@vercel/geistdocs 2.14.7 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.14.7","-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.15.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});
@@ -1 +1 @@
1
- {"version":3,"file":"command-prompt.d.ts","sourceRoot":"","sources":["../../src/components/command-prompt.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,wBAAwB,EAG7B,KAAK,GAAG,EACR,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAkCf,KAAK,sBAAsB,GAAG,IAAI,CAChC,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,CAOhD;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAwId;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,GAAG,CAAC,OAAO,GAAG,IAAI,CAEpB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,CAsFlD"}
1
+ {"version":3,"file":"command-prompt.d.ts","sourceRoot":"","sources":["../../src/components/command-prompt.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,wBAAwB,EAG7B,KAAK,GAAG,EACR,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAmCf,KAAK,sBAAsB,GAAG,IAAI,CAChC,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,CACX,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CA0EtC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,KAAK,CA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C,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,CAmClD"}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { AnimatePresence, motion, useReducedMotion } from "motion/react";
4
3
  import { useSize } from "phase/react";
5
4
  import { Children, createContext, isValidElement, useContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
6
5
  import { IconCheck } from "#geistdocs-assets/icons/icon-check";
7
6
  import { IconCopy } from "#geistdocs-assets/icons/icon-copy";
8
7
  import { cn } from "#geistdocs-ui/utils";
8
+ import { observeWidthTransition } from "../internal/command-prompt-transition";
9
9
  const CommandPromptContext = createContext(null);
10
10
  function useCommandPromptContext(component) {
11
11
  const context = useContext(CommandPromptContext);
@@ -88,8 +88,11 @@ export function CommandPromptTriggerDivider({ className, ...props }) {
88
88
  }
89
89
  export function CommandPromptSurface({ className, onClick, children, }) {
90
90
  const context = useCommandPromptContext("CommandPrompt.Surface");
91
- const shouldReduceMotion = useReducedMotion();
92
- return (_jsx(motion.div, { className: cn("group material-small relative flex max-w-[calc(100vw-48px)] items-center gap-1 rounded-full py-2 pr-3 pl-5 transition-colors", className), layout: true, onClick: (event) => {
91
+ return (
92
+ // biome-ignore lint/a11y/noNoninteractiveElementInteractions: pointer shortcut for CommandPrompt.Copy, which is the keyboard control
93
+ // biome-ignore lint/a11y/noStaticElementInteractions: pointer shortcut for CommandPrompt.Copy, which is the keyboard control
94
+ // biome-ignore lint/a11y/useKeyWithClickEvents: pointer shortcut for CommandPrompt.Copy, which is the keyboard control
95
+ _jsx("div", { className: cn("group material-small relative flex max-w-[calc(100vw-48px)] items-center gap-1 rounded-full py-2 pr-3 pl-5 transition-colors", className), onClick: (event) => {
93
96
  onClick?.(event);
94
97
  if (event.defaultPrevented) {
95
98
  return;
@@ -98,16 +101,16 @@ export function CommandPromptSurface({ className, onClick, children, }) {
98
101
  return;
99
102
  }
100
103
  context.copyActiveValue();
101
- }, transition: shouldReduceMotion
102
- ? { duration: 0 }
103
- : { type: "spring", bounce: 0, duration: 0.4 }, children: children }));
104
+ }, children: children }));
104
105
  }
105
106
  export function CommandPromptPrefix({ className, ...props }) {
106
107
  return (_jsx("span", { className: cn("block pr-1 text-gray-500 text-label-16-mono!", className), ...props }));
107
108
  }
109
+ // A critically damped spring that settles in 400ms, sampled into linear() stops.
110
+ const WIDTH_SPRING_EASING = "linear(0, 0.015 2%, 0.066 4.5%, 0.186 8.5%, 0.465 17%, 0.609 22.25%, 0.725 27.75%, 0.814 33.5%, 0.883 40%, 0.937 48.25%, 0.975 60.25%, 0.995 81.25%, 1)";
108
111
  export function CommandPromptViewport({ className, children, }) {
109
112
  const context = useCommandPromptContext("CommandPrompt.Viewport");
110
- const shouldReduceMotion = useReducedMotion();
113
+ const viewportRef = useRef(null);
111
114
  const { commandWidth, canShowGradient, isOverflowing, setActiveCopyValue, setCanShowGradient, setCommandWidth, setIsOverflowing, } = context;
112
115
  const { ref: measureRef } = useSize({
113
116
  onResize: ({ width }) => setCommandWidth(width),
@@ -131,46 +134,69 @@ export function CommandPromptViewport({ className, children, }) {
131
134
  .filter((child) => typeof child === "string" || typeof child === "number")
132
135
  .join("");
133
136
  const copyValue = activeItem?.copyValue ?? fallbackCopyValue;
134
- // biome-ignore lint/correctness/useExhaustiveDependencies: copyValue must reset the overflow/gradient state when the active command changes.
137
+ const previousCommandRef = useRef(null);
138
+ const [mountCopyValue] = useState(copyValue);
139
+ const [animateEnter, setAnimateEnter] = useState(false);
140
+ if (!animateEnter && copyValue !== mountCopyValue) {
141
+ setAnimateEnter(true);
142
+ }
135
143
  useLayoutEffect(() => {
144
+ const previousCommand = previousCommandRef.current;
145
+ previousCommandRef.current = { copyValue, width: commandWidth };
146
+ if (previousCommand?.copyValue === copyValue) {
147
+ return;
148
+ }
136
149
  setIsOverflowing(false);
137
- setCanShowGradient(Boolean(shouldReduceMotion));
138
- }, [copyValue, setCanShowGradient, setIsOverflowing, shouldReduceMotion]);
150
+ // Equal-width commands keep the current gate, including an in-flight transition.
151
+ if (measureRef.current?.getBoundingClientRect().width !==
152
+ previousCommand?.width) {
153
+ setCanShowGradient(false);
154
+ }
155
+ }, [
156
+ commandWidth,
157
+ copyValue,
158
+ measureRef,
159
+ setCanShowGradient,
160
+ setIsOverflowing,
161
+ ]);
162
+ useEffect(() => {
163
+ const viewport = viewportRef.current;
164
+ if (commandWidth === undefined || !viewport) {
165
+ return;
166
+ }
167
+ return observeWidthTransition(viewport, () => {
168
+ // Layout effects record a newer width before passive-effect cleanup runs.
169
+ if (previousCommandRef.current?.width === commandWidth) {
170
+ setCanShowGradient(true);
171
+ }
172
+ });
173
+ }, [commandWidth, setCanShowGradient]);
139
174
  useEffect(() => {
140
175
  setActiveCopyValue(copyValue);
141
176
  return () => {
142
177
  setIsOverflowing(false);
143
178
  };
144
179
  }, [copyValue, setActiveCopyValue, setIsOverflowing]);
145
- return (_jsxs(motion.span, { animate: commandWidth === undefined
146
- ? undefined
147
- : { width: shouldReduceMotion ? "auto" : commandWidth }, className: cn("relative block min-w-0 overflow-hidden text-gray-1000 text-label-14-mono!", className), initial: false, onAnimationComplete: () => {
148
- setCanShowGradient(true);
149
- }, transition: shouldReduceMotion
150
- ? { duration: 0 }
151
- : { type: "spring", bounce: 0, duration: 0.4 }, children: [_jsx("span", { "aria-hidden": true, className: "pointer-events-none invisible absolute whitespace-nowrap", ref: measureRef, children: command }), _jsx(AnimatePresence, { initial: false, mode: "wait", children: Children.toArray(children).map((child) => {
152
- if (!isValidElement(child)) {
153
- return null;
154
- }
155
- if (child.props.value !== context.value) {
156
- return null;
180
+ return (_jsxs("span", { className: cn("relative block min-w-0 overflow-hidden text-gray-1000 text-label-14-mono! transition-[width] duration-400 motion-reduce:w-auto! motion-reduce:transition-none", className), ref: viewportRef, style: {
181
+ width: commandWidth,
182
+ transitionTimingFunction: WIDTH_SPRING_EASING,
183
+ }, children: [_jsx("span", { "aria-hidden": true, className: "pointer-events-none invisible absolute whitespace-nowrap", ref: measureRef, children: command }), activeItem && (_jsx("span", { className: cn("block min-w-0 whitespace-nowrap py-2", animateEnter &&
184
+ "fade-in animate-in blur-in-1 duration-150 ease-[ease-out] motion-reduce:animate-none", canShowGradient && isOverflowing
185
+ ? "overflow-x-auto"
186
+ : "overflow-x-hidden", activeItem.className), ref: (element) => {
187
+ activeContentRef.current = element;
188
+ if (element) {
189
+ setIsOverflowing(element.scrollWidth > element.clientWidth);
157
190
  }
158
- return (_jsx(motion.span, { animate: { opacity: 1, filter: "blur(0px)" }, className: cn("block min-w-0 whitespace-nowrap py-2", canShowGradient && isOverflowing
159
- ? "overflow-x-auto"
160
- : "overflow-x-hidden", child.props.className), exit: { opacity: 0, filter: "blur(1px)" }, initial: { opacity: 0, filter: "blur(1px)" }, ref: (element) => {
161
- activeContentRef.current = element;
162
- if (element) {
163
- setIsOverflowing(element.scrollWidth > element.clientWidth);
164
- }
165
- }, transition: shouldReduceMotion ? { duration: 0 } : { duration: 0.15 }, children: child.props.children }, copyValue));
166
- }) }), _jsx(AnimatePresence, { children: canShowGradient && isOverflowing && (_jsx(motion.span, { animate: { opacity: 1 }, "aria-hidden": true, className: "pointer-events-none absolute top-0 right-0 bottom-0 z-10 block w-4 bg-gradient-to-r from-transparent to-background-100", exit: { opacity: 0 }, initial: { opacity: 0 }, transition: shouldReduceMotion ? { duration: 0 } : { duration: 0.2 } })) })] }));
191
+ }, children: activeItem.children }, copyValue)), _jsx("span", { "aria-hidden": true, className: cn("pointer-events-none absolute top-0 right-0 bottom-0 z-10 block w-4 bg-gradient-to-r from-transparent to-background-100 transition-opacity duration-200 ease-[ease-out] motion-reduce:transition-none", canShowGradient && isOverflowing ? "opacity-100" : "opacity-0") })] }));
167
192
  }
168
193
  export function CommandPromptContent(_props) {
169
194
  return null;
170
195
  }
196
+ const iconClassName = "absolute inset-0 flex items-center justify-center transition-[opacity,scale,filter] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none";
197
+ const hiddenIconClassName = "scale-50 opacity-0 blur-[1px]";
171
198
  export function CommandPromptCopy({ className, onClick, ...props }) {
172
199
  const context = useCommandPromptContext("CommandPrompt.Copy");
173
- const shouldReduceMotion = useReducedMotion();
174
200
  return (_jsxs("button", { "aria-label": context.copied ? "Copied" : "Copy command", className: cn("relative flex size-8 shrink-0 translate-x-0.5 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-gray-1000", "hover:!bg-gray-alpha-200 touch-manipulation transition-colors group-hover:bg-gray-alpha-100", "outline-2 outline-transparent outline-offset-2 focus-visible:outline-[var(--ds-focus-color)]", className), onClick: (event) => {
175
201
  onClick?.(event);
176
202
  if (event.defaultPrevented) {
@@ -178,33 +204,5 @@ export function CommandPromptCopy({ className, onClick, ...props }) {
178
204
  }
179
205
  event.stopPropagation();
180
206
  context.copyActiveValue();
181
- }, type: "button", ...props, children: [_jsx(AnimatePresence, { initial: false, children: !context.copied && (_jsx(motion.span, { animate: {
182
- opacity: 1,
183
- transform: "scale(1)",
184
- filter: "blur(0px)",
185
- }, className: "absolute inset-0 flex items-center justify-center", exit: {
186
- opacity: 0,
187
- transform: "scale(0.5)",
188
- filter: "blur(1px)",
189
- }, initial: {
190
- opacity: 0,
191
- transform: "scale(0.5)",
192
- filter: "blur(1px)",
193
- }, transition: shouldReduceMotion
194
- ? { duration: 0 }
195
- : { duration: 0.2, ease: [0.23, 1, 0.32, 1] }, children: _jsx(IconCopy, { className: "block", size: 16 }) }, "copy")) }), _jsx(AnimatePresence, { initial: false, children: context.copied && (_jsx(motion.span, { animate: {
196
- opacity: 1,
197
- transform: "scale(1)",
198
- filter: "blur(0px)",
199
- }, className: "absolute inset-0 flex items-center justify-center", exit: {
200
- opacity: 0,
201
- transform: "scale(0.5)",
202
- filter: "blur(1px)",
203
- }, initial: {
204
- opacity: 0,
205
- transform: "scale(0.5)",
206
- filter: "blur(1px)",
207
- }, transition: shouldReduceMotion
208
- ? { duration: 0 }
209
- : { duration: 0.2, ease: [0.23, 1, 0.32, 1] }, children: _jsx(IconCheck, { className: "block", size: 16 }) }, "check")) })] }));
207
+ }, type: "button", ...props, children: [_jsx("span", { className: cn(iconClassName, context.copied && hiddenIconClassName), children: _jsx(IconCopy, { className: "block", size: 16 }) }), _jsx("span", { className: cn(iconClassName, !context.copied && hiddenIconClassName), children: _jsx(IconCheck, { className: "block", size: 16 }) })] }));
210
208
  }
@@ -0,0 +1,10 @@
1
+ export interface ChatRateLimitOptions {
2
+ /**
3
+ * Published Vercel Firewall SDK rate limit IDs to check per request.
4
+ * Must contain at least one non-empty ID. Every check must pass.
5
+ * Limits and counting windows are configured in the site's Vercel project.
6
+ */
7
+ ids: string[];
8
+ }
9
+ export declare const createChatRateLimiter: (options?: ChatRateLimitOptions) => ((request: Request) => Promise<Response | undefined>) | undefined;
10
+ //# sourceMappingURL=chat-rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-rate-limit.d.ts","sourceRoot":"","sources":["../../src/internal/chat-rate-limit.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,eAAO,MAAM,qBAAqB,GAAI,UAAU,oBAAoB,gBAmB3C,OAAO,KAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,aA4B/D,CAAC"}
@@ -0,0 +1,35 @@
1
+ export const createChatRateLimiter = (options) => {
2
+ if (options === undefined) {
3
+ return;
4
+ }
5
+ if (!(options && Array.isArray(options.ids)) ||
6
+ options.ids.length === 0 ||
7
+ !options.ids.every((id) => typeof id === "string" && id.trim().length > 0)) {
8
+ throw new Error("createChatRoute rateLimit.ids must be a non-empty array of non-empty strings.");
9
+ }
10
+ // Snapshot and deduplicate IDs so configuration changes cannot bypass checks
11
+ // or cause the same request to consume one bucket more than once.
12
+ const ids = [...new Set(options.ids)];
13
+ return async (request) => {
14
+ try {
15
+ const { checkRateLimit } = await import("@vercel/firewall");
16
+ const results = await Promise.all(ids.map((id) => checkRateLimit(id, { request, timeout: 1000 })));
17
+ if (results.some(({ rateLimited }) => rateLimited)) {
18
+ return new Response("Too many chat requests. Please try again later.", {
19
+ status: 429,
20
+ headers: { "Cache-Control": "no-store" },
21
+ });
22
+ }
23
+ if (results.some(({ error }) => error)) {
24
+ throw new Error("Ask AI firewall rate limit rules are not configured");
25
+ }
26
+ }
27
+ catch (error) {
28
+ console.error("Ask AI rate limit check failed:", error);
29
+ return new Response("Chat is temporarily unavailable. Please try again later.", {
30
+ status: 503,
31
+ headers: { "Cache-Control": "no-store" },
32
+ });
33
+ }
34
+ };
35
+ };
@@ -0,0 +1,2 @@
1
+ export declare const observeWidthTransition: (element: HTMLElement, onSettled: () => void) => () => void;
2
+ //# sourceMappingURL=command-prompt-transition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-prompt-transition.d.ts","sourceRoot":"","sources":["../../src/internal/command-prompt-transition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,GACjC,SAAS,WAAW,EACpB,WAAW,MAAM,IAAI,eAyBtB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export const observeWidthTransition = (element, onSettled) => {
2
+ let active = true;
3
+ const transitions = element
4
+ .getAnimations()
5
+ .filter((animation) => "transitionProperty" in animation &&
6
+ animation.transitionProperty === "width");
7
+ const settle = () => {
8
+ if (active) {
9
+ onSettled();
10
+ }
11
+ };
12
+ // Reduced motion can cancel a transition without starting a replacement.
13
+ Promise.all(transitions.map((transition) => transition.finished)).then(settle, settle);
14
+ return () => {
15
+ active = false;
16
+ };
17
+ };
@@ -1,5 +1,6 @@
1
1
  import { type LanguageModel } from "ai";
2
2
  import { type GeistdocsConfig } from "../config";
3
+ import { type ChatRateLimitOptions } from "../internal/chat-rate-limit";
3
4
  import { type ChatMixedbreadOptions } from "../internal/chat-retrieval";
4
5
  import { type EveAgentClientContext } from "../internal/eve-agent";
5
6
  import { type GeistdocsPageFilter } from "../page-visibility";
@@ -125,8 +126,8 @@ interface CreateChatRouteOptions {
125
126
  /** Narrows the stable public corpus available to Ask AI. */
126
127
  filterPage?: GeistdocsPageFilter;
127
128
  /**
128
- * Request size caps applied before any model, proxy, or agent call. Rate
129
- * limiting is not included; wrap the route with your own.
129
+ * Request size caps applied before any model, proxy, or agent call.
130
+ * Use `rateLimit` to also limit request frequency with Vercel Firewall.
130
131
  */
131
132
  limits?: ChatRequestLimits;
132
133
  /**
@@ -139,14 +140,22 @@ interface CreateChatRouteOptions {
139
140
  * Accepts any AI SDK `LanguageModel`, including AI Gateway model strings
140
141
  * such as `"xai/grok-4.5"`. Ignored in proxy and eve agent modes, where
141
142
  * the external service selects the model. Defaults to
142
- * `"openai/gpt-5.6-sol"`.
143
+ * `"openai/gpt-6-luna"`.
143
144
  */
144
145
  model?: LanguageModel;
145
146
  proxy?: ChatProxyConfig;
147
+ /**
148
+ * Opt-in Vercel Firewall SDK checks, using the platform-provided client IP.
149
+ * Publish each ID in the site's Vercel project before enabling. Checks run
150
+ * before every POST, including eve prewarming, with a one-second timeout.
151
+ * Limited requests receive 429; missing rules and failed checks receive 503.
152
+ * Omit to disable. The SDK skips checks outside production mode.
153
+ */
154
+ rateLimit?: ChatRateLimitOptions;
146
155
  source?: SourceBundle;
147
156
  sources?: SourceBundle[];
148
157
  }
149
- export declare const createChatRoute: ({ config, contextInjection, eveAgent, filterPage, limits, mixedbread, model, proxy, source, sources, }: CreateChatRouteOptions) => {
158
+ export declare const createChatRoute: ({ config, contextInjection, eveAgent, filterPage, limits, mixedbread, model, proxy, rateLimit, source, sources, }: CreateChatRouteOptions) => {
150
159
  POST: (req: Request) => Promise<Response>;
151
160
  maxDuration: 800;
152
161
  };
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,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,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,UAAU,sBAAsB;IAC9B,MAAM,EAAE,IAAI,CACV,eAAe,EACb,IAAI,GACJ,UAAU,GACV,iBAAiB,GACjB,QAAQ,GACR,SAAS,GACT,cAAc,CACjB,CAAC;IACF;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AA2uDD,eAAO,MAAM,eAAe,GAAI,mHAY7B,sBAAsB;gBAsNL,OAAO;;CAI1B,CAAC"}
@@ -5,11 +5,12 @@ import { z } from "zod";
5
5
  import { getPublicPath } from "../config";
6
6
  import { MAX_USER_MESSAGE_CHARS } from "../internal/chat/message-text";
7
7
  import { createSourceChunk, createSourceChunks, } from "../internal/chat/source-chunks";
8
+ import { createChatRateLimiter, } from "../internal/chat-rate-limit";
8
9
  import { createChatDocumentSearch, } from "../internal/chat-retrieval";
9
10
  import { buildEveAgentTranscript, capLastUserMessageText, createEmptyEveAgentSession, getEveAgentMessageMetadata, hasPriorEveAgentTurn, normalizeAgentUrl, prewarmExistingEveAgentSession, resolveEveAgentUrl, startOrContinueEveAgentSession, streamEveAgentTurn, } from "../internal/eve-agent";
10
11
  import { CHAT_SECRET_ENV, createEveAgentSessionCookieCodec, EVE_AGENT_SESSION_COOKIE, isSameSessionTag, readCookieValues, serializeEveAgentSessionCookie, } from "../internal/eve-agent-session-cookie";
11
12
  import { isPageVisibleForSurface, } from "../page-visibility";
12
- const DEFAULT_CHAT_MODEL = "openai/gpt-5.6-sol";
13
+ const DEFAULT_CHAT_MODEL = "openai/gpt-6-luna";
13
14
  const DEFAULT_MAX_REQUEST_BYTES = 1_000_000;
14
15
  const DEFAULT_MAX_MESSAGES = 200;
15
16
  const DEFAULT_MAX_MESSAGE_PARTS = 2000;
@@ -1110,8 +1111,9 @@ const validateRouteOptions = ({ contextInjection, eveAgent, }) => {
1110
1111
  throw new Error("createChatRoute eveAgent.visibleTools must be an array of tool names.");
1111
1112
  }
1112
1113
  };
1113
- export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, filterPage, limits, mixedbread, model = DEFAULT_CHAT_MODEL, proxy, source, sources, }) => {
1114
+ export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, filterPage, limits, mixedbread, model = DEFAULT_CHAT_MODEL, proxy, rateLimit, source, sources, }) => {
1114
1115
  validateRouteOptions({ contextInjection, eveAgent });
1116
+ const rateLimiter = createChatRateLimiter(rateLimit);
1115
1117
  const { defaultLanguage, languages } = getLanguages(config);
1116
1118
  const routeSources = resolveSources(source, sources);
1117
1119
  const searchDocuments = createDocumentSearch({
@@ -1284,7 +1286,9 @@ export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, f
1284
1286
  }
1285
1287
  };
1286
1288
  return {
1287
- POST,
1289
+ POST: rateLimiter
1290
+ ? async (req) => (await rateLimiter(req)) ?? POST(req)
1291
+ : POST,
1288
1292
  maxDuration: 800,
1289
1293
  };
1290
1294
  };
