@vercel/geistdocs 2.13.0 → 2.13.1-canary.dd9d47d
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/config.d.ts +11 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/footer.js +1 -1
- package/dist/internal/chat/session.d.ts +2 -3
- package/dist/internal/chat/session.d.ts.map +1 -1
- package/dist/internal/chat/session.js +28 -4
- package/dist/internal/chat/shell.js +2 -2
- package/dist/internal/eve-agent-session.d.ts +5 -7
- package/dist/internal/eve-agent-session.d.ts.map +1 -1
- package/dist/internal/eve-agent-session.js +5 -8
- package/dist/internal/eve-agent.d.ts +11 -3
- package/dist/internal/eve-agent.d.ts.map +1 -1
- package/dist/internal/eve-agent.js +19 -4
- package/dist/internal/navbar/desktop-menu.d.ts.map +1 -1
- package/dist/internal/navbar/desktop-menu.js +4 -4
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/internal/navbar/mobile-menu.js +4 -4
- package/dist/internal/navbar/use-nav-active.d.ts +12 -5
- package/dist/internal/navbar/use-nav-active.d.ts.map +1 -1
- package/dist/internal/navbar/use-nav-active.js +30 -14
- package/dist/internal/sidebar.d.ts +3 -1
- package/dist/internal/sidebar.d.ts.map +1 -1
- package/dist/internal/sidebar.js +8 -8
- package/dist/layout.d.ts +7 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +2 -2
- package/dist/navbar.d.ts +1 -1
- package/dist/navbar.d.ts.map +1 -1
- package/dist/navbar.js +3 -1
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +21 -4
- package/dist/routes/openapi.d.ts.map +1 -1
- package/dist/routes/openapi.js +10 -4
- package/docs/agents.md +1 -1
- package/docs/llms.txt +7 -3
- package/docs/manifest.json +1 -1
- package/docs/pages/ask-ai.md +5 -1
- package/docs/pages/configuration.md +1 -1
- package/package.json +6 -6
- package/template/content/docs/ask-ai.mdx +5 -1
- package/template/content/docs/configuration.mdx +1 -1
- 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.13.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.13.1-canary.dd9d47d","-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});
|
package/dist/config.d.ts
CHANGED
|
@@ -60,9 +60,10 @@ export interface GeistdocsFeatureConfig {
|
|
|
60
60
|
}
|
|
61
61
|
export interface GeistdocsEveAgentConfig {
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* Prepare an eve session when the reader starts typing each question.
|
|
64
|
+
* Fresh sessions require eve 0.59+; preparing an existing conversation
|
|
65
|
+
* requires eve 0.83+ and never delays Send or replaces its session.
|
|
66
|
+
* Requires the server-only
|
|
66
67
|
* `GEISTDOCS_CHAT_SECRET` (without it, the chat route refuses prewarm
|
|
67
68
|
* requests). @default false
|
|
68
69
|
*/
|
|
@@ -96,6 +97,12 @@ export interface GeistdocsAIHistoryConfig {
|
|
|
96
97
|
retentionDays?: number;
|
|
97
98
|
}
|
|
98
99
|
export interface GeistdocsAIConfig extends GeistdocsFeatureConfig {
|
|
100
|
+
/**
|
|
101
|
+
* Label of the navbar button that opens the chat. Blank values use the
|
|
102
|
+
* default. The page action keeps its own label.
|
|
103
|
+
* @default "Ask AI"
|
|
104
|
+
*/
|
|
105
|
+
buttonLabel?: string;
|
|
99
106
|
/**
|
|
100
107
|
* App-local path of the chat route the Ask AI client calls, such as
|
|
101
108
|
* `"/api/ai-chat"`. Must start with a single `/` and carry no query string
|
|
@@ -135,7 +142,7 @@ export interface GeistdocsAIConfig extends GeistdocsFeatureConfig {
|
|
|
135
142
|
suggestions?: GeistdocsAISuggestionInput[];
|
|
136
143
|
/**
|
|
137
144
|
* Heading and accessible label of the chat panel. Blank values use the
|
|
138
|
-
* default.
|
|
145
|
+
* default. Set the navbar button label with `buttonLabel`.
|
|
139
146
|
* @default "Ask AI"
|
|
140
147
|
*/
|
|
141
148
|
title?: string;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,SAAS,WAO7D,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAoBvE,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,a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AE,0BAA0B,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,eAAe,EAAE,QAAQ,CAAC,KAAG,CAAW,CAAC"}
|
package/dist/footer.js
CHANGED
|
@@ -173,4 +173,4 @@ const resolveHref = (item) => item.external || item.href.startsWith("http")
|
|
|
173
173
|
: `${VERCEL}${item.href}`;
|
|
174
174
|
const FooterGroup = ({ title, children, }) => (_jsxs("div", { children: [title ? (_jsx("h2", { className: "my-3 font-medium text-gray-1000 text-label-14", children: title })) : null, _jsx("ul", { className: "m-0 list-none p-0", children: children })] }));
|
|
175
175
|
const FooterLink = ({ badge, children, external, href, }) => (_jsx("li", { className: "py-0.5 leading-5", children: _jsxs("a", { className: "-ml-0.5 flex w-fit items-center gap-1.5 p-0.5 text-gray-900 transition-colors hover:text-gray-1000 motion-reduce:transition-none", href: href, rel: external ? "noopener" : undefined, target: external ? "_blank" : undefined, children: [children, badge ? (_jsx(Badge, { className: "h-5 bg-gray-200 px-2 text-[11px]/[20px] tabular-nums tracking-[0.2px]", contrast: "low", variant: "gray", children: badge })) : null] }) }));
|
|
176
|
-
export const Footer = () => (_jsxs("footer", { className: "mx-auto max-w-[1448px] px-6 pt-10 pb-6 text-sm", children: [_jsxs("div", { className: cn("grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-4 lg:gap-y-7 xl:grid-cols-6"), children: [FOOTER_GROUPS.map((group) => (_jsx(FooterGroup, { title: group.title, children: group.items.map((item) => (_jsx(FooterLink, { badge: item.badge, external: item.external, href: resolveHref(item), children: item.name }, item
|
|
176
|
+
export const Footer = () => (_jsxs("footer", { className: "mx-auto max-w-[1448px] px-6 pt-10 pb-6 text-sm", children: [_jsxs("div", { className: cn("grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-4 lg:gap-y-7 xl:grid-cols-6"), children: [FOOTER_GROUPS.map((group) => (_jsx(FooterGroup, { title: group.title, children: group.items.map((item) => (_jsx(FooterLink, { badge: item.badge, external: item.external, href: resolveHref(item), children: item.name }, resolveHref(item)))) }, group.title))), _jsx(FooterGroup, { title: "Social", children: SOCIAL_LINKS.map((item) => (_jsx(FooterLink, { external: item.external, href: item.href, children: item.name }, item.name))) })] }), _jsxs("div", { className: "mt-10 flex items-center justify-between", children: [_jsx("a", { "aria-label": "Vercel", className: "inline-flex text-gray-1000", href: `${VERCEL}/home`, rel: "noopener", target: "_blank", children: _jsx(LogoIconVercelSvg, { size: 16 }) }), _jsx(ThemeSwitcher, { small: true })] })] }));
|
|
@@ -39,9 +39,8 @@ export interface GeistdocsChatSession {
|
|
|
39
39
|
subscribe: (listener: () => void) => () => void;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* messages.
|
|
42
|
+
* Prepare an eve session while typing, once per idle turn. Existing
|
|
43
|
+
* conversations keep their session and never wait for preparation on Send.
|
|
45
44
|
*/
|
|
46
45
|
prewarm: () => void;
|
|
47
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAwB,KAAK,SAAS,EAAE,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AI,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,GAAI,kFAO/B,wBAAwB,KAAG,oBAwH7B,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Chat } from "@ai-sdk/react";
|
|
2
2
|
import { DefaultChatTransport } from "ai";
|
|
3
|
+
import { getEveAgentMessageMetadata } from "../eve-agent.js";
|
|
3
4
|
import { requestEveAgentPrewarm } from "../eve-agent-session.js";
|
|
4
5
|
import { restoreStoredChat } from "./options.js";
|
|
5
6
|
export const toError = (error) => error instanceof Error ? error : new Error(String(error));
|
|
6
7
|
export const createChatSession = ({ api, getCurrentRoute, history, historyRetentionMs, onError, prewarmEveAgent, }) => {
|
|
7
8
|
let pendingPrewarm = null;
|
|
9
|
+
let prewarmedTurn = null;
|
|
8
10
|
let historyState = { status: "loading" };
|
|
9
11
|
let restoring = false;
|
|
10
12
|
const historyListeners = new Set();
|
|
@@ -35,6 +37,7 @@ export const createChatSession = ({ api, getCurrentRoute, history, historyRetent
|
|
|
35
37
|
// first message reuses the prewarmed session.
|
|
36
38
|
await pendingPrewarm;
|
|
37
39
|
pendingPrewarm = null;
|
|
40
|
+
prewarmedTurn = null;
|
|
38
41
|
return {
|
|
39
42
|
body: {
|
|
40
43
|
...body,
|
|
@@ -75,11 +78,32 @@ export const createChatSession = ({ api, getCurrentRoute, history, historyRetent
|
|
|
75
78
|
},
|
|
76
79
|
},
|
|
77
80
|
prewarm: () => {
|
|
78
|
-
if (prewarmEveAgent
|
|
79
|
-
|
|
80
|
-
chat.
|
|
81
|
-
|
|
81
|
+
if (!prewarmEveAgent ||
|
|
82
|
+
chat.status === "submitted" ||
|
|
83
|
+
chat.status === "streaming") {
|
|
84
|
+
return;
|
|
82
85
|
}
|
|
86
|
+
const lastMessage = chat.messages.at(-1);
|
|
87
|
+
const turn = lastMessage?.id ?? "";
|
|
88
|
+
if (prewarmedTurn === turn) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (lastMessage) {
|
|
92
|
+
const metadata = getEveAgentMessageMetadata(chat.messages);
|
|
93
|
+
if (!metadata) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
prewarmedTurn = turn;
|
|
97
|
+
// An existing session already has its cookie. Preparation is a hint
|
|
98
|
+
// and must not hold up a real message, even if the hint stalls.
|
|
99
|
+
requestEveAgentPrewarm({
|
|
100
|
+
apiUrl: api,
|
|
101
|
+
sessionTag: metadata.session,
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
prewarmedTurn = turn;
|
|
106
|
+
pendingPrewarm ??= requestEveAgentPrewarm({ apiUrl: api });
|
|
83
107
|
},
|
|
84
108
|
};
|
|
85
109
|
};
|
|
@@ -76,10 +76,10 @@ const GeistdocsChatPanel = ({ clearConversation, expandable, session, textareaRe
|
|
|
76
76
|
const hasDraft = prompt.trim().length > 0;
|
|
77
77
|
// Prewarm on the draft so session startup overlaps with typing.
|
|
78
78
|
useEffect(() => {
|
|
79
|
-
if (hasDraft &&
|
|
79
|
+
if (hasDraft && (status === "ready" || status === "error")) {
|
|
80
80
|
session.prewarm();
|
|
81
81
|
}
|
|
82
|
-
}, [hasDraft,
|
|
82
|
+
}, [hasDraft, session, status]);
|
|
83
83
|
const submitText = useChatCommands({
|
|
84
84
|
clearConversation,
|
|
85
85
|
commandState,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ask the chat route to
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* request so the cookie is in place. Resolves `true` when the route accepted
|
|
6
|
-
* the request and `false` on any failure, which falls back to normal session
|
|
7
|
-
* creation.
|
|
2
|
+
* Ask the chat route to prepare a session. A fresh session is bound by an
|
|
3
|
+
* httpOnly cookie; an existing one is identified by its non-reversible tag
|
|
4
|
+
* and verified against that cookie. Failures fall back to normal Send.
|
|
8
5
|
*/
|
|
9
|
-
export declare const requestEveAgentPrewarm: ({ apiUrl, fetchImpl, timeoutMs, }: {
|
|
6
|
+
export declare const requestEveAgentPrewarm: ({ apiUrl, fetchImpl, sessionTag, timeoutMs, }: {
|
|
10
7
|
apiUrl: string;
|
|
11
8
|
fetchImpl?: typeof fetch;
|
|
9
|
+
sessionTag?: string;
|
|
12
10
|
timeoutMs?: number;
|
|
13
11
|
}) => Promise<boolean>;
|
|
14
12
|
//# sourceMappingURL=eve-agent-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eve-agent-session.d.ts","sourceRoot":"","sources":["../../src/internal/eve-agent-session.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"eve-agent-session.d.ts","sourceRoot":"","sources":["../../src/internal/eve-agent-session.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAU,+CAK1C;IACD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,KAAG,OAAO,CAAC,OAAO,CAalB,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
const PREWARM_TIMEOUT_MS = 20_000;
|
|
2
2
|
/**
|
|
3
|
-
* Ask the chat route to
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* request so the cookie is in place. Resolves `true` when the route accepted
|
|
7
|
-
* the request and `false` on any failure, which falls back to normal session
|
|
8
|
-
* creation.
|
|
3
|
+
* Ask the chat route to prepare a session. A fresh session is bound by an
|
|
4
|
+
* httpOnly cookie; an existing one is identified by its non-reversible tag
|
|
5
|
+
* and verified against that cookie. Failures fall back to normal Send.
|
|
9
6
|
*/
|
|
10
|
-
export const requestEveAgentPrewarm = async ({ apiUrl, fetchImpl = fetch, timeoutMs = PREWARM_TIMEOUT_MS, }) => {
|
|
7
|
+
export const requestEveAgentPrewarm = async ({ apiUrl, fetchImpl = fetch, sessionTag, timeoutMs = PREWARM_TIMEOUT_MS, }) => {
|
|
11
8
|
try {
|
|
12
9
|
const response = await fetchImpl(apiUrl, {
|
|
13
10
|
method: "POST",
|
|
14
|
-
body: JSON.stringify({ prewarm: true }),
|
|
11
|
+
body: JSON.stringify({ prewarm: true, sessionTag }),
|
|
15
12
|
headers: { "Content-Type": "application/json" },
|
|
16
13
|
signal: AbortSignal.timeout(timeoutMs),
|
|
17
14
|
});
|
|
@@ -61,9 +61,9 @@ export interface StreamEveAgentTurnOptions {
|
|
|
61
61
|
}
|
|
62
62
|
export declare const normalizeAgentUrl: (url: string) => string;
|
|
63
63
|
/**
|
|
64
|
-
* Stream position on the most recent assistant message
|
|
65
|
-
* user message. Only the
|
|
66
|
-
*
|
|
64
|
+
* Stream position on the most recent assistant message, with or without a
|
|
65
|
+
* trailing user message. Only the latest answer counts: a turn that failed
|
|
66
|
+
* or was stopped carries no position, and resuming from an older one
|
|
67
67
|
* would replay events. Legacy shapes (`{ sessionId, streamIndex }` objects
|
|
68
68
|
* and opaque string tokens) read as no position.
|
|
69
69
|
*/
|
|
@@ -110,6 +110,14 @@ export declare const createEmptyEveAgentSession: ({ agentUrl, fetchImpl, headers
|
|
|
110
110
|
}) => Promise<{
|
|
111
111
|
sessionId: string;
|
|
112
112
|
}>;
|
|
113
|
+
/** Prepare an existing idle owner using eve 0.83's bodyless session POST. */
|
|
114
|
+
export declare const prewarmExistingEveAgentSession: ({ agentUrl, fetchImpl, headers, sessionId, signal, }: {
|
|
115
|
+
agentUrl: string;
|
|
116
|
+
fetchImpl?: typeof fetch;
|
|
117
|
+
headers?: HeadersInit;
|
|
118
|
+
sessionId: string;
|
|
119
|
+
signal?: AbortSignal;
|
|
120
|
+
}) => Promise<void>;
|
|
113
121
|
/**
|
|
114
122
|
* Send the turn's message to the agent: as a follow-up to `continuation`
|
|
115
123
|
* when given, otherwise (or when that session is no longer active) as the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eve-agent.d.ts","sourceRoot":"","sources":["../../src/internal/eve-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"eve-agent.d.ts","sourceRoot":"","sources":["../../src/internal/eve-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAoC3E,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wDAAwD;AACxD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,gBAAgB,EAAE,CAAC;AAE1D,2EAA2E;AAC3E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;CACrB;AAwBD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,uDAAuD;IACvD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;IACjC,6EAA6E;IAC7E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zB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAkBhC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,8BAA8B,GAAU,sDAMlD;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,IAAI,CAsBf,CAAC;AA6TF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GAAU,kGASlD;IACD,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gEAAgE;IAChE,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,eAAe,CAoD1B,CAAC;AA8HF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,oHAWtC,yBAAyB,kBA+D3B,CAAC"}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
* `session.waiting`, so the client disconnects at turn boundaries and
|
|
18
18
|
* counts consumed lines to resume from an absolute cursor.
|
|
19
19
|
* - `POST {url}/eve/v1/session/:sessionId/cancel` cancels the in-flight turn.
|
|
20
|
+
* - In eve 0.83+, a bodyless `POST {url}/eve/v1/session/:sessionId` prepares
|
|
21
|
+
* an existing session without starting a turn or replacing the session.
|
|
20
22
|
*/
|
|
21
23
|
const EVE_SESSION_PATH = "/eve/v1/session";
|
|
22
24
|
const CANCEL_TIMEOUT_MS = 5000;
|
|
@@ -43,14 +45,14 @@ const isEveAgentMessageMetadata = (value) => isRecord(value) &&
|
|
|
43
45
|
value.streamIndex >= 0;
|
|
44
46
|
const readEveAgentMetadata = (message) => message?.metadata?.eveAgent;
|
|
45
47
|
/**
|
|
46
|
-
* Stream position on the most recent assistant message
|
|
47
|
-
* user message. Only the
|
|
48
|
-
*
|
|
48
|
+
* Stream position on the most recent assistant message, with or without a
|
|
49
|
+
* trailing user message. Only the latest answer counts: a turn that failed
|
|
50
|
+
* or was stopped carries no position, and resuming from an older one
|
|
49
51
|
* would replay events. Legacy shapes (`{ sessionId, streamIndex }` objects
|
|
50
52
|
* and opaque string tokens) read as no position.
|
|
51
53
|
*/
|
|
52
54
|
export const getEveAgentMessageMetadata = (messages) => {
|
|
53
|
-
for (let index = messages.length -
|
|
55
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
54
56
|
const message = messages[index];
|
|
55
57
|
if (message?.role !== "assistant") {
|
|
56
58
|
continue;
|
|
@@ -191,6 +193,19 @@ export const createEmptyEveAgentSession = async ({ agentUrl, fetchImpl = fetch,
|
|
|
191
193
|
}
|
|
192
194
|
return await parseSessionResponse(response);
|
|
193
195
|
};
|
|
196
|
+
/** Prepare an existing idle owner using eve 0.83's bodyless session POST. */
|
|
197
|
+
export const prewarmExistingEveAgentSession = async ({ agentUrl, fetchImpl = fetch, headers, sessionId, signal, }) => {
|
|
198
|
+
const response = await fetchImpl(`${normalizeAgentUrl(agentUrl)}${EVE_SESSION_PATH}/${encodeURIComponent(sessionId)}`, { method: "POST", headers, signal });
|
|
199
|
+
if (!response.ok) {
|
|
200
|
+
throw new Error(`eve agent session preparation failed with status ${response.status}.`);
|
|
201
|
+
}
|
|
202
|
+
const body = await response.json();
|
|
203
|
+
if (!isRecord(body) ||
|
|
204
|
+
body.ok !== true ||
|
|
205
|
+
!["ready", "accepted", "unsupported", "no_active_session"].includes(body.status)) {
|
|
206
|
+
throw new Error("eve agent returned an invalid preparation response.");
|
|
207
|
+
}
|
|
208
|
+
};
|
|
194
209
|
const isTurnBoundaryEvent = (type) => type === "session.waiting" ||
|
|
195
210
|
type === "session.completed" ||
|
|
196
211
|
type === "session.failed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desktop-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/desktop-menu.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAYtB,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAiBD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,GAC7B,eAAe,EAAE,CAYnB;
|
|
1
|
+
{"version":3,"file":"desktop-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/desktop-menu.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAYtB,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAiBD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,GAC7B,eAAe,EAAE,CAYnB;AA8DD,eAAO,MAAM,WAAW,GAAI,sBAAsB,gBAAgB,4CAuEjE,CAAC"}
|
|
@@ -40,14 +40,14 @@ export function groupDropdownItems(dropdown) {
|
|
|
40
40
|
* the vercel.com header pattern with columned sections and plain
|
|
41
41
|
* hover-underline links.
|
|
42
42
|
*/
|
|
43
|
-
const DropdownNavItem = ({ first, item, }) => {
|
|
44
|
-
const isActive = useNavActive();
|
|
43
|
+
const DropdownNavItem = ({ first, item, navItems, }) => {
|
|
44
|
+
const isActive = useNavActive(navItems);
|
|
45
45
|
const hasActiveChild = item.items.some((child) => !isExternal(child) && isActive(child.href));
|
|
46
46
|
const sections = groupDropdownItems(item);
|
|
47
47
|
return (_jsxs(NavigationMenuItem, { className: "flex", children: [_jsx(NavigationMenuTrigger, { className: topLevelItemClassName(first), "data-active": hasActiveChild ? "" : undefined, children: item.label }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: true, children: _jsx("div", { className: "mx-auto w-full max-w-[1448px] px-2", children: _jsx("div", { className: "flex flex-nowrap gap-x-10 pt-4 pb-6 pl-4", children: sections.map((section) => (_jsxs("div", { className: "min-w-[180px] shrink-0", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: section.heading }), _jsx("ul", { className: "mt-[5px] flex list-none flex-col", children: section.items.map((child) => (_jsx("li", { className: "flex", children: _jsx(PanelLink, { active: !isExternal(child) && isActive(child.href), product: child }) }, child.href))) })] }, section.heading))) }) }) })] }));
|
|
48
48
|
};
|
|
49
49
|
export const DesktopMenu = ({ items, className }) => {
|
|
50
|
-
const isActive = useNavActive();
|
|
50
|
+
const isActive = useNavActive(items);
|
|
51
51
|
const [navOpen, setNavOpen] = useState(false);
|
|
52
|
-
return (_jsxs(_Fragment, { children: [_jsx(NavigationMenu, { "aria-label": "Primary navigation", delayDuration: 0, onValueChange: (value) => setNavOpen(Boolean(value)), skipDelayDuration: 0, viewport: false, children: _jsx(NavigationMenuList, { className: cn("h-16 items-stretch gap-0", className), children: items.map((item, index) => "items" in item ? (_jsx(DropdownNavItem, { first: index === 0, item: item }, item.label)) : (_jsx(NavigationMenuItem, { className: "flex", children: _jsx(NavigationMenuLink, { active: isActive(item.href), asChild: true, className: topLevelItemClassName(index === 0), children: item.href.startsWith("http") ? (_jsxs("a", { className: "flex flex-row items-center gap-1", href: item.href, rel: "noopener", target: "_blank", children: [item.label, _jsx(IconArrowUpRightSmall, { "aria-hidden": "true", className: cn(navOpen && "will-change-transform"), size: 12 })] })) : (_jsx(LocalizedLink, { href: item.href, children: item.label })) }) }, item.href))) }) }), _jsx("div", { "aria-hidden": "true", className: cn("pointer-events-none fixed inset-x-0 top-16 bottom-0 z-0 bg-background-200/60", navOpen ? "opacity-100" : "opacity-0") })] }));
|
|
52
|
+
return (_jsxs(_Fragment, { children: [_jsx(NavigationMenu, { "aria-label": "Primary navigation", delayDuration: 0, onValueChange: (value) => setNavOpen(Boolean(value)), skipDelayDuration: 0, viewport: false, children: _jsx(NavigationMenuList, { className: cn("h-16 items-stretch gap-0", className), children: items.map((item, index) => "items" in item ? (_jsx(DropdownNavItem, { first: index === 0, item: item, navItems: items }, item.label)) : (_jsx(NavigationMenuItem, { className: "flex", children: _jsx(NavigationMenuLink, { active: isActive(item.href), asChild: true, className: topLevelItemClassName(index === 0), children: item.href.startsWith("http") ? (_jsxs("a", { className: "flex flex-row items-center gap-1", href: item.href, rel: "noopener", target: "_blank", children: [item.label, _jsx(IconArrowUpRightSmall, { "aria-hidden": "true", className: cn(navOpen && "will-change-transform"), size: 12 })] })) : (_jsx(LocalizedLink, { href: item.href, children: item.label })) }) }, item.href))) }) }), _jsx("div", { "aria-hidden": "true", className: cn("pointer-events-none fixed inset-x-0 top-16 bottom-0 z-0 bg-background-200/60", navOpen ? "opacity-100" : "opacity-0") })] }));
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA+YD,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAEhD,CAAC"}
|
|
@@ -34,8 +34,8 @@ function SubNavLink({ active, children, external, href, onClick, }) {
|
|
|
34
34
|
* collapsible: uppercase section headings when items declare sections, a
|
|
35
35
|
* flat list when none do.
|
|
36
36
|
*/
|
|
37
|
-
function NavDropdownCollapsible({ dropdown, onLinkClick, }) {
|
|
38
|
-
const isActive = useNavActive();
|
|
37
|
+
function NavDropdownCollapsible({ dropdown, navItems, onLinkClick, }) {
|
|
38
|
+
const isActive = useNavActive(navItems);
|
|
39
39
|
const sections = groupDropdownItems(dropdown);
|
|
40
40
|
const flat = sections.length === 1 && sections[0].heading === dropdown.label;
|
|
41
41
|
const renderItems = (items) => items.map((item) => {
|
|
@@ -57,7 +57,7 @@ function MobileMenuButton({ expanded, onClick, }) {
|
|
|
57
57
|
const MobileMenuState = ({ activeProduct, githubUrl, nav, ossProducts, showOss = false, }) => {
|
|
58
58
|
const isDesktop = useMediaQuery("(min-width: 1024px)");
|
|
59
59
|
const [show, setShow] = useState(false);
|
|
60
|
-
const isActive = useNavActive();
|
|
60
|
+
const isActive = useNavActive(nav);
|
|
61
61
|
// Resolve the default/custom list and drop the active product here on the
|
|
62
62
|
// client, where `DEFAULT_OSS_PRODUCTS` is a real array (see resolveOssProducts).
|
|
63
63
|
const products = showOss
|
|
@@ -122,6 +122,6 @@ const MobileMenuState = ({ activeProduct, githubUrl, nav, ossProducts, showOss =
|
|
|
122
122
|
const close = () => setShow(false);
|
|
123
123
|
return (_jsxs(_Fragment, { children: [_jsx(MobileMenuButton, { expanded: show, onClick: () => setShow(!show) }), _jsx("div", { className: cn("fixed inset-0 top-16 z-40 @min-[1024px]:hidden bg-background-200", show
|
|
124
124
|
? "pointer-events-auto opacity-100"
|
|
125
|
-
: "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2", show ? "opacity-100" : "pointer-events-none opacity-0"), children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
|
|
125
|
+
: "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2", show ? "opacity-100" : "pointer-events-none opacity-0"), children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, navItems: nav, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
|
|
126
126
|
};
|
|
127
127
|
export const MobileMenu = (props) => (_jsx(MobileMenuState, { ...props }, usePathname()));
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import type { GeistdocsNavItem } from "../../config";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The href of the most specific nav item that matches the path: the path
|
|
4
|
+
* equals the href or is nested beneath it. External links never match. When
|
|
5
|
+
* nav items nest (`/docs` and `/docs/lib`), only the longest match is active,
|
|
6
|
+
* so `/docs/lib/models` highlights `/docs/lib` rather than both.
|
|
6
7
|
*/
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const getActiveNavHref: (pathname: string, hrefs: readonly string[]) => string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a predicate that reports whether a nav item is the active one for
|
|
11
|
+
* the current page. A section stays highlighted while browsing its
|
|
12
|
+
* sub-pages, unless a more specific nav item matches.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useNavActive: (items: readonly GeistdocsNavItem[]) => (href: string) => boolean;
|
|
8
15
|
//# sourceMappingURL=use-nav-active.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-active.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/use-nav-active.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-nav-active.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/use-nav-active.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AASrD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,OAAO,SAAS,MAAM,EAAE,KACvB,MAAM,GAAG,SAeX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,gBAAgB,EAAE,MAarD,MAAM,MAAM,YACrB,CAAC"}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useParams, usePathname } from "next/navigation";
|
|
3
|
+
const getNavHrefs = (items) => items.flatMap((item) => "items" in item
|
|
4
|
+
? item.items.filter((child) => !child.external).map((child) => child.href)
|
|
5
|
+
: [item.href]);
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The href of the most specific nav item that matches the path: the path
|
|
8
|
+
* equals the href or is nested beneath it. External links never match. When
|
|
9
|
+
* nav items nest (`/docs` and `/docs/lib`), only the longest match is active,
|
|
10
|
+
* so `/docs/lib/models` highlights `/docs/lib` rather than both.
|
|
8
11
|
*/
|
|
9
|
-
export const
|
|
12
|
+
export const getActiveNavHref = (pathname, hrefs) => {
|
|
13
|
+
let active;
|
|
14
|
+
for (const href of hrefs) {
|
|
15
|
+
if (href.startsWith("http")) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const matches = href === "/"
|
|
19
|
+
? pathname === "/"
|
|
20
|
+
: pathname === href || pathname.startsWith(`${href}/`);
|
|
21
|
+
if (matches && (active === undefined || href.length > active.length)) {
|
|
22
|
+
active = href;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return active;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns a predicate that reports whether a nav item is the active one for
|
|
29
|
+
* the current page. A section stays highlighted while browsing its
|
|
30
|
+
* sub-pages, unless a more specific nav item matches.
|
|
31
|
+
*/
|
|
32
|
+
export const useNavActive = (items) => {
|
|
10
33
|
const pathname = usePathname();
|
|
11
34
|
const params = useParams();
|
|
12
35
|
const lang = typeof params.lang === "string" ? params.lang : null;
|
|
@@ -15,13 +38,6 @@ export const useNavActive = () => {
|
|
|
15
38
|
const normalizedPath = lang && (pathname === `/${lang}` || pathname.startsWith(`/${lang}/`))
|
|
16
39
|
? pathname.slice(lang.length + 1) || "/"
|
|
17
40
|
: pathname;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
if (href === "/") {
|
|
23
|
-
return normalizedPath === "/";
|
|
24
|
-
}
|
|
25
|
-
return normalizedPath === href || normalizedPath.startsWith(`${href}/`);
|
|
26
|
-
};
|
|
41
|
+
const active = getActiveNavHref(normalizedPath, getNavHrefs(items));
|
|
42
|
+
return (href) => href === active;
|
|
27
43
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type GeistdocsSidebarMode } from "../sidebar";
|
|
3
|
-
export declare const GeistdocsSidebar: ({ mode, showDesktop, top, }: {
|
|
3
|
+
export declare const GeistdocsSidebar: ({ mode, scrollToActive, showDesktop, top, }: {
|
|
4
4
|
mode?: GeistdocsSidebarMode;
|
|
5
|
+
/** Scroll the desktop sidebar to reveal the current page on navigation. */
|
|
6
|
+
scrollToActive?: boolean;
|
|
5
7
|
showDesktop?: boolean;
|
|
6
8
|
top?: ReactNode;
|
|
7
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAgBf,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAgBf,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AAu/B5E,eAAO,MAAM,gBAAgB,GAAI,6CAK9B;IACD,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,4CAkEA,CAAC"}
|
package/dist/internal/sidebar.js
CHANGED
|
@@ -213,9 +213,9 @@ const SidebarTree = ({ activeUrl, idScope, nodes, onNavigate, openFirstLevel = f
|
|
|
213
213
|
useActiveItemScroll(listRef, activeUrl, scrollActive && visible, opened.join(":"), manualToggleRef);
|
|
214
214
|
return (_jsx("ul", { className: "m-0 flex list-none flex-col gap-px p-0", ref: listRef, children: _jsx(SidebarTreeItems, { depth: 0, nodes: nodes, parentPath: [], state: state }) }));
|
|
215
215
|
};
|
|
216
|
-
const SidebarRootList = ({ activeSection, activeUrl, groups, onSelect, visible, }) => {
|
|
216
|
+
const SidebarRootList = ({ activeSection, activeUrl, groups, onSelect, scrollToActive, visible, }) => {
|
|
217
217
|
const contentRef = useRef(null);
|
|
218
|
-
useActiveItemScroll(contentRef, activeUrl, visible, activeSection?.$id ?? "root");
|
|
218
|
+
useActiveItemScroll(contentRef, activeUrl, scrollToActive && visible, activeSection?.$id ?? "root");
|
|
219
219
|
return (_jsx("div", { className: "flex flex-col gap-4 px-2 pt-1 pb-2", ref: contentRef, children: groups.map((group) => (_jsxs("div", { className: "flex flex-col", children: [group.label || group.icon ? (_jsxs("div", { className: "flex items-center gap-2 px-2 pt-2 pb-1 font-medium text-gray-900 text-label-13 [&_svg]:size-4", children: [group.icon ? (_jsx("span", { className: "shrink-0", children: group.icon })) : null, _jsx("span", { className: "min-w-0 truncate", children: group.label })] })) : null, _jsx("ul", { className: "m-0 flex list-none flex-col gap-px p-0", children: group.items.map((section, index) => (_jsx(SidebarRootItem, { activeSection: activeSection, activeUrl: activeUrl, item: section, onSelect: onSelect }, getSidebarNodeId(section, [index])))) })] }, group.id))) }));
|
|
220
220
|
};
|
|
221
221
|
const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
|
|
@@ -250,7 +250,7 @@ const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
|
|
|
250
250
|
return (_jsxs("li", { className: cn(separateDisclosure && "flex items-center gap-px"), children: [renderedItem, separateDisclosure ? (_jsx("button", { "aria-label": getRootDisclosureLabel(item.name), className: "grid size-8 flex-none cursor-pointer touch-manipulation place-content-center rounded-md bg-transparent p-0 text-gray-900 hover:bg-gray-100 focus-visible:bg-gray-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: (event) => onSelect(item, event.currentTarget), type: "button", children: _jsx(IconChevronRightSmall, { size: 16 }) })) : null] }));
|
|
251
251
|
};
|
|
252
252
|
const SidebarSectionHeader = ({ buttonRef, onBack, section, }) => (_jsx("div", { className: "mb-2 px-2 pt-1", children: _jsxs("button", { "aria-label": "Back to all documentation sections", className: "flex w-full cursor-pointer touch-manipulation flex-row items-center justify-between gap-1 rounded-md border-0 bg-transparent p-0 text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: onBack, ref: buttonRef, type: "button", children: [_jsx("span", { className: "grid size-9 flex-none place-content-center", children: _jsx(IconChevronRightSmall, { className: "rotate-180", size: 16 }) }), _jsx("span", { className: "flex min-w-0 flex-1 items-center justify-center text-button-14", children: _jsx("span", { className: "truncate", children: section.name }) }), _jsx("span", { className: "size-9 flex-none" })] }) }));
|
|
253
|
-
const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
253
|
+
const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, scrollToActive, top, }) => {
|
|
254
254
|
const groups = useMemo(() => getSidebarRootGroups(nodes), [nodes]);
|
|
255
255
|
const currentSection = useMemo(() => findActiveRootSection(nodes, activeUrl), [activeUrl, nodes]);
|
|
256
256
|
const [selectedSection, setSelectedSection] = useState(null);
|
|
@@ -335,14 +335,14 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
|
335
335
|
shouldFocusSectionRef.current = true;
|
|
336
336
|
setSelectedSection(section);
|
|
337
337
|
setView("section");
|
|
338
|
-
}, visible: !rootHidden }) }), activeSection ? (_jsxs("div", { className: cn("geistdocs-sidebar-pane", sectionHidden &&
|
|
338
|
+
}, scrollToActive: scrollToActive, visible: !rootHidden }) }), activeSection ? (_jsxs("div", { className: cn("geistdocs-sidebar-pane", sectionHidden &&
|
|
339
339
|
"pointer-events-none absolute inset-x-0 top-0 opacity-0 [transform:translateX(8px)] motion-reduce:invisible"), "data-sidebar-pane": "section", inert: sectionHidden || undefined, children: [_jsx(SidebarSectionHeader, { buttonRef: sectionHeaderRef, onBack: () => {
|
|
340
340
|
shouldFocusRootRef.current = true;
|
|
341
341
|
setSelectedSection(null);
|
|
342
342
|
setView("root");
|
|
343
|
-
}, section: activeSection }), _jsx("div", { className: "px-2", children: _jsx(SidebarTree, { activeUrl: activeUrl, idScope: sectionScope, nodes: sectionItems, openFirstLevel: true, scrollActive:
|
|
343
|
+
}, section: activeSection }), _jsx("div", { className: "px-2", children: _jsx(SidebarTree, { activeUrl: activeUrl, idScope: sectionScope, nodes: sectionItems, openFirstLevel: true, scrollActive: scrollToActive, visible: !sectionHidden }) })] })) : null] })] }) }) }) }));
|
|
344
344
|
};
|
|
345
|
-
const DesktopTreeSidebar = ({ activeUrl, nodes, rootScope, top, }) => (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-mode": "tree", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-3 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, children: [top ? _jsx("div", { className: "pb-3", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: rootScope, nodes: nodes, openFirstLevel: true, scrollActive:
|
|
345
|
+
const DesktopTreeSidebar = ({ activeUrl, nodes, rootScope, scrollToActive, top, }) => (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-mode": "tree", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-3 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, children: [top ? _jsx("div", { className: "pb-3", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: rootScope, nodes: nodes, openFirstLevel: true, scrollActive: scrollToActive })] }) }) }) }));
|
|
346
346
|
const DesktopSidebar = ({ mode, ...props }) => {
|
|
347
347
|
if (mode === "tree") {
|
|
348
348
|
return _jsx(DesktopTreeSidebar, { ...props });
|
|
@@ -353,7 +353,7 @@ const MobileSidebar = ({ activeUrl, idScope, nodes, onOpenChange, open, top, })
|
|
|
353
353
|
// A full-width slide with no fade, so the page never shows through.
|
|
354
354
|
// `!` overrides the state-variant animation classes provider sheets set.
|
|
355
355
|
"data-[state=closed]:fade-out-100! data-[state=open]:fade-in-100! data-[state=closed]:slide-out-to-left! data-[state=open]:slide-in-from-left! duration-300! ease-[cubic-bezier(0.32,0.72,0,1)]! motion-reduce:animate-none!"), "data-geistdocs-mobile-sidebar": true, noOverlay: true, side: "left", children: [_jsxs(SheetHeader, { className: "h-16 shrink-0 flex-row items-center justify-between gap-2 border-b px-4 py-0 text-left", children: [_jsx(SheetTitle, { className: "text-label-16", children: "Browse" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." }), _jsx(SheetClose, { "aria-label": "Close menu", className: "-mr-2 grid size-8 shrink-0 touch-manipulation place-items-center rounded-md text-gray-900 transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", children: _jsx(IconCross, { size: 16 }) })] }), _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-3 text-gray-900", "data-geistdocs-sidebar-scroll": true, children: [_jsx("div", { className: "pb-4 [&>button]:w-full", children: _jsx(SearchButton, { onClick: () => onOpenChange(false) }) }), top ? _jsx("div", { className: "pb-4", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: idScope, nodes: nodes, onNavigate: () => onOpenChange(false), scrollActive: true, visible: open })] }) })] }) }));
|
|
356
|
-
export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }) => {
|
|
356
|
+
export const GeistdocsSidebar = ({ mode = "sections", scrollToActive = true, showDesktop = true, top, }) => {
|
|
357
357
|
const { root, full } = useTreeContext();
|
|
358
358
|
const { isOpen, setIsOpen } = useGeistdocsSidebar();
|
|
359
359
|
const containerRef = useRef(null);
|
|
@@ -383,5 +383,5 @@ export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }
|
|
|
383
383
|
return (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true, ref: (marker) => {
|
|
384
384
|
containerRef.current =
|
|
385
385
|
marker?.closest("[data-geistdocs-container]") ?? null;
|
|
386
|
-
} }), showDesktop ? (_jsx(DesktopSidebar, { activeUrl: activeUrl, mode: mode, nodes: root.children, rootScope: rootScope, top: top }, root.$id)) : null, _jsx(MobileSidebar, { activeUrl: activeUrl, idScope: rootScope, nodes: root.children, onOpenChange: setIsOpen, open: isOpen, top: top })] }));
|
|
386
|
+
} }), showDesktop ? (_jsx(DesktopSidebar, { activeUrl: activeUrl, mode: mode, nodes: root.children, rootScope: rootScope, scrollToActive: scrollToActive, top: top }, root.$id)) : null, _jsx(MobileSidebar, { activeUrl: activeUrl, idScope: rootScope, nodes: root.children, onOpenChange: setIsOpen, open: isOpen, top: top })] }));
|
|
387
387
|
};
|
package/dist/layout.d.ts
CHANGED
|
@@ -9,9 +9,15 @@ interface GeistdocsDocsLayoutProps {
|
|
|
9
9
|
config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
|
|
10
10
|
containerProps?: ComponentProps<typeof FumadocsDocsLayout>["containerProps"];
|
|
11
11
|
sidebarMode?: GeistdocsSidebarMode;
|
|
12
|
+
/**
|
|
13
|
+
* Scroll the desktop sidebar to reveal the current page when it is out of
|
|
14
|
+
* view after a navigation. Set false to keep the sidebar where it is.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
sidebarScrollToActive?: boolean;
|
|
12
18
|
sidebarTop?: ReactNode;
|
|
13
19
|
tree: ComponentProps<typeof FumadocsDocsLayout>["tree"];
|
|
14
20
|
}
|
|
15
|
-
export declare const GeistdocsDocsLayout: ({ config, containerProps, sidebarMode, sidebarTop, tree, children, }: GeistdocsDocsLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const GeistdocsDocsLayout: ({ config, containerProps, sidebarMode, sidebarScrollToActive, sidebarTop, tree, children, }: GeistdocsDocsLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
22
|
export {};
|
|
17
23
|
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,OAAO,EAAE,KAAK,oBAAoB,EAA4B,MAAM,WAAW,CAAC;AAEhF,eAAO,MAAM,iBAAiB,iHAA0B,CAAC;AAIzD,eAAO,MAAM,oBAAoB,+CAShC,CAAC;AAEF,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,OAAO,EAAE,KAAK,oBAAoB,EAA4B,MAAM,WAAW,CAAC;AAEhF,eAAO,MAAM,iBAAiB,iHAA0B,CAAC;AAIzD,eAAO,MAAM,oBAAoB,+CAShC,CAAC;AAEF,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,mBAAmB,GAAI,6FAQjC,wBAAwB,4CAwC1B,CAAC"}
|
package/dist/layout.js
CHANGED
|
@@ -11,7 +11,7 @@ const chatOpenScript = `(function(){try{if(localStorage.getItem(${JSON.stringify
|
|
|
11
11
|
export const GeistdocsThemeScript = () => (_jsxs(_Fragment, { children: [_jsx(GeistThemeScript, { storageKey: "geistdocs-theme" }), _jsx("script", {
|
|
12
12
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: the storage key and attribute are package constants; no user-authored HTML is inserted.
|
|
13
13
|
dangerouslySetInnerHTML: { __html: chatOpenScript }, id: "geistdocs-chat-open-script" })] }));
|
|
14
|
-
export const GeistdocsDocsLayout = ({ config, containerProps, sidebarMode, sidebarTop, tree, children, }) => {
|
|
14
|
+
export const GeistdocsDocsLayout = ({ config, containerProps, sidebarMode, sidebarScrollToActive, sidebarTop, tree, children, }) => {
|
|
15
15
|
const { i18n } = createGeistdocsI18n(config);
|
|
16
16
|
return (_jsx(GeistdocsSidebarProvider, { children: _jsx(FumadocsDocsLayout, { containerProps: {
|
|
17
17
|
...containerProps,
|
|
@@ -25,7 +25,7 @@ export const GeistdocsDocsLayout = ({ config, containerProps, sidebarMode, sideb
|
|
|
25
25
|
enabled: false,
|
|
26
26
|
}, sidebar: {
|
|
27
27
|
collapsible: false,
|
|
28
|
-
component: _jsx(GeistdocsSidebar, { mode: sidebarMode, top: sidebarTop }),
|
|
28
|
+
component: (_jsx(GeistdocsSidebar, { mode: sidebarMode, scrollToActive: sidebarScrollToActive, top: sidebarTop })),
|
|
29
29
|
}, tabMode: "auto", themeSwitch: {
|
|
30
30
|
enabled: false,
|
|
31
31
|
}, tree: tree, children: _jsx("main", { className: "contents", children: children }) }) }));
|
package/dist/navbar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GeistdocsConfig } from "./config";
|
|
2
2
|
interface NavbarProps {
|
|
3
|
-
config: Pick<GeistdocsConfig, "github" | "logo" | "logoHref" | "nav" | "navbarActiveProduct" | "navbarBrand" | "navbarGithub" | "navbarOssProducts" | "navbarVariant">;
|
|
3
|
+
config: Pick<GeistdocsConfig, "ai" | "github" | "logo" | "logoHref" | "nav" | "navbarActiveProduct" | "navbarBrand" | "navbarGithub" | "navbarOssProducts" | "navbarVariant">;
|
|
4
4
|
}
|
|
5
5
|
export declare const Navbar: ({ config }: NavbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
package/dist/navbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../src/navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,UAAU,WAAW;IACnB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,QAAQ,GACR,MAAM,GACN,UAAU,GACV,KAAK,GACL,qBAAqB,GACrB,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,eAAe,CAClB,CAAC;CACH;AAKD,eAAO,MAAM,MAAM,GAAI,YAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../src/navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,UAAU,WAAW;IACnB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,IAAI,GACJ,QAAQ,GACR,MAAM,GACN,UAAU,GACV,KAAK,GACL,qBAAqB,GACrB,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,eAAe,CAClB,CAAC;CACH;AAKD,eAAO,MAAM,MAAM,GAAI,YAAY,WAAW,4CA2E7C,CAAC"}
|
package/dist/navbar.js
CHANGED
|
@@ -12,9 +12,11 @@ export const Navbar = ({ config }) => {
|
|
|
12
12
|
const variant = config.navbarVariant ?? "oss";
|
|
13
13
|
const isOss = variant === "oss";
|
|
14
14
|
const showGithub = config.navbarGithub?.enabled !== false;
|
|
15
|
+
const buttonLabel = config.ai?.buttonLabel?.trim();
|
|
16
|
+
const askLabel = buttonLabel ? _jsx("span", { children: buttonLabel }) : undefined;
|
|
15
17
|
const githubUrl = showGithub ? getGithubRepoUrl(config.github) : null;
|
|
16
18
|
// The default product list lives in a "use client" module, so it is resolved
|
|
17
19
|
// and filtered inside the mobile menu.
|
|
18
20
|
const activeProduct = config.navbarActiveProduct;
|
|
19
|
-
return (_jsx(NavbarShell, { children: _jsxs("div", { className: "@container mx-auto flex w-full max-w-[1448px] justify-between px-2", children: [_jsxs("div", { className: "flex select-none flex-row items-center", children: [isOss ? (_jsx(NavbarLogo, { activeProduct: activeProduct, brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, ossProducts: config.navbarOssProducts, variant: "oss" })) : (_jsx(NavbarLogo, { brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, variant: "standard" })), _jsx(DesktopMenu, { className: "@min-[1024px]:flex hidden", items: nav })] }), _jsxs("div", { className: "mr-4 flex flex-row items-center justify-end gap-2", children: [_jsx(SearchButton, { className: "@min-[1024px]:flex hidden w-36" }), _jsx(AskAIButton, { className: "@min-[768px]:flex hidden shrink-0", size: "small", variant: "secondary" }), _jsx(AskAIButton, { className: "@min-[768px]:hidden", size: "small", variant: "secondary" }), showGithub ? (_jsx(GitHubButton, { className: "@min-[768px]:inline-flex hidden shrink-0", github: config.github })) : null, _jsx(MobileMenu, { activeProduct: activeProduct, githubUrl: githubUrl, nav: nav, ossProducts: config.navbarOssProducts, showOss: isOss })] })] }) }));
|
|
21
|
+
return (_jsx(NavbarShell, { children: _jsxs("div", { className: "@container mx-auto flex w-full max-w-[1448px] justify-between px-2", children: [_jsxs("div", { className: "flex select-none flex-row items-center", children: [isOss ? (_jsx(NavbarLogo, { activeProduct: activeProduct, brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, ossProducts: config.navbarOssProducts, variant: "oss" })) : (_jsx(NavbarLogo, { brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, variant: "standard" })), _jsx(DesktopMenu, { className: "@min-[1024px]:flex hidden", items: nav })] }), _jsxs("div", { className: "mr-4 flex flex-row items-center justify-end gap-2", children: [_jsx(SearchButton, { className: "@min-[1024px]:flex hidden w-36" }), _jsx(AskAIButton, { className: "@min-[768px]:flex hidden shrink-0", size: "small", variant: "secondary", children: askLabel }), _jsx(AskAIButton, { className: "@min-[768px]:hidden", size: "small", variant: "secondary", children: askLabel }), showGithub ? (_jsx(GitHubButton, { className: "@min-[768px]:inline-flex hidden shrink-0", github: config.github })) : null, _jsx(MobileMenu, { activeProduct: activeProduct, githubUrl: githubUrl, nav: nav, ossProducts: config.navbarOssProducts, showOss: isOss })] })] }) }));
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAKhE,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAKhE,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,KAAK,qBAAqB,EAU3B,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AA4B1C;;;GAGG;AACH,KAAK,mBAAmB,GACpB,WAAW,GACX,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAE/D,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,KAAK,oBAAoB,GAAG,MAAM,GAAG,WAAW,CAAC;AAEjD,+EAA+E;AAC/E,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,2EAA2E;AAC3E,KAAK,iCAAiC,GAAG,CAAC,OAAO,EAAE;IACjD,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,KAAK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sB;gBAqBE,OAAO;;CAiMjC,CAAC"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { getPublicPath } from "../config";
|
|
6
6
|
import { createSourceChunk, createSourceChunks, } from "../internal/chat/source-chunks";
|
|
7
7
|
import { createChatDocumentSearch, } from "../internal/chat-retrieval";
|
|
8
|
-
import { buildEveAgentTranscript, capLastUserMessageText, createEmptyEveAgentSession, getEveAgentMessageMetadata, hasPriorEveAgentTurn, normalizeAgentUrl, resolveEveAgentUrl, startOrContinueEveAgentSession, streamEveAgentTurn, } from "../internal/eve-agent";
|
|
8
|
+
import { buildEveAgentTranscript, capLastUserMessageText, createEmptyEveAgentSession, getEveAgentMessageMetadata, hasPriorEveAgentTurn, normalizeAgentUrl, prewarmExistingEveAgentSession, resolveEveAgentUrl, startOrContinueEveAgentSession, streamEveAgentTurn, } from "../internal/eve-agent";
|
|
9
9
|
import { CHAT_SECRET_ENV, createEveAgentSessionCookieCodec, EVE_AGENT_SESSION_COOKIE, isSameSessionTag, readCookieValues, serializeEveAgentSessionCookie, } from "../internal/eve-agent-session-cookie";
|
|
10
10
|
import { isPageVisibleForSurface, } from "../page-visibility";
|
|
11
11
|
const DEFAULT_CHAT_MODEL = "openai/gpt-5.6-sol";
|
|
@@ -749,17 +749,33 @@ const readEveAgentCookieSession = (req, sessionCodec) => {
|
|
|
749
749
|
}
|
|
750
750
|
return null;
|
|
751
751
|
};
|
|
752
|
-
const createEveAgentPrewarmResponse = async ({ agentUrl, enabled, eveAgent, req, sessionCodec, }) => {
|
|
752
|
+
const createEveAgentPrewarmResponse = async ({ agentUrl, body, enabled, eveAgent, req, sessionCodec, }) => {
|
|
753
753
|
// Without a signing secret a prewarmed session could not be bound to the
|
|
754
754
|
// browser, so prewarming is refused rather than allocating sessions
|
|
755
755
|
// nobody can reuse.
|
|
756
756
|
if (!(agentUrl && enabled && sessionCodec)) {
|
|
757
757
|
return createChatErrorResponse("Invalid chat request: eve agent prewarming is not enabled.", 400);
|
|
758
758
|
}
|
|
759
|
-
|
|
759
|
+
if ("sessionTag" in body) {
|
|
760
|
+
const cookieSession = readEveAgentCookieSession(req, sessionCodec);
|
|
761
|
+
if (typeof body.sessionTag !== "string" ||
|
|
762
|
+
body.sessionTag.length !== 22 ||
|
|
763
|
+
!cookieSession ||
|
|
764
|
+
!isSameSessionTag(body.sessionTag, sessionCodec.tag(cookieSession.sessionId))) {
|
|
765
|
+
return createChatErrorResponse("Invalid chat request: session does not match this conversation.", 400);
|
|
766
|
+
}
|
|
767
|
+
await prewarmExistingEveAgentSession({
|
|
768
|
+
agentUrl,
|
|
769
|
+
headers: await getEveAgentRequestHeaders({ eveAgent, req }),
|
|
770
|
+
sessionId: cookieSession.sessionId,
|
|
771
|
+
signal: req.signal,
|
|
772
|
+
});
|
|
773
|
+
// Preparing an owner preserves the session cookie and its expiry.
|
|
774
|
+
return Response.json({ ok: true }, { status: 202 });
|
|
775
|
+
}
|
|
760
776
|
const { sessionId } = await createEmptyEveAgentSession({
|
|
761
777
|
agentUrl,
|
|
762
|
-
headers,
|
|
778
|
+
headers: await getEveAgentRequestHeaders({ eveAgent, req }),
|
|
763
779
|
signal: req.signal,
|
|
764
780
|
});
|
|
765
781
|
return Response.json({ ok: true }, {
|
|
@@ -816,6 +832,7 @@ const resolveChatRequestBody = async ({ eveAgent, eveAgentUrl, limits, prewarmEn
|
|
|
816
832
|
return {
|
|
817
833
|
response: await createEveAgentPrewarmResponse({
|
|
818
834
|
agentUrl: eveAgentUrl,
|
|
835
|
+
body,
|
|
819
836
|
enabled: prewarmEnabled,
|
|
820
837
|
eveAgent,
|
|
821
838
|
req,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/routes/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAA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istant",
|
|
159
159
|
tags: ["Chat"],
|
|
160
160
|
summary: "Ask the documentation assistant",
|
|
161
|
-
description: `Streams an answer from the Ask AI assistant. The assistant searches the documentation before answering and cites the pages it used. The response body is an AI SDK UI message stream sent as server-sent events. This endpoint calls a language model on the site owner's account; use the search endpoint for lookups that do not need an answer written for you.${eveAgent ? " The assistant keeps one session per browser across turns: the response sets a session cookie, and assistant messages carry the stream position in `metadata.eveAgent`. Send the full conversation, including that metadata, with each request." : ""}${prewarm ? ' Send `{ "prewarm": true }` instead of a conversation to allocate an assistant session ahead of the first question; the response sets the session cookie and contains no answer.' : ""}`,
|
|
161
|
+
description: `Streams an answer from the Ask AI assistant. The assistant searches the documentation before answering and cites the pages it used. The response body is an AI SDK UI message stream sent as server-sent events. This endpoint calls a language model on the site owner's account; use the search endpoint for lookups that do not need an answer written for you.${eveAgent ? " The assistant keeps one session per browser across turns: the response sets a session cookie, and assistant messages carry the stream position in `metadata.eveAgent`. Send the full conversation, including that metadata, with each request." : ""}${prewarm ? ' Send `{ "prewarm": true }` instead of a conversation to allocate an assistant session ahead of the first question; the response sets the session cookie and contains no answer. To prepare an existing conversation instead, also send `sessionTag` from the latest answer\'s `metadata.eveAgent.session`; the route verifies it against the signed cookie and preserves the session. Existing-session preparation requires eve 0.83+.' : ""}`,
|
|
162
162
|
requestBody: {
|
|
163
163
|
required: true,
|
|
164
164
|
content: {
|
|
@@ -178,7 +178,7 @@ const buildChatPath = (config) => {
|
|
|
178
178
|
...(prewarm
|
|
179
179
|
? {
|
|
180
180
|
"202": {
|
|
181
|
-
...jsonResponse("
|
|
181
|
+
...jsonResponse("A fresh assistant session was allocated and bound to the session cookie, or an existing-session preparation request was accepted without changing the cookie. Acceptance does not mean a background owner transfer has finished. Sites without a session signing secret refuse prewarm requests with 400.", ref("ChatPrewarmResponse")),
|
|
182
182
|
headers: EVE_AGENT_SESSION_COOKIE_HEADER,
|
|
183
183
|
},
|
|
184
184
|
}
|
|
@@ -351,7 +351,13 @@ const SCHEMAS = {
|
|
|
351
351
|
prewarm: {
|
|
352
352
|
type: "boolean",
|
|
353
353
|
enum: [true],
|
|
354
|
-
description: "
|
|
354
|
+
description: "Prepare an assistant session without asking a question.",
|
|
355
|
+
},
|
|
356
|
+
sessionTag: {
|
|
357
|
+
type: "string",
|
|
358
|
+
minLength: 22,
|
|
359
|
+
maxLength: 22,
|
|
360
|
+
description: "The latest answer's metadata.eveAgent.session tag. When present, prepare only the existing session whose signed cookie matches this tag; a missing, expired, or mismatched cookie is rejected with 400. Omit for fresh-session creation.",
|
|
355
361
|
},
|
|
356
362
|
},
|
|
357
363
|
example: { prewarm: true },
|
|
@@ -362,7 +368,7 @@ const SCHEMAS = {
|
|
|
362
368
|
properties: {
|
|
363
369
|
ok: { type: "boolean", enum: [true] },
|
|
364
370
|
},
|
|
365
|
-
description: "
|
|
371
|
+
description: "Fresh sessions are bound to the `Set-Cookie` response header. Existing-session preparation does not set a cookie. The body carries no session identifier.",
|
|
366
372
|
example: { ok: true },
|
|
367
373
|
},
|
|
368
374
|
UIMessage: {
|
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.13.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.13.1-canary.dd9d47d 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.13.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.13.1-canary.dd9d47d.
|
|
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
|
|
@@ -1346,7 +1346,7 @@ export const ai = {
|
|
|
1346
1346
|
};
|
|
1347
1347
|
```
|
|
1348
1348
|
|
|
1349
|
-
Set `eveAgent.prewarm`
|
|
1349
|
+
Set `eveAgent.prewarm` when preparing a durable session while a reader types is appropriate for the site. Fresh-session creation requires eve 0.59 or newer. With eve 0.83 or newer, the same option also prepares existing conversations before follow-up messages, preserving the session and allowing Send to proceed without waiting.
|
|
1350
1350
|
|
|
1351
1351
|
The `ai` config also controls the chat panel and its route:
|
|
1352
1352
|
|
|
@@ -4275,7 +4275,11 @@ export const ai = {
|
|
|
4275
4275
|
};
|
|
4276
4276
|
```
|
|
4277
4277
|
|
|
4278
|
-
Set `prewarm: true` to
|
|
4278
|
+
Set `prewarm: true` to prepare a session when a reader starts typing each question. In a new conversation, the route creates an empty session and binds it to the browser with the session cookie. The first message waits for that request so it can reuse the session. Fresh-session prewarming requires eve 0.59 or newer.
|
|
4279
|
+
|
|
4280
|
+
With eve 0.83 or newer, typing a follow-up also prepares the existing session owner on the deployment accepting the request. An idle owner on another deployment can transfer before Send. This keeps the same session, history, stream position, and expiry, and runs no model call. The client prepares each idle turn once, including restored conversations. Send proceeds without waiting for existing-session preparation; acceptance does not mean a background transfer has finished.
|
|
4281
|
+
|
|
4282
|
+
Prewarming requires [`GEISTDOCS_CHAT_SECRET`](#keep-eve-sessions-across-turns-with-geistdocs_chat_secret). The route verifies the latest answer's session tag against the signed cookie before preparing an existing session. Preparation failures, older agents without support, and expired or mismatched cookies fall back to the normal send path. Leave prewarming disabled when typing a draft should not allocate a durable session before the reader sends a message.
|
|
4279
4283
|
|
|
4280
4284
|
The URL flows to `createChatRoute` through the config object you already pass in `app/api/chat/route.ts` — no route changes are required. Geistdocs speaks eve's session API directly: it starts or resumes a durable eve session, streams the agent's NDJSON events, and translates them into the same UI message stream the chat panel already renders. With `GEISTDOCS_CHAT_SECRET` set, Geistdocs continues one eve session across turns by binding it to the reader's browser with a signed, httpOnly cookie.
|
|
4281
4285
|
|
package/docs/manifest.json
CHANGED
package/docs/pages/ask-ai.md
CHANGED
|
@@ -336,7 +336,11 @@ export const ai = {
|
|
|
336
336
|
};
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
-
Set `prewarm: true` to
|
|
339
|
+
Set `prewarm: true` to prepare a session when a reader starts typing each question. In a new conversation, the route creates an empty session and binds it to the browser with the session cookie. The first message waits for that request so it can reuse the session. Fresh-session prewarming requires eve 0.59 or newer.
|
|
340
|
+
|
|
341
|
+
With eve 0.83 or newer, typing a follow-up also prepares the existing session owner on the deployment accepting the request. An idle owner on another deployment can transfer before Send. This keeps the same session, history, stream position, and expiry, and runs no model call. The client prepares each idle turn once, including restored conversations. Send proceeds without waiting for existing-session preparation; acceptance does not mean a background transfer has finished.
|
|
342
|
+
|
|
343
|
+
Prewarming requires [`GEISTDOCS_CHAT_SECRET`](#keep-eve-sessions-across-turns-with-geistdocs_chat_secret). The route verifies the latest answer's session tag against the signed cookie before preparing an existing session. Preparation failures, older agents without support, and expired or mismatched cookies fall back to the normal send path. Leave prewarming disabled when typing a draft should not allocate a durable session before the reader sends a message.
|
|
340
344
|
|
|
341
345
|
The URL flows to `createChatRoute` through the config object you already pass in `app/api/chat/route.ts` — no route changes are required. Geistdocs speaks eve's session API directly: it starts or resumes a durable eve session, streams the agent's NDJSON events, and translates them into the same UI message stream the chat panel already renders. With `GEISTDOCS_CHAT_SECRET` set, Geistdocs continues one eve session across turns by binding it to the reader's browser with a signed, httpOnly cookie.
|
|
342
346
|
|
|
@@ -207,7 +207,7 @@ export const ai = {
|
|
|
207
207
|
};
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
Set `eveAgent.prewarm`
|
|
210
|
+
Set `eveAgent.prewarm` when preparing a durable session while a reader types is appropriate for the site. Fresh-session creation requires eve 0.59 or newer. With eve 0.83 or newer, the same option also prepares existing conversations before follow-up messages, preserving the session and allowing Send to proceed without waiting.
|
|
211
211
|
|
|
212
212
|
The `ai` config also controls the chat panel and its route:
|
|
213
213
|
|
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.13.
|
|
4
|
+
"version": "2.13.1-canary.dd9d47d",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -299,6 +299,10 @@
|
|
|
299
299
|
"./theme.css": "./theme.css",
|
|
300
300
|
"./package.json": "./package.json"
|
|
301
301
|
},
|
|
302
|
+
"scripts": {
|
|
303
|
+
"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",
|
|
304
|
+
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
305
|
+
},
|
|
302
306
|
"dependencies": {
|
|
303
307
|
"@ai-sdk/react": "^3.0.134",
|
|
304
308
|
"@clack/prompts": "^0.11.0",
|
|
@@ -362,9 +366,5 @@
|
|
|
362
366
|
"react-dom": "^19.2.3",
|
|
363
367
|
"tsup": "^8.5.1",
|
|
364
368
|
"typescript": "^5.9.3"
|
|
365
|
-
},
|
|
366
|
-
"scripts": {
|
|
367
|
-
"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",
|
|
368
|
-
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
369
369
|
}
|
|
370
|
-
}
|
|
370
|
+
}
|
|
@@ -334,7 +334,11 @@ export const ai = {
|
|
|
334
334
|
};
|
|
335
335
|
```
|
|
336
336
|
|
|
337
|
-
Set `prewarm: true` to
|
|
337
|
+
Set `prewarm: true` to prepare a session when a reader starts typing each question. In a new conversation, the route creates an empty session and binds it to the browser with the session cookie. The first message waits for that request so it can reuse the session. Fresh-session prewarming requires eve 0.59 or newer.
|
|
338
|
+
|
|
339
|
+
With eve 0.83 or newer, typing a follow-up also prepares the existing session owner on the deployment accepting the request. An idle owner on another deployment can transfer before Send. This keeps the same session, history, stream position, and expiry, and runs no model call. The client prepares each idle turn once, including restored conversations. Send proceeds without waiting for existing-session preparation; acceptance does not mean a background transfer has finished.
|
|
340
|
+
|
|
341
|
+
Prewarming requires [`GEISTDOCS_CHAT_SECRET`](#keep-eve-sessions-across-turns-with-geistdocs_chat_secret). The route verifies the latest answer's session tag against the signed cookie before preparing an existing session. Preparation failures, older agents without support, and expired or mismatched cookies fall back to the normal send path. Leave prewarming disabled when typing a draft should not allocate a durable session before the reader sends a message.
|
|
338
342
|
|
|
339
343
|
The URL flows to `createChatRoute` through the config object you already pass in `app/api/chat/route.ts` — no route changes are required. Geistdocs speaks eve's session API directly: it starts or resumes a durable eve session, streams the agent's NDJSON events, and translates them into the same UI message stream the chat panel already renders. With `GEISTDOCS_CHAT_SECRET` set, Geistdocs continues one eve session across turns by binding it to the reader's browser with a signed, httpOnly cookie.
|
|
340
344
|
|
|
@@ -205,7 +205,7 @@ export const ai = {
|
|
|
205
205
|
};
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
Set `eveAgent.prewarm`
|
|
208
|
+
Set `eveAgent.prewarm` when preparing a durable session while a reader types is appropriate for the site. Fresh-session creation requires eve 0.59 or newer. With eve 0.83 or newer, the same option also prepares existing conversations before follow-up messages, preserving the session and allowing Send to proceed without waiting.
|
|
209
209
|
|
|
210
210
|
The `ai` config also controls the chat panel and its route:
|
|
211
211
|
|
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.13.
|
|
20
|
+
"@vercel/geistdocs": "2.13.1-canary.dd9d47d",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|