rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:mrbeandev/dsh-image-edge-cap
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Limits the images sent to the providers or models you choose in DeepSeek Harness (DSH): the longest side of each image, and the number of images per request. It has its own page in the Plugins view.
Only the copy sent in the model request changes. Stored attachments and session logs never change, and providers or models without limits get exactly the same requests as before.
Contents: Supported DSH versions · Why this plugin exists · Install · The plugin page · How it works · Upgrading from 0.1.x · Compatibility and risk · Development
Supported range: DSH 0.2.0-rc.1 up to (not including) 0.3.0. Check
yours with dsh --version.
| DSH version | npm tag (at the time of this release) | Status |
|---|---|---|
0.2.1-rc.2 |
latest, next |
✅ Tested |
0.2.0-rc.2 |
— | ✅ Tested |
0.2.0-rc.1 |
— | ✅ Tested |
other releases from 0.2.0-rc.1 up to 0.3.0 (not included) |
— | ⚠️ Untested: loads with a warning |
older than 0.2.0-rc.1 (0.1.x) |
— | ❌ Not supported |
0.3.0 and newer (prereleases included) |
— | ❌ Refused until tested (override with allowUntestedHarness: true) |
Node.js: ^22.19.0 or >=24.0.0.
The plugin has no runtime dependencies and does not need any other community plugin. A refused plugin logs a clear error at startup and does not load; its page then says the host plugin is not running. It never half-loads.
DSH resends the whole conversation, including every image so far, with each
model request. Some providers reject a request once its images cross a limit.
From then on every turn fails: retries, continue, and /compact all resend
the same images.
Image too large (Anthropic). A request with more than 20 images is rejected when any image is over 2000 px on either side:
400 invalid_request_error: messages.N.content.1.image.source.base64.data:
At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels
DSH's requestImagePixelBudget limits total pixels (width × height), not
side length. Tall or wide images therefore pass it unchanged: a full-page
mobile screenshot of 390 × 2475 is only 0.97 MP.
Max edge = 2000 sends it as 315 × 2000.
Too many images (Cloudflare Workers AI). Workers AI rejects a request with
more than 32 distinct images. DSH's OpenAI client shows this as
400 status code (no body), because Cloudflare puts the reason under errors:
Invalid data for image - reason too many images in request (max 32)
DSH can drop old images, but only when its adapter raises a byte-limit error,
which this plain 400 is not. Max images = 32 keeps the newest 32 distinct
images in every request. Older ones are sent as DSH's own short text note
([image omitted to fit request image limits; …]), so the session continues.
Both cases were reproduced and fixed against the real services. Through the
real DSH runtime, 33 distinct screenshots to @cf/deepseek-ai/… returned the
400 without the plugin and succeeded with Max images = 32; 32 images
succeeded either way.
dsh plugin --profile web add dsh-image-edge-cap
Stop the running DSH Web process when your active work is finished, then start
it again (for example dsh web --no-open --port 3080) and refresh the page.
Open Plugins → dsh-image-edge-cap.
To install from a local checkout instead (keep the folder in place, the profile links to it):
dsh plugin --profile web add "/absolute/path/to/dsh-image-edge-cap"
To remove it:
dsh plugin --profile web remove dsh-image-edge-cap
Alternatively, clear a provider's limits; its next request goes out unchanged.
Open Plugins in the sidebar and choose dsh-image-edge-cap. The page lists every registered model provider. Open a provider to see a table: an All models row, then one row per model from DSH's live model catalog (the same list as the model picker). Each row has two limits:
| Limit | Effect |
|---|---|
| Max edge (px) | Shrinks each image so its longest side is at most this many pixels, keeping the aspect ratio. 16–16384. |
| Max images | Keeps only the newest N distinct images in each request; older ones become a short text note. 1–100000. |
all: 2000). 0 turns that limit off for one model even when
All models sets it./compact. No restart is needed.Typical setups:
The limits are stored in this plugin's entry of the profile patch
(cordis.patch.yml), so you can also edit them by hand. * is All models:
- id: dsh-image-edge-cap
name: dsh-image-edge-cap
config:
limits:
my-router:
models:
cc/claude-a: { maxImageEdge: 2000 }
cc/claude-b: { maxImageEdge: 2000 }
cf-workers-ai:
models:
"*": { maxImages: 32 }
"@cf/zai-org/glm-5.3": { maxImages: 0 } # 0 = off for this model
Max edge
llm/stream listener reads the request's provider and model. If no
edge limit applies, it returns the stream untouched.AsyncLocalStorage scope
that holds the limit. The scope reaches the image reads the adapter makes
while the stream is consumed, even through other llm/stream listeners and
concurrent requests.readImageRequest on the attachments service. Inside a
limited scope it lowers the requested target so the long edge fits, with
the short edge rounded the same way the store resizes.Max images
forAdapter step, the last step before
a request reaches the provider adapter. Plain calls, prepared agent calls,
retries and compaction summaries all pass through it.offloaded on the
request copy only. That is the same mark DSH's own image-offload plugin
uses, so every adapter already sends DSH's placeholder text for them.Each change is logged once per process, for example
dsh-image-edge-cap: capped a request image 390×2475 → 315×2000 (max edge 2000) and
dsh-image-edge-cap: sent the newest 32 of 33 images to cf-workers-ai/@cf/….
limits form
and removes its old providers rule.The plugin wraps two internal methods, both reversibly:
attachments.readImageRequest and llm.forAdapter. Neither is an official
extension API. Each wrapper is installed when its service appears, removed
when the plugin is disposed, and never installed twice. The version gate
refuses DSH releases outside the tested range. If forAdapter is ever
missing, the plugin logs a warning and keeps only the edge limit.
Plugin config keys (on the dsh-image-edge-cap entry):
| Key | Meaning |
|---|---|
limits |
Per-provider, per-model limits edited by the plugin page. |
providers |
0.1.x per-provider rules; still honoured until the provider is saved. |
enabled: false |
Load without limiting anything. |
harnessEntry |
Path of the running dsh CLI entry (detected automatically). |
allowUntestedHarness: true |
Load on a DSH outside the supported range. Not recommended. |
The plugin has zero npm runtime or build dependencies. The host code is plain ESM, and a dependency-free builder writes the browser bundle in DSH's ModuleLoader format, using the shell's own React.
| File | Role |
|---|---|
index.mjs |
Host entry: version gate, Config, llm/stream scope, the two wrappers. |
cap.mjs |
Pure limit resolution, target math and image-count selection. |
client/index.mjs |
Source of the plugin page. |
lib/client.js |
Generated by npm run build; never edit it by hand. |
icon.svg |
Plugin icon shown in the Plugins view. |
scripts/check-release.mjs |
Release gate (metadata, stale bundle, private data, packed files). |
scripts/e2e-gui.mjs |
Headless-Chrome check of the plugin page in a running DSH Web. |
npm run build # generate lib/client.js from client/index.mjs
npm test # unit tests: limits, image selection, wrappers, version gate, page
DSH_TEST_HARNESS_ENTRY="/absolute/path/to/dsh/lib/bin.js" npm run test:integration
npm run verify # build + tests + release gate
npm run pack:check # inspect the exact published file set
To run the integration suite against another DSH version, install that version
in a scratch folder and point DSH_TEST_HARNESS_ENTRY at it:
npm install --prefix /tmp/dsh-021rc2 @deepseek-ai/dsh@0.2.1-rc.2 --ignore-scripts
DSH_TEST_HARNESS_ENTRY=/tmp/dsh-021rc2/node_modules/@deepseek-ai/dsh/lib/bin.js npm run test:integration
The integration suite runs the plugin on that DSH's own Cordis, real
LocalAttachmentStore, real LLM runtime and real pi-ai adapter. It sends real
requests to a loopback mock server (fake credentials, no paid API calls) and
checks the HTTP body:
The UI tests use a fake React harness. Version 0.2.0 was also checked in the
real DSH Web app on 0.2.0-rc.1, 0.2.0-rc.2 and 0.2.1-rc.2, by installing the
packed tarball into an isolated DSH_HOME with mock providers (see
LOCAL-SETUP.md). On each version:
On 0.2.1-rc.2 it also passed a remove/reinstall.
MIT. Maintainer release steps are in RELEASE.md.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: llm、anthropic、deepseek-harness。