DSH local model manager
Engine-specific context planning belongs to backend plugins. The manager keeps prepared calls, model metadata, compaction, output budgets and launches aligned with a backend’s calculated capacity. Embedded MTP configuration and GPU memory charts belong to @martindye/dsh-model-backend-llama-cpp; the manager has no MTP toggle or percentage reduction.
Public npm package: @martindye/dsh-local-model-manager. For llama.cpp, also install @martindye/dsh-model-backend-llama-cpp through DSH’s plugin manager. See npm installation and release notes.
Version 0.7.1 provides generic DSH model policies and configurable local-server orchestration. Install a separate backend plugin for engine-specific capabilities. The built-in external mode fronts an already managed OpenAI-compatible server. The separately published @martindye/dsh-model-backend-llama-cpp supplies native llama.cpp readiness, context, token counting, image compatibility and CUDA graph controls. No DSH core or model-source patches are required.
Setup and launch configuration
Open the plugin's Model options UI. Startup/shutdown scripts, executable and argument arrays, working directory, weights/projector paths, model aliases, context overrides and model profiles are visible and editable. No Qwen installation path is a default. Fallback context is 8,192 tokens; configure the model's actual usable capacity. Server management defaults OFF. Launch edits are saved as live settings but affect future requests/starts; they do not hot-reload the plugin or stop a currently running model. Proxy listening-port changes still require an idle reload.
Choose a backend plugin and the acceleration mode matching the installed server. Unsupported native-counting/image-pricing/PNG controls are disabled; CUDA graphs are disabled unless the backend supports them and CUDA is selected. Selecting CUDA does not install hardware libraries or change the serving executable. Configurable HTTP/HTTPS targets use normal certificate verification. Authentication can be configured with the secret targetApiKey field.
startCommand plus literal startArgs overrides script mode. Windows scripts receive -ContextSize <N>; POSIX scripts receive the size as their first positional argument. Arguments support {contextSize}, {model}, {servedModel}, {modelPath}, {projectorPath}, {host}, {port}. Custom launchers require their own explicit shutdown command before resizing. Shutdown commands must target only the selected server. See portable setup.
Image descriptions and release
Release images after description offers the manual offload_described_images action. Automatically describe images before release is a separate, default-OFF option that requires no voluntary housekeeping call. It runs a description checkpoint through a DSH vision route, commits image-linked observations as visible conversation context, then appends DSH's standard image/offload event. Failed, empty, malformed, cancelled, token-truncated or unsaved descriptions retain their images. Original files remain available for rereading; later reads introduce separate occurrences.
Automatic checkpoints default to compaction timing to coordinate with a history rewrite already taking place. For compaction calls, completed descriptions are committed through DSH's existing compaction/summary-error recovery seam. The engine refreshes its captured history before generating the summary, so image release does not invalidate an already-generated summary. Eligible image batches are processed within the same compaction transaction; pinned recent images remain available. Descriptions are appended outside the selected prefix. This applies to pressure, overflow and manual compaction without changing DSH's stability checks.
Checkpoints prioritise retained images outside the summary prefix, which would otherwise remain as visual context. Ordinary-request timing releases earlier but may rebuild the prompt cache more often. Same-route checkpoints retain the existing prefix/tools and do not attach an image twice. Missing selected images are supplied explicitly. No checkpoint tool calls are executed.
Defaults: current provider/model, 8,192 output tokens including reasoning, 24,000 checkpoint characters, at most four images per checkpoint and zero explicitly pinned recent images. All are editable. Set a recent-image retention count when continued visual comparison is needed. Compaction processes further eligible batches before its summary; ordinary requests leave remaining images for a later checkpoint. Failed image occurrences are not repeatedly retried every request; reread the image or toggle/reconfigure the option to retry.
Descriptions are a lossy substitute for visual data, and description generation adds inference. A completed checkpoint establishes that linked text exists, not that it preserves every useful detail. This feature does not guarantee unchanged task quality or faster execution. Compaction reasoning and retained-history targets are separate policies.
Backend image-token pricing for retention is independent from both release options. Currently it supports explicitly configured DSH pi-ai routes through this proxy when the backend offers exact native counting. It mirrors pi-ai's request image policy, respects adapter-owned pricing and uses measured visual costs without double-charging the provider-usage anchor. Set settingsPath to the profile file for route metadata; ambiguous duplicate model IDs do not silently borrow another provider's values. Other providers keep their adapter-owned accounting. No thinking-template keyword is hardcoded into image-count probes.
Output and compaction policies
Dynamic output budgeting defaults OFF and requires a native-count-capable backend. It uses min(configured ceiling, usable context minus exact prompt tokens minus safety reserve). Default reserve: 8,192; ceiling: 65,536. Unsupported or failed counting retains the configured output limit. Token counting does not resize preallocated KV memory.
The optional flat 10% compaction output budget preserves reasoning and exempts only compaction from the ordinary reserve/ceiling. The independent summarise-without-reasoning option requests OFF only when the selected model advertises it. Automatic image description calls have their own protected output cap and never inherit the compaction exception.
Coordinate small tool-result trims with compaction defaults OFF. Below the configured estimated savings threshold (8,192 tokens by default), ordinary pressure pruning is deferred to the existing full compaction pass. Larger savings retain normal pruning. Overflow/manual calls outside that pre-step pass are unaffected. This avoids some separate prefix invalidations, but savings are estimates and the scheduling tradeoff needs workload measurement.
Backend boundary and validation
The manager imports no llama.cpp engine implementation. Backend registration is effect-owned and requires protocol v1; missing or duplicate backends are refused. See backend protocol. Its current generic proxy uses OpenAI-compatible /v1 transport; another serving API needs an adapter.
The original Windows/Qwen/TurboQuant installation is migrated through explicit profile values; its weights, context, reasoning and launcher stay installation choices. Earlier hardware measurements remain historical evidence in docs/cuda-graphs.md, not universal performance promises.
Run npm test from the source checkout. Tests use scripted providers, real DSH/Cordis composition checks and CPU-only fixture processes. The two npm packages are prepared for separate publication; publication itself is not automatic.