docs(vision): package READMEs, Model Experience, and the capability Agent Note

Document the four image-recognition packages and the vision group, register
the vision domain in the package index, add the capability decision as an
Agent Note, declare the invariants peer dep, and drop the unused agents
injection from the consumer.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Pine
2026-08-14 11:15:59 +08:00
parent 19b39bc2e0
commit f5f114dfb8
12 changed files with 342 additions and 1 deletions
@@ -0,0 +1,6 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-14-image-recognition-capability.md
2026-08-14-image-recognition-capability.md: bd8fe3406e200b23f9d25f54ca71fcf7c081e1e6
2026-08-14-image-recognition-capability.zh.md: c958d6441f96f7c8b96cf3c6c3a4e8783a00fb58
@@ -0,0 +1,78 @@
# Agent Note: Image-recognition capability (opt-in bundle)
Status: implemented
English | [中文](2026-08-14-image-recognition-capability.zh.md)
## Problem
The harness had no way to recognize image contents as a first-class step of a
task. A multimodal model can `read_image`, but nothing detects an image task and
routes it through a user-configured recognition provider first. The user wanted
an image-capability plugin, modeled on the web-search provider: fill in a
provider address + API key in the settings page, and have the model recognize an
image before continuing.
## Decision
Add a complete capability seam over four new packages under `packages/vision/`,
mirroring the web-search three-role shape (Service Definition / Provider /
Consumer), plus an opt-in bundle:
- **Service Definition** `@deepseek-ai/dsh-image-recognition`: `ctx.imageRecognition`
provider registry + provider-selecting `recognize()` (mirrors `ctx.web`):
duplicate ids rejected, order-independent selection,
`ImageRecognitionError` taxonomy.
- **Provider** `@deepseek-ai/dsh-image-recognition-http`: a user-configurable
OpenAI-compatible chat-completions vision provider. `baseURL` + `model` live in
a live settings section; the key rides the credentials domain via a
credential-ref. Logs the secret-free vision request as the
`image-recognition/llm-request` session event.
- **Consumer** `@deepseek-ai/dsh-tool-image-recognition`: registers a
`recognize_image` tool and a bundled `image-recognition` skill, and hooks
`agent/pre-step` to **deterministically inject** the skill body when a step
input carries an image (an image content block or an image file path/URL), so
the model recognizes the image before other actions.
- **Bundle** `@deepseek-ai/dsh-image-recognition-bundle`: mounts the three above;
**opt-in** — it is not in any default profile's bundles list.
- **Settings card**: an `image-recognition` card in the Plugins settings page
(endpoint + key), cloned from the web-search card.
The mechanism is deterministic-injection-plus-model-driven-execution: the
pre-step injection guarantees the skill instructions are present, while the model
still drives the actual `recognize_image` call (consistent with every existing
plugin — the model is the final decider of tool use).
## Enabling
A user opts in per profile by adding `@deepseek-ai/dsh-image-recognition-bundle`
to the profile's `dsh.profile.bundles` (or `dsh plugin --profile <name> add
...`), then configures the endpoint and key in the Plugins settings page.
## Verification
- `packages/vision/*` unit tests: SD selection semantics, provider HTTP
error/abort mapping, and the image-signal detection function.
- Full host program typechecks.
- Real use: opt in the bundle, attach an image, confirm `recognize_image` runs
and the task continues from its result.
## Alternatives considered
- **Built-in multimodal `read_image` as the mechanism.** Rejected: the user
wanted a configurable provider (address + key) surfaced in the settings page,
modeled on web-search, not a fixed multimodal path.
- **Prompt-guidance only (register the skill, let the model self-route).**
Rejected: the user asked for a deterministic guarantee that the model
recognizes an image first; the pre-step injection delivers that while the model
still drives the actual tool call.
## Consequences
- **Costs:** a new capability seam of four packages plus a client card; the
opt-in bundle needs a configured provider before it works; image-task path/URL
detection is heuristic and can be disabled.
- **Buys:** recognition becomes a first-class step with a provider the user
controls, the harness follows the capability-seam and
deterministic-injection-plus-model-driven-execution patterns, and the feature
is opt-in per profile (no default-behavior change).
@@ -0,0 +1,62 @@
# Agent Note:图像识别能力(可选 bundle)
Status: implemented
English | [中文](2026-08-14-image-recognition-capability.md)
## 问题
harness 此前无法把"识别图像内容"作为任务的一等步骤。多模态模型可以 `read_image`
但没有东西检测图像任务、并通过用户配置的识别提供方先路由它。用户想要一个仿网页
搜索的图像能力插件:在设置页填写供应商地址 + API Key,让模型先识别图像再继续任务。
## 决策
`packages/vision/` 下新增四个包,构成完整能力缝,镜像 web-search 的三角色形态
Service Definition / Provider / Consumer),外加一个可选 bundle
- **Service Definition** `@deepseek-ai/dsh-image-recognition``ctx.imageRecognition`
提供方注册表 + 按提供方选择的 `recognize()`(镜像 `ctx.web`):重复 id 拒绝、
选择与注册顺序无关、`ImageRecognitionError` 分类。
- **Provider** `@deepseek-ai/dsh-image-recognition-http`:可配置的
OpenAI 兼容 chat-completions 视觉提供方。`baseURL` + `model` 在实时 settings
区段;密钥经 credential-ref 走凭据域。把不含密钥的视觉请求记录为
`image-recognition/llm-request` 会话事件。
- **Consumer** `@deepseek-ai/dsh-tool-image-recognition`:注册 `recognize_image`
工具和一个内置 `image-recognition` 技能,并挂接 `agent/pre-step`,当一步输入
携带图像(图像内容块或图像文件路径/URL)时**确定性注入**技能体,让模型先识别
再做其他动作。
- **Bundle** `@deepseek-ai/dsh-image-recognition-bundle`:挂载以上三者;**可选**——
不在任何默认 profile 的 bundles 列表里。
- **设置页卡片**:在插件设置页新增 `image-recognition` 卡片(接口地址 + 密钥),
仿 web-search 卡片。
机制是"确定性注入 + 模型驱动执行":pre-step 注入保证技能指令在场,而模型仍驱动
实际的 `recognize_image` 调用(与所有既有插件一致——模型是工具使用的最终决策者)。
## 启用
用户按 profile 启用,把 `@deepseek-ai/dsh-image-recognition-bundle` 加入该 profile
`dsh.profile.bundles`(或 `dsh plugin --profile <name> add ...`),然后在插件
设置页配置接口地址和密钥。
## 验证
- `packages/vision/*` 单测:SD 选择语义、provider 的 HTTP 错误/中止映射、图像信号
检测函数。
- 全量 host 程序类型检查通过。
- 实机:启用 bundle,附加一张图,确认 `recognize_image` 运行且任务基于其结果继续。
## 备选方案
- **用内置多模态 `read_image` 作为机制。** 已否决:用户想要一个可配置的提供方
(地址 + 密钥),在设置页露出,仿 web-search,而不是固定的多模态路径。
- **仅 prompt 引导(注册技能、让模型自主路由)。** 已否决:用户要求确定性保证——
模型先识别图像;pre-step 注入实现这一点,同时模型仍驱动实际工具调用。
## 后果
- **代价:** 新增四个包 + 一个客户端卡片组成的能力缝;可选 bundle 需要先配置提供方
才能工作;图像任务的路径/URL 检测是启发式的,可关闭。
- **收益:** 识别成为一等步骤,且提供方由用户掌控;harness 遵循能力缝与
"确定性注入 + 模型驱动执行"模式;功能按 profile 可选,不改变默认行为。