@vercel/geistdocs 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/icon-fullscreen-close.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen-close.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen-close.js +25 -0
- package/dist/assets/icons/icon-fullscreen.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen.js +25 -0
- package/dist/assets/icons/index.d.ts +2 -0
- package/dist/assets/icons/index.d.ts.map +1 -1
- package/dist/assets/icons/index.js +2 -0
- package/dist/cli/index.js +1 -1
- package/dist/internal/chat/context.d.ts +3 -0
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +7 -0
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +15 -10
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +226 -19
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +9 -3
- package/docs/agents.md +1 -1
- package/docs/llms.txt +4 -3
- package/docs/manifest.json +1 -1
- package/docs/pages/ask-ai.md +3 -2
- package/package.json +1 -1
- package/template/content/docs/ask-ai.mdx +3 -2
- package/template/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ! THIS FILE WAS AUTO_GENERATED - DO NOT EDIT MANUALLY
|
|
3
|
+
*
|
|
4
|
+
* ▲ Part of Vercel's Geistcn Design System
|
|
5
|
+
* Generated by: pnpm icons:build
|
|
6
|
+
*
|
|
7
|
+
* @see Slack #project-geistcn for support: https://vercel.slack.com/archives/C08AW4PQHK3
|
|
8
|
+
*/
|
|
9
|
+
import type { JSX } from "react";
|
|
10
|
+
import { type IconProps } from "../_internal/components/icon/base-icon.js";
|
|
11
|
+
/**
|
|
12
|
+
* Icon component - renders as SVG
|
|
13
|
+
*
|
|
14
|
+
* @param props.size - Controls icon height; width is auto-calculated to preserve aspect ratio (accepts number or string with optional "px" suffix)
|
|
15
|
+
* @param props.color - Fill color for the icon (default: 'currentColor')
|
|
16
|
+
* @param props.className - CSS class name for styling
|
|
17
|
+
* @param props.style - Inline styles (excludes `width`, `height` which are managed internally)
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* - Inherits all standard SVG element props except `width`, `height`, `viewBox`, `fill` which are managed internally.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link IconProps} for complete prop types
|
|
23
|
+
* @see {@link BaseIcon} for underlying implementation behavior
|
|
24
|
+
*/
|
|
25
|
+
export declare function IconFullscreenClose(props: IconProps): JSX.Element;
|
|
26
|
+
//# sourceMappingURL=icon-fullscreen-close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-fullscreen-close.d.ts","sourceRoot":"","sources":["../../../src/assets/icons/icon-fullscreen-close.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAMjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { BaseIcon, } from "../_internal/components/icon/base-icon.js";
|
|
3
|
+
/**
|
|
4
|
+
* Icon component - renders as SVG
|
|
5
|
+
*
|
|
6
|
+
* @param props.size - Controls icon height; width is auto-calculated to preserve aspect ratio (accepts number or string with optional "px" suffix)
|
|
7
|
+
* @param props.color - Fill color for the icon (default: 'currentColor')
|
|
8
|
+
* @param props.className - CSS class name for styling
|
|
9
|
+
* @param props.style - Inline styles (excludes `width`, `height` which are managed internally)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - Inherits all standard SVG element props except `width`, `height`, `viewBox`, `fill` which are managed internally.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link IconProps} for complete prop types
|
|
15
|
+
* @see {@link BaseIcon} for underlying implementation behavior
|
|
16
|
+
*/
|
|
17
|
+
export function IconFullscreenClose(props) {
|
|
18
|
+
return (_jsx(BaseIcon, { "$generated": GENERATED_CONFIG, ...props, children: ICON_PATHS }));
|
|
19
|
+
}
|
|
20
|
+
const GENERATED_CONFIG = {
|
|
21
|
+
height: 16,
|
|
22
|
+
aspectRatio: 1,
|
|
23
|
+
viewBox: "0 0 16 16",
|
|
24
|
+
};
|
|
25
|
+
const ICON_PATHS = (_jsx(_Fragment, { children: _jsx("path", { clipRule: "evenodd", d: "M6 1v4a1 1 0 0 1-1 1H1V4.5h3.5V1zm8.25 5H15V4.5h-3.5V1H10v4a1 1 0 0 0 1 1zM10 14.25V15h1.5v-3.5h3.54V10H11a1 1 0 0 0-1 1zM1.75 10H1v1.5h3.5V15H6v-4a1 1 0 0 0-1-1z", fill: "currentColor", fillRule: "evenodd" }) }));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ! THIS FILE WAS AUTO_GENERATED - DO NOT EDIT MANUALLY
|
|
3
|
+
*
|
|
4
|
+
* ▲ Part of Vercel's Geistcn Design System
|
|
5
|
+
* Generated by: pnpm icons:build
|
|
6
|
+
*
|
|
7
|
+
* @see Slack #project-geistcn for support: https://vercel.slack.com/archives/C08AW4PQHK3
|
|
8
|
+
*/
|
|
9
|
+
import type { JSX } from "react";
|
|
10
|
+
import { type IconProps } from "../_internal/components/icon/base-icon.js";
|
|
11
|
+
/**
|
|
12
|
+
* Icon component - renders as SVG
|
|
13
|
+
*
|
|
14
|
+
* @param props.size - Controls icon height; width is auto-calculated to preserve aspect ratio (accepts number or string with optional "px" suffix)
|
|
15
|
+
* @param props.color - Fill color for the icon (default: 'currentColor')
|
|
16
|
+
* @param props.className - CSS class name for styling
|
|
17
|
+
* @param props.style - Inline styles (excludes `width`, `height` which are managed internally)
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* - Inherits all standard SVG element props except `width`, `height`, `viewBox`, `fill` which are managed internally.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link IconProps} for complete prop types
|
|
23
|
+
* @see {@link BaseIcon} for underlying implementation behavior
|
|
24
|
+
*/
|
|
25
|
+
export declare function IconFullscreen(props: IconProps): JSX.Element;
|
|
26
|
+
//# sourceMappingURL=icon-fullscreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-fullscreen.d.ts","sourceRoot":"","sources":["../../../src/assets/icons/icon-fullscreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAM5D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { BaseIcon, } from "../_internal/components/icon/base-icon.js";
|
|
3
|
+
/**
|
|
4
|
+
* Icon component - renders as SVG
|
|
5
|
+
*
|
|
6
|
+
* @param props.size - Controls icon height; width is auto-calculated to preserve aspect ratio (accepts number or string with optional "px" suffix)
|
|
7
|
+
* @param props.color - Fill color for the icon (default: 'currentColor')
|
|
8
|
+
* @param props.className - CSS class name for styling
|
|
9
|
+
* @param props.style - Inline styles (excludes `width`, `height` which are managed internally)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - Inherits all standard SVG element props except `width`, `height`, `viewBox`, `fill` which are managed internally.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link IconProps} for complete prop types
|
|
15
|
+
* @see {@link BaseIcon} for underlying implementation behavior
|
|
16
|
+
*/
|
|
17
|
+
export function IconFullscreen(props) {
|
|
18
|
+
return (_jsx(BaseIcon, { "$generated": GENERATED_CONFIG, ...props, children: ICON_PATHS }));
|
|
19
|
+
}
|
|
20
|
+
const GENERATED_CONFIG = {
|
|
21
|
+
height: 16,
|
|
22
|
+
aspectRatio: 1,
|
|
23
|
+
viewBox: "0 0 16 16",
|
|
24
|
+
};
|
|
25
|
+
const ICON_PATHS = (_jsx(_Fragment, { children: _jsx("path", { clipRule: "evenodd", d: "M1 5.25V6h1.5V2.5H6V1H2a1 1 0 0 0-1 1zM5.25 15H6v-1.5H2.5V10H1v4a1 1 0 0 0 1 1zM15 10v4a1 1 0 0 1-1 1h-4v-1.5h3.5V10zm-4.25-9H10v1.5h3.5V6H15V2a1 1 0 0 0-1-1z", fill: "currentColor", fillRule: "evenodd" }) }));
|
|
@@ -36,6 +36,8 @@ export { IconFileText } from "./icon-file-text";
|
|
|
36
36
|
export { IconFluid } from "./icon-fluid";
|
|
37
37
|
export { IconFolderOpen } from "./icon-folder-open";
|
|
38
38
|
export { IconForward10Seconds10 } from "./icon-forward-10-seconds-10";
|
|
39
|
+
export { IconFullscreen } from "./icon-fullscreen";
|
|
40
|
+
export { IconFullscreenClose } from "./icon-fullscreen-close";
|
|
39
41
|
export { IconInformation } from "./icon-information";
|
|
40
42
|
export { IconLanguages } from "./icon-languages";
|
|
41
43
|
export { IconLink } from "./icon-link";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assets/icons/index.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAGrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,E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M,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -37,6 +37,8 @@ export { IconFileText } from "./icon-file-text";
|
|
|
37
37
|
export { IconFluid } from "./icon-fluid";
|
|
38
38
|
export { IconFolderOpen } from "./icon-folder-open";
|
|
39
39
|
export { IconForward10Seconds10 } from "./icon-forward-10-seconds-10";
|
|
40
|
+
export { IconFullscreen } from "./icon-fullscreen";
|
|
41
|
+
export { IconFullscreenClose } from "./icon-fullscreen-close";
|
|
40
42
|
export { IconInformation } from "./icon-information";
|
|
41
43
|
export { IconLanguages } from "./icon-languages";
|
|
42
44
|
export { IconLink } from "./icon-link";
|
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.8.0","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.9.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});
|
|
@@ -43,11 +43,14 @@ interface GeistdocsChatContextValue {
|
|
|
43
43
|
hasBeenOpened: boolean;
|
|
44
44
|
/** Milliseconds a stored conversation is kept after its last message. */
|
|
45
45
|
historyRetentionMs: number;
|
|
46
|
+
/** Desktop panel fills the viewport. Reset when the chat closes. */
|
|
47
|
+
isExpanded: boolean;
|
|
46
48
|
isOpen: boolean;
|
|
47
49
|
openWithPage: GeistdocsChatController["openWithPage"];
|
|
48
50
|
preloadChat: () => void;
|
|
49
51
|
prewarmEveAgent: boolean;
|
|
50
52
|
prompt: string;
|
|
53
|
+
setIsExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
51
54
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
52
55
|
setPrompt: React.Dispatch<React.SetStateAction<string>>;
|
|
53
56
|
setUser: React.Dispatch<React.SetStateAction<ChatUser | null>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/context.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAGtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,WAAW,CAAC;AAInB,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;CACb;AAED,+DAA+D;AAC/D,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AAI,CAAC;CACvB;AAMD,eAAO,MAAM,uBAAuB,iCAQnC,CAAC;AAEF,UAAU,0BAA0B;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC;CAC5D;AAED,eAAO,MAAM,qBAAqB,GAAI,uBAGnC,0BAA0B,4CAkI5B,CAAC"}
|
|
@@ -14,6 +14,7 @@ export const useGeistdocsChatContext = () => {
|
|
|
14
14
|
};
|
|
15
15
|
export const GeistdocsChatProvider = ({ children, config, }) => {
|
|
16
16
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
17
18
|
const [hasBeenOpened, setHasBeenOpened] = useState(false);
|
|
18
19
|
const [prompt, setPrompt] = useState("");
|
|
19
20
|
const [user, setUser] = useState(null);
|
|
@@ -53,6 +54,9 @@ export const GeistdocsChatProvider = ({ children, config, }) => {
|
|
|
53
54
|
if (isOpen) {
|
|
54
55
|
setHasBeenOpened(true);
|
|
55
56
|
}
|
|
57
|
+
else {
|
|
58
|
+
setIsExpanded(false);
|
|
59
|
+
}
|
|
56
60
|
}, [isOpen]);
|
|
57
61
|
useEffect(() => {
|
|
58
62
|
window.localStorage.setItem(CHAT_OPEN_STORAGE_KEY, String(isOpen));
|
|
@@ -74,11 +78,13 @@ export const GeistdocsChatProvider = ({ children, config, }) => {
|
|
|
74
78
|
enabled,
|
|
75
79
|
hasBeenOpened,
|
|
76
80
|
historyRetentionMs: resolveChatHistoryRetentionMs(retentionDays),
|
|
81
|
+
isExpanded,
|
|
77
82
|
isOpen,
|
|
78
83
|
openWithPage,
|
|
79
84
|
preloadChat,
|
|
80
85
|
prewarmEveAgent: config.ai?.eveAgent?.prewarm === true,
|
|
81
86
|
prompt,
|
|
87
|
+
setIsExpanded,
|
|
82
88
|
setIsOpen,
|
|
83
89
|
setPrompt,
|
|
84
90
|
setUser,
|
|
@@ -94,6 +100,7 @@ export const GeistdocsChatProvider = ({ children, config, }) => {
|
|
|
94
100
|
config.title,
|
|
95
101
|
enabled,
|
|
96
102
|
hasBeenOpened,
|
|
103
|
+
isExpanded,
|
|
97
104
|
isOpen,
|
|
98
105
|
openWithPage,
|
|
99
106
|
preloadChat,
|
|
@@ -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":"AA6ZA,eAAO,MAAM,kBAAkB,sDAgE9B,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useChat } from "@ai-sdk/react";
|
|
|
4
4
|
import { catchError } from "next/error";
|
|
5
5
|
import { Portal } from "radix-ui";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
|
-
import { IconChevronDoubleRight, IconTrash } from "#geistdocs-assets/icons";
|
|
7
|
+
import { IconChevronDoubleRight, IconFullscreen, IconFullscreenClose, IconTrash, } from "#geistdocs-assets/icons";
|
|
8
8
|
import { Button } from "#geistdocs-ui/components/button";
|
|
9
9
|
import { Drawer, DrawerTitle } from "#geistdocs-ui/components/drawer";
|
|
10
10
|
import { Kbd } from "#geistdocs-ui/components/kbd";
|
|
@@ -28,7 +28,10 @@ import { Suggestion, Suggestions } from "./suggestion";
|
|
|
28
28
|
import { useChatCommands } from "./use-chat-commands";
|
|
29
29
|
import { useChatUserAvatar } from "./user-avatar";
|
|
30
30
|
const ChatLoading = () => (_jsx("div", { className: "flex size-full w-full flex-col items-center justify-center overflow-hidden whitespace-nowrap rounded-xl xl:max-w-md xl:border xl:bg-background-100", children: _jsx(Spinner, {}) }));
|
|
31
|
-
|
|
31
|
+
// Centers the header, transcript, and composer when the panel fills the
|
|
32
|
+
// viewport, so lines stay readable on wide screens.
|
|
33
|
+
const EXPANDED_COLUMN = "mx-auto w-full max-w-5xl";
|
|
34
|
+
const GeistdocsChatInner = ({ active, expandable = false, isOpen, }) => {
|
|
32
35
|
const state = useChatSession();
|
|
33
36
|
const textareaRef = useRef(null);
|
|
34
37
|
const ready = state.status === "ready";
|
|
@@ -59,11 +62,13 @@ const GeistdocsChatInner = ({ active, isOpen, }) => {
|
|
|
59
62
|
if (state.status === "loading") {
|
|
60
63
|
return _jsx(ChatLoading, {});
|
|
61
64
|
}
|
|
62
|
-
return (_jsx(GeistdocsChatPanel, { clearConversation: state.clearConversation, session: state.session, textareaRef: textareaRef }));
|
|
65
|
+
return (_jsx(GeistdocsChatPanel, { clearConversation: state.clearConversation, expandable: expandable, session: state.session, textareaRef: textareaRef }));
|
|
63
66
|
};
|
|
64
|
-
const GeistdocsChatPanel = ({ clearConversation, session, textareaRef, }) => {
|
|
67
|
+
const GeistdocsChatPanel = ({ clearConversation, expandable, session, textareaRef, }) => {
|
|
65
68
|
const toast = useToasts();
|
|
66
|
-
const { prompt, setPrompt, setIsOpen, chatTitle, commands, commandState, footer, suggestions, } = useGeistdocsChatContext();
|
|
69
|
+
const { prompt, setPrompt, setIsOpen, chatTitle, commands, commandState, footer, isExpanded: isExpandedState, setIsExpanded, suggestions, } = useGeistdocsChatContext();
|
|
70
|
+
const isExpanded = expandable && isExpandedState;
|
|
71
|
+
const expandLabel = isExpanded ? "Collapse chat" : "Expand chat";
|
|
67
72
|
const userAvatar = useChatUserAvatar();
|
|
68
73
|
const { messages, sendMessage, setMessages, status, stop } = useChat({
|
|
69
74
|
chat: session.chat,
|
|
@@ -105,15 +110,15 @@ const GeistdocsChatPanel = ({ clearConversation, session, textareaRef, }) => {
|
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
112
|
};
|
|
108
|
-
return (_jsxs("aside", { "aria-label": `${chatTitle} chat`, className: "flex size-full w-full flex-col overflow-hidden whitespace-nowrap bg-background-100", children: [_jsxs("div", { className: "sticky top-0 z-10 flex h-16 items-center justify-between bg-background-100 py-2 pr-2 pl-3.5", children: [_jsx("h2", { className: "font-semibold text-sm", children: chatTitle }), _jsxs("div", { className: "flex items-center gap-0.5", children: [_jsx(CopyChat, { messages: messages }), _jsx(Tooltip, { position: "bottom", text: "Delete chat", children: _jsx(Button, { "aria-label": "Delete chat", className: "text-gray-800! disabled:bg-gray-alpha-100!", disabled: messages.length === 0 ||
|
|
113
|
+
return (_jsxs("aside", { "aria-label": `${chatTitle} chat`, className: "flex size-full w-full flex-col overflow-hidden whitespace-nowrap bg-background-100", children: [_jsxs("div", { className: cn("sticky top-0 z-10 flex h-16 shrink-0 items-center justify-between bg-background-100 py-2 pr-2 pl-3.5", isExpanded && EXPANDED_COLUMN), children: [_jsx("h2", { className: "font-semibold text-sm", children: chatTitle }), _jsxs("div", { className: "flex items-center gap-0.5", children: [_jsx(CopyChat, { messages: messages }), expandable ? (_jsx(Tooltip, { position: "bottom", text: expandLabel, children: _jsx(Button, { "aria-label": expandLabel, "aria-pressed": isExpanded, className: "text-gray-800! shadow-none", onClick: () => setIsExpanded(!isExpanded), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: isExpanded ? (_jsx(IconFullscreenClose, { size: 14 })) : (_jsx(IconFullscreen, { size: 14 })) }) })) : null, _jsx(Tooltip, { position: "bottom", text: "Delete chat", children: _jsx(Button, { "aria-label": "Delete chat", className: "text-gray-800! disabled:bg-gray-alpha-100!", disabled: messages.length === 0 ||
|
|
109
114
|
status === "streaming" ||
|
|
110
|
-
status === "submitted", onClick: handleClearChat, shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconTrash, { size: 14 }) }) }), _jsx(Tooltip, { position: "bottom", text: "Close chat", children: _jsx(Button, { "aria-label": "Close chat", className: "text-gray-800! shadow-none", onClick: () => setIsOpen(false), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconChevronDoubleRight, { size: 14 }) }) })] })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { children: [messages.map((message, index) => (_jsxs(Message, { avatar: message.role === "user" ? userAvatar : undefined, from: message.role, children: [_jsx(MessageMetadata, { inProgress: isActiveAssistantMessage({
|
|
115
|
+
status === "submitted", onClick: handleClearChat, shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconTrash, { size: 14 }) }) }), _jsx(Tooltip, { position: "bottom", text: "Close chat", children: _jsx(Button, { "aria-label": "Close chat", className: "text-gray-800! shadow-none", onClick: () => setIsOpen(false), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconChevronDoubleRight, { size: 14 }) }) })] })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { className: cn(isExpanded && EXPANDED_COLUMN), children: [messages.map((message, index) => (_jsxs(Message, { avatar: message.role === "user" ? userAvatar : undefined, from: message.role, children: [_jsx(MessageMetadata, { inProgress: isActiveAssistantMessage({
|
|
111
116
|
index,
|
|
112
117
|
messages,
|
|
113
118
|
status,
|
|
114
119
|
}), parts: message.parts }), _jsx(ChatMessagePageChip, { metadata: message.metadata }), message.parts
|
|
115
120
|
.filter((part) => part.type === "text")
|
|
116
|
-
.map((part) => (_jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${part.type}-${part.text}`))), _jsx(MessageActions, { index: index, messages: messages, setMessages: setMessages, status: status })] }, message.id))), shouldShowPendingActivity({ messages, status }) ? (_jsx("div", { className: "h-12 animate-pulse pt-2 text-gray-900 text-sm", children: _jsx(DotsSpinner, {}) })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: "relative grid w-auto shrink-0 gap-3 whitespace-normal p-4 text-left", children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "w-full cursor-text", children: suggestions.map((suggestion) => (_jsx(Suggestion, { className: "w-full", icon: suggestion.icon, onClick: handleSuggestionClick, suggestion: suggestion.text, variant: "tertiary" }, suggestion.key))) }), _jsxs("p", { className: "mb-3 whitespace-normal px-2 text-left text-gray-900 text-label-14", children: ["Tip: You can open and close chat with", _jsx(Kbd, { className: "material-base ml-1.5 text-gray-900", meta: true, small: true }), _jsx(Kbd, { className: "material-base ml-1 font-mono! text-gray-900", small: true, children: "I" })] })] })), commandState.attachedPage ? (_jsx(ChatPageAttachmentCard, { onRemove: commands.detachPage, page: commandState.attachedPage })) : null, _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
|
|
121
|
+
.map((part) => (_jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${part.type}-${part.text}`))), _jsx(MessageActions, { index: index, messages: messages, setMessages: setMessages, status: status })] }, message.id))), shouldShowPendingActivity({ messages, status }) ? (_jsx("div", { className: "h-12 animate-pulse pt-2 text-gray-900 text-sm", children: _jsx(DotsSpinner, {}) })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: cn("relative grid w-auto shrink-0 gap-3 whitespace-normal p-4 text-left", isExpanded && EXPANDED_COLUMN), children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "w-full cursor-text", children: suggestions.map((suggestion) => (_jsx(Suggestion, { className: "w-full", icon: suggestion.icon, onClick: handleSuggestionClick, suggestion: suggestion.text, variant: "tertiary" }, suggestion.key))) }), _jsxs("p", { className: "mb-3 whitespace-normal px-2 text-left text-gray-900 text-label-14", children: ["Tip: You can open and close chat with", _jsx(Kbd, { className: "material-base ml-1.5 text-gray-900", meta: true, small: true }), _jsx(Kbd, { className: "material-base ml-1 font-mono! text-gray-900", small: true, children: "I" })] })] })), commandState.attachedPage ? (_jsx(ChatPageAttachmentCard, { onRemove: commands.detachPage, page: commandState.attachedPage })) : null, _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
|
|
117
122
|
event.preventDefault();
|
|
118
123
|
handleSubmit().catch((error) => {
|
|
119
124
|
console.error("Failed to submit chat message:", error);
|
|
@@ -136,7 +141,7 @@ const GeistdocsChatError = ({ chatTitle, onClose, retry, }) => {
|
|
|
136
141
|
const GeistdocsChatErrorFallback = ({ chatTitle, onClose }, { retry }) => (_jsx(GeistdocsChatError, { chatTitle: chatTitle, onClose: onClose, retry: retry }));
|
|
137
142
|
const GeistdocsChatErrorBoundary = catchError(GeistdocsChatErrorFallback);
|
|
138
143
|
export const GeistdocsChatShell = () => {
|
|
139
|
-
const { chatTitle, enabled, isOpen, setIsOpen } = useGeistdocsChatContext();
|
|
144
|
+
const { chatTitle, enabled, isExpanded, isOpen, setIsOpen } = useGeistdocsChatContext();
|
|
140
145
|
// The shell mounts only on the client after hydration, so read the
|
|
141
146
|
// breakpoint now instead of starting as desktop for a frame.
|
|
142
147
|
const isMobile = useIsMobileAfterHydration();
|
|
@@ -156,5 +161,5 @@ export const GeistdocsChatShell = () => {
|
|
|
156
161
|
// modal surfaces like the search command menu, dialogs, and
|
|
157
162
|
// dropdowns (z-50), so opening the command menu paints over an
|
|
158
163
|
// open chat panel.
|
|
159
|
-
"fixed inset-y-0 right-0 z-45 hidden h-full
|
|
164
|
+
"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: "80dvh", onDismiss: () => setIsOpen(false), show: isMobile && isOpen, children: [_jsx(DrawerTitle, { className: "sr-only", children: chatTitle }), _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: isMobile, isOpen: isOpen }) })] }) })] }));
|
|
160
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,SAAS,CAAC;AA43CtD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,aAAa,MAGjD,QAAQ,MAAM,oBAe7B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,aAAa,WAlBF,MAAM,oBAkBoB,CAAC"}
|
|
@@ -6,7 +6,9 @@ import remarkStringify from "remark-stringify";
|
|
|
6
6
|
import { unified } from "unified";
|
|
7
7
|
const LEADING_WHITESPACE = /^\s+/;
|
|
8
8
|
const TRAILING_WHITESPACE = /\s+$/;
|
|
9
|
+
const VERSIONED_PATH = /^\/v\d+(?:\/|$)/;
|
|
9
10
|
const WHITESPACE = /\s+/;
|
|
11
|
+
const markdownFragmentParser = unified().use(remarkParse).use(remarkGfm);
|
|
10
12
|
// JSX applies props left to right, so a repeated attribute or a later spread
|
|
11
13
|
// wins at runtime. Read the last literal and distrust it when a spread follows.
|
|
12
14
|
const findAttribute = (node, name) => {
|
|
@@ -38,6 +40,16 @@ function expressionString(node) {
|
|
|
38
40
|
}
|
|
39
41
|
return undefined;
|
|
40
42
|
}
|
|
43
|
+
const expressionBoolean = (node) => node?.type === "Literal" && typeof node.value === "boolean"
|
|
44
|
+
? node.value
|
|
45
|
+
: undefined;
|
|
46
|
+
const expressionScalar = (node) => {
|
|
47
|
+
if (node?.type === "Literal" &&
|
|
48
|
+
(typeof node.value === "string" || typeof node.value === "number")) {
|
|
49
|
+
return String(node.value);
|
|
50
|
+
}
|
|
51
|
+
return expressionString(node);
|
|
52
|
+
};
|
|
41
53
|
const getAttribute = (node, name) => {
|
|
42
54
|
const attribute = findAttribute(node, name);
|
|
43
55
|
if (!attribute) {
|
|
@@ -95,6 +107,15 @@ const paragraph = (value) => ({
|
|
|
95
107
|
children: [{ type: "text", value }],
|
|
96
108
|
type: "paragraph",
|
|
97
109
|
});
|
|
110
|
+
const strongParagraph = (value) => ({
|
|
111
|
+
children: [
|
|
112
|
+
{
|
|
113
|
+
children: [{ type: "text", value }],
|
|
114
|
+
type: "strong",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
type: "paragraph",
|
|
118
|
+
});
|
|
98
119
|
const inlineCode = (value) => ({
|
|
99
120
|
type: "inlineCode",
|
|
100
121
|
value,
|
|
@@ -342,6 +363,37 @@ const listItem = (label, nested) => ({
|
|
|
342
363
|
spread: false,
|
|
343
364
|
type: "listItem",
|
|
344
365
|
});
|
|
366
|
+
const describedListItem = (label, description, nested) => {
|
|
367
|
+
const descriptionBlocks = description
|
|
368
|
+
? (markdownFragmentParser.parse(description)
|
|
369
|
+
.children ?? [])
|
|
370
|
+
: [];
|
|
371
|
+
const first = descriptionBlocks[0];
|
|
372
|
+
const inlineDescription = first?.type === "paragraph" ? (first.children ?? []) : [];
|
|
373
|
+
const remainingDescription = inlineDescription.length > 0
|
|
374
|
+
? descriptionBlocks.slice(1)
|
|
375
|
+
: descriptionBlocks;
|
|
376
|
+
return {
|
|
377
|
+
children: [
|
|
378
|
+
{
|
|
379
|
+
children: [
|
|
380
|
+
...label,
|
|
381
|
+
...(label.length > 0 && inlineDescription.length > 0
|
|
382
|
+
? [{ type: "text", value: " " }]
|
|
383
|
+
: []),
|
|
384
|
+
...inlineDescription,
|
|
385
|
+
],
|
|
386
|
+
type: "paragraph",
|
|
387
|
+
},
|
|
388
|
+
...remainingDescription,
|
|
389
|
+
...(nested.length > 0
|
|
390
|
+
? [{ children: nested, ordered: false, spread: false, type: "list" }]
|
|
391
|
+
: []),
|
|
392
|
+
],
|
|
393
|
+
spread: remainingDescription.length > 0,
|
|
394
|
+
type: "listItem",
|
|
395
|
+
};
|
|
396
|
+
};
|
|
345
397
|
const describedLabel = (label, description) => {
|
|
346
398
|
if (!description) {
|
|
347
399
|
return label;
|
|
@@ -408,6 +460,89 @@ const propertiesTableNodes = (node) => {
|
|
|
408
460
|
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
409
461
|
: [];
|
|
410
462
|
};
|
|
463
|
+
const constraintItems = (entry) => objectElements(objectProperty(entry, "constraints")).flatMap((constraint) => {
|
|
464
|
+
const label = expressionString(objectProperty(constraint, "label"));
|
|
465
|
+
const value = expressionScalar(objectProperty(constraint, "value"));
|
|
466
|
+
if (!(label && value)) {
|
|
467
|
+
return [];
|
|
468
|
+
}
|
|
469
|
+
return [
|
|
470
|
+
listItem([
|
|
471
|
+
{
|
|
472
|
+
children: [{ type: "text", value: `${label}:` }],
|
|
473
|
+
type: "strong",
|
|
474
|
+
},
|
|
475
|
+
{ type: "text", value: ` ${value}` },
|
|
476
|
+
], []),
|
|
477
|
+
];
|
|
478
|
+
});
|
|
479
|
+
const apiVariantItems = (entry) => objectElements(objectProperty(entry, "variants")).flatMap((variant) => {
|
|
480
|
+
const name = expressionString(objectProperty(variant, "name"));
|
|
481
|
+
const description = expressionString(objectProperty(variant, "description"));
|
|
482
|
+
const nested = apiParameterItems(objectElements(objectProperty(variant, "properties")));
|
|
483
|
+
if (!name) {
|
|
484
|
+
return nested;
|
|
485
|
+
}
|
|
486
|
+
return [
|
|
487
|
+
describedListItem([
|
|
488
|
+
{
|
|
489
|
+
children: [{ type: "text", value: name }],
|
|
490
|
+
type: "strong",
|
|
491
|
+
},
|
|
492
|
+
], description, nested),
|
|
493
|
+
];
|
|
494
|
+
});
|
|
495
|
+
function apiParameterItems(entries) {
|
|
496
|
+
return entries.flatMap((entry) => {
|
|
497
|
+
const name = expressionString(objectProperty(entry, "name"));
|
|
498
|
+
const type = expressionString(objectProperty(entry, "type"));
|
|
499
|
+
const description = expressionString(objectProperty(entry, "description"));
|
|
500
|
+
const required = expressionBoolean(objectProperty(entry, "required"));
|
|
501
|
+
const deprecated = expressionBoolean(objectProperty(entry, "deprecated"));
|
|
502
|
+
const label = [];
|
|
503
|
+
const optionalName = name && required === false ? `${name}?` : name;
|
|
504
|
+
if (optionalName || type) {
|
|
505
|
+
label.push(inlineCode([optionalName, type].filter(Boolean).join(": ")));
|
|
506
|
+
}
|
|
507
|
+
if (deprecated) {
|
|
508
|
+
label.push({ type: "text", value: label.length > 0 ? " " : "" }, {
|
|
509
|
+
children: [{ type: "text", value: "Deprecated." }],
|
|
510
|
+
type: "strong",
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
const nestedProperties = apiParameterItems(objectElements(objectProperty(entry, "properties")));
|
|
514
|
+
const arrayItem = objectProperty(entry, "arrayItems");
|
|
515
|
+
const nestedArrayItem = arrayItem?.type === "ObjectExpression"
|
|
516
|
+
? apiParameterItems([arrayItem])
|
|
517
|
+
: [];
|
|
518
|
+
const nested = [
|
|
519
|
+
...constraintItems(entry),
|
|
520
|
+
...nestedProperties,
|
|
521
|
+
...nestedArrayItem,
|
|
522
|
+
...apiVariantItems(entry),
|
|
523
|
+
];
|
|
524
|
+
if (label.length === 0 && !description) {
|
|
525
|
+
return nested;
|
|
526
|
+
}
|
|
527
|
+
return [describedListItem(label, description, nested)];
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
const apiSignatureNodes = (node) => {
|
|
531
|
+
const parameters = objectElements(getAttributeExpression(node, "parameters"));
|
|
532
|
+
if (parameters.length === 0) {
|
|
533
|
+
return endpointNodes(node);
|
|
534
|
+
}
|
|
535
|
+
const title = getAttribute(node, "title");
|
|
536
|
+
return [
|
|
537
|
+
...(title ? [heading([{ type: "text", value: title }], 2)] : []),
|
|
538
|
+
{
|
|
539
|
+
children: apiParameterItems(parameters),
|
|
540
|
+
ordered: false,
|
|
541
|
+
spread: false,
|
|
542
|
+
type: "list",
|
|
543
|
+
},
|
|
544
|
+
];
|
|
545
|
+
};
|
|
411
546
|
const TRIM_NEWLINES = /^\n+|\n+$/g;
|
|
412
547
|
// `Snippet` renders a copyable command or code line from its `text` prop: a
|
|
413
548
|
// string, a static template literal, or an array of lines. The page decides
|
|
@@ -528,34 +663,87 @@ const filesNodes = (node) => {
|
|
|
528
663
|
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
529
664
|
: [];
|
|
530
665
|
};
|
|
666
|
+
// True when a prop is written, or a spread could supply it, but its value is
|
|
667
|
+
// not a literal: the rendered value is unknown, so no default may stand in.
|
|
668
|
+
const hasUnreadableAttribute = (node, name, value) => value === undefined &&
|
|
669
|
+
(node.attributes ?? []).some((attribute) => attribute.type === "mdxJsxExpressionAttribute" ||
|
|
670
|
+
(attribute.type === "mdxJsxAttribute" && attribute.name === name));
|
|
671
|
+
const getBooleanAttribute = (node, name) => {
|
|
672
|
+
const attribute = findAttribute(node, name);
|
|
673
|
+
if (!attribute) {
|
|
674
|
+
return undefined;
|
|
675
|
+
}
|
|
676
|
+
if (attribute.value === null) {
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
return expressionBoolean(getAttributeExpression(node, name));
|
|
680
|
+
};
|
|
531
681
|
const packageNodes = (node) => {
|
|
532
682
|
const packageValue = getAttribute(node, "package") ?? getAttribute(node, "packages");
|
|
533
683
|
const packageExpression = getAttributeExpression(node, "packages");
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
684
|
+
let packages = [];
|
|
685
|
+
if (packageValue) {
|
|
686
|
+
packages = packageValue.split(WHITESPACE).filter(Boolean);
|
|
687
|
+
}
|
|
688
|
+
else if (packageExpression?.type === "ArrayExpression") {
|
|
689
|
+
const entries = packageExpression.elements ?? [];
|
|
690
|
+
const values = entries.map((entry) => expressionString(entry ?? undefined));
|
|
691
|
+
if (values.some((entry) => entry === undefined)) {
|
|
692
|
+
return [];
|
|
693
|
+
}
|
|
694
|
+
packages = values;
|
|
695
|
+
}
|
|
539
696
|
if (packages.length === 0) {
|
|
540
697
|
return [];
|
|
541
698
|
}
|
|
699
|
+
const dev = getBooleanAttribute(node, "dev");
|
|
700
|
+
if (hasUnreadableAttribute(node, "dev", dev)) {
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
542
703
|
return [
|
|
543
704
|
{
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
705
|
+
lang: "bash",
|
|
706
|
+
type: "code",
|
|
707
|
+
value: `pnpm add ${dev ? "-D " : ""}${packages.join(" ")}`,
|
|
708
|
+
},
|
|
709
|
+
];
|
|
710
|
+
};
|
|
711
|
+
const CODE_LANGUAGES = {
|
|
712
|
+
cURL: "bash",
|
|
713
|
+
JavaScript: "javascript",
|
|
714
|
+
TypeScript: "typescript",
|
|
715
|
+
};
|
|
716
|
+
const codeVariantNodes = (node) => {
|
|
717
|
+
const code = getAttribute(node, "code");
|
|
718
|
+
if (!code) {
|
|
719
|
+
return node.children ?? [];
|
|
720
|
+
}
|
|
721
|
+
const language = getAttribute(node, "language");
|
|
722
|
+
return [
|
|
723
|
+
{
|
|
724
|
+
lang: language
|
|
725
|
+
? (CODE_LANGUAGES[language] ?? language.toLowerCase())
|
|
726
|
+
: undefined,
|
|
727
|
+
type: "code",
|
|
728
|
+
value: code.replace(TRIM_NEWLINES, ""),
|
|
556
729
|
},
|
|
557
730
|
];
|
|
558
731
|
};
|
|
732
|
+
const copyPromptNodes = (node) => {
|
|
733
|
+
const title = getAttribute(node, "title");
|
|
734
|
+
const titleIsDynamic = hasUnreadableAttribute(node, "title", title);
|
|
735
|
+
const body = blockChildren(node, true);
|
|
736
|
+
const text = getAttribute(node, "text");
|
|
737
|
+
const content = body.length > 0 ? body : [];
|
|
738
|
+
if (content.length === 0 && text) {
|
|
739
|
+
content.push(paragraph(text));
|
|
740
|
+
}
|
|
741
|
+
const titleNodes = title ? [strongParagraph(title)] : [];
|
|
742
|
+
if (title === undefined && !titleIsDynamic) {
|
|
743
|
+
titleNodes.push(strongParagraph("Prompt for coding agents"));
|
|
744
|
+
}
|
|
745
|
+
return [...titleNodes, ...content];
|
|
746
|
+
};
|
|
559
747
|
const videoNodes = (node) => {
|
|
560
748
|
const url = getAttribute(node, "src") ?? getAttribute(node, "url");
|
|
561
749
|
if (!url) {
|
|
@@ -595,6 +783,19 @@ const endpointNodes = (node) => {
|
|
|
595
783
|
? [heading([inlineCode(`${method.toUpperCase()} ${path}`)])]
|
|
596
784
|
: [];
|
|
597
785
|
};
|
|
786
|
+
const endpointDisplayNodes = (node) => {
|
|
787
|
+
const method = getAttribute(node, "method");
|
|
788
|
+
const path = getAttribute(node, "path");
|
|
789
|
+
const versionPrefix = getAttribute(node, "versionPrefix");
|
|
790
|
+
if (hasUnreadableAttribute(node, "versionPrefix", versionPrefix)) {
|
|
791
|
+
return [];
|
|
792
|
+
}
|
|
793
|
+
const fullPath = path
|
|
794
|
+
? `${versionPrefix ?? (VERSIONED_PATH.test(path) ? "" : "/v1")}${path}`
|
|
795
|
+
: undefined;
|
|
796
|
+
const label = method?.toUpperCase() === "DELETE" ? "DEL" : method?.toUpperCase();
|
|
797
|
+
return method && path ? [heading([inlineCode(`${label}${fullPath}`)])] : [];
|
|
798
|
+
};
|
|
598
799
|
const themeAwareImageNodes = (node) => {
|
|
599
800
|
const light = getAttributeExpression(node, "light");
|
|
600
801
|
const dark = getAttributeExpression(node, "dark");
|
|
@@ -672,15 +873,17 @@ const buttonNodes = (node) => {
|
|
|
672
873
|
const COMPONENT_REPLACERS = {
|
|
673
874
|
Accordion: (node) => labelledContentNodes(node, ["title"]),
|
|
674
875
|
APIPage: apiOperationNodes,
|
|
675
|
-
APISignature:
|
|
876
|
+
APISignature: apiSignatureNodes,
|
|
676
877
|
Button: buttonNodes,
|
|
677
878
|
ButtonLink: linkNodes,
|
|
678
879
|
Callout: (node) => [calloutNode(node)],
|
|
679
880
|
Card: cardNodes,
|
|
680
881
|
CardPlayer: cardNodes,
|
|
681
882
|
ChatGeneration: chatGenerationNodes,
|
|
883
|
+
CodeVariant: codeVariantNodes,
|
|
884
|
+
CopyPrompt: copyPromptNodes,
|
|
682
885
|
Details: (node) => blockChildren(node, true),
|
|
683
|
-
EndpointDisplay:
|
|
886
|
+
EndpointDisplay: endpointDisplayNodes,
|
|
684
887
|
ExampleLinks: exampleLinksNodes,
|
|
685
888
|
GithubLink: githubLinkNodes,
|
|
686
889
|
Image: imageNodes,
|
|
@@ -691,6 +894,10 @@ const COMPONENT_REPLACERS = {
|
|
|
691
894
|
MDXImage: imageNodes,
|
|
692
895
|
Mermaid: mermaidNodes,
|
|
693
896
|
PackageInstall: packageNodes,
|
|
897
|
+
PromptLink: (node) => {
|
|
898
|
+
const text = getAttribute(node, "text");
|
|
899
|
+
return text ? [paragraph(text)] : [];
|
|
900
|
+
},
|
|
694
901
|
PropertiesTable: propertiesTableNodes,
|
|
695
902
|
Snippet: snippetNodes,
|
|
696
903
|
Summary: summaryNodes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AA+FD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
|
|
@@ -17,7 +17,7 @@ const GeistdocsChatShell = lazy(() => import("./chat/shell").then(({ GeistdocsCh
|
|
|
17
17
|
})));
|
|
18
18
|
const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props }) => {
|
|
19
19
|
const { i18n, i18nProvider } = createGeistdocsI18n(config);
|
|
20
|
-
const { enabled, hasBeenOpened, isOpen, setIsOpen } = useGeistdocsChatContext();
|
|
20
|
+
const { enabled, hasBeenOpened, isExpanded, isOpen, setIsExpanded, setIsOpen, } = useGeistdocsChatContext();
|
|
21
21
|
const isMobile = useIsMobile();
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (!enabled) {
|
|
@@ -26,7 +26,13 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
26
26
|
const handleKeyDown = (event) => {
|
|
27
27
|
if (event.key === "Escape" && isOpen) {
|
|
28
28
|
event.preventDefault();
|
|
29
|
-
|
|
29
|
+
// The first Escape returns an expanded desktop panel to the sidebar.
|
|
30
|
+
if (isExpanded && !isMobile) {
|
|
31
|
+
setIsExpanded(false);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setIsOpen(false);
|
|
35
|
+
}
|
|
30
36
|
return;
|
|
31
37
|
}
|
|
32
38
|
if ((event.metaKey || event.ctrlKey) &&
|
|
@@ -39,7 +45,7 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
39
45
|
};
|
|
40
46
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
41
47
|
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
42
|
-
}, [enabled, isOpen, setIsOpen]);
|
|
48
|
+
}, [enabled, isExpanded, isMobile, isOpen, setIsExpanded, setIsOpen]);
|
|
43
49
|
// fumadocs spreads the provider's `search.options` onto the dialog, which is
|
|
44
50
|
// how a consumer reaches `tag`. Typed here so it survives the hand-off.
|
|
45
51
|
const SearchDialogComponent = useCallback((searchProps) => (_jsx(GeistdocsSearchDialog, { basePath: config.basePath, ...searchProps })), [config.basePath]);
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.0 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.0.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -3872,6 +3872,7 @@ Once open, users can:
|
|
|
3872
3872
|
- Ask questions about any part of your documentation
|
|
3873
3873
|
- View the documentation pages used as sources for each answer
|
|
3874
3874
|
- Copy an answer as Markdown
|
|
3875
|
+
- Expand the desktop panel to fill the viewport
|
|
3875
3876
|
- Get step-by-step guidance on complex topics
|
|
3876
3877
|
|
|
3877
3878
|
## Control Ask AI from your own components
|
|
@@ -4542,8 +4543,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
4542
4543
|
|
|
4543
4544
|
The chat interface adapts to different screen sizes:
|
|
4544
4545
|
|
|
4545
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
4546
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
4546
|
+
- **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.
|
|
4547
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
4547
4548
|
|
|
4548
4549
|
## Configuration
|
|
4549
4550
|
|
package/docs/manifest.json
CHANGED
package/docs/pages/ask-ai.md
CHANGED
|
@@ -52,6 +52,7 @@ Once open, users can:
|
|
|
52
52
|
- Ask questions about any part of your documentation
|
|
53
53
|
- View the documentation pages used as sources for each answer
|
|
54
54
|
- Copy an answer as Markdown
|
|
55
|
+
- Expand the desktop panel to fill the viewport
|
|
55
56
|
- Get step-by-step guidance on complex topics
|
|
56
57
|
|
|
57
58
|
## Control Ask AI from your own components
|
|
@@ -722,8 +723,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
722
723
|
|
|
723
724
|
The chat interface adapts to different screen sizes:
|
|
724
725
|
|
|
725
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
726
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
726
|
+
- **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.
|
|
727
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
727
728
|
|
|
728
729
|
## Configuration
|
|
729
730
|
|
package/package.json
CHANGED
|
@@ -50,6 +50,7 @@ Once open, users can:
|
|
|
50
50
|
- Ask questions about any part of your documentation
|
|
51
51
|
- View the documentation pages used as sources for each answer
|
|
52
52
|
- Copy an answer as Markdown
|
|
53
|
+
- Expand the desktop panel to fill the viewport
|
|
53
54
|
- Get step-by-step guidance on complex topics
|
|
54
55
|
|
|
55
56
|
## Control Ask AI from your own components
|
|
@@ -720,8 +721,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
720
721
|
|
|
721
722
|
The chat interface adapts to different screen sizes:
|
|
722
723
|
|
|
723
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
724
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
724
|
+
- **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.
|
|
725
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
725
726
|
|
|
726
727
|
## Configuration
|
|
727
728
|
|
package/template/package.json
CHANGED