メインコンテンツへスキップ
Y

dsh-plugin-strata

youshanlian/dsh-plugin-strata

Integrated control plane for the local strata model stack: manage the strata-hop :8080 model-switching router (status/models/warm/logs), stream live model-switch and load state into the web GUI status chip and the strata_status tool, preload a model engine the moment it is selected, edit run-config and shared chat settings from a GUI tuning panel or strata_params, and ship the dsh provider patch that routes chats to the router with Effort-level mappings. Read-only toward inference: it never sends a prompt and spends no tokens; bring your own running strata plus strata-hop (defaults :8080 hop, :8756 monitor). As shipped, the status server listens on 0.0.0.0:8756 with no authentication and open CORS, and its endpoints can change run-config and restart the engine; set host to 127.0.0.1 in cordis.patch.yml to keep it on this machine. It expects strata-hop as a systemd user unit.

インストール

dsh plugin --profile web add github:youshanlian/dsh-plugin-strata

README

dsh-plugin-strata

dsh × 本地 strata 的一体化控制面。 装上之后,你在 dsh 里选中一个 strata 模型,路由器就替你把它预热好——冷启动那 20-30 秒发生在选中的一刻,而不是第一次提问的时候。 GUI 顶部多一枚状态芯片:当前加载的是哪个模型、正在切换还是空闲、加载进度,实时可见(悬停看详情)。 输入区旁多一个**「调参」面板**:直接编辑当前模型的 run-config(温度 / top_p / top_k / min_p / 思考预算 / 显存预留 / MTP / 别名表…16 键,保存后「重启生效」约 25 秒)和 strata 全应用共享的聊天设置(思考档位 / 采样默认值,保存即生效)。 模型切换路由本身也有三个工具:strata_hop(status / models / warm / logs)、strata_status(实时状态)、strata_params(读改以上两类设置)——agent 也能自己动手调参。 对推理只读:插件从不发 prompt、不消耗 token;它只管理你自己的路由器。

One plugin for dsh + a local strata stack. Warm-on-selection model preloading, a live load/switch status chip in the web GUI, a run-config + shared chat-settings tuning panel, and agent tools (strata_hop / strata_status / strata_params) to control your own strata-hop :8080 router. Read-only toward inference: it never sends a prompt and spends no tokens.

dsh plugin --profile web add github:youshanlian/dsh-plugin-strata   # 一键安装(需 dsh CLI)

没装过 dsh CLI?跑一行引导脚本(执行上面那条命令 + 装后校验):

