Merge remote-tracking branch 'origin/master' into feat/plugin-owned-settings-surface
# Conflicts: # packages/client/ui-input-trigger/README.i18n.yaml # packages/client/ui-settings-plugins/src/client/ConfigurablePluginsTab.tsx # packages/client/ui-settings-plugins/src/client/index.ts # packages/client/ui-settings-plugins/src/client/tab-store.ts # packages/client/ui-settings-plugins/tests/apply.client.spec.ts # packages/client/ui-settings-plugins/tests/section.client.spec.tsx # packages/client/ui-settings-plugins/tests/stores.client.spec.ts # packages/host/apiproxy/src/api-proxy.ts # packages/host/apiproxy/tests/api-proxy-config.spec.ts
This commit is contained in:
@@ -5,7 +5,7 @@ import { resolve } from 'node:path'
|
||||
import type { DefaultTheme, PageData } from 'vitepress'
|
||||
import type { ViteDevServer } from 'vite'
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid'
|
||||
import { landingLink, orderedPages, routeLink, sectionSpec, type DocsLocale, type DocsPage } from '../docs.ts'
|
||||
import { landingLink, orderedPages, routeLink, sectionSpec, type DocsLocale, type DocsPage, type DocsSidebar } from '../docs.ts'
|
||||
import { docsSourceFiles, projectDocs } from '../../scripts/project-doc-site.ts'
|
||||
|
||||
projectDocs()
|
||||
@@ -31,6 +31,77 @@ function sidebar(locale: DocsLocale, collection: NonNullable<DocsPage['sidebar']
|
||||
})
|
||||
}
|
||||
|
||||
/** One module link shared between the navigation bar and the guide sidebar. */
|
||||
interface GuideModuleLink {
|
||||
/** Label shown in the navigation bar and the guide sidebar. */
|
||||
label: string
|
||||
/** Sidebar collection the link opens. */
|
||||
collection: DocsSidebar
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-locale guide-module facts: the guide collection and the module links
|
||||
* appended to the guide sidebar.
|
||||
*/
|
||||
interface GuideModules {
|
||||
/** Guide sidebar collection for the locale. */
|
||||
guide: 'zh-guide' | 'en-guide'
|
||||
/** Development module link. */
|
||||
develop: GuideModuleLink
|
||||
/** Reference module link. */
|
||||
reference: GuideModuleLink
|
||||
}
|
||||
|
||||
/**
|
||||
* Guide-module facts keyed by locale, giving every module label and collection
|
||||
* one home shared by the navigation bar and the guide sidebar.
|
||||
*/
|
||||
const guideModules = {
|
||||
root: {
|
||||
guide: 'zh-guide',
|
||||
develop: { label: '开发', collection: 'zh-develop' },
|
||||
reference: { label: '参考', collection: 'zh-reference' },
|
||||
},
|
||||
en: {
|
||||
guide: 'en-guide',
|
||||
develop: { label: 'Development', collection: 'en-develop' },
|
||||
reference: { label: 'Reference', collection: 'en-reference' },
|
||||
},
|
||||
} satisfies Record<DocsLocale, GuideModules>
|
||||
|
||||
/**
|
||||
* Guide sidebar with direct links into the first development and reference pages.
|
||||
*
|
||||
* @param locale - Route tree whose guide sidebar is being built.
|
||||
* @returns Guide groups followed by top-level links to the other documentation modules.
|
||||
*/
|
||||
function guideSidebar(locale: DocsLocale): DefaultTheme.SidebarItem[] {
|
||||
const { guide, develop, reference } = guideModules[locale]
|
||||
return [
|
||||
...sidebar(locale, guide),
|
||||
...[develop, reference].map(({ label, collection }) => ({
|
||||
text: label,
|
||||
link: landingLink(locale, collection),
|
||||
})),
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigation-bar items for the modules the guide sidebar links into, reading
|
||||
* their labels and collections from the shared per-locale record.
|
||||
*
|
||||
* @param locale - Route tree the navigation items belong to.
|
||||
* @returns The module items for the locale's navigation bar.
|
||||
*/
|
||||
function moduleNav(locale: DocsLocale): DefaultTheme.NavItem[] {
|
||||
const { develop, reference } = guideModules[locale]
|
||||
const routePrefix = locale === 'root' ? '' : '/en'
|
||||
return [
|
||||
{ text: develop.label, link: landingLink(locale, develop.collection), activeMatch: `^${routePrefix}/develop/` },
|
||||
{ text: reference.label, link: landingLink(locale, reference.collection), activeMatch: `^${routePrefix}/reference/` },
|
||||
]
|
||||
}
|
||||
|
||||
function watchCanonicalDocs(server: ViteDevServer): void {
|
||||
const sources = docsSourceFiles()
|
||||
server.watcher.add(sources)
|
||||
@@ -196,12 +267,11 @@ export default withMermaid({
|
||||
themeConfig: {
|
||||
siteTitle: siteTitle('技术预览'),
|
||||
nav: [
|
||||
{ text: '入门', link: landingLink('root', 'zh-guide'), activeMatch: '^/guide/' },
|
||||
{ text: '开发', link: landingLink('root', 'zh-develop'), activeMatch: '^/develop/' },
|
||||
{ text: '参考', link: landingLink('root', 'zh-reference'), activeMatch: '^/reference/' },
|
||||
{ text: '入门', link: landingLink('root', guideModules.root.guide), activeMatch: '^/guide/' },
|
||||
...moduleNav('root'),
|
||||
],
|
||||
sidebar: {
|
||||
'/guide/': sidebar('root', 'zh-guide'),
|
||||
'/guide/': guideSidebar('root'),
|
||||
'/develop/': sidebar('root', 'zh-develop'),
|
||||
'/reference/': sidebar('root', 'zh-reference'),
|
||||
},
|
||||
@@ -223,12 +293,11 @@ export default withMermaid({
|
||||
themeConfig: {
|
||||
siteTitle: siteTitle('Preview'),
|
||||
nav: [
|
||||
{ text: 'Guide', link: landingLink('en', 'en-guide'), activeMatch: '^/en/guide/' },
|
||||
{ text: 'Develop', link: landingLink('en', 'en-develop'), activeMatch: '^/en/develop/' },
|
||||
{ text: 'Reference', link: landingLink('en', 'en-reference'), activeMatch: '^/en/reference/' },
|
||||
{ text: 'Guide', link: landingLink('en', guideModules.en.guide), activeMatch: '^/en/guide/' },
|
||||
...moduleNav('en'),
|
||||
],
|
||||
sidebar: {
|
||||
'/en/guide/': sidebar('en', 'en-guide'),
|
||||
'/en/guide/': guideSidebar('en'),
|
||||
'/en/develop/': sidebar('en', 'en-develop'),
|
||||
'/en/reference/': sidebar('en', 'en-reference'),
|
||||
},
|
||||
|
||||
@@ -270,7 +270,7 @@ const subsystemGroups = [
|
||||
['session-projection.md', '会话投影', 'Session projections'],
|
||||
['persistence.md', '会话持久化', 'Session persistence'],
|
||||
['spill.md', 'Spill 存储', 'Spill storage'],
|
||||
['telemetry.md', '遥测', 'Telemetry'],
|
||||
['session-telemetry.md', '遥测', 'SessionTelemetryBackend'],
|
||||
]],
|
||||
['模型与上下文', 'Model and context', [
|
||||
['llm-streaming.md', 'LLM 流式响应', 'LLM streaming'],
|
||||
@@ -280,10 +280,10 @@ const subsystemGroups = [
|
||||
]],
|
||||
['执行与工具', 'Execution and tools', [
|
||||
['tools.md', '工具', 'Tools'],
|
||||
['bash.md', 'Bash 执行', 'Bash execution'],
|
||||
['shell.md', 'Bash 执行', 'Bash execution'],
|
||||
['subprocess.md', '子进程', 'Subprocesses'],
|
||||
['pty.md', 'PTY 会话', 'PTY sessions'],
|
||||
['tasks.md', '后台任务', 'Background tasks'],
|
||||
['terminal.md', 'PTY 会话', 'PTY sessions'],
|
||||
['jobs.md', '后台任务', 'Background jobs'],
|
||||
['filesystem.md', '文件系统', 'Filesystem'],
|
||||
['lsp.md', 'LSP 导航', 'LSP navigation'],
|
||||
['code-runtime.md', '代码运行时', 'Code runtime'],
|
||||
@@ -294,17 +294,17 @@ const subsystemGroups = [
|
||||
]],
|
||||
['策略与交互', 'Policy and interaction', [
|
||||
['approval.md', '审批', 'Approvals'],
|
||||
['permission.md', '权限预设', 'Permission presets'],
|
||||
['permission-presets.md', '权限预设', 'Permission presets'],
|
||||
['sandbox.md', '沙箱', 'Sandboxing'],
|
||||
['plan.md', '计划模式', 'Plan mode'],
|
||||
['user-interaction.md', '用户交互', 'User interaction'],
|
||||
['user-questions.md', '用户交互', 'User interaction'],
|
||||
['commands.md', '命令', 'Human commands'],
|
||||
['goal.md', '目标', 'Goals'],
|
||||
['schedule.md', '定时提醒', 'Scheduled reminders'],
|
||||
]],
|
||||
['平台与接入', 'Platform and access', [
|
||||
['http-server.md', 'HTTP 服务器', 'HTTP server'],
|
||||
['typert.md', 'TypeRT', 'TypeRT'],
|
||||
['web-server.md', 'HTTP 服务器', 'HTTP server'],
|
||||
['typert.md', 'Typert', 'Typert'],
|
||||
['client-modules.md', '客户端模块', 'Client modules'],
|
||||
['storage.md', '存储', 'Storage'],
|
||||
['workspace.md', '工作区', 'Workspaces'],
|
||||
|
||||
Reference in New Issue
Block a user