dsh-model-flatmap 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +112 -2
- package/README.zh.md +98 -0
- package/client.js +2378 -0
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +220 -0
- package/docs/model-picker.jpeg +0 -0
- package/icon.svg +11 -0
- package/index.js +12 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +26 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-model-flatmap contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-model-flatmap
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A flat, two-level-free model picker for the DeepSeek Harness (DSH) composer:
|
|
4
|
+
> every model and reasoning level on one surface, no second-level menus.
|
|
5
|
+
|
|
6
|
+
[简体中文](./README.zh.md)
|
|
7
|
+
|
|
8
|
+
## What it is
|
|
9
|
+
|
|
10
|
+
`dsh-model-flatmap` is a **browser-only** DSH plugin. It replaces the composer's
|
|
11
|
+
`conversation.input.model` seat with a single flat panel rendered in the Web GUI.
|
|
12
|
+
Instead of nested popovers, the whole catalogue is one searchable grid where the
|
|
13
|
+
model grid, the current model's reasoning levels, and the agent-teamwork switch
|
|
14
|
+
are all visible at once.
|
|
15
|
+
|
|
16
|
+
The plugin reads and writes through **public Client APIs only** — the per-Session
|
|
17
|
+
model directory, the teamwork setting, and the host's locale. The host half
|
|
18
|
+
(`index.js`) contributes no service, tool, or event; the UI lives in `client.js`,
|
|
19
|
+
which registers with a negative priority so it shadows the shipped `ModelSelect`
|
|
20
|
+
while active. Disabling the plugin restores the native control with no residue.
|
|
21
|
+
|
|
22
|
+
## Screenshot
|
|
23
|
+
|
|
24
|
+
The panel in action — a flat grid of models, the current model's reasoning
|
|
25
|
+
levels, and the agent-teamwork switch on one surface:
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **One surface.** The trigger opens one panel capped at 320 px. The header, the
|
|
32
|
+
reasoning row, and the teamwork row stay fixed; only the model grid scrolls.
|
|
33
|
+
- **Global search.** Filters across every provider and every family. Groups that
|
|
34
|
+
end up empty are dropped, so no stray headings remain. Prefix matches rank
|
|
35
|
+
first, then substring matches, then ordered character matches.
|
|
36
|
+
- **Word-wise search.** Whitespace splits the query into tokens, and every token
|
|
37
|
+
must land somewhere in the name. A hit ranks by its weakest token.
|
|
38
|
+
- **Provider-wide search.** A query that matches a *provider* (its id, catalog
|
|
39
|
+
name, or section label) keeps that provider's entire catalogue in the grid.
|
|
40
|
+
- **Two grouping modes.** A segment control switches the grid between
|
|
41
|
+
*By provider* and *By family*. Grouping and search are independent.
|
|
42
|
+
- **Model families.** A built-in dictionary recognises DeepSeek, Grok, Opus,
|
|
43
|
+
Haiku, Sonnet, Claude, Qwen, GLM, Kimi, GPT, Gemini, Llama, Mistral and others.
|
|
44
|
+
Unrecognised models are inferred from their id; anything unjudgeable falls into
|
|
45
|
+
*Others* (always sorts last). Families stay flat — no nesting.
|
|
46
|
+
- **Generations are kept apart.** A registered brand splits by generation:
|
|
47
|
+
`hy3` → `HY3`, `hy4free` / `hy4std` / `hy4-preview` → `HY4`, and a bare `hy`
|
|
48
|
+
→ `HY`. Unregistered brands still collapse their version tail; dictionary
|
|
49
|
+
families (GPT, Qwen…) are never split.
|
|
50
|
+
- **Rows are provider-primary.** Under *By family* the heading already says what
|
|
51
|
+
the models are, so the family name is not repeated in a row: the primary text
|
|
52
|
+
is the provider name. Only when one provider offers several models in the same
|
|
53
|
+
family does a short id-derived suffix differentiate them. The full model name
|
|
54
|
+
and description stay in the tooltip.
|
|
55
|
+
- **Reasoning effort.** The current model's reasoning levels render as an
|
|
56
|
+
exclusive, keyboard-operable group ("推理等级" / "Reasoning effort") driven by
|
|
57
|
+
radio semantics.
|
|
58
|
+
- **Adaptive footer.** The reasoning group and the agent-teamwork switch share
|
|
59
|
+
one line when both fit with a 30 px gap, and fall back to one row each when
|
|
60
|
+
they do not — the break is CSS flex wrapping, not a measured pixel threshold.
|
|
61
|
+
- **Out-of-balance models are struck through.** A model whose last call failed
|
|
62
|
+
on insufficient balance, credit, or quota keeps a `line-through` on its row
|
|
63
|
+
text until a later call for that same model returns anything else. The strike
|
|
64
|
+
follows the model the failing request actually used, and covers the Host's
|
|
65
|
+
`QUOTA` / `ACCOUNT_QUOTA` codes, a provider `402`, and a `429` whose body
|
|
66
|
+
reports an empty balance — a plain rate limit never strikes.
|
|
67
|
+
- **Theme-aware.** Styled with host theme tokens only; looks correct in both
|
|
68
|
+
light and dark themes.
|
|
69
|
+
|
|
70
|
+
See [`docs/DETAIL.md`](./docs/DETAIL.md) for the full behaviour spec and
|
|
71
|
+
[`DECISIONS.md`](./DECISIONS.md) for the decision log behind the design.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
This package is a DSH **bundle**. Install it from your DSH profile (the plugin
|
|
76
|
+
manager), or drop it into the profile's bundle directory so the `dsh` loader
|
|
77
|
+
picks up `cordis.patch.yml`.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Example: install the bundle into a running profile (paths vary by install)
|
|
81
|
+
cp -r . "<profile>/bundles/dsh-model-flatmap"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Enable or disable the plugin from the profile's plugin list — no native control
|
|
85
|
+
is touched when the bundle is off.
|
|
86
|
+
|
|
87
|
+
## Project layout
|
|
88
|
+
|
|
89
|
+
| Path | Purpose |
|
|
90
|
+
| -------------------- | -------------------------------------------------------- |
|
|
91
|
+
| `index.js` | Host half — bundle entry, contributes nothing at runtime. |
|
|
92
|
+
| `client.js` | Browser half — the entire flat picker UI. |
|
|
93
|
+
| `cordis.patch.yml` | Cordis patch applied by the `dsh` bundle loader. |
|
|
94
|
+
| `locale/en.json` | English copy and metadata. |
|
|
95
|
+
| `locale/zh.json` | Simplified-Chinese copy and metadata. |
|
|
96
|
+
| `docs/DETAIL.md` | Detailed behaviour specification. |
|
|
97
|
+
| `test/` | Render-path tests driven through a minimal hook runtime. |
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
The plugin is plain ES modules with no build step.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Run the render-path tests (no browser required)
|
|
105
|
+
node --test test/
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Tests read `client.js` directly and drive the real component through a minimal
|
|
109
|
+
hook runtime to catch crashes, missing sections, and wrong column counts.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Released under the [MIT License](./LICENSE).
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# dsh-model-flatmap
|
|
2
|
+
|
|
3
|
+
> 一个平铺、无二级菜单的 DeepSeek Harness(DSH)模型选择器:所有模型与推理等级
|
|
4
|
+
> 都在同一平面上,没有层层弹层。
|
|
5
|
+
|
|
6
|
+
[English](./README.md)
|
|
7
|
+
|
|
8
|
+
## 这是什么
|
|
9
|
+
|
|
10
|
+
`dsh-model-flatmap` 是一个**纯浏览器端**的 DSH 插件。它把会话输入框中的
|
|
11
|
+
`conversation.input.model` 控件替换成一个平铺面板,渲染在 Web GUI 内。面板没有
|
|
12
|
+
嵌套的二级菜单:模型网格、当前模型的推理等级,以及智能体协作开关,全部同时可见。
|
|
13
|
+
|
|
14
|
+
插件**只通过公开的 Client API 读写数据**——每个会话的模型目录、协作设置、以及宿主
|
|
15
|
+
的语言文案。宿主部分(`index.js`)不提供任何服务、工具或事件;UI 全部在
|
|
16
|
+
`client.js` 中,注册时使用负优先级以在启用期间覆盖原生的 `ModelSelect`。关闭插件
|
|
17
|
+
即可无残留地恢复原生控件。
|
|
18
|
+
|
|
19
|
+
## 截图
|
|
20
|
+
|
|
21
|
+
运行中的面板——模型平铺网格、当前模型的推理等级,以及智能体协作开关,
|
|
22
|
+
全部位于同一平面上:
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## 功能
|
|
27
|
+
|
|
28
|
+
- **一块平面。** 触发器打开一个高度上限 320 px 的面板。头部、推理等级行与协作行
|
|
29
|
+
固定常驻,只有模型网格可滚动。
|
|
30
|
+
- **全局搜索。** 跨所有 provider 与 family 过滤。过滤后为空的组会被丢弃,不会留下
|
|
31
|
+
空标题。命中排序:前缀优先,其次子串,最后有序字符匹配。
|
|
32
|
+
- **分词搜索。** 空白把查询拆成多个 token,每个 token 都要在名称中命中;一次命中的
|
|
33
|
+
排序取决于最弱的那一个 token。
|
|
34
|
+
- **按 provider 整体搜索。** 命中某个 *provider*(其 id、目录名或分组标签)时,该
|
|
35
|
+
provider 的整个目录都会保留在网格中。
|
|
36
|
+
- **两种分组模式。** 分段控件在 *按 provider* 与 *按 family* 之间切换。分组与搜索彼此
|
|
37
|
+
独立。
|
|
38
|
+
- **模型家族。** 内置词典识别 DeepSeek、Grok、Opus、Haiku、Sonnet、Claude、Qwen、
|
|
39
|
+
GLM、Kimi、GPT、Gemini、Llama、Mistral 等。未覆盖的模型按 id 推断;无法判断的归入
|
|
40
|
+
*Others*(永远排在最后)。家族保持平铺,不嵌套。
|
|
41
|
+
- **generation 要区分开。** 已注册品牌按 generation 分节:`hy3` 归 `HY3`、`hy4free` /
|
|
42
|
+
`hy4std` / `hy4-preview` 归 `HY4`,裸 `hy` 仍是 `HY`;未注册品牌仍折叠版本后缀。
|
|
43
|
+
词典家族(GPT、Qwen…)不拆 generation。
|
|
44
|
+
- **row content 以 provider 为主。** *按 family* 下标题已经说明模型是什么,所以行里
|
|
45
|
+
不再重复家族名,主文本改为 provider name;仅当同一 provider 在同一家族下有多个
|
|
46
|
+
模型时,才补一个由 id 推出的短后缀区分。完整模型名/描述保留在 tooltip。
|
|
47
|
+
- **推理等级。** 当前模型的推理等级渲染为一个互斥、可键盘操作的分组("推理等级",
|
|
48
|
+
基于 radio 语义)。
|
|
49
|
+
- **自适应底栏。** 推理等级组与智能体协作开关在放得下(中间至少 30 px)时共用一行,
|
|
50
|
+
放不下时各自占一行回到原来的两行布局——换行由 CSS flex 换行决定,不靠 JS 量像素。
|
|
51
|
+
- **额度不足的模型加删除线。** 某个模型的调用因额度/余额/信用不足而失败后,该模型的
|
|
52
|
+
行文字会带 `line-through` 删除线,直到同一个模型的下一次调用返回非额度不足的结果
|
|
53
|
+
才去掉。标记跟随失败那次请求实际使用的模型;覆盖宿主的 `QUOTA` / `ACCOUNT_QUOTA`
|
|
54
|
+
代码、provider 的 `402`,以及**正文说明余额不足的 `429`**——纯限流的 429 不会划线。
|
|
55
|
+
- **跟随主题。** 仅使用宿主主题令牌着色,在浅色与深色主题下都正确。
|
|
56
|
+
|
|
57
|
+
完整行为规格见 [`docs/DETAIL.md`](./docs/DETAIL.md),设计决策见
|
|
58
|
+
[`DECISIONS.md`](./DECISIONS.md)。
|
|
59
|
+
|
|
60
|
+
## 安装
|
|
61
|
+
|
|
62
|
+
本包是一个 DSH **bundle**。从 DSH 配置文件的插件管理器安装,或将其放入配置文件的
|
|
63
|
+
bundle 目录,由 `dsh` 加载器读取 `cordis.patch.yml`。
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 示例:把 bundle 装到某个运行中的 profile(路径因安装而异)
|
|
67
|
+
cp -r . "<profile>/bundles/dsh-model-flatmap"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
在配置文件的插件列表中启用或停用本插件即可——关闭 bundle 不会触碰任何原生控件。
|
|
71
|
+
|
|
72
|
+
## 目录结构
|
|
73
|
+
|
|
74
|
+
| 路径 | 用途 |
|
|
75
|
+
| -------------------- | ------------------------------------------------ |
|
|
76
|
+
| `index.js` | 宿主部分——bundle 入口,运行时不提供任何能力。 |
|
|
77
|
+
| `client.js` | 浏览器部分——完整的平铺选择器 UI。 |
|
|
78
|
+
| `cordis.patch.yml` | 由 `dsh` bundle 加载器应用的 Cordis 补丁。 |
|
|
79
|
+
| `locale/en.json` | 英文文案与元数据。 |
|
|
80
|
+
| `locale/zh.json` | 简体中文文案与元数据。 |
|
|
81
|
+
| `docs/DETAIL.md` | 详细行为规格。 |
|
|
82
|
+
| `test/` | 通过最小化 hook 运行时驱动的渲染路径测试。 |
|
|
83
|
+
|
|
84
|
+
## 开发
|
|
85
|
+
|
|
86
|
+
插件是纯 ES 模块,无需构建步骤。
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# 运行渲染路径测试(无需浏览器)
|
|
90
|
+
node --test test/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
测试直接读取 `client.js`,并通过最小化 hook 运行时驱动真实组件,以捕获崩溃、缺失
|
|
94
|
+
区块和错误的列数。
|
|
95
|
+
|
|
96
|
+
## 许可证
|
|
97
|
+
|
|
98
|
+
基于 [MIT 许可证](./LICENSE) 发布。
|