DSHПЛАГИНЫ
🔧
ПЛАГИН DEEPSEEK HARNESS

dsh-plugin-trim

Автор: @haidai233 ↗

Плагин «dsh-plugin-trim» для DeepSeek Harness: Trims the tool surface per session. Each session owns a profile — a tool whitelist — applied through `agent.ctx.tools.restrict({ allow })` on that agent scope only, and switching one session never touches another; `full` is the built-in no-restriction profile. The provider only picks the default: a session created or switched onto a local provider (explicit `localProvider`, `routes`, a loopback/private baseURL, or a local-ish id) gets the `local` profile, a cloud one gets `full`, and the re-plan runs on model-selection events plus one delayed pass because the projection can land after the event. Profiles are editable from the panel and persisted under `~/.dsh/plugin-trim-state.json`; an explicit per-session choice overrides the provider default until cleared. A separate, opt-in layer physically disables whole plugin entries through `pluginManager.setPluginEnabled` — that one is profile-scoped by API and the panel labels it as such rather than pretending it can be per-session. A `tool_trim` tool exposes list/status/profile/set/apply/restore to the model. The panel is served by a loopback-only HTTP server the plugin starts on its own fixed port — `http://127.0.0.1:12256/` (auto-bumps on collision, configurable) — because the DSH port changes on every restart and a locally linked package gets no market card in the sidebar; it lists live sessions with their profile and tool count, an editor per profile, a provider picker limited to providers declared in the profile or currently in use, and the full plugin list with search and paging. Two implementation details worth knowing: `tools.restrict()` is an intersection and cannot widen, so the old restriction is released before the visible set is read — otherwise switching to a bigger profile would shrink instead of grow; and every disposer is registered on `ctx.effect`, without which a hot reload leaves an unremovable restriction behind. Measured on a 12GB laptop GPU with a 27B model and a fully resident 256K cache, same conversation: 105 tools / 56,306 prompt tokens / 22.5 tok/s decode, 62 / 34,207 / 43.0 after disabling three tool-heavy plugins, 14 / 12,890 / 66.8 after a session moved to the local profile, with prefill rising from 487 to 1,310 tok/s. Restricting also drops the skill catalog injection, roughly 4.3K more tokens. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

★ 0 звёзд GitHub17 ноября 2026 г. добавлен
БЫСТРАЯ УСТАНОВКА

Команды для терминала DSH

dsh plugin --profile web add github:haidai233/dsh-plugin-trim

Запустите команду в терминале, где работает DeepSeek Harness. Перезапуск применит плагин автоматически.

ОПИСАНИЕ И ВОЗМОЖНОСТИ

Что делает dsh-plugin-trim

Плагин «dsh-plugin-trim» для DeepSeek Harness: Trims the tool surface per session. Each session owns a profile — a tool whitelist — applied through `agent.ctx.tools.restrict({ allow })` on that agent scope only, and switching one session never touches another; `full` is the built-in no-restriction profile. The provider only picks the default: a session created or switched onto a local provider (explicit `localProvider`, `routes`, a loopback/private baseURL, or a local-ish id) gets the `local` profile, a cloud one gets `full`, and the re-plan runs on model-selection events plus one delayed pass because the projection can land after the event. Profiles are editable from the panel and persisted under `~/.dsh/plugin-trim-state.json`; an explicit per-session choice overrides the provider default until cleared. A separate, opt-in layer physically disables whole plugin entries through `pluginManager.setPluginEnabled` — that one is profile-scoped by API and the panel labels it as such rather than pretending it can be per-session. A `tool_trim` tool exposes list/status/profile/set/apply/restore to the model. The panel is served by a loopback-only HTTP server the plugin starts on its own fixed port — `http://127.0.0.1:12256/` (auto-bumps on collision, configurable) — because the DSH port changes on every restart and a locally linked package gets no market card in the sidebar; it lists live sessions with their profile and tool count, an editor per profile, a provider picker limited to providers declared in the profile or currently in use, and the full plugin list with search and paging. Two implementation details worth knowing: `tools.restrict()` is an intersection and cannot widen, so the old restriction is released before the visible set is read — otherwise switching to a bigger profile would shrink instead of grow; and every disposer is registered on `ctx.effect`, without which a hot reload leaves an unremovable restriction behind. Measured on a 12GB laptop GPU with a 27B model and a fully resident 256K cache, same conversation: 105 tools / 56,306 prompt tokens / 22.5 tok/s decode, 62 / 34,207 / 43.0 after disabling three tool-heavy plugins, 14 / 12,890 / 66.8 after a session moved to the local profile, with prefill rising from 487 to 1,310 tok/s. Restricting also drops the skill catalog injection, roughly 4.3K more tokens. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Показать оригинальное описание (EN/ZH)

Trims the tool surface per session. Each session owns a profile — a tool whitelist — applied through `agent.ctx.tools.restrict({ allow })` on that agent scope only, and switching one session never touches another; `full` is the built-in no-restriction profile. The provider only picks the default: a session created or switched onto a local provider (explicit `localProvider`, `routes`, a loopback/private baseURL, or a local-ish id) gets the `local` profile, a cloud one gets `full`, and the re-plan runs on model-selection events plus one delayed pass because the projection can land after the event. Profiles are editable from the panel and persisted under `~/.dsh/plugin-trim-state.json`; an explicit per-session choice overrides the provider default until cleared. A separate, opt-in layer physically disables whole plugin entries through `pluginManager.setPluginEnabled` — that one is profile-scoped by API and the panel labels it as such rather than pretending it can be per-session. A `tool_trim` tool exposes list/status/profile/set/apply/restore to the model. The panel is served by a loopback-only HTTP server the plugin starts on its own fixed port — `http://127.0.0.1:12256/` (auto-bumps on collision, configurable) — because the DSH port changes on every restart and a locally linked package gets no market card in the sidebar; it lists live sessions with their profile and tool count, an editor per profile, a provider picker limited to providers declared in the profile or currently in use, and the full plugin list with search and paging. Two implementation details worth knowing: `tools.restrict()` is an intersection and cannot widen, so the old restriction is released before the visible set is read — otherwise switching to a bigger profile would shrink instead of grow; and every disposer is registered on `ctx.effect`, without which a hot reload leaves an unremovable restriction behind. Measured on a 12GB laptop GPU with a 27B model and a fully resident 256K cache, same conversation: 105 tools / 56,306 prompt tokens / 22.5 tok/s decode, 62 / 34,207 / 43.0 after disabling three tool-heavy plugins, 14 / 12,890 / 66.8 after a session moved to the local profile, with prefill rising from 487 to 1,310 tok/s. Restricting also drops the skill catalog injection, roughly 4.3K more tokens. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

УДАЛЕНИЕ ПЛАГИНА

Как удалить при необходимости

dsh plugin --profile web remove dsh-plugin-trim
🛡️

Безопасность и аудит

Плагины выполняются в окружении пользователя DSH. Рекомендуется проверять исходный код, зависимости и запрашиваемые разрешения в репозитории автора перед установкой.