dsh-local-models 0.2.0 → 0.3.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/README-es.md CHANGED
@@ -11,7 +11,7 @@ Construido sobre el `llama.cpp` upstream sin modificaciones (`llama-server`). Si
11
11
  - **Estimación de VRAM en vivo** — pesos + los tipos de caché K/V seleccionados + estado recurrente + cómputo/grafo + overhead frente al total de GPU detectado (nvidia-smi / sysfs de amdgpu, sumados entre todas las GPUs, 16 GB asumidos cuando se desconoce), con filas de entra / margen de seguridad / ctx máximo que entra (ver [Problemas conocidos](./KNOWN_ISSUES.md) para la precisión en la familia Gemma)
12
12
  - **Profiles** — guarda configuraciones de lanzamiento con nombre y recárgalas con un clic
13
13
  - **Modo router** — sirve todos los perfiles guardados desde un único endpoint compatible con OpenAI (`--models-preset`); los modelos se cargan bajo demanda, uno residente a la vez por defecto. Arrancar el router registra (o vuelve a registrar) automáticamente sus modelos en dsh — sin pulsar Register a mano.
14
- - **Register in dsh** — escribe el servidor listo como ruta de proveedor `llm-pi-ai` (con modalidad de visión + niveles de razonamiento, y salida máxima anunciada en 131K tokens para que los bloques largos de razonamiento xhigh no se trunquen)
14
+ - **Register in dsh** — escribe el servidor listo como ruta de proveedor `llm-pi-ai` (con modalidad de visión + niveles de razonamiento, y salida máxima anunciada en 32K tokens (limitada a la mitad de la ventana para que la compactación conserve presupuesto de presión; sube maxTokens por request explícitamente para bloques largos de razonamiento xhigh))
15
15
  - **Overlay de terminal** — tail en vivo del log de `llama-server` desde la pestaña
16
16
 
17
17
  ## Requirements
package/README-hi.md CHANGED
@@ -11,7 +11,7 @@ stock upstream `llama.cpp` (`llama-server`) के विरुद्ध बन
11
11
  - **Live VRAM estimate** — weights + चुने गए K/V cache types + recurrent state + compute/graph + overhead, detected GPU total के विरुद्ध (nvidia-smi / amdgpu sysfs, सभी GPUs पर summed, अज्ञात होने पर 16 GB माना गया), fits / safe-margin / max-ctx-that-fits पंक्तियों के साथ (Gemma-family सटीकता के लिए [Known issues](./KNOWN_ISSUES.md) देखें)
12
12
  - **Profiles** — नामित launch configurations सहेजें, एक क्लिक में फिर लोड करें
13
13
  - **Router mode** — सभी सहेजे गए profiles को एक OpenAI-compatible endpoint (`--models-preset`) से serve करें; models माँग पर लोड होते हैं, default रूप से एक बार में एक ही resident रहता है। router शुरू करने पर dsh में उसके models अपने आप (फिर से) register हो जाते हैं — manual Register दबाने की ज़रूरत नहीं।
14
- - **Register in dsh** — तैयार server को `llm-pi-ai` provider route के रूप में लिखता है (vision modality + thinking levels शामिल, max output 131K tokens बताया गया ताकि लंबे xhigh thinking blocks कटें नहीं)
14
+ - **Register in dsh** — तैयार server को `llm-pi-ai` provider route के रूप में लिखता है (vision modality + thinking levels शामिल, max output 32K tokens बताया गया (window के आधे तक सीमित ताकि compaction का pressure budget बचा रहे; लंबे xhigh thinking blocks के लिए per-request maxTokens स्पष्ट रूप से बढ़ाएं))
15
15
  - **Terminal overlay** — tab से ही `llama-server` log का live tail
16
16
 
17
17
  ## Requirements
package/README-pt.md CHANGED
@@ -11,7 +11,7 @@ Construído sobre o `llama.cpp` upstream sem modificações (`llama-server`). Se
11
11
  - **Estimativa de VRAM ao vivo** — pesos + os tipos de cache K/V selecionados + estado recorrente + compute/grafo + overhead contra o total detectado de GPU (nvidia-smi / sysfs do amdgpu, somados entre as GPUs, 16 GB presumidos quando desconhecido), com linhas de cabe / margem de segurança / ctx máximo que cabe (veja [Known issues](./KNOWN_ISSUES.md) para a precisão na família Gemma)
12
12
  - **Profiles** — salve configurações de inicialização nomeadas e recarregue com um clique
13
13
  - **Modo Router** — serve todos os profiles salvos a partir de um único endpoint compatível com OpenAI (`--models-preset`); os modelos carregam sob demanda, um residente por vez por padrão. Iniciar o router registra (ou re-registra) automaticamente seus modelos no dsh — sem precisar clicar em Register manualmente.
