@vercel/geistdocs 2.13.0 → 2.13.1-canary.87d00b3
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/loading-skeleton.d.ts.map +1 -1
- package/dist/internal/chat/loading-skeleton.js +1 -3
- package/dist/internal/chat/prompt-input.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.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +8 -9
- 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/navbar.d.ts +1 -1
- package/dist/navbar.d.ts.map +1 -1
- package/dist/navbar.js +3 -1
- package/dist/providers/public/components/drawer.d.ts +2 -1
- package/dist/providers/public/components/drawer.d.ts.map +1 -1
- package/dist/providers/public/components/drawer.js +2 -2
- 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 +8 -4
- package/docs/manifest.json +1 -1
- package/docs/pages/ask-ai.md +6 -2
- package/docs/pages/configuration.md +1 -1
- package/package.json +6 -6
- package/template/content/docs/ask-ai.mdx +6 -2
- 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.87d00b3","-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,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAavE,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAWtE,CAAC;AAEF,MA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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 })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading-skeleton.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/loading-skeleton.tsx"],"names":[],"mappings":"AAsCA,eAAO,MAAM,wBAAwB,+CAyCpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,+CAsB7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,sBAGjC;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,
|
|
1
|
+
{"version":3,"file":"loading-skeleton.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/loading-skeleton.tsx"],"names":[],"mappings":"AAsCA,eAAO,MAAM,wBAAwB,+CAyCpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,+CAsB7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,sBAGjC;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,4CAiBA,CAAC"}
|
|
@@ -40,7 +40,5 @@ export const ChatLoadingSkeleton = ({ isMobile, title, }) => {
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
getMessageCount(title).then((count) => setConversation(count > 0));
|
|
42
42
|
}, [title]);
|
|
43
|
-
return (_jsx("div", { className: cn("fixed z-45 flex flex-col bg-background-100", isMobile
|
|
44
|
-
? "inset-x-0 bottom-0 h-[80dvh] rounded-t-xl"
|
|
45
|
-
: "inset-y-0 right-0 w-[400px] border-l"), children: conversation ? _jsx(ChatConversationSkeleton, {}) : _jsx(ChatEmptySkeleton, {}) }));
|
|
43
|
+
return (_jsx("div", { className: cn("fixed z-45 flex flex-col bg-background-100", isMobile ? "inset-0" : "inset-y-0 right-0 w-[400px] border-l"), children: conversation ? _jsx(ChatConversationSkeleton, {}) : _jsx(ChatEmptySkeleton, {}) }));
|
|
46
44
|
};
|
|
@@ -33,5 +33,5 @@ export const ChatPromptInput = ({ onChange, onStop, onSubmit, status, textareaRe
|
|
|
33
33
|
event.currentTarget.form?.requestSubmit();
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
return (_jsx("div", { className: "cursor-text rounded-[12px] border border-gray-300 border-solid pt-2 pb-2 shadow-xs transition-colors duration-250 focus-within:border-gray-500", children: _jsxs("form", { className: "flex flex-col items-center gap-2", onSubmit: onSubmit, children: [_jsx("textarea", { className: "min-h-0 w-full resize-none rounded-none border-0 bg-transparent px-4 py-2 font-sans text-
|
|
36
|
+
return (_jsx("div", { className: "cursor-text rounded-[12px] border border-gray-300 border-solid pt-2 pb-2 shadow-xs transition-colors duration-250 focus-within:border-gray-500", children: _jsxs("form", { className: "flex flex-col items-center gap-2", onSubmit: onSubmit, children: [_jsx("textarea", { className: "min-h-0 w-full resize-none rounded-none border-0 bg-transparent px-4 py-2 font-sans text-copy-16 text-gray-1000 shadow-none outline-hidden ring-0 placeholder:text-gray-600 focus:outline-none focus-visible:ring-0 min-[768px]:text-copy-14", maxLength: 1000, name: "message", onChange: handleChange, onKeyDown: handleKeyDown, placeholder: "Ask a question...", ref: textareaRef, value: value }), _jsx("div", { className: "flex w-full items-center justify-end px-2", children: isGenerating && onStop ? (_jsx(Button, { className: "animate-fade-in-scale", onClick: onStop, prefix: _jsx(IconStopCircle, { className: "size-4" }), size: "small", typeName: "button", children: "Stop" })) : (_jsx(Button, { "aria-label": "Submit", className: "size-8 animate-fade-in-scale p-0", disabled: value.trim().length <= 3, shape: "square", size: "small", svgOnly: true, typeName: "submit", children: _jsx(IconArrowUp, { className: "size-4" }) })) })] }) }));
|
|
37
37
|
};
|
|
@@ -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,MAAM,IAAI,CAAC;
|
|
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,MAAM,IAAI,CAAC;AAK1D,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,iEAAiE;AACjE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,uCAAuC;IACvC,IAAI,EAAE,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,UACqB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,gBAAgB,CAAC;QACjC;;;;;WAKG;QACH,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;KACjD,CAAC;IACF;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,qDAAqD;IACrD,eAAe,EAAE,MAAM,MAAM,GAAG,IAAI,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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/shell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/shell.tsx"],"names":[],"mappings":"AAuaA,eAAO,MAAM,kBAAkB,sDA+D9B,CAAC"}
|
|
@@ -31,22 +31,21 @@ const ChatLoading = () => (_jsx("div", { className: "flex size-full w-full flex-
|
|
|
31
31
|
// Centers the header, transcript, and composer when the panel fills the
|
|
32
32
|
// viewport, so lines stay readable on wide screens.
|
|
33
33
|
const EXPANDED_COLUMN = "mx-auto w-full max-w-5xl";
|
|
34
|
-
const GeistdocsChatInner = ({ active, expandable = false, isOpen, }) => {
|
|
34
|
+
const GeistdocsChatInner = ({ active, expandable = false, focusOnOpen, isOpen, }) => {
|
|
35
35
|
const state = useChatSession();
|
|
36
36
|
const textareaRef = useRef(null);
|
|
37
37
|
const ready = state.status === "ready";
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// shell becomes active (a breakpoint change) doesn't move focus.
|
|
38
|
+
// Desktop readers can type immediately. Mobile readers choose when to open
|
|
39
|
+
// the software keyboard after the full-screen chat has settled.
|
|
41
40
|
useEffect(() => {
|
|
42
|
-
if (!(isOpen && ready)) {
|
|
41
|
+
if (!(active && focusOnOpen && isOpen && ready)) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
const timer = setTimeout(() => {
|
|
46
45
|
textareaRef.current?.focus();
|
|
47
46
|
}, 100);
|
|
48
47
|
return () => clearTimeout(timer);
|
|
49
|
-
}, [isOpen, ready]);
|
|
48
|
+
}, [active, focusOnOpen, isOpen, ready]);
|
|
50
49
|
// The inactive shell is hidden, so it renders nothing: only the visible
|
|
51
50
|
// shell subscribes to the chat and re-renders as a response streams. When
|
|
52
51
|
// the breakpoint changes, the newly active shell renders the shared
|
|
@@ -76,10 +75,10 @@ const GeistdocsChatPanel = ({ clearConversation, expandable, session, textareaRe
|
|
|
76
75
|
const hasDraft = prompt.trim().length > 0;
|
|
77
76
|
// Prewarm on the draft so session startup overlaps with typing.
|
|
78
77
|
useEffect(() => {
|
|
79
|
-
if (hasDraft &&
|
|
78
|
+
if (hasDraft && (status === "ready" || status === "error")) {
|
|
80
79
|
session.prewarm();
|
|
81
80
|
}
|
|
82
|
-
}, [hasDraft,
|
|
81
|
+
}, [hasDraft, session, status]);
|
|
83
82
|
const submitText = useChatCommands({
|
|
84
83
|
clearConversation,
|
|
85
84
|
commandState,
|
|
@@ -160,5 +159,5 @@ export const GeistdocsChatShell = () => {
|
|
|
160
159
|
// modal surfaces like the search command menu, dialogs, and
|
|
161
160
|
// dropdowns (z-50), so opening the command menu paints over an
|
|
162
161
|
// open chat panel.
|
|
163
|
-
"fixed inset-y-0 right-0 z-45 hidden h-full flex-col gap-4 border-l bg-background-100 transition-transform min-[768px]:flex", isExpanded ? "w-screen border-l-0" : "w-[400px] max-w-[75vw]", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", children: _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: !isMobile, expandable: true, isOpen: isOpen }) }) }) }), _jsx("div", { className: "min-[768px]:hidden", children: _jsxs(Drawer, { className: "flex flex-col bg-background-100", height: "
|
|
162
|
+
"fixed inset-y-0 right-0 z-45 hidden h-full flex-col gap-4 border-l bg-background-100 transition-transform min-[768px]:flex", isExpanded ? "w-screen border-l-0" : "w-[400px] max-w-[75vw]", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", children: _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: !isMobile, expandable: true, focusOnOpen: true, isOpen: isOpen }) }) }) }), _jsx("div", { className: "min-[768px]:hidden", children: _jsxs(Drawer, { className: "flex max-h-none flex-col rounded-none bg-background-100", height: "100dvh", onDismiss: () => setIsOpen(false), repositionInputs: false, show: isMobile && isOpen, children: [_jsx(DrawerTitle, { className: "sr-only", children: chatTitle }), _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: isMobile, focusOnOpen: false, isOpen: isOpen }) })] }) })] }));
|
|
164
163
|
};
|
|
@@ -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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;;;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";
|
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
|
};
|
|
@@ -5,9 +5,10 @@ interface DrawerProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
height?: number | string;
|
|
7
7
|
onDismiss?: () => void;
|
|
8
|
+
repositionInputs?: boolean;
|
|
8
9
|
show?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare const Drawer: ({ children, className, height, onDismiss, show, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Drawer: ({ children, className, height, onDismiss, repositionInputs, show, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export declare const DrawerTitle: ({ className, ...props }: ComponentProps<typeof DrawerPrimitive.Title>) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../../src/providers/public/components/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAGjD,UAAU,WAAW;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../../src/providers/public/components/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAGjD,UAAU,WAAW;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,GAAI,qEAOpB,WAAW,4CAuBb,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,yBAGzB,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAK9C,CAAC"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
4
4
|
import { cn } from "../utils";
|
|
5
|
-
export const Drawer = ({ children, className, height, onDismiss, show, }) => (_jsx(DrawerPrimitive.Root, { onOpenChange: (open) => {
|
|
5
|
+
export const Drawer = ({ children, className, height, onDismiss, repositionInputs, show, }) => (_jsx(DrawerPrimitive.Root, { onOpenChange: (open) => {
|
|
6
6
|
if (!open) {
|
|
7
7
|
onDismiss?.();
|
|
8
8
|
}
|
|
9
|
-
}, open: show, children: _jsxs(DrawerPrimitive.Portal, { children: [_jsx(DrawerPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/40" }), _jsx(DrawerPrimitive.Content, { className: cn("fixed inset-x-0 bottom-0 z-50 flex max-h-[90dvh] flex-col rounded-t-xl bg-background-100 shadow-[var(--ds-shadow-modal)] outline-none", className), style: { height }, children: children })] }) }));
|
|
9
|
+
}, open: show, repositionInputs: repositionInputs, children: _jsxs(DrawerPrimitive.Portal, { children: [_jsx(DrawerPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/40" }), _jsx(DrawerPrimitive.Content, { className: cn("fixed inset-x-0 bottom-0 z-50 flex max-h-[90dvh] flex-col rounded-t-xl bg-background-100 shadow-[var(--ds-shadow-modal)] outline-none", className), style: { height }, children: children })] }) }));
|
|
10
10
|
export const DrawerTitle = ({ className, ...props }) => (_jsx(DrawerPrimitive.Title, { className: cn("font-semibold text-gray-1000", className), ...props }));
|
|
@@ -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,GAC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KG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAyqDD,eAAO,MAAM,eAAe,GAAI,wGAW7B,sBAAsB;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+B,MAAM,WAAW,CAAC;AAS9E,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,IAAI,CACV,eAAe,EACb,OAAO,GACP,IAAI,GACJ,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,cAAc,CACjB,CAAC;IACF;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,wBAAwB,EAClC,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAC9B,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAC;CACnE;AAID,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC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AM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACxD,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClB,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C;AAokBD,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,yBAAyB;mBAmBE,WAAW;;;;;CA6BxC,CAAC"}
|
package/dist/routes/openapi.js
CHANGED
|
@@ -158,7 +158,7 @@ const buildChatPath = (config) => {
|
|
|
158
158
|
operationId: "askDocsAssistant",
|
|
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.87d00b3 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.87d00b3.
|
|
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
|
|
|
@@ -4681,7 +4685,7 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
4681
4685
|
The chat interface adapts to different screen sizes:
|
|
4682
4686
|
|
|
4683
4687
|
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
4684
|
-
- **Mobile**: Opens as a
|
|
4688
|
+
- **Mobile**: Opens as a full-screen chat and waits for the reader to focus the prompt before opening the software keyboard.
|
|
4685
4689
|
|
|
4686
4690
|
## Configuration
|
|
4687
4691
|
|
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
|
|
|
@@ -742,7 +746,7 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
742
746
|
The chat interface adapts to different screen sizes:
|
|
743
747
|
|
|
744
748
|
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
745
|
-
- **Mobile**: Opens as a
|
|
749
|
+
- **Mobile**: Opens as a full-screen chat and waits for the reader to focus the prompt before opening the software keyboard.
|
|
746
750
|
|
|
747
751
|
## Configuration
|
|
748
752
|
|
|
@@ -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.87d00b3",
|
|
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
|
|
|
@@ -740,7 +744,7 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
740
744
|
The chat interface adapts to different screen sizes:
|
|
741
745
|
|
|
742
746
|
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
743
|
-
- **Mobile**: Opens as a
|
|
747
|
+
- **Mobile**: Opens as a full-screen chat and waits for the reader to focus the prompt before opening the software keyboard.
|
|
744
748
|
|
|
745
749
|
## Configuration
|
|
746
750
|
|
|
@@ -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.87d00b3",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|