dsh-draw 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +201 -0
- package/README.es.md +194 -0
- package/README.hi.md +194 -0
- package/README.md +194 -0
- package/README.pt.md +194 -0
- package/README.zh.md +194 -0
- package/SECURITY.md +39 -0
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/cordis.patch.yml +48 -0
- package/lib/client.js +4787 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +1429 -0
- package/lib/typert.host.js +26 -0
- package/lib/types/client/DrawResultCard.d.ts +58 -0
- package/lib/types/client/DrawResultCard.d.ts.map +1 -0
- package/lib/types/client/DrawResultCard.js +48 -0
- package/lib/types/client/DrawSettingsTab.d.ts +31 -0
- package/lib/types/client/DrawSettingsTab.d.ts.map +1 -0
- package/lib/types/client/DrawSettingsTab.js +129 -0
- package/lib/types/client/index.d.ts +35 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js +98 -0
- package/lib/types/client/locales.d.ts +14 -0
- package/lib/types/client/locales.d.ts.map +1 -0
- package/lib/types/client/locales.js +57 -0
- package/lib/types/client/present.d.ts +80 -0
- package/lib/types/client/present.d.ts.map +1 -0
- package/lib/types/client/present.js +86 -0
- package/lib/types/client/remote.d.ts +268 -0
- package/lib/types/client/remote.d.ts.map +1 -0
- package/lib/types/client/remote.js +15 -0
- package/lib/types/client/styles.d.ts +11 -0
- package/lib/types/client/styles.d.ts.map +1 -0
- package/lib/types/client/styles.js +43 -0
- package/lib/types/config.d.ts +160 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +230 -0
- package/lib/types/drawer.d.ts +114 -0
- package/lib/types/drawer.d.ts.map +1 -0
- package/lib/types/drawer.js +138 -0
- package/lib/types/engine.d.ts +58 -0
- package/lib/types/engine.d.ts.map +1 -0
- package/lib/types/engine.js +135 -0
- package/lib/types/http.d.ts +89 -0
- package/lib/types/http.d.ts.map +1 -0
- package/lib/types/http.js +127 -0
- package/lib/types/index.d.ts +43 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +78 -0
- package/lib/types/quota.d.ts +69 -0
- package/lib/types/quota.d.ts.map +1 -0
- package/lib/types/quota.js +56 -0
- package/lib/types/router.d.ts +141 -0
- package/lib/types/router.d.ts.map +1 -0
- package/lib/types/router.js +207 -0
- package/lib/types/sanitize.d.ts +40 -0
- package/lib/types/sanitize.d.ts.map +1 -0
- package/lib/types/sanitize.js +103 -0
- package/lib/types/service.d.ts +59 -0
- package/lib/types/service.d.ts.map +1 -0
- package/lib/types/service.js +131 -0
- package/lib/types/session-events.d.ts +66 -0
- package/lib/types/session-events.d.ts.map +1 -0
- package/lib/types/session-events.js +32 -0
- package/lib/types/tool.d.ts +30 -0
- package/lib/types/tool.d.ts.map +1 -0
- package/lib/types/tool.js +131 -0
- package/lib/types/translate.d.ts +64 -0
- package/lib/types/translate.d.ts.map +1 -0
- package/lib/types/translate.js +56 -0
- package/lib/types/typert.host.d.ts +250 -0
- package/lib/types/typert.host.d.ts.map +1 -0
- package/lib/types/typert.host.js +23 -0
- package/lib/types/version.d.ts +10 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/version.js +9 -0
- package/lib/types/wire.d.ts +699 -0
- package/lib/types/wire.d.ts.map +1 -0
- package/lib/types/wire.js +273 -0
- package/lib/wire-Cc4JZ3jR.js +4370 -0
- package/package.json +179 -0
- package/src/client/DrawResultCard.tsx +100 -0
- package/src/client/DrawSettingsTab.tsx +159 -0
- package/src/client/index.ts +123 -0
- package/src/client/locales.ts +84 -0
- package/src/client/present.ts +137 -0
- package/src/client/remote.ts +44 -0
- package/src/client/styles.ts +44 -0
- package/src/config.ts +358 -0
- package/src/drawer.ts +234 -0
- package/src/engine.ts +182 -0
- package/src/http.ts +161 -0
- package/src/index.ts +93 -0
- package/src/quota.ts +98 -0
- package/src/router.ts +309 -0
- package/src/sanitize.ts +113 -0
- package/src/service.ts +169 -0
- package/src/session-events.ts +70 -0
- package/src/tool.ts +145 -0
- package/src/translate.ts +101 -0
- package/src/typert.host.ts +25 -0
- package/src/version.ts +10 -0
- package/src/wire.ts +417 -0
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🎨 dsh-draw
|
|
4
|
+
|
|
5
|
+
**Unified static-image generation routing for DeepSeek Harness.**
|
|
6
|
+
|
|
7
|
+
*One tool, many engines — health-aware fallback, durable results, counted usage.*
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/topics/dsh-plugin)
|
|
11
|
+
[](#)
|
|
12
|
+
[](https://github.com/PerryLink/dsh-draw/actions)
|
|
13
|
+
[](https://github.com/PerryLink/dsh-draw/releases)
|
|
14
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
15
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
16
|
+
|
|
17
|
+
[English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Compatibility
|
|
24
|
+
|
|
25
|
+
| Surface | Status |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Harness | DeepSeek Harness `0.1.0-rc.6` (compat declared for `0.1.0-rc.6`) |
|
|
28
|
+
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
29
|
+
| Engines | Any OpenAI-compatible images endpoint; presets for OpenAI Images (`gpt-image-1`) and Zhipu CogView (`cogview-3-flash`) |
|
|
30
|
+
| Surfaces | Host `image_generate` tool + web result card + Plugins settings tab |
|
|
31
|
+
|
|
32
|
+
## What you get
|
|
33
|
+
|
|
34
|
+
`dsh-draw` gives the harness one unified `image_generate` tool with standard parameters (`prompt`/`size`/`count`/`quality`/`style`/`engine`) that are translated per engine:
|
|
35
|
+
|
|
36
|
+
- **Multi-engine routing** — a config-driven chain (OpenAI Images, Zhipu CogView, or any OpenAI-compatible endpoint) walked top-down with **health-aware fallback**: consecutive failures push an engine into cooldown, and the next healthy engine serves the call.
|
|
37
|
+
- **Durable results** — generated images are saved as workspace attachments (content-addressed, under the harness's attachment policy) and returned as canonical file references.
|
|
38
|
+
- **Quota accounting** — per-session caps on generation calls and image bytes, folded from the durable session log and enforced before engine spend and before storage.
|
|
39
|
+
- **Credentials as references** — engine API keys are environment-variable names resolved per call through the official `ctx.credentials` seam; literal keys are never stored in configuration and never logged.
|
|
40
|
+
- **Web surfaces** — an in-conversation result card (images, engine, quota, one-click regenerate) and a Plugins settings tab (engine chain, credential status, probes, quota limits).
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
model harness
|
|
44
|
+
│ image_generate {prompt, ...} ──▶ validate ──▶ quota check ──▶ router
|
|
45
|
+
│ openai ──(fail)──▶ cogview ──▶ images
|
|
46
|
+
│ ◀── canonical JSON + image blocks (durable attachment refs)
|
|
47
|
+
│ └── draw/generated session event (quota + audit)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick start
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
# 1. install the bundle into your profile
|
|
54
|
+
dsh plugin --profile web add "github:PerryLink/dsh-draw#main"
|
|
55
|
+
|
|
56
|
+
# or from npm (published releases)
|
|
57
|
+
dsh plugin --profile web add dsh-draw
|
|
58
|
+
|
|
59
|
+
# 2. provide the engine keys as credential references (environment variables)
|
|
60
|
+
# OPENAI_API_KEY and/or ZHIPU_API_KEY — never in the profile patch
|
|
61
|
+
|
|
62
|
+
# 3. restart and verify the row
|
|
63
|
+
dsh --profile web --dump-config | grep -A2 'id: dsh-draw'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then ask the agent to draw:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
> Draw a 1536x1024 landscape of a lighthouse at dusk, vivid style.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Install & uninstall
|
|
73
|
+
|
|
74
|
+
- **git channel** (latest `main`): `dsh plugin --profile web add "github:PerryLink/dsh-draw#main"` — the `prepare` script builds with production dependencies only.
|
|
75
|
+
- **npm channel** (published releases): `dsh plugin --profile web add dsh-draw`.
|
|
76
|
+
- **tarball channel**: `pnpm pack` in this repo, then `dsh plugin --profile web add ./dsh-draw-<version>.tgz`.
|
|
77
|
+
- **uninstall**: `dsh plugin --profile web remove dsh-draw` (or remove the row from the profile patch).
|
|
78
|
+
|
|
79
|
+
> If pnpm reports `ERR_PNPM_IGNORED_BUILDS` for this package (esbuild's harmless platform-binary validation), add `allowBuilds: { esbuild: true }` to your `pnpm-workspace.yaml` — the `dsh` CLI prints the exact snippet.
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
All tunables are Schemastery `Config` fields (changeable from cordis.yml). An id-targeted override replaces the whole row — restate every key you need. `cordis.patch.yml` documents each key inline.
|
|
84
|
+
|
|
85
|
+
| Key | Default | Meaning |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `engines` | OpenAI + CogView presets | Ordered engine chain, walked top-down with fallback; each entry: `id`, `baseUrl` (no credentials), `model`, `apiKeyRef` (env-var name), `enabled`, `sizeMap`, `qualitySupported`, `styleSupported`, `responseFormat` (`b64_json`/`url`), `imageMediaType` |
|
|
88
|
+
| `defaultEngine` | `openai` | Engine id the router prefers; must name a configured engine |
|
|
89
|
+
| `requestTimeoutMs` | `120000` | Per-generation HTTP timeout (1000..600000) |
|
|
90
|
+
| `maxImagesPerCall` | `4` | Cap on images one call may produce (1..10) |
|
|
91
|
+
| `maxPromptLength` | `4000` | Prompt length cap in characters (1..32000) |
|
|
92
|
+
| `maxGenerationsPerSession` | `200` | Per-session generation-call cap (1..100000) |
|
|
93
|
+
| `maxBytesPerSession` | `209715200` | Per-session image-byte cap (1048576..4294967296) |
|
|
94
|
+
| `failureThreshold` | `2` | Consecutive failures before an engine enters cooldown (1..10) |
|
|
95
|
+
| `cooldownMs` | `60000` | Engine cooldown after the threshold trips (1000..3600000) |
|
|
96
|
+
|
|
97
|
+
Example override in your profile patch:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
- insert:
|
|
101
|
+
- id: dsh-draw
|
|
102
|
+
name: dsh-draw
|
|
103
|
+
config:
|
|
104
|
+
defaultEngine: cogview
|
|
105
|
+
maxImagesPerCall: 2
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Tools & surfaces
|
|
109
|
+
|
|
110
|
+
| Surface | Notes |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `image_generate` | Standard parameters; returns canonical JSON (engine/model/size, image references, quota, fallback flag, attempts) plus image content blocks |
|
|
113
|
+
| Result card (`tool.call.toolview`, key `image_generate`) | Images, engine/quota line, one-click regenerate (full drawer path: quota + routing + audit) |
|
|
114
|
+
| Settings tab (Plugins → Image generation) | Engine chain, credential status, set/remove API keys (credential references), connectivity probes, quota limits |
|
|
115
|
+
|
|
116
|
+
## Permissions & data
|
|
117
|
+
|
|
118
|
+
- **Permissions**: the plugin makes outbound HTTPS calls to the configured engine endpoints only; every other surface is read-only. The settings tab's only writes are credential set/remove calls on the official `ctx.credentials` seam.
|
|
119
|
+
- **Data**: generated images are saved through the official attachment store under the harness's own attachment policy. Quota usage is folded from the `draw/generated` session events — nothing else is stored.
|
|
120
|
+
- **Session log**: the `draw/generated` event records engine, model, standardized request, byte totals, and attachment ids — the audit facts, never the API keys.
|
|
121
|
+
|
|
122
|
+
## Security boundaries
|
|
123
|
+
|
|
124
|
+
- **Credential references, never literals.** `apiKeyRef` names an environment variable; a `baseUrl` embedding credentials fails the load loudly.
|
|
125
|
+
- **Sanitized display.** URLs, probe notes, and error text are redacted (userinfo passwords, credential query values, bearer tokens, JWTs) before any display or log.
|
|
126
|
+
- **Quota before spend.** Generation and byte caps are checked before engine calls and before attachment storage; exhausted sessions fail fast without spending engine credits.
|
|
127
|
+
- **Fail loud, fall back deliberately.** Malformed responses surface as structured errors; a failing engine is skipped after its cooldown threshold, and a fully exhausted chain returns the complete attempt record instead of pretending success.
|
|
128
|
+
|
|
129
|
+
## Known limitations
|
|
130
|
+
|
|
131
|
+
- **Image models only.** No video, audio, or edit endpoints; no vision understanding.
|
|
132
|
+
- **Engine compatibility.** Engines must speak the OpenAI `POST /images/generations` shape (base64 or URL delivery); provider-specific extras are out of scope.
|
|
133
|
+
- **Cost awareness is structural.** The plugin counts calls and bytes but does not know engine pricing — pair with `dsh-budget` for cost governance.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
pnpm install # node ^22.19 || >=24
|
|
139
|
+
pnpm run typecheck # tsc: src + tests against the local harness checkout
|
|
140
|
+
pnpm run typecheck:ci # tsc against the published 0.1.0-rc.6 faces (no paths)
|
|
141
|
+
pnpm test # vitest: 77 tests, 11 suites (scripted transport, real Context/Session/ToolRuntime)
|
|
142
|
+
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
143
|
+
pnpm run verify:self-contained # dependency specs resolve from the registry
|
|
144
|
+
pnpm run verify:artifacts # host ESM face + typert manifest + browser bundle + config files
|
|
145
|
+
pnpm pack # the published tarball
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Topics
|
|
149
|
+
|
|
150
|
+
`dsh`, `dsh-plugin`, `deepseek-harness`, `deepseek`, `cordis`, `image-generation`, `openai-images`, `cogview`, `zhipu`, `text-to-image`
|
|
151
|
+
|
|
152
|
+
## Contributors
|
|
153
|
+
|
|
154
|
+
- [@PerryLink](https://github.com/PerryLink) — creator and maintainer: engine router, drawer, quota accounting, Typert wire vocabulary, browser half, and the five-language docs.
|
|
155
|
+
|
|
156
|
+
## PerryLink DSH Plugin Family
|
|
157
|
+
|
|
158
|
+
This project is one of the [29 DeepSeek Harness plugins](https://github.com/PerryLink) maintained by [PerryLink](https://github.com/PerryLink). If this one helps you, the others likely will too:
|
|
159
|
+
|
|
160
|
+
| Plugin | One-liner |
|
|
161
|
+
|---|---|
|
|
162
|
+
| [dsh-auto-review](https://github.com/PerryLink/dsh-auto-review) | Second-model auto-review on the approval chain, fail-closed by default |
|
|
163
|
+
| [dsh-background-agents](https://github.com/PerryLink/dsh-background-agents) | Durable background child agents with a Web UI sidebar, messaging and interrupt |
|
|
164
|
+
| [dsh-budget](https://github.com/PerryLink/dsh-budget) | Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel. |
|
|
165
|
+
| [dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind) | Claude Code /rewind-equivalent: snapshots, session forks, one-shot restore |
|
|
166
|
+
| [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH |
|
|
167
|
+
| [dsh-click](https://github.com/PerryLink/dsh-click) | Cross-platform native desktop control for DeepSeek Harness — Windows first. |
|
|
168
|
+
| [dsh-composer-history](https://github.com/PerryLink/dsh-composer-history) | Terminal-style input history for the web composer: arrows, Ctrl+R search |
|
|
169
|
+
| [dsh-defend](https://github.com/PerryLink/dsh-defend) | Prompt-injection, jailbreak, and secret-leak defense for DeepSeek Harness. |
|
|
170
|
+
| [dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck) | Engineering-discipline guard: requirements grill, test gates, adversary review |
|
|
171
|
+
| **[dsh-draw](https://github.com/PerryLink/dsh-draw)** | Unified static-image generation routing for DeepSeek Harness. |
|
|
172
|
+
| [dsh-fast](https://github.com/PerryLink/dsh-fast) | Read-only performance diagnostics for DeepSeek Harness. |
|
|
173
|
+
| [dsh-github](https://github.com/PerryLink/dsh-github) | GitHub PR/issues integration for DSH, every write gated by approval |
|
|
174
|
+
| [dsh-library](https://github.com/PerryLink/dsh-library) | Local document knowledge base for DeepSeek Harness. |
|
|
175
|
+
| [dsh-local-ai](https://github.com/PerryLink/dsh-local-ai) | Local-model (Ollama) integration for DeepSeek Harness. |
|
|
176
|
+
| [dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions) | LSP diagnostics, formatting, completion, code actions and rename over language servers |
|
|
177
|
+
| [dsh-mask](https://github.com/PerryLink/dsh-mask) | PII masking middleware for DeepSeek Harness — anonymize personal data before it reaches the model, restore it at the display layer. |
|
|
178
|
+
| [dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel) | Read-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors |
|
|
179
|
+
| [dsh-memento](https://github.com/PerryLink/dsh-memento) | Approval-gated cross-session memory: ctx.memory seam + SQLite + memory tool |
|
|
180
|
+
| [dsh-observe](https://github.com/PerryLink/dsh-observe) | OpenTelemetry and Langfuse observability exporter for DeepSeek Harness. |
|
|
181
|
+
| [dsh-output-styles](https://github.com/PerryLink/dsh-output-styles) | Claude Code outputStyles-equivalent runtime style switching |
|
|
182
|
+
| [dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules) | Claude Code-style declarative allow/deny/ask permission rules with audit |
|
|
183
|
+
| [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | Plugin-development knowledge base as an on-demand agent skill |
|
|
184
|
+
| [dsh-score](https://github.com/PerryLink/dsh-score) | Multi-dimensional quality scoring for DeepSeek Harness plugins. |
|
|
185
|
+
| [dsh-session-pin](https://github.com/PerryLink/dsh-session-pin) | Pin sessions in the Web sidebar with durable ordering |
|
|
186
|
+
| [dsh-session-sync](https://github.com/PerryLink/dsh-session-sync) | Cross-device session sync for DeepSeek Harness — a dedicated git mirror of your session store. |
|
|
187
|
+
| [dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security) | Security-audit skill pack: secret scan, dependency and supply-chain review |
|
|
188
|
+
| [dsh-talk](https://github.com/PerryLink/dsh-talk) | Voice-first session loop for DeepSeek Harness: talk to it, hear it answer. |
|
|
189
|
+
| [dsh-test-drive](https://github.com/PerryLink/dsh-test-drive) | Isolated install-and-smoke test drives for DeepSeek Harness plugins. |
|
|
190
|
+
| [dsh-translate](https://github.com/PerryLink/dsh-translate) | Vendor parameter translation and deterministic JSON repair for DeepSeek Harness. |
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-draw contributors
|
package/README.pt.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🎨 dsh-draw
|
|
4
|
+
|
|
5
|
+
**Roteamento unificado de geração de imagens estáticas para o DeepSeek Harness.**
|
|
6
|
+
|
|
7
|
+
*Uma ferramenta, muitos motores — fallback ciente da saúde, resultados duráveis, uso contabilizado.*
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/topics/dsh-plugin)
|
|
11
|
+
[](#)
|
|
12
|
+
[](https://github.com/PerryLink/dsh-draw/actions)
|
|
13
|
+
[](https://github.com/PerryLink/dsh-draw/releases)
|
|
14
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
15
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
16
|
+
|
|
17
|
+
[English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Compatibilidade
|
|
24
|
+
|
|
25
|
+
| Superfície | Status |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Harness | DeepSeek Harness `0.1.0-rc.6` (compatibilidade declarada para `0.1.0-rc.6`) |
|
|
28
|
+
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
29
|
+
| Motores | Qualquer endpoint de imagens compatível com OpenAI; presets para OpenAI Images (`gpt-image-1`) e Zhipu CogView (`cogview-3-flash`) |
|
|
30
|
+
| Superfícies | Ferramenta host `image_generate` + cartão de resultado web + aba de ajustes de Plugins |
|
|
31
|
+
|
|
32
|
+
## O que você ganha
|
|
33
|
+
|
|
34
|
+
O `dsh-draw` dá ao harness uma ferramenta unificada `image_generate` com parâmetros padrão (`prompt`/`size`/`count`/`quality`/`style`/`engine`) traduzidos por motor:
|
|
35
|
+
|
|
36
|
+
- **Roteamento multi-motor** — uma cadeia configurável (OpenAI Images, Zhipu CogView ou qualquer endpoint compatível com OpenAI) percorrida de cima para baixo com **fallback ciente da saúde**: falhas consecutivas colocam um motor em cooldown e o próximo motor saudável atende a chamada.
|
|
37
|
+
- **Resultados duráveis** — as imagens geradas são salvas como anexos do workspace (endereçadas por conteúdo, sob a política de anexos do harness) e retornadas como referências de arquivo canônicas.
|
|
38
|
+
- **Contabilidade de cota** — limites por sessão de chamadas de geração e bytes de imagem, dobrados a partir do registro de sessão durável e aplicados antes do gasto no motor e antes do armazenamento.
|
|
39
|
+
- **Credenciais como referências** — as chaves de API são nomes de variáveis de ambiente resolvidos por chamada através do seam oficial `ctx.credentials`; chaves literais nunca ficam na configuração nem nos logs.
|
|
40
|
+
- **Superfícies web** — um cartão de resultado na conversa (imagens, motor, cota, regenerar com um clique) e uma aba de ajustes de Plugins (cadeia de motores, estado de credenciais, sondas, limites de cota).
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
modelo harness
|
|
44
|
+
│ image_generate {prompt, ...} ──▶ validar ──▶ checar cota ──▶ rotear
|
|
45
|
+
│ openai ──(falha)──▶ cogview ──▶ imagens
|
|
46
|
+
│ ◀── JSON canônico + blocos de imagem (referências de anexo duráveis)
|
|
47
|
+
│ └── evento de sessão draw/generated (cota + auditoria)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Início rápido
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
# 1. instale o bundle no seu perfil
|
|
54
|
+
dsh plugin --profile web add "github:PerryLink/dsh-draw#main"
|
|
55
|
+
|
|
56
|
+
# ou pelo npm (versões publicadas)
|
|
57
|
+
dsh plugin --profile web add dsh-draw
|
|
58
|
+
|
|
59
|
+
# 2. forneça as chaves do motor como referências de credencial (variáveis de ambiente)
|
|
60
|
+
# OPENAI_API_KEY e/ou ZHIPU_API_KEY — nunca no patch do perfil
|
|
61
|
+
|
|
62
|
+
# 3. reinicie e verifique a linha
|
|
63
|
+
dsh --profile web --dump-config | grep -A2 'id: dsh-draw'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Depois peça ao agente para desenhar:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
> Desenhe uma paisagem 1536x1024 de um farol ao entardecer, estilo vívido.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Instalação e desinstalação
|
|
73
|
+
|
|
74
|
+
- **Canal git** (último `main`): `dsh plugin --profile web add "github:PerryLink/dsh-draw#main"` — o script `prepare` compila apenas com dependências de produção.
|
|
75
|
+
- **Canal npm** (versões publicadas): `dsh plugin --profile web add dsh-draw`.
|
|
76
|
+
- **Canal tarball**: `pnpm pack` neste repositório e então `dsh plugin --profile web add ./dsh-draw-<version>.tgz`.
|
|
77
|
+
- **Desinstalar**: `dsh plugin --profile web remove dsh-draw` (ou remova a linha do patch do perfil).
|
|
78
|
+
|
|
79
|
+
> Se o pnpm reportar `ERR_PNPM_IGNORED_BUILDS` para este pacote (a validação inofensiva do binário de plataforma do esbuild), adicione `allowBuilds: { esbuild: true }` ao seu `pnpm-workspace.yaml` — o CLI `dsh` imprime o trecho exato.
|
|
80
|
+
|
|
81
|
+
## Configuração
|
|
82
|
+
|
|
83
|
+
Todos os ajustes são campos `Config` do Schemastery (alteráveis pelo cordis.yml). Uma sobrescrita direcionada por id substitui a linha inteira — redeclare cada chave que precisar. O `cordis.patch.yml` documenta cada chave em linha.
|
|
84
|
+
|
|
85
|
+
| Chave | Padrão | Significado |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `engines` | Presets OpenAI + CogView | Cadeia ordenada de motores, percorrida de cima para baixo com fallback; cada entrada: `id`, `baseUrl` (sem credenciais), `model`, `apiKeyRef` (nome de variável de ambiente), `enabled`, `sizeMap`, `qualitySupported`, `styleSupported`, `responseFormat` (`b64_json`/`url`), `imageMediaType` |
|
|
88
|
+
| `defaultEngine` | `openai` | Id de motor preferido pelo roteador; deve nomear um motor configurado |
|
|
89
|
+
| `requestTimeoutMs` | `120000` | Tempo limite HTTP por geração (1000..600000) |
|
|
90
|
+
| `maxImagesPerCall` | `4` | Limite de imagens por chamada (1..10) |
|
|
91
|
+
| `maxPromptLength` | `4000` | Limite de caracteres do prompt (1..32000) |
|
|
92
|
+
| `maxGenerationsPerSession` | `200` | Limite de chamadas por sessão (1..100000) |
|
|
93
|
+
| `maxBytesPerSession` | `209715200` | Limite de bytes de imagem por sessão (1048576..4294967296) |
|
|
94
|
+
| `failureThreshold` | `2` | Falhas consecutivas antes do cooldown (1..10) |
|
|
95
|
+
| `cooldownMs` | `60000` | Cooldown do motor após o limiar (1000..3600000) |
|
|
96
|
+
|
|
97
|
+
Exemplo de sobrescrita no patch do seu perfil:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
- insert:
|
|
101
|
+
- id: dsh-draw
|
|
102
|
+
name: dsh-draw
|
|
103
|
+
config:
|
|
104
|
+
defaultEngine: cogview
|
|
105
|
+
maxImagesPerCall: 2
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Ferramentas e superfícies
|
|
109
|
+
|
|
110
|
+
| Superfície | Notas |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `image_generate` | Parâmetros padrão; retorna JSON canônico (motor/modelo/tamanho, referências de imagem, cota, indicador de fallback, tentativas) mais blocos de imagem |
|
|
113
|
+
| Cartão de resultado (`tool.call.toolview`, chave `image_generate`) | Imagens, linha de motor/cota, regenerar com um clique (caminho completo do drawer: cota + roteamento + auditoria) |
|
|
114
|
+
| Aba de ajustes (Plugins → Image generation) | Cadeia de motores, estado de credenciais, definir/remover chaves de API (referências de credencial), sondas de conectividade, limites de cota |
|
|
115
|
+
|
|
116
|
+
## Permissões e dados
|
|
117
|
+
|
|
118
|
+
- **Permissões**: o plugin só faz chamadas HTTPS de saída para os endpoints de motor configurados; todo o resto é somente leitura. As únicas escritas da aba de ajustes são as chamadas de definir/remover credenciais no seam oficial `ctx.credentials`.
|
|
119
|
+
- **Dados**: as imagens geradas são salvas através do armazenamento de anexos oficial sob a política de anexos do harness. O uso de cota é dobrado dos eventos de sessão `draw/generated` — nada mais é armazenado.
|
|
120
|
+
- **Registro de sessão**: o evento `draw/generated` registra motor, modelo, solicitação padronizada, totais de bytes e ids de anexo — os fatos de auditoria, nunca as chaves de API.
|
|
121
|
+
|
|
122
|
+
## Limites de segurança
|
|
123
|
+
|
|
124
|
+
- **Referências de credencial, nunca literais.** `apiKeyRef` nomeia uma variável de ambiente; um `baseUrl` com credenciais falha ruidosamente ao carregar.
|
|
125
|
+
- **Exibição saneada.** URLs, notas de sonda e texto de erro são redigidos (senhas de userinfo, valores de credencial em queries, tokens bearer, JWT) antes de qualquer exibição ou log.
|
|
126
|
+
- **Cota antes do gasto.** Os limites de geração e bytes são verificados antes das chamadas ao motor e antes do armazenamento; sessões esgotadas falham rápido sem gastar créditos.
|
|
127
|
+
- **Falha ruidosa, fallback deliberado.** Respostas malformadas geram erros estruturados; um motor com falhas é ignorado após o limiar de cooldown, e uma cadeia esgotada retorna o registro completo de tentativas em vez de fingir sucesso.
|
|
128
|
+
|
|
129
|
+
## Limitações conhecidas
|
|
130
|
+
|
|
131
|
+
- **Somente modelos de imagem.** Sem endpoints de vídeo, áudio ou edição; sem compreensão visual.
|
|
132
|
+
- **Compatibilidade de motores.** Os motores devem falar a forma `POST /images/generations` da OpenAI (entrega base64 ou URL); extras específicos de cada provedor ficam de fora.
|
|
133
|
+
- **Consciência de custo é estrutural.** O plugin conta chamadas e bytes, mas não conhece o preço dos motores — combine com `dsh-budget` para a governança de custo.
|
|
134
|
+
|
|
135
|
+
## Desenvolvimento
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
pnpm install # node ^22.19 || >=24
|
|
139
|
+
pnpm run typecheck # tsc: src + tests contra o checkout local do harness
|
|
140
|
+
pnpm run typecheck:ci # tsc contra as faces publicadas 0.1.0-rc.6 (sem paths)
|
|
141
|
+
pnpm test # vitest: 77 testes, 11 suítes (transporte roteirizado, Context/Session/ToolRuntime reais)
|
|
142
|
+
pnpm run build # declarações tsc + bundles tsdown (lib/)
|
|
143
|
+
pnpm run verify:self-contained # as especificações de dependências resolvem pelo registry
|
|
144
|
+
pnpm run verify:artifacts # face ESM host + manifesto typert + bundle de navegador + arquivos de configuração
|
|
145
|
+
pnpm pack # o tarball publicado
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Topics
|
|
149
|
+
|
|
150
|
+
`dsh`, `dsh-plugin`, `deepseek-harness`, `deepseek`, `cordis`, `image-generation`, `openai-images`, `cogview`, `zhipu`, `text-to-image`
|
|
151
|
+
|
|
152
|
+
## Contributors
|
|
153
|
+
|
|
154
|
+
- [@PerryLink](https://github.com/PerryLink) — criador e mantenedor: roteador de motores, drawer, contabilidade de cota, vocabulário wire do Typert, metade de navegador e a documentação em cinco idiomas.
|
|
155
|
+
|
|
156
|
+
## PerryLink DSH Plugin Family
|
|
157
|
+
|
|
158
|
+
Este projeto é um dos [29 complementos do DeepSeek Harness](https://github.com/PerryLink) mantidos por [PerryLink](https://github.com/PerryLink). Se este ajuda você, os outros provavelmente também ajudarão:
|
|
159
|
+
|
|
160
|
+
| Plugin | One-liner |
|
|
161
|
+
|---|---|
|
|
162
|
+
| [dsh-auto-review](https://github.com/PerryLink/dsh-auto-review) | Auto-revisão com segundo modelo na cadeia de aprovação, falha fechada por padrão |
|
|
163
|
+
| [dsh-background-agents](https://github.com/PerryLink/dsh-background-agents) | Agentes filhos em segundo plano e duráveis com barra lateral Web, mensagens e interrupção |
|
|
164
|
+
| [dsh-budget](https://github.com/PerryLink/dsh-budget) | Governança de custos para DeepSeek Harness: orçamentos, carbono e latência em um painel. |
|
|
165
|
+
| [dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind) | Equivalente ao /rewind do Claude Code: instantâneos, bifurcações e restauração de uma vez |
|
|
166
|
+
| [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | Migra sessões, memória, skills e CLAUDE.md do Claude Code para o DSH |
|
|
167
|
+
| [dsh-click](https://github.com/PerryLink/dsh-click) | Controle de desktop nativo multiplataforma para DeepSeek Harness — Windows primeiro. |
|
|
168
|
+
| [dsh-composer-history](https://github.com/PerryLink/dsh-composer-history) | Histórico de entrada estilo terminal para o compositor web: setas, busca Ctrl+R |
|
|
169
|
+
| [dsh-defend](https://github.com/PerryLink/dsh-defend) | Defesa contra injeção de prompt, jailbreak e vazamento de segredos para DeepSeek Harness. |
|
|
170
|
+
| [dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck) | Guarda de disciplina de engenharia: sabatina de requisitos, portões de teste, revisão adversária |
|
|
171
|
+
| **[dsh-draw](https://github.com/PerryLink/dsh-draw)** | Roteamento unificado de geração de imagens estáticas para DeepSeek Harness. |
|
|
172
|
+
| [dsh-fast](https://github.com/PerryLink/dsh-fast) | Diagnóstico de desempenho somente leitura para DeepSeek Harness. |
|
|
173
|
+
| [dsh-github](https://github.com/PerryLink/dsh-github) | Integração de PR/issues do GitHub para DSH, toda escrita com aprovação |
|
|
174
|
+
| [dsh-library](https://github.com/PerryLink/dsh-library) | Base de conhecimento documental local para DeepSeek Harness. |
|
|
175
|
+
| [dsh-local-ai](https://github.com/PerryLink/dsh-local-ai) | Integração de modelos locais (Ollama) para DeepSeek Harness. |
|
|
176
|
+
| [dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions) | Diagnóstico, formatação, completação, ações e renomeação LSP via servidores de linguagem |
|
|
177
|
+
| [dsh-mask](https://github.com/PerryLink/dsh-mask) | Middleware de mascaramento de PII para DeepSeek Harness — anonimiza antes do modelo e restaura na camada de exibição. |
|
|
178
|
+
| [dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel) | Painel MCP somente leitura: comando /mcp + aba de configurações com status, ferramentas e erros |
|
|
179
|
+
| [dsh-memento](https://github.com/PerryLink/dsh-memento) | Memória entre sessões com porta de aprovação: seam ctx.memory + SQLite + ferramenta memory |
|
|
180
|
+
| [dsh-observe](https://github.com/PerryLink/dsh-observe) | Exportador de observabilidade OpenTelemetry e Langfuse para DeepSeek Harness. |
|
|
181
|
+
| [dsh-output-styles](https://github.com/PerryLink/dsh-output-styles) | Troca de estilos em tempo de execução equivalente ao outputStyles do Claude Code |
|
|
182
|
+
| [dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules) | Regras declarativas allow/deny/ask estilo Claude Code com auditoria |
|
|
183
|
+
| [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | Base de conhecimento de desenvolvimento de plugins como skill de agente sob demanda |
|
|
184
|
+
| [dsh-score](https://github.com/PerryLink/dsh-score) | Pontuação de qualidade multidimensional para plugins do DeepSeek Harness. |
|
|
185
|
+
| [dsh-session-pin](https://github.com/PerryLink/dsh-session-pin) | Fixa sessões na barra lateral Web com ordenação durável |
|
|
186
|
+
| [dsh-session-sync](https://github.com/PerryLink/dsh-session-sync) | Sincronização de sessões entre dispositivos para DeepSeek Harness — um espelho git dedicado do seu armazenamento de sessões. |
|
|
187
|
+
| [dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security) | Pacote de skills de auditoria de segurança: varredura de segredos, revisão de dependências e cadeia de suprimentos |
|
|
188
|
+
| [dsh-talk](https://github.com/PerryLink/dsh-talk) | Loop de sessão com voz para DeepSeek Harness: fale e ouça a resposta. |
|
|
189
|
+
| [dsh-test-drive](https://github.com/PerryLink/dsh-test-drive) | Testes isolados de instalação e inicialização para plugins do DeepSeek Harness. |
|
|
190
|
+
| [dsh-translate](https://github.com/PerryLink/dsh-translate) | Tradução de parâmetros entre fornecedores e reparo determinístico de JSON para DeepSeek Harness. |
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-draw contributors
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🎨 dsh-draw
|
|
4
|
+
|
|
5
|
+
**DeepSeek Harness 的统一静态图像生成路由。**
|
|
6
|
+
|
|
7
|
+
*一个工具、多个引擎 —— 健康感知回退、结果持久、用量记账。*
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/topics/dsh-plugin)
|
|
11
|
+
[](#)
|
|
12
|
+
[](https://github.com/PerryLink/dsh-draw/actions)
|
|
13
|
+
[](https://github.com/PerryLink/dsh-draw/releases)
|
|
14
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
15
|
+
[](https://www.npmjs.com/package/dsh-draw)
|
|
16
|
+
|
|
17
|
+
[English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 兼容性
|
|
24
|
+
|
|
25
|
+
| 方面 | 状态 |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Harness | DeepSeek Harness `0.1.0-rc.6`(声明兼容 `0.1.0-rc.6`) |
|
|
28
|
+
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
29
|
+
| 引擎 | 任意 OpenAI 兼容图像端点;内置 OpenAI Images(`gpt-image-1`)与智谱 CogView(`cogview-3-flash`)预设 |
|
|
30
|
+
| 界面 | Host `image_generate` 工具 + Web 结果卡片 + Plugins 设置页签 |
|
|
31
|
+
|
|
32
|
+
## 你能得到什么
|
|
33
|
+
|
|
34
|
+
`dsh-draw` 给 harness 一个统一的 `image_generate` 工具,标准参数(`prompt`/`size`/`count`/`quality`/`style`/`engine`)按引擎翻译:
|
|
35
|
+
|
|
36
|
+
- **多引擎路由** —— 配置驱动的引擎链(OpenAI Images、智谱 CogView 或任意 OpenAI 兼容端点)自上而下执行,**健康感知回退**:连续失败让引擎进入冷却,由下一个健康引擎接单。
|
|
37
|
+
- **结果持久化** —— 生成的图片存为工作区附件(内容寻址、受 harness 附件策略约束),返回规范文件引用。
|
|
38
|
+
- **配额记账** —— 按会话的调用次数与图片字节上限,从持久会话日志折叠计算,引擎开销前与落盘前双重强制。
|
|
39
|
+
- **凭据即引用** —— 引擎 API 密钥是环境变量名,每次调用经官方 `ctx.credentials` 接缝解析;配置里绝不写明文、日志里绝不出现。
|
|
40
|
+
- **Web 界面** —— 会话内结果卡片(图片、引擎、配额、一键重新生成)与 Plugins 设置页签(引擎链、凭据状态、探测、配额上限)。
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
模型 harness
|
|
44
|
+
│ image_generate {prompt, ...} ──▶ 校验 ──▶ 配额检查 ──▶ 路由
|
|
45
|
+
│ openai ──(失败)──▶ cogview ──▶ 图片
|
|
46
|
+
│ ◀── 规范 JSON + 图片块(持久附件引用)
|
|
47
|
+
│ └── draw/generated 会话事件(配额 + 审计)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 快速开始
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
# 1. 把 bundle 装进你的 profile
|
|
54
|
+
dsh plugin --profile web add "github:PerryLink/dsh-draw#main"
|
|
55
|
+
|
|
56
|
+
# 或从 npm 安装(正式发布版)
|
|
57
|
+
dsh plugin --profile web add dsh-draw
|
|
58
|
+
|
|
59
|
+
# 2. 以凭据引用(环境变量)提供引擎密钥
|
|
60
|
+
# OPENAI_API_KEY 和/或 ZHIPU_API_KEY —— 绝不写进 profile patch
|
|
61
|
+
|
|
62
|
+
# 3. 重启并核实行
|
|
63
|
+
dsh --profile web --dump-config | grep -A2 'id: dsh-draw'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
然后让 agent 画图:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
> 画一张 1536x1024 的黄昏灯塔风景,vivid 风格。
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 安装与卸载
|
|
73
|
+
|
|
74
|
+
- **git 通道**(最新 `main`):`dsh plugin --profile web add "github:PerryLink/dsh-draw#main"` —— `prepare` 脚本仅用生产依赖构建。
|
|
75
|
+
- **npm 通道**(正式发布版):`dsh plugin --profile web add dsh-draw`。
|
|
76
|
+
- **tarball 通道**:在本仓库执行 `pnpm pack`,然后 `dsh plugin --profile web add ./dsh-draw-<version>.tgz`。
|
|
77
|
+
- **卸载**:`dsh plugin --profile web remove dsh-draw`(或从 profile patch 中删除该行)。
|
|
78
|
+
|
|
79
|
+
> 如果 pnpm 对本包报 `ERR_PNPM_IGNORED_BUILDS`(esbuild 的平台二进制无害校验),在你的 `pnpm-workspace.yaml` 中加入 `allowBuilds: { esbuild: true }` —— `dsh` CLI 会打印确切片段。
|
|
80
|
+
|
|
81
|
+
## 配置
|
|
82
|
+
|
|
83
|
+
所有可调项都是 Schemastery `Config` 字段(可在 cordis.yml 中修改)。按 id 定向覆盖会替换整行 —— 需要重新声明每个键。`cordis.patch.yml` 内联说明了每个键。
|
|
84
|
+
|
|
85
|
+
| 键 | 默认值 | 含义 |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `engines` | OpenAI + CogView 预设 | 有序引擎链,自上而下带回退;每项:`id`、`baseUrl`(不含凭据)、`model`、`apiKeyRef`(环境变量名)、`enabled`、`sizeMap`、`qualitySupported`、`styleSupported`、`responseFormat`(`b64_json`/`url`)、`imageMediaType` |
|
|
88
|
+
| `defaultEngine` | `openai` | 路由首选引擎 id;必须是已配置引擎 |
|
|
89
|
+
| `requestTimeoutMs` | `120000` | 每次生成 HTTP 超时(1000..600000) |
|
|
90
|
+
| `maxImagesPerCall` | `4` | 单次调用可生成图片上限(1..10) |
|
|
91
|
+
| `maxPromptLength` | `4000` | 提示词字符上限(1..32000) |
|
|
92
|
+
| `maxGenerationsPerSession` | `200` | 每会话生成调用上限(1..100000) |
|
|
93
|
+
| `maxBytesPerSession` | `209715200` | 每会话图片字节上限(1048576..4294967296) |
|
|
94
|
+
| `failureThreshold` | `2` | 引擎进入冷却前的连续失败次数(1..10) |
|
|
95
|
+
| `cooldownMs` | `60000` | 触发阈值后的冷却时长(1000..3600000) |
|
|
96
|
+
|
|
97
|
+
profile patch 中的覆盖示例:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
- insert:
|
|
101
|
+
- id: dsh-draw
|
|
102
|
+
name: dsh-draw
|
|
103
|
+
config:
|
|
104
|
+
defaultEngine: cogview
|
|
105
|
+
maxImagesPerCall: 2
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 工具与界面
|
|
109
|
+
|
|
110
|
+
| 界面 | 说明 |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `image_generate` | 标准参数;返回规范 JSON(引擎/模型/尺寸、图片引用、配额、回退标志、尝试记录)加图片内容块 |
|
|
113
|
+
| 结果卡片(`tool.call.toolview`,key `image_generate`) | 图片、引擎/配额行、一键重新生成(完整 drawer 路径:配额 + 路由 + 审计) |
|
|
114
|
+
| 设置页签(Plugins → 图像生成) | 引擎链、凭据状态、设置/移除 API 密钥(凭据引用)、连通性探测、配额上限 |
|
|
115
|
+
|
|
116
|
+
## 权限与数据
|
|
117
|
+
|
|
118
|
+
- **权限**:插件仅对配置的引擎端点发起 HTTPS 出站请求;其余界面全部只读。设置页签唯一的写入是对官方 `ctx.credentials` 接缝的凭据设置/移除。
|
|
119
|
+
- **数据**:生成的图片经官方附件存储落盘,受 harness 附件策略约束。配额用量从 `draw/generated` 会话事件折叠 —— 不额外存储任何东西。
|
|
120
|
+
- **会话日志**:`draw/generated` 事件记录引擎、模型、标准化请求、字节总量与附件 id —— 审计事实,绝不包含 API 密钥。
|
|
121
|
+
|
|
122
|
+
## 安全边界
|
|
123
|
+
|
|
124
|
+
- **凭据即引用,绝不写明文。** `apiKeyRef` 命名环境变量;`baseUrl` 内嵌凭据会在加载期大声失败。
|
|
125
|
+
- **展示脱敏。** URL、探测备注与错误文本在展示或写日志前脱敏(userinfo 密码、凭据查询值、bearer token、JWT)。
|
|
126
|
+
- **配额先于开销。** 调用与字节上限在引擎调用前与附件落盘前检查;超限会话快速失败、不烧引擎额度。
|
|
127
|
+
- **大声失败、刻意回退。** 畸形响应给出结构化错误;引擎达到冷却阈值后被跳过;整条链耗尽时返回完整尝试记录而非假装成功。
|
|
128
|
+
|
|
129
|
+
## 已知限制
|
|
130
|
+
|
|
131
|
+
- **仅图像模型。** 无视频、音频或编辑端点;无视觉理解。
|
|
132
|
+
- **引擎兼容性。** 引擎需支持 OpenAI `POST /images/generations` 形状(base64 或 URL 交付);厂商专属扩展不在范围内。
|
|
133
|
+
- **成本感知是结构性的。** 插件统计调用次数与字节,但不了解引擎定价 —— 与 `dsh-budget` 配合做成本治理。
|
|
134
|
+
|
|
135
|
+
## 开发
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
pnpm install # node ^22.19 || >=24
|
|
139
|
+
pnpm run typecheck # tsc:src + tests,对照本地 harness checkout
|
|
140
|
+
pnpm run typecheck:ci # tsc:对照已发布的 0.1.0-rc.6 类型(无 paths)
|
|
141
|
+
pnpm test # vitest:77 个测试、11 个套件(scripted 传输、真实 Context/Session/ToolRuntime)
|
|
142
|
+
pnpm run build # tsc 声明 + tsdown 打包(lib/)
|
|
143
|
+
pnpm run verify:self-contained # 依赖声明全部来自 registry
|
|
144
|
+
pnpm run verify:artifacts # host ESM 面 + typert manifest + 浏览器包 + 配置文件
|
|
145
|
+
pnpm pack # 发布用 tarball
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Topics
|
|
149
|
+
|
|
150
|
+
`dsh`, `dsh-plugin`, `deepseek-harness`, `deepseek`, `cordis`, `image-generation`, `openai-images`, `cogview`, `zhipu`, `text-to-image`
|
|
151
|
+
|
|
152
|
+
## Contributors
|
|
153
|
+
|
|
154
|
+
- [@PerryLink](https://github.com/PerryLink) —— 创建者与维护者:引擎路由、drawer、配额记账、Typert wire 词汇、浏览器半与五语文档。
|
|
155
|
+
|
|
156
|
+
## PerryLink DSH Plugin Family
|
|
157
|
+
|
|
158
|
+
本项目是由 [PerryLink](https://github.com/PerryLink) 维护的 [29 个 DeepSeek Harness 插件](https://github.com/PerryLink)之一。如果这个对你有用,其他插件很可能也会:
|
|
159
|
+
|
|
160
|
+
| Plugin | One-liner |
|
|
161
|
+
|---|---|
|
|
162
|
+
| [dsh-auto-review](https://github.com/PerryLink/dsh-auto-review) | 审批链上的第二模型自动审查,默认失败关闭 |
|
|
163
|
+
| [dsh-background-agents](https://github.com/PerryLink/dsh-background-agents) | 持久化后台子代理,带 Web UI 侧边栏、消息与打断 |
|
|
164
|
+
| [dsh-budget](https://github.com/PerryLink/dsh-budget) | DeepSeek Harness 的成本治理:预算、碳排与延迟一屏呈现。 |
|
|
165
|
+
| [dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind) | Claude Code /rewind 等价物:快照、会话分叉、一次性恢复 |
|
|
166
|
+
| [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | 将 Claude Code 会话、记忆、技能与 CLAUDE.md 迁入 DSH |
|
|
167
|
+
| [dsh-click](https://github.com/PerryLink/dsh-click) | 跨平台原生桌面控制(DeepSeek Harness),Windows 优先。 |
|
|
168
|
+
| [dsh-composer-history](https://github.com/PerryLink/dsh-composer-history) | Web 输入框的终端式输入历史:方向键、Ctrl+R 搜索 |
|
|
169
|
+
| [dsh-defend](https://github.com/PerryLink/dsh-defend) | DeepSeek Harness 的提示注入、越狱与密钥泄露防护。 |
|
|
170
|
+
| [dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck) | 工程纪律门禁:需求质询、测试门禁、对抗式审查 |
|
|
171
|
+
| **[dsh-draw](https://github.com/PerryLink/dsh-draw)** | DeepSeek Harness 的统一静态图像生成路由。 |
|
|
172
|
+
| [dsh-fast](https://github.com/PerryLink/dsh-fast) | DeepSeek Harness 的只读性能诊断。 |
|
|
173
|
+
| [dsh-github](https://github.com/PerryLink/dsh-github) | DSH 的 GitHub PR/issue 集成,每次写入都经审批门 |
|
|
174
|
+
| [dsh-library](https://github.com/PerryLink/dsh-library) | DeepSeek Harness 的本地文档知识库。 |
|
|
175
|
+
| [dsh-local-ai](https://github.com/PerryLink/dsh-local-ai) | DeepSeek Harness 的本地模型(Ollama)接入。 |
|
|
176
|
+
| [dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions) | 经语言服务器的 LSP 诊断、格式化、补全、代码操作与重命名 |
|
|
177
|
+
| [dsh-mask](https://github.com/PerryLink/dsh-mask) | DeepSeek Harness 的 PII 脱敏中间件——数据到模型前匿名化,展示层还原。 |
|
|
178
|
+
| [dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel) | 只读 MCP 运行时面板:/mcp 命令 + 带状态、工具与错误的设置页 |
|
|
179
|
+
| [dsh-memento](https://github.com/PerryLink/dsh-memento) | 带审批门的跨会话记忆:ctx.memory 接缝 + SQLite + memory 工具 |
|
|
180
|
+
| [dsh-observe](https://github.com/PerryLink/dsh-observe) | DeepSeek Harness 的 OpenTelemetry 与 Langfuse 可观测导出器。 |
|
|
181
|
+
| [dsh-output-styles](https://github.com/PerryLink/dsh-output-styles) | Claude Code outputStyles 等价的运行时样式切换 |
|
|
182
|
+
| [dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules) | Claude Code 风格声明式 allow/deny/ask 权限规则,带审计 |
|
|
183
|
+
| [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | 按需 agent 技能形式的插件开发知识库 |
|
|
184
|
+
| [dsh-score](https://github.com/PerryLink/dsh-score) | DeepSeek Harness 插件的多指标质量评分。 |
|
|
185
|
+
| [dsh-session-pin](https://github.com/PerryLink/dsh-session-pin) | 在 Web 侧边栏置顶会话,顺序持久化 |
|
|
186
|
+
| [dsh-session-sync](https://github.com/PerryLink/dsh-session-sync) | DeepSeek Harness 的跨设备会话同步——会话存储的专用 git 镜像。 |
|
|
187
|
+
| [dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security) | 安全审计技能包:密钥扫描、依赖与供应链审查 |
|
|
188
|
+
| [dsh-talk](https://github.com/PerryLink/dsh-talk) | DeepSeek Harness 的语音优先会话闭环:对它说,听它答。 |
|
|
189
|
+
| [dsh-test-drive](https://github.com/PerryLink/dsh-test-drive) | DeepSeek Harness 插件的隔离式安装冒烟实测。 |
|
|
190
|
+
| [dsh-translate](https://github.com/PerryLink/dsh-translate) | DeepSeek Harness 的厂商参数翻译与确定性 JSON 修复。 |
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-draw contributors
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please **do not** open a public issue for security vulnerabilities.
|
|
6
|
+
|
|
7
|
+
Report privately through GitHub's private vulnerability reporting:
|
|
8
|
+
|
|
9
|
+
**https://github.com/PerryLink/dsh-draw/security/advisories/new**
|
|
10
|
+
|
|
11
|
+
That flow keeps the report confidential while we triage, and it is the channel we watch first.
|
|
12
|
+
|
|
13
|
+
## Before you report
|
|
14
|
+
|
|
15
|
+
- **Redact sensitive data** from any logs, request dumps, or session excerpts you attach: API keys, tokens, secrets, Authorization headers, personal paths, and account identifiers. Trimmed error messages and stack traces are usually enough.
|
|
16
|
+
- Include, when possible: the plugin version, the harness (`dsh`) version, Node and OS versions, and the minimal steps to reproduce.
|
|
17
|
+
|
|
18
|
+
## What to expect
|
|
19
|
+
|
|
20
|
+
- **Acknowledgment**: within 5 business days.
|
|
21
|
+
- **Triage**: within 10 business days we confirm the issue and assess severity, or ask for more details.
|
|
22
|
+
- **Fix**: security fixes are prepared in a private fork, released as a patch version, and announced in the release notes.
|
|
23
|
+
|
|
24
|
+
## Disclosure and credit
|
|
25
|
+
|
|
26
|
+
- We follow coordinated disclosure: a public advisory (and CVE request where appropriate) is published once a fix ships.
|
|
27
|
+
- Reporters are credited in the advisory unless they ask to remain anonymous. There is no bug bounty program at this time.
|
|
28
|
+
|
|
29
|
+
## Scope
|
|
30
|
+
|
|
31
|
+
This plugin routes static-image generation to OpenAI-compatible endpoints from inside the harness. Its own guarantees:
|
|
32
|
+
|
|
33
|
+
- **API keys are credential references.** Configuration carries environment-variable names (`apiKeyRef`), never literal keys; values are resolved per call through the official `ctx.credentials` seam and never enter a log, snapshot, session event, or tool result.
|
|
34
|
+
- **Config rejects credential-bearing URLs.** An engine `baseUrl` embedding a username or password fails the load loudly.
|
|
35
|
+
- **Display surfaces are sanitized.** URLs, error text, and probe notes are redacted (userinfo passwords, credential query values, bearer tokens, JWTs) before display or logging.
|
|
36
|
+
- **Quota before spend.** Per-session generation and byte caps are folded from the durable session log and enforced before engine calls and before attachment storage.
|
|
37
|
+
- **Fail loud.** Malformed engine responses, unconfigured credentials, and failed image downloads surface as structured errors — never as silent emptiness.
|
|
38
|
+
|
|
39
|
+
Vulnerabilities in the harness itself should be reported to the official harness maintainers instead.
|