diff --git a/README.md b/README.md index dc7a1ee..40d886d 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ - 受控 Mac 需要先安装并授权 `cua-driver`;Boss runtime 会优先搜索 `PATH`,再搜索 `~/.local/bin/cua-driver`、`/usr/local/bin/cua-driver`、`/opt/homebrew/bin/cua-driver` 和 `/Applications/CuaDriver.app/Contents/MacOS/cua-driver`;如果仍找不到,会明确返回 `CUA_DRIVER_COMMAND_NOT_FOUND`,不会伪装成执行成功 - 当前默认本机配置已把 `browserAutomation / computerUse` 两项能力直接上报为在线起步态,所以 Boss App 里这台 Mac 会显示“可做浏览器控制 / 桌面控制”;如果某条链路要临时收起,只需要改 `local-agent/config.cloud.json` - 当前 `local-agent` 已新增 `Codex App Server` runner:boss-agent 默认打开 `codexAppServerEnabled`,通过 `codex app-server` stdio 接入 `conversation_reply / dispatch_execution`,也可灰度切到 `ws://127.0.0.1:` 或 `unix://PATH` 本机长驻 App Server;WebSocket/Unix WebSocket handshake 支持 `Authorization: Bearer `,优先用 `codexAppServerAuthTokenFile` 保存本地 token。失败时只在 turn 未启动前回退 `codex exec resume`,避免重复执行同一轮对话。设备 heartbeat 会单独上报 `codexAppServer` capability,并按 `codexAppServerDiscoveryTtlMs` 缓存 `model/list / skills/list / plugin/list / app/list / modelProvider/capabilities/read` 的能力摘要,供 APP/后台模型选择和治理页读取。2026-05-31 起,runner 会吸收 App Server 的 plan / diff / item / subagent 事件并归一到 Boss `execution_progress` 进度卡,执行中通过 `POST /api/v1/master-agent/tasks/[taskId]/progress` 实时刷新;后续已补 `approvals / warnings / fileChanges / threadStatus / realtime / modelRoute / tokenUsage / mcpServers / remoteControl / threadGoal / threadSettings / compaction / accountStatus / modelVerification / threadCollaboration / toolActivities / reasoningSummary / windowsSandbox` 等结构化摘要。Android 原生进度卡可显示线程状态、实时状态、线程配置、线程协作、工具活动、思考摘要、账号状态、运行状态、Windows 沙箱状态、安全提醒、审批状态和文件变更摘要,且不展示完整命令、diff、系统提示词、密钥、SDP、音频原始数据、raw realtime item、remote installationId、本地绝对路径或 Windows sandbox sourcePath。本机 `codex-cli 0.135.0-alpha.1` 协议快照已生成在 `docs/protocol-snapshots/codex-app-server/0.135.0-alpha.1/`。同日新增第一版 Inter-Thread Broker:任务携带源/目标 Codex 线程时可通过 `thread/read -> thread/inject_items -> turn/start` 完成受控线程协作;服务端新增 `POST /api/v1/projects/[projectId]/thread-collaboration` 作为 APP/后台可调用入口;任务携带 `targetCodexTurnId` 时 runner 会改用 `turn/steer` 干预活跃 turn。 +- 当前 App Server heartbeat discovery 已扩展到 `experimentalFeature/list / collaborationMode/list / permissionProfile/list / mcpServerStatus/list`,设备详情页会展示“治理:实验特性 / 协作模式 / MCP / 权限”摘要;MCP 只保留服务名、工具数量、资源数量和认证状态,permission profile 只保留 id/description,不保存本地路径、resource URI、文件规则、token 或工具参数。 - `GET http://127.0.0.1:4317/api/v1/skills` 正常,已返回本机扫描到的 Codex Skill - `POST http://127.0.0.1:4317/api/v1/heartbeat` 正常,且会顺带触发 `thread-context` 上报 - `local-agent` 当前每 5 秒轮询一次本机 Skill lifecycle 请求;默认打开 `skillLifecycleEnabled=true`。远程 `install` 或带 `sourceUrl` 的更新必须命中 `skillLifecycleAllowedSources` 或 `skillLifecycleTrustedSources`,为空时只允许既有本地 Skill 的 `update / rollback / uninstall / version_lock`;请求携带 `checksum / expectedChecksum` 时会校验 `manifest.json` 或 `SKILL.md` 的 sha256,失败会清理半安装目录或尽量恢复备份。卸载 / 更新 / 回滚前会在 `skillsDir/.boss-skill-backups` 保留备份,卸载仍限制在 `skillsDir` 目录内,版本锁写入 `.boss-skill-locks.json` diff --git a/docs/architecture/ai_handoff_index_cn.md b/docs/architecture/ai_handoff_index_cn.md index 5b5700c..b0966da 100644 --- a/docs/architecture/ai_handoff_index_cn.md +++ b/docs/architecture/ai_handoff_index_cn.md @@ -153,7 +153,7 @@ - Web 和原生 Android 当前都已经接上“新设备导入草稿 -> 勾选 -> 决议预览 -> 应用导入”的前台页面;已绑定生产设备继续保留 heartbeat 自动导入链路 - 原生首页的刷新失败策略当前已改成按当前 tab 独立判错,不会再因为 `设备 / 设置 / OTA` 的旁路请求失败把会话页刷新一并判成失败 - 当前量产方向已经明确为“Boss 企业控制面 + 可插拔执行协议”:多租户、权限、审批、审计、备份、回退和 Skill 治理由 Boss 承担,Codex App Server / Codex MCP / Codex CLI / Computer Use / 业务系统 API 都作为 provider 接入;详见 `docs/architecture/enterprise_ai_ops_architecture_cn.md` -- 当前 Codex App Server 已完成十二批接入:boss-agent 默认开启 `local-agent/codex-app-server-runner.mjs` 作为 Codex 绑定入口,优先走 `codex app-server` stdio,也可灰度连接 `ws://127.0.0.1:` 或 `unix://PATH` 同机长驻 App Server;长驻连接支持 `Authorization: Bearer `,配置上优先使用 `codexAppServerAuthTokenFile`。turn 启动前失败才回退 CLI,turn 启动后不重复执行;桌面远程控制默认先走 `codex-computer-use`,失败后回退 `cua-driver-computer-use`。2026-05-31 已按本机 `codex-cli 0.135.0-alpha.1` 生成协议快照 `docs/protocol-snapshots/codex-app-server/0.135.0-alpha.1/`,并把 `turn/plan/updated`、`turn/diff/updated`、`item/started|completed`、`thread/started`、`item/*/requestApproval`、`item/autoApprovalReview/*`、`guardianWarning`、`serverRequest/resolved`、`item/fileChange/patchUpdated`、`thread/status/changed`、`thread/realtime/*`、`model/rerouted`、`thread/tokenUsage/updated`、`mcpServer/startupStatus/updated`、`remoteControl/status/changed`、`windowsSandbox/setupCompleted`、`thread/goal/*`、`thread/settings/updated`、`thread/compacted`、`account/updated`、`account/rateLimits/updated`、`model/verification`、`warning`、`configWarning`、`deprecationNotice`、`ThreadItem.collabToolCall`、`ThreadItem.contextCompaction`、`mcpToolCall`、`dynamicToolCall`、`webSearch`、`imageView`、`imageGeneration`、`hook/started|completed`、`enteredReviewMode`、`exitedReviewMode`、`commandExecution`、`ThreadItem.plan`、`ThreadItem.reasoning.summary` 归一到 Boss `execution_progress` 卡片;realtime 只保留状态、文本摘要和计数,运行状态只保留模型切换、上下文用量、MCP 状态、远控连接摘要和 Windows 沙箱准备状态,线程配置只保留目标、模型、审批、沙箱、协作模式和压缩状态,线程协作只保留工具名、状态、目标类型和智能体状态,工具活动只保留类型、名称、状态和安全摘要,图像生成只保留状态与安全文件名,钩子生命周期只保留事件名、处理器类型、状态、来源、执行模式和耗时,思考摘要只保留官方 summary 文本和状态,账号状态只保留认证方式、套餐、额度窗口、积分余额和模型校验摘要,不保存 SDP、音频原始数据、raw item、remote installationId、cwd、turnId、配置文件路径、collab 源/目标线程 ID、collab prompt、tool arguments/result/contentItems、web URL token、命令正文/输出、raw reasoning content、reasoning item id、imageGeneration revisedPrompt/result、hook sourcePath/statusMessage/entries、Windows sandbox sourcePath/samplePaths/本地绝对路径或未清洗密钥。heartbeat 已能缓存 `model/list / skills/list / plugin/list / app/list / modelProvider/capabilities/read` 的能力摘要;同批已补 `turn/steer` 活跃 turn 干预和 `POST /api/v1/projects/[projectId]/thread-collaboration` 服务端线程协作排队入口。 +- 当前 Codex App Server 已完成十三批接入:boss-agent 默认开启 `local-agent/codex-app-server-runner.mjs` 作为 Codex 绑定入口,优先走 `codex app-server` stdio,也可灰度连接 `ws://127.0.0.1:` 或 `unix://PATH` 同机长驻 App Server;长驻连接支持 `Authorization: Bearer `,配置上优先使用 `codexAppServerAuthTokenFile`。turn 启动前失败才回退 CLI,turn 启动后不重复执行;桌面远程控制默认先走 `codex-computer-use`,失败后回退 `cua-driver-computer-use`。2026-05-31 已按本机 `codex-cli 0.135.0-alpha.1` 生成协议快照 `docs/protocol-snapshots/codex-app-server/0.135.0-alpha.1/`,并把 `turn/plan/updated`、`turn/diff/updated`、`item/started|completed`、`thread/started`、`item/*/requestApproval`、`item/autoApprovalReview/*`、`guardianWarning`、`serverRequest/resolved`、`item/fileChange/patchUpdated`、`thread/status/changed`、`thread/realtime/*`、`model/rerouted`、`thread/tokenUsage/updated`、`mcpServer/startupStatus/updated`、`remoteControl/status/changed`、`windowsSandbox/setupCompleted`、`thread/goal/*`、`thread/settings/updated`、`thread/compacted`、`account/updated`、`account/rateLimits/updated`、`model/verification`、`warning`、`configWarning`、`deprecationNotice`、`ThreadItem.collabToolCall`、`ThreadItem.contextCompaction`、`mcpToolCall`、`dynamicToolCall`、`webSearch`、`imageView`、`imageGeneration`、`hook/started|completed`、`enteredReviewMode`、`exitedReviewMode`、`commandExecution`、`ThreadItem.plan`、`ThreadItem.reasoning.summary` 归一到 Boss `execution_progress` 卡片;realtime 只保留状态、文本摘要和计数,运行状态只保留模型切换、上下文用量、MCP 状态、远控连接摘要和 Windows 沙箱准备状态,线程配置只保留目标、模型、审批、沙箱、协作模式和压缩状态,线程协作只保留工具名、状态、目标类型和智能体状态,工具活动只保留类型、名称、状态和安全摘要,图像生成只保留状态与安全文件名,钩子生命周期只保留事件名、处理器类型、状态、来源、执行模式和耗时,思考摘要只保留官方 summary 文本和状态,账号状态只保留认证方式、套餐、额度窗口、积分余额和模型校验摘要,不保存 SDP、音频原始数据、raw item、remote installationId、cwd、turnId、配置文件路径、collab 源/目标线程 ID、collab prompt、tool arguments/result/contentItems、web URL token、命令正文/输出、raw reasoning content、reasoning item id、imageGeneration revisedPrompt/result、hook sourcePath/statusMessage/entries、Windows sandbox sourcePath/samplePaths/本地绝对路径或未清洗密钥。heartbeat 已能缓存 `model/list / skills/list / plugin/list / app/list / modelProvider/capabilities/read / experimentalFeature/list / collaborationMode/list / permissionProfile/list / mcpServerStatus/list` 的能力摘要;同批已补 `turn/steer` 活跃 turn 干预和 `POST /api/v1/projects/[projectId]/thread-collaboration` 服务端线程协作排队入口。MCP 与权限 discovery 只保留安全摘要,不保存 resource URI、权限文件规则、工具参数、本地路径或 token。 - 当前 boss-agent 已支持 Mac OTA:`local-agent/boss-agent-ota-runner.mjs` 默认开启,每 5 分钟检查服务端最新包;状态页可手动检查或下载并安装,安装时保留原绑定配置,只更新版本号和本机 runtime 路径。最新验证版本为 `20260516221619`,已在 MacBook Air `macbook-air` 上确认 OTA 下载校验、暂存、覆盖安装后不会误切到默认 `config.cloud.json`。正式分发脚本已预留 Developer ID 公证路径:`BOSS_AGENT_NOTARIZE=1` 配合 notary profile 或 Apple ID 凭据。 - 当前量产治理已补设备撤权和任务可靠性底座:`revoke_device` 会清空设备 token、标记离线并阻断 heartbeat / 任务认领 / Skill 同步 / 日志上报 / boss-agent OTA;`MasterAgentTask` claim 会记录 attempt 和 lease,运行中任务可按租约重试,超过上限转 `timed_out`,用户或管理员可通过 cancel 接口转 `canceled` 且迟到 complete 不覆盖终态。 - 当前群聊 `dispatch_execution` 完成回写已补幂等,重复完成不会再向群聊重复追加结果 diff --git a/docs/architecture/api_and_service_inventory_cn.md b/docs/architecture/api_and_service_inventory_cn.md index 658f605..93b39fd 100644 --- a/docs/architecture/api_and_service_inventory_cn.md +++ b/docs/architecture/api_and_service_inventory_cn.md @@ -118,6 +118,7 @@ - 当前普通单线程 `conversation_reply` 在真正执行 `codex exec resume` 前,会先把 Boss 用户消息镜像进目标 Codex Desktop rollout;定位优先走 `state_5.sqlite`,不可用时回退扫描 `~/.codex/sessions`,并按 `sourceMessageId` 去重 - 当前 Codex Desktop 同步新增常驻刷新桥:`scripts/codex-desktop-refresh-bridge-daemon.mjs` 通过 launchd 监听 `127.0.0.1:4318`,暴露 `POST /api/v1/codex-desktop/refresh`、`GET /api/v1/codex-desktop/events`、`GET /api/v1/codex-desktop/events/recent` 和 `GET /api/v1/codex-desktop/capabilities`;`local-agent` 会优先调用 refresh endpoint,失败时回退到 `scripts/codex-desktop-refresh-hint.mjs` 命令式刷新。SSE 事件只包含线程引用、消息 ID、状态、deep link 等安全元数据,不包含用户正文或内部 prompt;`scripts/codex-desktop-event-consumer.mjs` 可作为 Desktop 插件/IPC 接入前的订阅 smoke;`scripts/codex-desktop-integration-probe.mjs` 负责只读探测 Codex.app 能力 - 当前新增 Codex App Server runner:`local-agent/codex-app-server-runner.mjs`。boss-agent 默认配置 `codexAppServerEnabled=true`,会接管 `conversation_reply / dispatch_execution`;它默认通过 stdio 启动 `codex app-server`,也支持 `codexAppServerTransport=ws + codexAppServerUrl=ws://127.0.0.1:` 或 `codexAppServerTransport=unix + codexAppServerUrl=unix:///absolute/path.sock` 连接同机长驻 App Server,bearer token 可通过 `codexAppServerAuthTokenFile` 读取并在握手时发送 `Authorization: Bearer `。runner 执行 `initialize -> thread/resume|thread/start -> turn/start|turn/steer`,并把 `item/agentMessage/delta` 或 `item/completed` 归一成 Boss 任务回复;当 App Server 对单个 JSON-RPC 请求返回 `-32001 / retry later` 时,runner 会做最多 3 次指数退避重试。turn 启动前失败可回退 CLI,turn 启动后失败不回退,避免重复执行。2026-05-31 起,runner 会把 `turn/plan/updated`、`turn/diff/updated`、`item/started|completed`、`thread/started` 归一成 `executionProgress.steps / branch / artifacts / agents`,把 `item/*/requestApproval`、`item/autoApprovalReview/*`、`guardianWarning`、`serverRequest/resolved`、`item/fileChange/patchUpdated` 归一成 `executionProgress.approvals / warnings / fileChanges`,把 `thread/status/changed`、`thread/realtime/started|transcript|outputAudio|itemAdded|error|closed` 归一成 `executionProgress.threadStatus / realtime`,把 `model/rerouted`、`thread/tokenUsage/updated`、`mcpServer/startupStatus/updated`、`remoteControl/status/changed` 归一成 `executionProgress.modelRoute / tokenUsage / mcpServers / remoteControl`,并把 `thread/goal/*`、`thread/settings/updated`、`thread/compacted`、`account/updated`、`account/rateLimits/updated`、`model/verification`、`warning`、`configWarning`、`deprecationNotice`、`ThreadItem.collabToolCall`、`ThreadItem.contextCompaction`、`mcpToolCall`、`dynamicToolCall`、`webSearch`、`imageView`、`imageGeneration`、`hook/started|completed`、`windowsSandbox/setupCompleted`、`enteredReviewMode`、`exitedReviewMode`、`commandExecution`、`ThreadItem.plan`、`ThreadItem.reasoning.summary` 归一成线程配置、账号状态、模型校验、安全提醒、线程协作、上下文压缩、工具活动、图片产物、钩子生命周期、Windows 沙箱准备状态、计划步骤和思考摘要;服务端 complete 回写会与本地 Git/GitHub 进度合并,且不保存 SDP、音频 base64、raw realtime item、remote installationId、cwd、turnId、配置路径、collab 源/目标线程 ID、collab prompt、tool arguments/result/contentItems、web URL token、命令正文/输出、raw reasoning content、reasoning item id、imageGeneration revisedPrompt/result、hook sourcePath/statusMessage/entries、Windows sandbox sourcePath/samplePaths/本地绝对路径或未清洗的 MCP 错误。heartbeat 同时支持按 TTL 拉取 `model/list / skills/list / plugin/list / app/list / modelProvider/capabilities/read`,并把摘要保存在 `capabilities.codexAppServer.metadata`。 +- App Server heartbeat discovery 现在还会按 TTL 拉取 `experimentalFeature/list / collaborationMode/list / permissionProfile/list / mcpServerStatus/list`,写入 `capabilities.codexAppServer.metadata.experimentalFeatures / collaborationModes / permissionProfiles / mcpServers`。这些字段用于 APP/后台治理页展示 Codex 当前可用的实验特性、多 Agent/协作模式、权限 profile 和 MCP 服务健康;MCP 请求固定使用 `detail=toolsAndAuthOnly`,服务端状态里不保存 resource URI、工具参数、permission profile 文件规则、本地路径或密钥。 - 当前 Codex App Server runner 已新增第一版 Boss Inter-Thread Broker:任务携带 `intentCategory=thread_collaboration`、`sourceCodexThreadRef` 和 `targetCodexThreadRef` 时,会先 `thread/read` 源线程,再通过 `thread/inject_items` 向目标线程注入受控摘要,最后 `turn/start` 目标线程;服务端入口是 `POST /api/v1/projects/[projectId]/thread-collaboration`,负责权限、源/目标线程校验和任务排队。这不是假设官方线程 P2P,而是 Boss 自己做线程协作编排。 - 当前 boss-agent Mac OTA 已接入:`local-agent/boss-agent-ota-runner.mjs` 会用设备 token 调 Boss 服务端 `/api/v1/boss-agent/ota` 检查最新 Mac 运行包,`/api/v1/boss-agent/ota/apply` 会下载 `boss-agent-mac-latest.zip`、校验 sha256、暂存安装 wrapper,并拉起本机安装器;安装脚本会保留绑定配置并只更新版本号与本机 runtime 路径。安装器会优先沿用当前 LaunchAgent active config,并保留所有 `config*.json`,避免多电脑场景中误绑定到默认设备配置。当前最新验证包为 `20260516221619`;构建脚本支持 `BOSS_AGENT_NOTARIZE=1` 的 Developer ID 公证路径。 - 当前 `local-agent` 还新增了两条统一电脑控制 runtime: diff --git a/docs/architecture/codex_server_progress_card_cn.md b/docs/architecture/codex_server_progress_card_cn.md index fb9f48d..d90436f 100644 --- a/docs/architecture/codex_server_progress_card_cn.md +++ b/docs/architecture/codex_server_progress_card_cn.md @@ -20,9 +20,9 @@ Boss 不能直接把 App Server 原始 Thread / Turn / Item 字段写进业务 2026-05-31 已继续把 `turn/plan/updated`、`turn/diff/updated`、`item/started|completed`、`thread/started` 这类协议事件归一化为 Boss `execution_progress` 的步骤、分支变更、产物和后台智能体。同日第二批补齐 `item/*/requestApproval`、`item/autoApprovalReview/*`、`guardianWarning`、`serverRequest/resolved` 和 `item/fileChange/patchUpdated` 的安全摘要映射,APP 只展示审批状态、风险提醒和文件路径,不展示完整命令、diff、系统提示词或密钥。第三批已把 `thread/status/changed` 与 `thread/realtime/*` 归一成 `executionProgress.threadStatus / realtime`,APP 只展示活跃/等待审批/等待用户输入、realtime 文本摘要、音频片段计数和关闭/错误原因;第四批已把 `model/rerouted`、`thread/tokenUsage/updated`、`mcpServer/startupStatus/updated` 和 `remoteControl/status/changed` 归一成 `executionProgress.modelRoute / tokenUsage / mcpServers / remoteControl`,用于 APP “运行状态”区块。 -2026-06-01 第五批已把 `thread/goal/updated|cleared`、`thread/settings/updated` 和 `thread/compacted` 归一成 `executionProgress.threadGoal / threadSettings / compaction`,用于 APP “线程配置”区块;第六批已把 `account/updated`、`account/rateLimits/updated`、`model/verification`、`warning`、`configWarning`、`deprecationNotice` 归一成 `executionProgress.accountStatus / modelVerification / warnings`;第七批已把官方 `ThreadItem.collabToolCall` 归一成 `executionProgress.threadCollaboration`,并按官方建议把新版 `ThreadItem.contextCompaction` 映射回 `executionProgress.compaction`;第八批已把 `mcpToolCall`、`dynamicToolCall`、`webSearch`、`imageView`、`enteredReviewMode`、`exitedReviewMode` 和 `commandExecution` 归一成 `executionProgress.toolActivities`;第九批已把官方 `ThreadItem.plan` 的最终 `item/completed` 文本映射为 `executionProgress.steps`,并把 `ThreadItem.reasoning.summary` 映射为 `executionProgress.reasoningSummary`;第十批已把 `ThreadItem.imageGeneration` 安全映射为 `executionProgress.toolActivities` 的图像生成活动和 `executionProgress.artifacts` 的图片产物;第十一批已把 `hook/started|completed` 安全映射为 `executionProgress.toolActivities` 的钩子活动,供 APP 以“钩子”轻卡展示企业治理和插件生命周期状态;第十二批已把 `windowsSandbox/setupCompleted` 安全映射为 `executionProgress.windowsSandbox`,供 APP 在“运行状态”里展示 Windows 沙箱准备状态、setup mode 和脱敏错误摘要。 +2026-06-01 第五批已把 `thread/goal/updated|cleared`、`thread/settings/updated` 和 `thread/compacted` 归一成 `executionProgress.threadGoal / threadSettings / compaction`,用于 APP “线程配置”区块;第六批已把 `account/updated`、`account/rateLimits/updated`、`model/verification`、`warning`、`configWarning`、`deprecationNotice` 归一成 `executionProgress.accountStatus / modelVerification / warnings`;第七批已把官方 `ThreadItem.collabToolCall` 归一成 `executionProgress.threadCollaboration`,并按官方建议把新版 `ThreadItem.contextCompaction` 映射回 `executionProgress.compaction`;第八批已把 `mcpToolCall`、`dynamicToolCall`、`webSearch`、`imageView`、`enteredReviewMode`、`exitedReviewMode` 和 `commandExecution` 归一成 `executionProgress.toolActivities`;第九批已把官方 `ThreadItem.plan` 的最终 `item/completed` 文本映射为 `executionProgress.steps`,并把 `ThreadItem.reasoning.summary` 映射为 `executionProgress.reasoningSummary`;第十批已把 `ThreadItem.imageGeneration` 安全映射为 `executionProgress.toolActivities` 的图像生成活动和 `executionProgress.artifacts` 的图片产物;第十一批已把 `hook/started|completed` 安全映射为 `executionProgress.toolActivities` 的钩子活动,供 APP 以“钩子”轻卡展示企业治理和插件生命周期状态;第十二批已把 `windowsSandbox/setupCompleted` 安全映射为 `executionProgress.windowsSandbox`,供 APP 在“运行状态”里展示 Windows 沙箱准备状态、setup mode 和脱敏错误摘要;第十三批已把 heartbeat discovery 扩展到 `experimentalFeature/list`、`collaborationMode/list`、`permissionProfile/list` 和 `mcpServerStatus/list`,供设备详情、APP 和 PC 后台看到实验特性、协作模式、权限 Profile 与 MCP 服务摘要。 -`thread/realtime/sdp`、音频 base64、原始 realtime item、remote installationId、thread settings 的 `cwd`、compaction `turnId`、collaboration settings 内部 prompt、collabToolCall 源/目标线程 ID、tool arguments/result/contentItems、web URL token、命令正文/输出、raw reasoning `content`、reasoning item id、imageGeneration 原始 result/revisedPrompt、hook id/sourcePath/statusMessage/entries、Windows sandbox sourcePath/samplePaths/本地绝对路径和未清洗的 MCP 错误不入账。 +`thread/realtime/sdp`、音频 base64、原始 realtime item、remote installationId、thread settings 的 `cwd`、compaction `turnId`、collaboration settings 内部 prompt、collabToolCall 源/目标线程 ID、tool arguments/result/contentItems、web URL token、命令正文/输出、raw reasoning `content`、reasoning item id、imageGeneration 原始 result/revisedPrompt、hook id/sourcePath/statusMessage/entries、Windows sandbox sourcePath/samplePaths、本地绝对路径、permission profile 文件规则、MCP resource URI 和未清洗的 MCP 错误不入账。 官方文档入口:`https://developers.openai.com/codex/app-server` @@ -44,7 +44,7 @@ Boss 不能直接把 App Server 原始 Thread / Turn / Item 字段写进业务 - 本机协议快照已生成到 `docs/protocol-snapshots/codex-app-server/0.135.0-alpha.1/`,共识别 137 个协议方法;确认支持 `thread/inject_items`、`thread/rollback`、`thread/goal/*`、`turn/steer`、`command/exec`、`thread/realtime/*`、`account/*`、`model/verification`、`configWarning`、`deprecationNotice`、`model/list` - Boss 当前默认仍以 `stdio` 作为本机 agent 接入方式;`ws://127.0.0.1:` 和 `unix://PATH` 本地长驻 transport 已可灰度接入,WebSocket/Unix WebSocket handshake 支持 `Authorization: Bearer `;非 loopback signed bearer/JWT、自动重连和健康探测仍保留为后续增强,不直接替换当前稳定链路 - 官方文档提示 WebSocket ingress 满载时会返回 JSON-RPC `-32001 / Server overloaded; retry later.`;Boss runner 已对该错误做最多 3 次指数退避重试,避免长驻连接瞬时拥塞直接把用户任务打失败 -- Boss heartbeat 已新增 App Server 能力发现缓存:按 `codexAppServerDiscoveryTtlMs` 拉取 `model/list`、`modelProvider/capabilities/read`、`skills/list`、`plugin/list`、`app/list`,归一成设备 `capabilities.codexAppServer.metadata`;发现失败只记录 warn,不阻塞心跳 +- Boss heartbeat 已新增 App Server 能力发现缓存:按 `codexAppServerDiscoveryTtlMs` 拉取 `model/list`、`modelProvider/capabilities/read`、`skills/list`、`plugin/list`、`app/list`、`experimentalFeature/list`、`collaborationMode/list`、`permissionProfile/list` 和 `mcpServerStatus/list`,归一成设备 `capabilities.codexAppServer.metadata`;发现失败只记录 warn,不阻塞心跳。MCP discovery 使用 `detail=toolsAndAuthOnly`,只保留服务名、工具数量、资源数量和认证状态,不保存 resource URI 或工具参数。 - Boss 第一批只用 App Server 做任务级 provider,不直接复用 ChatGPT Mobile 到 Codex App 的官方 relay;官方移动控制链路仍属于 ChatGPT App 与 Codex App 同账号/工作区之间的产品能力,不是第三方 Boss 可以稳定依赖的私有通道 下一轮再核对版本时,不要只看 npm 包版本号;必须同时读取 App Server schema / TypeScript 定义,并把 protocol snapshot 保存到 `docs/protocol-snapshots/codex-app-server//`。 diff --git a/docs/architecture/current_runtime_and_deploy_status_cn.md b/docs/architecture/current_runtime_and_deploy_status_cn.md index 1aed85f..a1078be 100644 --- a/docs/architecture/current_runtime_and_deploy_status_cn.md +++ b/docs/architecture/current_runtime_and_deploy_status_cn.md @@ -36,6 +36,7 @@ - 当前执行底座抽象层已落地在 `src/lib/execution/`,并已补齐 `ExecutionBackend / PromptAssembler / PermissionPolicy / RemoteRuntimeAdapter / OrchestrationBackend` 默认实现 - 当前生产主链仍然沿用 `local-agent -> codex exec resume -> /api/v1/master-agent/tasks/[taskId]/complete`,执行底座重构以“先抽象、不改行为”为准 - 当前 Codex server 调研结论已记录在 `docs/architecture/codex_server_progress_card_cn.md`:长期优先方向更新为 `Codex App Server / Remote Control -> Inter-Thread Broker -> CodexMcpBackendAdapter -> codex exec resume` 的分层 provider 策略;当前 boss-agent 默认打开 `Codex App Server` runner 作为 Codex 绑定入口,Boss 仍保留 `codex exec resume` 兜底,并继续用 `execution_progress` 结构化进度卡作为 APP 可见执行态。本机 `codex-cli 0.135.0-alpha.1` 协议快照已生成到 `docs/protocol-snapshots/codex-app-server/0.135.0-alpha.1/`,确认支持 WebSocket auth、`thread/inject_items`、`turn/steer`、`thread/realtime/*`、`thread/goal/*`、`thread/settings/updated`、`thread/compacted`、`ThreadItem.contextCompaction`、`ThreadItem.collabToolCall`、`account/*`、`model/verification`、`configWarning`、`deprecationNotice`、`command/exec` 和 `model/list` +- 当前 App Server 能力发现已新增治理摘要:local-agent 会在 heartbeat discovery 中拉取 `experimentalFeature/list / collaborationMode/list / permissionProfile/list / mcpServerStatus/list`,并把实验特性、协作模式、权限 Profile 与 MCP 服务状态写入设备 `codexAppServer.metadata`;设备详情页会显示“治理”摘要。该链路只保留安全摘要,不保存 MCP resource URI、permission profile 文件规则、本地路径、token 或工具参数。 - 当前量产 B+ 架构开发文档已新增:`docs/architecture/enterprise_ai_ops_architecture_cn.md`。该文档把 PPT 中的主 Agent / 业务 Agent / 老板端 / 经理端 / 员工端 / 治理层 / 系统层 / 设备层 / 执行层 / 接入层整理成后续产品架构约束,并明确数据库备份、业务回退、Codex 协议扩展和 Skill 治理方向;它是规划文档,不代表当前全部已落地 - 当前 `claw-code` 已以最小 `ClawBackendAdapter` 形式接入执行底座,但默认关闭;只有显式配置 `BOSS_CLAW_*` 且可用性探测通过时,`master-agent` 当前对话中才会出现并允许选择 `claw-runtime` - 当前已新增最小 `Telegram Gateway`:Boss 当前可直接暴露 Telegram webhook,把 Telegram 私聊或受控群聊文本桥接进 `master-agent` 或按群 / Topic 路由到指定 Boss 项目,并在主 Agent 异步任务完成后自动回推 Telegram;配置入口已接到 Web `/me/telegram` 和原生 Android `我的 > Telegram 接入` diff --git a/local-agent/codex-app-server-runner.mjs b/local-agent/codex-app-server-runner.mjs index 678e344..d018b84 100644 --- a/local-agent/codex-app-server-runner.mjs +++ b/local-agent/codex-app-server-runner.mjs @@ -1214,6 +1214,79 @@ function normalizeDiscoveryApps(result) { .filter(Boolean); } +function normalizeDiscoveryExperimentalFeatures(result) { + return asArray(result?.data) + .map((feature) => { + const name = trimToDefined(feature?.name); + if (!name) return null; + return { + name, + stage: safeProgressText(feature?.stage, 48) || "unknown", + displayName: trimToDefined(feature?.displayName) || name, + enabled: Boolean(feature?.enabled), + defaultEnabled: Boolean(feature?.defaultEnabled), + }; + }) + .filter(Boolean); +} + +function normalizeDiscoveryCollaborationModes(result) { + const modes = Array.isArray(result) + ? result + : asArray(result?.data).length > 0 + ? asArray(result?.data) + : asArray(result?.modes ?? result?.collaborationModes); + return modes + .map((mode) => { + const id = + trimToDefined(mode?.id) || + trimToDefined(mode?.name) || + trimToDefined(mode?.mode) || + (typeof mode === "string" ? trimToDefined(mode) : undefined); + if (!id) return null; + return { + id, + name: trimToDefined(mode?.name) || id, + displayName: trimToDefined(mode?.displayName) || trimToDefined(mode?.title) || id, + description: safeRuntimeDiagnosticText(mode?.description, 160), + }; + }) + .filter(Boolean); +} + +function normalizeDiscoveryPermissionProfiles(result) { + return asArray(result?.data) + .map((profile) => { + const id = trimToDefined(profile?.id) || trimToDefined(profile?.name); + if (!id) return null; + return { + id, + description: safeRuntimeDiagnosticText(profile?.description, 160), + }; + }) + .filter(Boolean); +} + +function normalizeDiscoveryMcpServers(result) { + return asArray(result?.data) + .map((server) => { + const name = trimToDefined(server?.name); + if (!name) return null; + const toolCount = + server?.tools && typeof server.tools === "object" && !Array.isArray(server.tools) + ? Object.keys(server.tools).length + : asArray(server?.tools).length; + return { + name, + authStatus: safeProgressText(server?.authStatus, 64) || "unknown", + toolCount, + resourceCount: asArray(server?.resources).length, + resourceTemplateCount: asArray(server?.resourceTemplates).length, + }; + }) + .filter(Boolean); +} + async function withCodexAppServerRpcSession(runnerConfig, callback) { const cwd = runnerConfig.cwd || process.cwd(); let closed = false; @@ -1293,6 +1366,9 @@ async function withCodexAppServerRpcSession(runnerConfig, callback) { title: runnerConfig.clientTitle, version: runnerConfig.clientVersion, }, + capabilities: { + experimentalApi: true, + }, }); notify("initialized", {}); return await callback(request); @@ -1316,12 +1392,27 @@ export async function discoverCodexAppServerCapabilities(runnerConfig) { return withCodexAppServerRpcSession(runnerConfig, async (request) => { const limit = runnerConfig.discoveryLimit ?? 20; - const [modelResult, providerCapabilities, skillsResult, pluginResult, appsResult] = await Promise.all([ + const cwd = runnerConfig.cwd || process.cwd(); + const [ + modelResult, + providerCapabilities, + skillsResult, + pluginResult, + appsResult, + experimentalFeaturesResult, + collaborationModesResult, + permissionProfilesResult, + mcpServersResult, + ] = await Promise.all([ safeRequest(request, "model/list", { includeHidden: false, limit }), safeRequest(request, "modelProvider/capabilities/read", {}), - safeRequest(request, "skills/list", { cwds: [runnerConfig.cwd || process.cwd()], forceReload: false }), - safeRequest(request, "plugin/list", { cwds: [runnerConfig.cwd || process.cwd()] }), + safeRequest(request, "skills/list", { cwds: [cwd], forceReload: false }), + safeRequest(request, "plugin/list", { cwds: [cwd] }), safeRequest(request, "app/list", { limit }), + safeRequest(request, "experimentalFeature/list", { limit }), + safeRequest(request, "collaborationMode/list", {}), + safeRequest(request, "permissionProfile/list", { cwd, limit }), + safeRequest(request, "mcpServerStatus/list", { limit, detail: "toolsAndAuthOnly" }), ]); const models = asArray(modelResult?.data) @@ -1346,14 +1437,30 @@ export async function discoverCodexAppServerCapabilities(runnerConfig) { skills: normalizeDiscoverySkills(skillsResult).slice(0, limit), plugins: normalizeDiscoveryPlugins(pluginResult).slice(0, limit), apps: normalizeDiscoveryApps(appsResult).slice(0, limit), + experimentalFeatures: normalizeDiscoveryExperimentalFeatures(experimentalFeaturesResult).slice(0, limit), + collaborationModes: normalizeDiscoveryCollaborationModes(collaborationModesResult).slice(0, limit), + permissionProfiles: normalizeDiscoveryPermissionProfiles(permissionProfilesResult).slice(0, limit), + mcpServers: normalizeDiscoveryMcpServers(mcpServersResult).slice(0, limit), errors: [ - modelResult?.__bossError ? `model/list:${modelResult.__bossError}` : undefined, + modelResult?.__bossError ? `model/list:${safeRuntimeDiagnosticText(modelResult.__bossError)}` : undefined, providerCapabilities?.__bossError - ? `modelProvider/capabilities/read:${providerCapabilities.__bossError}` + ? `modelProvider/capabilities/read:${safeRuntimeDiagnosticText(providerCapabilities.__bossError)}` + : undefined, + skillsResult?.__bossError ? `skills/list:${safeRuntimeDiagnosticText(skillsResult.__bossError)}` : undefined, + pluginResult?.__bossError ? `plugin/list:${safeRuntimeDiagnosticText(pluginResult.__bossError)}` : undefined, + appsResult?.__bossError ? `app/list:${safeRuntimeDiagnosticText(appsResult.__bossError)}` : undefined, + experimentalFeaturesResult?.__bossError + ? `experimentalFeature/list:${safeRuntimeDiagnosticText(experimentalFeaturesResult.__bossError)}` + : undefined, + collaborationModesResult?.__bossError + ? `collaborationMode/list:${safeRuntimeDiagnosticText(collaborationModesResult.__bossError)}` + : undefined, + permissionProfilesResult?.__bossError + ? `permissionProfile/list:${safeRuntimeDiagnosticText(permissionProfilesResult.__bossError)}` + : undefined, + mcpServersResult?.__bossError + ? `mcpServerStatus/list:${safeRuntimeDiagnosticText(mcpServersResult.__bossError)}` : undefined, - skillsResult?.__bossError ? `skills/list:${skillsResult.__bossError}` : undefined, - pluginResult?.__bossError ? `plugin/list:${pluginResult.__bossError}` : undefined, - appsResult?.__bossError ? `app/list:${appsResult.__bossError}` : undefined, ].filter(Boolean), }; }); diff --git a/src/components/app-ui.tsx b/src/components/app-ui.tsx index 96ff482..14e3626 100644 --- a/src/components/app-ui.tsx +++ b/src/components/app-ui.tsx @@ -83,6 +83,10 @@ export function buildDeviceWorkspaceDetailCards(workspace: DeviceWorkspaceView) const codexSkillCount = arrayLength(codexAppServerMetadata.skills); const codexPluginCount = arrayLength(codexAppServerMetadata.plugins); const codexAppCount = arrayLength(codexAppServerMetadata.apps); + const codexExperimentalFeatureCount = arrayLength(codexAppServerMetadata.experimentalFeatures); + const codexCollaborationModeCount = arrayLength(codexAppServerMetadata.collaborationModes); + const codexMcpServerCount = arrayLength(codexAppServerMetadata.mcpServers); + const codexPermissionProfileCount = arrayLength(codexAppServerMetadata.permissionProfiles); return { capabilities: { @@ -108,6 +112,7 @@ export function buildDeviceWorkspaceDetailCards(workspace: DeviceWorkspaceView) )}` : "模型:未发现", codexExtensions: `扩展:Skill ${codexSkillCount} 个 · Plugin ${codexPluginCount} 个 · App ${codexAppCount} 个`, + codexGovernance: `治理:实验特性 ${codexExperimentalFeatureCount} 个 · 协作模式 ${codexCollaborationModeCount} 个 · MCP ${codexMcpServerCount} 个 · 权限 ${codexPermissionProfileCount} 个`, preferredExecutionMode: `默认执行模式:${ selectedDevice?.preferredExecutionMode === "gui" ? "GUI" @@ -739,6 +744,9 @@ export function DeviceEditorCard({
{detailCards.capabilities.items.codexExtensions}
+
+ {detailCards.capabilities.items.codexGovernance} +
{detailCards.capabilities.items.preferredExecutionMode}
diff --git a/tests/device-detail-capabilities-route.test.ts b/tests/device-detail-capabilities-route.test.ts index 34a0e32..636ef81 100644 --- a/tests/device-detail-capabilities-route.test.ts +++ b/tests/device-detail-capabilities-route.test.ts @@ -73,6 +73,16 @@ test("device detail exposes Codex App Server discovered model and extension summ skills: [{ name: "image2-ui-prototype" }], plugins: [{ id: "github" }], apps: [{ id: "canva" }], + experimentalFeatures: [ + { name: "multi_agent", stage: "stable", enabled: true }, + { name: "apps", stage: "beta", enabled: false }, + ], + collaborationModes: [{ id: "solo" }, { id: "plan" }], + permissionProfiles: [{ id: ":workspace" }], + mcpServers: [ + { name: "github", toolCount: 2, authStatus: "oAuth" }, + { name: "figma", toolCount: 0, authStatus: "notLoggedIn" }, + ], }, }, }; @@ -84,6 +94,7 @@ test("device detail exposes Codex App Server discovered model and extension summ assert.equal(cards.capabilities.items.codexAppServer, "Codex App Server:已连接"); assert.equal(cards.capabilities.items.codexModels, "模型:2 个 · 默认 gpt-5.4 · 快速 gpt-5.4-mini · 深度 gpt-5.4"); assert.equal(cards.capabilities.items.codexExtensions, "扩展:Skill 1 个 · Plugin 1 个 · App 1 个"); + assert.equal(cards.capabilities.items.codexGovernance, "治理:实验特性 2 个 · 协作模式 2 个 · MCP 2 个 · 权限 1 个"); }); test("device detail exposes folder and project conflict skeleton from workspace policy", async () => { diff --git a/tests/device-heartbeat-capability-metadata.test.ts b/tests/device-heartbeat-capability-metadata.test.ts index 92116e9..513fa4a 100644 --- a/tests/device-heartbeat-capability-metadata.test.ts +++ b/tests/device-heartbeat-capability-metadata.test.ts @@ -59,6 +59,10 @@ test("device heartbeat preserves Codex App Server capability metadata", async () defaultModelId: "gpt-5.4", fastModelId: "gpt-5.4-mini", providerCapabilities: { webSearch: true }, + experimentalFeatures: [{ name: "multi_agent", stage: "stable", enabled: true }], + collaborationModes: [{ id: "plan" }], + permissionProfiles: [{ id: ":workspace" }], + mcpServers: [{ name: "github", toolCount: 2, authStatus: "oAuth" }], }, }, }, @@ -71,4 +75,14 @@ test("device heartbeat preserves Codex App Server capability metadata", async () const updatedDevice = nextState.devices.find((item) => item.id === device!.id); assert.equal(updatedDevice?.capabilities?.codexAppServer.metadata?.models?.[0]?.id, "gpt-5.4"); assert.equal(updatedDevice?.capabilities?.codexAppServer.metadata?.providerCapabilities?.webSearch, true); + assert.equal( + (updatedDevice?.capabilities?.codexAppServer.metadata?.experimentalFeatures as Array<{ name: string }> | undefined)?.[0] + ?.name, + "multi_agent", + ); + assert.equal( + (updatedDevice?.capabilities?.codexAppServer.metadata?.mcpServers as Array<{ toolCount: number }> | undefined)?.[0] + ?.toolCount, + 2, + ); }); diff --git a/tests/fixtures/codex-app-server-runtime.mjs b/tests/fixtures/codex-app-server-runtime.mjs index d56836e..3a49869 100644 --- a/tests/fixtures/codex-app-server-runtime.mjs +++ b/tests/fixtures/codex-app-server-runtime.mjs @@ -156,6 +156,116 @@ rl.on("line", (line) => { return; } + if (message.method === "experimentalFeature/list") { + send({ + id: message.id, + result: { + data: [ + { + name: "multi_agent", + stage: "stable", + displayName: "Multi agent", + description: "Allow spawned agents to coordinate work", + announcement: "internal token=sk-secret-should-not-leak", + enabled: true, + defaultEnabled: true, + }, + { + name: "apps", + stage: "beta", + displayName: "Apps", + description: "Enable app connectors", + announcement: null, + enabled: false, + defaultEnabled: false, + }, + ], + nextCursor: null, + }, + }); + return; + } + + if (message.method === "collaborationMode/list") { + send({ + id: message.id, + result: { + data: [ + { + id: "solo", + name: "solo", + displayName: "Solo", + description: "Single-thread execution", + }, + { + id: "plan", + name: "plan", + displayName: "Plan", + description: "Plan before coding", + }, + ], + }, + }); + return; + } + + if (message.method === "permissionProfile/list") { + send({ + id: message.id, + result: { + data: [ + { + id: ":workspace", + description: "Workspace write", + filesystem: { + "/Users/kris/code/boss": "write", + }, + }, + { + id: ":read-only", + description: "Read-only", + }, + ], + nextCursor: null, + }, + }); + return; + } + + if (message.method === "mcpServerStatus/list") { + send({ + id: message.id, + result: { + data: [ + { + name: "github", + tools: { + "repos/list": { name: "repos/list", description: "List repositories" }, + "issues/read": { name: "issues/read", description: "Read issues" }, + }, + resources: [ + { + name: "private repo token=sk-secret-should-not-leak", + uri: "file:///Users/kris/.ssh/id_ed25519", + }, + ], + resourceTemplates: [], + authStatus: "oAuth", + }, + { + name: "figma", + tools: {}, + resources: [], + resourceTemplates: [], + authStatus: "notLoggedIn", + }, + ], + nextCursor: null, + }, + }); + return; + } + if (message.method === "thread/resume") { send({ id: message.id, diff --git a/tests/local-agent-codex-app-server-runner.test.mjs b/tests/local-agent-codex-app-server-runner.test.mjs index b45d65f..fecbc98 100644 --- a/tests/local-agent-codex-app-server-runner.test.mjs +++ b/tests/local-agent-codex-app-server-runner.test.mjs @@ -8,6 +8,7 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import { + discoverCodexAppServerCapabilities, executeCodexAppServerTask, getCodexAppServerRunnerConfig, shouldUseCodexAppServerTaskRunner, @@ -15,6 +16,35 @@ import { const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +test("codex app-server discovery includes governance and MCP summaries without leaking internals", async () => { + const runnerConfig = getCodexAppServerRunnerConfig(process.env, { + codexAppServerEnabled: true, + codexAppServerCommand: process.execPath, + codexAppServerArgs: ["tests/fixtures/codex-app-server-runtime.mjs"], + codexAppServerWorkdir: repoRoot, + codexAppServerTimeoutMs: 5000, + codexAppServerDiscoveryLimit: 20, + }); + + const metadata = await discoverCodexAppServerCapabilities(runnerConfig); + + assert.equal(metadata.experimentalFeatures[0].name, "multi_agent"); + assert.equal(metadata.experimentalFeatures[0].stage, "stable"); + assert.equal(metadata.experimentalFeatures[0].enabled, true); + assert.equal(metadata.collaborationModes[1].id, "plan"); + assert.equal(metadata.permissionProfiles[0].id, ":workspace"); + assert.equal(metadata.mcpServers[0].name, "github"); + assert.equal(metadata.mcpServers[0].toolCount, 2); + assert.equal(metadata.mcpServers[0].authStatus, "oAuth"); + + const serialized = JSON.stringify(metadata); + assert.equal(serialized.includes("sk-secret-should-not-leak"), false); + assert.equal(serialized.includes("/Users/kris"), false); + assert.equal(serialized.includes("id_ed25519"), false); + assert.equal(serialized.includes("filesystem"), false); + assert.equal(serialized.includes("resources"), false); +}); + function encodeWsTextFrame(value) { const payload = Buffer.from(value); if (payload.length < 126) {