Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

feat(i18n): add zh-Hans to homepage components and fix checkpointing titles

xf gong09c1c543260c
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md
index 2164f23..f90950c 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md
@@ -1,5 +1,5 @@
---
-title: Postgres 检查点
+title: Postgres Checkpointing
description: "使用 PostgresCheckpointer 实现生产级的 agent 状态持久化。"
---
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/sqlite.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/sqlite.md
index bb8c3e0..6ba3154 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/sqlite.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/sqlite.md
@@ -1,5 +1,5 @@
---
-title: SQLite
+title: SQLite Checkpointing
description: "使用 SQLiteCheckpointer 实现轻量级单进程 agent 状态持久化。"
---
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/postgres.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/postgres.md
index 2164f23..f90950c 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/postgres.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/postgres.md
@@ -1,5 +1,5 @@
---
-title: Postgres 检查点
+title: Postgres Checkpointing
description: "使用 PostgresCheckpointer 实现生产级的 agent 状态持久化。"
---
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/sqlite.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/sqlite.md
index bb8c3e0..6ba3154 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/sqlite.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.6/guides/checkpointing/sqlite.md
@@ -1,5 +1,5 @@
---
-title: SQLite
+title: SQLite Checkpointing
description: "使用 SQLiteCheckpointer 实现轻量级单进程 agent 状态持久化。"
---
diff --git a/website/src/components/Home/FeatureGrid.tsx b/website/src/components/Home/FeatureGrid.tsx
index 809629e..9f984c2 100644
--- a/website/src/components/Home/FeatureGrid.tsx
+++ b/website/src/components/Home/FeatureGrid.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import Link from '@docusaurus/Link';
+import { useIsZhHans } from '@site/src/hooks/useIsZhHans';
import styles from './FeatureGrid.module.css';
type Icon = React.FC<React.SVGProps<SVGSVGElement>>;
@@ -53,18 +54,31 @@ const IconHitl: Icon = (p) => (
</svg>
);
-const CARDS = [
- { Icon: IconBox, title: 'Agents', body: 'One async loop, fully typed events.', href: '/docs/guides/agents/first-agent' },
- { Icon: IconStream, title: 'Streaming', body: 'async for event in stream.', href: '/docs/guides/agents/streaming' },
- { Icon: IconTool, title: 'Tools', body: 'Plain functions, parallel execution.', href: '/docs/guides/agents/tool-use' },
- { Icon: IconPlug, title: 'Providers', body: 'Anthropic, OpenAI, or write your own.', href: '/docs/guides/providers/anthropic' },
- { Icon: IconDisk, title: 'Checkpointing', body: 'Append-only, O(1) per turn.', href: '/docs/guides/checkpointing/sqlite' },
- { Icon: IconHitl, title: 'Human-in-the-loop', body: 'Pause for confirm, approve, or ask.', href: '/docs/guides/hitl/overview' },
- { Icon: IconMcp, title: 'MCP', body: 'Load remote tools at startup.', href: '/docs/guides/mcp/loading' },
- { Icon: IconTrace, title: 'Tracing', body: 'OpenTelemetry, OTLP / JSONL, GenAI semconv.', href: '/docs/guides/tracing/overview' },
+const CARDS_EN = [
+ { Icon: IconBox, title: 'Agents', body: 'One async loop, fully typed events.', href: '/docs/guides/agents/first-agent' },
+ { Icon: IconStream, title: 'Streaming', body: 'async for event in stream.', href: '/docs/guides/agents/streaming' },
+ { Icon: IconTool, title: 'Tools', body: 'Plain functions, parallel execution.', href: '/docs/guides/agents/tool-use' },
+ { Icon: IconPlug, title: 'Providers', body: 'Anthropic, OpenAI, or write your own.', href: '/docs/guides/providers/anthropic' },
+ { Icon: IconDisk, title: 'Checkpointing', body: 'Append-only, O(1) per turn.', href: '/docs/guides/checkpointing/sqlite' },
+ { Icon: IconHitl, title: 'Human-in-the-loop', body: 'Pause for confirm, approve, or ask.', href: '/docs/guides/hitl/overview' },
+ { Icon: IconMcp, title: 'MCP', body: 'Load remote tools at startup.', href: '/docs/guides/mcp/loading' },
+ { Icon: IconTrace, title: 'Tracing', body: 'OpenTelemetry, OTLP / JSONL, GenAI semconv.', href: '/docs/guides/tracing/overview' },
+];
+
+const CARDS_ZH = [
+ { Icon: IconBox, title: 'Agent', body: '一个 async 循环,完整类型化事件。', href: '/docs/guides/agents/first-agent' },
+ { Icon: IconStream, title: '流式输出', body: 'async for event in stream。', href: '/docs/guides/agents/streaming' },
+ { Icon: IconTool, title: '工具调用', body: '普通函数,并行执行。', href: '/docs/guides/agents/tool-use' },
+ { Icon: IconPlug, title: 'Provider', body: 'Anthropic、OpenAI,或自定义。', href: '/docs/guides/providers/anthropic' },
+ { Icon: IconDisk, title: 'Checkpointing', body: '追加式,每轮 O(1)。', href: '/docs/guides/checkpointing/sqlite' },
+ { Icon: IconHitl, title: '人机协同', body: '暂停等待确认、审批或问答。', href: '/docs/guides/hitl/overview' },
+ { Icon: IconMcp, title: 'MCP', body: '启动时加载远程工具。', href: '/docs/guides/mcp/loading' },
+ { Icon: IconTrace, title: 'Tracing', body: 'OpenTelemetry、OTLP / JSONL、GenAI semconv。', href: '/docs/guides/tracing/overview' },
];
export default function FeatureGrid() {
+ const zh = useIsZhHans();
+ const CARDS = zh ? CARDS_ZH : CARDS_EN;
return (
<section className={styles.section}>
<div className={styles.grid}>
@@ -73,7 +87,7 @@ export default function FeatureGrid() {
<c.Icon className={styles.icon} width={16} height={16} />
<h3 className={styles.title}>{c.title}</h3>
<p className={styles.body}>{c.body}</p>
- <span className={styles.more}>→ Guides / {c.title}</span>
+ <span className={styles.more}>→ {zh ? '指南 / ' : 'Guides / '}{c.title}</span>
</Link>
))}
</div>
diff --git a/website/src/components/Home/HelloAgent.tsx b/website/src/components/Home/HelloAgent.tsx
index 697347b..6a25a2d 100644
--- a/website/src/components/Home/HelloAgent.tsx
+++ b/website/src/components/Home/HelloAgent.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import Link from '@docusaurus/Link';
import CodeBlock from '@theme/CodeBlock';
+import { useIsZhHans } from '@site/src/hooks/useIsZhHans';
import styles from './HelloAgent.module.css';
const SAMPLE = `import asyncio
@@ -41,15 +42,20 @@ asyncio.run(agent.prompt("What's the weather in Tokyo?"))
`;
export default function HelloAgent() {
+ const zh = useIsZhHans();
return (
<section className={styles.section}>
<div className={styles.left}>
- <h2 className={styles.h2}>Hello, agent.</h2>
+ <h2 className={styles.h2}>{zh ? '你好,agent。' : 'Hello, agent.'}</h2>
<p className={styles.lede}>
- A single async function loop. One <code>Provider</code>, one <code>AgentTool</code>, and you're streaming.
+ {zh ? (
+ <>一个 async 函数循环。一个 <code>Provider</code>,一个 <code>AgentTool</code>,即可开始流式输出。</>
+ ) : (
+ <>A single async function loop. One <code>Provider</code>, one <code>AgentTool</code>, and you're streaming.</>
+ )}
</p>
<Link to="/docs/getting-started/quick-start" className={styles.link}>
- Full quick-start →
+ {zh ? '完整快速开始 →' : 'Full quick-start →'}
</Link>
</div>
<div className={styles.right}>
diff --git a/website/src/components/Home/Hero.tsx b/website/src/components/Home/Hero.tsx
index 7ab77c9..6e995f2 100644
--- a/website/src/components/Home/Hero.tsx
+++ b/website/src/components/Home/Hero.tsx
@@ -2,12 +2,14 @@ import React from 'react';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+import { useIsZhHans } from '@site/src/hooks/useIsZhHans';
import styles from './Hero.module.css';
export default function Hero() {
const social = useBaseUrl('/img/brand/cubepi-social-preview.png');
const installCmd = 'pip install cubepi';
const { siteConfig } = useDocusaurusContext();
+ const zh = useIsZhHans();
// Sourced from siteConfig.customFields.PACKAGE_VERSION (parsed from
// pyproject.toml at config-load time) so the eyebrow tracks the
// released version automatically.
@@ -25,13 +27,25 @@ export default function Hero() {
/>
<div className={styles.eyebrow}>cubepi · v{version} · alpha</div>
<h1 className={styles.h1}>CubePi</h1>
- <p className={styles.tagline}>A Pythonic, async-native agent framework.</p>
+ <p className={styles.tagline}>
+ {zh ? '一个 Pythonic 原生异步 Agent 框架。' : 'A Pythonic, async-native agent framework.'}
+ </p>
<p className={styles.lead}>
- CubePi is a Pythonic, async-native agent framework designed for high
- performance, readability, and production-grade persistence. It provides
- a leaner alternative to graph-based agent runtimes by modeling agent
- logic as a linear <code>while</code> loop that developers can easily
- trace and debug.
+ {zh ? (
+ <>
+ CubePi 是一个 Pythonic 原生异步 Agent 框架,专为高性能、高可读性和生产级持久化而设计。
+ 它以线性 <code>while</code> 循环建模 agent 逻辑,提供比图结构 agent 运行时更轻量的替代方案,
+ 开发者可以轻松追踪和调试。
+ </>
+ ) : (
+ <>
+ CubePi is a Pythonic, async-native agent framework designed for high
+ performance, readability, and production-grade persistence. It provides
+ a leaner alternative to graph-based agent runtimes by modeling agent
+ logic as a linear <code>while</code> loop that developers can easily
+ trace and debug.
+ </>
+ )}
</p>
<div className={styles.actions}>
<button
@@ -44,7 +58,7 @@ export default function Hero() {
<kbd className={styles.kbd}>⌘C</kbd>
</button>
<Link className={`${styles.cta} ${styles.ctaGhost}`} to="/docs/getting-started/quick-start">
- Quick Start →
+ {zh ? '快速开始 →' : 'Quick Start →'}
<kbd className={styles.kbd}>G Q</kbd>
</Link>
</div>
diff --git a/website/src/components/Home/InstallMatrix.tsx b/website/src/components/Home/InstallMatrix.tsx
index 9e8e11d..6c85371 100644
--- a/website/src/components/Home/InstallMatrix.tsx
+++ b/website/src/components/Home/InstallMatrix.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useIsZhHans } from '@site/src/hooks/useIsZhHans';
import styles from './InstallMatrix.module.css';
const ROWS: { tool: string; cmd: string }[] = [
@@ -9,9 +10,10 @@ const ROWS: { tool: string; cmd: string }[] = [
];
export default function InstallMatrix() {
+ const zh = useIsZhHans();
return (
<section className={styles.section}>
- <h2 className={styles.h2}>Install</h2>
+ <h2 className={styles.h2}>{zh ? '安装' : 'Install'}</h2>
<div className={styles.table}>
{ROWS.map((r) => (
<div key={r.tool} className={styles.row}>
@@ -22,7 +24,7 @@ export default function InstallMatrix() {
className={styles.copy}
onClick={() => navigator.clipboard?.writeText(r.cmd)}
aria-label={`Copy ${r.tool} command`}
- >Copy</button>
+ >{zh ? '复制' : 'Copy'}</button>
</div>
))}
</div>
diff --git a/website/src/components/Home/WhyTable.tsx b/website/src/components/Home/WhyTable.tsx
index 6827abb..e01959e 100644
--- a/website/src/components/Home/WhyTable.tsx
+++ b/website/src/components/Home/WhyTable.tsx
@@ -1,7 +1,8 @@
import React from 'react';
+import { useIsZhHans } from '@site/src/hooks/useIsZhHans';
import styles from './WhyTable.module.css';
-const ROWS: { label: string; langgraph: string; cubepi: string }[] = [
+const ROWS_EN: { label: string; langgraph: string; cubepi: string }[] = [
{ label: 'Abstraction', langgraph: 'Graph nodes + edges + channels', cubepi: 'Plain async functions — run_agent_loop is a while loop' },
{ label: 'Streaming', langgraph: 'Callback-based, multiple handler types', cubepi: 'async for event in stream — one pattern everywhere' },
{ label: 'Checkpointing', langgraph: 'Full snapshot per step; serializes entire message list', cubepi: 'Append-only — O(1) DB I/O regardless of conversation length' },
@@ -12,10 +13,25 @@ const ROWS: { label: string; langgraph: string; cubepi: string }[] = [
{ label: 'Observability', langgraph: 'LangSmith / Langfuse integration', cubepi: 'Native OpenTelemetry — Tracer, Meter, GenAI semconv, OTLP / JSONL out of the box' },
];
+const ROWS_ZH: { label: string; langgraph: string; cubepi: string }[] = [
+ { label: '抽象模型', langgraph: '图节点 + 边 + 通道', cubepi: '普通 async 函数 — run_agent_loop 就是一个 while 循环' },
+ { label: '流式输出', langgraph: '基于回调,多种 handler 类型', cubepi: 'async for event in stream — 统一模式' },
+ { label: 'Checkpointing', langgraph: '每步全量快照,序列化整个消息列表', cubepi: '追加式 — 无论对话多长,每轮 O(1) DB I/O' },
+ { label: '依赖项', langgraph: 'langchain-core、langgraph-sdk 及传递依赖', cubepi: '3 个核心依赖:pydantic、anthropic、openai' },
+ { label: '工具执行', langgraph: '工具是需要手动连线的图节点', cubepi: '声明为函数;框架自动路由并并行执行' },
+ { label: '多 Provider', langgraph: '通过 langchain chat model 适配器', cubepi: '原生 Provider 协议 — 内置 Anthropic、OpenAI' },
+ { label: 'Middleware', langgraph: '图级中间件,在节点进出时触发', cubepi: '7 种类型化 hook,声明式组合规则' },
+ { label: '可观测性', langgraph: 'LangSmith / Langfuse 集成', cubepi: '原生 OpenTelemetry — Tracer、Meter、GenAI semconv,开箱即用 OTLP / JSONL' },
+];
+
export default function WhyTable() {
+ const zh = useIsZhHans();
+ const ROWS = zh ? ROWS_ZH : ROWS_EN;
return (
<section className={styles.section}>
- <h2 className={styles.h2}>Why CubePi — a langgraph and pi-agent-core alternative</h2>
+ <h2 className={styles.h2}>
+ {zh ? '为什么选择 CubePi — langgraph 和 pi-agent-core 的替代方案' : 'Why CubePi — a langgraph and pi-agent-core alternative'}
+ </h2>
<div className={styles.tableWrap}>
<table className={styles.table}>
<thead>
diff --git a/website/src/hooks/useIsZhHans.ts b/website/src/hooks/useIsZhHans.ts
new file mode 100644
index 0000000..b4b63d2
--- /dev/null
+++ b/website/src/hooks/useIsZhHans.ts
@@ -0,0 +1,5 @@
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+export function useIsZhHans(): boolean {
+ const { i18n } = useDocusaurusContext();
+ return i18n.currentLocale === 'zh-Hans';
+}