14
- - **Register in dsh** — grava o servidor pronto como uma rota de provedor `llm-pi-ai` (modalidade de visão + thinking levels incluídos, saída máxima anunciada em 131K tokens para que blocos longos de thinking xhigh não sejam truncados)
14
+ - **Register in dsh** — grava o servidor pronto como uma rota de provedor `llm-pi-ai` (modalidade de visão + thinking levels incluídos, saída máxima anunciada em 32K tokens (limitada à metade da janela para que a compactação mantenha budget de pressão; suba o maxTokens por request explicitamente para blocos longos de thinking xhigh))
15
15
  - **Overlay de terminal** — tail ao vivo do log do `llama-server` direto da aba
16
16
 
17
17
  ## Requirements
package/README-zh.md CHANGED
@@ -11,7 +11,7 @@
11
11
  - **实时显存估算** —— 权重 + 所选的 K/V cache 类型 + 循环状态 + 计算/图 + 额外开销,与检测到的 GPU 总显存对比(nvidia-smi / amdgpu sysfs,多卡求和,未知时按 16 GB 计),并给出 fits / safe-margin / max-ctx-that-fits 三行结果(Gemma 系列的准确性见 [Known issues](./KNOWN_ISSUES.md))
12
12
  - **Profiles** —— 保存具名的启动配置,一键重新加载
13
13
  - **路由模式** —— 用一个 OpenAI 兼容端点(`--models-preset`)服务所有已保存的 profile;模型按需加载,默认同一时刻只驻留一个。启动路由会自动在 dsh 中(重新)注册它的模型 —— 无需手动点 Register。
14
- - **Register in dsh** —— 把已就绪的服务器写成一个 `llm-pi-ai` 提供方路由(包含视觉模态 + thinking levels,最大输出声明为 131K tokens,以免较长的 xhigh thinking 块被截断)
14
+ - **Register in dsh** —— 把已就绪的服务器写成一个 `llm-pi-ai` 提供方路由(包含视觉模态 + thinking levels,最大输出声明为 32K tokens(上限为窗口的一半,以便 compact 保留压力预算;较长的 xhigh thinking 块请显式提高单次请求的 maxTokens))
15
15
  - **终端浮层** —— 在标签页里实时跟踪 `llama-server` 日志
16
16
 
17
17
  ## Requirements
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-local-models
2
2
 
3
+ [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/vmarcelo49/dsh-local-models)
4
+
3
5
  A `dsh` addon that adds a **Local Models** tab to the dsh Web GUI: pick a `.gguf` file, tune context and speculative decoding, watch a live VRAM estimate, and load it through `llama-server` — then register the running server as an LLM provider in dsh with one click.
4
6
 
5
7
  Built against stock upstream `llama.cpp` (`llama-server`). No fork, no patches, no build step: the client bundle is hand-written `React.createElement` (no JSX toolchain) and the node half is dependency-free.
@@ -11,7 +13,7 @@ Built against stock upstream `llama.cpp` (`llama-server`). No fork, no patches,
11
13
  - **Live VRAM estimate** — weights + the selected K/V cache types + recurrent state + compute/graph + overhead against the detected GPU total (nvidia-smi / amdgpu sysfs, summed across GPUs, 16 GB assumed when unknown), with fits / safe-margin / max-ctx-that-fits rows (see [Known issues](./KNOWN_ISSUES.md) for Gemma-family accuracy)
12
14
  - **Profiles** — save named launch configurations, reload in one click
13
15
  - **Router mode** — serve all saved profiles from one OpenAI-compatible endpoint (`--models-preset`); models load on demand, one resident at a time by default. Starting the router automatically (re-)registers its models in dsh — no manual Register press.
