src/ — 源码分析
基于 ~/6ai/opensources/openclaw/src 的源码阅读与分析产出。
目录映射
| 分析目录 | 对应源码目录 | 说明 |
|---|---|---|
| core/ | entry.ts, globals.ts, global-state.ts, runtime.ts, shared/, types/, compat/ | 启动入口、全局状态、类型定义 |
| gateway/ | gateway/ | WebSocket 网关、会话路由、RPC 协议 |
| agents/ | agents/, commands/, auto-reply/, sessions/, routing/ | Agent 运行时、命令处理、会话管理 |
| channels/ | channels/, pairing/ | 渠道集成(Telegram/Discord/Slack/WhatsApp 等) |
| plugins/ | plugins/, plugin-sdk/, plugin-state/ | 插件系统、Plugin SDK、激活流水线 |
| cli/ | cli/, tui/, wizard/, interactive/ | CLI 命令行、TUI 界面、引导向导 |
| automation/ | cron/, tasks/, flows/, hooks/, commitments/ | 定时任务、后台任务、Hooks、Commitments |
| memory/ | memory/, memory-host-sdk/, context-engine/, link-understanding/ | 记忆系统、上下文引擎 |
| tools/ | tools/, acp/, mcp/, web-search/, web-fetch/, trajectory/ | 工具系统、ACP、MCP、搜索 |
| media/ | media/, media-generation/, image-generation/, video-generation/, music-generation/, tts/, realtime-transcription/, talk/ | 媒体生成与处理 |
| infra/ | infra/, config/, secrets/, security/, logging/, process/, status/, proxy-capture/ | 基础设施、配置、密钥、安全 |
源码规模参考
agents/ 1587 ts files # 最大模块,Agent 运行时核心
infra/ 720 ts files # 基础设施
gateway/ 692 ts files # 网关
commands/ 627 ts files # 命令处理
plugins/ 588 ts files # 插件系统
plugin-sdk/ 528 ts files # Plugin SDK
auto-reply/ 512 ts files # 消息处理/回复
cli/ 410 ts files # CLI
config/ 346 ts files # 配置
channels/ 345 ts files # 渠道
cron/ 172 ts files # 定时任务