You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zoo Code supports the VS Code Language Model API provider. VS Code LM models can expose custom endpoints and provider-specific metadata. Some of these models support image input in native VS Code Chat, but Zoo Code can treat them as text-only.
10
+
11
+
The current capability mapper in `src/api/providers/vscode-lm.ts` only recognizes:
12
+
13
+
-`model.capabilities.imageInput`
14
+
-`model.capabilities.vision`
15
+
- static family metadata in `vscodeLlmModels`
16
+
17
+
When none of those are present, it sets `supportsImages` to `false`. For image-capable custom endpoint models, this false value propagates into task request generation, where image blocks are removed before the VS Code LM request is built.
18
+
19
+
## Decision
20
+
21
+
1. Broaden VS Code LM capability detection to recognize additional image/vision metadata shapes exposed by VS Code LM providers.
22
+
2. Keep explicit negative capability metadata authoritative when a model clearly reports image support is disabled.
23
+
3. Use safe fallback behavior for unknown custom VS Code LM models so Zoo Code does not strip images before the VS Code LM API can accept or reject them.
24
+
4. Preserve full VS Code LM model identity in the webview model picker by using `id` when available instead of only `${vendor}/${family}`.
25
+
5. Add regression coverage for:
26
+
- provider image capability mapping,
27
+
- image blocks reaching `LanguageModelDataPart` in the final VS Code LM request,
28
+
- selected model capability propagation in the webview.
29
+
30
+
## Consequences
31
+
32
+
### Positive
33
+
34
+
- Image-capable VS Code LM custom endpoint models are no longer downgraded to text-only inside Zoo Code.
35
+
- Images survive the task request pipeline and can be converted to `LanguageModelDataPart`.
36
+
- Model selection is less prone to collisions when multiple VS Code LM models share vendor/family.
37
+
38
+
### Negative
39
+
40
+
- Unknown VS Code LM custom models may show image UI even if the provider later rejects images. This is preferable to silently dropping user images before the API request because VS Code LM is the source of truth for request acceptance.
41
+
42
+
## Alternatives Considered
43
+
44
+
1.**Only support `capabilities.imageInput` and `capabilities.vision`**: rejected because it fails for custom endpoints that VS Code Chat can use with images.
45
+
2.**Always disable images for unknown VS Code LM models**: rejected because it causes silent image removal and contradicts VS Code Chat behavior.
46
+
3.**Bypass `maybeRemoveImageBlocks()` for VS Code LM only**: rejected because capability propagation is used by UI, tools, and prompts; fixing only the final request would leave inconsistent behavior.
VS Code LM models that accept images in native VS Code Chat can behave as text-only in Zoo Code. The reported example is `customendpoint/gpt-5.5`.
10
+
11
+
## Pipeline traced
12
+
13
+
1.**Model discovery**
14
+
15
+
-`src/api/providers/vscode-lm.ts` calls `vscode.lm.selectChatModels({})` in `getVsCodeLmModels()` and maps each model through `getVsCodeLmModelInfo()`.
16
+
-`getVsCodeLmModelInfo()` currently only checks `model.capabilities.imageInput`, `model.capabilities.vision`, static family metadata, then defaults to `false`.
17
+
18
+
2.**Selected model state**
19
+
20
+
-`webview-ui/src/components/settings/providers/VSCodeLM.tsx` receives `vsCodeLmModels` from the extension and stores the selected model object, including `info`, through `vsCodeLmModelSelector`.
21
+
- The settings UI currently keys VS Code LM models by `${vendor}/${family}`. That can collide for custom endpoints or multiple models with the same vendor/family but different `id` or `version`.
22
+
-`webview-ui/src/components/ui/hooks/useSelectedModel.ts` reads `vsCodeLmModelSelector.info` and exposes model capabilities to chat UI.
-`webview-ui/src/components/chat/ChatTextArea.tsx` disables paste/drop/select image interactions when `shouldDisableImages` is true.
28
+
-`webview-ui/src/components/chat/ChatRow.tsx` also disables image attachment while editing when `!model?.supportsImages`.
29
+
30
+
4.**Image ingestion**
31
+
32
+
-`src/core/webview/webviewMessageHandler.ts` resolves incoming images through `resolveImageMentions()`.
33
+
-`resolveImageMentions()` defaults `supportsImages` to `true`; the current webview handler does not pass the current provider capability. This means images are not stripped at this step because of VS Code LM capability detection.
34
+
35
+
5.**Task request generation**
36
+
37
+
-`src/core/task/Task.ts` merges API history and then calls `maybeRemoveImageBlocks(mergedForApi, this.api)` before `buildCleanConversationHistory()` and `this.api.createMessage()`.
38
+
-`src/api/transform/image-cleaning.ts` converts image blocks into text placeholders when `apiHandler.getModel().info.supportsImages` is false.
39
+
40
+
6.**VS Code LM request transform**
41
+
-`src/api/transform/vscode-lm-format.ts` converts Anthropic image blocks to `vscode.LanguageModelDataPart` when that constructor is available.
42
+
- Existing tests in `src/api/transform/__tests__/vscode-lm-format.spec.ts` already prove image blocks become data parts when they survive to this transform.
43
+
44
+
## Root cause
45
+
46
+
The root cause is capability detection and preservation for VS Code LM custom models. `getVsCodeLmModelInfo()` is too narrow: it treats a VS Code LM model as image-capable only when `capabilities.imageInput` or `capabilities.vision` is present, or when static family metadata says images are supported. Custom endpoint models can be image-capable in VS Code Chat without matching these fields/static families, so Zoo Code records `supportsImages: false`.
47
+
48
+
Once `supportsImages` is false, `Task.attemptApiRequest()` calls `maybeRemoveImageBlocks()`, which replaces image blocks with `[Referenced image in conversation]`. Therefore `convertToVsCodeLmMessages()` never gets an image block and cannot create `LanguageModelDataPart` for the final `client.sendRequest()` call.
49
+
50
+
A secondary issue is model identity in the settings UI. `VSCodeLM.tsx` uses `${vendor}/${family}` as the picker key, ignoring `id` and `version`. This can preserve or select the wrong `info` when multiple VS Code LM models share vendor/family.
- Add provider tests for broader VS Code LM image-capability shapes and fallback behavior for custom endpoints.
67
+
- Add a provider request test proving Anthropic image blocks reach `sendRequest()` as `LanguageModelDataPart`.
68
+
- Add settings hook/UI tests for preserving `info.supportsImages` and distinct model identity.
69
+
- Run targeted Vitest suites from the correct package directories.
70
+
- Runtime verification with a real VS Code LM image-capable model requires an interactive VS Code extension host and an installed/authenticated model provider. If unavailable in this environment, document exact manual steps and do not claim completed runtime verification.
0 commit comments