Stop paying the multimodal tax. Your AI agent keeps every image it has seen but only sends the ones it needs: lighter chats, no endless reconnecting, no starting over. Works with Codex, Claude Code, Cline, Gemini CLI, OpenCode, WorkBuddy and more. Install once, forget it.
TypeScript ai-agentsai-imageclaude-codeclaude-code-pluginclinecodexcodex-plugincomputer-usecontext-engineeringcontext-managementdeveloper-toolsgemini-cliimage-generationmcpmultimodalmultimodal-aiopencodeqwen-codetoken-optimizationvision-language-model
// Purpose: v0.1-14 — the plugin's own words in Simplified Chinese and English: Codex's tool list and the panel's tab
// title, results and refusals of the panel's calls, conflicts with the user's settings, and the command line. The
// panel page keeps its texts in panel.html, and the text for the model is in core/words.ts. Every key exists in both
// languages (a unit test checks it), so changing a text means changing both.
// Input: a language and a key, with {name} values filled in. Output: strings.
import type { Lang } from "./lang.ts";
const zh = {
// Codex's tool list; the panel tool's title is the tab's title.
"tool.threadId": "任务 ID;面板调用时由 Codex 自动带上。",
"tool.shown": "面板页面显示在屏幕上的时间段(毫秒);面板调用时带上。",
"tool.lang": "面板显示的语言(zh 或 en);面板调用时带上。",
"tool.panel.title": "上下文素材",
"tool.panel.description": "上下文素材面板:查看这个任务里的历史图片,勾选下一条消息要发给模型的图片。由用户在侧边面板里打开,模型不需要调用。",
"tool.select.title": "上下文素材:勾选",
"tool.select.description": "素材面板内部使用:勾选或取消图片,开关自动选图。只有用户能操作,模型调用会被拒绝。",
"tool.image.title": "上下文素材:图片",
"tool.image.description": "素材面板内部使用:读取一张图片的缩略图或预览图。模型不需要调用。",
"tool.setup.title": "上下文素材:启用或停用",
"tool.setup.description": "素材面板内部使用:让 Codex 经过本机代理(启用),或者恢复直连(停用),重启 Codex 后生效。只有用户能操作,模型调用会被拒绝。",
"tool.bind.title": "上下文素材:切到新任务",
"tool.bind.description": "素材面板内部使用:在新任务发出第一条消息之前打开的面板,切到用户刚开始的那个任务。只有用户能操作,模型调用会被拒绝。",
"server.title": "上下文素材管理器",
"resource.name": "上下文素材面板",
// Results and refusals of calls (a refusal of the model's call is read by the model).
"call.noThread": "不知道是哪个任务:缺少 threadId",
"call.summary": "共 {images} 张图,取消了 {unchecked} 张。",
"call.modelSelect": "只有用户能勾选或取消图片;需要某张图时,请回复“需要 IMG-xxx”。",
"call.modelSetup": "只有用户能启用或停用。",
"call.modelBind": "只有用户能切换面板对应的任务。",
"call.started": "这个面板的任务已经开始了,不用切换。",
"call.notUserThread": "只能切到用户自己开始的任务。",
"call.enabled": "已启用,重启 Codex 后生效。",
"call.disabled": "已停用,重启 Codex 后恢复直连。",
"call.imageOk": "ok",
"call.imageNone": "无法显示",
// A setting of the user's that the tool does not overwrite (codexconfig.ts).
"conflict.baseUrl": "config.toml 里已经设置了 openai_base_url,没有覆盖它。",
"conflict.endpointSyntax": "无法安全接管这种供应商配置写法,配置未修改。请使用单行服务地址设置。",
"conflict.proxyLoop": "服务地址指向插件引擎自身,配置未修改。",
"conflict.endpointUrl": "服务地址无效,配置未修改。请使用不含账号密码和片段标记的 HTTP 或 HTTPS 地址。",
"proxy.unknownRoute": "无法识别服务线路,或请求的平台标识与线路不一致。",
"proxy.invalidRoute": "服务线路登记无效。",
"proxy.isolatedRoute": "此服务线路需要使用独立的本机入口。",
"conflict.systemProxy": "config.toml 关掉了 respect_system_proxy,没有改动它。",
"conflict.noProxy": ".env 里已经设置了 NO_PROXY,没有覆盖它。",
"conflict.mcpServer": "config.toml 里已经有名为 {name} 的 MCP 服务,没有覆盖它。",
"conflict.noEnd": "config.toml 里有一段带标记的设置缺少结束标记,没有改动。",
// Notes of an install or setup (install.ts).
"note.legacyMcp": "去掉旧版写进 config.toml 的插件服务:现在由插件自己提供",
"note.noProxy": "写入 .env 的 NO_PROXY:环境变量里有代理,而且没有覆盖本机地址",
// The command line (cam.ts).
"cli.kind.upload": "上传",
"cli.kind.view": "工具查看",
"cli.kind.generated": "生成",
"cli.kind.tool": "工具结果",
"cli.state.locked": "锁定",
"cli.state.checked": "勾选",
"cli.state.unchecked": "取消",
"cli.requested": "模型索要",
"cli.table.title": "任务 {thread}:{images} 张图,{turns} 轮;取消 {unchecked} 张;勾选的图共 {checkedMb} MB(全部勾选时 {allMb} MB)",
"cli.table.header": "编号 | 状态 | 来源 | 名称 | 轮次 | 尺寸 | 大小 | 内容相同 | 备注",
"cli.codexFailed": "codex {args} 失败:{output}",
"cli.noOutput": "没有输出",
"cli.selfTest.timeout": "没有在 {seconds} 秒内响应。{errors}",
"cli.selfTest.incomplete": "工具或面板页面不完整",
"cli.selfTest.failed": "装好的插件服务没能启动:{error}。代理设置没有写入,Codex 仍然直连。",
"cli.runInRepo": "请在仓库里运行:node plugin/src/cam.ts install",
"cli.noCli": "找不到 Codex 的命令行。请先安装 Codex 桌面版并至少打开过一次,或者安装 Codex 命令行;也可以用环境变量 CODEX_CLI_PATH 指定它的位置。",
"cli.notInstalled": "插件还没有装进 Codex:请先安装插件,再运行 setup。",
"cli.step.oldMarketplace": "去掉指向别处的旧插件市场",
"cli.step.addMarketplace": "登记插件市场(这个仓库)",
"cli.step.oldPlugin": "卸掉旧的插件副本",
"cli.step.install": "安装插件",
"cli.step.selfTest": "自检通过:插件服务能启动,提供 {tools}",
"cli.step.direct": "恢复直连:去掉代理设置",
"cli.step.directEnv": "恢复直连:去掉代理设置和 .env 里的 NO_PROXY",
"cli.step.noCli": "找不到 Codex 的命令行,插件没有卸载;可以在 Codex 的插件页面里移除",
"cli.step.removePlugin": "卸载插件",
"cli.step.removeMarketplace": "去掉插件市场",
"cli.list": "、",
"cli.next.install": "重启 Codex 后生效。面板在任务右侧的侧边面板:新建标签页 → 插件和 MCP → 上下文素材",
"cli.next.uninstall": "重启 Codex 后生效;引擎会在 Codex 全部退出后自己退出。勾选记录留在数据目录里,不需要可以删掉",
};
const en: Record<keyof typeof zh, string> = {
"tool.threadId": "Task ID; Codex adds it when the panel calls.",
"tool.shown": "When the panel page was on screen (ms); the panel sends it.",
"tool.lang": "The panel's language (zh or en); the panel sends it.",
"tool.panel.title": "Context Assets",
"tool.panel.description": "Context Assets panel: see the images in this task's history and choose which go to the model with the next message. The user opens it from the side panel; the model does not need to call it.",
"tool.select.title": "Context Assets: check",
"tool.select.description": "Used by the panel: check or uncheck images, and switch automatic selection. Only the user can do this; calls from the model are refused.",
"tool.image.title": "Context Assets: image",
"tool.image.description": "Used by the panel: read an image's thumbnail or preview. The model does not need to call it.",
"tool.setup.title": "Context Assets: enable or disable",
"tool.setup.description": "Used by the panel: route Codex through the local proxy (enable) or connect directly again (disable); takes effect after Codex restarts. Only the user can do this; calls from the model are refused.",
"tool.bind.title": "Context Assets: switch to the new task",
"tool.bind.description": "Used by the panel: a panel opened on a new chat before its first message switches to the task the user just started. Only the user can do this; calls from the model are refused.",
"server.title": "Context Attachment Manager",
"resource.name": "Context Assets panel",
"call.noThread": "Which task? The threadId is missing.",
"call.summary": "Images: {images}, unchecked: {unchecked}.",
"call.modelSelect": "Only the user can check or uncheck images; if you need an image, reply \"need IMG-xxx\".",
"call.modelSetup": "Only the user can enable or disable the plugin.",
"call.modelBind": "Only the user can switch the panel to another task.",
"call.started": "This panel's task has already started; there is nothing to switch.",
"call.notUserThread": "The panel can only switch to a task the user started.",
"call.enabled": "Enabled. Restart Codex for it to take effect.",
"call.disabled": "Disabled. Restart Codex to connect directly again.",
"call.imageOk": "ok",
"call.imageNone": "cannot be shown",
"conflict.baseUrl": "config.toml already sets openai_base_url; it was left as it is.",
"conflict.endpointSyntax": "This provider configuration cannot be safely routed; nothing was changed. Use a single-line endpoint setting.",
"conflict.proxyLoop": "The endpoint points back to the plugin engine; nothing was changed.",
"conflict.endpointUrl": "Invalid endpoint; nothing was changed. Use an HTTP or HTTPS URL without embedded credentials or a fragment.",
"proxy.unknownRoute": "Unrecognized provider route or conflicting client identity.",
"proxy.invalidRoute": "Invalid provider route registration.",
"proxy.isolatedRoute": "This provider route requires its dedicated local listener.",
"conflict.systemProxy": "config.toml turns respect_system_proxy off; it was left as it is.",
"conflict.noProxy": ".env already sets NO_PROXY; it was left as it is.",
"conflict.mcpServer": "config.toml already has an MCP server named {name}; it was left as it is.",
"conflict.noEnd": "A marked block in config.toml has no end marker; nothing was changed.",
"note.legacyMcp": "Removed the plugin service an older version wrote into config.toml: the plugin provides it now",
"note.noProxy": "Wrote NO_PROXY into .env: a proxy is set in the environment and does not leave out this machine",
"cli.kind.upload": "upload",
"cli.kind.view": "viewed",
"cli.kind.generated": "generated",
"cli.kind.tool": "tool result",
"cli.state.locked": "locked",
"cli.state.checked": "checked",
"cli.state.unchecked": "unchecked",
"cli.requested": "asked for by the model",
"cli.table.title": "Task {thread}: {images} images, {turns} turns; {unchecked} unchecked; checked images {checkedMb} MB ({allMb} MB with all checked)",
"cli.table.header": "ID | State | Source | Name | Turn | Size | Bytes | Same as | Note",
"cli.codexFailed": "codex {args} failed: {output}",
"cli.noOutput": "no output",
"cli.selfTest.timeout": "No reply within {seconds} s. {errors}",
"cli.selfTest.incomplete": "The tools or the panel page are incomplete",
"cli.selfTest.failed": "The installed plugin service did not start: {error}. The proxy settings were not written; Codex still connects directly.",
"cli.runInRepo": "Run this in the repository: node plugin/src/cam.ts install",
"cli.noCli": "Codex's command line was not found. Install the Codex desktop app and open it at least once, or install the Codex command line; you can also set CODEX_CLI_PATH to its location.",
"cli.notInstalled": "The plugin is not in Codex yet: install the plugin first, then run setup.",
"cli.step.oldMarketplace": "Removed an older plugin marketplace that pointed elsewhere",
"cli.step.addMarketplace": "Registered the plugin marketplace (this repository)",
"cli.step.oldPlugin": "Removed the old copy of the plugin",
"cli.step.install": "Installed the plugin",
"cli.step.selfTest": "Self-test passed: the plugin service starts and offers {tools}",
"cli.step.direct": "Connected directly again: removed the proxy settings",
"cli.step.directEnv": "Connected directly again: removed the proxy settings and the NO_PROXY in .env",
"cli.step.noCli": "Codex's command line was not found, so the plugin was not removed; remove it on Codex's plugins page",
"cli.step.removePlugin": "Removed the plugin",
"cli.step.removeMarketplace": "Removed the plugin marketplace",
"cli.list": ", ",
"cli.next.install": "Restart Codex for this to take effect. The panel is in the task's side panel: New tab > Plugins and MCP > Context Assets",
"cli.next.uninstall": "Restart Codex for this to take effect; the engine exits by itself once Codex has quit. Your selections stay in the data folder; delete it if you no longer need them",
};
export type MessageKey = keyof typeof zh;
export const MESSAGES: Record<Lang, Record<MessageKey, string>> = { zh, en };
export function say(lang: Lang, key: MessageKey, vars: Record<string, string | number> = {}): string {
return MESSAGES[lang][key].replace(/\{(\w+)\}/g, (all, name: string) => (name in vars ? String(vars[name]) : all));
}