deepspace 0.31.2 → 0.32.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/documentation/runtime/app.tsx","../src/documentation/runtime/article.tsx","../src/documentation/types.ts","../src/documentation/routing.ts","../src/documentation/runtime/browser.ts","../src/documentation/runtime/code-block.tsx","../src/documentation/runtime/icons.tsx","../src/documentation/runtime/page-actions.tsx","../src/documentation/runtime/assistant.tsx","../src/client/ai-stream.ts","../src/documentation/text.ts","../src/documentation/runtime/assistant-transcript.ts","../src/documentation/runtime/dialog.ts","../src/documentation/runtime/navigation.tsx","../package.json","../src/documentation/runtime/search.tsx","../src/documentation/runtime/mdx-components.tsx","../src/documentation/runtime/public.tsx"],"sourcesContent":["import type {\n ReactNode,\n ReactElement,\n} from 'react'\nimport {\n useCallback,\n useEffect,\n useState,\n} from 'react'\nimport type { DocumentationRuntimeData } from '../types'\nimport { Article, ContextRail } from './article'\nimport { AssistantLauncher, DocumentationAssistant, type AssistantSeed } from './assistant'\nimport { DesktopSidebar, DocumentationHeader, MobileNavigation } from './navigation'\nimport { SearchCommand } from './search'\n\nexport interface DocumentationAppProps {\n data: DocumentationRuntimeData\n /** Rendered page body. Omit children to use the compiler's static HTML. */\n children?: ReactNode\n navigating?: boolean\n onNavigate?: (href: string) => void\n onPrefetch?: (href: string) => void\n}\n\nexport function DocumentationApp({\n data,\n children,\n navigating = false,\n onNavigate,\n}: DocumentationAppProps): ReactElement {\n const [mobileNavOpen, setMobileNavOpen] = useState(false)\n const [searchOpen, setSearchOpen] = useState(false)\n const [assistantOpen, setAssistantOpen] = useState(false)\n const [assistantDraft, setAssistantDraft] = useState('')\n const [assistantSeed, setAssistantSeed] = useState<AssistantSeed>({ id: 0, submit: false })\n const assistantAccess = data.config.assistant.access === 'disabled'\n ? null\n : data.config.assistant.access\n const assistantEnabled = assistantAccess !== null\n const appClassName = [\n 'documentation-app',\n assistantEnabled ? 'has-assistant' : '',\n assistantOpen ? 'is-assistant-open' : '',\n navigating ? 'is-navigating' : '',\n ].filter(Boolean).join(' ')\n\n const openAssistant = useCallback((seed?: string, submit = false) => {\n if (seed !== undefined) setAssistantDraft(seed)\n setAssistantSeed((current) => ({ id: current.id + 1, submit, value: seed }))\n setSearchOpen(false)\n setAssistantOpen(true)\n }, [])\n\n useEffect(() => {\n const handleKeydown = (event: globalThis.KeyboardEvent): void => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k') {\n event.preventDefault()\n setSearchOpen(true)\n }\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'i') {\n event.preventDefault()\n if (data.config.assistant.access !== 'disabled') openAssistant()\n }\n }\n document.addEventListener('keydown', handleKeydown)\n return () => document.removeEventListener('keydown', handleKeydown)\n }, [data.config.assistant.access, openAssistant])\n\n useEffect(() => {\n setMobileNavOpen(false)\n setSearchOpen(false)\n }, [data.page.route])\n\n return (\n <div\n aria-busy={navigating || undefined}\n className={appClassName}\n >\n <a className=\"documentation-skip-link\" href=\"#documentation-content\">Skip to main content</a>\n <DocumentationHeader\n data={data}\n onMenuOpen={() => setMobileNavOpen(true)}\n onSearchOpen={() => setSearchOpen(true)}\n />\n <div className=\"documentation-frame\">\n <DesktopSidebar data={data} />\n <main className=\"documentation-main\" id=\"documentation-content\">\n <div className=\"documentation-reader-grid\">\n <div className=\"documentation-reader-column\">\n <Article\n data={data}\n launcher={assistantAccess && !assistantOpen ? (\n <AssistantLauncher\n input={assistantDraft}\n name={data.config.name}\n onInputChange={setAssistantDraft}\n onSubmit={(question) => openAssistant(question, true)}\n />\n ) : undefined}\n onAssistantOpen={openAssistant}\n >{children}</Article>\n </div>\n <ContextRail data={data} />\n </div>\n </main>\n </div>\n <MobileNavigation\n data={data}\n onClose={() => setMobileNavOpen(false)}\n open={mobileNavOpen}\n />\n <SearchCommand\n assistantEnabled={assistantEnabled}\n basePath={data.basePath}\n name={data.config.name}\n onAssistantOpen={openAssistant}\n onClose={() => setSearchOpen(false)}\n onNavigate={onNavigate}\n open={searchOpen}\n />\n {assistantAccess && (\n <DocumentationAssistant\n access={assistantAccess}\n basePath={data.basePath}\n input={assistantDraft}\n name={data.config.name}\n onClose={() => setAssistantOpen(false)}\n onInputChange={setAssistantDraft}\n open={assistantOpen}\n route={data.page.route}\n seed={assistantSeed}\n suggestions={data.config.assistant.suggestions}\n />\n )}\n </div>\n )\n}\n","import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport type { DocumentationHeading, DocumentationRuntimeData } from '../types'\nimport { documentationPublicPath } from '../routing'\nimport { errorMessage, safeStorageGet, safeStorageSet } from './browser'\nimport { CodeBlockActions, CodeBlockControlsProvider, codeBlockLanguage } from './code-block'\nimport { ChevronRightIcon, ListIcon } from './icons'\nimport { PageActions } from './page-actions'\n\n/**\n * Every imperative enhancement is scoped through this selector. React-rendered\n * prose (`data-prose=\"react\"`) is off limits to DOM surgery: the reconciler is\n * its only writer.\n */\nconst HTML_PROSE_SCOPE = '.documentation-prose[data-prose=\"html\"]'\n\nexport function Article({\n children,\n data,\n launcher,\n onAssistantOpen,\n}: {\n children?: ReactNode\n data: DocumentationRuntimeData\n /** Docked assistant entry point, placed above the pagination so it can stick. */\n launcher?: ReactNode\n onAssistantOpen: (seed?: string) => void\n}): ReactElement {\n const articleRef = useRef<HTMLElement>(null)\n const codeBlocks = useCodeBlockMounts(articleRef, data.page.route)\n useArticleEnhancements(articleRef, data)\n const controls = useMemo(() => ({\n assistantEnabled: data.config.assistant.access !== 'disabled',\n onAsk: (code: string) =>\n onAssistantOpen(`Explain this ${data.page.title} example and the important details:\\n\\n${code}`),\n }), [data.config.assistant.access, data.page.title, onAssistantOpen])\n return (\n <article className=\"documentation-article\" ref={articleRef}>\n <Breadcrumbs items={data.breadcrumbs} />\n <header className=\"documentation-article-header\">\n <div className=\"documentation-article-meta\">\n {data.config.theme.eyebrowStyle !== 'none' && (\n <div className=\"documentation-eyebrow\">{\n data.page.kind === 'openapi'\n ? 'API reference'\n : data.config.theme.eyebrowStyle === 'breadcrumbs'\n ? data.breadcrumbs.join(' / ')\n : data.breadcrumbs[0] ?? 'Documentation'\n }</div>\n )}\n <PageActions data={data} onAssistantOpen={onAssistantOpen} />\n </div>\n <h1>{data.page.title}</h1>\n {data.page.description && <p className=\"documentation-lede\">{data.page.description}</p>}\n </header>\n <OutlineDisclosure headings={outlineHeadings(data.page.headings)} />\n <CodeBlockControlsProvider value={controls}>\n {children ?? (\n <div\n className=\"documentation-prose\"\n data-prose=\"html\"\n dangerouslySetInnerHTML={{ __html: data.page.html }}\n />\n )}\n {codeBlocks.map((mount) => createPortal(\n <CodeBlockActions readCode={() => readPreText(mount.pre)} />,\n mount.host,\n mount.key,\n ))}\n </CodeBlockControlsProvider>\n {data.page.openapi?.playground && <ApiPlayground operation={data.page.openapi} />}\n {launcher && (\n <div className=\"documentation-launcher-dock\">{launcher}</div>\n )}\n <nav className=\"documentation-pagination\" aria-label=\"Page navigation\">\n {data.previous ? (\n <a rel=\"prev\" href={documentationPublicPath(data.basePath, data.previous.route)}><small>Previous</small><span><ChevronRightIcon className=\"is-back\" />{data.previous.title}</span></a>\n ) : <span />}\n {data.next ? (\n <a rel=\"next\" href={documentationPublicPath(data.basePath, data.next.route)}><small>Next</small><span>{data.next.title}<ChevronRightIcon /></span></a>\n ) : <span />}\n </nav>\n </article>\n )\n}\n\nfunction Breadcrumbs({ items }: { items: string[] }): ReactElement {\n return (\n <nav className=\"documentation-breadcrumbs\" aria-label=\"Breadcrumb\">\n {items.map((item, index) => (\n <span key={`${item}:${items.slice(0, index + 1).join('/')}`}>{index > 0 && <ChevronRightIcon />}{item}</span>\n ))}\n </nav>\n )\n}\n\nfunction outlineHeadings(headings: DocumentationHeading[]): DocumentationHeading[] {\n return headings.filter((heading) => heading.depth === 2 || heading.depth === 3)\n}\n\nfunction OutlineLinks({\n active,\n headings,\n}: {\n active: string\n headings: DocumentationHeading[]\n}): ReactElement {\n return (\n <>\n {headings.map((heading) => (\n <a\n aria-current={active === heading.id ? 'location' : undefined}\n className={`${heading.depth === 3 ? 'depth-3 ' : ''}${active === heading.id ? 'is-active' : ''}`}\n href={`#${heading.id}`}\n key={heading.id}\n >{heading.text}</a>\n ))}\n </>\n )\n}\n\n/**\n * The outline below the rail's breakpoint. It carries no active state: the rail\n * owns the single scroll observer, and a collapsed disclosure has nothing to\n * highlight.\n */\nfunction OutlineDisclosure({ headings }: { headings: DocumentationHeading[] }): ReactElement | null {\n if (headings.length === 0) return null\n return (\n <details className=\"documentation-outline-disclosure\">\n <summary><ListIcon />On this page</summary>\n <nav className=\"documentation-outline\" aria-label=\"On this page\">\n <OutlineLinks active=\"\" headings={headings} />\n </nav>\n </details>\n )\n}\n\nexport function ContextRail({\n data,\n}: {\n data: DocumentationRuntimeData\n}): ReactElement {\n const headings = useMemo(() => outlineHeadings(data.page.headings), [data.page.headings])\n const [active, setActive] = useState(headings[0]?.id ?? '')\n useEffect(() => setActive(headings[0]?.id ?? ''), [headings])\n // Reading-line scroll spy: the active heading is the last one above the\n // anchor clearance line, and at the very bottom of a scrollable page it is\n // the final heading. An intersection band fails the case that matters most —\n // a short last section can never scroll high enough to enter the band, so\n // clicking its outline entry moved the page but not the highlight.\n useEffect(() => {\n let frame: number | null = null\n const measure = (): void => {\n frame = null\n const root = document.documentElement\n // Clearance has one owner: the container's scroll-padding-top.\n const clearance = (Number.parseFloat(getComputedStyle(root).scrollPaddingTop) || 96) + 4\n const scrollable = root.scrollHeight > window.innerHeight + 4\n const atBottom = scrollable && window.innerHeight + window.scrollY >= root.scrollHeight - 2\n let next = headings[0]?.id ?? ''\n for (const heading of headings) {\n const element = document.getElementById(heading.id)\n if (!element) continue\n if (element.getBoundingClientRect().top <= clearance) next = heading.id\n else break\n }\n // Clamped tail: at the very bottom, a short section's heading can sit\n // below the reading line forever. An explicit anchor target (the hash)\n // that is visible there wins — the reader said which section they meant.\n if (atBottom) {\n const hashId = decodeURIComponent(window.location.hash.slice(1))\n if (hashId && headings.some((heading) => heading.id === hashId)) {\n const top = document.getElementById(hashId)?.getBoundingClientRect().top\n if (top !== undefined && top > clearance && top < window.innerHeight) next = hashId\n }\n }\n setActive(next)\n }\n const schedule = (): void => {\n if (frame === null) frame = window.requestAnimationFrame(measure)\n }\n // An outline click at the very bottom changes the hash without producing a\n // scroll event, and pushState fires no hashchange — re-measure after the\n // router's synchronous same-page handling has updated the hash.\n const onOutlineClick = (event: MouseEvent): void => {\n if (event.target instanceof Element && event.target.closest('.documentation-outline a')) {\n window.setTimeout(schedule, 0)\n }\n }\n measure()\n window.addEventListener('scroll', schedule, { passive: true })\n window.addEventListener('resize', schedule, { passive: true })\n window.addEventListener('popstate', schedule)\n window.addEventListener('hashchange', schedule)\n document.addEventListener('click', onOutlineClick)\n return () => {\n window.removeEventListener('scroll', schedule)\n window.removeEventListener('resize', schedule)\n window.removeEventListener('popstate', schedule)\n window.removeEventListener('hashchange', schedule)\n document.removeEventListener('click', onOutlineClick)\n if (frame !== null) window.cancelAnimationFrame(frame)\n }\n }, [headings])\n return (\n <aside className=\"documentation-context-rail\" aria-label=\"Page context\">\n {headings.length > 0 && (\n <nav className=\"documentation-outline\" aria-label=\"On this page\">\n <h2>On this page</h2>\n <OutlineLinks active={active} headings={headings} />\n </nav>\n )}\n </aside>\n )\n}\n\n\nfunction ApiPlayground({ operation }: { operation: NonNullable<DocumentationRuntimeData['page']['openapi']> }): ReactElement | null {\n const [body, setBody] = useState('')\n const [token, setToken] = useState('')\n const [responseText, setResponseText] = useState('No request sent.')\n const [sending, setSending] = useState(false)\n if (!operation.baseUrl) return null\n const url = `${operation.baseUrl.replace(/\\/$/, '')}${operation.path}`\n const send = async (): Promise<void> => {\n setSending(true)\n setResponseText('Sending request…')\n try {\n const headers: Record<string, string> = {}\n if (token) headers.Authorization = `Bearer ${token}`\n if (body.trim()) headers['Content-Type'] = 'application/json'\n const response = await fetch(url, {\n method: operation.method,\n headers,\n body: ['GET', 'HEAD'].includes(operation.method) ? undefined : body.trim() || undefined,\n })\n const text = await response.text()\n setResponseText(`${response.status} ${response.statusText}\\n\\n${text}`)\n } catch (error) {\n setResponseText(errorMessage(error))\n } finally {\n setSending(false)\n }\n }\n return (\n <section className=\"documentation-playground\" data-playground>\n <div className=\"documentation-playground-title\"><div><span className={`method method-${operation.method.toLowerCase()}`}>{operation.method}</span><strong>Try this operation</strong></div><code>{url}</code></div>\n <p>Requests run in your browser. Tokens stay in memory and never enter search or assistant context.</p>\n <label><span>Bearer token</span><input type=\"password\" autoCapitalize=\"none\" autoComplete=\"off\" autoCorrect=\"off\" spellCheck={false} value={token} onChange={(event) => setToken(event.target.value)} placeholder=\"Optional\" /></label>\n <label><span>JSON body</span><textarea rows={7} autoCapitalize=\"none\" autoComplete=\"off\" autoCorrect=\"off\" spellCheck={false} value={body} onChange={(event) => setBody(event.target.value)} placeholder=\"{}\" /></label>\n <button type=\"button\" disabled={sending} onClick={send}>{sending ? 'Sending…' : `Send ${operation.method} request`}</button>\n <pre aria-live=\"polite\">{responseText}</pre>\n </section>\n )\n}\n\ninterface CodeBlockMount {\n key: string\n host: HTMLElement\n pre: HTMLPreElement\n}\n\n/**\n * Wraps each compiled `pre` so the copy/ask controls can overlay a non-scrolling\n * box. Inside `pre` they would scroll away with the code and force horizontal\n * padding onto every line. The controls themselves are portalled in so their\n * icons stay the same components the rest of the shell uses.\n *\n * Scoped to `[data-prose=\"html\"]` on purpose: this pass reparents `pre`, which\n * is only ever safe on compiler-rendered markup the reconciler does not track.\n * React-rendered prose gets the identical wrapper from `CodeBlock` instead.\n */\nfunction useCodeBlockMounts(\n articleRef: RefObject<HTMLElement | null>,\n route: string,\n): CodeBlockMount[] {\n const [mounts, setMounts] = useState<CodeBlockMount[]>([])\n useEffect(() => {\n const article = articleRef.current\n if (!article) return\n const created: Array<{ block: HTMLElement; pre: HTMLPreElement }> = []\n const next: CodeBlockMount[] = []\n article.querySelectorAll<HTMLPreElement>(HTML_PROSE_SCOPE + ' pre').forEach((pre, index) => {\n const block = document.createElement('div')\n block.className = 'documentation-code-block'\n pre.replaceWith(block)\n block.appendChild(pre)\n // Inside a code group the tab already carries the fence title.\n const title = pre.getAttribute('data-code-title')\n if (title && !block.closest('[data-tab-group]')) {\n const bar = document.createElement('div')\n bar.className = 'documentation-code-title'\n bar.textContent = title\n block.insertBefore(bar, pre)\n }\n const host = document.createElement('div')\n host.className = 'documentation-code-actions'\n const language = codeBlockLanguage(pre.querySelector('code')?.className ?? '')\n if (language) {\n const label = document.createElement('span')\n label.className = 'documentation-code-language'\n label.textContent = language\n host.appendChild(label)\n }\n block.appendChild(host)\n created.push({ block, pre })\n next.push({ key: `${route}:${index}`, host, pre })\n })\n setMounts(next)\n return () => {\n setMounts([])\n for (const { block, pre } of created) block.replaceWith(pre)\n }\n }, [articleRef, route])\n return mounts\n}\n\nfunction readPreText(pre: HTMLPreElement): string {\n return pre.querySelector('code')?.textContent ?? pre.textContent ?? ''\n}\n\n/**\n * Enhances compiler-rendered tab groups. Like the code-block pass this is\n * confined to `[data-prose=\"html\"]`: MDX renders `Tabs` and `CodeGroup` through\n * `TabGroup`, which owns its own tablist in React.\n */\nfunction useArticleEnhancements(\n articleRef: RefObject<HTMLElement | null>,\n data: DocumentationRuntimeData,\n): void {\n useEffect(() => {\n const article = articleRef.current\n if (!article) return\n const cleanups: Array<() => void> = []\n article.querySelectorAll<HTMLElement>(`${HTML_PROSE_SCOPE} [data-tab-group]`).forEach((group, groupIndex) => {\n if (group.querySelector(':scope > .documentation-tab-buttons')) return\n const tabs = Array.from(group.querySelectorAll<HTMLElement>(':scope > [data-tab]'))\n if (tabs.length === 0) return\n const controls = document.createElement('div')\n controls.className = 'documentation-tab-buttons'\n controls.setAttribute('role', 'tablist')\n const labels = tabs.map((tab, tabIndex) => tab.dataset.tabTitle ?? `Tab ${tabIndex + 1}`)\n const activate = (activeIndex: number, broadcast = false): void => {\n tabs.forEach((tab, index) => { tab.hidden = index !== activeIndex; tab.setAttribute('role', 'tabpanel') })\n Array.from(controls.querySelectorAll('button')).forEach((button, index) => {\n button.setAttribute('aria-selected', index === activeIndex ? 'true' : 'false')\n button.setAttribute('tabindex', index === activeIndex ? '0' : '-1')\n })\n if (broadcast) {\n const label = labels[activeIndex]\n if (label) {\n safeStorageSet('deepspace-documentation-tab-selection', label)\n document.dispatchEvent(new CustomEvent('deepspace-documentation-tab-change', {\n detail: { label, source: group },\n }))\n }\n }\n }\n tabs.forEach((tab, tabIndex) => {\n const button = document.createElement('button')\n button.type = 'button'\n button.id = `documentation-tab-${groupIndex}-${tabIndex}`\n button.setAttribute('role', 'tab')\n button.textContent = labels[tabIndex]\n tab.setAttribute('aria-labelledby', button.id)\n const click = (): void => activate(tabIndex, true)\n const keydown = (event: globalThis.KeyboardEvent): void => {\n if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return\n event.preventDefault()\n const next = event.key === 'Home' ? 0 : event.key === 'End' ? tabs.length - 1 : (tabIndex + (event.key === 'ArrowRight' ? 1 : -1) + tabs.length) % tabs.length\n activate(next)\n controls.querySelectorAll('button')[next]?.focus()\n }\n button.addEventListener('click', click)\n button.addEventListener('keydown', keydown)\n controls.appendChild(button)\n cleanups.push(() => { button.removeEventListener('click', click); button.removeEventListener('keydown', keydown) })\n })\n const title = group.querySelector(':scope > .documentation-code-group-title')\n if (title) group.insertBefore(controls, title.nextSibling)\n if (!title) group.insertBefore(controls, group.firstChild)\n const sync = (event: Event): void => {\n const detail = (event as CustomEvent<{ label?: string; source?: Element }>).detail\n if (!detail?.label || detail.source === group) return\n const matchingIndex = labels.findIndex((label) => label === detail.label)\n if (matchingIndex >= 0) activate(matchingIndex)\n }\n document.addEventListener('deepspace-documentation-tab-change', sync)\n const stored = safeStorageGet('deepspace-documentation-tab-selection')\n const initial = stored ? labels.findIndex((label) => label === stored) : -1\n activate(initial >= 0 ? initial : 0)\n cleanups.push(() => { document.removeEventListener('deepspace-documentation-tab-change', sync); controls.remove() })\n })\n return () => cleanups.reverse().forEach((cleanup) => cleanup())\n }, [articleRef, data.page.route])\n}\n","import type { z } from 'zod'\nimport type { themeObjectSchema } from './config/schema'\n\nexport const DOCUMENTATION_CONFIG_FILE = 'documentation.json'\nexport const DOCUMENTATION_MANIFEST_VERSION = 2\n\nexport type DocumentationAssistantAccess = 'disabled' | 'public' | 'authenticated'\nexport type DocumentationMcpAccess = 'disabled' | 'public'\nexport const DOCUMENTATION_CONTEXTUAL_ACTIONS = [\n 'copy',\n 'view',\n 'assistant',\n 'chatgpt',\n 'claude',\n 'mcp',\n 'add-mcp',\n 'cursor',\n 'vscode',\n] as const\nexport type DocumentationContextualAction = (typeof DOCUMENTATION_CONTEXTUAL_ACTIONS)[number]\nexport const DEFAULT_DOCUMENTATION_CONTEXTUAL_ACTIONS: readonly DocumentationContextualAction[] =\n DOCUMENTATION_CONTEXTUAL_ACTIONS\n\nexport interface DocumentationFontConfig {\n family: string\n weight?: number | string\n source?: string\n format?: string\n}\n\n/**\n * The `theme` object as authored in documentation.json — exactly the keys\n * the config schema accepts under `theme.*`, derived from that schema so\n * the two can never drift. Everything else (fonts, background decoration,\n * styling, logo href) is configured through the Mintlify-style top-level\n * keys and only exists on the resolved theme.\n */\nexport type DocumentationThemeConfig = z.infer<typeof themeObjectSchema>\n\n/**\n * The fully resolved theme after config loading merges `theme.*` with the\n * Mintlify top-level keys (`colors`, `logo`, `favicon`, `appearance`,\n * `background`, `fonts`, `styling`). This is what the template and runtime\n * consume; it is an output shape, never accepted as `theme.*` input.\n */\nexport interface ResolvedDocumentationTheme extends DocumentationThemeConfig {\n backgroundDark?: string\n backgroundDecoration?: 'none' | 'gradient' | 'grid'\n bodyFont?: DocumentationFontConfig\n headingFont?: DocumentationFontConfig\n monoFont?: DocumentationFontConfig\n codeBlockMode?: 'dark' | 'system'\n eyebrowStyle?: 'section' | 'breadcrumbs' | 'none'\n logoHref?: string\n}\n\nexport interface DocumentationLinkConfig {\n label: string\n href: string\n}\n\nexport interface DocumentationNavGroup {\n group: string\n pages: DocumentationNavigationItem[]\n}\n\nexport type DocumentationNavigationItem = string | DocumentationLinkConfig | DocumentationNavGroup\n\nexport const DOCUMENTATION_OPENAPI_SAMPLE_LANGUAGES = ['curl', 'javascript', 'python', 'go'] as const\nexport type DocumentationOpenApiSampleLanguage = (typeof DOCUMENTATION_OPENAPI_SAMPLE_LANGUAGES)[number]\nexport type DocumentationOpenApiSampleDefaults = 'required' | 'all'\n\nexport interface DocumentationOpenApiExamplesConfig {\n languages: DocumentationOpenApiSampleLanguage[]\n defaults: DocumentationOpenApiSampleDefaults\n autogenerate: boolean\n}\n\nexport const DEFAULT_DOCUMENTATION_OPENAPI_EXAMPLES = {\n languages: ['curl', 'python', 'javascript', 'go'],\n defaults: 'all',\n autogenerate: true,\n} as const satisfies Omit<DocumentationOpenApiExamplesConfig, 'languages'> & {\n languages: readonly DocumentationOpenApiSampleLanguage[]\n}\n\nexport interface DocumentationOpenApiConfig {\n source: string\n route?: string\n label?: string\n playground?: boolean\n baseUrl?: string\n examples?: DocumentationOpenApiExamplesConfig\n}\n\nexport interface DocumentationAssistantConfig {\n access: DocumentationAssistantAccess\n model?: string\n suggestions?: string[]\n}\n\nexport interface DocumentationMcpConfig {\n access: DocumentationMcpAccess\n}\n\nexport interface DocumentationContextualConfig {\n actions: DocumentationContextualAction[]\n}\n\nexport interface DocumentationSeoConfig {\n noindex?: boolean\n ogImage?: string\n metaTags?: Record<string, string>\n}\n\nexport interface DocumentationConfig {\n $schema?: string\n name: string\n description?: string\n source: string\n output: string\n url?: string\n /** Explicit custom hostnames that mount this documentation at `/`. */\n domains: string[]\n theme: ResolvedDocumentationTheme\n navigation?: DocumentationNavigationItem[]\n links: DocumentationLinkConfig[]\n footer: DocumentationLinkConfig[]\n redirects: Record<string, string>\n openapi: DocumentationOpenApiConfig[]\n assistant: DocumentationAssistantConfig\n mcp: DocumentationMcpConfig\n contextual: DocumentationContextualConfig\n seo: DocumentationSeoConfig\n}\n\nexport interface DocumentationFrontmatter {\n title?: string\n description?: string\n slug?: string\n hidden?: boolean\n noindex?: boolean\n}\n\nexport interface DocumentationHeading {\n depth: number\n id: string\n text: string\n}\n\nexport interface DocumentationPage {\n sourcePath: string\n relativePath: string\n route: string\n title: string\n description?: string\n hidden: boolean\n noindex: boolean\n markdown: string\n html: string\n text: string\n headings: DocumentationHeading[]\n sourceFormat: 'markdown' | 'mdx' | 'generated'\n kind: 'page' | 'openapi'\n openapi?: DocumentationOpenApiOperation\n}\n\nexport interface DocumentationNavigationPage {\n kind: 'page'\n route: string\n label: string\n}\n\nexport interface DocumentationNavigationLink {\n kind: 'link'\n href: string\n label: string\n}\n\nexport interface DocumentationNavigationGroup {\n kind: 'group'\n label: string\n items: DocumentationNavigationNode[]\n}\n\nexport type DocumentationNavigationNode = DocumentationNavigationPage | DocumentationNavigationLink | DocumentationNavigationGroup\n\nexport interface DocumentationOpenApiParameter {\n name: string\n in: string\n required: boolean\n description?: string\n schema?: unknown\n example?: unknown\n}\n\nexport interface DocumentationOpenApiResponse {\n status: string\n description: string\n schema?: unknown\n}\n\nexport interface DocumentationOpenApiCodeSample {\n language: string\n label: string\n syntax: string\n code: string\n generated: boolean\n}\n\nexport interface DocumentationOpenApiOperation {\n method: string\n path: string\n operationId: string\n summary: string\n description?: string\n tags: string[]\n parameters: DocumentationOpenApiParameter[]\n requestBody?: unknown\n responses: DocumentationOpenApiResponse[]\n security?: unknown\n baseUrl?: string\n playground: boolean\n codeSamples: DocumentationOpenApiCodeSample[]\n}\n\nexport interface DocumentationSearchEntry {\n route: string\n title: string\n description?: string\n /** Carries ids so search can offer section results, not only whole pages. */\n headings: DocumentationHeading[]\n text: string\n}\n\nexport interface DocumentationAssistantChunk {\n id: string\n route: string\n title: string\n heading?: string\n text: string\n}\n\nexport interface DocumentationGraph {\n config: DocumentationConfig\n pages: DocumentationPage[]\n navigation: DocumentationNavigationNode[]\n sourceHash: string\n}\n\nexport interface DocumentationBuildManifest {\n version: typeof DOCUMENTATION_MANIFEST_VERSION\n sourceHash: string\n outputHash: string\n /** Version of the `deepspace` package that compiled this output. */\n sdkVersion: string\n name: string\n pageCount: number\n /** Authored pages plus configured redirect entry points. */\n routes: string[]\n /** Exact non-HTML artifacts that may be served from the public mount. */\n resources: string[]\n assistant: DocumentationAssistantConfig\n mcp: DocumentationMcpConfig\n domains: string[]\n /** Default public mount on the ordinary app hostname. */\n basePath: string\n}\n\nexport interface DocumentationDiagnostic {\n code: string\n message: string\n file?: string\n line?: number\n}\n\nexport interface DocumentationValidationResult {\n appDir: string\n configPath: string\n sourceDir: string\n outputDir: string\n graph: DocumentationGraph\n warnings: DocumentationDiagnostic[]\n}\n\nexport interface DocumentationBuildResult extends DocumentationValidationResult {\n manifest: DocumentationBuildManifest\n files: string[]\n}\n\nexport interface DocumentationRuntimePageLink {\n route: string\n title: string\n}\n\nexport interface DocumentationRuntimePage {\n route: string\n title: string\n description?: string\n html: string\n headings: DocumentationHeading[]\n kind: DocumentationPage['kind']\n markdownUrl: string\n openapi?: DocumentationOpenApiOperation\n}\n\nexport interface DocumentationRuntimeData {\n /** Public mount (`/docs` on an app host, empty on an explicit documentation domain). */\n basePath: string\n config: Pick<\n DocumentationConfig,\n 'name' | 'description' | 'theme' | 'links' | 'footer' | 'assistant' | 'mcp' | 'contextual'\n >\n page: DocumentationRuntimePage\n navigation: DocumentationNavigationNode[]\n breadcrumbs: string[]\n previous?: DocumentationRuntimePageLink\n next?: DocumentationRuntimePageLink\n}\n\nexport type DocumentationRuntimeRouteData = Omit<DocumentationRuntimeData, 'config' | 'navigation'>\n\n/** Small per-route payload used by the hydrated documentation router. */\nexport interface DocumentationRuntimeRouteDocument {\n canonical: string | null\n data: DocumentationRuntimeRouteData\n description: string | null\n openGraph: Record<'og:title' | 'og:description' | 'og:url', string | null>\n robots: string | null\n title: string\n}\n\nexport class DocumentationError extends Error {\n readonly code: string\n readonly diagnostics: DocumentationDiagnostic[]\n\n constructor(message: string, code: string, diagnostics: DocumentationDiagnostic[] = []) {\n super(message)\n this.name = 'DocumentationError'\n this.code = code\n this.diagnostics = diagnostics\n }\n}\n","import { DocumentationError } from './types'\n\n/** Slash-collapsing shared by the compiler's strict normalizer and the\n * worker's lenient normalizer for untrusted lookup input, which must miss\n * rather than throw. */\nexport function collapseRoute(value: string): string {\n let route = `/${value}`.replace(/\\/{2,}/g, '/')\n if (route.length > 1) route = route.replace(/\\/$/, '')\n return route\n}\n\n/** Normalize and validate every public documentation route in one place. */\nexport function normalizeRoute(value: string): string {\n assertSafeRoute(value)\n let route = collapseRoute(value)\n route = route.replace(/\\.(?:md|mdx)$/i, '')\n route = route.replace(/\\/index$/i, '')\n return route || '/'\n}\n\nexport function routeFromRelativePath(relativePath: string): string {\n let path = relativePath.replace(/\\.(?:md|mdx)$/i, '')\n if (path === 'index') path = ''\n else path = path.replace(/\\/index$/i, '')\n return normalizeRoute(path)\n}\n\n/** Normalize the public mount for native documentation. Empty means a custom documentation host. */\nexport function normalizeDocumentationBasePath(value: string | undefined): string {\n if (!value || value === '/') return ''\n const normalized = normalizeRoute(value)\n if (normalized === '/_documentation') {\n throw new DocumentationError('The internal /_documentation namespace cannot be a public documentation base', 'documentation_base_invalid')\n }\n return normalized\n}\n\n/** Convert a logical documentation route/resource into its public URL path. */\nexport function documentationPublicPath(basePath: string, path: string): string {\n const base = normalizeDocumentationBasePath(basePath)\n const suffix = path.startsWith('/') ? path : `/${path}`\n if (suffix === '/') return base || '/'\n return `${base}${suffix}`\n}\n\n/** Project logical root-relative references onto the active public mount. */\nexport function publicDocumentationReferences(source: string, basePath: string): string {\n const base = normalizeDocumentationBasePath(basePath)\n if (!base) return source\n const publicPath = (value: string): string =>\n value === base || value.startsWith(`${base}/`) ? value : `${base}${value}`\n return source\n .replace(\n /(\\]\\()(\\/(?!\\/)[^)\\s]*)/g,\n (_match, prefix: string, value: string) => `${prefix}${publicPath(value)}`,\n )\n .replace(\n /^(\\s*\\[[^\\]]+\\]:\\s*)(\\/(?!\\/)\\S*)/gm,\n (_match, prefix: string, value: string) => `${prefix}${publicPath(value)}`,\n )\n .replace(\n /(\\b(?:href|src)=[\"'])(\\/(?!\\/)[^\"']*)/g,\n (_match, prefix: string, value: string) => `${prefix}${publicPath(value)}`,\n )\n}\n\n/** Convert a public request pathname back to a logical documentation route. */\nexport function documentationLogicalPath(basePath: string, pathname: string): string | null {\n const base = normalizeDocumentationBasePath(basePath)\n if (!base) return pathname.startsWith('/') ? pathname : `/${pathname}`\n if (pathname === base) return '/'\n if (!pathname.startsWith(`${base}/`)) return null\n return pathname.slice(base.length) || '/'\n}\n\n/** Canonical public Markdown projection for a page route. */\nexport function markdownUrlForRoute(route: string, basePath = ''): string {\n const logical = route === '/' ? '/index.md' : `${normalizeRoute(route)}.md`\n return documentationPublicPath(basePath, logical)\n}\n\n/** Deterministic build artifact paths for one canonical page route. */\nexport function artifactPathsForRoute(route: string): {\n data: string\n html: string\n markdown: string\n} {\n const clean = normalizeRoute(route).replace(/^\\//, '')\n return clean\n ? {\n data: `data/${clean}.json`,\n html: `${clean}/index.html`,\n markdown: `${clean}.md`,\n }\n : {\n data: 'data/index.json',\n html: 'index.html',\n markdown: 'index.md',\n }\n}\n\nexport function routeArtifactId(route: string): string {\n return route === '/'\n ? 'index'\n : normalizeRoute(route).replace(/^\\//, '').replace(/[^a-z0-9]+/gi, '-')\n}\n\nexport function joinSiteUrl(base: string, route: string): string {\n const path = route.startsWith('/') ? route : `/${route}`\n return `${base.replace(/\\/$/, '')}${path}`\n}\n\nfunction assertSafeRoute(value: string): void {\n if (value.includes('\\\\') || value.includes('\\0')) throw unsafeRoute(value)\n\n let decoded = value\n for (let pass = 0; pass < 5; pass++) {\n let next: string\n try {\n next = decodeURIComponent(decoded)\n } catch {\n throw unsafeRoute(value)\n }\n if (next === decoded) break\n decoded = next\n }\n if (\n decoded.includes('\\\\') ||\n decoded.includes('\\0') ||\n decoded.split('/').some((segment) => segment === '.' || segment === '..')\n ) throw unsafeRoute(value)\n}\n\nfunction unsafeRoute(value: string): DocumentationError {\n return new DocumentationError(\n `Documentation route contains an unsafe path segment: ${value}`,\n 'documentation_route_invalid',\n [{ code: 'route_path_escape', message: value }],\n )\n}\n","/** Copy text while preserving focus when the Clipboard API is unavailable. */\nexport async function writeClipboardText(text: string): Promise<void> {\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text)\n return\n }\n } catch {\n // A user gesture can still copy through the document when access is withheld.\n }\n\n const activeElement = document.activeElement instanceof HTMLElement ? document.activeElement : null\n const textarea = document.createElement('textarea')\n textarea.value = text\n textarea.readOnly = true\n textarea.style.position = 'fixed'\n textarea.style.inset = '0 auto auto 0'\n textarea.style.opacity = '0'\n textarea.style.pointerEvents = 'none'\n document.body.appendChild(textarea)\n textarea.focus({ preventScroll: true })\n textarea.select()\n const copied = document.execCommand('copy')\n textarea.remove()\n activeElement?.focus({ preventScroll: true })\n if (!copied) throw new Error('Unable to copy text')\n}\n\nexport function externalProps(href: string): { target?: '_blank'; rel?: 'noopener noreferrer' } {\n return isExternal(href) ? { target: '_blank', rel: 'noopener noreferrer' } : {}\n}\n\nexport function isExternal(href: string): boolean {\n return /^https?:\\/\\//i.test(href)\n}\n\nexport function safeStorageGet(key: string): string | null {\n try { return localStorage.getItem(key) } catch { return null }\n}\n\nexport function safeStorageSet(key: string, value: string): void {\n try { localStorage.setItem(key, value) } catch { /* storage is optional */ }\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type ReactNode,\n} from 'react'\nimport { safeStorageGet, safeStorageSet, writeClipboardText } from './browser'\nimport { CheckIcon, CopyIcon, SparkIcon } from './icons'\n\nexport interface CodeBlockControls {\n assistantEnabled: boolean\n onAsk: (code: string) => void\n}\n\n/**\n * The article supplies the assistant wiring so code-block controls render the\n * same way whether React owns the prose (MDX) or the controls are portalled\n * into compiler HTML. Portals inherit context from their React position, so a\n * single provider in `Article` covers both.\n */\nconst CodeBlockContext = createContext<CodeBlockControls>({\n assistantEnabled: false,\n onAsk: () => {},\n})\n\nexport const CodeBlockControlsProvider = CodeBlockContext.Provider\n\n/** Copy and ask controls. `readCode` is evaluated at click time so the same\n * component serves a React-rendered `pre` and a compiler-rendered one. */\nexport function CodeBlockActions({ readCode }: { readCode: () => string }): ReactElement {\n const { assistantEnabled, onAsk } = useContext(CodeBlockContext)\n const [copied, setCopied] = useState(false)\n const copy = async (): Promise<void> => {\n await writeClipboardText(readCode())\n setCopied(true)\n window.setTimeout(() => setCopied(false), 1400)\n }\n return (\n <>\n <button aria-label={copied ? 'Code copied' : 'Copy code'} onClick={() => { void copy() }} type=\"button\">\n {copied ? <CheckIcon /> : <CopyIcon />}\n </button>\n {assistantEnabled && (\n <button\n aria-label=\"Ask the documentation assistant about this code\"\n onClick={() => onAsk(readCode().trim().slice(0, 1200))}\n type=\"button\"\n ><SparkIcon /></button>\n )}\n </>\n )\n}\n\nexport function codeBlockLanguage(className: string): string {\n return /(?:^|\\s)(?:language|lang)-([a-z0-9+#-]{1,20})/i.exec(className)?.[1] ?? ''\n}\n\nfunction childCodeClassName(children: ReactNode): string {\n const code = children as { props?: { className?: unknown } } | null\n return typeof code?.props?.className === 'string' ? code.props.className : ''\n}\n\n/** MDX attaches fence info to the `code` child, not the `pre`. */\nfunction childCodeTitle(children: ReactNode): string | undefined {\n const code = children as { props?: Record<string, unknown> } | null\n const title = code?.props?.['data-code-title']\n return typeof title === 'string' && title ? title : undefined\n}\n\n/** Inside a CodeGroup the fence title is already the tab label. */\nconst CodeGroupContext = createContext(false)\nexport const CodeGroupProvider = CodeGroupContext.Provider\n\n/**\n * The MDX `pre` replacement. The wrapper, language label, and controls are all\n * React children of the same element, so the reconciler is the only writer of\n * this subtree — the compiled-HTML path gets the identical structure from\n * `useCodeBlockMounts` instead.\n */\nexport function CodeBlock({ children, ...props }: ComponentPropsWithoutRef<'pre'>): ReactElement {\n const preRef = useRef<HTMLPreElement>(null)\n const inCodeGroup = useContext(CodeGroupContext)\n const language = codeBlockLanguage(childCodeClassName(children))\n const preTitle = (props as Record<string, unknown>)['data-code-title']\n const title = inCodeGroup\n ? undefined\n : childCodeTitle(children) ?? (typeof preTitle === 'string' && preTitle ? preTitle : undefined)\n const readCode = (): string =>\n preRef.current?.querySelector('code')?.textContent ?? preRef.current?.textContent ?? ''\n return (\n <div className=\"documentation-code-block\">\n {title ? <div className=\"documentation-code-title\">{title}</div> : null}\n <pre {...props} ref={preRef}>{children}</pre>\n <div className=\"documentation-code-actions\">\n {language ? <span className=\"documentation-code-language\">{language}</span> : null}\n <CodeBlockActions readCode={readCode} />\n </div>\n </div>\n )\n}\n\nconst TAB_SELECTION_KEY = 'deepspace-documentation-tab-selection'\nconst TAB_CHANGE_EVENT = 'deepspace-documentation-tab-change'\n\nexport interface TabGroupPanel {\n label: string\n content: ReactNode\n}\n\n/**\n * Tab groups rendered by React rather than enhanced imperatively after the\n * fact. Selection still syncs across every group on the page through the same\n * storage key and document event the compiled-HTML path uses, so a `Tabs` block\n * and a compiled tab group stay in step.\n */\nexport function TabGroup({\n className,\n panels,\n title,\n}: {\n className: string\n panels: TabGroupPanel[]\n title?: ReactNode\n}): ReactElement {\n const groupId = useId()\n const [active, setActive] = useState(0)\n const controlsRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const stored = safeStorageGet(TAB_SELECTION_KEY)\n const index = stored ? panels.findIndex((panel) => panel.label === stored) : -1\n if (index >= 0) setActive(index)\n }, [panels])\n\n useEffect(() => {\n const sync = (event: Event): void => {\n const detail = (event as CustomEvent<{ label?: string; source?: unknown }>).detail\n if (!detail?.label || detail.source === groupId) return\n const index = panels.findIndex((panel) => panel.label === detail.label)\n if (index >= 0) setActive(index)\n }\n document.addEventListener(TAB_CHANGE_EVENT, sync)\n return () => document.removeEventListener(TAB_CHANGE_EVENT, sync)\n }, [groupId, panels])\n\n const select = (index: number, broadcast: boolean): void => {\n setActive(index)\n const label = panels[index]?.label\n if (!broadcast || !label) return\n safeStorageSet(TAB_SELECTION_KEY, label)\n document.dispatchEvent(new CustomEvent(TAB_CHANGE_EVENT, { detail: { label, source: groupId } }))\n }\n\n const onKeyDown = (event: React.KeyboardEvent, index: number): void => {\n if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return\n event.preventDefault()\n const next = event.key === 'Home'\n ? 0\n : event.key === 'End'\n ? panels.length - 1\n : (index + (event.key === 'ArrowRight' ? 1 : -1) + panels.length) % panels.length\n select(next, true)\n controlsRef.current?.querySelectorAll('button')[next]?.focus()\n }\n\n return (\n <div className={className} data-tab-group>\n {title}\n <div className=\"documentation-tab-buttons\" ref={controlsRef} role=\"tablist\">\n {panels.map((panel, index) => (\n <button\n aria-selected={index === active}\n id={`documentation-tab-${groupId}-${index}`}\n key={panel.label}\n onClick={() => select(index, true)}\n onKeyDown={(event) => onKeyDown(event, index)}\n role=\"tab\"\n tabIndex={index === active ? 0 : -1}\n type=\"button\"\n >{panel.label}</button>\n ))}\n </div>\n {panels.map((panel, index) => (\n <section\n aria-labelledby={`documentation-tab-${groupId}-${index}`}\n className=\"documentation-tab\"\n data-tab\n data-tab-title={panel.label}\n hidden={index !== active}\n key={panel.label}\n role=\"tabpanel\"\n >{panel.content}</section>\n ))}\n </div>\n )\n}\n","import type { ReactElement, SVGProps } from 'react'\n\ntype IconProps = SVGProps<SVGSVGElement>\n\nfunction Icon({ children, ...props }: IconProps): ReactElement {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n {...props}\n >\n {children}\n </svg>\n )\n}\n\nexport function OrbitMark(props: IconProps): ReactElement {\n return (\n <Icon viewBox=\"0 0 32 32\" {...props}>\n <path d=\"M16 2.5c.5 7.7 5.8 13 13.5 13.5-7.7.5-13 5.8-13.5 13.5C15.5 21.8 10.2 16.5 2.5 16 10.2 15.5 15.5 10.2 16 2.5Z\" fill=\"currentColor\" />\n <circle cx=\"16\" cy=\"16\" fill=\"var(--documentation-bg)\" r=\"3.25\" />\n <path d=\"M4.5 22.7c5.6-2 16.4-8.3 22.7-14.1\" opacity=\".45\" stroke=\"currentColor\" strokeLinecap=\"round\" />\n </Icon>\n )\n}\n\nexport function SearchIcon(props: IconProps): ReactElement {\n return <Icon {...props}><circle cx=\"11\" cy=\"11\" r=\"6.5\" stroke=\"currentColor\" strokeWidth=\"1.8\" /><path d=\"m16 16 4 4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function SparkIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M12 2.8c.3 5 3.7 8.4 8.7 8.7-5 .3-8.4 3.7-8.7 8.7-.3-5-3.7-8.4-8.7-8.7 5-.3 8.4-3.7 8.7-8.7Z\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /><path d=\"M19 3v4M21 5h-4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.4\" /></Icon>\n}\n\nexport function MenuIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M4 7h16M4 12h16M4 17h16\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function CloseIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"m6 6 12 12M18 6 6 18\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function SunIcon(props: IconProps): ReactElement {\n return <Icon {...props}><circle cx=\"12\" cy=\"12\" r=\"3.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function MoonIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M19.5 14.8A8 8 0 0 1 9.2 4.5 8 8 0 1 0 19.5 14.8Z\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function SystemIcon(props: IconProps): ReactElement {\n return <Icon {...props}><rect x=\"3\" y=\"4\" width=\"18\" height=\"13\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"M8 21h8M12 17v4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function ChevronRightIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"m9 5 7 7-7 7\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function ChevronDownIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"m5 9 7 7 7-7\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function ExternalIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M14 4h6v6M20 4l-9 9\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /><path d=\"M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function CopyIcon(props: IconProps): ReactElement {\n return <Icon {...props}><rect x=\"8\" y=\"8\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2\" stroke=\"currentColor\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function CheckIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"m5 12.5 4.2 4L19 7\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.9\" /></Icon>\n}\n\nexport function FileIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M6 3.5h8l4 4V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4.5a1 1 0 0 1 1-1Z\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /><path d=\"M14 3.5v4h4M8 12h7M8 16h7\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function MessageIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M5.5 18.5 4 21l3.5-1.2A8.5 8.5 0 1 0 5.5 18.5Z\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /><path d=\"M8 10h8M8 14h5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function TerminalIcon(props: IconProps): ReactElement {\n return <Icon {...props}><rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"m7 9 3 3-3 3M12.5 15H17\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function EditorIcon(props: IconProps): ReactElement {\n return <Icon {...props}><rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"M8 4.5v15M11.5 9h5M11.5 12h5M11.5 15h3\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function SendIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M12 18V6M7.5 10.5 12 6l4.5 4.5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n\nexport function StopIcon(props: IconProps): ReactElement {\n return <Icon {...props}><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\" /></Icon>\n}\n\nexport function HashIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M9.5 4 7.5 20M16.5 4l-2 16M4.5 9h15M3.5 15h15\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.6\" /></Icon>\n}\n\nexport function ListIcon(props: IconProps): ReactElement {\n return <Icon {...props}><path d=\"M4 6h16M4 12h11M4 18h7\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.8\" /></Icon>\n}\n","import { useEffect, useRef, useState, type ReactElement } from 'react'\nimport type { DocumentationContextualAction, DocumentationRuntimeData } from '../types'\nimport { documentationPublicPath } from '../routing'\nimport { writeClipboardText } from './browser'\nimport {\n CheckIcon,\n ChevronDownIcon,\n CopyIcon,\n EditorIcon,\n ExternalIcon,\n FileIcon,\n MessageIcon,\n OrbitMark,\n TerminalIcon,\n} from './icons'\n\nexport function PageActions({\n data,\n onAssistantOpen,\n}: {\n data: DocumentationRuntimeData\n onAssistantOpen: (seed?: string) => void\n}): ReactElement | null {\n const [copied, setCopied] = useState<DocumentationContextualAction | null>(null)\n const detailsRef = useRef<HTMLDetailsElement>(null)\n const actions = data.config.contextual.actions.filter((action) => {\n if (data.page.route === '/404') return false\n if (action === 'assistant' && data.config.assistant.access === 'disabled') return false\n if (\n (action === 'mcp' || action === 'add-mcp' || action === 'cursor' || action === 'vscode')\n && data.config.mcp.access !== 'public'\n ) return false\n return true\n })\n const primary = actions[0]\n\n useEffect(() => {\n const closeOnPointerDown = (event: PointerEvent): void => {\n const details = detailsRef.current\n if (details && !details.contains(event.target as Node)) details.open = false\n }\n const closeOnEscape = (event: KeyboardEvent): void => {\n if (event.key === 'Escape' && detailsRef.current?.open) {\n detailsRef.current.open = false\n detailsRef.current.querySelector('summary')?.focus()\n }\n }\n document.addEventListener('pointerdown', closeOnPointerDown)\n document.addEventListener('keydown', closeOnEscape)\n return () => {\n document.removeEventListener('pointerdown', closeOnPointerDown)\n document.removeEventListener('keydown', closeOnEscape)\n }\n }, [])\n\n if (!primary) return null\n\n const markCopied = (action: DocumentationContextualAction): void => {\n setCopied(action)\n window.setTimeout(() => setCopied((current) => current === action ? null : current), 1600)\n }\n const copyPage = async (): Promise<void> => {\n const response = await fetch(data.page.markdownUrl)\n if (!response.ok) return\n await writeClipboardText(await response.text())\n markCopied('copy')\n closeMenu()\n }\n const copyMcp = async (): Promise<void> => {\n await writeClipboardText(new URL(documentationPublicPath(data.basePath, '/mcp'), window.location.origin).toString())\n markCopied('mcp')\n closeMenu()\n }\n const copyMcpInstall = async (): Promise<void> => {\n const mcpUrl = new URL(documentationPublicPath(data.basePath, '/mcp'), window.location.origin).toString()\n await writeClipboardText(`npx add-mcp ${mcpUrl}`)\n markCopied('add-mcp')\n closeMenu()\n }\n const closeMenu = (): void => {\n const details = detailsRef.current\n if (!details?.open) return\n details.open = false\n details.querySelector('summary')?.focus()\n }\n const openAiContext = (provider: 'chatgpt' | 'claude'): void => {\n const markdownUrl = new URL(data.page.markdownUrl, window.location.origin).toString()\n const prompt = `Use ${markdownUrl} as context. Explain ${data.page.title} and answer my questions about this documentation page.`\n const destination = new URL(provider === 'chatgpt' ? 'https://chatgpt.com/' : 'https://claude.ai/new')\n destination.searchParams.set('q', prompt)\n window.open(destination.toString(), '_blank', 'noopener,noreferrer')\n closeMenu()\n }\n const openMcpEditor = (editor: 'cursor' | 'vscode'): void => {\n const mcpUrl = new URL(documentationPublicPath(data.basePath, '/mcp'), window.location.origin).toString()\n const name = data.config.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '') || 'documentation'\n if (editor === 'cursor') {\n const config = window.btoa(JSON.stringify({ url: mcpUrl }))\n window.location.href = `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(name)}&config=${encodeURIComponent(config)}`\n } else {\n const config = encodeURIComponent(JSON.stringify({ name, type: 'http', url: mcpUrl }))\n window.location.href = `vscode:mcp/install?${config}`\n }\n closeMenu()\n }\n const content = (\n icon: ReactElement,\n label: string,\n description: string,\n menuItem: boolean,\n external = false,\n ): ReactElement => menuItem ? (\n <>\n <span className=\"documentation-contextual-action-icon\">{icon}</span>\n <span className=\"documentation-contextual-action-copy\"><strong>{label}</strong><small>{description}</small></span>\n {external && <ExternalIcon className=\"documentation-contextual-action-external\" />}\n </>\n ) : <>{icon}{label}</>\n const renderAction = (action: DocumentationContextualAction, menuItem = false): ReactElement => {\n const role = menuItem ? 'menuitem' : undefined\n if (action === 'view') {\n return <a href={data.page.markdownUrl} key={action} onClick={closeMenu} role={role}>{content(<FileIcon />, 'View as Markdown', 'Open the raw Markdown page', menuItem)}</a>\n }\n if (action === 'assistant') {\n return <button key={action} role={role} type=\"button\" onClick={() => { closeMenu(); onAssistantOpen(`Explain the key ideas on ${data.page.title}.`) }}>{content(<OrbitMark />, 'Ask about this page', 'Use the DeepSpace agent with page context', menuItem)}</button>\n }\n if (action === 'chatgpt' || action === 'claude') {\n const label = action === 'chatgpt' ? 'Open in ChatGPT' : 'Open in Claude'\n return <button key={action} role={role} type=\"button\" onClick={() => openAiContext(action)}>{content(<MessageIcon />, label, 'Ask questions about this page', menuItem, true)}</button>\n }\n if (action === 'mcp') {\n const label = copied === action ? 'MCP URL copied' : 'Copy MCP server URL'\n return <button key={action} role={role} type=\"button\" onClick={copyMcp}>{content(copied === action ? <CheckIcon /> : <CopyIcon />, label, 'Copy the same-release documentation endpoint', menuItem)}</button>\n }\n if (action === 'add-mcp') {\n const label = copied === action ? 'Install command copied' : 'Copy MCP install command'\n return <button key={action} role={role} type=\"button\" onClick={copyMcpInstall}>{content(copied === action ? <CheckIcon /> : <TerminalIcon />, label, 'Copy npx command to install MCP server', menuItem)}</button>\n }\n if (action === 'cursor' || action === 'vscode') {\n const label = action === 'cursor' ? 'Connect to Cursor' : 'Connect to VS Code'\n return <button key={action} role={role} type=\"button\" onClick={() => openMcpEditor(action)}>{content(<EditorIcon />, label, `Install MCP server in ${action === 'cursor' ? 'Cursor' : 'VS Code'}`, menuItem, true)}</button>\n }\n const label = copied === action ? 'Page copied' : 'Copy page'\n return <button key={action} role={role} type=\"button\" onClick={copyPage}>{content(copied === action ? <CheckIcon /> : <CopyIcon />, label, 'Copy page as Markdown for LLMs', menuItem)}</button>\n }\n\n return (\n <div className=\"documentation-contextual-actions\" aria-label=\"Page actions\">\n <div className=\"documentation-contextual-primary\" aria-live=\"polite\">{renderAction(primary)}</div>\n {actions.length > 0 && (\n <details ref={detailsRef}>\n <summary aria-label=\"More page actions\"><ChevronDownIcon /></summary>\n <div aria-label=\"More page actions\" className=\"documentation-contextual-menu\" role=\"menu\">\n {actions.map((action) => renderAction(action, true))}\n </div>\n </details>\n )}\n </div>\n )\n}\n","import {\n useEffect,\n useRef,\n useState,\n type FormEvent,\n type ReactElement,\n type ReactNode,\n} from 'react'\nimport { parseSseLine } from '../../client/ai-stream'\nimport { documentationPublicPath } from '../routing'\nimport { documentationSubject } from '../text'\nimport { completedDocumentationAssistantTranscript } from './assistant-transcript'\nimport { errorMessage, externalProps, writeClipboardText } from './browser'\nimport { useDialogFocus } from './dialog'\nimport { CloseIcon, SendIcon, StopIcon } from './icons'\n\ninterface AssistantMessage {\n id: string\n role: 'assistant' | 'user'\n text: string\n state?: 'error' | 'streaming'\n status?: string\n}\n\nexport interface AssistantSeed {\n id: number\n submit: boolean\n value?: string\n}\n\nexport function AssistantLauncher({\n input,\n name,\n onInputChange,\n onSubmit,\n}: {\n input: string\n name: string\n onInputChange: (value: string) => void\n onSubmit: (question: string) => void\n}): ReactElement {\n const subject = documentationSubject(name)\n const submit = (event: FormEvent): void => {\n event.preventDefault()\n const question = input.trim()\n if (!question) return\n onSubmit(question)\n }\n return (\n <form\n className=\"documentation-assistant-launcher\"\n id=\"deepspace-documentation-assistant-launcher\"\n onSubmit={submit}\n >\n <input\n aria-label={`Ask the ${subject} agent`}\n autoCapitalize=\"sentences\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n enterKeyHint=\"send\"\n id=\"deepspace-documentation-assistant-launcher-input\"\n maxLength={4000}\n onChange={(event) => onInputChange(event.target.value)}\n placeholder=\"Ask anything…\"\n spellCheck={false}\n value={input}\n />\n <span aria-hidden=\"true\" className=\"documentation-launcher-hint\"><kbd>⌘</kbd><kbd>I</kbd></span>\n <button className=\"documentation-launcher-send\" type=\"submit\" disabled={!input.trim()} aria-label=\"Send question to documentation agent\"><SendIcon /></button>\n </form>\n )\n}\n\nexport function DocumentationAssistant({\n access,\n basePath,\n input,\n name,\n onClose,\n onInputChange,\n open,\n route,\n seed,\n suggestions,\n}: {\n access: 'public' | 'authenticated'\n basePath: string\n input: string\n name: string\n onClose: () => void\n onInputChange: (value: string) => void\n open: boolean\n route: string\n seed: AssistantSeed\n suggestions?: string[]\n}): ReactElement | null {\n const panelRef = useRef<HTMLElement>(null)\n const formRef = useRef<HTMLFormElement>(null)\n const messagesRef = useRef<HTMLDivElement>(null)\n const composerRef = useRef<HTMLTextAreaElement>(null)\n const abortRef = useRef<AbortController | null>(null)\n const queuedQuestionRef = useRef<string | null>(null)\n const handledSeedRef = useRef(0)\n const [messages, setMessages] = useState<AssistantMessage[]>([\n { id: 'welcome', role: 'assistant', text: `I can search the ${documentationSubject(name)} and cite the exact pages I use.` },\n ])\n const [sending, setSending] = useState(false)\n useDialogFocus(open, panelRef, onClose, false, 'deepspace-documentation-assistant-launcher-input')\n useEffect(() => {\n if (!open || seed.id === 0 || handledSeedRef.current === seed.id) return\n handledSeedRef.current = seed.id\n if (!seed.submit || !seed.value?.trim()) return\n queuedQuestionRef.current = seed.value\n const frame = window.requestAnimationFrame(() => formRef.current?.requestSubmit())\n return () => window.cancelAnimationFrame(frame)\n }, [open, seed])\n useEffect(() => {\n const element = messagesRef.current\n if (element) element.scrollTop = element.scrollHeight\n }, [messages])\n // Grow the composer with its content up to the cap; a fixed two-row box\n // scrolled and clipped glyphs instead.\n useEffect(() => {\n const element = composerRef.current\n if (!element) return\n element.style.height = 'auto'\n element.style.height = `${Math.min(element.scrollHeight, 160)}px`\n element.style.overflowY = element.scrollHeight > 160 ? 'auto' : 'hidden'\n }, [input, open])\n useEffect(() => () => abortRef.current?.abort(), [])\n if (!open) return null\n\n const submit = async (event?: FormEvent): Promise<void> => {\n event?.preventDefault()\n const question = (queuedQuestionRef.current ?? input).trim()\n queuedQuestionRef.current = null\n if (!question || sending) return\n const transcript = completedDocumentationAssistantTranscript(messages)\n onInputChange('')\n setSending(true)\n const userId = `user-${Date.now()}`\n const answerId = `assistant-${Date.now()}`\n setMessages((current) => [...current, { id: userId, role: 'user', text: question }, { id: answerId, role: 'assistant', text: '', state: 'streaming', status: 'Searching this documentation…' }])\n const controller = new AbortController()\n abortRef.current = controller\n let timedOut = false\n const slowTimer = window.setTimeout(() => {\n setMessages((current) => current.map((message) => message.id === answerId\n ? { ...message, status: 'Still working through the documentation…' }\n : message))\n }, 12_000)\n const timeoutTimer = window.setTimeout(() => {\n timedOut = true\n controller.abort()\n }, 120_000)\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n }\n if (access === 'authenticated') {\n const tokenResponse = await fetch('/api/auth/token', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' } })\n const tokenData = tokenResponse.ok ? await tokenResponse.json().catch(() => null) as { token?: string } | null : null\n if (!tokenData?.token) throw new Error('Sign in to use the documentation assistant.')\n headers.Authorization = `Bearer ${tokenData.token}`\n }\n const response = await fetch(documentationPublicPath(basePath, '/api/ai'), {\n method: 'POST',\n headers,\n body: JSON.stringify({ question, route, messages: transcript }),\n signal: controller.signal,\n })\n if (!response.ok || !response.body) {\n const body = await response.json().catch(() => null) as { error?: string } | null\n throw new Error(body?.error ?? `Assistant unavailable (${response.status})`)\n }\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let answer = ''\n const consumeLine = (line: string): void => {\n const data = parseSseLine(line)\n if (!data) return\n if (data.type === 'text-delta' && typeof data.delta === 'string') {\n answer += data.delta\n setMessages((current) => current.map((message) => message.id === answerId ? { ...message, text: answer, state: 'streaming', status: undefined } : message))\n } else if (data.type === 'tool-input-available') {\n const status = data.toolName === 'documentation_read'\n ? 'Reading the relevant source pages…'\n : 'Searching this documentation…'\n setMessages((current) => current.map((message) => message.id === answerId ? { ...message, status } : message))\n } else if (data.type === 'tool-output-available') {\n setMessages((current) => current.map((message) => message.id === answerId ? { ...message, status: 'Reviewing the source material…' } : message))\n } else if (data.type === 'error') {\n throw new Error(typeof data.errorText === 'string' ? data.errorText : 'The assistant stream failed.')\n }\n }\n while (true) {\n const chunk = await reader.read()\n if (chunk.done) break\n buffer += decoder.decode(chunk.value, { stream: true })\n const lines = buffer.split(/\\r?\\n/)\n buffer = lines.pop() ?? ''\n for (const line of lines) consumeLine(line)\n }\n buffer += decoder.decode()\n consumeLine(buffer)\n setMessages((current) => current.map((message) => message.id === answerId ? { ...message, text: answer || 'No answer was returned.', state: undefined } : message))\n } catch (error) {\n const message = timedOut\n ? 'The documentation search took too long. Try a narrower question.'\n : controller.signal.aborted\n ? 'Response stopped.'\n : errorMessage(error)\n setMessages((current) => current.map((item) => item.id === answerId ? { ...item, text: message, state: 'error' } : item))\n } finally {\n window.clearTimeout(slowTimer)\n window.clearTimeout(timeoutTimer)\n abortRef.current = null\n setSending(false)\n }\n }\n\n const defaults = suggestions ?? ['How do I get started?', 'Show me a complete example', 'What should I understand first?']\n return (\n <aside\n aria-label=\"Documentation assistant\"\n className=\"documentation-assistant\"\n id=\"deepspace-documentation-assistant\"\n ref={panelRef}\n role=\"complementary\"\n >\n <header>\n <div><span><strong id=\"deepspace-documentation-assistant-title\">Ask {name}</strong><small>Answers from this documentation build</small></span></div>\n <button type=\"button\" onClick={onClose} aria-label=\"Close documentation assistant\"><CloseIcon /></button>\n </header>\n <div className=\"documentation-assistant-messages\" ref={messagesRef} aria-live=\"polite\">\n {messages.map((message) => (\n <div className={`documentation-assistant-message is-${message.role}${message.state ? ` is-${message.state}` : ''}`} key={message.id}>\n <div>\n {message.role === 'assistant' ? <AssistantMarkdown value={message.text} /> : message.text}\n {message.state === 'streaming' && !message.text && (\n <span className=\"documentation-assistant-activity\" role=\"status\"><span aria-hidden=\"true\" />{message.status ?? 'Working…'}</span>\n )}\n </div>\n </div>\n ))}\n {messages.length === 1 && (\n <div className=\"documentation-assistant-suggestions\">\n <p>Try asking</p>\n {defaults.map((suggestion) => <button key={suggestion} type=\"button\" onClick={() => onInputChange(suggestion)}>{suggestion}</button>)}\n </div>\n )}\n </div>\n <form className=\"documentation-assistant-composer\" onSubmit={submit} ref={formRef}>\n <textarea\n aria-label=\"Ask a documentation question\"\n autoCapitalize=\"sentences\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n data-autofocus\n enterKeyHint=\"send\"\n maxLength={4000}\n onChange={(event) => onInputChange(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault()\n void submit()\n }\n }}\n placeholder=\"Ask a question about this documentation\"\n ref={composerRef}\n rows={1}\n spellCheck={false}\n value={input}\n />\n {sending ? (\n <button type=\"button\" onClick={() => abortRef.current?.abort()} aria-label=\"Stop response\"><StopIcon /></button>\n ) : (\n <button type=\"submit\" disabled={!input.trim()} aria-label=\"Send question\"><SendIcon /></button>\n )}\n </form>\n <footer>Responses cite this deployment and may still contain mistakes.</footer>\n </aside>\n )\n}\n\n\nfunction AssistantMarkdown({ value }: { value: string }): ReactElement {\n const blocks: ReactNode[] = []\n const fence = /```([^\\n`]*)\\n([\\s\\S]*?)(?:```|$)/g\n let cursor = 0\n for (const match of value.matchAll(fence)) {\n const index = match.index ?? 0\n if (index > cursor) blocks.push(...renderAssistantText(value.slice(cursor, index), `text-${cursor}`))\n blocks.push(\n <AssistantCodeBlock\n code={(match[2] ?? '').replace(/\\n$/, '')}\n key={`code-${index}`}\n language={(match[1] ?? '').trim().split(/\\s+/, 1)[0] ?? ''}\n />,\n )\n cursor = index + match[0].length\n }\n if (cursor < value.length) blocks.push(...renderAssistantText(value.slice(cursor), `text-${cursor}`))\n return <div className=\"documentation-assistant-markdown\">{blocks}</div>\n}\n\nfunction AssistantCodeBlock({ code, language }: { code: string; language: string }): ReactElement {\n const [copied, setCopied] = useState(false)\n const copy = async (): Promise<void> => {\n await writeClipboardText(code)\n setCopied(true)\n window.setTimeout(() => setCopied(false), 1400)\n }\n return (\n <figure className=\"documentation-assistant-code\">\n <figcaption><span>{language || 'Code'}</span><button type=\"button\" onClick={copy}>{copied ? 'Copied' : 'Copy'}</button></figcaption>\n <pre><code>{code}</code></pre>\n </figure>\n )\n}\n\nfunction renderAssistantText(value: string, keyPrefix: string): ReactNode[] {\n const lines = value.split('\\n')\n const blocks: ReactNode[] = []\n let index = 0\n while (index < lines.length) {\n const line = lines[index]?.trim() ?? ''\n if (!line) { index += 1; continue }\n const heading = line.match(/^(#{1,4})\\s+(.+)$/)\n if (heading) {\n blocks.push(<strong className=\"documentation-assistant-heading\" key={`${keyPrefix}-heading-${index}`}>{renderInlineMarkdown(heading[2])}</strong>)\n index += 1\n continue\n }\n const unordered = /^[-*]\\s+/.test(line)\n const ordered = /^\\d+[.)]\\s+/.test(line)\n if (unordered || ordered) {\n const items: ReactNode[] = []\n while (index < lines.length) {\n const candidate = lines[index]?.trim() ?? ''\n const match = unordered ? candidate.match(/^[-*]\\s+(.+)$/) : candidate.match(/^\\d+[.)]\\s+(.+)$/)\n if (!match) break\n items.push(<li key={`${keyPrefix}-item-${index}`}>{renderInlineMarkdown(match[1])}</li>)\n index += 1\n }\n blocks.push(unordered\n ? <ul key={`${keyPrefix}-list-${index}`}>{items}</ul>\n : <ol key={`${keyPrefix}-list-${index}`}>{items}</ol>)\n continue\n }\n const paragraph: string[] = [line]\n index += 1\n while (index < lines.length) {\n const candidate = lines[index]?.trim() ?? ''\n if (!candidate || /^(?:#{1,4}\\s+|[-*]\\s+|\\d+[.)]\\s+)/.test(candidate)) break\n paragraph.push(candidate)\n index += 1\n }\n blocks.push(<p key={`${keyPrefix}-paragraph-${index}`}>{paragraph.map((part, partIndex) => <span key={`${partIndex}:${part.slice(0, 18)}`}>{renderInlineMarkdown(part)}{partIndex < paragraph.length - 1 && ' '}</span>)}</p>)\n }\n return blocks\n}\n\nfunction renderInlineMarkdown(value: string): ReactNode[] {\n const pattern = /(\\[[^\\]]+\\]\\((?:https?:\\/\\/|\\/)[^)]+\\)|`[^`]+`|\\*\\*[^*]+\\*\\*)/g\n return value.split(pattern).filter(Boolean).map((part, index) => {\n const link = part.match(/^\\[([^\\]]+)\\]\\(((?:https?:\\/\\/|\\/)[^)]+)\\)$/)\n if (link) return <a key={`${index}:${part}`} href={link[2]} {...externalProps(link[2])}>{link[1]}</a>\n if (part.startsWith('`') && part.endsWith('`')) return <code key={`${index}:${part}`}>{part.slice(1, -1)}</code>\n if (part.startsWith('**') && part.endsWith('**')) return <strong key={`${index}:${part}`}>{part.slice(2, -2)}</strong>\n return <span key={`${index}:${part}`}>{part}</span>\n })\n}\n","/**\n * Pure decoders for the Vercel AI SDK v5 `toUIMessageStreamResponse` body.\n *\n * The wire format is SSE: each event is `data: <json>\\n\\n`, terminated by\n * `data: [DONE]\\n\\n`. Each event carries a `type` discriminator\n * (`text-delta`, `tool-input-available`, `tool-output-available`,\n * `tool-input-error`, `tool-output-error`, `error`, `abort`, …) — see the\n * `UIMessageChunk` union in `ai/dist/index.d.ts`.\n *\n * This module decodes those chunks into a small action vocabulary that\n * the React layer then applies to its state. Keeping decode pure means\n * the v5-boundary behavior is fully testable without spinning up a\n * component tree.\n */\n\n/** Raw v5 stream chunk, as parsed off the wire. `type` may be any string. */\nexport type AiStreamChunk = Record<string, unknown> & { type?: unknown }\n\n/**\n * Strip one SSE line's framing. Returns the parsed JSON payload, or `null`\n * for blank lines, comment lines (`:` prefix), non-`data:` SSE fields, the\n * `[DONE]` terminator, or any line whose payload doesn't parse as JSON.\n *\n * Multi-line `data:` events (per the SSE spec, joined by `\\n` before\n * dispatch) are NOT supported — v5's emitter never produces them. If you\n * hit a wire intermediary that re-splits long payloads (e.g. a proxy that\n * caps line length), upgrade this to accumulate consecutive `data:` lines\n * until a blank line.\n */\nexport function parseSseLine(line: string): AiStreamChunk | null {\n if (!line) return null\n if (line.startsWith(':')) return null // SSE comment\n if (!line.startsWith('data:')) return null // we only consume `data:` events\n // SSE allows exactly one space after the colon to be elided. Trim a\n // trailing \\r so CRLF-framed responses still hit the [DONE] short-circuit.\n const raw = line.slice(5).replace(/^ /, '').replace(/\\r$/, '')\n if (raw === '[DONE]') return null\n try {\n const parsed: unknown = JSON.parse(raw)\n if (!parsed || typeof parsed !== 'object') return null\n return parsed as AiStreamChunk\n } catch {\n return null\n }\n}\n\n/**\n * Action vocabulary the React layer applies. Every `decodeAiStreamChunk`\n * output is one of these — `null` means the chunk is intentionally ignored\n * (lifecycle markers, reasoning we don't surface yet, etc.).\n *\n * Wire field renames (v5): chunks carry `input` / `output` directly. We\n * map them to `args` / `result` here so persisted UI shapes stay v4-stable.\n */\nexport type AiStreamAction =\n | { type: 'append-text'; delta: string }\n | { type: 'upsert-tool-call'; toolCallId: string; toolName: string; input: unknown }\n | { type: 'finalize-tool-call'; toolCallId: string; result: unknown }\n /**\n * Schema validation rejected the input before the tool ran; no preceding\n * `upsert-tool-call` was emitted, so the React layer must create the\n * invocation and finalize it as failed in one step.\n */\n | { type: 'fail-tool-input'; toolCallId: string; toolName: string; input: unknown; errorText: string }\n /** Tool execution failed; a previous `upsert-tool-call` exists to finalize. */\n | { type: 'fail-tool-output'; toolCallId: string; errorText: string }\n | { type: 'stream-error'; errorText: string }\n /** Server-side abort with no error chunk to follow. */\n | { type: 'abort' }\n\n/** Decode one v5 UIMessage stream chunk into an action, or `null` to ignore. */\nexport function decodeAiStreamChunk(chunk: AiStreamChunk): AiStreamAction | null {\n if (typeof chunk.type !== 'string') return null\n\n switch (chunk.type) {\n case 'text-delta': {\n const delta = typeof chunk.delta === 'string' ? chunk.delta : ''\n if (!delta) return null\n return { type: 'append-text', delta }\n }\n\n case 'tool-input-available': {\n if (typeof chunk.toolCallId !== 'string' || typeof chunk.toolName !== 'string') return null\n return {\n type: 'upsert-tool-call',\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n input: chunk.input,\n }\n }\n\n case 'tool-output-available': {\n if (typeof chunk.toolCallId !== 'string') return null\n // The wire emits `output: part.output` directly (no `toJSONValue`\n // wrapping at this layer). When `part.output` is `undefined`,\n // `JSON.stringify` drops the key entirely, so `'output' in chunk`\n // reads false on the receiving side. Treat absence as an explicit\n // `null` result — finalizing the invocation is what stops the\n // spinner; ignoring the chunk would hang the UI forever for any\n // tool whose `execute` returns undefined.\n const result = 'output' in chunk ? chunk.output : null\n return { type: 'finalize-tool-call', toolCallId: chunk.toolCallId, result }\n }\n\n case 'tool-input-error': {\n if (typeof chunk.toolCallId !== 'string' || typeof chunk.toolName !== 'string') return null\n const errorText = typeof chunk.errorText === 'string' ? chunk.errorText : 'Tool input rejected'\n return {\n type: 'fail-tool-input',\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n input: chunk.input,\n errorText,\n }\n }\n\n case 'tool-output-error': {\n if (typeof chunk.toolCallId !== 'string') return null\n const errorText = typeof chunk.errorText === 'string' ? chunk.errorText : 'Tool execution failed'\n return { type: 'fail-tool-output', toolCallId: chunk.toolCallId, errorText }\n }\n\n case 'error': {\n const errorText = typeof chunk.errorText === 'string' ? chunk.errorText : 'Stream error'\n return { type: 'stream-error', errorText }\n }\n\n case 'abort':\n return { type: 'abort' }\n\n // Forward-compat: silently ignore lifecycle markers (start/finish,\n // start-step/finish-step), text-start/-end, tool-input-start/-delta,\n // reasoning-*, source-*, message-metadata.\n default:\n return null\n }\n}\n","/** Render an unknown failure without unsafe structural assumptions. */\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n}\n\nexport function escapeXml(value: string): string {\n return escapeHtml(value).replace(/&#39;/g, '&apos;')\n}\n\nexport function slugify(value: string): string {\n return value\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n}\n\n/** Add the documentation qualifier exactly once in user- and agent-facing copy. */\nexport function documentationSubject(name: string): string {\n const normalized = name.trim()\n if (!normalized || /^documentation$/i.test(normalized)) return 'documentation'\n return /(?:\\bdocs?|documentation)$/i.test(normalized) ? normalized : `${normalized} documentation`\n}\n\n/** Allocate stable, collision-free ids with the same rules in Markdown and MDX. */\nexport function createSlugger(fallback = 'section'): (value: string) => string {\n const seen = new Map<string, number>()\n return (value) => {\n const base = slugify(value) || fallback\n const count = seen.get(base) ?? 0\n seen.set(base, count + 1)\n return count === 0 ? base : `${base}-${count + 1}`\n }\n}\n","export interface DocumentationAssistantTranscriptMessage {\n role: 'assistant' | 'user'\n text: string\n state?: 'error' | 'streaming'\n}\n\nexport interface DocumentationAssistantContextMessage {\n role: 'assistant' | 'user'\n content: string\n}\n\n/** Select completed in-memory turns to provide as context for the next request. */\nexport function completedDocumentationAssistantTranscript(\n messages: readonly DocumentationAssistantTranscriptMessage[],\n maxMessages: number = 12,\n): DocumentationAssistantContextMessage[] {\n const pairs: Array<\n [DocumentationAssistantContextMessage, DocumentationAssistantContextMessage]\n > = []\n for (let index = 0; index < messages.length - 1; index += 1) {\n const user = messages[index]\n if (user?.role !== 'user' || user.state !== undefined || !user.text.trim()) continue\n const assistant = messages[index + 1]\n if (\n assistant?.role !== 'assistant' ||\n assistant.state !== undefined ||\n !assistant.text.trim()\n ) {\n continue\n }\n pairs.push([\n { role: 'user', content: user.text },\n { role: 'assistant', content: assistant.text },\n ])\n index += 1\n }\n\n const pairLimit = Math.max(0, Math.floor(maxMessages / 2))\n if (pairLimit === 0) return []\n return pairs.slice(-pairLimit).flat()\n}\n","import { useEffect, type RefObject } from 'react'\n\n/** Shared keyboard/focus contract for the documentation search, assistant, and mobile navigation. */\nexport function useDialogFocus(\n open: boolean,\n ref: RefObject<HTMLElement | null>,\n onClose: () => void,\n trap = true,\n restoreId?: string,\n): void {\n useEffect(() => {\n if (!open) return\n const previous = document.activeElement as HTMLElement | null\n const element = ref.current\n const frame = window.requestAnimationFrame(() => {\n const target = element?.querySelector<HTMLElement>('[data-autofocus]')\n ?? element?.querySelector<HTMLElement>('button,a,input,textarea')\n target?.focus()\n })\n const keydown = (event: globalThis.KeyboardEvent): void => {\n if (event.key === 'Escape') {\n event.preventDefault()\n onClose()\n return\n }\n if (!trap || event.key !== 'Tab' || !element) return\n const focusable = Array.from(element.querySelectorAll<HTMLElement>(\n 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])',\n ))\n if (focusable.length === 0) return\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault()\n last?.focus()\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault()\n first?.focus()\n }\n }\n document.addEventListener('keydown', keydown)\n return () => {\n window.cancelAnimationFrame(frame)\n document.removeEventListener('keydown', keydown)\n const restoreTarget = restoreId\n ? document.getElementById(restoreId)\n : previous?.isConnected && previous !== document.body && !element?.contains(previous)\n ? previous\n : null\n restoreTarget?.focus()\n }\n }, [onClose, open, ref, restoreId, trap])\n}\n","import { useEffect, useRef, useState, type ReactElement } from 'react'\nimport { version as sdkVersion } from '../../../package.json'\nimport type { DocumentationNavigationNode, DocumentationRuntimeData } from '../types'\nimport { documentationPublicPath } from '../routing'\nimport { documentationSubject } from '../text'\nimport { externalProps, isExternal, safeStorageGet, safeStorageSet } from './browser'\nimport { useDialogFocus } from './dialog'\nimport {\n ChevronDownIcon,\n CloseIcon,\n ExternalIcon,\n MenuIcon,\n MoonIcon,\n OrbitMark,\n SearchIcon,\n SunIcon,\n SystemIcon,\n} from './icons'\n\ntype ThemeMode = 'light' | 'dark' | 'system'\n\nexport function DocumentationHeader({\n data,\n onMenuOpen,\n onSearchOpen,\n}: {\n data: DocumentationRuntimeData\n onMenuOpen: () => void\n onSearchOpen: () => void\n}): ReactElement {\n return (\n <header className=\"documentation-header\">\n <a\n className=\"documentation-brand\"\n href={data.config.theme.logoHref ?? documentationPublicPath(data.basePath, '/')}\n aria-label={`${documentationSubject(data.config.name)} home`}\n {...externalProps(data.config.theme.logoHref ?? documentationPublicPath(data.basePath, '/'))}\n >\n <BrandLogo data={data} />\n </a>\n <div className=\"documentation-header-center\">\n <button className=\"documentation-search-trigger\" type=\"button\" onClick={onSearchOpen} aria-label=\"Search documentation\">\n <SearchIcon />\n <span>Search documentation</span>\n <kbd>⌘K</kbd>\n </button>\n </div>\n <nav className=\"documentation-top-links\" aria-label=\"Product navigation\">\n {data.config.links.map((link) => (\n <a key={`${link.label}:${link.href}`} href={link.href} {...externalProps(link.href)}>\n {link.label}\n {isExternal(link.href) && <ExternalIcon />}\n </a>\n ))}\n </nav>\n <div className=\"documentation-mobile-actions\">\n <button className=\"documentation-icon-button\" type=\"button\" onClick={onSearchOpen} aria-label=\"Search documentation\"><SearchIcon /></button>\n <button className=\"documentation-icon-button\" type=\"button\" onClick={onMenuOpen} aria-label=\"Open documentation navigation\"><MenuIcon /></button>\n </div>\n </header>\n )\n}\n\nfunction BrandLogo({ data }: { data: DocumentationRuntimeData }): ReactElement {\n const { logo, logoDark } = data.config.theme\n if (logo) {\n return (\n <>\n <img className=\"documentation-brand-logo documentation-brand-logo-light\" src={logo} alt=\"\" />\n <img className=\"documentation-brand-logo documentation-brand-logo-dark\" src={logoDark ?? logo} alt=\"\" />\n <span className=\"documentation-brand-product\">Documentation</span>\n </>\n )\n }\n return (\n <>\n <span className=\"documentation-brand-mark\"><OrbitMark /></span>\n <span className=\"documentation-brand-name\">{data.config.name}</span>\n </>\n )\n}\n\nexport function DesktopSidebar({ data }: { data: DocumentationRuntimeData }): ReactElement {\n return (\n <aside className=\"documentation-sidebar\" aria-label=\"Documentation navigation\">\n <nav className=\"documentation-page-tree\">\n <NavigationTree activeRoute={data.page.route} basePath={data.basePath} nodes={data.navigation} />\n </nav>\n <div className=\"documentation-sidebar-footer\">\n {!data.config.theme.strictMode && <ThemeControls defaultMode={data.config.theme.defaultMode ?? 'system'} />}\n {data.config.footer.length > 0 && (\n <nav aria-label=\"Documentation footer\">\n {data.config.footer.map((link) => (\n <a key={`${link.label}:${link.href}`} href={link.href} {...externalProps(link.href)}>{link.label}</a>\n ))}\n </nav>\n )}\n <span>{`Built with deepspace ${sdkVersion}`}</span>\n </div>\n </aside>\n )\n}\n\nfunction NavigationTree({\n activeRoute,\n basePath,\n depth = 0,\n nodes,\n}: {\n activeRoute: string\n basePath: string\n depth?: number\n nodes: DocumentationNavigationNode[]\n}): ReactElement {\n return (\n <>\n {nodes.map((node) => {\n if (node.kind === 'group') {\n const active = containsRoute(node, activeRoute)\n if (depth === 0) {\n return (\n <section className=\"documentation-nav-section\" key={`group:${node.label}`}>\n <h2>{node.label}</h2>\n <NavigationTree activeRoute={activeRoute} basePath={basePath} depth={depth + 1} nodes={node.items} />\n </section>\n )\n }\n return (\n <details className=\"documentation-nav-folder\" key={`group:${node.label}`} open={active}>\n <summary><span>{node.label}</span><ChevronDownIcon /></summary>\n <div><NavigationTree activeRoute={activeRoute} basePath={basePath} depth={depth + 1} nodes={node.items} /></div>\n </details>\n )\n }\n const href = node.kind === 'page' ? documentationPublicPath(basePath, node.route) : node.href\n const active = node.kind === 'page' && node.route === activeRoute\n return (\n <a\n aria-current={active ? 'page' : undefined}\n className={active ? 'documentation-nav-link is-active' : 'documentation-nav-link'}\n href={href}\n key={`${node.kind}:${href}`}\n {...externalProps(href)}\n >\n <span>{node.label}</span>\n {isExternal(href) && <ExternalIcon />}\n </a>\n )\n })}\n </>\n )\n}\n\nexport function MobileNavigation({\n data,\n onClose,\n open,\n}: {\n data: DocumentationRuntimeData\n onClose: () => void\n open: boolean\n}): ReactElement | null {\n const dialogRef = useRef<HTMLDivElement>(null)\n useDialogFocus(open, dialogRef, onClose)\n if (!open) return null\n return (\n <div className=\"documentation-modal-layer\" role=\"presentation\" onMouseDown={(event) => {\n if (event.currentTarget === event.target) onClose()\n }}>\n <div className=\"documentation-mobile-nav\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Documentation navigation\" ref={dialogRef}>\n <header>\n <a\n aria-label={`${documentationSubject(data.config.name)} home`}\n className=\"documentation-brand\"\n href={data.config.theme.logoHref ?? documentationPublicPath(data.basePath, '/')}\n {...externalProps(data.config.theme.logoHref ?? documentationPublicPath(data.basePath, '/'))}\n >\n <BrandLogo data={data} />\n </a>\n <button className=\"documentation-icon-button\" type=\"button\" onClick={onClose} aria-label=\"Close documentation navigation\" data-autofocus><CloseIcon /></button>\n </header>\n <nav className=\"documentation-page-tree\"><NavigationTree activeRoute={data.page.route} basePath={data.basePath} nodes={data.navigation} /></nav>\n <footer>\n {!data.config.theme.strictMode && <ThemeControls defaultMode={data.config.theme.defaultMode ?? 'system'} />}\n {data.config.footer.map((link) => <a key={`${link.label}:${link.href}`} href={link.href} {...externalProps(link.href)}>{link.label}</a>)}\n </footer>\n </div>\n </div>\n )\n}\n\nfunction ThemeControls({ defaultMode }: { defaultMode: ThemeMode }): ReactElement {\n const [mode, setMode] = useState<ThemeMode>(defaultMode)\n useEffect(() => {\n const saved = safeStorageGet('deepspace-documentation-theme') as ThemeMode | null\n if (saved === 'light' || saved === 'dark' || saved === 'system') setMode(saved)\n }, [])\n useEffect(() => applyThemeMode(mode), [mode])\n const choose = (next: ThemeMode): void => {\n setMode(next)\n safeStorageSet('deepspace-documentation-theme', next)\n }\n return (\n <div className=\"documentation-theme-controls\" role=\"group\" aria-label=\"Theme preference\">\n <button aria-pressed={mode === 'system'} aria-label=\"Use system theme\" onClick={() => choose('system')} type=\"button\"><SystemIcon /></button>\n <button aria-pressed={mode === 'light'} aria-label=\"Use light theme\" onClick={() => choose('light')} type=\"button\"><SunIcon /></button>\n <button aria-pressed={mode === 'dark'} aria-label=\"Use dark theme\" onClick={() => choose('dark')} type=\"button\"><MoonIcon /></button>\n </div>\n )\n}\n\nfunction containsRoute(node: Extract<DocumentationNavigationNode, { kind: 'group' }>, route: string): boolean {\n return node.items.some((item) => item.kind === 'page'\n ? item.route === route\n : item.kind === 'group' && containsRoute(item, route))\n}\n\nfunction applyThemeMode(mode: ThemeMode): () => void {\n const media = window.matchMedia('(prefers-color-scheme: dark)')\n const apply = (): void => {\n document.documentElement.dataset.themeMode = mode\n document.documentElement.dataset.theme = mode === 'system' ? (media.matches ? 'dark' : 'light') : mode\n }\n apply()\n media.addEventListener?.('change', apply)\n return () => media.removeEventListener?.('change', apply)\n}\n","{\n \"name\": \"deepspace\",\n \"version\": \"0.32.1\",\n \"engines\": {\n \"node\": \">=22.15.0 <23 || >=24 <25 || >=26 <27\"\n },\n \"description\": \"DeepSpace SDK — build real-time collaborative apps on Cloudflare Workers\",\n \"type\": \"module\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"deepspace\": \"dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./schema\": {\n \"types\": \"./dist/schema.d.ts\",\n \"import\": \"./dist/schema.js\"\n },\n \"./worker\": {\n \"types\": \"./dist/worker.d.ts\",\n \"import\": \"./dist/worker.js\"\n },\n \"./server\": {\n \"types\": \"./dist/server.d.ts\",\n \"import\": \"./dist/server.js\"\n },\n \"./testing\": {\n \"types\": \"./dist/testing.d.ts\",\n \"import\": \"./dist/testing.js\"\n },\n \"./testing/mcp\": {\n \"types\": \"./dist/testing-mcp.d.ts\",\n \"import\": \"./dist/testing-mcp.js\"\n },\n \"./build\": {\n \"types\": \"./dist/build.d.ts\",\n \"import\": \"./dist/build.js\"\n },\n \"./documentation\": {\n \"types\": \"./dist/documentation.d.ts\",\n \"import\": \"./dist/documentation.js\"\n },\n \"./documentation/react\": {\n \"types\": \"./dist/documentation-react.d.ts\",\n \"import\": \"./dist/documentation-react.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"features\",\n \"CHANGELOG.md\"\n ],\n \"scripts\": {\n \"build\": \"node ../../scripts/clean-artifacts.mjs dist --tsbuildinfo && tsup\",\n \"type-check\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"test:documentation-browser\": \"playwright test --config src/documentation/runtime/__browser__/playwright.config.ts\",\n \"clean\": \"node ../../scripts/clean-artifacts.mjs dist --tsbuildinfo\",\n \"prepublishOnly\": \"pnpm build\"\n },\n \"dependencies\": {\n \"@ai-sdk/anthropic\": \"2.0.91\",\n \"@ai-sdk/openai\": \"2.0.116\",\n \"@ai-sdk/openai-compatible\": \"1.0.46\",\n \"@clack/prompts\": \"^1.2.0\",\n \"@mdx-js/mdx\": \"^3.1.1\",\n \"acorn\": \"^8.16.0\",\n \"ai\": \"5.0.222\",\n \"better-auth\": \"1.6.23\",\n \"citty\": \"^0.2.0\",\n \"cross-spawn\": \"^7.0.6\",\n \"esbuild\": \"^0.27.0\",\n \"highlight.js\": \"^11.11.1\",\n \"hono\": \"^4.12.34\",\n \"jose\": \"^6.1.0\",\n \"marked\": \"^18.0.7\",\n \"mdast-util-gfm\": \"^3.1.0\",\n \"mdast-util-to-markdown\": \"^2.1.2\",\n \"rehype-highlight\": \"^7.0.2\",\n \"remark-frontmatter\": \"^5.0.0\",\n \"remark-gfm\": \"^4.0.1\",\n \"sanitize-html\": \"^2.17.7\",\n \"smol-toml\": \"^1.6.1\",\n \"yaml\": \"^2.9.0\",\n \"yjs\": \"^13.6.0\",\n \"zod\": \"^4.3.6\"\n },\n \"peerDependencies\": {\n \"@playwright/test\": \">=1.40.0\",\n \"clsx\": \">=2.0.0\",\n \"lucide-react\": \">=0.400.0\",\n \"react\": \"^18.0.0 || ^19.0.0\",\n \"react-dom\": \"^18.0.0 || ^19.0.0\",\n \"tailwind-merge\": \">=2.0.0\"\n },\n \"peerDependenciesMeta\": {\n \"@playwright/test\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"react-dom\": {\n \"optional\": true\n },\n \"clsx\": {\n \"optional\": true\n },\n \"tailwind-merge\": {\n \"optional\": true\n },\n \"lucide-react\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@cloudflare/workers-types\": \"^4.20241205.0\",\n \"@playwright/test\": \"^1.59.1\",\n \"@types/better-sqlite3\": \"^7.6.12\",\n \"@types/cross-spawn\": \"^6.0.6\",\n \"@types/react\": \"^19.0.0\",\n \"@types/react-dom\": \"^19.0.0\",\n \"@types/sanitize-html\": \"^2.16.1\",\n \"better-sqlite3\": \"^12.0.0\",\n \"clsx\": \"^2.1.1\",\n \"framer-motion\": \"^12.38.0\",\n \"jsdom\": \"^29.1.1\",\n \"lucide-react\": \"^1.7.0\",\n \"react-router-dom\": \"^7.1.0\",\n \"tailwind-merge\": \"^3.5.0\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.7.0\",\n \"vitest\": \"^4.1.0\"\n },\n \"keywords\": [\n \"deepspace\",\n \"cloudflare-workers\",\n \"durable-objects\",\n \"real-time\",\n \"collaborative\",\n \"sdk\"\n ],\n \"license\": \"Apache-2.0\",\n \"homepage\": \"https://deep.space\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/deepdotspace/deepspace.git\",\n \"directory\": \"packages/deepspace\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/deepdotspace/deepspace/issues\"\n }\n}\n","import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react'\nimport type { DocumentationHeading, DocumentationSearchEntry } from '../types'\nimport { documentationPublicPath } from '../routing'\nimport { documentationSubject } from '../text'\nimport { useDialogFocus } from './dialog'\nimport { ChevronRightIcon, FileIcon, HashIcon, OrbitMark, SearchIcon, SparkIcon } from './icons'\n\nexport function SearchCommand({\n assistantEnabled,\n basePath,\n name,\n onAssistantOpen,\n onClose,\n onNavigate,\n open,\n}: {\n assistantEnabled: boolean\n basePath: string\n name: string\n onAssistantOpen: (seed?: string) => void\n onClose: () => void\n onNavigate?: (href: string) => void\n open: boolean\n}): ReactElement | null {\n const dialogRef = useRef<HTMLDivElement>(null)\n const resultsRef = useRef<HTMLDivElement>(null)\n const [index, setIndex] = useState<DocumentationSearchEntry[] | null>(null)\n const [loading, setLoading] = useState(false)\n const [query, setQuery] = useState('')\n const [activeIndex, setActiveIndex] = useState(0)\n useDialogFocus(open, dialogRef, onClose)\n useEffect(() => {\n if (!open || index || loading) return\n setLoading(true)\n fetch(documentationPublicPath(basePath, '/search.json'))\n .then((response) => response.ok ? response.json() as Promise<DocumentationSearchEntry[]> : [])\n .then(setIndex)\n .catch(() => setIndex([]))\n .finally(() => setLoading(false))\n }, [basePath, index, loading, open])\n useEffect(() => {\n if (!open) {\n setQuery('')\n setActiveIndex(0)\n }\n }, [open])\n // Arrowing past the visible rows must bring the highlighted one into view.\n useEffect(() => {\n resultsRef.current\n ?.querySelector(`#documentation-search-option-${activeIndex}`)\n ?.scrollIntoView({ block: 'nearest' })\n }, [activeIndex, query])\n const preparedIndex = useMemo(() => prepareSearchIndex(index ?? []), [index])\n const results = useMemo(() => rankSearch(preparedIndex, query), [preparedIndex, query])\n if (!open) return null\n const selectableCount = results.length + (assistantEnabled && query.trim() ? 1 : 0)\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>): void => {\n if (event.key === 'ArrowDown' && selectableCount > 0) {\n event.preventDefault()\n setActiveIndex((current) => (current + 1) % selectableCount)\n } else if (event.key === 'ArrowUp' && selectableCount > 0) {\n event.preventDefault()\n setActiveIndex((current) => (current - 1 + selectableCount) % selectableCount)\n } else if (event.key === 'Enter') {\n event.preventDefault()\n const result = activeIndex < results.length ? results[activeIndex] : undefined\n if (result) {\n onClose()\n const href = documentationPublicPath(basePath, result.href)\n if (onNavigate) onNavigate(href)\n else window.location.assign(href)\n } else if (assistantEnabled && query.trim()) {\n onAssistantOpen(query.trim())\n }\n }\n }\n return (\n <div className=\"documentation-modal-layer documentation-search-layer\" role=\"presentation\" onMouseDown={(event) => {\n if (event.currentTarget === event.target) onClose()\n }}>\n <div className=\"documentation-search-dialog\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Search documentation\" ref={dialogRef}>\n <label className=\"documentation-search-input\">\n <SearchIcon />\n <input\n aria-activedescendant={selectableCount > 0 ? `documentation-search-option-${activeIndex}` : undefined}\n aria-controls=\"documentation-search-results\"\n aria-expanded=\"true\"\n aria-label={`Search ${documentationSubject(name)}`}\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n data-autofocus\n enterKeyHint=\"go\"\n onChange={(event) => { setQuery(event.target.value); setActiveIndex(0) }}\n onKeyDown={handleKeyDown}\n placeholder={`Search ${name}`}\n role=\"combobox\"\n spellCheck={false}\n value={query}\n />\n <kbd>Esc</kbd>\n </label>\n <div className=\"documentation-search-results\" id=\"documentation-search-results\" ref={resultsRef} role=\"listbox\" aria-label=\"Search results\">\n {!query.trim() && (\n <div className=\"documentation-search-empty\"><OrbitMark /><strong>Find an answer in these docs</strong><span>Search pages, headings, APIs, and examples.</span></div>\n )}\n {query.trim() && loading && <div className=\"documentation-search-state\">Searching this documentation…</div>}\n {query.trim() && !loading && results.length === 0 && <div className=\"documentation-search-state\">No documentation matched “{query.trim()}”.</div>}\n {results.map((result, resultIndex) => (\n <a\n aria-selected={activeIndex === resultIndex}\n className={activeIndex === resultIndex ? 'documentation-search-result is-active' : 'documentation-search-result'}\n href={documentationPublicPath(basePath, result.href)}\n id={`documentation-search-option-${resultIndex}`}\n key={result.href}\n onClick={onClose}\n onMouseEnter={() => setActiveIndex(resultIndex)}\n role=\"option\"\n >\n <span className=\"documentation-search-kind\">{result.kind === 'section' ? <HashIcon /> : <FileIcon />}</span>\n <span className=\"documentation-search-copy\">\n <strong>{highlightMatch(result.title, query)}</strong>\n {result.kind === 'section'\n ? <span className=\"documentation-search-crumbs\">{result.context}<ChevronRightIcon />{result.title}</span>\n : <small>{result.context}</small>}\n </span>\n <ChevronRightIcon />\n </a>\n ))}\n {assistantEnabled && query.trim() && (\n <button\n aria-selected={activeIndex === results.length}\n className={activeIndex === results.length ? 'documentation-search-assistant is-active' : 'documentation-search-assistant'}\n id={`documentation-search-option-${results.length}`}\n onClick={() => onAssistantOpen(query.trim())}\n onMouseEnter={() => setActiveIndex(results.length)}\n role=\"option\"\n type=\"button\"\n ><SparkIcon /><span><strong>Ask DeepSpace</strong><small>Answer from the current documentation with citations</small></span><ChevronRightIcon /></button>\n )}\n </div>\n <footer><span><kbd>↑</kbd><kbd>↓</kbd> select</span><span><kbd>↵</kbd> open</span><span><kbd>esc</kbd> close</span></footer>\n </div>\n </div>\n )\n}\n\nexport interface DocumentationSearchResult {\n /** Route with the section anchor already applied, and the list key. */\n href: string\n kind: 'page' | 'section'\n title: string\n /** Second line: the page description, or the owning page for a section. */\n context: string\n}\n\ninterface PreparedSearchHeading {\n heading: DocumentationHeading\n normalized: string\n}\n\ninterface PreparedSearchEntry {\n entry: DocumentationSearchEntry\n title: string\n headings: PreparedSearchHeading[]\n headingText: string\n haystack: string\n}\n\nfunction prepareSearchIndex(index: DocumentationSearchEntry[]): PreparedSearchEntry[] {\n return index.map((entry) => ({\n entry,\n title: normalizeSearch(entry.title),\n headings: entry.headings.map((heading) => ({ heading, normalized: normalizeSearch(heading.text) })),\n headingText: normalizeSearch(entry.headings.map((heading) => heading.text).join(' ')),\n haystack: normalizeSearch(`${entry.description ?? ''} ${entry.text}`),\n }))\n}\n\nfunction rankSearch(index: PreparedSearchEntry[], query: string): DocumentationSearchResult[] {\n const normalized = normalizeSearch(query)\n if (!normalized) return []\n const tokens = normalized.split(' ').filter(Boolean)\n const scored: Array<{ result: DocumentationSearchResult; score: number; route: string }> = []\n for (const { entry, title, headings, headingText, haystack } of index) {\n let score = title === normalized ? 180 : title.startsWith(normalized) ? 110 : title.includes(normalized) ? 75 : 0\n if (headingText.includes(normalized)) score += 55\n for (const token of tokens) {\n if (title.includes(token)) score += 24\n else if (headingText.includes(token)) score += 14\n else if (haystack.includes(token)) score += 5\n else score -= 18\n }\n if (score > 0) {\n scored.push({\n route: entry.route,\n score,\n result: {\n href: entry.route,\n kind: 'page',\n title: entry.title,\n context: entry.description ?? entry.text.slice(0, 150),\n },\n })\n }\n for (const { heading, normalized: headingNormalized } of headings) {\n // Deliberately below an exact page-title hit so pages still lead.\n let sectionScore = headingNormalized === normalized\n ? 120\n : headingNormalized.startsWith(normalized) ? 80 : headingNormalized.includes(normalized) ? 60 : 0\n if (sectionScore === 0) {\n for (const token of tokens) if (headingNormalized.includes(token)) sectionScore += 18\n }\n if (sectionScore <= 0) continue\n scored.push({\n route: `${entry.route}#${heading.id}`,\n score: sectionScore,\n result: {\n href: `${entry.route}#${heading.id}`,\n kind: 'section',\n title: heading.text,\n context: entry.title,\n },\n })\n }\n }\n return scored\n .sort((left, right) => right.score - left.score || left.route.localeCompare(right.route))\n .slice(0, 10)\n .map((item) => item.result)\n}\n\nfunction highlightMatch(value: string, query: string): ReactNode {\n const normalizedQuery = query.trim()\n if (!normalizedQuery) return value\n const index = value.toLowerCase().indexOf(normalizedQuery.toLowerCase())\n if (index < 0) return value\n return <>{value.slice(0, index)}<mark>{value.slice(index, index + normalizedQuery.length)}</mark>{value.slice(index + normalizedQuery.length)}</>\n}\n\nfunction normalizeSearch(value: string): string {\n return value.normalize('NFKD').replace(/[\\u0300-\\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim()\n}\n","import type { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'\nimport { Children, createElement, isValidElement } from 'react'\nimport { CodeBlock, CodeGroupProvider, TabGroup, type TabGroupPanel } from './code-block'\n\ninterface TitledProps {\n children?: ReactNode\n label?: string\n title?: string\n}\n\nfunction Callout({ children, title, kind }: TitledProps & { kind: string }): ReactElement {\n const label = title ?? kind.charAt(0).toUpperCase() + kind.slice(1)\n return <aside className={`documentation-callout documentation-callout-${kind}`}><strong>{label}</strong>{children}</aside>\n}\n\nexport function Note(props: TitledProps): ReactElement {\n return <Callout {...props} kind=\"note\" />\n}\n\nexport function Tip(props: TitledProps): ReactElement {\n return <Callout {...props} kind=\"tip\" />\n}\n\nexport function Warning(props: TitledProps): ReactElement {\n return <Callout {...props} kind=\"warning\" />\n}\n\nexport function Info(props: TitledProps): ReactElement {\n return <Callout {...props} kind=\"info\" />\n}\n\nexport function Card({ children, href, label, title }: TitledProps & { href?: string }): ReactElement {\n const content = <>{title ?? label ? <strong>{title ?? label}</strong> : null}{children}</>\n return href\n ? <a className=\"documentation-card\" href={href}>{content}<span aria-hidden=\"true\">→</span></a>\n : <div className=\"documentation-card\">{content}</div>\n}\n\nexport function Accordion({ children, label, title }: TitledProps): ReactElement {\n return <details className=\"documentation-accordion\"><summary>{title ?? label ?? 'Details'}</summary>{children}</details>\n}\n\nexport function AccordionGroup({ children }: TitledProps): ReactElement {\n return <div className=\"documentation-accordion-group\">{children}</div>\n}\n\nexport function Step({ children, label, title }: TitledProps): ReactElement {\n return <section className=\"documentation-step\">{title ?? label ? <h3>{title ?? label}</h3> : null}{children}</section>\n}\n\nexport function Steps({ children }: TitledProps): ReactElement {\n return <div className=\"documentation-steps\">{children}</div>\n}\n\nexport function Tab({ children, label, title }: TitledProps): ReactElement {\n return <section className=\"documentation-tab\" data-tab data-tab-title={title ?? label ?? 'Tab'}>{children}</section>\n}\n\nexport function Tabs({ children }: TitledProps): ReactElement {\n return <TabGroup className=\"documentation-tabs\" panels={tabPanels(children)} />\n}\n\nexport function CodeGroup({ children, label, title }: TitledProps): ReactElement {\n const panels = Children.toArray(children).map((child, index) => ({\n label: codeBlockTitle(child) ?? `Example ${index + 1}`,\n content: child,\n }))\n return (\n <CodeGroupProvider value={true}>\n <TabGroup\n className=\"documentation-code-group\"\n panels={panels}\n title={title ?? label\n ? <div className=\"documentation-code-group-title\">{title ?? label}</div>\n : undefined}\n />\n </CodeGroupProvider>\n )\n}\n\n/** Read `Tab` labels and bodies so the group renders its own tablist. A child\n * that is not a `Tab` still becomes a panel, keyed by position. */\nfunction tabPanels(children: ReactNode): TabGroupPanel[] {\n return Children.toArray(children).map((child, index) => {\n const props = isValidElement<TitledProps>(child) ? child.props : undefined\n return {\n label: props?.title ?? props?.label ?? `Tab ${index + 1}`,\n content: props && 'children' in props ? props.children : child,\n }\n })\n}\n\nfunction codeBlockTitle(node: ReactNode): string | undefined {\n if (!isValidElement<{ children?: ReactNode }>(node)) return undefined\n const code = node.props.children\n if (!isValidElement<Record<string, unknown>>(code)) return undefined\n const title = code.props['data-code-title']\n return typeof title === 'string' && title ? title : undefined\n}\n\nfunction Heading({ level, ...props }: ComponentPropsWithoutRef<'h2'> & { level: number }): ReactElement {\n const id = props.id\n return createElement(\n `h${level}`,\n props,\n props.children,\n id ? <a aria-label=\"Link to this section\" className=\"documentation-heading-anchor\" href={`#${id}`}>#</a> : null,\n )\n}\n\nexport const documentationMdxComponents = {\n /** React renders the code-block wrapper so nothing has to move a `pre` that\n * the reconciler already owns. */\n pre: CodeBlock,\n Accordion,\n AccordionGroup,\n Card,\n CodeGroup,\n Info,\n Note,\n Step,\n Steps,\n Tab,\n Tabs,\n Tip,\n Warning,\n h1: (props: ComponentPropsWithoutRef<'h1'>) => <Heading {...props} level={1} />,\n h2: (props: ComponentPropsWithoutRef<'h2'>) => <Heading {...props} level={2} />,\n h3: (props: ComponentPropsWithoutRef<'h3'>) => <Heading {...props} level={3} />,\n h4: (props: ComponentPropsWithoutRef<'h4'>) => <Heading {...props} level={4} />,\n h5: (props: ComponentPropsWithoutRef<'h5'>) => <Heading {...props} level={5} />,\n h6: (props: ComponentPropsWithoutRef<'h6'>) => <Heading {...props} level={6} />,\n}\n","import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport type { DocumentationRuntimeData } from '../types'\nimport { DocumentationApp, type DocumentationAppProps } from './app'\nimport { documentationMdxComponents } from './mdx-components'\n\nexport type DocumentationPageComponent = ComponentType<{ components?: Record<string, ComponentType<never>> }>\n\nexport interface DocumentationSiteProps extends DocumentationAppProps {\n /** The current compiled Markdown or MDX page. */\n children: ReactNode\n}\n\nexport type DocumentationSiteComponent = ComponentType<DocumentationSiteProps>\n\n/** The polished SDK-owned documentation shell. */\nexport const DefaultDocumentation = DocumentationApp\n\n/**\n * The prose subtree has exactly one writer, and `data-prose` names it. `react`\n * means the reconciler owns every node inside and only React components may\n * enhance it; `html` means the compiler's markup owns it and the article's\n * imperative pass may enhance it. Nothing may write across that line — moving a\n * React-owned node out from under its fiber makes the next route swap fail with\n * `removeChild ... not a child of this node`.\n */\nexport function DocumentationContent({\n data,\n Page,\n}: {\n data: DocumentationRuntimeData\n Page?: DocumentationPageComponent\n}): ReactElement {\n if (!Page) {\n return (\n <div\n className=\"documentation-prose\"\n data-prose=\"html\"\n dangerouslySetInnerHTML={{ __html: data.page.html }}\n />\n )\n }\n return (\n <div className=\"documentation-prose\" data-prose=\"react\">\n <Page components={documentationMdxComponents as never} />\n </div>\n )\n}\n\nexport { DocumentationApp }\nexport type { DocumentationAppProps }\nexport {\n Accordion,\n AccordionGroup,\n Card,\n CodeGroup,\n Info,\n Note,\n Step,\n Steps,\n Tab,\n Tabs,\n Tip,\n Warning,\n} from './mdx-components'\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EACA,aAAAA;AAAA,EACA,YAAAC;AAAA,OACK;;;ACRP;AAAA,EACE,aAAAC;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,OAIK;AACP,SAAS,oBAAoB;;;ACmUtB,IAAM,qBAAN,cAAiC,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EAET,YAAY,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,QAAK,YAAY,4BAAqC,GACzD;AAEJ;","names":["useEffect","useState","useEffect","useRef","useState","jsx","jsxs","useEffect","useRef","useState","Fragment","jsx","jsxs","useState","useRef","useEffect","label","Fragment","jsx","jsxs","useRef","useState","useEffect","useEffect","useRef","useState","useEffect","jsx","jsxs","useRef","useState","useEffect","useEffect","useRef","useState","Fragment","jsx","jsxs","active","useRef","useState","useEffect","useEffect","useMemo","useRef","useState","Fragment","jsx","jsxs","useRef","useState","useEffect","useMemo","jsx","jsxs","useState","useEffect","Fragment","jsx","jsxs","jsx"]}
package/dist/cli.js CHANGED
@@ -2488,7 +2488,15 @@ async function resolveAppIdByName(deployUrl, token, name) {
2488
2488
  function repoApi(deployUrl, token, appId) {
2489
2489
  const base = `/api/repo/${encodeURIComponent(appId)}`;
2490
2490
  const call = async (path, init) => {
2491
- return await apiFetch(deployUrl, token, `${base}${path}`, init);
2491
+ try {
2492
+ return await apiFetch(deployUrl, token, `${base}${path}`, init);
2493
+ } catch (err) {
2494
+ if (err instanceof ApiError && err.code === "source_managed_by_github") {
2495
+ const repository = err.details?.repository;
2496
+ if (typeof repository === "string") throw githubSourceRefusal(appId, repository);
2497
+ }
2498
+ throw err;
2499
+ }
2492
2500
  };
2493
2501
  const post = (path, body) => call(path, { method: "POST", body: JSON.stringify(body) });
2494
2502
  const KIND = {
@@ -2529,10 +2537,6 @@ function repoApi(deployUrl, token, appId) {
2529
2537
  return await getShape("/refs", { refs: "array", head: "present" });
2530
2538
  } catch (err) {
2531
2539
  if (err instanceof ApiError && err.code === "app_not_found") return null;
2532
- if (err instanceof ApiError && err.code === "source_managed_by_github") {
2533
- const repository = err.details?.repository;
2534
- if (typeof repository === "string") throw githubSourceRefusal(appId, repository);
2535
- }
2536
2540
  throw err;
2537
2541
  }
2538
2542
  },
@@ -13749,7 +13753,6 @@ Re-run with --allow-do-deletion to accept the data loss.`,
13749
13753
  newReleaseId: result.releaseId ?? null,
13750
13754
  bundleRetained: result.bundleRetained ?? null,
13751
13755
  url: result.url ?? null,
13752
- versionId: result.versionId ?? null,
13753
13756
  wranglerEnv: wranglerEnv ?? null,
13754
13757
  // Always present, matching `deploy`: one field to branch on.
13755
13758
  serving,
@@ -15873,12 +15876,12 @@ var git_credential_default = defineCommand14({
15873
15876
  var source_default = defineDeepspaceCommand({
15874
15877
  meta: {
15875
15878
  name: "source",
15876
- description: "Show the app\u2019s source authority (inferred from use, never declared)"
15879
+ description: "Show the app\u2019s permanent source authority (latched on first source use)"
15877
15880
  },
15878
15881
  args: {
15879
15882
  provider: {
15880
15883
  type: "positional",
15881
- description: "No longer accepted \u2014 source is inferred, not declared",
15884
+ description: "No longer accepted \u2014 source latches on first use, not by declaration",
15882
15885
  required: false
15883
15886
  },
15884
15887
  app: {
@@ -15891,7 +15894,7 @@ var source_default = defineDeepspaceCommand({
15891
15894
  async run({ args }) {
15892
15895
  if (typeof args.provider === "string" && args.provider.trim()) {
15893
15896
  throw new Refusal(
15894
- "Source is no longer declared \u2014 it latches at the app's first release, permanently: a first deploy from a checkout with a GitHub remote fixes GitHub source, and a first `deepspace push` (or a first deploy without one) fixes DeepSpace source. This command only reports.",
15897
+ "Source is no longer declared \u2014 it latches at the app's first source use, permanently: a first deploy from a checkout with a GitHub remote fixes GitHub source, and a first `deepspace push` (or a first deploy without one) fixes DeepSpace source. This command only reports.",
15895
15898
  "source_inferred"
15896
15899
  );
15897
15900
  }
@@ -15901,7 +15904,9 @@ var source_default = defineDeepspaceCommand({
15901
15904
  if (appDir && !readAppId(appDir)) {
15902
15905
  if (!args.json) {
15903
15906
  console.log("App: not registered yet \u2014 it registers on first use (deploy, secrets, dev\u2026)");
15904
- console.log("Source: unclaimed \u2014 a checkout with a GitHub remote deploys as GitHub; the first `deepspace push` claims DeepSpace source permanently.");
15907
+ console.log(
15908
+ "Source: unclaimed \u2014 first source use latches permanently: a deploy with a GitHub remote claims GitHub; a first push or deploy without one claims DeepSpace."
15909
+ );
15905
15910
  }
15906
15911
  return { data: { appId: null, source: null, revision: 0, registered: false } };
15907
15912
  }
@@ -15930,7 +15935,7 @@ function reportSource(appId, state, json) {
15930
15935
  console.log("Source: DeepSpace");
15931
15936
  } else {
15932
15937
  console.log(
15933
- "Source: unclaimed \u2014 a checkout with a GitHub remote deploys as GitHub; the first `deepspace push` claims DeepSpace source permanently."
15938
+ "Source: unclaimed \u2014 first source use latches permanently: a deploy with a GitHub remote claims GitHub; a first push or deploy without one claims DeepSpace."
15934
15939
  );
15935
15940
  }
15936
15941
  console.log(`Revision: ${state.revision}`);
@@ -15945,7 +15950,7 @@ import { join as join28, resolve as resolve22 } from "path";
15945
15950
  // package.json
15946
15951
  var package_default = {
15947
15952
  name: "deepspace",
15948
- version: "0.31.2",
15953
+ version: "0.32.1",
15949
15954
  engines: {
15950
15955
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
15951
15956
  },
@@ -16029,7 +16034,7 @@ var package_default = {
16029
16034
  "rehype-highlight": "^7.0.2",
16030
16035
  "remark-frontmatter": "^5.0.0",
16031
16036
  "remark-gfm": "^4.0.1",
16032
- "sanitize-html": "^2.17.6",
16037
+ "sanitize-html": "^2.17.7",
16033
16038
  "smol-toml": "^1.6.1",
16034
16039
  yaml: "^2.9.0",
16035
16040
  yjs: "^13.6.0",