| 1 | import { Seal } from "@/components/seal"; |
| 2 | import { buildPageMetadata } from "@/lib/page-meta"; |
| 3 | |
| 4 | const REPO_BLOB_BASE = "https://github.com/Hmbown/CodeWhale/blob/main"; |
| 5 | |
| 6 | export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) { |
| 7 | const { locale } = await params; |
| 8 | const isZh = locale === "zh"; |
| 9 | return buildPageMetadata({ |
| 10 | path: "/runtime", |
| 11 | locale, |
| 12 | title: isZh ? "Runtime & 集成 · Codewhale" : "Runtime & Integrations · Codewhale", |
| 13 | description: isZh |
| 14 | ? "Codewhale 的本地 Runtime API、HTTP/SSE、ACP stdio 适配器、MCP 服务器、VS Code 配套扩展与消息桥接。" |
| 15 | : "Codewhale's local Runtime API, HTTP/SSE, baseline ACP stdio adapter, MCP servers, Phase 0 VS Code companion, and messaging bridges.", |
| 16 | }); |
| 17 | } |
| 18 | |
| 19 | interface Integration { |
| 20 | name: string; |
| 21 | desc: string; |
| 22 | descZh: string; |
| 23 | href: string; |
| 24 | } |
| 25 | |
| 26 | const INTEGRATIONS: Integration[] = [ |
| 27 | { |
| 28 | name: "HTTP / SSE Runtime API", |
| 29 | desc: "Full local HTTP + Server-Sent Events runtime API on 127.0.0.1:7878. Create threads, stream turns, manage background jobs, and control approval decisions — all from any HTTP client or the bundled mobile page.", |
| 30 | descZh: "完整的本地 HTTP + Server-Sent Events Runtime API,监听 127.0.0.1:7878。创建线程、流式对话、管理后台任务、控制审批决策——任意 HTTP 客户端或内置手机页面皆可调用。", |
| 31 | href: `${REPO_BLOB_BASE}/docs/RUNTIME_API.md`, |
| 32 | }, |
| 33 | { |
| 34 | name: "ACP (Agent Client Protocol)", |
| 35 | desc: "Baseline JSON-RPC adapter over stdio for compatible editor clients such as Zed. It supports initialize, new session, prompt, and cancel with text responses; shell and file tools, checkpoint replay, and session loading remain on the full Runtime API.", |
| 36 | descZh: "面向 Zed 等兼容编辑器客户端的基础 JSON-RPC stdio 适配器。它支持初始化、新建会话、提示和取消,并返回文本响应;shell 与文件工具、检查点回放和会话加载仍由完整 Runtime API 提供。", |
| 37 | href: `${REPO_BLOB_BASE}/docs/RUNTIME_API.md`, |
| 38 | }, |
| 39 | { |
| 40 | name: "MCP (Model Context Protocol)", |
| 41 | desc: "Connect Codewhale to external tools and services through configured MCP servers over stdio or HTTP/SSE, or expose Codewhale's own tools to another MCP client.", |
| 42 | descZh: "通过已配置的 MCP 服务器(stdio 或 HTTP/SSE)将 Codewhale 连接到外部工具和服务,或把 Codewhale 自身工具暴露给其他 MCP 客户端。", |
| 43 | href: `${REPO_BLOB_BASE}/docs/MCP.md`, |
| 44 | }, |
| 45 | { |
| 46 | name: "VS Code Extension", |
| 47 | desc: "Phase 0 companion for the local runtime. It can open Codewhale in a terminal, start and check the Runtime API, and show read-only thread summaries and restore points. It does not yet provide full chat, inline edits, or editor actions.", |
| 48 | descZh: "本地 Runtime 的 Phase 0 配套扩展。它可以在终端中打开 Codewhale、启动并检查 Runtime API,以及显示只读线程摘要和还原点;目前尚不提供完整聊天、内联编辑或编辑器操作。", |
| 49 | href: "https://github.com/Hmbown/CodeWhale/tree/main/extensions/vscode", |
| 50 | }, |
| 51 | { |
| 52 | name: "Telegram Bridge", |
| 53 | desc: "First-party Telegram bot bridge. Start a headless Codewhale session, then chat with it from any Telegram client — approvals, tool results, and completions surface inline.", |
| 54 | descZh: "官方 Telegram 机器人桥接。启动无头 Codewhale 会话,在任何 Telegram 客户端中与之对话——审批、工具结果和完成状态内联展示。", |
| 55 | href: "https://github.com/Hmbown/CodeWhale/tree/main/integrations/telegram-bridge", |
| 56 | }, |
| 57 | { |
| 58 | name: "Feishu / Lark Bridge", |
| 59 | desc: "First-party Feishu / Lark bot bridge. Chat-native agent loop inside your Feishu workspace with approval cards, session linking, and audit trail.", |
| 60 | descZh: "官方飞书 / Lark 机器人桥接。在飞书工作区内实现聊天原生 Agent 循环,支持审批卡片、会话关联和审计日志。", |
| 61 | href: "https://github.com/Hmbown/CodeWhale/tree/main/integrations/feishu-bridge", |
| 62 | }, |
| 63 | { |
| 64 | name: "Weixin Bridge (实验性)", |
| 65 | desc: "Experimental Weixin / WeChat bridge. Receive agent completions and approvals inside WeChat; early-stage and not recommended for production deployments.", |
| 66 | descZh: "实验性微信桥接。在微信中接收 Agent 完成通知和审批;早期阶段,不建议用于生产环境。", |
| 67 | href: "https://github.com/Hmbown/CodeWhale/tree/main/integrations/weixin-bridge", |
| 68 | }, |
| 69 | ]; |
| 70 | |
| 71 | export default async function RuntimePage({ params }: { params: Promise<{ locale: string }> }) { |
| 72 | const { locale } = await params; |
| 73 | const isZh = locale === "zh"; |
| 74 | |
| 75 | return ( |
| 76 | <> |
| 77 | {/* Hero */} |
| 78 | <section className="mx-auto max-w-[1100px] px-6 pt-12 pb-10"> |
| 79 | <div className="flex items-baseline gap-4 mb-3"> |
| 80 | <Seal char="接" /> |
| 81 | <div className="eyebrow">{isZh ? "Runtime & 集成" : "Runtime & Integrations"}</div> |
| 82 | </div> |
| 83 | <h1 className="font-display tracking-crisp mb-6"> |
| 84 | {isZh ? ( |
| 85 | <>运行时与集成<span className="font-cjk text-indigo text-5xl ml-2">Runtime & Integrations</span></> |
| 86 | ) : ( |
| 87 | <>Runtime & Integrations<span className="font-cjk text-indigo text-5xl ml-2">运行时与集成</span></> |
| 88 | )} |
| 89 | </h1> |
| 90 | |
| 91 | <p className="max-w-2xl text-ink-soft leading-relaxed"> |
| 92 | {isZh |
| 93 | ? "Codewhale 不仅是一个终端 Agent——它还是一个可通过多种协议和集成方式嵌入到你现有工作流中的本地控制平面。" |
| 94 | : "Codewhale is more than a terminal agent — it is a local control plane you can embed into your existing workflow through multiple protocols and integrations."} |
| 95 | </p> |
| 96 | </section> |
| 97 | |
| 98 | {/* Trust boundary */} |
| 99 | <section className="mx-auto max-w-[1100px] px-6 py-8 hairline-t"> |
| 100 | <div className="flex items-baseline gap-4 mb-4"> |
| 101 | <Seal char="信" /> |
| 102 | <div className="eyebrow">{isZh ? "信任边界" : "Trust boundary"}</div> |
| 103 | </div> |
| 104 | <div className="grid sm:grid-cols-2 gap-6 text-sm text-ink-soft leading-relaxed"> |
| 105 | <div> |
| 106 | <strong className="text-ink">{isZh ? "本地优先" : "Local-first"}</strong> |
| 107 | <p className="mt-1"> |
| 108 | {isZh |
| 109 | ? "Runtime API 默认仅监听 127.0.0.1。本地运行时不需要 Codewhale 账户或托管中继。" |
| 110 | : "The Runtime API binds 127.0.0.1 by default. The local runtime does not require a Codewhale account or hosted relay."} |
| 111 | </p> |
| 112 | </div> |
| 113 | <div> |
| 114 | <strong className="text-ink">{isZh ? "认证必需" : "Auth required"}</strong> |
| 115 | <p className="mt-1"> |
| 116 | {isZh |
| 117 | ? "所有 Runtime API 路由(/v1/*)需要 Bearer Token。配置 CODEWHALE_RUNTIME_TOKEN 环境变量或 config.toml 中的 auth_token。" |
| 118 | : "All Runtime API routes (/v1/*) require a Bearer token. Set CODEWHALE_RUNTIME_TOKEN env var or auth_token in config.toml."} |
| 119 | </p> |
| 120 | </div> |
| 121 | <div> |
| 122 | <strong className="text-ink">{isZh ? "权限用户控制" : "Permissions user-controlled"}</strong> |
| 123 | <p className="mt-1"> |
| 124 | {isZh |
| 125 | ? "远程客户端通过经过认证的 Runtime API 提交请求与审批决定。本地模式、权限姿态和沙箱策略仍然生效。" |
| 126 | : "Remote clients submit requests and approval decisions through the authenticated Runtime API. Local mode, permission posture, and sandbox policy still apply."} |
| 127 | </p> |
| 128 | </div> |
| 129 | <div> |
| 130 | <strong className="text-ink">{isZh ? "开放协议" : "Open protocols"}</strong> |
| 131 | <p className="mt-1"> |
| 132 | {isZh |
| 133 | ? "HTTP/SSE Runtime API、MCP 和基础 ACP stdio 适配器分别服务于不同集成场景;请根据客户端需要选择对应接口。" |
| 134 | : "The HTTP/SSE Runtime API, MCP surface, and baseline ACP stdio adapter serve different integration needs; choose the interface your compatible client supports."} |
| 135 | </p> |
| 136 | </div> |
| 137 | </div> |
| 138 | </section> |
| 139 | |
| 140 | {/* Integration cards */} |
| 141 | <section className="mx-auto max-w-[1100px] px-6 py-10 hairline-t"> |
| 142 | <div className="flex items-baseline gap-4 mb-6"> |
| 143 | <Seal char="集" /> |
| 144 | <div className="eyebrow">{isZh ? "集成方式" : "Integration surfaces"}</div> |
| 145 | </div> |
| 146 | |
| 147 | <div className="grid sm:grid-cols-2 gap-6"> |
| 148 | {INTEGRATIONS.map((item) => ( |
| 149 | <div key={item.name} className="hairline rounded-lg p-5 bg-panel-1 hover:bg-panel-2 transition-colors"> |
| 150 | <h3 className="font-semibold text-base mb-2"> |
| 151 | <a href={item.href} target="_blank" rel="noopener noreferrer" className="body-link"> |
| 152 | {item.name} ↗ |
| 153 | </a> |
| 154 | </h3> |
| 155 | <p className="text-sm text-ink-soft leading-relaxed"> |
| 156 | {isZh ? item.descZh : item.desc} |
| 157 | </p> |
| 158 | </div> |
| 159 | ))} |
| 160 | </div> |
| 161 | </section> |
| 162 | |
| 163 | {/* Read more */} |
| 164 | <section className="mx-auto max-w-[1100px] px-6 py-8 hairline-t"> |
| 165 | <p className="text-sm text-ink-soft"> |
| 166 | {isZh ? ( |
| 167 | <> |
| 168 | 详细实现文档:{" "} |
| 169 | <a |
| 170 | href={`${REPO_BLOB_BASE}/docs/RUNTIME_API.md`} |
| 171 | target="_blank" |
| 172 | rel="noopener noreferrer" |
| 173 | className="body-link" |
| 174 | > |
| 175 | Runtime API 与 ACP stdio 适配器 ↗ |
| 176 | </a> |
| 177 | {" · "} |
| 178 | <a |
| 179 | href={`${REPO_BLOB_BASE}/docs/MCP.md`} |
| 180 | target="_blank" |
| 181 | rel="noopener noreferrer" |
| 182 | className="body-link" |
| 183 | > |
| 184 | MCP 集成 ↗ |
| 185 | </a> |
| 186 | </> |
| 187 | ) : ( |
| 188 | <> |
| 189 | Detailed implementation docs:{" "} |
| 190 | <a |
| 191 | href={`${REPO_BLOB_BASE}/docs/RUNTIME_API.md`} |
| 192 | target="_blank" |
| 193 | rel="noopener noreferrer" |
| 194 | className="body-link" |
| 195 | > |
| 196 | Runtime API and ACP stdio adapter ↗ |
| 197 | </a> |
| 198 | {" · "} |
| 199 | <a |
| 200 | href={`${REPO_BLOB_BASE}/docs/MCP.md`} |
| 201 | target="_blank" |
| 202 | rel="noopener noreferrer" |
| 203 | className="body-link" |
| 204 | > |
| 205 | MCP integration ↗ |
| 206 | </a> |
| 207 | </> |
| 208 | )} |
| 209 | </p> |
| 210 | </section> |
| 211 | </> |
| 212 | ); |
| 213 | } |
| 214 |