rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:xuan25/dsh-imagegen
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Image-generation and editing plugin for dsh: one imagegen tool that renders
and edits images through any OpenAI-compatible image backend, so agents can
generate and edit images without per-backend glue. The same tool lists the
configured routes, echoes the declared model lists, and live-probes the
backends.
| verb | network | what it does |
|---|---|---|
generate |
yes | Generates the requested images. The tool writes the image files to disk and verifies each one is a PNG, JPEG, or WebP image. |
edit |
yes | Edits one or more existing images: the tool reads the files named by the images argument (one entry per input image), posts them with the prompt to the backend, and writes the result files to disk with the same output handling as generate. |
providers |
no | Lists the configured routes with their fields, the originating layer of each field, and the credential state. |
models |
no | Echoes the declared model list of each route. The live model listing is the status verb. |
status |
yes | Probes each route's backend and reports reachability plus the live model list. |
Key generate and edit behaviors:
prompt argument is required for both verbs. For edit, the images
argument is also required (an array of one or more readable file paths).model, the tool uses the route's single declared
model. When a route declares no models, the tool asks the backend for its
model list. When the declared or live model list contains several models,
the call fails and lists the candidates.size and negativePrompt to the backend as-is, and only
when the call sets them. The seed argument must be an integer, and the
tool passes it only when the call sets it. The n argument is an integer= 1 with a default of 1, and a value greater than 1 requests a batch.
out, the output path is that argument (a file path for
n = 1, or a directory marked by a trailing separator or by existing on
disk). When the call omits out, the tool writes the files to
<process.cwd()>/images/<unixts>_<i>.<ext>. The file extension matches
the image content type (png / jpg / webp).code: output, and the tool keeps the file on
disk. When the path cannot be written, the call fails the same way.timeout argument of
1-3600 s overrides it per call for generate and edit.The plugin ships a dsh-imagegen skill. The skill is the full tool reference
for agent contexts: it carries the parameter table, the env contract, and the
error codes.
dsh-imagegen is an out-of-tree plugin for a dsh profile. Install it with the dsh plugin command:
dsh plugin --profile <name> add dsh-imagegen
Configuration is layered (see the Configuration section); the plugin creates no config or state files.
Providers are configured in any of four layers, lowest to highest priority;
the providers verb reports the originating layer of every field, so a
shadowed value is never silent:
api: openai-compatible),IMAGEGEN_* env contract (static per process boot),dsh-imagegen and a
config object, or profile-level patches),dsh-imagegen: section in the user settings document
($DSH_HOME/settings.yaml), which the plugin re-reads on every call, so
settings edits apply without a restart.dsh-imagegen:
defaultProvider: local
providers:
local:
baseURL: http://<host>:<port>/v1
hosted:
baseURL: https://api.example.com/v1
apiKeyEnv: IMAGEGEN_HOSTED_KEY
models: [flux-1]
displayName: Hosted Images
The env contract mirrors the config fields 1:1: IMAGEGEN_DEFAULT_PROVIDER,
and per route <NAME> the variables IMAGEGEN_PROVIDER_<NAME>_BASEURL,
IMAGEGEN_PROVIDER_<NAME>_API, IMAGEGEN_PROVIDER_<NAME>_APIKEYENV,
IMAGEGEN_PROVIDER_<NAME>_HEADERS, IMAGEGEN_PROVIDER_<NAME>_MODELS,
IMAGEGEN_PROVIDER_<NAME>_DISPLAYNAME. The <NAME> segment is the route name
uppercased with - written as _. The headers value is a JSON object
string, and the models value is a comma-separated list of model ids. The
baseURL value is the OpenAI-compatible base URL including the /v1 prefix
(the same shape as an LLM provider base URL); the plugin appends
/images/generations, /images/edits, and /models to it verbatim.
The apiKeyEnv value is a
reference to an environment variable name, never a secret in config; per
request the value resolves from the process environment, then from
$DSH_HOME/.credentials.yaml.
// Generate with the default route and its single declared model.
{ "verb": "generate", "prompt": "a lighthouse in fog", "size": "1024x1024" }
// Pick a route and model explicitly, and keep the output name deterministic.
{ "verb": "generate", "provider": "hosted", "model": "flux-1",
"prompt": "an isometric pixel-art garden", "seed": 42, "out": "/tmp/garden.png" }
// Generate a batch into an existing directory.
{ "verb": "generate", "prompt": "three weather variations", "n": 3, "out": "renders/" }
// Edit an existing image: send the input file plus the edit instruction.
{ "verb": "edit", "prompt": "repaint the chair red", "images": ["renders/base.png"] }
// Edit multiple images at once: one array entry per input image.
{ "verb": "edit", "prompt": "merge the two scenes", "images": ["renders/a.png", "renders/b.png"] }
// List what is configured, and where each field comes from.
{ "verb": "providers" }
// List the declared model lists per route (no network).
{ "verb": "models" }
// Probe backend health and the live model list.
{ "verb": "status" }
A failing call returns the document { ok: false, error: { code, message, provider?, elapsed_ms } }. The code set is invalid_param / config /
network / timeout / http / protocol / output.
config error carries the message "no provider route is
configured", no route survived configuration. Check the base URLs; the tool
reports each route that configuration drops as a warning in the log.config error carries the message "credential missing: environment
variable "X" is not set", the credential reference does not resolve. Set
X in the environment or add it to $DSH_HOME/.credentials.yaml.config error carries the message "unknown provider "x"", the route
name matches no configured route. Route names match case-insensitively and
treat _ and - as the same separator; the error lists the configured
names.config error carries the message "multiple providers configured
(...) and no default is set", pass the provider argument explicitly, or
set IMAGEGEN_DEFAULT_PROVIDER, or set the settings defaultProvider.output error carries the message "write failed", the tool could
not write to the out path. Check the directory and its permissions.output error carries the message "not a recognized image", the
backend returned bytes with no PNG, JPEG, or WebP magic. Inspect the kept
file; the backend may return an unsupported container.invalid_param error from the edit verb names an images path,
that file is absent or is not a regular file; pass readable image files.edit call fails with an http error and the message carries
status 400, the backend rejected the request; a common cause is a size
the edit endpoint does not accept (some backends accept only
size: "auto" for edits). Omit the size argument and retry.pnpm install
pnpm run build # tsc -> lib/
pnpm run lint # eslint src/ test/
pnpm run selftest # in-process: HTTP stub + config matrix + magic-byte checks CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: openai。