A local plugin for image-heavy chats in Codex, Claude Code and other agents: earlier images stop going out with every message, and the model fetches the one it needs by its ID, also after compaction.
TypeScript ai-agentsclaude-codeclaude-code-plugincodexcodex-plugincontext-managementdeveloper-toolsimage-generationmcpmultimodal
docs: the multimodal tax, a platform table, and how to connect an agent
chipfighter4f4dd9d4e2f6
diff --git a/ADAPTERS.md b/ADAPTERS.mdnew file mode 100644index 0000000..14ffe35--- /dev/null+++ b/ADAPTERS.md@@ -0,0 +1,85 @@+# Connecting an agent++Context Attachment Manager cuts the multimodal tax on any agent: earlier turns' images go out as short placeholders, and the model pulls back the one it needs by its id. The plugin has three layers:++- **The core** (`plugin/src/core`) knows no platform. It decides what to leave out, numbers the images and keeps them for the fetch tool.+- **Request-format translators** (`plugin/src/adapters/protocols`) find the images in a request and put the core's decision into it. Four formats today: OpenAI Responses, OpenAI Chat Completions, Anthropic Messages, Gemini generateContent.+- **Platform adapters** (`plugin/src/adapters/<name>`) are thin: where the platform's requests go, how they name their session, how the user connects it.++The panel (pick images, pin, search) is only in Codex and Claude Desktop. Every other agent uses the core alone: auto-select is always on, and the model fetches an image with `cam_view_image` when it needs it.++## Agents you can connect now++These adapters were written from each agent's code and docs and are **not tested live yet**. If one does not work for you, please [open an issue](https://github.com/chipfighter/context-attachment-manager/issues) with what you saw.++All of them need this repository on your computer and Node.js 24 or later. From the repository folder, run `cam connect <agent>` (`cam.cmd` on Windows). It registers a route in the local engine, from a local address to where the agent's requests go now, and prints the exact settings to change. It changes no file of the agent's.++### WorkBuddy++```bash+cam connect workbuddy+```++WorkBuddy's agent sends OpenAI Chat Completions requests to `CODEBUDDY_BASE_URL`, by default `https://www.workbuddy.cn/v2`. The command prints the local address to put in `~/.workbuddy/settings.json` under `env`, and the MCP server to add for `cam_view_image`. Sessions come from WorkBuddy's `x-conversation-id` header; its side requests (`x-agent-type: auxiliary`) pass unchanged.++### OpenCode++```bash+cam connect opencode --base-url https://api.anthropic.com/v1+```++Give the address your provider uses now (Anthropic, OpenAI, an OpenAI-compatible service, Google). Put the printed address in `opencode.json` as that provider's `options.baseURL`, and add the printed MCP server under `mcp`. OpenCode's requests name no session the engine can read, so sessions are told apart by their first prompt.++### Gemini CLI++```bash+cam connect gemini-cli+```++For an API key sign-in: set `GOOGLE_GEMINI_BASE_URL` to the printed address in `~/.gemini/.env`. For a Google sign-in: run `cam connect gemini-cli --base-url https://cloudcode-pa.googleapis.com` and set `CODE_ASSIST_ENDPOINT` instead. Add the printed MCP server under `mcpServers` in `~/.gemini/settings.json`.++### pi++```bash+cam connect pi --base-url https://api.anthropic.com+```++Give the address your provider uses now. Put the printed address in `~/.pi/agent/models.json` as that provider's `baseUrl`, and load our extension (`plugin/src/adapters/pi/extension.ts`, with `pi -e` or in `~/.pi/agent/extensions/`). The extension names each request's session and registers the MCP server.++### DeepSeek Harness++DeepSeek Harness needs no route: `plugin/src/adapters/dsh/plugin.ts` is a dsh plugin. In your composition's `cordis.yml`, replace the `@deepseek-ai/dsh-compaction-image-offload` row with one whose `name` is the path to that file. It keeps what dsh's own plugin does (offloading the oldest images when a route refuses a request as over its image budget) and adds auto-select: when a new turn starts, it offloads every image of the turns before. dsh shows an offloaded image as text with a read-only path, and the model reads it back from there.++## Adding your agent++A pull request that adds an agent touches these places:++1. **`plugin/src/adapters/<name>/platform.ts`**: the agent's entry, a `CorePlatform` (`plugin/src/core/platform.ts`). WorkBuddy's whole adapter:++ ```ts+ export const workbuddy: CorePlatform = {+ name: "workbuddy",+ title: "WorkBuddy",+ upstream: "https://www.workbuddy.cn/v2",+ sessionOf: (headers) => headerOf(headers, "x-conversation-id"),+ sideRequest: (headers) => headerOf(headers, "x-agent-type") === "auxiliary",+ connect: ({ url, mcp }) => [/* the steps cam connect prints */],+ };+ ```++2. **`plugin/src/platforms.ts`**: one line in `CORE_PLATFORMS`.+3. **Tests** in `spike/src/platforms.test.ts`: a request as your agent sends it, rewritten as expected. Run `node --test` from the repository root.+4. **The "Works with" table** at the bottom of `README.md` (and `README_CN.md`, `README_JA.md` if you can; we will fill them in otherwise): one row with a link, one line on what your agent is, and how far it is tested.++What the engine needs from an agent:++- **A way to send its model requests through the engine.** Usually a base URL setting; `cam connect` registers the route. The engine keeps every header except its own (`x-cam-*`), and the credentials stay in the agent's requests.+- **A request format the translators know.** The engine tells it by the path: `/chat/completions`, `/responses`, `/messages`, `:generateContent`, `:streamGenerateContent`. A new format is a new translator in `plugin/src/adapters/protocols/<format>/` and an entry in `spike/src/contract.test.ts`, which checks every translator the same way.+- **A session id, if it has one.** Name the header in `sessionOf`. An agent with extensions can add `x-cam-session` to each request instead (see the pi extension). Without either, sessions are told apart by their first prompt, which works but can merge two sessions that start with the same words.+- **An MCP server**, so the model has `cam_view_image`: `node plugin/src/plugin-server.ts` with `CAM_HOST=<name>`. It also keeps the engine running while the agent runs.++An agent that runs plugins inside its own process, like DeepSeek Harness, can do auto-select there instead of going through the engine. Keep its rule the same: when a new turn starts, earlier turns' images leave the request, and the model has a way to get one back.++## The panel++The panel stays in Codex and Claude Desktop. Other agents get no panel by default. If you want one for your agent, open an issue first: the panel layer (`plugin/src/panel`) reads everything through the core, and an adapter that shows it also has to store the user's choices per session (see `plugin/src/adapters/claude/panel-web.ts`).diff --git a/AGENTS.md b/AGENTS.mdindex 9d85e01..f8bf383 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -12,7 +12,7 @@ Context Attachment Manager(上下文素材管理器,2026-10-11 前叫 Codex- [docs/v0.7/plan.md](docs/v0.7/plan.md):v0.7 方案,Codex 的子代理和旁聊也自动选图(已发布 0.7.0)。- [docs/v0.8/plan.md](docs/v0.8/plan.md):v0.8 方案,模型给每张图写特征行、压缩后照样拿对图,面板改成搜索加缩略图(已发布 0.8.0)。- [docs/v0.10/plan.md](docs/v0.10/plan.md):v0.10 方案,压缩和续接之后照样拿回之前的图,编号不变(已发布 0.10.0;关卡结果见方案第 3 节)。-- [docs/v0.11/plan.md](docs/v0.11/plan.md):v0.11 方案,把插件拆成接入层、核心层、面板层,并接入 WorkBuddy(进行中)。+- [docs/v0.11/plan.md](docs/v0.11/plan.md):v0.11 方案,把插件拆成接入层、核心层、面板层,其他 Agent 平台只接核心、不带面板(第 1–8 步已在本机 main 上做完,没有推送)。- [docs/history/v0.1/](docs/history/v0.1/):v0.1 的开发记录(原方案、任务记录、各阶段报告、最初的构想),只作参考,不作依据。- [CHANGELOG.md](CHANGELOG.md):每个版本的更新记录,发布时就是 Release 说明。- [eval/README_CN.md](eval/README_CN.md):评测(英文版 [eval/README.md](eval/README.md)),装插件和不装插件的对比:方法、结果和复现步骤。这一份是 Codex 里的关键帧对话;Claude Code 里压缩两次再分叉的长任务在 [eval/long-task/](eval/long-task/README_CN.md)。diff --git a/README.md b/README.mdindex 24088f7..901621b 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@<h1 align="center">Context Attachment Manager</h1>-<p align="center"><b>Long image chats in Codex and Claude, without the lag.</b><br>The model manages its own images, pulling back only what it needs. And any image you made before is one search away: just describe what you remember.</p>+<p align="center"><b>Stop paying the multimodal tax.</b><br>Automatic context management for images: install it and forget it. Earlier images step aside, and the model pulls back the one it needs.<br>Works with Codex, Claude Code, WorkBuddy, OpenCode, Gemini CLI and more agents.</p><p align="center"><a href="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml"><img src="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml/badge.svg" alt="CI"></a>@@ -25,16 +25,23 @@<img src="docs/images/hero.png" alt="Three views of the panel on a task of period-drama keyframes. Auto-select: the model manages its own images, and the card shows the next request at 1.7 MB instead of 7.5 MB. Search: typing best face finds the close-up the user called the best face three turns ago. Preview: that close-up shown full size." width="100%"></p>-## Why I made this+## The multimodal tax-I was iterating on images with GPT in Codex. After a dozen or so, the chat started failing: it kept reconnecting and never got through. Every message was sending every image in the conversation again, about 44 MB each time. The only way out was a new chat, and with it, losing everything we had built up.+Use a multimodal model in any agent and the images pile up. The model remembers nothing between turns, so every request sends the whole chat again, every earlier image included. A dozen images in, each message uploads tens of megabytes: the chat gets slower and pricier, then keeps reconnecting and never gets through. The way out is a new chat, and everything you built up is gone.-So I made a panel that keeps the conversation and drops the weight.+That price, paid again and again for old images, is the multimodal tax.++## Where you pay it++- **Generating images in a chat**: keyframes, posters, product shots, several a turn.+- **Reading scanned PDFs**: every page is an image.+- **Letting AI drive a computer or a browser**: a screenshot every step.+- **Talking about photos, screenshots and charts**: a few turns, a pile of images.## What it does- **The model manages its own images.** Earlier images stay out of your messages, and when the model needs one, it pulls that one back by itself. Nothing to set up. Pin the ones that matter, like a character reference, and they go with every message.-- **Find any image by what you remember.** Search "best face" or "rainy night", filter by place, or browse by turn. Click one to see it full size.+- **Find any image by what you remember.** Search "best face" or "rainy night", filter by place, or browse by turn. Click one to see it full size (the panel in Codex and Claude Desktop).- **It remembers every image.** The model quietly notes what each image shows and what you said about it ("too dark", "best face"). Even far into a long chat, or after the chat is compacted, it picks the right one.- **Your chat stays light.** No more slowdowns or endless reconnecting. In a 15-image task, a request that carried 24.9 MB went out at 212 KB.@@ -61,7 +68,7 @@ Paste this to Codex, or to Claude in Claude Desktop's Code tab:Install the Context Attachment Manager plugin for me, following https://github.com/chipfighter/context-attachment-manager/blob/main/INSTALL.md```-Then restart Codex, or start a new session in Claude. To install or uninstall it yourself, see [INSTALL.md](INSTALL.md).+Then restart Codex, or start a new session in Claude. To install or uninstall it yourself, see [INSTALL.md](INSTALL.md). Using another agent? See [Works with](#works-with) at the bottom.## Privacy@@ -73,4 +80,21 @@ We ran a short-drama keyframe chat in Codex with and without the plugin: nine keWe also ran a longer task in Claude Code: 51 images, compacted twice, then forked. With and without the plugin the model found nearly every image (19 or 20 of 20 questions), because the images were files on disk it could read again; in a chat this short the plugin cost about 30% more. Details are in the [long-task eval](eval/long-task/README.md).+## Works with++The plugin's core knows no platform; each one gets a thin adapter. The panel is in Codex and Claude Desktop; on the other agents, auto-select works on its own and the model still pulls back any image by its id.++| Agent | What it is | Support |+|---|---|---|+| [Codex](https://github.com/openai/codex) | OpenAI's coding agent, desktop and CLI | Auto-select + panel, tested |+| [Claude Code](https://github.com/anthropics/claude-code) | Anthropic's coding agent, desktop and CLI | Auto-select + panel (desktop), tested |+| [WorkBuddy](https://www.workbuddy.cn) | Tencent's desktop AI work assistant, with CodeBuddy inside | Auto-select, new, feedback welcome |+| [OpenCode](https://github.com/anomalyco/opencode) | Open-source terminal coding agent for any model provider | Auto-select, new, feedback welcome |+| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | Google's open-source terminal agent | Auto-select, new, feedback welcome |+| [pi](https://github.com/earendil-works/pi) | Minimal, extensible terminal coding agent | Auto-select (pi extension), new, feedback welcome |+| [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | DeepSeek's agent harness where everything is a plugin | Auto-select (dsh plugin), new, feedback welcome |+| **Your agent** | A thin adapter; the core stays as it is | Send a PR and add your agent here: [ADAPTERS.md](ADAPTERS.md) |++To connect one of the new ones, see [ADAPTERS.md](ADAPTERS.md): `cam connect <agent>` prints the settings to change. Something off? [Open an issue](https://github.com/chipfighter/context-attachment-manager/issues).+<p align="center"><sub><a href="CHANGELOG.md">Changelog</a> · <a href="CONTRIBUTING.md">Contributing</a> · <a href="LICENSE">MIT License</a></sub></p>diff --git a/README_CN.md b/README_CN.mdindex 50de32e..b502df7 100644--- a/README_CN.md+++ b/README_CN.md@@ -4,7 +4,7 @@<h1 align="center">Context Attachment Manager</h1>-<p align="center"><b>在 Codex 和 Claude 里跟 AI 改图,聊再久也不卡。</b><br>模型自己管理图片,用到哪张取哪张;之前做过的图,凭印象一搜就到。</p>+<p align="center"><b>别再交多模态税。</b><br>多模态上下文的自动管理工具:装上就不用管,之前的图自动让位,模型要哪张取哪张。<br>Codex、Claude Code、WorkBuddy、OpenCode、Gemini CLI 等 Agent 平台都能接。</p><p align="center"><a href="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml"><img src="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml/badge.svg" alt="CI"></a>@@ -25,16 +25,23 @@<img src="docs/images/hero-zh.png" alt="面板的三个画面,任务是古装短剧的关键帧。自动选图:模型自己管理图片,卡片显示下一条请求约 1.7 MB,全部发送要 7.5 MB。凭印象找图:搜索“最好”,找到三轮前用户说脸最好的那张特写。预览:这张特写的大图。" width="100%"></p>-## 为什么做这个+## 什么是多模态税-我在 Codex 里用 GPT 反复生图、改图。图攒到十几张以后,对话开始出问题:一直在重连,怎么都发不出去。原来每发一条消息,对话里所有的图都要重新上传一遍,一次就是约 44 MB。唯一的办法是新开对话,前面攒下的东西也就全没了。+在任何 Agent 平台上用多模态模型,图都会越攒越多。模型不记事,每一轮请求都要把整段对话连同之前所有的图重新发一遍。图攒到十几张,发一条消息就要上传几十 MB:越聊越慢,越聊越贵,最后一直重连、发不出去,只能新开对话,前面攒下的东西全丢。-所以我做了这个面板:对话留着,负担卸掉。+这笔为旧图反复付出的代价,就是多模态税。++## 哪些时候在交++- **在对话里生图、改图**:关键帧、海报、商品图,一轮就是好几张。+- **读扫描版 PDF**:每一页都是一张图。+- **让 AI 控制电脑或浏览器**:每走一步就是一张截图。+- **跟模型聊照片、截图、图表**:聊几轮就是一堆。## 能做什么- **模型自己管理图片。** 之前的图不再跟着每条消息重发,要用哪张,模型自己把那一张取回来,什么都不用设置。要紧的图,比如角色参考图,可以固定成每条消息都带上。-- **凭印象找图。** 搜“脸最好”或者“雨夜”,按地点筛选,或者按轮翻看,点开就是大图。+- **凭印象找图。** 搜“脸最好”或者“雨夜”,按地点筛选,或者按轮翻看,点开就是大图(Codex 和 Claude 桌面版的面板)。- **每张图它都记得。** 模型会悄悄记下每张图画的是什么,以及你对它说过什么(“太暗”“这张脸最好”)。聊得再久,对话压缩过,它照样拿对图。- **对话一直轻快。** 不再越聊越慢、反复重连。一个 15 张图的任务里,原本 24.9 MB 的请求,发出去只有 212 KB。@@ -61,7 +68,7 @@ https://github.com/user-attachments/assets/b9767a20-8ca4-4a33-86bc-5e0a16a2ed13帮我安装 Context Attachment Manager 插件,按这里的说明来:https://github.com/chipfighter/context-attachment-manager/blob/main/INSTALL.md```-装好后重启 Codex,或者在 Claude 里新建一个会话。想自己动手安装或卸载,看 [INSTALL.md](INSTALL.md)(英文)。+装好后重启 Codex,或者在 Claude 里新建一个会话。想自己动手安装或卸载,看 [INSTALL.md](INSTALL.md)(英文)。用的是别的 Agent?见页面底部的[支持的平台](#支持的平台)。## 隐私@@ -73,4 +80,21 @@ https://github.com/user-attachments/assets/b9767a20-8ca4-4a33-86bc-5e0a16a2ed13我们还在 Claude Code 里跑了一段更长的任务:51 张图,压缩两次再分叉。装不装插件,模型都几乎找对了每张图(20 题答对 19 或 20 题),因为图都是磁盘上的文件,模型能再读一遍;在这么短的对话里,装插件多花约三成费用。详见[长任务评测](eval/long-task/README_CN.md)。+## 支持的平台++插件的核心不认平台,每个平台只有一层薄薄的接入。面板只在 Codex 和 Claude 桌面版上有;其他平台装上后自动选图,模型照样按编号取回原图。++| 平台 | 简介 | 接入情况 |+|---|---|---|+| [Codex](https://github.com/openai/codex) | OpenAI 的编程智能体,桌面版和命令行 | 自动选图+面板,已实测 |+| [Claude Code](https://github.com/anthropics/claude-code) | Anthropic 的编程智能体,桌面版和命令行 | 自动选图+面板(桌面版),已实测 |+| [WorkBuddy](https://www.workbuddy.cn) | 腾讯的桌面 AI 工作助手,内置 CodeBuddy | 自动选图,新接入,欢迎反馈 |+| [OpenCode](https://github.com/anomalyco/opencode) | 开源的终端编程智能体,能接任意模型服务 | 自动选图,新接入,欢迎反馈 |+| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | Google 开源的终端智能体 | 自动选图,新接入,欢迎反馈 |+| [pi](https://github.com/earendil-works/pi) | 极简、可扩展的终端编程智能体 | 自动选图(pi 扩展),新接入,欢迎反馈 |+| [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | DeepSeek 的智能体框架,一切皆插件 | 自动选图(dsh 插件),新接入,欢迎反馈 |+| **你的 Agent** | 写一层薄薄的接入,核心一行不用改 | 提个 PR,把你的平台加到这里:[接入说明](ADAPTERS.md)(英文) |++新接入的平台怎么接上,见 [ADAPTERS.md](ADAPTERS.md):一条 `cam connect <平台>` 命令给出要改的设置。用下来有问题,欢迎[提 issue](https://github.com/chipfighter/context-attachment-manager/issues)。+<p align="center"><sub><a href="CHANGELOG.md">更新记录</a> · <a href="CONTRIBUTING.md">参与开发</a> · <a href="LICENSE">MIT 许可证</a></sub></p>diff --git a/README_JA.md b/README_JA.mdindex c585c23..3df356b 100644--- a/README_JA.md+++ b/README_JA.md@@ -4,7 +4,7 @@<h1 align="center">Context Attachment Manager</h1>-<p align="center"><b>Codex や Claude で画像のやり取りを重ねても、会話を軽快に。</b><br>モデルが画像を管理し、必要なものだけを取り出します。以前作った画像も、覚えている特徴や感想で検索できます。</p>+<p align="center"><b>マルチモーダル税は、もう払わない。</b><br>画像コンテキストの自動管理ツール。入れたら後は任せるだけで、以前の画像は自動で外れ、必要な画像はモデルが取り出します。<br>Codex、Claude Code、WorkBuddy、OpenCode、Gemini CLI などのエージェントに対応。</p><p align="center"><a href="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml"><img src="https://github.com/chipfighter/context-attachment-manager/actions/workflows/ci.yml/badge.svg" alt="CI"></a>@@ -25,16 +25,23 @@<img src="docs/images/hero.png" alt="パネルの 3 つの表示例。自動選択では、すべての画像を送ると 7.5 MB のリクエストが約 1.7 MB に。検索では best face と入力して、以前いちばん良い顔だと評価した画像を探せます。プレビューでは、その画像を大きく表示できます。" width="100%"></p>-## 作った理由+## マルチモーダル税とは-Codex で GPT と画像の生成や修正を繰り返していたところ、画像が十数枚になった頃から、再接続を繰り返すばかりでメッセージを送れなくなりました。メッセージを送るたびに会話内のすべての画像が再送され、1 回で約 44 MB になっていたのです。新しい会話を始めれば送れますが、それまで積み重ねた内容を引き継げません。+どのエージェントでもマルチモーダルモデルを使えば、画像はたまっていきます。モデルはターンをまたいで記憶しないため、毎回のリクエストで会話全体を、以前の画像もすべて含めて送り直します。画像が十数枚になると、1 通ごとに数十 MB をアップロードすることになり、会話は遅く、高くなり、やがて再接続を繰り返して送れなくなります。新しい会話を始めれば送れますが、それまで積み重ねた内容は失われます。-そこで、会話を続けながら送信量を減らせるパネルを作りました。+古い画像のために何度も払うこのコストが、マルチモーダル税です。++## 払っている場面++- **会話の中で画像を生成・修正する**:キーフレーム、ポスター、商品画像など、1 ターンで何枚も。+- **スキャンした PDF を読ませる**:1 ページが 1 枚の画像です。+- **AI にパソコンやブラウザーを操作させる**:1 ステップごとにスクリーンショット。+- **写真・スクリーンショット・グラフについて話す**:数ターンで画像の山に。## できること- **モデルが画像を自分で管理。** 過去の画像を毎回送り直さず、必要な画像だけをモデルが取り出します。特別な設定は不要です。キャラクターの参考画像など、常に見てほしい画像は毎回送るように固定できます。-- **覚えていることから画像を検索。** 「いちばん良い顔」「雨の夜」などで検索したり、場所で絞り込んだり、会話のターンごとに画像を探したりできます。クリックすると大きなプレビューが開きます。+- **覚えていることから画像を検索。** 「いちばん良い顔」「雨の夜」などで検索したり、場所で絞り込んだり、会話のターンごとに画像を探したりできます。クリックすると大きなプレビューが開きます(Codex と Claude Desktop のパネル)。- **会話を圧縮した後も画像を探せる。** モデルは、画像の特徴とあなたの感想(「暗すぎる」「この顔がいちばん良い」など)を、会話の本文には表示せずに記録します。長い会話でも、会話を圧縮した後でも、必要な画像を探す手がかりになります。- **会話の送信量を削減。** 画像が 15 枚あるタスクのテストでは、24.9 MB あったリクエストが 212 KB になりました。@@ -46,7 +53,7 @@ Codex で GPT と画像の生成や修正を繰り返していたところ、画次の手順に従って、Context Attachment Manager プラグインをインストールしてください:https://github.com/chipfighter/context-attachment-manager/blob/main/INSTALL.md```-インストール後は Codex を再起動してください。Claude Desktop では **Code** タブで新しいセッションを始めてください。手動でのインストール、更新、アンインストールの手順は、共通の [INSTALL.md](INSTALL.md)(英語)にあります。+インストール後は Codex を再起動してください。Claude Desktop では **Code** タブで新しいセッションを始めてください。手動でのインストール、更新、アンインストールの手順は、共通の [INSTALL.md](INSTALL.md)(英語)にあります。ほかのエージェントをお使いの場合は、ページ下部の[対応エージェント](#対応エージェント)をご覧ください。## パネルを開く@@ -75,4 +82,21 @@ Codex で GPT と画像の生成や修正を繰り返していたところ、画Codex で短編ドラマのキーフレーム 9 枚、合計約 32 MB の画像を使い、プラグインの有無を比較しました。プラグインなしでは、再起動後や会話の圧縮直後に会話全体を再送するとリクエストが 42 MB になり、送信できませんでした。プラグインありでは同じリクエストが 0.12 MB になり、このテストでは会話の圧縮前後とも必要な画像を正しく選べました。検証方法、結果、再現手順は [eval](eval/README.md)(英語)をご覧ください。+## 対応エージェント++プラグインのコアはどのエージェントにも依存せず、エージェントごとに薄い接続層があるだけです。パネルは Codex と Claude Desktop のみで、ほかのエージェントでは自動選択がそのまま働き、モデルは番号で元の画像を取り出せます。++| エージェント | 概要 | 対応状況 |+|---|---|---|+| [Codex](https://github.com/openai/codex) | OpenAI のコーディングエージェント(デスクトップ版・CLI) | 自動選択+パネル、動作確認済み |+| [Claude Code](https://github.com/anthropics/claude-code) | Anthropic のコーディングエージェント(デスクトップ版・CLI) | 自動選択+パネル(デスクトップ版)、動作確認済み |+| [WorkBuddy](https://www.workbuddy.cn) | Tencent のデスクトップ AI アシスタント(CodeBuddy 内蔵) | 自動選択、新規対応、フィードバック歓迎 |+| [OpenCode](https://github.com/anomalyco/opencode) | どのモデルサービスにもつながるオープンソースのターミナル型エージェント | 自動選択、新規対応、フィードバック歓迎 |+| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | Google のオープンソースのターミナル型エージェント | 自動選択、新規対応、フィードバック歓迎 |+| [pi](https://github.com/earendil-works/pi) | ミニマルで拡張できるターミナル型コーディングエージェント | 自動選択(pi 拡張)、新規対応、フィードバック歓迎 |+| [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | すべてがプラグインの DeepSeek のエージェント基盤 | 自動選択(dsh プラグイン)、新規対応、フィードバック歓迎 |+| **あなたのエージェント** | 薄い接続層を書くだけで、コアは変更不要 | PR を送って、ここに追加してください:[ADAPTERS.md](ADAPTERS.md)(英語) |++新しく対応したエージェントの接続方法は [ADAPTERS.md](ADAPTERS.md)(英語)にあります。`cam connect <エージェント>` で変更する設定が表示されます。問題があれば [issue](https://github.com/chipfighter/context-attachment-manager/issues) でお知らせください。+<p align="center"><sub><a href="CHANGELOG.md">変更履歴(英語)</a> · <a href="CONTRIBUTING.md">開発への参加(英語)</a> · <a href="LICENSE">MIT ライセンス</a></sub></p>diff --git a/docs/design.md b/docs/design.mdindex c285fc6..9a0e630 100644--- a/docs/design.md+++ b/docs/design.md@@ -16,7 +16,7 @@另一条路线是在新任务里重建历史(阶段 0 验证过,技术上可行)。没有采用,因为用户要在同一个任务里看到连续的对话,见 [history/v0.1/phase0-report.md](history/v0.1/phase0-report.md)。-v0.11 起代码分成三层([v0.11/plan.md](v0.11/plan.md)):`core/` 是不认识任何平台的核心,`panel/` 是面板,`adapters/<平台>/` 是各平台的接入;`plugin/src` 顶层只放入口(`plugin-server.ts`、`proxy.ts`、`cam.ts`)和引擎的生命周期(`engine.ts`)。分层规则由 `spike/src/layers.test.ts` 检查。+v0.11 起代码分成三层([v0.11/plan.md](v0.11/plan.md)):`core/` 是不认识任何平台的核心,`panel/` 是面板,`adapters/<平台>/` 是各平台的接入;`plugin/src` 顶层只放入口(`plugin-server.ts`、`proxy.ts`、`cam.ts`)、引擎的生命周期(`engine.ts`)和平台登记表(`platforms.ts`)。分层规则由 `spike/src/layers.test.ts` 检查。Codex 和 Claude Code 带面板,接入层读它们自己的本地记录;其余平台只接核心,不带面板,见 [v0.11/plan.md](v0.11/plan.md) 第 3.8、3.9 节和对外的 [ADAPTERS.md](../ADAPTERS.md)。| 部分 | 代码(`plugin/src`) | 作用 ||---|---|---|@@ -31,6 +31,8 @@ v0.11 起代码分成三层([v0.11/plan.md](v0.11/plan.md)):`core/` 是不| Claude 会话索引和改写(v0.4) | `adapters/claude/claude-index.ts`、`adapters/claude/claude-rewrite.ts`、`adapters/protocols/anthropic-messages/rewrite.ts` | 从 Claude Code 的会话记录找图、编号,把请求里的图对上记录;把决定落进 Anthropic Messages 请求 || Claude 思考记录和提示缓存(v0.4、v0.10) | `adapters/protocols/anthropic-messages/thinking.ts`、`adapters/protocols/anthropic-messages/cache.ts` | 账号校验思考记录时,去掉和实际发出的历史对不上的思考;改过历史后,让提示缓存仍能读到 || 面板页(v0.4) | `panel/panel-web.js`、`panel/panel-language.ts`、`adapters/claude/panel-web.ts` | 引擎把 `panel.html` 作为网页提供时,代替 MCP 应用的宿主 |+| 只接核心的平台(v0.11) | `platforms.ts`、`core/platform.ts`、`core/request-index.ts`、`adapters/protocols/any.ts`、`adapters/protocols/openai-chat/rewrite.ts`、`adapters/protocols/gemini/rewrite.ts`、`adapters/{workbuddy,opencode,gemini-cli,pi}/platform.ts`、`adapters/pi/extension.ts` | 平台登记表和每个平台的条目;按路径认格式,从请求本身认图、按内容编号、存原图,自动选图一直开着;`cam connect` 登记线路;pi 的扩展加会话头、注册取图服务 |+| DeepSeek Harness(v0.11) | `adapters/dsh/plugin.ts` | dsh 插件,顶替官方的图片卸载插件:新一轮开始时卸载之前各轮的图,图片超预算时照旧卸载最旧的 |引擎和插件服务之间只通过数据目录里的文件共享状态,任何一方不在,另一方都照常工作。diff --git a/docs/spec.md b/docs/spec.mdindex 3461e34..8ae50ff 100644--- a/docs/spec.md+++ b/docs/spec.md@@ -216,7 +216,8 @@ v0.1 到 v0.3 都不做下面这些。其中音频和其他语言已确认是后- 浏览器和电脑操作截图的专门规则(例如同一轮只发最近几张):另议。- v0.11 也不做:- 新平台的面板(用户 2026-11-02 定:默认不带,用户主动要求时再接);- - 让模型请求经过不了引擎的客户端:省略旧图要让引擎站在客户端和模型 API 之间,只有能改 API 地址或走代理的客户端接得进来;MCP 只能给模型加取图工具,不能从客户端发出的历史里删图;+ - 让模型请求经过不了引擎、自己也没有能改历史的插件的客户端:省略旧图要么让引擎站在客户端和模型 API 之间,要么用客户端自己的插件改历史(DeepSeek Harness);MCP 只能给模型加取图工具,不能从客户端发出的历史里删图;+ - Antigravity(用户 2026-11-02 定);- 跨请求格式的转换:翻译器只改图片相关的几处,请求照原格式发往原服务(v0.9 的规则不变);- 拆成多个仓库(用户 2026-11-02 定;拆成多个包以后看情况)。@@ -362,7 +363,8 @@ v0.1 之前的阶段验收(阶段 0 的重建路线、代理路线 P2)都已1. 代码分成接入层、核心层、面板层,分层检查测试通过:核心层不引用接入层和面板层,面板层只经核心的公开接口。2. Codex 和 Claude 的行为不变:原有单元测试和冒烟测试全过;各种勾选组合下改写结果和拆之前逐字节相同;模型自测不退化(gpt-6-sol,中英文)。3. 有对外的接入接口文档(英文)和契约测试;面板在文档里是可选的一节,新平台默认不接。-4. WorkBuddy:装上后官方模型的请求经过引擎,之前各轮的图按自动选图省略,模型能按编号取回;不带面板。实跑一轮验证。+4. 其他平台只接核心、不带面板:WorkBuddy、OpenCode、Gemini CLI、pi 的请求经过引擎,之前各轮的图按自动选图省略,模型能按编号取回;DeepSeek Harness 用顶替官方插件的 dsh 插件,新一轮开始时卸载之前各轮的图。用户 2026-11-02 定不在本机实跑:按各平台的代码和文档写接入,用合成请求测试,README 的平台表标明没实测,等用户反馈。+5. README 开头改成多模态税的口径,删掉“为什么做这个”,底部有平台表(简介和接入情况);`ADAPTERS.md` 写各平台的接法和怎么加新平台。## 5. 待定问题diff --git a/docs/v0.11/plan.md b/docs/v0.11/plan.mdindex 995a518..76139e2 100644--- a/docs/v0.11/plan.md+++ b/docs/v0.11/plan.md@@ -1,6 +1,6 @@-# v0.11 方案:拆成接入层、核心层、面板层,接入 WorkBuddy+# v0.11 方案:拆成接入层、核心层、面板层,接入其他 Agent 平台-> 状态:用户 2026-11-02 确认方案(第 7 节),按第 5 节的步骤做。规格以 [spec.md](../spec.md) 为准,实现见 [design.md](../design.md)。本机的摸底记录和参考项目的笔记只在 `local/`,不进仓库。+> 状态:用户 2026-11-02 确认方案(第 7 节)。第 1–8 步已做完,在本机 main 上,没有推送;剩 Claude 桌面版实测和发布。规格以 [spec.md](../spec.md) 为准,实现见 [design.md](../design.md),对外的接入说明是 [ADAPTERS.md](../../ADAPTERS.md)。本机的摸底记录和参考项目的笔记只在 `local/`,不进仓库。## 1. 背景与目标@@ -18,7 +18,7 @@1. **三层**:接入层(一个平台一份,尽量薄)、核心层(不认识任何平台)、面板层(只经核心接口拿数据)。以后调算法只改核心层;维护某个平台只看它的那一份。2. **Codex 和 Claude 的行为不变**:这次是重组,不改用户看得到的任何行为。3. **对外接口文档和契约测试**:第三方照文档写接入,跑契约测试证明能用。-4. **用新结构接 WorkBuddy**,检验接入层是不是真的薄。+4. **用新结构接其他平台**:WorkBuddy、OpenCode、Gemini CLI、pi、DeepSeek Harness,只接核心,不带面板,检验接入层是不是真的薄。## 2. 已定的规则(用户 2026-11-02 定)@@ -32,25 +32,22 @@### 3.1 目录+做完后的结构(文件清单见 design.md):+```plugin/src/- core/ 核心层:不认识任何平台、任何请求格式- engine/ 本机代理:监听、线路、HTTP 和 WebSocket 转发、系统代理、健康检查、退役- session/ 会话的图片清单和编号、勾选、自动选图、特征行和评价、压缩后放回的决定- text/ 发给模型的文字:占位符、说明、标签、清单(中英文)- tools/ 取图工具 cam_view_image 的逻辑- api.ts 给接入层和面板用的公开接口- panel/ 面板层:只用 core/api.ts+ proxy.ts、plugin-server.ts、cam.ts、engine.ts、platforms.ts 入口、引擎生命周期、平台登记表+ core/ 核心层:不认识任何平台、任何请求格式(engine/transport.ts 是通往服务的路)+ panel/ 面板层:只用核心adapters/ 接入层- protocols/ 请求格式的翻译器:openai-responses、anthropic-messages,以后 openai-chat、gemini- codex/ common(config.toml、任务记录)、desktop、cli- claude/ common(会话记录)、desktop(Mod、面板自动打开)、code- workbuddy/+ protocols/ 请求格式的翻译器:openai-responses、anthropic-messages、openai-chat、gemini;any.ts 给只接核心的平台用+ codex/、claude/ 带面板的两个平台,各自读本地记录、改配置、开面板+ workbuddy/、opencode/、gemini-cli/、pi/ 只接核心的平台,每个一个 platform.ts(pi 另有扩展)+ dsh/ DeepSeek Harness 的 dsh 插件```-- 接入层按厂商分文件夹,里面按入口分。同一家的两个入口共用配置文件和本地记录,放在一起。- 宿主规定位置的文件(`.codex-plugin/`、`.claude-plugin/`、`hooks/`、`.mcp.json`、启动脚本)留在原处,只改它们指向的入口。-- 上面是目标结构。具体文件怎么分,拆到那一步时按代码的实际情况定,不为了对齐这张图硬拆。+- 原先画的目标结构(core 下再分 session/、text/、tools/,加一个 api.ts)没有照搬:拆到那一步时按代码的实际情况定,核心是平铺的小文件。### 3.2 三层各管什么@@ -60,18 +57,17 @@ plugin/src/### 3.3 接入契约-一个平台必须提供:--1. **名字和格式**:平台编号,用哪个翻译器。-2. **导流**:装上时让平台的模型请求经过引擎(改配置文件、写环境变量或用 Mod),卸载时只还原自己写的部分;注册 MCP 服务,让模型能用 `cam_view_image`。-3. **认会话**:从请求里认出会话、轮次,以及它是主对话、子代理还是旁聊、来自哪个会话。-4. **认取图的调用方**:`cam_view_image` 被调用时,是哪个会话在调(Codex 从调用的 `_meta` 拿,Claude 从 `CLAUDE_CODE_SESSION_ID` 拿)。+平台分两种:-可以提供:+- **带面板的平台**(Codex、Claude Code):接入层读平台自己的本地记录(任务记录、会话记录),认会话、轮次、子代理和旁聊、压缩,改平台的配置,打开面板,还有平台特有的处理(Codex 的 WebSocket 降级、API key 线路;Claude 的思考签名重试、提示缓存)。这两份接入是厚的,因为面板要用这些信息。+- **只接核心的平台**(其余所有平台):接入层只填一个条目(`core/platform.ts` 的 `CorePlatform`):+ 1. **名字**;+ 2. **原地址**:它的模型请求本来发去哪(按服务商填地址的平台,由用户在 `cam connect` 时给出);+ 3. **认会话**(可选):哪个请求头是会话编号;+ 4. **旁路请求**(可选):哪些请求不改(起标题、润色提示之类);+ 5. **接法**:用户要改哪些设置,`cam connect` 打出来。-5. **会话历史**:读平台的本地记录,给出图片出现的顺序、来源和名字、模型回复的文字(核心从里面读特征行)、被打断的轮次、压缩信息、会话的开始时间和分叉关系、面板搜索用的每轮文字。不提供时由核心从请求里建(第 3.5 节)。-6. **平台特有的处理**:例如 Codex 的 WebSocket 降级为 HTTP、API key 登录转去 OpenAI。-7. **面板**:怎么在这个平台里打开面板。默认不提供(第 2 节第 2 条)。+ 平台加一行进 `platforms.ts` 就接上了。请求格式、哪几张图、省略哪些,都由核心和翻译器从请求本身算出来(第 3.8 节)。### 3.4 翻译器@@ -86,20 +82,40 @@ plugin/src/### 3.5 图片清单从哪来- 平台提供了会话历史(Codex、Claude),就用它,和现在一样。-- 没提供的平台:核心从经过引擎的请求里建清单,图第一次出现时编号,原图存在数据目录,压缩以后从那里放回。这是新机制,分叉、撤回、多个会话共用引擎时编号怎么保持稳定,在第 5 节第 8 步单独设计,不影响 Codex 和 Claude。+- 只接核心的平台:核心从经过引擎的请求里建清单(`core/request-index.ts`,第 3.8 节)。### 3.6 分层检查和契约测试-- **分层检查**(单元测试):核心不引用 `adapters/` 和 `panel/`;面板只引用 `core/api.ts`;平台文件夹之间不互相引用(同一家的 `common` 除外),翻译器只被平台引用。参考项目 claude-code-router 的请求流水线直接引用了各智能体的特殊功能,平台的特殊处理漏进了核心;这条检查就是防这个。+- **分层检查**(单元测试):核心不引用 `adapters/` 和 `panel/`;面板只引用核心;平台文件夹之间不互相引用,翻译器只引用核心和别的翻译器。参考项目 claude-code-router 的请求流水线直接引用了各智能体的特殊功能,平台的特殊处理漏进了核心;这条检查就是防这个。- **契约测试**:每个翻译器、每个平台带一组样例请求,跑同一套测试:不改时原样输出;换图后图不在了、字在对的位置;插说明的位置对;不认识的字段原样保留。### 3.7 发布- 仍是一个版本、一份内容。全机只有一个引擎,所有平台共用;各平台装不同版本时,引擎会互相请对方退役,Codex 和 Claude 两份副本之间已经出现过(design 第 5 节)。所以不按平台拆成不同的包。-- 每个平台按它自己的方式装:Codex、Claude 照旧走各自的插件市场和安装命令;新平台在它那一步定(WorkBuddy 有和 Claude Code 几乎一样的插件市场)。+- 每个平台按它自己的方式装:Codex、Claude 照旧走各自的插件市场和安装命令;只接核心的平台在仓库里运行 `cam connect <平台>`,它登记线路、打出要改的设置,不替用户改平台的文件(没实测过,不自动改别人的配置)。- 面板文件随包一起发,只有 Codex 桌面版和 Claude 桌面版的接入打开它。- 拆的过程中插件版本号不动,免得 Codex 中途从工作区自动重装;全部做完再升到 0.11.0 发布。+### 3.8 只接核心的平台(用户 2026-11-02 定:除 Codex 和 Claude 桌面版外,都不接面板)++- **导流**:平台的服务地址改成引擎的一条线路(`/__cam/routes/<编号>`),线路记着原地址。请求原样转去原地址,只有图片相关的几处被改;引擎自己的请求头(`x-cam-*`)不往外发,其余请求头照转。+- **格式**:按路径认:`/chat/completions`、`/responses`、`/messages`、`:generateContent` / `:streamGenerateContent`(Gemini CLI 用 Google 账号登录时,内容包在 `request` 里)。四种格式各有翻译器,`adapters/protocols/any.ts` 把它们串起来。+- **轮次**:每条用户自己写了字的消息开始新的一轮;工具结果、只有图的消息算在当前轮。+- **自动选图一直开着**:之前各轮的图换成占位文字,本轮的图照发;模型用 `cam_view_image` 取回的图只在那一轮发,下一轮换成一句短说明。特征行不开:模型写的记录行在终端里会原样显示出来。+- **编号**:按内容编号,同一张图在哪都是同一个编号;第一次见到时编号,原图存进数据目录(`platforms/<平台>/`)。不读平台自己的记录。+- **认会话**:平台请求头里的会话编号;没有就用我们的扩展加的 `x-cam-session`(pi);再没有就按第一条提问区分(同一平台、同样开头的两个会话会合成一个,编号仍按内容,不会拿错图)。+- **取图**:平台的 MCP 服务(`plugin-server.ts`,`CAM_HOST=<平台>`)只有 `cam_view_image`,从最近一次发出带工具的请求的那个会话里取。+- **引擎保活**:MCP 服务每几秒探一次引擎,引擎看到有平台在探就不退出(不再只认 Codex 和 Claude 的进程)。+- **不做**:压缩后放回、面板、手动勾选、固定发送。++### 3.9 DeepSeek Harness(用户 2026-11-02 定:在接入层里顶替它官方的插件)++DSH 的请求可能用 DeepSeek 的文件模式发图(请求里是文件引用,不是图片数据),走引擎改不了,所以做成 dsh 插件(`adapters/dsh/plugin.ts`),在 `cordis.yml` 里顶替官方的 `@deepseek-ai/dsh-compaction-image-offload`:++- 保留官方插件做的事:服务因图片超预算拒绝请求时,标记最旧的几张卸载,然后重试。+- 加上自动选图:新一轮开始时(`agent/pre-step` 里轮次变了),把之前各轮还留着的图全部标记卸载。+- 卸载是 DSH 自己的机制:写进会话日志、永不撤回,模型看到的是写着附件名和只读路径的文字,需要时自己读回原图。所以不需要我们的取图工具,提示缓存的前缀也只往前走。+## 4. WorkBuddy 摸底(2026-11-02,本机 5.9.3,只看代码,没跑对话)- Electron 桌面应用,里面打包了腾讯的 CodeBuddy Code 智能体(`@genie/agent-cli` 2.165.0)。@@ -107,7 +123,8 @@ plugin/src/- 导流:环境变量 `CODEBUDDY_BASE_URL` 改官方地址;`~/.workbuddy/settings.json` 的 `env` 会被写进智能体进程的环境变量。设了自定义地址后不再 gzip 压缩请求。也认 `HTTPS_PROXY`。- 插件:和 Claude Code 几乎一样的插件市场,插件目录里是 `.codebuddy-plugin/plugin.json`、`.mcp.json`,有 hooks。内置插件里有 `mcp-app` 类别(带 HTML 页面)。- 会话:代码里有 `X-Conversation-ID` 请求头,对话记录看起来是 jsonl。-- 要实跑确认:env 对桌面版的智能体进程是否生效;登录令牌经过本机代理会不会被拒;模型请求里带不带会话编号;图片是不是 `image_url` 的 data URL。跑对话会用掉 WorkBuddy 的额度。+- 11-02 抓包(只记请求的形状,不记内容和令牌):请求头里有 `x-conversation-id`(UUIDv7)和 `x-agent-type`(润色提示这类旁路请求是 `auxiliary`)。`CODEBUDDY_BASE_URL` 要带 `/v2`:那次没带,请求发到 `/chat/completions`,服务回 405,看起来像“连不上”。+- 用户 11-02 定:不再实跑,按上面的结论写接入,等用户反馈。图片是不是 `image_url` 的 data URL、登录令牌经过本机代理会不会被拒,没有实测。## 5. 步骤@@ -120,13 +137,14 @@ plugin/src/5. 拆面板:`panel-state.ts` 只读核心接口;插件服务里的面板工具和取图工具分开。6. 拆安装:Codex 的配置和命令行、Claude 的 Mod 进各自的接入。7. 写 `ADAPTERS.md`(英文,对外)和契约测试;在 Codex 和 Claude 里跑一遍模型自测(gpt-6-sol,中英文)。-8. 接 WorkBuddy:先实跑抓包,核实第 4 节没确认的几点;写 openai-chat 翻译器;核心加从请求建清单;定安装方式。不带面板。+8. 接其他平台:平台登记表(自动选图的规则收进核心、会话编号不限 UUID、引擎认所有平台的探活);openai-chat、gemini 两个翻译器;核心从请求建清单;WorkBuddy、OpenCode、Gemini CLI、pi 的条目,pi 的扩展,DSH 的插件;`cam connect`;README 底部的平台表。不带面板,不实跑(第 7 节)。+9. Claude 桌面版实跑一轮,然后推送、发 0.11.0。## 6. 风险- 第 2、3 步动的是每个请求都经过的代码,最容易出回归。靠逐字节对照测试兜底。-- 从请求建清单是新机制,第 8 步单独设计和测试。-- WorkBuddy 第 4 节没确认的几点,第 8 步之前不对外承诺支持。+- 只接核心的五个平台都没实跑过,只有合成请求的测试。README 的平台表写明“新接入,欢迎反馈”,和实测过的 Codex、Claude 分开。+- cc-switch(切换 Claude Code、Codex 等的服务地址)每次切 Codex 的服务商,会删掉顶层的 `openai_base_url`、重写 `[model_providers.custom]`,把插件对 Codex 的接管抹掉,之后 Codex 直连,直到在面板里重新启用或重跑 `cam install`。Claude Code 不受影响:插件每个会话开始时重新读地址。- 文件搬家后,已安装的副本要靠 `cam install` 更新;启动脚本里的入口路径要一起改,不能让已安装的配置指向不存在的文件。## 7. 用户的决定(2026-11-02)@@ -136,3 +154,6 @@ plugin/src/3. 翻译器只抽象操作,不抽象整份请求。4. 一个仓库;拆包以后看情况;拆的过程中可以清理冗余。5. 按第 5 节的顺序做;不受现有设计约束。+6. WorkBuddy 不再测;其余平台也不在本机实跑,按代码和文档写接入,对外展示,等别人提 issue 和 PR。+7. 接入的平台:WorkBuddy、OpenCode、Gemini CLI、pi 写进接入层;DeepSeek Harness 在接入层里顶替它官方的插件,接不进就先不要;Antigravity 不写。+8. README:删掉“为什么做这个”;开头改成多模态税的口径(多模态上下文的自动管理工具,装上就不用管),场景写短;最底下放平台表(各平台的简介和接入情况),不挡上面的展示内容,用来和其他平台双向引流。diff --git a/plugin/src/adapters/dsh/plugin.ts b/plugin/src/adapters/dsh/plugin.tsindex 9234bd4..6650cb3 100644--- a/plugin/src/adapters/dsh/plugin.ts+++ b/plugin/src/adapters/dsh/plugin.ts@@ -8,8 +8,8 @@// starts. Marks never revert, so the provider's cached prefix only moves forward. No request goes through the engine.// Written against dsh's docs and the source of its image-offload plugin (agent/pre-step, agent/request-error,// compaction/summary-error, image/offload); not tested live.-// Use (dsh composition config): replace `- name: '@deepseek-ai/dsh-compaction-image-offload'` with-// `- name: '<path to this file>'`.+// Use: in the dsh composition (cordis.yml), replace the `@deepseek-ai/dsh-compaction-image-offload` row with one whose+// `name` is the path to this file (dsh loads a local plugin by its path: `name: './…/plugin.ts'`).// Input: dsh's events. Output: image/offload events in the session log.import { IMAGE_OFFLOAD_REQUIRED_CODE, LlmError } from "@deepseek-ai/dsh-llm";diff --git a/plugin/src/cam.ts b/plugin/src/cam.tsindex f3743a5..5afcadd 100644--- a/plugin/src/cam.ts+++ b/plugin/src/cam.ts@@ -230,7 +230,8 @@ async function main(): Promise<void> {const route = registerRoute({ platform: platform.name, baseUrl });const url = routeBaseUrl(port, route.id).replace("localhost", "127.0.0.1");const mcp = { command: process.execPath, args: [join(import.meta.dirname, "plugin-server.ts")], env: { CAM_HOST: platform.name } };- console.log(JSON.stringify({ command, platform: platform.name, upstream: baseUrl, url, steps: platform.connect({ url, mcp }) }, null, 2));+ // Plain lines, to copy from: inside JSON the paths' backslashes would be escaped twice.+ console.log([`${platform.title}: ${url} -> ${baseUrl}`, ...platform.connect({ url, mcp }).map((step, at) => `${at + 1}. ${step}`)].join("\n"));return;}if (!command || !threadId) throw new Error("usage: cam.ts install [--port N] | setup [--port N] | uninstall | status | connect <platform> [--base-url URL] | list|uncheck|check|check-all <thread id> [IMG-…]");