bash <(curl -fsSL https://raw.githubusercontent.com/youshanlian/dsh-plugin-strata/main/install.sh)

前置条件是系统侧已经跑着 strata + strata-hop(见下文前置条件);模型 id 需与你的 hop 配置一致(见常见坑)。

一个插件,四件事(合并自独立功能):

  1. strata 接入 dsh —— bundle 自带 cordis.patch.yml,默认写入 provider strata (baseURL: http://127.0.0.1:8080/v1,模型 id 与 hop 配置键一致)。
  2. 模型切换路由控制 —— 工具 strata_hop:管理 127.0.0.1:8080 的 strata-hop (status / models / warm / logs)。路由器源码在 router/strata-hop.py (含 /warm、/loaded 端点)与 router/strata-hop.service。
  3. 切换状态监控 —— 状态服务(默认 :8756,GET /events)+ Web GUI 顶部状态芯片 + 工具 strata_status;GUI 里选中 strata 模型即自动 POST /warm 预热引擎 (冷启动发生在第一次请求之前,而不是请求期间)。
  4. 运行配置调参(调参) —— 工具 strata_params + GUI 输入区旁的「调参」面板: 编辑当前加载模型的 strata run-config(sampling.temperature / top_p / top_k / min_p、思考预算、显存预留、别名表等 16 键),保存进 hop 维护的模型 profile, 下次启动生效。
  5. 聊天设置(聊天设置) —— 同一面板/工具的第二块:strata 所有应用共享的采样与 思考档位默认值(GET/POST /settings 由 monitor 代理),保存立即生效且持久化, 无需重启。

对推理只读:插件从不发 prompt、不消耗 token。写操作只有:warm(幂等预热)、 run-config 调参(只改下次启动用的配置)、聊天设置(共享默认值,立即生效)、以及显式的 「重启生效」(hop 卸载后带 force 重新预热同一模型,同样不发 prompt)。真正的模型切换仍由 dsh 的模型选择器触发。

前置条件(一次性,系统侧)

strata-hop:  ~/.local/share/strata-hop/strata-hop.py  (本包 router/ 内有同款源码)
配置:        ~/.config/strata/strata-hop.json         (示例见 router/strata-hop.example.json)
密钥:        ~/.config/strata/strata-hop.env          (STRATA_API_KEY)
systemd:     ~/.config/systemd/user/strata-hop.service(本包 router/ 内有同款 unit)

安装

一条命令装进任意 profile(实测于 dsh 0.2.1-rc.2;bundle 会自动注册进 profile 的 dsh.profile.bundles,插件自带的 cordis.patch.yml 默认启用插件行和 provider strata):

dsh plugin --profile web add github:youshanlian/dsh-plugin-strata
# 之后重启该 profile 的 dsh 即可看到状态芯片与「调参」面板

没有 dsh CLI 或想连 dsh 本体一起装,用仓库根目录的引导脚本:

bash <(curl -fsSL https://raw.githubusercontent.com/youshanlian/dsh-plugin-strata/main/install.sh)
# 指定 profile: … install.sh --profile <name>;预览不执行:加 --dry-run

装好后若模型 id 与你的 hop 配置不同,在 profile 的补丁层覆盖 llm-pi-ai 的 providers.strata(整条替换,非内置目录的条目要写全 api / baseURL / models)。

开发模式(本机源码改动即时生效)才用 file: 链接:

// ~/.dsh/profiles/<profile>/package.json
"dependencies": { "dsh-plugin-strata": "file:/path/to/dsh-plugin-strata" },
"dsh": { "profile": { "bundles": [ …, "dsh-plugin-strata" ] } }

配置(插件行 config)

键默认说明
hopUrlhttp://127.0.0.1:8080strata-hop 地址
hopConfig~/.config/strata/strata-hop.jsonhop 配置(读 catalog/默认模型)
hopEnvFile~/.config/strata/strata-hop.env读密钥的兜底文件
apiKeyEnvSTRATA_API_KEYhop 的鉴权环境变量名
unitstrata-hop.servicejournalctl 跟踪的 systemd user unit
host / port127.0.0.1 / 8756状态服务器绑定(GUI 芯片用 LAN 需设 0.0.0.0)
followJournaltrue跟随 hop 日志
pollSeconds2被动探测间隔
warmOnSelectiontrue选中模型即预热
warmProviderstrata只预热该 provider 的选择,云端选择不动

调参(run-config tuning)

调的是 strata serve 的 run-config(hop 维护在每个模型 profile JSON 里,hop 会留 .bak 备份),不是 dsh 侧的 provider 参数。可调键与 serve 端 runconfig.py 的 EDITABLE 表一致(本包 lib/params.js 的 PARAM_SPEC 是同一份规范的镜像): sampling.temperature/top_p/top_k/min_p、reasoning_budget_tokens、fit_max_tokens、 anthropic_thinking、effort_position、aliases、idle_unload_s、mtp、lazy_load、 engine_silence_s、api_monitor、open_browser、vram_reserve_mib。

三个入口,同一套校验(全有或全无:一个键非法就整体不写):

  • GUI:输入区旁「调参 ▸」按钮 → 面板按键类型渲染控件(数字框 / 开·关·默认下拉 / 枚举下拉 / 逗号分隔名单)。留空 = 清除该键、回 strata 默认。只提交改动过的键。
  • 工具:strata_params —— action: get 读当前视图;action: set 传 set_json: '{"sampling.temperature": 0.6, "mtp": null}';action: restart 重启生效。
  • HTTP(monitor :8756):GET /params、POST /params {"set": {...}}、 POST /restart {"model": ...}。

语义要点:

  • 保存 ≠ 生效。写入的是该模型 profile 里下次启动用的配置;正在运行的引擎保持旧值。 要立即生效点「重启生效」(或 action: restart)= hop POST /unload 后 POST /warm {force:true} 重新拉起同一模型:约 25 秒冷启动,不发 prompt、不耗 token。
  • 必须先有加载中的模型才能保存(serve 的 /config 由活着的引擎应答)。没加载时 GUI 显示 profile 的只读内容(source: "file"、writable: false),先在 dsh 里选中 strata 模型(会自动预热)再编辑。
  • 浏览器不能直连 hop 写:serve 的 _own_page 防护会拒外来 Origin(403),所以 GUI 一律走 monitor 代理(monitor 用 ~/.config/strata/strata-hop.env 的密钥访问 hop)。 不要手改 profile JSON —— hop 是这些文件的属主。
  • restart 之后 GUI 会轮询 /events,就绪后自动刷新面板。

聊天设置(聊天设置, shared chat settings)

这就是 strata 8081 聊天界面里 Sampling 按钮打开的采样抽屉(思考档位 / 温度 / top_p / top_k / max tokens / seed / 显示思考 / 速度预测 / MCP / "Use for other apps too"),不在别的设置页。抽屉里勾上「Use for other apps too」保存时,把当前值 POST 到 /settings 成为所有应用共享的默认值(持久化在 <配置基名>.shared-settings.json)——dsh 的调参面板/工具管的就是这同一份共享默认值:

  • GUI:调参面板第二区「聊天设置(所有应用共享 · 立即生效)」,改行后点 「保存聊天设置」即时生效;留空 = 清除该项。
  • 工具:strata_params —— action: settings_get 读取;action: settings_set 传 set_json: '{"reasoning_effort": "medium", "temperature": 0.7}',set_json: "null" 清空全部。
  • HTTP(monitor :8756):GET /settings、POST /settings {"defaults": {...}} ({"defaults": null} 清空)。

可调 8 键(lib/params.js 的 SHARED_SPEC 与 serve 的 clean_shared_defaults 一致): reasoning_effort(思考档位 none/low/medium/high)、temperature、top_p、top_k、 seed、max_tokens、reasoning_budget_tokens、experimental_speed_projection。

语义要点:

  • 保存即生效、无需重启:作用于「没带该参数」的请求;持久化,重启后仍在。
  • 请求优先:请求明确带的参数覆盖共享默认——dsh 总是自带 max_tokens;模型条目带 reasoningEfforts(见 cordis.patch.yml),dsh 聊天设置里选了 Effort 就把对应 reasoning_effort 随请求发出,此时聊天设置里的思考档位只在未选时兜底。
  • POST 是全量替换:没带的键会被清除。GUI 总会重发全部现值(改哪行留空哪行), 直接调工具时先 settings_get 合并再提交。
  • 读写同样要求有加载中的引擎(这份设置由活着的 serve 持有),浏览器同样不能直连 hop 写。
  • 抽屉里的「显示思考」和「MCP 工具」两个开关是 8081 网页自己随每条请求带的客户端选项, 服务器上不存在存放它们的地方,所以本插件不代理;dsh 侧对应的是自己的思考展示与 工具/MCP 配置,Effort 行则已随 reasoningEfforts 出现在模型选择里。

测试

node tools/smoke.js [--port 8757]     # 独立冒烟:监控 + hop 只读探测 + /params、/settings 路由与非法值拒绝,不动引擎
dsh --profile web --dump-config       # 校验 bundle/补丁装配

上架插件市场

本插件走的是社区索引流程:在 awesome-dsh-plugin 提一个 PR,新增 data/plugins/youshanlian__dsh-plugin-strata.yml:

url: https://github.com/youshanlian/dsh-plugin-strata
name: youshanlian/dsh-plugin-strata
category: model
tarball: https://github.com/youshanlian/dsh-plugin-strata/releases/latest/download/dsh-plugin-strata.tgz
description.en: >-
  …(一句以句号结尾的英文简介)

要点:dsh.bundle.patch 必须声明(否则索引器不给 npm:/tarball: 字段);条目里不要手写 npm:;Release 资产名不带版本号,releases/latest/download 永远指向最新;需要 dsh-plugin topic 与 SPDX LICENSE,仓库创建需满 1 天。合并后即出现在 dsh Web 插件页, 可直接搜索并点「安装」。

自建私有市场(自定义插件市场 URL)才需要官方生成器:

pnpm --filter @deepseek-ai/dsh-plugin-market-generator start \
  --input plugins.txt --output site/index.json --title "…"

把 index.json 放到静态可访问(2xx、无重定向)的位置(如 GitHub Pages), 在 dsh Web 插件页 → 实验性插件 → 自定义插件市场里添加该 URL 即可。

换到别的机器:通用性注意事项

  • 平台:hop/监控的日志与单元状态依赖 Linux + systemd 用户会话 (journalctl --user / systemctl --user)。非 systemd 环境把插件配置 followJournal: false,被动探测与 GUI 芯片仍可用。
  • python3 ≥ 3.8:router/strata-hop.py 只用标准库,无需 pip 依赖。
  • 模型 id 对齐(最常见的坑):bundle cordis.patch.yml 里的两个模型 id 只是示例,必须与你 hop 配置里 models 的键一致。不一致时在 profile 的 cordis.patch.yml 覆盖 providers.strata——注意 provider 条目是 整条替换,非内置目录的条目要写全 api / baseURL / models。
  • 状态端口固定 8756:GUI 芯片按 http://<GUI 主机名>:8756/events 连接 (端口写死在客户端),不要改插件 port。要从局域网设备访问 GUI 时, 把插件 host 设为 0.0.0.0 并放行防火墙 8756(GUI 端口同理)。
  • systemd unit 占位符:router/strata-hop.service 里的 /home/USER 与 strata 安装路径需按你的机器替换。

関連プラグイン