{"_id":"@adamcjm/dsh-vision","name":"@adamcjm/dsh-vision","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adamcjm/dsh-vision","version":"0.1.0","description":"Vision subagent delegation for DeepSeek Harness: when the main session model cannot read images, delegate image understanding to a one-shot vision subagent; when the main model is natively multimodal, read directly and skip the subagent.","type":"module","main":"lib/index.js","exports":{".":"./lib/index.js","./cordis.patch.yml":"./cordis.patch.yml","./package.json":"./package.json"},"keywords":["deepseek-harness","dsh","plugin","bundle","vision","subagent","multimodal"],"license":"MIT","author":{"name":"adamcjm"},"repository":{"type":"git","url":"git+https://github.com/adamcjm/dsh-vision.git"},"homepage":"https://github.com/adamcjm/dsh-vision#readme","dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"_id":"@adamcjm/dsh-vision@0.1.0","gitHead":"fa71b7b848c6e476c80739d1ced5946bcf923107","bugs":{"url":"https://github.com/adamcjm/dsh-vision/issues"},"_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-x7F/6/866vv4SULhwAupbVfdPWa+CM0mhGDOR2ry/FguZCMmth4BHpjmhztk2KMXGHONP4/oWrOQjpeDUxvjVg==","shasum":"026351f90464e50b3a4f6cace6abda4ba9b260f3","tarball":"https://registry.npmjs.org/@adamcjm/dsh-vision/-/dsh-vision-0.1.0.tgz","fileCount":5,"unpackedSize":24376,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDoTuSQ3QE+ZvjyCvIX7T50z2rj5escD4yvDHmDSfHNiAiANqvVz3oz/bSZt3WcBchJeDL0xbG+yKTZX696+BswPkQ=="}]},"_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"directories":{},"maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-vision_0.1.0_1788454328162_0.6391247346893518"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-03T16:52:07.988Z","0.1.0":"2026-09-03T16:52:08.297Z","modified":"2026-09-03T16:52:08.565Z"},"maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"description":"Vision subagent delegation for DeepSeek Harness: when the main session model cannot read images, delegate image understanding to a one-shot vision subagent; when the main model is natively multimodal, read directly and skip the subagent.","homepage":"https://github.com/adamcjm/dsh-vision#readme","keywords":["deepseek-harness","dsh","plugin","bundle","vision","subagent","multimodal"],"repository":{"type":"git","url":"git+https://github.com/adamcjm/dsh-vision.git"},"author":{"name":"adamcjm"},"bugs":{"url":"https://github.com/adamcjm/dsh-vision/issues"},"license":"MIT","readme":"# dsh-vision · 视觉子代理插件\n\n**English** | [中文](#中文)\n\nA DeepSeek Harness (dsh) plugin that gives a text-only main model \"eyes\": when the session needs image understanding, the work is delegated to a one-shot vision subagent running on a vision-capable model; when the main model is natively multimodal, images are read directly and no subagent is ever spawned.\n\n---\n\n## Installation\n\n```sh\n# npm (recommended)\ndsh plugin --profile web add @adamcjm/dsh-vision\n\n# or straight from GitHub\ndsh plugin --profile web add github:adamcjm/dsh-vision\n\n# or local development (live edits, no reinstall)\ndsh plugin --profile web add link:~/.dsh/dev/dsh-vision\n```\n\nThe CLI appends the bundle to `dsh.profile.bundles` automatically. Restart `dsh web` to activate.\n\nVerify:\n\n```sh\ndsh --profile web --dump-config | grep -A6 \"id: dsh-vision\"\n```\n\n## How it works\n\n1. **Automatic capability detection.** The plugin checks the current session route's `inputModalities` (the same gate the harness's `read_image` uses).\n   - Main model declares `image` input → `vision_agent` short-circuits with \"use read_image directly\" — **no subagent is spawned**; the guidance section also tells the model to prefer `read_image`.\n   - Main model is text-only → the model calls `vision_agent(images, question)`; the plugin starts a **one-shot foreground subagent** on the configured vision route (the child inherits the session's preset, including its own `read_image` tool), and only the child's **text answer** returns to the main session.\n2. **Pasted images, zero message rewriting.** In a text-only session the harness projects a pasted image into a stub like `[image omitted ...; attachment sha256:abcdef12]`. `vision_agent` accepts the `sha256:` reference (full 64-hex id, truncated prefix, or the whole bracketed stub text — it is extracted automatically) and resolves it to the durable attachment's local object file, so the subagent reads the original bytes. No request messages are rewritten, which keeps the harness's agent-loop log-reconstruction invariant intact.\n3. **Hardened child.** The subagent runs with `maxDepth: 0` (no further delegation) and `toolFilter` limited to `read_image`; image bytes never enter the main session's context.\n\n## Configuration\n\nThe `dsh-vision` row in `cordis.patch.yml` (override by id in the profile's own `cordis.patch.yml`):\n\n| Field | Default | Meaning |\n| --- | --- | --- |\n| `provider` | `deepseek-official` | Provider route for the vision subagent (must be registered in the LLM catalog) |\n| `model` | `deepseek-v4-flash-vision-exp` | Vision model (must declare image input; shipped in the built-in catalog) |\n| `subagentProvider` | `spawn` | Host subagent registry backend |\n| `maxDepth` | `0` | The vision child may not delegate further |\n\n## Usage\n\n- Paste an image and ask about it → the main model sees the `sha256:` stub → calls `vision_agent([\"sha256:...\" or the whole stub text], \"your question\")` → the subagent reads the image → the text answer comes back and the conversation continues.\n- Give image file paths (absolute or workspace-relative) → same flow.\n- Main model supports images (e.g. switched to a vision model) → it reads with `read_image` directly, no subagent.\n- Image URLs → the model downloads them to the workspace first, then passes local paths.\n\n## Structure\n\n```\ndsh-vision/\n├── package.json        # bundle manifest (dsh.bundle.patch)\n├── cordis.patch.yml    # inserts the dsh-vision row (root layer, visible to every session)\n└── lib/index.js        # host plugin, zero external dependencies\n```\n\n## License\n\n[MIT](LICENSE)\n\n---\n\n# 中文\n\n给纯文本主模型装上「眼睛」的 DeepSeek Harness（dsh）插件：会话需要识图时，自动把任务（识图意图 + 目标图片）交给运行在视觉模型上的一次性 vision sub-agent；主模型原生支持多模态时，直接读图，永不启动子代理。\n\n## 安装\n\n```sh\n# npm（推荐）\ndsh plugin --profile web add @adamcjm/dsh-vision\n\n# 或直接从 GitHub 安装\ndsh plugin --profile web add github:adamcjm/dsh-vision\n\n# 或本地开发（改代码即时生效，无需重装）\ndsh plugin --profile web add link:~/.dsh/dev/dsh-vision\n```\n\nCLI 会自动把插件追加进 `dsh.profile.bundles`。重启 `dsh web` 生效。\n\n验证：\n\n```sh\ndsh --profile web --dump-config | grep -A6 \"id: dsh-vision\"\n```\n\n## 工作原理\n\n1. **能力自动判断**：插件按 harness 的 `read_image` 同款门禁检查当前会话路由的 `inputModalities`。\n   - 主模型声明 `image` 输入 → `vision_agent` 直接短路返回「请用 read_image」，**不会 spawn 任何子代理**；提示词区也引导模型优先 `read_image`。\n   - 主模型不支持图片 → 模型调用 `vision_agent(images, question)`，插件启动**一次性前台子代理**，路由钉在配置的视觉模型上（子代理继承会话预设，自带 `read_image`），子代理读图后仅把**文本答案**返回主会话继续。\n2. **贴图闭环（零消息改写）**：纯文本会话中贴图会被官方适配器投影成 `[image omitted ...; attachment sha256:abcdef12]` 占位符。`vision_agent` 接受 `sha256:` 引用（完整 64 位、截断前缀、或**整段方括号占位文本原样**，自动提取），解析为持久化附件的本地对象路径后由子代理读原始字节。不改写任何请求消息，与 harness 的 agent-loop 日志一致性校验完全兼容。\n3. **安全边界**：子代理 `maxDepth: 0`（禁止再委派）、`toolFilter` 仅允许 `read_image`，图片字节不进入主会话上下文。\n\n## 配置\n\n`cordis.patch.yml` 中的 `dsh-vision` 行（可在 profile 自己的 `cordis.patch.yml` 里按 id 覆盖）：\n\n| 字段 | 默认 | 说明 |\n| --- | --- | --- |\n| `provider` | `deepseek-official` | 视觉子代理的路由 provider（需已在 LLM 目录注册） |\n| `model` | `deepseek-v4-flash-vision-exp` | 视觉模型（必须声明 image 输入；内置目录自带该模型） |\n| `subagentProvider` | `spawn` | host subagent 注册表后端 |\n| `maxDepth` | `0` | 子代理禁止再委派 |\n\n## 使用\n\n- 贴图 + 问题 → 主模型看到 `sha256:` 占位符 → 调 `vision_agent([\"sha256:...\" 或整段占位文本], \"问题\")` → 子代理读图 → 文本答案返回主会话继续。\n- 给图片文件路径（绝对或相对工作区）→ 同样流程。\n- 主模型支持图片（如切到视觉模型）→ 直接 `read_image`，不启动子代理。\n- 图片 URL → 模型先下载到工作区，再传本地路径。\n\n## 结构\n\n```\ndsh-vision/\n├── package.json        # bundle 声明（dsh.bundle.patch）\n├── cordis.patch.yml    # 插入 dsh-vision 行（root 层，全 profile 会话可见）\n└── lib/index.js        # 零外部依赖的 host 插件\n```\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_rev":"1-004b001306e1a9b0482f0d206e7fa892"}