mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-11-25 08:51:45 +08:00
43 KiB
43 KiB
Coding Runtime 能力映射
状态:active 更新时间:2026-10-21
Current 对齐修订:Coding Workbench 的独立 Outputs/Logs/Recovery surface 已删除。运行时输出仍属于 tool/runtime capability,但产品呈现只走 canonical timeline、Summary 与 BackgroundTerminalList;本页旧 UI 名称不再是迁移目标。
分类规则
| 分类 | 含义 |
|---|---|
copy |
可按等价结构迁入或重写,必须改成 Lime 命名与 owner。 |
rewrite |
思路可复用,但需要按 Lime 架构重写。 |
reference |
只参考产品或协议设计,不复制实现。 |
forbidden |
不得迁入,不得作为 current 主链。 |
copy 不表示保留外部命名。任何迁入都必须进入 Lime current crates / packages,并补许可证和边界审查。
核心运行时能力
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| Thread / Turn / Item 生命周期 | RuntimeCore session/thread/turn/item | copy | 可复用状态机结构,统一映射 RuntimeEvent。 |
| Input queue / active turn | RuntimeCore queue / turn state | copy | 用于 queue-if-busy、steer、cancel、resume。 |
| Turn context builder | lime-rs/crates/agent prompt/context services |
rewrite | 必须融合 Lime memory、skills、workspace、Provider slots。 |
| Tool lifecycle pairing | RuntimeEvent sequence gate | copy | tool.started -> result/failed 必须机械校验。 |
| Headless event projection | AgentUI event adapter / fixture replay | copy | 输出到 Lime event family,不保留外部 JSON shape。 |
| Context compaction | RuntimeCore history / memory compaction | rewrite | 对齐 Lime memory / evidence / read model。 |
| Review mode | coding review profile / task kind | rewrite | 作为模型槽位和 task mode,不新增 runtime。 |
Runtime 模块边界
| 能力 | Lime current 落点 | 分类 | 当前状态 |
|---|---|---|---|
| Runtime facade | lime-rs/crates/app-server/src/runtime.rs |
current | 已收缩到约 527 行,只保留核心类型、构造、共享 helper 和模块出口。不得继续承接领域业务逻辑。 |
| Runtime domain logic | lime-rs/crates/app-server/src/runtime/*.rs |
current | session、turn、gateway、exports、artifact、tool lifecycle、file system、project git 等分域模块已拆出。新增能力优先进入对应领域文件。 |
| App data traits | runtime/app_data.rs + runtime/app_data/*.rs |
current | AppDataSource 是组合 facade;分域 trait 是真实 owner,禁止把新接口直接堆到巨型 trait 区块。 |
| Local data source impl | local_data_source.rs + local_data_source/impls/*.rs |
current | 根文件保留结构体、初始化和共享 helper;分域 impl 已下沉,后续新增数据源实现必须进入 impls/<domain>.rs 或对应子模块。 |
| Gateway inbound agent runner | runtime/gateway_runner.rs + runtime/gateway.rs |
current | Telegram / Feishu / Discord / WeChat 通过 GatewayAgentRunner 调用 App Server current RuntimeCore::start_turn,不恢复旧 DB 参数 runner 或 legacy runtime。 |
| 旧 Rust root | lime-rs/src/** |
dead | 已删除,禁止恢复 wrapper、stub、compat facade 或旧命令注册。 |
本地参考模块迁移清单
本表只记录“可迁移能力”,不把任何参考仓库、参考 CLI 或参考产品名写成 Lime current owner。实际迁入时,执行计划必须单独记录来源路径、许可证、迁入文件和测试证据;本路线图只保留中性模块名和 Lime 落点。
| 参考目录 | 可迁移内容 | Lime current owner | 分类 | 当前状态 |
|---|---|---|---|---|
apply-patch 模块 |
patch grammar、streaming parser、patch apply replacement engine、场景 fixture | apply-patch crate + agent apply_patch tool + RuntimeBackend mirror + file checkpoint / evidence owner |
copy | 已迁入中性 apply-patch crate(parser / streaming parser / seek sequence / apply service),并接入 agent current tool registry 与 App Server runtime_backend/coding_events/patch.rs:patch.started.paths 优先来自结构化 parser,非法 patch 优先分类为 invalid_patch;agent apply_patch tool 已委托 apply-patch 在 workdir 内真实 add/update/delete/move 文件,支持缺父目录创建、Unicode 标点模糊匹配和 path escape 拒绝,并输出多文件 file.changed metadata。每个文件变更已带 checkpointRef/contentRef/diffRef、工作区相对路径、内容预览、旧内容字段和结构化 diff 预览,RuntimeBackend mirror 会透传到 file.changed,由 RuntimeCore file checkpoint / evidence owner 消费。后续仍需补 GUI evidence。 |
execpolicy 模块 |
prefix rule、network rule、policy decision | Policy service + RuntimeBackend policy facts | copy/rewrite | 基础 permission.denied / sandbox.blocked facts 已从 tool result 分类进入 RuntimeEvent,并透传 policy/profile/decision/platform/command diagnostics;agent tool orchestrator 已能把真实 ToolRegistry::execute 权限拒绝 / 安全拒绝 / 沙箱类失败合成结构化 policy metadata;执行前置 ToolExecutionDecision 已覆盖 shell approval 与 read-only sandbox 非只读 shell 阻断,主工具 inspector 复用同一 decision;NativeAgentConfig.agent.tool_execution 与 workspace_sandbox 已由 App Server turn start 注入并被 execution / orchestrator / inspector / inventory 消费;execution/sandbox.rs 是 sandbox 判定与 backend plan owner,可输出 macOS / Linux / Windows / unsupported diagnostics,并在 strict 模式下对未 enforce backend 执行前阻断;macOS seatbelt 与 Linux bubblewrap 可用时进入 ready/enforced=true 并接入 Agent 前台 shell runner,Windows setup/readiness、双 mode restricted-token runner、ACL/Job/ConPTY、Firewall/WFP 与 warning lifecycle 已接入 current owner,并由 Windows runner schema v3 7/7 evidence 支撑。execution/rules.rs 与 execution/service.rs 继续承接默认规则、多来源 policy 合并和 network metadata;Windows runner、Windows 实机 smoke 与具体网络规则 enforcement 已有 current owner/evidence,后续仅在 token、ACL 或网络规则变更时回归。 |
file-search 模块 |
异步文件搜索、增量 snapshot | search/context tool | copy | 待输出 tool.result + source refs。 |
sandboxing 模块 |
sandbox policy transforms | sandbox manager + RuntimeEvent diagnostics | rewrite | 基础 sandbox.blocked event 已接入;read-only sandbox 下非只读 shell 命令已在执行前阻断并输出结构化 blocked metadata;execution/sandbox.rs 已集中 canonical sandbox label、shell command 文本抽取、只读命令分类、workspace sandbox runtime config 解析和分平台 backend plan;macOS seatbelt 与 Linux linux_sandbox 在宿主具备 /usr/bin/sandbox-exec 或 bwrap 时进入 ready/enforced=true,并通过 ToolContext.workspace_sandbox 接入 Agent 前台 Bash/PowerShell 执行点;Windows restricted_token 已接入 elevated sandbox-account 与 unelevated current-user runner,setup mode、ACL lease、Job Object、ConPTY、readiness read-back 和 warning lifecycle 由同一 current owner 承接;Windows runner schema v3 7/7 及复验 run 是 enforcement evidence,macOS 不得外推。 |
exec 模块 |
JSONL / human event processor 思路 | RuntimeEvent adapter / smoke harness | reference | 只借事件输出思想,不复制协议 shape。 |
code-mode-protocol 模块 |
session framing / response model | external harness adapter | reference | 只能 compat,不替代 App Server。 |
code-mode-host 模块 |
host lifecycle idea | Desktop Host sidecar 管理 | reference | 只用于外部 harness 生命周期。 |
终端型多 harness 参考能力
另一个本地参考仓库的价值主要在“多模型 / 多 harness / 工作区任务治理”的产品和架构经验,而不是代码复制。它已经有 Provider、agent harness、MCP、workspace、terminal、remote apply/read 等较完整边界;Lime 只吸收可映射到 current 主链的部分。
| 参考能力 | Lime current 落点 | 分类 | 说明 | |
|---|---|---|---|---|
| 多 harness 选择 | external_harness diagnostics + RuntimeCore profile decision |
reference | 只能作为兼容执行器选择诊断;Lime 主 turn owner 仍是 App Server / RuntimeCore。 | |
| 组织 / 用户命令规则合并 | Policy service command rules | rewrite | 持久化、组织、用户、runtime、请求级 shellCommandRules/networkRules 与 tool override 已接入;ToolExecutionPolicySource / commandRuleSource 可输出 organization/user/runtime/request 来源,command rule 支持 regex/prefix/exact,network rule 支持 `target=url |
host。后续补冲突解释和 UI evidence。Lime 输出 action.required、permission.denied、sandbox.blocked` 或 network risk metadata。 |
| MCP server 配置解析 | Tool inventory / MCP owner | rewrite | 只进入 Lime MCP owner,不让外部 harness 配置成为事实源。 | |
| 远程读文件 / 应用 diff | ExecutionBackend file / patch tool | reference | 可作为 remote backend 语义参考;输出仍是 file.changed / patch.* / artifact refs。 |
|
| 工作区配置和 session 切换 | Workspace + RuntimeCore session owner | reference | 保持 Lime Workspace 边界,不复制终端 workspace 状态模型。 | |
| UI 视觉 / 终端面板 | Coding Workbench diagnostics / optional terminal surface | forbidden/reference | 不能把 Lime GUI 退回终端壳;只允许借鉴“运行明细可展开”的信息层级。 |
文件、补丁、命令
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| File read/write abstraction | RuntimeBackend mirror + ExecutionBackend file tool + artifact/checkpoint projection owner | copy | 第一刀已从 Read/Write/Edit 派生 file.read/file.changed;file.changed 已进入 RuntimeCore artifact/read-model 聚合与 file checkpoint API read/list/get/diff/restore 基础链路;previous content 已落到文件系统 checkpoint snapshot owner,restore 从 snapshot ref 回读后写回 live 文件;current timeline hydrate 已可从 persisted items 恢复 checkpoint snapshot refs。后续补 GUI evidence。 |
| Patch apply engine | apply-patch crate + agent apply_patch tool + RuntimeBackend mirror + file artifact / checkpoint owner |
copy | 已复制 patch grammar、lenient heredoc parser、streaming parser、fuzzy seek sequence 和真实 apply service 到中性 crate;agent apply_patch tool 已接到该 current owner,RuntimeBackend mirror 已用 parser 提取 patch paths 和 invalid_patch 分类,并从 tool metadata 投影多文件 file.changed。per-file checkpointRef/contentRef/diffRef 与结构化 diff 预览已进入 RuntimeCore artifact / file checkpoint / read-model 主链;后续补 GUI evidence,失败必须结构化,不只写日志。 |
| Diff summary | App Server thread_read.change_summary + AgentUI projection ChangeSummaryView / PatchView / FileChangeView |
rewrite | 已从 file.changed 与 patch.* 派生 read model 变更摘要,并投影到 Workbench session overview;完整 per-turn diff 仍按后续 evidence / checkpoint 细化。 |
| Shell command execution | RuntimeBackend tool mirror + Project Shell / ExecutionBackend command tool | copy | canonical exec_command 已通过 ToolExecutionDecision 与 RuntimeToolExecutionAttempt 进入 unified exec,并由 App Server ExecutionProcessServer 承接 sandbox-aware process/control owner;command.* / test.* facts、output refs、active read model、approval/sandbox diagnostics、stdin/control 与 terminal lifecycle 均已接通。P2-A 同时让本地 pipe/PTY/Seatbelt/Bubblewrap/Windows restricted runner 与远端 Environment 共享 bounded output 与 UTF-8 framing。P2-A/P2-B current owner 已闭环,剩余主缺口是当前 SHA 的正式 verifier/distribution 与 Windows 平台复验证据。 |
| PTY resize/write/terminate | Project Shell APIs | reference | 仅用于用户显式 shell 或工具执行面。 |
| Test output parsing | ExecutionBackend test tool | rewrite | 不从自由文本猜测,需要 status/exit/output refs。 |
| Large output truncation | output ref / artifact ref + tool-runtime bounded process output | copy | BoundedProcessOutput 默认保留 1 MiB head/latest tail,精确统计 outputBytes / outputOmittedBytes / outputTruncated 并插入 omission marker;所有本地 backend 与远端 Environment 已复用该 owner。reader 使用 64-slot bounded broadcast,unified exec observation 有界,App Server replay 按进程隔离;UTF-8 scalar 跨 chunk 时由 ProcessOutputFramers 延迟到完整边界再发 delta。RuntimeCore 继续负责 snapshot/artifact refs,不让 executor 直接写 App Server sidecar。Windows 当前 SHA 的 restricted-token 大输出仍待真机复验。 |
权限与安全
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| Permission profile | App Server policy + Desktop Host snapshot | copy | 显式表达 read/write/network/shell。 |
| Command approval policy | Policy service + RuntimeCore action owner | copy | action.required/resolved 已进入 RuntimeCore guard,RuntimeBackend action response 会回写 Agent tool confirmation / elicitation owner;thread_read.pending_requests / active_action_id 已支持 hydrate;agent tool orchestrator 已接入执行前置 ToolExecutionDecision,并有 decision 层、orchestrator 层和 Agent inspector 层定向测试覆盖 shell approval policy;App Server turn context 会注入当前配置的 agent.tool_execution,避免默认产品路径只依赖请求 metadata;Agent 库内 handle_approval_tool_requests_should_resume_after_manual_confirmation 已证明人工确认后工具会继续入队执行;macOS/Linux workspace sandbox runner 已接到前台 shell。仍需 UI 侧审批后续跑 evidence。 |
| Sandbox blocked event | sandbox.blocked RuntimeEvent |
copy | tool policy/sandbox 类失败会在 tool.failed 前派生 blocked fact,并携带 sandboxPolicy/platform/command/diagnostics 基础字段;read-only sandbox 下非只读 shell 命令已在真实执行前输出 blocked metadata;workspace sandbox backend diagnostics 已进入 decision metadata,strict fallback 可输出 workspace_sandbox_strict_backend_unavailable;UI 显示 blocked,不当作 assistant 文本。 |
| Dangerous command rules | policy catalog / command classifier | rewrite | execution/rules.rs 已提供基础 shell command classifier,能输出 git state mutation、递归/强制删除、提权、网络下载、权限变更和包管理器变更等风险 metadata;shellCommandRules 可用 regex/prefix/exact 补充持久化 / 组织 / 用户 / runtime / 请求级规则,并按来源优先级输出 metadata;curl/wget URL 也会进入 network rule classifier。 |
| Network policy | Provider / tool policy + Reliability policy evidence projection | rewrite | networkRules 已进入 ToolExecutionPolicyConfig 与 PolicyService 多来源合并,支持 URL / host 规则,对 WebFetch 和 shell 网络下载输出结构化 network risk metadata;Reliability UI 已从 current facts 派生 deny/ask 判定与解释摘要。后续补按具体规则深链编辑。 |
| Secret redaction | evidence / projection sanitation | copy | raw payload 不得进入 UI projection。 |
Provider 与多模型
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| Model list / model metadata | Model Registry | reference | 不复制单供应商 catalog。 |
| Custom endpoint models | API Key Provider / Provider Store | rewrite | 支持 alias、stable model id、capability tags。 |
| Model slot selection | CodingProfile model slots | rewrite | base/coding/review/fast/local 分离。 |
| Streaming request adapter | Provider adapters | copy | 只迁入协议无关的 SSE/stream 健壮性。 |
| Usage / rate limit facts | RuntimeEvent diagnostics / Provider telemetry | rewrite | 不进入正文,不影响 UI 状态机。 |
Skills / MCP / 外部 Harness
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| Skill directory discovery | Skill Catalog importer | rewrite | 可识别多生态目录,但事实源是 Lime catalog。 |
| Skill front matter parser | Skill standard parser | copy | 只迁通用 markdown/front matter 解析思路。 |
| MCP client transport | lime-rs/crates/mcp / tool inventory |
reference | 以 Lime MCP owner 为准。 |
| External CLI session event | external_harness adapter -> RuntimeEvent |
reference | 只能作为 compat adapter,不主导 runtime。 |
| CLI plugin installer | forbidden | forbidden | 不把第三方 CLI 插件作为 Lime 生产依赖。 |
UI / 产品形态
| 参考能力 | Lime current 落点 | 分类 | 说明 |
|---|---|---|---|
| 中央预览 + 右侧对话 | Coding Workbench | reference | 只借结构,不复制视觉和框架。 |
| CLI agent session side panel | external harness diagnostics | reference | 可显示外部 harness 状态,不作为主链。 |
| Terminal-first UI | forbidden | forbidden | Lime 是 GUI 桌面产品,不退化成终端壳。 |
| Native UI framework | forbidden | forbidden | Lime 继续 Electron + React + AgentUI packages。 |
迁移优先级
P0:先补 current event spine
- Thread / Turn / Item 生命周期。
- Tool lifecycle pairing。
- Patch apply / file change facts。
- Command execution policy。
- Permission / sandbox facts。
退出条件:
- App Server current fixture 能产生同构 coding events。
@limecloud/agent-ui-contractsschema / sequence gate 能拒绝孤立或终态后的执行事件。- Rust owner 不依赖 legacy desktop facade 或生产 mock fallback。
P1:迁入 patch / command / policy owner
- Patch parser / streaming parser / apply service:已迁入
apply-patchcrate,并通过 agentapply_patchtool 与 App Server patch mirror 消费 parser/apply facts;真实 apply service 已支持 workdir 内 add/update/delete/move、缺父目录创建、Unicode 标点模糊匹配和 path escape 拒绝。 - File / command / patch execution adapter:已完成 runtime tool event mirror、agent
apply_patchtool 入口接线、per-file patchcheckpointRef/contentRef/diffRefmetadata 和结构化 diff 预览、真实 tool permission denial outcome metadata、基础 policy/action/sandbox diagnostics facts,以及 backend metadata 中outputRef/refIds/artifactRefs/checkpointRef/contentRef/diffRef的透传、artifact/read-model 聚合、file checkpoint API read/list/get/diff/restore 基础投影、output snapshot owner、file checkpoint snapshot owner、current timeline snapshot refs hydrate;下一步补真实 Policy service / 分平台 sandbox backend 与 UI evidence。 - Approval / sandbox policy:基础 RuntimeEvent/action owner、
execution/sandbox.rs基础 owner、execution/rules.rs默认规则 catalog、execution/service.rsresolver owner、持久化 / 组织 / 用户 / runtime / 请求级shellCommandRules/networkRules合并、regex/prefix/exact命令规则、URL / host network 规则、人工确认后工具续跑库内测试,以及 macOS/Linux workspace sandbox runner 已接入;Windows readiness、setup mode、restricted-token runner、ACL/Job/ConPTY 生命周期与 world-writable warning 已接入 current owner,并由 Windows runner schema v37/7evidence 支撑;unelevated current-user runner 拒绝 managed network,elevated runner 使用 sandbox account 与 Firewall/WFP artifact。 - Output spill refs:事件级大输出规整、文件系统 snapshot owner 与跨 timeline hydrate 已接入;剩余是 GUI 读取证据。
退出条件:
- patch 成功/失败、patch parser paths /
invalid_patch分类、apply-patch真实落盘 service、agentapply_patchtool 入口接线、多文件 patchfile.changed投影、per-file patchcheckpointRef/contentRef/diffRef透传、文件读写、命令 lifecycle、测试命令 lifecycle、action resolved tool 回填、真实工具权限拒绝 metadata、命令被拒绝、沙箱阻断、基础 policy/sandbox diagnostics、sandbox 基础 owner、默认 policy rule catalog、PolicyService resolver owner、shell command rule classifier、持久化 / 组织 / 用户 / runtime / 请求级shellCommandRules/networkRules合并、审批后工具续跑、macOS/Linux sandbox backend runner 接线、output/artifact refs 透传、artifact/read-model 聚合、file checkpoint API read/list/get/diff/restore、tool terminal 大输出 payload 规整、文件系统 output snapshot owner、文件系统 checkpoint snapshot owner、跨 timeline hydrate、active command/test/action read model hydrate 已有 Rust 定向测试;Windows runner、Windows 实机 smoke 与 UI evidence 已由 current owner 与 schema v3 evidence 覆盖;后续只在 token/ACL/network 变更时回归。 - 所有副作用都有
toolCallId、artifactId、checkpointId、actionId或等价 owner id。 - 失败分类不靠 stdout/stderr 文本解析。
P2:再补 coding profile 投影
- FileChangeView。
- PatchView。
- CommandOutputView。
- TestRunView。
- ApprovalView。
- CodingDiagnosticsView。
退出条件:
CodingWorkbenchView可从 conformance fixtures 与 App Server read model 双路径重建。- active command/test/action 刷新后可 hydrate,并已通过 projection / Workspace adapter 定向测试进入 view model。
degraded/stale/blocked不被伪造成成功或普通 assistant 回复。
P3:接 Workspace UI 和 GUI smoke
- 旧 thread item adapter 只作为 migration 输入。
- Coding Workbench 消费
CodingWorkbenchView。 - GUI smoke 覆盖真实 current fixture。
退出条件:
changeView / summaryView由CodingWorkbenchView派生;审批、诊断和后台终端沿 canonical owner 展示。- 右侧审批卡和失败继续修复入口只调用 runtime client command callbacks。
- 用户可见文案覆盖
zh-CN / zh-TW / en-US / ja-JP / ko-KR。
P4:最后接外部 harness
- 外部 CLI agent 只作为
external_harness。 - 事件必须转成 Lime RuntimeEvent。
- 不允许外部 harness 直接写 artifact/evidence truth。
退出条件:
- 外部 harness 缺事件时 UI 显示
degraded,不从日志文本猜测。 - 外部 harness 自选模型只进入 diagnostics,不成为 Lime routing truth。
- 生产默认不要求安装外部 CLI 才能完成 coding turn。
禁止清单
- 引入外部 app-server 为 Lime current runtime。
- 引入外部 home/config/data root。
- 让外部 CLI 决定 Provider / model routing。
- 在文档、命名、crate、command、UI 文案中保留外部品牌。
- 复制 AGPL 来源代码。
- 复制任何 secret-bearing logging / raw payload 投影方式。