14
- - **Register in dsh** — writes the ready server as an `llm-pi-ai` provider route (vision modality + thinking levels included, max output advertised at 131K tokens so long xhigh thinking blocks aren't truncated)
16
+ - **Register in dsh** — writes the ready server as an `llm-pi-ai` provider route (vision modality + thinking levels included, max output advertised at 32K tokens (capped at half the window so compaction keeps a pressure budget; raise per-request maxTokens explicitly for long xhigh thinking blocks))
15
17
  - **Terminal overlay** — live tail of the `llama-server` log from the tab
16
18
 
17
19
  ## Requirements
@@ -136,3 +138,5 @@ See [KNOWN_ISSUES.md](./KNOWN_ISSUES.md) — most notably, the VRAM estimate is
136
138
  ## License
137
139
 
138
140
  MIT — see [LICENSE](./LICENSE).
141
+
142
+
package/lib/index.js CHANGED
@@ -84,15 +84,23 @@ const LOG_PATH = join(dataDir(), "llama-server.log");
84
84
  * ~15-22 s per image. Set LOCAL_MODELS_MMPROJ_CPU=0 to keep vision on the GPU. */
85
85
  const MMPROJ_CPU = process.env.LOCAL_MODELS_MMPROJ_CPU !== "0";
86
86
  /**
87
- * Max output advertised when a server is registered in dsh: 131K tokens,
88
- * the full daily window. The qwen3.x series is a heavy thinker — at xhigh
89
- * the thinking block alone regularly exceeds the old 32K default and the
90
- * reply gets cut off — so registration offers the whole window as max
91
- * output. Still capped at the launched ctx in the profile builders below:
92
- * a small-ctx profile must never advertise more output than it has room
93
- * for.
87
+ * Max output advertised when a server is registered in dsh: 32K tokens,
88
+ * matching the llm-pi-ai adapter default. This matters beyond truncation:
89
+ * the advertised maxTokens becomes the adapter's defaultMaxTokens, which
90
+ * dsh-compaction-basic uses as its reserved output `O` in `W - O - headroom`.
91
+ * Advertising the whole window (the old 131K) leaves no message budget at
92
+ * `W = O` — proactive compaction warns once and never fires. Half-window
93
+ * cap keeps at least half the context for history so headroom tuning can
94
+ * always make compaction viable. Heavy xhigh thinking that needs more must
95
+ * raise per-request maxTokens explicitly (which honestly moves the
96
+ * compaction threshold earlier instead of silently disabling it).
94
97
  */
95
- const MAX_OUTPUT_TOKENS = 131072;
98
+ const MAX_OUTPUT_TOKENS = 32768;
99
+ /** Default output share of the window: never offer more than half as max
100
+ * output, so a message budget always survives (`W - O > 0`). */
101
+ function defaultMaxOutput(contextWindow) {
102
+ return Math.max(1, Math.min(MAX_OUTPUT_TOKENS, Math.floor(contextWindow / 2)));
103
+ }
96
104
  /** Fixed-MTP ceiling. The tab offers 0-7 and the API clamps here: upstream
97
105
  * accepts any `--spec-draft-n-max` and clamps the effective depth to the
98
106
  * model's own nextn depth at load. Depth 3 is the measured 16 GiB sweet spot
@@ -1622,12 +1630,14 @@ export function buildProviderProfile(st, requestedRoute) {
1622
1630
  id: modelId,
1623
1631
  name: modelId,
1624
1632
  contextWindow,
1625
- // Advertise the full 131K window as max output: the qwen3.x series
1626
- // is a heavy thinker and at xhigh its thinking block alone blows
1627
- // past the old 32K ceiling, so long replies get truncated. Still
1628
- // never more than the window itself — a small-ctx profile must not
1629
- // offer more output than it has room for.
1630
- maxTokens: Math.min(MAX_OUTPUT_TOKENS, contextWindow),
1633
+ // Capped at half the window (see MAX_OUTPUT_TOKENS): the qwen3.x
1634
+ // series is a heavy thinker and at xhigh its thinking block alone
1635
+ // blows past small ceilings, so 32K is the default — but never more
1636
+ // than half the window, or compaction's `W - O - headroom` budget
1637
+ // collapses and proactive compaction never fires. Need more room
1638
+ // for a monster thinking block? Raise per-request maxTokens
1639
+ // explicitly instead.
1640
+ maxTokens: defaultMaxOutput(contextWindow),
1631
1641
  // Declaring image input is what makes a hand-declared vision model
1632
1642
  // usable: without it dsh rejects image attachments ("model does not
1633
1643
  // declare image input"). mmprojPath is set when a --mmproj file was
@@ -1940,7 +1950,7 @@ export function buildRouterProfile(profiles, modalitiesByModel) {
1940
1950
  id,
1941
1951
  name: id,
1942
1952
  contextWindow: p.ctx ?? 8192,
1943
- maxTokens: Math.min(MAX_OUTPUT_TOKENS, p.ctx ?? 8192),
1953
+ maxTokens: defaultMaxOutput(p.ctx ?? 8192),
1944
1954
  input,
1945
1955
  reasoningEfforts: { off: "none", low: "low", medium: "medium", xhigh: "xhigh" },
1946
1956
  compat: { supportsReasoningEffort: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-local-models",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "dsh addon: a Local Models settings tab that starts and stops a llama-server child process living with the dsh host process.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -98,10 +98,13 @@ provider route on the dsh webserver. Single-model mode needs the manual
98
98
  **Register in dsh** press; router mode has no Register button — starting
99
99
  the router auto-registers the `local-router` route once the server is
100
100
  ready (a refresh poll fires it; stopping first cancels a pending one).
101
- The registered model advertises `maxTokens: min(131072, ctx)` — the full
102
- 131K window for the daily full-window qwen3.x profile (heavy-thinking
103
- models at xhigh emit thinking blocks past the old 32K default and get
104
- truncated), and the launched ctx for smaller windows.
101
+ The registered model advertises `maxTokens: min(32768, floor(ctx/2))` — a
102
+ 32K cap at half the window. The advertised value becomes the adapter's
103
+ `defaultMaxTokens`, which compaction uses as its reserved output `O` in
104
+ `W - O - headroom`: advertising the whole window (`O = W`) leaves no
105
+ message budget and proactive compaction never fires. Heavy-thinking models
106
+ at xhigh that need more than 32K must raise per-request maxTokens
107
+ explicitly (which honestly moves the compaction threshold earlier).
105
108
  For opencode against the spawned server:
106
109
  - the opencode config resolves per directory (project `opencode.json` beats
107
110
  nothing; the global `~/.config/opencode/opencode.json(c)` is authoritative