源码索引¶
本页是阅读 Pi 源码的定位索引。行号基于本地仓库 /Users/gitsilence/github/pi 当前状态生成,格式为 packages/.../file.ts:line。如果源码更新,行号可能漂移,但文件与符号仍可作为入口。
Monorepo 模块索引¶
| 模块 | 负责内容 | 入口文件与行号 |
|---|---|---|
| 根工程 | workspace、构建、测试、发布脚本 | package.json:1, README.md:1 |
packages/ai |
多 provider LLM API、模型目录、流协议、OAuth、工具 schema 校验 | packages/ai/src/types.ts:6, packages/ai/src/stream.ts:36, packages/ai/src/api-registry.ts:23 |
packages/agent |
低层 agent loop、状态包装、工具执行、通用 harness | packages/agent/src/agent-loop.ts:31, packages/agent/src/agent.ts:166, packages/agent/src/types.ts:135 |
packages/agent/src/harness |
通用 AgentHarness、session repo/storage、compaction、skills、prompt templates | packages/agent/src/harness/agent-harness.ts:174, packages/agent/src/harness/types.ts:798 |
packages/coding-agent |
CLI/SDK/RPC 产品层、会话、扩展、内置工具、设置、项目资源 | packages/coding-agent/src/core/sdk.ts:166, packages/coding-agent/src/core/agent-session.ts:265 |
packages/coding-agent/src/core |
coding-agent 的领域核心:session、resource、extensions、tools、settings、models | packages/coding-agent/src/core/agent-session.ts:265, packages/coding-agent/src/core/session-manager.ts:757 |
packages/coding-agent/src/cli |
命令行参数、启动 UI、文件输入、项目 trust | packages/coding-agent/src/cli/args.ts:63, packages/coding-agent/src/cli/startup-ui.ts:54 |
packages/coding-agent/src/modes/interactive |
交互式 TUI 模式、主题、组件、模型搜索 | packages/coding-agent/src/modes/interactive/interactive-mode.ts:265, packages/coding-agent/src/modes/interactive/theme/theme.ts:323 |
packages/coding-agent/src/modes/rpc |
JSONL RPC 协议、client、headless UI bridge | packages/coding-agent/src/modes/rpc/rpc-mode.ts:40, packages/coding-agent/src/modes/rpc/rpc-types.ts:19 |
packages/coding-agent/src/bun |
Bun binary 相关环境恢复与 CLI 包装 | packages/coding-agent/src/bun/restore-sandbox-env.ts:19 |
packages/coding-agent/src/utils |
路径、shell、图片、git、版本、HTML/ANSI 等工具函数 | packages/coding-agent/src/utils/paths.ts:28, packages/coding-agent/src/utils/shell.ts:67 |
packages/tui |
终端 UI 核心、输入编辑器、组件、键盘协议、宽度计算 | packages/tui/src/tui.ts:64, packages/tui/src/keybindings.ts:155, packages/tui/src/keys.ts:163 |
packages/tui/native |
macOS/Windows 原生终端能力探测 | packages/tui/native/darwin/src/darwin-modifiers.c:1, packages/tui/native/win32/src/win32-console-mode.c:1 |
packages/coding-agent/docs |
官方用户文档、SDK/扩展/RPC/安全/设置等说明 | packages/coding-agent/docs/index.md:1, packages/coding-agent/docs/sdk.md:1, packages/coding-agent/docs/extensions.md:1 |
packages/coding-agent/examples |
SDK 与 extension 示例,包括 subagent、plan mode、sandbox、custom provider | packages/coding-agent/examples/sdk/README.md:1, packages/coding-agent/examples/extensions/README.md:1 |
scripts |
monorepo 检查、发布、统计、browser smoke、shrinkwrap 等工程脚本 | scripts/check-browser-smoke.mjs:1, scripts/generate-coding-agent-shrinkwrap.mjs:1, scripts/release.mjs:1 |
技术架构与启动链路¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| SDK 装配入口 | 创建 auth、model registry、settings、resource loader、session manager、AgentSession | packages/coding-agent/src/core/sdk.ts:166 |
| 创建 Agent | 设置初始 model/thinking/tools、streamFn、transformContext、queue mode | packages/coding-agent/src/core/sdk.ts:286 |
| 恢复 session 模型 | 从已有 session context 恢复 provider/modelId | packages/coding-agent/src/core/sdk.ts:190 |
| 初始模型选择 | settings/default provider/default model 到 available model 的解析 | packages/coding-agent/src/core/sdk.ts:205 |
| thinking level clamp | 根据模型能力收敛 thinking level | packages/coding-agent/src/core/sdk.ts:236, packages/coding-agent/src/core/agent-session.ts:1483 |
| 系统提示构造 | 工具列表、guidelines、项目上下文、skills、当前日期/cwd | packages/coding-agent/src/core/system-prompt.ts:28 |
| 资源加载 | extensions、skills、prompts、themes、context files | packages/coding-agent/src/core/resource-loader.ts:156 |
| 项目上下文文件 | 从 agentDir 和 cwd 祖先目录加载 AGENTS.md/CLAUDE.md | packages/coding-agent/src/core/resource-loader.ts:59 |
Agent Loop 与运行状态¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| agent loop 入口 | 新 prompt 加入 context 并启动 loop | packages/agent/src/agent-loop.ts:31 |
| continue 入口 | 从已有 user/toolResult 继续,用于重试/压缩后续跑 | packages/agent/src/agent-loop.ts:64 |
| 双层循环 | tool call、steering、follow-up 的循环驱动 | packages/agent/src/agent-loop.ts:155 |
| 模型流调用 | transformContext、convertToLlm、Context 构造、streamFn 调用 | packages/agent/src/agent-loop.ts:275 |
| partial message 更新 | provider stream 事件写回 context 并发 message_update |
packages/agent/src/agent-loop.ts:310 |
| 工具执行分派 | 根据全局/单工具 executionMode 选择 sequential/parallel | packages/agent/src/agent-loop.ts:373 |
| 顺序工具执行 | 逐个 prepare/execute/finalize/toolResult | packages/agent/src/agent-loop.ts:395 |
| 并行工具执行 | 顺序 preflight,并发执行,按原始顺序生成 toolResult message | packages/agent/src/agent-loop.ts:451 |
| 工具 preflight | 工具查找、prepareArguments、schema 校验、beforeToolCall | packages/agent/src/agent-loop.ts:562 |
| Agent 状态包装 | mutable state、event subscription、queue API、abort/wait | packages/agent/src/agent.ts:166 |
| Agent loop config | Agent 类把 state、queue、hooks 适配给 low-level loop | packages/agent/src/agent.ts:422 |
| Agent 核心类型 | AgentLoopConfig、AgentMessage、AgentTool、AgentEvent | packages/agent/src/types.ts:135, packages/agent/src/types.ts:309, packages/agent/src/types.ts:366, packages/agent/src/types.ts:408 |
Harness Engineering¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| 通用 AgentHarness | 运行环境层:session、resources、tools、hooks、stream options | packages/agent/src/harness/agent-harness.ts:174 |
| turn state 快照 | 每 turn 固定 messages/resources/model/thinking/tools/sessionId | packages/agent/src/harness/agent-harness.ts:158 |
| provider stream 包装 | auth/header 合并、before_provider_request、after_provider_response | packages/agent/src/harness/agent-harness.ts:376 |
| loop config 映射 | context/tool_call/tool_result/prepareNextTurn/queues 适配到 loop | packages/agent/src/harness/agent-harness.ts:421 |
| pending session writes | message、model、thinking、active tools、custom、label 等统一 flush | packages/agent/src/harness/agent-harness.ts:484 |
| Harness 事件类型 | before_agent_start、context、provider、tool、session、resources 等 | packages/agent/src/harness/types.ts:500 |
| Harness 错误类型 | session/compaction/branch_summary/hook/auth 等稳定错误分类 | packages/agent/src/harness/types.ts:219 |
| ExecutionEnv 抽象 | 文件系统和 shell 能力接口,便于不同运行环境实现 | packages/agent/src/harness/types.ts:268, packages/agent/src/harness/env/nodejs.ts:230 |
Coding Agent Session¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| AgentSession 产品层 | prompt、工具、模型、扩展、压缩、重试、持久化 | packages/coding-agent/src/core/agent-session.ts:265 |
| agent event handler | 扩展事件、UI listener、message 持久化、assistant tracking | packages/coding-agent/src/core/agent-session.ts:487 |
| 扩展事件翻译 | AgentEvent -> extension event | packages/coding-agent/src/core/agent-session.ts:613 |
| prompt 主流程 | extension command、input hook、skill/template、auth、compaction、before_agent_start | packages/coding-agent/src/core/agent-session.ts:997 |
| agent run 后处理 | 自动重试、自动压缩、queued message continuation | packages/coding-agent/src/core/agent-session.ts:958 |
| steering/follow-up | streaming 时按语义入队 | packages/coding-agent/src/core/agent-session.ts:1176, packages/coding-agent/src/core/agent-session.ts:1198 |
| custom message | 扩展注入 LLM context 或仅持久化显示 | packages/coding-agent/src/core/agent-session.ts:1299 |
| 模型切换 | set/cycle model,写 session/settings,触发扩展事件 | packages/coding-agent/src/core/agent-session.ts:1407, packages/coding-agent/src/core/agent-session.ts:1430 |
| thinking level | clamp、保存 session/settings、通知扩展 | packages/coding-agent/src/core/agent-session.ts:1483 |
| 自动压缩写入 | compaction result 写入 SessionManager | packages/coding-agent/src/core/agent-session.ts:1734, packages/coding-agent/src/core/agent-session.ts:2009 |
会话、分支与上下文消息¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| SessionEntry 类型 | message/model/thinking/compaction/branch/custom/label/session_info | packages/coding-agent/src/core/session-manager.ts:46, packages/coding-agent/src/core/session-manager.ts:140 |
| session context 构建 | 从 leaf 回溯、处理 compaction summary 与 kept messages | packages/coding-agent/src/core/session-manager.ts:325 |
| SessionManager | append-only JSONL 树、leaf、branch/fork/session list | packages/coding-agent/src/core/session-manager.ts:757 |
| append message | 普通消息写入 current leaf 子节点 | packages/coding-agent/src/core/session-manager.ts:950 |
| append compaction | 压缩摘要作为顶层 entry 写入 | packages/coding-agent/src/core/session-manager.ts:990 |
| custom message entry | 扩展注入可进入 LLM context 的消息 | packages/coding-agent/src/core/session-manager.ts:1054 |
| runtime replacement | new/switch/fork 时 tear down 旧 session 并创建新 runtime | packages/coding-agent/src/core/agent-session-runtime.ts:74 |
| custom AgentMessage | bash/custom/branchSummary/compactionSummary 类型扩展 | packages/coding-agent/src/core/messages.ts:29, packages/coding-agent/src/core/messages.ts:46, packages/coding-agent/src/core/messages.ts:55, packages/coding-agent/src/core/messages.ts:62 |
| convertToLlm | 应用层消息转标准 user/assistant/toolResult | packages/coding-agent/src/core/messages.ts:148 |
上下文裁剪、压缩与分支摘要¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| token 估算 | 用最近 usage + trailing estimate 估算上下文 | packages/coding-agent/src/core/compaction/compaction.ts:187 |
| 自动压缩阈值 | contextTokens > contextWindow - reserveTokens |
packages/coding-agent/src/core/compaction/compaction.ts:220 |
| cut point | 从后往前保留 keepRecentTokens,避开 toolResult | packages/coding-agent/src/core/compaction/compaction.ts:387 |
| split turn | 找 turn start,分开摘要超大 turn 前缀 | packages/coding-agent/src/core/compaction/compaction.ts:350 |
| prepareCompaction | 找上次 compaction、firstKeptEntryId、messagesToSummarize、fileOps | packages/coding-agent/src/core/compaction/compaction.ts:647 |
| compact | 生成 history summary 和 turn prefix summary,写文件操作列表 | packages/coding-agent/src/core/compaction/compaction.ts:754 |
| 文件操作追踪 | read/modified 文件提取、格式化、conversation 序列化 | packages/coding-agent/src/core/compaction/utils.ts:24, packages/coding-agent/src/core/compaction/utils.ts:54, packages/coding-agent/src/core/compaction/utils.ts:91 |
| branch summary | 离开分支时收集旧 branch entry 并生成摘要 | packages/coding-agent/src/core/compaction/branch-summarization.ts:124 |
| core harness compaction | 通用 harness 也有同构 compaction 实现 | packages/agent/src/harness/compaction/compaction.ts:202, packages/agent/src/harness/compaction/compaction.ts:548 |
工具系统¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| AgentToolResult | content 给模型,details 给 UI/日志/导出 | packages/agent/src/types.ts:345 |
| AgentTool | schema、prepareArguments、execute、onUpdate、executionMode | packages/agent/src/types.ts:366 |
| coding tool registry | 内置工具名、工具定义和工具实例创建 | packages/coding-agent/src/core/tools/index.ts:83, packages/coding-agent/src/core/tools/index.ts:96, packages/coding-agent/src/core/tools/index.ts:156 |
| bash tool | shell operations、spawn hook、tool definition、AgentTool | packages/coding-agent/src/core/tools/bash.ts:66, packages/coding-agent/src/core/tools/bash.ts:274, packages/coding-agent/src/core/tools/bash.ts:451 |
| edit tool | fuzzy edit/diff、tool definition、AgentTool | packages/coding-agent/src/core/tools/edit.ts:287, packages/coding-agent/src/core/tools/edit.ts:435 |
| write tool | 写文件 tool definition、AgentTool | packages/coding-agent/src/core/tools/write.ts:181, packages/coding-agent/src/core/tools/write.ts:265 |
| read/grep/find/ls | 文件读取与搜索工具 | packages/coding-agent/src/core/tools/read.ts:1, packages/coding-agent/src/core/tools/grep.ts:123, packages/coding-agent/src/core/tools/find.ts:1, packages/coding-agent/src/core/tools/ls.ts:95 |
| 截断策略 | 输出行数/字节/单行截断 | packages/coding-agent/src/core/tools/truncate.ts:11, packages/coding-agent/src/core/tools/truncate.ts:78 |
| 文件 mutation queue | 串行化写/编辑类文件变更 | packages/coding-agent/src/core/tools/file-mutation-queue.ts:1 |
| 扩展工具包装 | Extension registered tool -> AgentTool | packages/coding-agent/src/core/extensions/wrapper.ts:17 |
插件、扩展与资源¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| ExtensionAPI 类型 | 扩展可注册工具、命令、快捷键、UI、provider、事件 | packages/coding-agent/src/core/extensions/types.ts:435 |
| ExtensionRunner | 扩展生命周期、事件分发、runtime actions、UI context | packages/coding-agent/src/core/extensions/runner.ts:262 |
| project_trust | 第一个 yes/no handler 胜出 | packages/coding-agent/src/core/extensions/runner.ts:198 |
| tool_call hook | 可 block 工具调用 | packages/coding-agent/src/core/extensions/runner.ts:862 |
| tool_result hook | 可改 content/details/isError | packages/coding-agent/src/core/extensions/runner.ts:812 |
| context hook | 可替换即将发给模型的 messages | packages/coding-agent/src/core/extensions/runner.ts:914 |
| before_agent_start | 可追加 custom message 或改 system prompt | packages/coding-agent/src/core/extensions/runner.ts:980 |
| ExtensionAPI 创建 | 注册方法写 extension,动作方法委托 runtime | packages/coding-agent/src/core/extensions/loader.ts:177 |
| ExtensionRuntime | active/stale context、provider registration queue | packages/coding-agent/src/core/extensions/loader.ts:124 |
| 扩展发现 | 项目/全局/extensions 目录和 package manifest | packages/coding-agent/src/core/extensions/loader.ts:470, packages/coding-agent/src/core/extensions/loader.ts:555 |
| ResourceLoader | extensions/skills/prompts/themes/context files 聚合 | packages/coding-agent/src/core/resource-loader.ts:156 |
| Skills | SKILL.md frontmatter、加载、系统提示格式化 | packages/coding-agent/src/core/skills.ts:74, packages/coding-agent/src/core/skills.ts:168, packages/coding-agent/src/core/skills.ts:335 |
| Prompt templates | prompt 模板加载、参数替换、slash command 格式化 | packages/agent/src/harness/prompt-templates.ts:223, packages/agent/src/harness/prompt-templates.ts:265 |
| Package manager | npm/git package 安装、资源解析、更新 | packages/coding-agent/src/core/package-manager.ts:101, packages/coding-agent/src/core/package-manager.ts:775 |
| Project trust | 判断项目资源是否需要信任、trust store | packages/coding-agent/src/core/trust-manager.ts:184, packages/coding-agent/src/core/trust-manager.ts:208 |
MCP 与外部集成¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| 无内置 MCP | README 明确将 MCP 定位为扩展可实现能力 | packages/coding-agent/README.md:489 |
| MCP adapter 落点 | 可通过 extension 注册 tool/command/provider/context/UI | packages/coding-agent/src/core/extensions/types.ts:435, packages/coding-agent/src/core/extensions/loader.ts:177 |
| CLI tools + Skills | 用 README/SKILL.md 描述外部 CLI,让模型通过 bash 使用 | packages/coding-agent/src/core/skills.ts:335, packages/coding-agent/src/core/tools/bash.ts:274 |
| RPC 外部集成 | JSONL command/response/event 协议 | packages/coding-agent/src/modes/rpc/rpc-types.ts:19, packages/coding-agent/src/modes/rpc/rpc-mode.ts:40 |
| 严格 JSONL framing | 只按 LF 分帧,避免 readline Unicode separator 问题 | packages/coding-agent/src/modes/rpc/jsonl.ts:10, packages/coding-agent/src/modes/rpc/jsonl.ts:21 |
模型、Provider 与认证¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| Model 类型 | provider/api/contextWindow/reasoning/compat/cost | packages/ai/src/types.ts:579 |
| Context 类型 | systemPrompt/messages/tools | packages/ai/src/types.ts:355 |
| Assistant stream event | text/thinking/toolcall/done/error 流协议 | packages/ai/src/types.ts:369 |
| streamSimple | 根据 model.api 找 provider 并调用统一接口 | packages/ai/src/stream.ts:54 |
| API provider registry | register/get/unregister/clear provider | packages/ai/src/api-registry.ts:66 |
| lazy provider | 内置 provider 动态 import 和错误转流协议 | packages/ai/src/providers/register-builtins.ts:169 |
| provider 注册 | Anthropic/OpenAI/Google/Bedrock/Mistral 等 register | packages/ai/src/providers/anthropic.ts:790, packages/ai/src/providers/openai-responses.ts:185, packages/ai/src/providers/google.ts:319, packages/ai/src/providers/amazon-bedrock.ts:417 |
| OpenAI-compatible 差异 | compat 配置:role/tool/thinking/cache/session affinity | packages/ai/src/types.ts:387, packages/ai/src/types.ts:434, packages/ai/src/types.ts:444 |
| 模型目录 | generated model metadata 与 helper | packages/ai/src/models.generated.ts:6, packages/ai/src/models.ts:20 |
| 环境变量 API key | provider -> env key resolution | packages/ai/src/env-api-keys.ts:121, packages/ai/src/env-api-keys.ts:136 |
| OAuth provider | OpenAI Codex/GitHub Copilot/Anthropic OAuth registry | packages/ai/src/utils/oauth/index.ts:55, packages/ai/src/utils/oauth/openai-codex.ts:564 |
| Coding ModelRegistry | 可用模型、认证、扩展 provider config | packages/coding-agent/src/core/model-registry.ts:334 |
| AuthStorage | 本地 auth.json 凭据存储 | packages/coding-agent/src/core/auth-storage.ts:199 |
CLI、交互模式、RPC 与 TUI¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| 参数解析 | provider/model/mode/tools/extensions 等 CLI 参数 | packages/coding-agent/src/cli/args.ts:63 |
| 初始消息构造 | @files 和命令行 message 组合 |
packages/coding-agent/src/cli/initial-message.ts:20 |
| 文件输入处理 | CLI 附加文件、图片、路径处理 | packages/coding-agent/src/cli/file-processor.ts:13 |
| 交互模式 | TUI session loop、快捷键、UI/extension binding | packages/coding-agent/src/modes/interactive/interactive-mode.ts:265 |
| 主题系统 | Theme、主题加载/切换/导出、终端背景检测 | packages/coding-agent/src/modes/interactive/theme/theme.ts:323, packages/coding-agent/src/modes/interactive/theme/theme.ts:613, packages/coding-agent/src/modes/interactive/theme/theme.ts:711 |
| Settings UI | 交互式设置选择组件 | packages/coding-agent/src/modes/interactive/components/settings-selector.ts:467 |
| Print mode | 非交互文本/JSON 输出模式 | packages/coding-agent/src/modes/print-mode.ts:17 |
| RPC mode | headless 运行、extension UI request bridge | packages/coding-agent/src/modes/rpc/rpc-mode.ts:40 |
| RPC client | Node client spawn agent 并发送 JSONL command | packages/coding-agent/src/modes/rpc/rpc-client.ts:54 |
| TUI Component | terminal component/focus/overlay/container | packages/tui/src/tui.ts:64, packages/tui/src/tui.ts:295 |
| TUI keys | key ids、Kitty protocol、按键解析 | packages/tui/src/keys.ts:163, packages/tui/src/keys.ts:1251 |
| TUI keybindings | keybinding manager 与冲突处理 | packages/tui/src/keybindings.ts:155 |
| 编辑器 | editor component、undo/kill ring、autocomplete | packages/tui/src/editor-component.ts:11, packages/tui/src/undo-stack.ts:7, packages/tui/src/kill-ring.ts:8, packages/tui/src/autocomplete.ts:273 |
| 终端宽度/ANSI | grapheme、visible width、wrap、truncate、ANSI parsing | packages/tui/src/utils.ts:216, packages/tui/src/utils.ts:694, packages/tui/src/utils.ts:915 |
| 选择列表组件 | SelectList 和主题 | packages/tui/src/components/select-list.ts:40 |
工程化、发布与测试模块¶
| 知识点 | 说明 | 源码定位 |
|---|---|---|
| workspace 配置 | monorepo workspace、统一 scripts、依赖 pinning | package.json:5, package.json:13 |
| 根构建命令 | 依次构建 tui、ai、agent、coding-agent | package.json:15 |
| 根检查命令 | Biome、pinned deps、TS import、shrinkwrap、typecheck、browser smoke | package.json:16 |
| 根测试命令 | workspace 测试入口 | package.json:23 |
| ai 构建 | 生成模型目录和图片模型目录后编译 | packages/ai/package.json:77 |
| agent 构建 | agent-core TypeScript 编译 | packages/agent/package.json:29 |
| coding-agent 构建 | 编译 CLI、复制资源、设置执行权限 | packages/coding-agent/package.json:30 |
| tui 构建 | TUI 包编译 | packages/tui/package.json:9 |
| 模型生成脚本 | 从上游/配置生成模型元数据 | packages/ai/scripts/generate-models.ts:1, packages/ai/scripts/generate-image-models.ts:1 |
| shrinkwrap 生成 | 从 root lockfile 生成 coding-agent 发布 shrinkwrap | scripts/generate-coding-agent-shrinkwrap.mjs:1 |
| 依赖安全检查 | direct deps pinning 与 lockfile 变更检查 | scripts/check-pinned-deps.mjs:1, scripts/check-lockfile-commit.mjs:1 |
| 发布与本地 release | pack/install smoke、发布流程、release notes | scripts/local-release.mjs:1, scripts/release.mjs:1, scripts/release-notes.mjs:1 |
| Browser smoke | 浏览器环境入口与 smoke 检查 | scripts/browser-smoke-entry.ts:1, scripts/check-browser-smoke.mjs:1 |
| 会话分析脚本 | session transcript/context/cost/stat 统计 | scripts/session-transcripts.ts:1, scripts/session-context-stats.mjs:1, scripts/cost.ts:1, scripts/stats.ts:1 |
| session migration | coding-agent session 迁移脚本 | packages/coding-agent/scripts/migrate-sessions.sh:1 |
| 测试入口 | ai/agent/coding-agent/tui 包级测试命令 | packages/ai/package.json:78, packages/agent/package.json:30, packages/coding-agent/package.json:34, packages/tui/package.json:10 |
测试与可观察性入口¶
| 模块 | 测试/文档入口 | 说明 |
|---|---|---|
| agent loop | packages/agent/test/agent-loop.test.ts:1 |
loop、工具调用、队列、事件 |
| harness | packages/agent/test/harness/agent-harness.test.ts:1 |
harness 行为、stream、session、resource |
| compaction | packages/agent/test/harness/compaction.test.ts:1, packages/coding-agent/docs/compaction.md:1 |
压缩策略、cut point、split turn |
| session | packages/coding-agent/test/session-manager, packages/coding-agent/docs/session-format.md:1 |
JSONL 会话格式 |
| extensions | packages/coding-agent/examples/extensions/README.md:1, packages/coding-agent/docs/extensions.md:1 |
扩展 API 与示例 |
| SDK | packages/coding-agent/examples/sdk/README.md:1, packages/coding-agent/docs/sdk.md:1 |
嵌入式使用 |
| RPC | packages/coding-agent/docs/rpc.md:1 |
JSONL 协议 |
| TUI | packages/tui/test, packages/coding-agent/docs/tui.md:1 |
终端 UI 行为 |