> 说明:这是首次交付时的验证报告,原文保留;报告里提到的 `imagegen-*.png` 实测图片没有随仓库上传,仅作记录。 # Codex + AGY 子代理预设 —— 交付报告 日期:2026-10-10 运行时:DeepSeek Harness Desktop **0.2.0-rc.2**(`/Applications/DeepSeek Harness.app`,运行中) --- ## 1. 做了什么 | # | 事项 | 状态 | | --- | --- | --- | | 1 | 升级 `@deepseek-ai/dsh-subagent-codex`:`0.0.1-rc.1` → **`0.2.0-rc.2`**(与运行时同版本线) | ✅ | | 2 | 新建预设 **「Codex + AGY」**(`id: codex-agy`),把 codex 与 agy 挂成子代理 | ✅ 已安装并激活 | | 3 | 封装 `codex_imagegen` 工具(Codex imagegen 的 DSH 工具壳) | ✅ 已实测出图 | | 4 | `codex_imagegen` 固定用 `gpt-6-astra` + `xhigh` 跑 codex(2026-10-10 追加) | ✅ 已实测出图 | | 5 | 预设加 **Reporting 规则**:每轮摘要必须说人话(2026-10-11 追加) | ✅ 已写入并重新激活 | | 6 | `codex_imagegen` 加 **批量声明** + `grid` 裁块能力(2026-10-11 追加) | ✅ 已实测:1 张图 → 6 块 | | 7 | 端到端验证 | 见第 5 节(agy 有一处账号侧的既有故障) | --- ## 2. 产物 ``` output/dsh-codex-agy-preset-20261010/ ├── bundle/ ← 已作为 bundle 安装进 desktop profile │ ├── package.json @local/dsh-codex-agy-preset(dsh.bundle.patch) │ ├── cordis.patch.yml 3 行:codex/agy 后端 + preset-codex-agy 声明 │ ├── codex.mjs re-export 官方 codex 子代理后端 │ ├── agy.mjs Antigravity CLI 一次性子代理适配器(原文件原样搬入) │ └── imagegen.mjs codex_imagegen 工具 ├── imagegen-smoke.png 实测产物(默认模型):1254×1254 PNG ├── imagegen-astra6-smoke.png 实测产物(gpt-6-astra + xhigh):1536×1024 PNG ├── imagegen-batch-sheet.png 实测批量:一张 2×3 天气图标母图(1536×1024) ├── imagegen-batch-sheet-r*c*.png 同一张母图裁出的 6 块(各 512×512) └── REPORT.md 本文件 ``` sha256: ``` 2eb6545b…ec87c902 bundle/imagegen.mjs (2026-10-11 起:批量声明 + grid 裁块) a30d6c93…fe66a15b bundle/imagegen.mjs (2026-10-10 19:11:默认 gpt-6-astra + xhigh) 0232bf93…4fe2e027 bundle/agy.mjs 2b722329…24d8bafa bundle/codex.mjs fd885d96…438586b bundle/cordis.patch.yml(含 Reporting 规则) 5be32f1f…82b39850 bundle/package.json 047bc0a9…f7ba86b4 imagegen-smoke.png da4ea30e…15ea53db imagegen-astra6-smoke.png 2b8dd3bc…f7e9ce3b imagegen-batch-sheet.png ``` ### 每轮摘要要说人话(2026-10-11 追加) 预设的 `persona.suffix` 里加了一段 **Reporting** 规则,约束每轮结束给用户的摘要: * 结论先行:一两句大白话说清"做了什么、成没成",细节放后面; * 写给不懂这个仓库和这些工具的聪明人看:缩写首次出现要展开,说"登录页"或文件真名,不甩内部 id / 工具名; * 说清对用户的影响:现在什么能用了、下一步能干什么、还有什么没通/没验证/在等他; 失败和保留意见必须单独成句,不准埋在术语或日志墙里; * 子代理的结果要自己转述,不把原始输出/日志/diff 粘进摘要,只给文件路径; * 短段落 + 少量要点优先,不要一堆原始数据表格;这轮什么都没变就直说,不许凑字数; * 用户用什么语言就用什么语言。 规则写在 [bundle/cordis.patch.yml](bundle/cordis.patch.yml) 的 `persona.config.suffix`;不想要就删掉那段 (或把整个 preset 切回 Standard)。只对**新会话**生效——老会话沿用启动时的预设版本。 ### 批量出图:一张母图 + 裁块(2026-10-11 追加) 工具描述里加了一条**批量声明**:需要一组相关图片(图标集、卡片/插画变体、sprite sheet)时, **不要一张一张地调**,而是一次生成一张排成 grid 的母图,再裁开。两种用法都合法: 1. 传 `grid: { rows, cols }`(1–16,含)→ 工具自己裁,产出 `-r{行}c{列}.png`; 2. 不传 `grid` → 自己用 bash(本机 `python3` + Pillow 11.3.0)裁。 传 `grid` 时,发给 Codex 的指令会同时要求"等距网格、每格一个完整主体、不跨格、沟槽无杂字", 保证裁出来的块对齐。裁块用 `python3 -c` 一段 Pillow 程序(argv 传参,不走 shell), 边界取 `floor(i*size/n)`:尺寸非整除时每块最多差 1px,且**像素不重不漏**。 验证: | 验证项 | 方法 | 结果 | | --- | --- | --- | | 裁块正确性 | 用桩替换 codex(把已有母图当产出),`grid {rows:2,cols:3}` | 6 块各 512×512,逐像素等于源图对应区域 | | 奇数尺寸 | 1537×1025 母图切 3×3 | 9 块覆盖 1,575,425 px = 全图,无重叠无缺口 | | 不传 grid | 同上桩 | 只产出母图,不裁 | | 非法 grid | `rows:0` / 缺 `cols` | 明确报错并给出取值区间 | | 真跑批量 | 真实生成"6 个天气图标"母图 + `grid {rows:2,cols:3}` | **54s**:一张整齐的 2×3 母图,裁出 6 块,块内主体居中 | ### codex_imagegen 的模型(2026-10-10 追加) 工具调 codex 时固定带: ``` codex exec --skip-git-repo-check --color never -C \ -m gpt-6-astra -c model_reasoning_effort="xhigh" ``` * `gpt-6-astra` = 本机 `~/.codex/models_cache.json` 里唯一的 Astra 模型(display `GPT-6-Astra`,支持 `low/medium/high/xhigh/max/ultra`);用户说的 "astra6" 即此 slug。 * 默认值写在 `imagegen.mjs` 的 `DEFAULT_MODEL` / `DEFAULT_REASONING_EFFORT`,行配置里也显式写了同名两项;把行配置改成 `model: null` / `reasoningEffort: null` 可退回 Codex 自己的默认值。 --- ## 3. 安装状态(profile 已被改动) * 安装方式:`plugin_manager install_bundle`,target = `…/dsh-codex-agy-preset-20261010/bundle` → `application: applied`,`warnings: []` * 落盘位置:`~/.dsh/profiles/desktop/node_modules/@local/dsh-codex-agy-preset` → 软链到上面的 bundle 目录 (`package.json` 里新增 `"@local/dsh-codex-agy-preset": "link:…"`) * 运行中的三条 row 全部 `active`: | entryId | 模块 | 作用 | | --- | --- | --- | | `include:subagent-codex-backend` | `@local/dsh-codex-agy-preset/codex` | 注册 provider `codex`(host 层) | | `include:subagent-agy-backend` | `@local/dsh-codex-agy-preset/agy` | 注册 provider `agy`(host 层) | | `include:preset-codex-agy` | `@deepseek-ai/dsh-agent-preset` | 声明预设「Codex + AGY」(order 10) | 预设提供的工具:`subagent_codex`、`subagent_agy`、`codex_imagegen`(外加原有的 `subagent` / `subagent_fork` / `workflow` 等标准工具)。 --- ## 4. 怎么用 1. 在 Web GUI 新建一个会话,在**预设选择器**里选 **「Codex + AGY」**。 (老会话沿用启动时的组合,必须新建会话才生效。) 2. 可用的委派工具: * `subagent_codex` —— 把一整段自包含任务交给 Codex CLI;它在**当前会话的工作目录**里自己读写文件。 * `subagent_agy` —— 把任务交给 Antigravity CLI(print 模式,强制走 127.0.0.1:12450 代理)。 * `codex_imagegen` —— 传 `prompt`(可选 `out` 绝对路径、`refs` 参考图),返回成图路径;内部用 `gpt-6-astra` + `xhigh` 跑 codex。 要一批图时传 `grid: {rows, cols}`:只生成一张母图,工具自动裁成多块。 3. 这个预设的每轮收尾摘要按 **Reporting** 规则写:结论先行、大白话、说清影响和没通的地方。 4. 切回原状:预设选择器里改回 **Standard**。 --- ## 5. 验证记录 | 验证项 | 方法 | 结果 | | --- | --- | --- | | patch 能组合 | `dsh --profile headless --patch …/cordis.patch.yml --dump-config` | exit 0,三行按预期追加 | | 插件语法 | `node --check codex.mjs / agy.mjs / imagegen.mjs` | 全部通过 | | 工具注册形状 | 用假 ctx 调 `apply()`,检查 `ctx.tools.register` 入参 | `codex_imagegen`,`timeoutMs=900000`,schema 合法 | | **codex_imagegen 真跑** | 直接调工具 `execute()`:生成"白底红苹果"到指定路径 | **78s 出图**,1254×1254 PNG,已肉眼确认 | | argv 正确性 | 把 `command` 指向桩脚本,读取实际 argv | `… -m gpt-6-astra -c model_reasoning_effort="xhigh" …`,顺序正确 | | **astra6/xhigh 真跑** | 更新后再次 `execute()`:生成"白底蓝色纸飞机" | **44s 出图**,1536×1024 PNG,已肉眼确认 | | codex 子代理链路 | 用后端自带 `@openai/codex 0.153.4` 跑 `app-server --stdio` 握手 + `initialize` + `thread/start` | 成功;`codexHome=/Users/jingfu-shen/.codex`(已登录 ChatGPT) | | provider 注册 | 两条 backend row `fiberPhase: active`(`apply()` 未抛错即注册成功) | 成功 | | agy 链路 | `env HTTP(S)_PROXY=…:12450 agy --output-format json --print='…'` | ⚠️ **账号侧失败**,见下 | ### agy 的既有故障(不是本次改动引入) ``` {"status":"ERROR","error":"Eligibility check failed: Your current account is not eligible for Antigravity, because it is not currently available in your location."} ``` 代理端口是通的(`nc -z 127.0.0.1 12450` → OPEN;`scutil --proxy` 指向 12450),所以这不是 适配器那条"代理不可达"的诊断路径,而是 Antigravity 服务端对账号/地区资格的拒绝。 **agy 的接线是好的,能不能用取决于这个账号当前是否被 Antigravity 放行。** --- ## 6. 回滚 ```text # 1) 卸载预设与两个后端(profile 复原) plugin_manager action=remove_bundle target=@local/dsh-codex-agy-preset # (等价手工方式:删掉 ~/.dsh/profiles/desktop/package.json 里的 # "@local/dsh-codex-agy-preset" 依赖与 dsh.profile.bundles 里的同名项, # 再删 node_modules/@local;desktop profile 不能由 dsh CLI 管理, # `dsh plugin --profile desktop …` 会被拒绝) # 2) 还原 codex 后端包版本(若需要) cd ~/.dsh/subagent-backends cp package.json.bak-1791625085 package.json npm install --omit=dev --ignore-scripts ``` 卸载 bundle 后 `preset-codex-agy` 行消失,标准预设不受影响。 --- ## 7. 已知注意点 * **改完插件代码要让运行中的进程重新加载模块**:bundle 是软链到工作区目录的,所以文件改动立刻落盘,但已加载的 ESM 模块在进程内有缓存。本次已经用 `plugin_manager set_bundle` 关→开各一次(两次都 `application: applied`,三条 row 重新 `active`)来强制重新激活;若你发现工具行为仍是旧版,**退出并重开 DeepSeek Harness** 即可拿到全新模块。 * 重新 `install_bundle` 同一个本地路径会返回 `ambiguous-install`(`changed: false`)——这是 link 依赖的重装歧义,不是故障;不要用卸载重装来"刷新",要么 set_bundle 开关,要么重启。 * **provider 名全局唯一**:`codex` / `agy` 已在 host 层注册。不要再在 profile 补丁或别的 bundle 里注册同名 provider,否则第二次注册会抛 `DUPLICATE_PROVIDER` 并把整个挂载打回。 * **不要手改 `~/.dsh/profiles/desktop/cordis.patch.yml`**:该文件在 GUI 保存设置时会被重写(你 9-28 手写的 codex/agy host 行就是这样丢的,只剩 `cordis.patch.yml.bak-1791224742756` 里还有)。preset 走 bundle 安装才能存活。 * `~/.dsh/.agent-presets/`(含 `anchored-standard/`)**已经不被读取**(官方 registry 明确不扫描目录),可以当历史备份留着或删掉。 * codex 子代理用的是后端包**自带的 codex 0.153.4**(`node …/@openai/codex/bin/codex.js app-server --stdio`),不是你 PATH 上的 codex-cli 0.160.0;`codex_imagegen` 用的则是 PATH 上的 `codex`(0.160.0,已登录账号)。 * 升级后端包时,`codex.mjs` 里的绝对路径不变,但需要同步 `~/.dsh/subagent-backends` 里的版本与运行时对齐(当前 `0.2.0-rc.2`)。