New:Socket for Asana Is Now Available.Learn more
Get Started

dsh-read-image-jpeg-fallback

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsh-read-image-jpeg-fallback

DSH profile plugin: converts read_image PNG/WebP attachments to opaque sRGB JPEG so LM Studio's openai-completions endpoint accepts them

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

dsh-read-image-jpeg-fallback

A small DSH profile plugin that converts read_image PNG/WebP attachments to JPEG before they are sent to the model.

It is intended for LM Studio setups where DSH-generated WebP attachments cause:

400 'url' field must be a base64 encoded image

What it does

DSH may normalize PNG screenshots into WebP before building the model request.

Some LM Studio openai-completions routes reject those WebP image attachments.

This plugin hooks into read_image after the tool finishes and converts:

  • image/png → opaque sRGB JPEG
  • image/webp → opaque sRGB JPEG

JPEG and other media types are left unchanged.

The built-in read_image tool itself is not replaced or modified.

Installation

Requires:

  • DSH 0.1.1-rc.2
  • Node.js >= 22
  • pnpm available on PATH

From a tarball

dsh plugin --profile web add .\dsh-read-image-jpeg-fallback-0.1.1.tgz

From npm

Once published:

dsh plugin --profile web add dsh-read-image-jpeg-fallback

Restart DSH Web after installation.

Usage

No configuration is required.

Use read_image normally. When its result contains a PNG or WebP attachment, the plugin converts the model-visible image to JPEG before the next provider request is built.

read_image
    ↓
DSH attachment
    ↓
PNG / WebP ?
    ├─ no  → pass through
    └─ yes → opaque sRGB JPEG (quality 90)
                    ↓
                 model

Failure behavior

The plugin is designed to fail open.

If reading, converting, or saving the replacement image fails, the original read_image result is preserved and a warning is written to the DSH log.

It does not turn a successful tool call into a plugin error.

Supported environment

Verified with:

  • DSH 0.1.1-rc.2
  • LM Studio openai-completions
  • Node.js 26.x
  • sharp 0.35.3
  • Windows

Compatibility with other DSH versions or providers is not guaranteed.

Known issue

On some Windows + pnpm setups, removing the plugin may hang after pnpm has already completed its filesystem changes, particularly when sharp is being pruned.

If this occurs, pinning sharp directly in the DSH profile avoids the issue:

cd <DSH_HOME>\profiles\web
pnpm add sharp@0.35.3

Uninstall

dsh plugin --profile web remove dsh-read-image-jpeg-fallback

Restart DSH Web afterwards.

How it works

The plugin uses DSH's tools/post-execute hook.

For accepted read_image results containing PNG or WebP image blocks, it:

  • reads the stored attachment;
  • converts it with sharp to opaque sRGB JPEG at quality 90;
  • saves a new attachment through DSH's attachment store;
  • replaces only the model-visible image block with the new JPEG reference.

The canonical tool result and built-in read_image implementation remain untouched.

License

MIT

Keywords

dsh-plugin

FAQs

Package last updated on 25 Aug 2026

Related posts