rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:jack-001-a/deepseek-harness-translation-pane
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A translation workbench for DeepSeek Harness: one sidebar entry, one full-width
translation page, and a translate_text tool for the agent.
Published as @ybbmm/dsh-translation-pane
on npm and on GitHub.
| Where | What |
|---|---|
| Sidebar panel rail | A Translation icon that opens the page in the main column |
| Translation page | Source/target language pickers, provider picker, source and result cards, a swap action, copy, clear, a live character counter, and Ctrl+Enter to translate |
| Failover | Falls over to the other anonymous provider when the selected one is unreachable, and says which service served the text |
| Agent tool | translate_text(text, targetLanguage, sourceLanguage?) returning the translation |
The language and provider choices are remembered in the page's local storage.
The Host half prefers the shipped ctx.translator service when the
composition mounts it — that service owns provider routing, request limits and
Session-bound result reuse. When it is absent, the Host half speaks the
Microsoft Edge and Google Translate endpoints directly. Both routes are
anonymous: no login, no API key, no Session.
describe() reports which route is live and which providers that route can
actually serve, so the page never offers a provider the active route cannot
use. It is deliberately synchronous: the shipped translator's
availableProviders() can await credential and model discovery for up to its
own 60-second deadline, which would leave the panel stuck on its first paint.
The two anonymous endpoints are independent services, and a network that can reach one may be unable to reach the other. The direct route therefore treats a provider-level failure as a routing problem rather than a dead end:
429 and HTTP 5xx prove the provider itself is unhealthy, so
the fragment is handed to the other provider once. A 4xx, a 200 whose
body cannot be read, and the local rate limiter never fail over: none of them
is fixed by asking a different provider.attemptTimeoutMs (default 3000) bounds the wait for
response headers, so a dead provider is abandoned quickly. A provider that
does answer may keep streaming under the whole-request deadline.providerCooldownMs (default five minutes). Later requests go straight to the
healthy provider instead of probing the dead one again, and describe() shows
the observation as plain serializable data under providerHealth. A provider
that recovers is retried automatically once its cooldown expires.provider, and adds requestedProvider and failover. A long text may be
split and answered by both providers; failover is then still true, and
providersServed lists every service that answered. Cache entries keep the
same facts, so a cache hit does not pretend the requested provider answered.
The page names the services in the meta line, says which service served the
text after a failover, and warns when the selected service is known to be
unavailable.The shipped-translator route owns its own routing, so it stays single-provider here: the pane does not invent a cross-provider retry on top of it.
The anonymous endpoints rate-limit, return 5xx and occasionally hang. The
Host therefore:
attemptTimeoutMs) and a cooldown
(providerCooldownMs) that keeps later requests off a provider known to be
dead. See Provider failover and health.429 and HTTP
5xx — with exponential back-off and jitter, honouring a Retry-After
header. Every other 4xx fails immediately instead of burning the budget.
The retry budget applies when a second provider is not available (the
shipped-translator route, or failover: false); with two providers each is
tried once, because the other provider is the better retry.translation-pane/rate-limited rather than queueing without bound.Fragments of one long document are dispatched with bounded concurrency rather than one at a time, so a large input is not many times slower than it needs to be.
Input longer than maxTextChars is split on paragraph, then line, then
sentence, then word boundaries before dispatch, and the fragments are rejoined
so the result matches the source structure exactly. Text beyond the limit is
refused with a readable message instead of being truncated silently.
The Host never logs conversation content. Log records carry lengths, ids and counters only.
Both callers reach the same Host method, so a failure, a language tag, or a
limit behaves identically whether it came from the page or from the model. The
page reaches it over the shared connection RPC on translationPane/describe
and translationPane/translate; the tool calls the same service object
in-process.
That includes routing: the tool gets the same failover, and its output carries
the same additive provider / requestedProvider / failover facts (plus
providersServed when a split demand was answered by both), so it can tell the
user which service answered. Both paths surface the same stable error codes; no
raw diagnostic text reaches the page.
The API Gateway derives a Remote method's wire fields from the method's parameter names, rejects any argument the descriptor does not name, and calls the method positionally in that order. Two consequences matter when maintaining this plugin:
gateway/signature-invalid.signal is the cancellation slot: the Gateway
injects the caller's AbortSignal there, which is how the page's Cancel
button aborts the Host request and not just the browser-side promise.translate therefore declares both the flat and the nested request shape, so
the page and the in-process tool can share one entry point. The contract is
pinned by test/gateway-contract.test.mjs, which re-implements the Gateway's
own derivation, validation and dispatch and drives the real Host with the
payload the browser sends.
The Host answers with stable codes and the page localizes them, so a failure never surfaces a raw diagnostic string.
| Code | Meaning |
|---|---|
translation-pane/invalid-request |
Malformed request (defensive) |
translation-pane/text-limit |
The text exceeds the configured limit |
translation-pane/provider-unavailable |
The selected provider cannot serve this request |
translation-pane/provider-unreachable |
The Host could not reach the provider over the network |
translation-pane/timeout |
The provider did not answer within the deadline |
translation-pane/rate-limited |
The local rate limiter refused the request |
translation-pane/provider-error |
The provider answered with an error status |
translation-pane/invalid-response |
The provider answered with an unusable body |
translation-pane/offline |
The Harness is not connected to its Host (carrier failure only) |
The Host raises provider-unreachable when its own network cannot reach the
provider, while offline is the browser losing its Host. Keeping them apart
matters: only the second one is fixed by checking that the Host is running.
aria-describedby, and the Translate
action also describes the counter so an over-limit refusal is heard.aria-invalid, and the result region is
announced even when the user never focuses it.dir="auto", so right-to-left source text and
translations render in the correct direction.aria-keyshortcuts.--dsw-alias-* theme tokens, so light and dark themes follow the app.Tunables live in the profile patch so they survive upgrades. Every key is optional — the Host falls back to the documented default when a key is absent or invalid.
- id: ybbmm-dsh-translation-pane
name: '@ybbmm/dsh-translation-pane'
config:
bingEndpoint: https://edge.microsoft.com/translate/translatetext
googleEndpoint: https://translate.googleapis.com/translate_a/single
timeoutMs: 20000
attemptTimeoutMs: 3000
providerCooldownMs: 300000
failover: true
maxTextChars: 20000
fragmentChars: 3000
maxRetries: 2
retryBaseMs: 250
retryMaxMs: 4000
maxResponseBytes: 1048576
cacheSize: 64
rateLimitPerMinute: 60
maxConcurrency: 3
| Key | Default | Meaning |
|---|---|---|
bingEndpoint |
the Edge endpoint | Anonymous Bing-compatible endpoint |
googleEndpoint |
the Google endpoint | Anonymous Google-compatible endpoint |
timeoutMs |
20000 |
Deadline for the whole request, fragments included |
attemptTimeoutMs |
3000 |
Wait for one provider to start answering (response headers); capped by timeoutMs |
providerCooldownMs |
300000 |
How long a provider that failed is avoided; 0 disables the observation window |
failover |
true |
Let a fragment fall over to the other direct provider once |
maxTextChars |
20000 |
Largest input accepted for one request |
fragmentChars |
3000 |
Provider-sized fragment length |
maxRetries |
2 |
Retries for transient failures only; used when no second provider is available |
retryBaseMs |
250 |
First back-off delay |
retryMaxMs |
4000 |
Ceiling of the back-off delay |
maxResponseBytes |
1048576 |
Largest provider response accepted |
cacheSize |
64 |
Bounded LRU of finished translations; 0 disables it |
rateLimitPerMinute |
60 |
Token bucket across all callers |
maxConcurrency |
3 |
Fragments of one long request in flight at once |
From the plugin market: search for Translation Pane, or add it by name:
dsh plugin add @ybbmm/dsh-translation-pane
From a local directory (development):
dsh plugin add ./dsh-translation-pane
Restart the Harness if your profile does not hot-reload plugin bundles.
The page fills the main column and is itself the scroll container, so a short
window scrolls instead of clipping the lower controls. Each text card is capped
at 45vh (never below 264px): a long translation scrolls inside its own card
rather than stretching the page, and the source textarea scrolls internally
once the input outgrows the card.
npm test # node --test
The tests run against the real module with a fake Cordis context and a stubbed
fetch; they need no Harness installation and no network.
attemptTimeoutMs) before the failover answers.MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。