@@ -188,7 +188,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
188
188
  rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins),
189
189
  rehypeCodeOptions: {
190
190
  ...config.mdxOptions?.rehypeCodeOptions,
191
- themes: { light: geistShikiTheme, dark: geistShikiTheme },
191
+ themes: { light: geistShikiTheme },
192
192
  defaultColor: "light",
193
193
  },
194
194
  },
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.14.7 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 2.15.0 so agents can understand the installed package without web access.
4
4
  They are generated from `apps/template/content/docs` during the package build.
5
5
 
6
6
  ## How to use these files
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.14.7.
3
+ These docs are bundled with `@vercel/geistdocs` 2.15.0.
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
@@ -3938,7 +3938,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
3938
3938
 
3939
3939
  The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
3940
3940
 
3941
- Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account and has no built-in rate limit. Set `endpoints: { chat: false }` if that is not acceptable for your site.
3941
+ Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
3942
3942
 
3943
3943
  ## Select the article in rendered HTML
3944
3944
 
@@ -4263,7 +4263,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
4263
4263
 
4264
4264
  #### Choose a model
4265
4265
 
4266
- Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-5.6-sol`.
4266
+ Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-6-luna` in standard mode.
4267
4267
 
4268
4268
  ```ts title="app/api/chat/route.ts"
4269
4269
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
@@ -4646,28 +4646,33 @@ export const { POST, maxDuration } = createChatRoute({
4646
4646
 
4647
4647
  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.
4648
4648
 
4649
- 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`:
4649
+ ## Rate limiting
4650
+
4651
+ Request size limits don't control how often a client can call the route. Opt in to Vercel Firewall with `createChatRoute({ rateLimit: { ids: ["ask-ai"] } })`. Geistdocs includes the SDK and handles checks, timeouts, and error responses; no app-level SDK dependency or `POST` wrapper is required. Upgrading alone does not enable rate limiting.
4652
+
4653
+ First, publish a [Firewall SDK rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the ID `ask-ai` in the consumer site's Vercel project. Use the `@vercel/firewall` condition (`rate_limit_api_id`), count by `header:x-vercel-rate-limit-key` for the SDK's default per-client-IP buckets, and choose the request limit and window for your site. Start in log mode, verify enforcement in preview, then switch the exceeded-limit action to `rate_limit` in production. Installing Geistdocs does not create these project rules.
4654
+
4655
+ Then enable the rule in the chat route:
4650
4656
 
4651
4657
  ```ts title="app/api/chat/route.ts"
4652
- import { checkRateLimit } from "@vercel/firewall";
4653
4658
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
4654
4659
  import { config } from "@/lib/geistdocs/config";
4655
4660
  import { geistdocsSource } from "@/lib/geistdocs/source";
4656
4661
 
4657
- const chat = createChatRoute({ config, sources: [geistdocsSource] });
4662
+ export const { POST, maxDuration } = createChatRoute({
4663
+ config,
4664
+ sources: [geistdocsSource],
4665
+ rateLimit: { ids: ["ask-ai"] },
4666
+ });
4667
+ ```
4658
4668
 
4659
- export const maxDuration = 800;
4669
+ For separate burst and hourly limits, publish two rules and pass both IDs, for example `rateLimit: { ids: ["ask-ai-minute", "ask-ai-hour"] }`. Every check must pass; duplicate IDs are checked once. Empty lists and blank IDs throw at route creation.
4660
4670
 
4661
- export const POST = async (request: Request) => {
4662
- const { rateLimited } = await checkRateLimit("ask-ai", { request });
4671
+ When enabled, checks run before every chat POST in AI Gateway, proxy, and eve agent modes, including prewarm requests. Prewarming and sending each count as a request, so allow for both when choosing limits. Checks run concurrently with a one-second timeout each. Limited requests receive `429`; missing rules, network failures, and timeouts receive `503` before any model, retrieval, proxy, or agent call. Both errors are uncached plain text, displayed by the chat's error toast.
4663
4672
 
4664
- if (rateLimited) {
4665
- return Response.json({ error: "Too many requests." }, { status: 429 });
4666
- }
4673
+ Omit `rateLimit` to keep the existing behavior without firewall calls. The SDK skips checks when `NODE_ENV` is not `production`; `next dev` needs no rules. Local `next start` needs Vercel request headers and firewall access. Protected Vercel previews require Protection Bypass for Automation and exposed system environment variables. Counters are per region, not a global spending cap.
4667
4674
 
4668
- return chat.POST(request);
4669
- };
4670
- ```
4675
+ If your site already wraps `POST` with these SDK checks, replace the wrapper with `rateLimit` after upgrading and keep the same published rule IDs. Remove the app's direct `@vercel/firewall` dependency only if no other route uses it. Do not keep both checks, or each request will be counted twice.
4671
4676
 
4672
4677
  ## Features
4673
4678
 
@@ -4734,7 +4739,7 @@ The chat interface adapts to different screen sizes:
4734
4739
 
4735
4740
  The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set for the default AI Gateway mode. Set `GEISTDOCS_CHAT_PROXY_URL` to route Ask AI through a Vertex-backed proxy instead. Eve agent mode needs `GEISTDOCS_CHAT_SECRET` for multi-turn sessions and prewarming. You can read more in the [Environment Variables](/docs/env) section.
4736
4741
 
4737
- In default AI Gateway mode, Geistdocs uses `openai/gpt-5.6-sol` via the Vercel AI Gateway. In Vertex-backed proxy mode, the configured proxy controls the upstream model.
4742
+ In default AI Gateway mode, Geistdocs uses `openai/gpt-6-luna` via the Vercel AI Gateway. In proxy and eve agent modes, the external responder controls the upstream model.
4738
4743
 
4739
4744
  ## Suggested Prompts
4740
4745
 
@@ -467,5 +467,5 @@
467
467
  }
468
468
  ],
469
469
  "source": "apps/template/content/docs",
470
- "version": "2.14.7"
470
+ "version": "2.15.0"
471
471
  }
@@ -162,7 +162,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
162
162
 
163
163
  The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
164
164
 
165
- Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account and has no built-in rate limit. Set `endpoints: { chat: false }` if that is not acceptable for your site.
165
+ Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
166
166
 
167
167
  ## Select the article in rendered HTML
168
168
 
@@ -301,7 +301,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
301
301
 
302
302
  #### Choose a model
303
303
 
304
- Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-5.6-sol`.
304
+ Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-6-luna` in standard mode.
305
305
 
306
306
  ```ts title="app/api/chat/route.ts"
307
307
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
@@ -684,28 +684,33 @@ export const { POST, maxDuration } = createChatRoute({
684
684
 
685
685
  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.
686
686
 
687
- 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`:
687
+ ## Rate limiting
688
+
689
+ Request size limits don't control how often a client can call the route. Opt in to Vercel Firewall with `createChatRoute({ rateLimit: { ids: ["ask-ai"] } })`. Geistdocs includes the SDK and handles checks, timeouts, and error responses; no app-level SDK dependency or `POST` wrapper is required. Upgrading alone does not enable rate limiting.
690
+
691
+ First, publish a [Firewall SDK rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the ID `ask-ai` in the consumer site's Vercel project. Use the `@vercel/firewall` condition (`rate_limit_api_id`), count by `header:x-vercel-rate-limit-key` for the SDK's default per-client-IP buckets, and choose the request limit and window for your site. Start in log mode, verify enforcement in preview, then switch the exceeded-limit action to `rate_limit` in production. Installing Geistdocs does not create these project rules.
692
+
693
+ Then enable the rule in the chat route:
688
694
 
689
695
  ```ts title="app/api/chat/route.ts"
690
- import { checkRateLimit } from "@vercel/firewall";
691
696
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
692
697
  import { config } from "@/lib/geistdocs/config";
693
698
  import { geistdocsSource } from "@/lib/geistdocs/source";
694
699
 
695
- const chat = createChatRoute({ config, sources: [geistdocsSource] });
700
+ export const { POST, maxDuration } = createChatRoute({
701
+ config,
702
+ sources: [geistdocsSource],
703
+ rateLimit: { ids: ["ask-ai"] },
704
+ });
705
+ ```
696
706
 
697
- export const maxDuration = 800;
707
+ For separate burst and hourly limits, publish two rules and pass both IDs, for example `rateLimit: { ids: ["ask-ai-minute", "ask-ai-hour"] }`. Every check must pass; duplicate IDs are checked once. Empty lists and blank IDs throw at route creation.
698
708
 
699
- export const POST = async (request: Request) => {
700
- const { rateLimited } = await checkRateLimit("ask-ai", { request });
709
+ When enabled, checks run before every chat POST in AI Gateway, proxy, and eve agent modes, including prewarm requests. Prewarming and sending each count as a request, so allow for both when choosing limits. Checks run concurrently with a one-second timeout each. Limited requests receive `429`; missing rules, network failures, and timeouts receive `503` before any model, retrieval, proxy, or agent call. Both errors are uncached plain text, displayed by the chat's error toast.
701
710
 
702
- if (rateLimited) {
703
- return Response.json({ error: "Too many requests." }, { status: 429 });
704
- }
711
+ Omit `rateLimit` to keep the existing behavior without firewall calls. The SDK skips checks when `NODE_ENV` is not `production`; `next dev` needs no rules. Local `next start` needs Vercel request headers and firewall access. Protected Vercel previews require Protection Bypass for Automation and exposed system environment variables. Counters are per region, not a global spending cap.
705
712
 
706
- return chat.POST(request);
707
- };
708
- ```
713
+ If your site already wraps `POST` with these SDK checks, replace the wrapper with `rateLimit` after upgrading and keep the same published rule IDs. Remove the app's direct `@vercel/firewall` dependency only if no other route uses it. Do not keep both checks, or each request will be counted twice.
709
714
 
710
715
  ## Features
711
716
 
@@ -772,7 +777,7 @@ The chat interface adapts to different screen sizes:
772
777
 
773
778
  The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set for the default AI Gateway mode. Set `GEISTDOCS_CHAT_PROXY_URL` to route Ask AI through a Vertex-backed proxy instead. Eve agent mode needs `GEISTDOCS_CHAT_SECRET` for multi-turn sessions and prewarming. You can read more in the [Environment Variables](/docs/env) section.
774
779
 
775
- In default AI Gateway mode, Geistdocs uses `openai/gpt-5.6-sol` via the Vercel AI Gateway. In Vertex-backed proxy mode, the configured proxy controls the upstream model.
780
+ In default AI Gateway mode, Geistdocs uses `openai/gpt-6-luna` via the Vercel AI Gateway. In proxy and eve agent modes, the external responder controls the upstream model.
776
781
 
777
782
  ## Suggested Prompts
778
783
 
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.14.7",
4
+ "version": "2.15.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -311,6 +311,7 @@
311
311
  "@types/mdx": "^2.0.13",
312
312
  "@types/react": "^19.2.7",
313
313
  "@vercel/agent-readability": "^0.7.0",
314
+ "@vercel/firewall": "^1.2.6",
314
315
  "@vercel/oidc": "^3.4.1",
315
316
  "ai": "^6.0.132",
316
317
  "class-variance-authority": "^0.7.1",
@@ -324,7 +325,6 @@
324
325
  "glob": "^11.0.0",
325
326
  "mcp-handler": "2.2.0",
326
327
  "mermaid": "^11.12.2",
327
- "motion": "^12.23.25",
328
328
  "next-themes": "^0.4.6",
329
329
  "phase": "^0.5.4",
330
330
  "radix-ui": "1.6.4",
package/source-config.js CHANGED
@@ -300,7 +300,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
300
300
  ),
301
301
  rehypeCodeOptions: {
302
302
  ...config.mdxOptions?.rehypeCodeOptions,
303
- themes: { light: geistShikiTheme, dark: geistShikiTheme },
303
+ themes: { light: geistShikiTheme },
304
304
  defaultColor: "light",
305
305
  },
306
306
  },
@@ -77,7 +77,7 @@ Use these instructions when an AI coding agent edits this project.
77
77
  - Mixedbread failures fall back to local Orama retrieval. Keep the local source definitions and `excludeFrom: [chat]` visibility behavior intact.
78
78
  - Set `ai.eveAgent: { url }` in `geistdocs.tsx` to answer Ask AI with a hosted eve framework agent instead. The URL flows through the config object; the route file needs no changes. Set `prewarm: true` for eve 0.59+ responders when the site should prepare an empty durable session as the chat client loads. Requests authenticate with a per-request Vercel OIDC bearer token by default; pass server-only headers through the `eveAgent` option on `createChatRoute` for custom auth. Never put auth material in `geistdocs.tsx`. Configuring both `proxy` and an eve agent throws at route creation.
79
79
  - Set the server-only `GEISTDOCS_CHAT_SECRET` (at least 32 bytes, generate with `openssl rand -base64 32`) for eve agent mode. It signs the httpOnly `geistdocs_eve_session` cookie that binds a browser to its eve session (the cookie is `SameSite=Strict`, so keep the chat route on the same site as the docs pages); without it every turn starts a new eve session and prewarm requests are refused. Never prefix it with `NEXT_PUBLIC_` or put it in `geistdocs.tsx`.
80
- - `createChatRoute` caps request size (1,000,000-byte body, 200 messages, 200,000-character `pageContext.content` by default; override with the `limits` option). It does not rate limit, so wrap `POST` with the site's own rate limiting.
80
+ - `createChatRoute` caps request size (1,000,000-byte body, 200 messages, 200,000-character `pageContext.content` by default; override with the `limits` option). Opt in to Vercel Firewall with `rateLimit: { ids: ["ask-ai"] }` after publishing matching SDK rules in the site's Vercel project. Geistdocs owns the SDK checks and returns 429 when limited or 503 when checks fail. Omit `rateLimit` to leave it disabled; remove equivalent app-level checks when adopting it to avoid double counting.
81
81
  - Geistdocs Ask AI targets AI SDK v6: `ai` v6 and `@ai-sdk/react` v3. Keep those dependencies on the generated package versions unless a `@vercel/geistdocs` release changes them.
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`.
@@ -160,7 +160,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
160
160
 
161
161
  The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
162
162
 
163
- Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account and has no built-in rate limit. Set `endpoints: { chat: false }` if that is not acceptable for your site.
163
+ Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
164
164
 
165
165
  ## Select the article in rendered HTML
166
166
 
@@ -290,7 +290,7 @@ export const SignedInAskAIUser = () => {
290
290
 
291
291
  The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set, which you can read more about in the [环境变量](/docs/env) section.
292
292
 
293
- The model used is `openai/gpt-5.6-sol` via the Vercel AI Gateway.
293
+ The default model is `openai/gpt-6-luna` via the Vercel AI Gateway.
294
294
 
295
295
  ### 使用 `GEISTDOCS_CHAT_SECRET` 保持 eve 会话
296
296
 
@@ -299,7 +299,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
299
299
 
300
300
  #### Choose a model
301
301
 
302
- Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-5.6-sol`.
302
+ Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-6-luna` in standard mode.
303
303
 
304
304
  ```ts title="app/api/chat/route.ts"
305
305
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
@@ -682,28 +682,33 @@ export const { POST, maxDuration } = createChatRoute({
682
682
 
683
683
  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.
684
684
 
685
- 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`:
685
+ ## Rate limiting
686
+
687
+ Request size limits don't control how often a client can call the route. Opt in to Vercel Firewall with `createChatRoute({ rateLimit: { ids: ["ask-ai"] } })`. Geistdocs includes the SDK and handles checks, timeouts, and error responses; no app-level SDK dependency or `POST` wrapper is required. Upgrading alone does not enable rate limiting.
688
+
689
+ First, publish a [Firewall SDK rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the ID `ask-ai` in the consumer site's Vercel project. Use the `@vercel/firewall` condition (`rate_limit_api_id`), count by `header:x-vercel-rate-limit-key` for the SDK's default per-client-IP buckets, and choose the request limit and window for your site. Start in log mode, verify enforcement in preview, then switch the exceeded-limit action to `rate_limit` in production. Installing Geistdocs does not create these project rules.
690
+
691
+ Then enable the rule in the chat route:
686
692
 
687
693
  ```ts title="app/api/chat/route.ts"
688
- import { checkRateLimit } from "@vercel/firewall";
689
694
  import { createChatRoute } from "@vercel/geistdocs/routes/chat";
690
695
  import { config } from "@/lib/geistdocs/config";
691
696
  import { geistdocsSource } from "@/lib/geistdocs/source";
692
697
 
693
- const chat = createChatRoute({ config, sources: [geistdocsSource] });
698
+ export const { POST, maxDuration } = createChatRoute({
699
+ config,
700
+ sources: [geistdocsSource],
701
+ rateLimit: { ids: ["ask-ai"] },
702
+ });
703
+ ```
694
704
 
695
- export const maxDuration = 800;
705
+ For separate burst and hourly limits, publish two rules and pass both IDs, for example `rateLimit: { ids: ["ask-ai-minute", "ask-ai-hour"] }`. Every check must pass; duplicate IDs are checked once. Empty lists and blank IDs throw at route creation.
696
706
 
697
- export const POST = async (request: Request) => {
698
- const { rateLimited } = await checkRateLimit("ask-ai", { request });
707
+ When enabled, checks run before every chat POST in AI Gateway, proxy, and eve agent modes, including prewarm requests. Prewarming and sending each count as a request, so allow for both when choosing limits. Checks run concurrently with a one-second timeout each. Limited requests receive `429`; missing rules, network failures, and timeouts receive `503` before any model, retrieval, proxy, or agent call. Both errors are uncached plain text, displayed by the chat's error toast.
699
708
 
700
- if (rateLimited) {
701
- return Response.json({ error: "Too many requests." }, { status: 429 });
702
- }
709
+ Omit `rateLimit` to keep the existing behavior without firewall calls. The SDK skips checks when `NODE_ENV` is not `production`; `next dev` needs no rules. Local `next start` needs Vercel request headers and firewall access. Protected Vercel previews require Protection Bypass for Automation and exposed system environment variables. Counters are per region, not a global spending cap.
703
710
 
704
- return chat.POST(request);
705
- };
706
- ```
711
+ If your site already wraps `POST` with these SDK checks, replace the wrapper with `rateLimit` after upgrading and keep the same published rule IDs. Remove the app's direct `@vercel/firewall` dependency only if no other route uses it. Do not keep both checks, or each request will be counted twice.
707
712
 
708
713
  ## Features
709
714
 
@@ -770,7 +775,7 @@ The chat interface adapts to different screen sizes:
770
775
 
771
776
  The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set for the default AI Gateway mode. Set `GEISTDOCS_CHAT_PROXY_URL` to route Ask AI through a Vertex-backed proxy instead. Eve agent mode needs `GEISTDOCS_CHAT_SECRET` for multi-turn sessions and prewarming. You can read more in the [Environment Variables](/docs/env) section.
772
777
 
773
- In default AI Gateway mode, Geistdocs uses `openai/gpt-5.6-sol` via the Vercel AI Gateway. In Vertex-backed proxy mode, the configured proxy controls the upstream model.
778
+ In default AI Gateway mode, Geistdocs uses `openai/gpt-6-luna` via the Vercel AI Gateway. In proxy and eve agent modes, the external responder controls the upstream model.
774
779
 
775
780
  ## Suggested Prompts
776
781
 
@@ -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.14.7",
20
+ "@vercel/geistdocs": "2.15.0",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",
@@ -30,7 +30,6 @@
30
30
  "geist": "1.7.1",
31
31
  "jotai": "^2.15.2",
32
32
  "mermaid": "^11.12.2",
33
- "motion": "^12.23.25",
34
33
  "nanoid": "^5.1.6",
35
34
  "next": "16.3.3",
36
35
  "next-themes": "^0.4.6",