@hukj/dsh-subagent-model-tags 0.0.0-stage → 1.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hukj
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,91 @@
1
- # Temporary Holding Version
1
+ # dsh-subagent-model-tags
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/rolfhu/dsh-subagent-model-tags/actions/workflows/ci.yml/badge.svg)](https://github.com/rolfhu/dsh-subagent-model-tags/actions/workflows/ci.yml)
4
+
5
+ English | [中文](README.zh.md)
6
+
7
+ A DeepSeek Harness plugin that shows each subagent's model name in the session-header subagent panels, and widens those panels from 360 px to 460 px.
8
+
9
+ ## Screenshots
10
+
11
+ The model name appears on the row's name line — the second line when the row shows a description:
12
+
13
+ ![A single subagent row with the model name impl/st/glm-5.3 on the name line](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/one-row.png)
14
+
15
+ Every nesting level carries its own model name, including provider and reasoning effort:
16
+
17
+ ![Nested subagents, each row showing its own model name such as impl/st/kimi-k3 · high](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/nested-panel.png)
18
+
19
+ Inside a subagent conversation, the breadcrumb panel shows model names too:
20
+
21
+ ![A subagent conversation's breadcrumb panel with model names on every row](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/breadcrumb-panel.png)
22
+
23
+ ## What it does
24
+
25
+ - Adds each subagent's model name on its row's name line in every subagent panel: the root session's subagent panel, a subagent conversation's sibling switcher, and its own children panel. The name is written as `provider/model · reasoning effort`, at every nesting level.
26
+ - A subagent with no recorded model, and external subagents that have no local session, show `—`.
27
+ - Widens the subagent panels to 460 px (still bounded by the window width).
28
+
29
+ The model name comes from each subagent session's `modelSelection` projection, which the Harness records durably, so it shows what the subagent actually runs with rather than what a parent was asked for.
30
+
31
+ ## Install
32
+
33
+ Requires DeepSeek Harness `0.2.2-rc.4` and later `0.2.x`.
34
+
35
+ - **Published package**: open **Plugins** in the Web sidebar, choose **Add plugin**, and enter `@hukj/dsh-subagent-model-tags`. The Plugin Manager picks the registry through its own configuration and falls back through the configured registries.
36
+ - **Local development**: enter the absolute path of this directory in the same dialog.
37
+
38
+ Then enable the bundle if it is switched off. The change takes effect after a page refresh.
39
+
40
+ ## Limitations
41
+
42
+ - The model name is injected as text into the panel's rendered rows, so a future DSH panel change can silently stop it. The plugin writes a name onto a row only when it can pair every rendered row against a catalog it knows (the conversation's own or an ancestor's) and verify each paired row's displayed label; a panel that verifies against nothing stays untouched instead of showing a wrong model.
43
+ - Two catalogs with identical row labels in the same order could still cross-match; in practice that requires two identical agent sets on the same chain.
44
+ - The panel width is raised through the host's `--dsh-subagent-menu-width` variable; if the host restructures the panel, the width rule may stop applying.
45
+ - Diagnostics: with a panel open, run `__subagentModelsDebug()` in the page console to see what the last syncs paired and why a candidate root was rejected.
46
+
47
+ ## Files
48
+
49
+ | File | Role |
50
+ |---|---|
51
+ | `client.js` | Web client module: panel widening and the two invisible seats that write model names |
52
+ | `index.js` | Inert Host entry |
53
+ | `cordis.patch.yml` | Bundle patch inserting the plugin row |
54
+ | `locale/*.json` | Plugin display metadata in eight languages |
55
+ | `docs/DETAIL.md`, `docs/preview.svg` | Detail page image |
56
+ | `docs/images/*.png` | README screenshots |
57
+ | `screenshots.json` | Screenshot list for plugin storefronts |
58
+ | `assets/icon-180.png` | Raster icon for plugin storefronts |
59
+ | `icon.svg` | Plugin icon |
60
+
61
+ ## Development
62
+
63
+ The self-check loads the client module with a stub module loader, runs its factory, exercises both slot registrations, renders both components, and executes the effect bodies against a minimal fake DOM — including a panel sync where an equal-count wrong catalog root must be rejected by label verification.
64
+
65
+ ```sh
66
+ node test/selftest.cjs
67
+ ```
68
+
69
+ It is not part of the published package.
70
+
71
+ ## Releasing
72
+
73
+ Publishing is automated up to the staging area: pushing a version tag runs the `Release` workflow, which checks that the tag matches `package.json`, runs the self-check, and stages the release on npm with provenance through Trusted Publishing (OIDC, no stored token).
74
+
75
+ ```sh
76
+ # 1. bump the version in package.json and commit it
77
+ # 2. tag and push
78
+ git tag v1.0.1
79
+ git push origin v1.0.1
80
+ ```
81
+
82
+ Staging does not need 2FA. The final step is a human approval with 2FA, which is npm's proof-of-presence requirement for every publish:
83
+
84
+ - Open the staged version's page on npmjs.com (the workflow log prints the URL), or run `npm stage list` and `npm stage view <id>` locally
85
+ - Approve it with your 2FA on npmjs.com — `npm stage approve <id>` in a terminal needs a TOTP code and does not work with a passkey
86
+
87
+ The workflow's trusted-publisher connection allows `npm stage publish` (the default for connections created after 2026-09-03); direct `npm publish` over OIDC is refused unless a new connection explicitly allows it. `CI` runs the self-check on every push to `main` and on pull requests.
88
+
89
+ ## License
90
+
91
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,91 @@
1
+ # dsh-subagent-model-tags
2
+
3
+ [![CI](https://github.com/rolfhu/dsh-subagent-model-tags/actions/workflows/ci.yml/badge.svg)](https://github.com/rolfhu/dsh-subagent-model-tags/actions/workflows/ci.yml)
4
+
5
+ [English](README.md) | 中文
6
+
7
+ 一个 DeepSeek Harness 插件:在会话顶部的子代理面板里显示每个子代理所使用的模型名,并把面板宽度从 360px 加宽到 460px。
8
+
9
+ ## 效果展示
10
+
11
+ 模型名显示在行的名称行上(有描述的行就是第二行):
12
+
13
+ ![单个子代理行,名称行上显示模型名 impl/st/glm-5.3](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/one-row.png)
14
+
15
+ 每一层嵌套都带自己的模型名,包含 provider 与推理档位:
16
+
17
+ ![嵌套的子代理列表,每行显示自己的模型名,如 impl/st/kimi-k3 · high](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/nested-panel.png)
18
+
19
+ 进入子代理会话后,面包屑面板同样显示模型名:
20
+
21
+ ![子代理会话的面包屑面板,每行都有模型名](https://raw.githubusercontent.com/rolfhu/dsh-subagent-model-tags/main/docs/images/breadcrumb-panel.png)
22
+
23
+ ## 功能说明
24
+
25
+ - 在会话顶部的各子代理面板中,为每个子代理的名称行追加模型名:根会话的子代理面板、子代理会话的兄弟切换面板、以及它自己的子代理面板,所有嵌套层级都生效。模型名格式为 `provider/model · 推理档位`。
26
+ - 没有任何模型记录的子代理、以及没有本地会话的 external 子代理显示 `—`。
27
+ - 把子代理面板加宽到 460px(仍受窗口宽度限制)。
28
+
29
+ 模型名取自每个子代理会话的 `modelSelection` 投影(Harness 会持久记录),因此显示的是子代理实际使用的模型,而不是父会话「要求」的模型。
30
+
31
+ ## 安装
32
+
33
+ 要求 DeepSeek Harness `0.2.2-rc.4` 及之后的 `0.2.x` 版本。
34
+
35
+ - **已发布版本**:在 Web 侧边栏打开 **Plugins**,选择 **Add plugin**,输入 `@hukj/dsh-subagent-model-tags`。管理器会先按自身配置的 registry 查询,失败再按配置的回退 registry 依次尝试。
36
+ - **本地开发**:在同一个对话框里输入本目录的绝对路径。
37
+
38
+ 若插件被关闭,请在列表里启用它。改动需要刷新页面后生效。
39
+
40
+ ## 已知限制
41
+
42
+ - 模型名是以文本形式注入到面板已渲染的行里的,因此 DSH 未来改动面板结构时可能悄悄失效。插件只会在「能把面板每一行与已知目录(当前会话或某个祖先会话的目录)完整配对,且每行显示名与条目期望名逐一匹配」时才写入模型名;无法校验通过的面板宁可不显示,也不显示错误的模型。
43
+ - 两个目录层级的显示名序列完全相同时仍可能交叉配对;实际上要求同一条链上存在两组完全相同的子代理。
44
+ - 面板宽度通过宿主 `--dsh-subagent-menu-width` 变量提升;宿主重构面板时宽度规则可能失效。
45
+ - 调试方法:面板打开时在浏览器控制台执行 `__subagentModelsDebug()`,可以看到最近一次同步配对了什么、候选根为什么被拒绝。
46
+
47
+ ## 文件说明
48
+
49
+ | 文件 | 作用 |
50
+ |---|---|
51
+ | `client.js` | Web 客户端模块:面板加宽与两个写入模型名的隐形座位 |
52
+ | `index.js` | 空的 Host 入口 |
53
+ | `cordis.patch.yml` | 插入插件行的 bundle 补丁 |
54
+ | `locale/*.json` | 八种语言的插件展示元数据 |
55
+ | `docs/DETAIL.md`、`docs/preview.svg` | 详情页图片 |
56
+ | `docs/images/*.png` | README 截图 |
57
+ | `screenshots.json` | 插件市场用的截图清单 |
58
+ | `assets/icon-180.png` | 插件市场用的位图图标 |
59
+ | `icon.svg` | 插件图标 |
60
+
61
+ ## 开发
62
+
63
+ 自检脚本会用桩模块加载器加载客户端模块、执行工厂、检查两个槽位注册、渲染两个组件,并用一个极简假 DOM 执行 effect 主体——其中包括一个「行数相同但目录根错误」的面板同步场景,必须被名称校验拒绝。
64
+
65
+ ```sh
66
+ node test/selftest.cjs
67
+ ```
68
+
69
+ 该脚本不参与 npm 发布包。
70
+
71
+ ## 发布
72
+
73
+ 发布已自动化到"暂存"这一步:推送版本标签会触发 `Release` 工作流,它先校验标签与 `package.json` 版本一致,再跑自检,最后通过 Trusted Publishing(OIDC,不存令牌)把发布提交到 npm 暂存区并附带 provenance。
74
+
75
+ ```sh
76
+ # 1. 修改 package.json 版本并提交
77
+ # 2. 打标签并推送
78
+ git tag v1.0.1
79
+ git push origin v1.0.1
80
+ ```
81
+
82
+ 暂存本身不需要 2FA。最后一步是**人工用 2FA 批准**——这是 npm 对每次发布的 proof-of-presence 要求:
83
+
84
+ - 打开 npmjs.com 上该暂存版本的页面(工作流日志里会打印链接),或在本地跑 `npm stage list`、`npm stage view <id>`
85
+ - 在 npmjs.com 上用你的 2FA 批准;在终端里 `npm stage approve <id>` 需要 TOTP 验证码,passkey 用不了
86
+
87
+ 工作流的 trusted-publisher 连接允许的是 `npm stage publish`(2026-09-03 之后创建的连接默认如此);除非新建连接时显式允许直接发布,OIDC 的 `npm publish` 会被拒绝。`CI` 工作流会在每次推送到 `main` 和每个 PR 上跑自检。
88
+
89
+ ## 许可证
90
+
91
+ MIT
package/client.js ADDED
@@ -0,0 +1,344 @@
1
+ window.__ModuleLoader__.load({
2
+ id: '@hukj/dsh-subagent-model-tags',
3
+ factory(require) {
4
+ const React = require('react');
5
+
6
+ const BADGE_MARK = 'data-subagent-model-badge';
7
+
8
+ let sessionsService = null;
9
+ let lastDebug = null;
10
+
11
+ /** Badge text for one recorded model selection; null when nothing is recorded. */
12
+ function modelText(selection) {
13
+ if (selection === null || selection === undefined) return null;
14
+ if (typeof selection.model !== 'string' || selection.model === '') return null;
15
+ const prefix = typeof selection.provider === 'string' && selection.provider !== ''
16
+ ? selection.provider + '/'
17
+ : '';
18
+ const route = prefix + selection.model;
19
+ return typeof selection.reasoningEffort === 'string' && selection.reasoningEffort !== ''
20
+ ? route + ' · ' + selection.reasoningEffort
21
+ : route;
22
+ }
23
+
24
+ /**
25
+ * Map every catalog child's session id to its badge text.
26
+ * A value of null means the child is known but has no recorded model yet.
27
+ */
28
+ function modelMapOf(projections) {
29
+ const map = new Map();
30
+ if (projections === null || typeof projections !== 'object') return map;
31
+ for (const snapshot of Object.values(projections)) {
32
+ const entries = snapshot && snapshot.values ? snapshot.values.subagentCatalog : undefined;
33
+ if (!Array.isArray(entries)) continue;
34
+ for (const entry of entries) {
35
+ const child = projections[entry.id];
36
+ const selection = child && child.values ? child.values.modelSelection : undefined;
37
+ const chosen = (selection && (selection.next || selection.lastUsed)) || null;
38
+ map.set(entry.id, modelText(chosen));
39
+ }
40
+ }
41
+ return map;
42
+ }
43
+
44
+ /**
45
+ * Pair each rendered row with its catalog entry by walking the panel's tree
46
+ * structure in order, recursing through rendered (expanded) groups. Every
47
+ * nesting level pairs by position, so no displayed-text matching is needed.
48
+ */
49
+ function collectRows(container, entries, projections, out) {
50
+ if (!Array.isArray(entries) || entries.length === 0) return;
51
+ const nodes = Array.from(container.children).filter(element =>
52
+ element.firstElementChild !== null
53
+ && element.firstElementChild.getAttribute('role') === 'treeitem');
54
+ let index = 0;
55
+ for (const entry of entries) {
56
+ const node = nodes[index++];
57
+ if (node === undefined) break;
58
+ const row = node.firstElementChild;
59
+ out.push([row, entry]);
60
+ const group = node.querySelector(':scope > [role="group"]');
61
+ if (group !== null) {
62
+ const child = projections[entry.id];
63
+ collectRows(
64
+ group,
65
+ child && child.values ? child.values.subagentCatalog : undefined,
66
+ projections,
67
+ out,
68
+ );
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Place or update one row's model badge on the row's name line: inside the
75
+ * secondary name span when the row shows a description, else inside the
76
+ * label span. Appends after the line's text; never inserts between the
77
+ * host's own React children.
78
+ */
79
+ function applyBadge(row, text) {
80
+ const area = row.querySelector(':scope > div');
81
+ if (area === null) return;
82
+ const content = area.children[1];
83
+ if (!content || content.tagName !== 'SPAN') return;
84
+ const label = content.firstElementChild;
85
+ if (!label || label.tagName !== 'SPAN') return;
86
+ const line = label.nextElementSibling !== null && label.nextElementSibling.tagName === 'SPAN'
87
+ ? label.nextElementSibling
88
+ : label;
89
+ if (text === undefined) {
90
+ const stale = content.querySelector(':scope > [' + BADGE_MARK + ']');
91
+ if (stale !== null) stale.remove();
92
+ return;
93
+ }
94
+ const shown = text === null ? '—' : text;
95
+ let badge = line.querySelector(':scope > [' + BADGE_MARK + ']');
96
+ if (badge === null) {
97
+ badge = document.createElement('span');
98
+ badge.setAttribute(BADGE_MARK, 'true');
99
+ badge.setAttribute('aria-hidden', 'true');
100
+ badge.style.cssText = 'display:inline-block;margin-left:6px;padding:0 6px;'
101
+ + 'border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);'
102
+ + 'color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:15px;'
103
+ + 'font-weight:400;white-space:nowrap;vertical-align:1px;';
104
+ line.appendChild(badge);
105
+ }
106
+ if (text === null) badge.removeAttribute('title');
107
+ else badge.setAttribute('title', text);
108
+ if (badge.textContent !== shown) badge.textContent = shown;
109
+ }
110
+
111
+ /** The displayed primary label a catalog entry renders on its row. */
112
+ function expectedLabel(entry, summaries) {
113
+ const summary = summaries ? summaries[entry.id] : undefined;
114
+ const name = entry.mode === 'continuable' || entry.mode === 'external'
115
+ ? entry.name || entry.id
116
+ : entry.id;
117
+ return entry.label || (summary && summary.title) || name;
118
+ }
119
+
120
+ /** The row's displayed primary label text, or null when unavailable. */
121
+ function rowLabel(row) {
122
+ const area = row.querySelector(':scope > div');
123
+ if (area === null) return null;
124
+ const content = area.children[1];
125
+ if (!content || content.tagName !== 'SPAN') return null;
126
+ const label = content.firstElementChild;
127
+ if (!label || label.tagName !== 'SPAN') return null;
128
+ const textNode = label.firstChild;
129
+ if (!textNode || textNode.nodeType !== 3) return null;
130
+ return String(textNode.textContent || '').trim();
131
+ }
132
+
133
+ /**
134
+ * Sync the panel we are mounted in by structural row/entry pairing against
135
+ * its known root session's catalog. The root is known, so no verification
136
+ * is needed here; the pairing is positional and complete.
137
+ */
138
+ function syncHomePanel(panel, rootEntries, projections, models) {
139
+ const pairs = [];
140
+ const tree = panel.querySelector('[role="tree"]');
141
+ if (tree !== null) collectRows(tree, rootEntries, projections, pairs);
142
+ for (const [row, entry] of pairs) {
143
+ applyBadge(row, models.get(entry.id));
144
+ }
145
+ return pairs;
146
+ }
147
+
148
+ /**
149
+ * Sync a panel whose seat we are not mounted in: try structural pairing
150
+ * against each candidate root session's catalog; accept a candidate only
151
+ * when it pairs every rendered row AND each paired row's displayed label
152
+ * equals its entry's expected label. When no candidate verifies, the panel
153
+ * is left alone rather than badged with guesses, and the failed attempts
154
+ * are reported for diagnosis.
155
+ */
156
+ function syncForeignPanel(panel, candidateRoots, projections, summaries, models) {
157
+ const rows = Array.from(panel.querySelectorAll('[role="treeitem"]'));
158
+ if (rows.length === 0) return null;
159
+ const rowLabels = rows.map(row => rowLabel(row));
160
+ const tree = panel.querySelector('[role="tree"]');
161
+ const attempts = [];
162
+ if (tree === null) {
163
+ return { rootId: null, pairs: [], attempts: [{ reason: 'no-tree', rows: rows.length }] };
164
+ }
165
+ for (const rootId of candidateRoots) {
166
+ const snapshot = projections ? projections[rootId] : undefined;
167
+ const entries = snapshot && snapshot.values ? snapshot.values.subagentCatalog : undefined;
168
+ const pairs = [];
169
+ collectRows(tree, entries, projections, pairs);
170
+ if (pairs.length !== rows.length) {
171
+ attempts.push({ rootId, reason: 'count', rows: rows.length, paired: pairs.length,
172
+ rowLabels: rowLabels.slice(0, 12) });
173
+ continue;
174
+ }
175
+ const mismatch = pairs.find(([row, entry]) => rowLabel(row) !== expectedLabel(entry, summaries));
176
+ if (mismatch !== undefined) {
177
+ attempts.push({ rootId, reason: 'label', rows: rows.length,
178
+ rowLabel: rowLabel(mismatch[0]),
179
+ expectedLabel: expectedLabel(mismatch[1], summaries),
180
+ entryId: mismatch[1].id, entryName: mismatch[1].name || null });
181
+ continue;
182
+ }
183
+ for (const [row, entry] of pairs) applyBadge(row, models.get(entry.id));
184
+ return { rootId, pairs, attempts };
185
+ }
186
+ return { rootId: null, pairs: [], attempts };
187
+ }
188
+
189
+ /** Pull missing model selections for visible paired rows. */
190
+ function refreshMissing(pairs, projections) {
191
+ if (sessionsService === null) return;
192
+ for (const [, entry] of pairs) {
193
+ const child = projections ? projections[entry.id] : undefined;
194
+ if (child && child.values && child.values.modelSelection) continue;
195
+ Promise.resolve(sessionsService.refreshProjections(entry.id)).catch(() => {});
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Root-panel footer seat: mounts only while the root session's subagent
201
+ * panel is open and badges that panel's rows by structural pairing.
202
+ */
203
+ function SubagentModels(props) {
204
+ const anchor = React.useRef(null);
205
+ const useSessions = props.useSessions;
206
+ const projections = useSessions ? useSessions(state => state.projectionsBySession) : undefined;
207
+ const rootEntries = projections && projections[props.sessionId] && projections[props.sessionId].values
208
+ ? projections[props.sessionId].values.subagentCatalog
209
+ : undefined;
210
+ const models = React.useMemo(() => modelMapOf(projections), [projections]);
211
+ React.useEffect(() => {
212
+ const anchorElement = anchor.current;
213
+ if (anchorElement === null || models.size === 0) return undefined;
214
+ const home = anchorElement.closest('[data-subagent-panel]');
215
+ if (home === null) return undefined;
216
+ const sync = () => syncHomePanel(home, rootEntries, projections, models);
217
+ const pairs = sync();
218
+ lastDebug = { ...lastDebug, home: {
219
+ rootSessionId: props.sessionId,
220
+ pairedRows: pairs.map(([, entry]) => ({
221
+ id: entry.id,
222
+ name: entry.name || null,
223
+ model: models.get(entry.id) === undefined ? 'unmapped' : models.get(entry.id),
224
+ })),
225
+ } };
226
+ refreshMissing(pairs, projections);
227
+ const observer = new MutationObserver(sync);
228
+ observer.observe(home, { childList: true, subtree: true, characterData: true });
229
+ return () => observer.disconnect();
230
+ }, [models, rootEntries, projections]);
231
+ return React.createElement('span', { ref: anchor, hidden: true });
232
+ }
233
+
234
+ /**
235
+ * Always-mounted header-actions seat: renders in every session header (root
236
+ * and subagent conversations), so it covers every subagent panel. Badges a
237
+ * panel only when one of its candidate root sessions (this conversation's
238
+ * own and its parent's catalogs) verifies against every rendered row; a
239
+ * panel that verifies against nothing stays untouched.
240
+ */
241
+ function SubagentModelsHeader(props) {
242
+ const useSessions = props.useSessions;
243
+ const useSession = props.useSession;
244
+ const projections = useSessions ? useSessions(state => state.projectionsBySession) : undefined;
245
+ const summaries = useSessions ? useSessions(state => state.byId) : undefined;
246
+ const address = useSession
247
+ ? useSession(session => (session.subagent && session.subagent.address) || null)
248
+ : null;
249
+ const models = React.useMemo(() => modelMapOf(projections), [projections]);
250
+ const candidateRoots = React.useMemo(() => {
251
+ /** The parent of a subagent session, from summaries or loaded catalogs. */
252
+ const parentOf = (sid) => {
253
+ const summary = summaries ? summaries[sid] : undefined;
254
+ if (summary && summary.origin === 'subagent' && summary.parentId) return summary.parentId;
255
+ if (projections) {
256
+ for (const id of Object.keys(projections)) {
257
+ const entries = projections[id] && projections[id].values
258
+ ? projections[id].values.subagentCatalog
259
+ : undefined;
260
+ if (Array.isArray(entries) && entries.some(one => one.id === sid)) return id;
261
+ }
262
+ }
263
+ return null;
264
+ };
265
+ const roots = [];
266
+ const seen = new Set();
267
+ const add = (id) => { if (id && !seen.has(id)) { seen.add(id); roots.push(id); } };
268
+ // Panels in this header can root at the current session or at any
269
+ // ancestor's catalog, so every ancestor must be a candidate.
270
+ add(props.sessionId);
271
+ let cursor = address !== null && address.parentSessionId
272
+ ? address.parentSessionId
273
+ : parentOf(props.sessionId);
274
+ for (let guard = 0; cursor !== null && guard < 16; guard++) {
275
+ add(cursor);
276
+ cursor = parentOf(cursor);
277
+ }
278
+ return roots;
279
+ }, [props.sessionId, address, summaries, projections]);
280
+ React.useEffect(() => {
281
+ const sync = () => {
282
+ const allPairs = [];
283
+ const matchedRoots = [];
284
+ const panelReports = [];
285
+ const panels = Array.from(document.querySelectorAll('[data-subagent-panel]'));
286
+ for (const panel of panels) {
287
+ const result = syncForeignPanel(panel, candidateRoots, projections, summaries, models);
288
+ if (result === null) {
289
+ matchedRoots.push('empty');
290
+ panelReports.push({ matchedRoot: 'empty', attempts: [] });
291
+ continue;
292
+ }
293
+ matchedRoots.push(result.rootId);
294
+ panelReports.push({ matchedRoot: result.rootId, attempts: result.attempts });
295
+ for (const pair of result.pairs) allPairs.push(pair);
296
+ }
297
+ return { panels: panels.length, matchedRoots, panelReports, pairs: allPairs };
298
+ };
299
+ const result = sync();
300
+ lastDebug = { ...lastDebug, lineage: {
301
+ sessionId: props.sessionId,
302
+ candidateRoots,
303
+ panels: result.panels,
304
+ matchedRoots: result.matchedRoots,
305
+ panelReports: result.panelReports,
306
+ pairedRows: result.pairs.map(([, entry]) => ({
307
+ id: entry.id,
308
+ name: entry.name || null,
309
+ model: models.get(entry.id) === undefined ? 'unmapped' : models.get(entry.id),
310
+ })),
311
+ } };
312
+ refreshMissing(result.pairs, projections);
313
+ const observer = new MutationObserver(() => { sync(); });
314
+ observer.observe(document.body, { childList: true, subtree: true, characterData: true });
315
+ return () => observer.disconnect();
316
+ }, [models, candidateRoots, projections]);
317
+ return null;
318
+ }
319
+
320
+ return {
321
+ inject: ['slots', 'sessions'],
322
+ apply(ctx) {
323
+ sessionsService = ctx.sessions;
324
+ window.__subagentModelsDebug = () => lastDebug;
325
+ ctx.effect(() => {
326
+ const style = document.createElement('style');
327
+ style.textContent = '[data-subagent-panel][role="dialog"]'
328
+ + '{--dsh-subagent-menu-width:min(460px,calc(100vw - 32px));}';
329
+ document.head.appendChild(style);
330
+ return () => style.remove();
331
+ }, 'subagent-models: panel width');
332
+ ctx.slots.inject('conversation.session.header.actions.subagent.footer', () => ctx.slots.register({
333
+ name: 'conversation.session.header.actions.subagent.footer',
334
+ id: 'subagent-models',
335
+ }, SubagentModels));
336
+ ctx.slots.inject('conversation.session.header.actions', () => ctx.slots.register({
337
+ name: 'conversation.session.header.actions',
338
+ id: 'subagent-models',
339
+ order: 15,
340
+ }, SubagentModelsHeader));
341
+ },
342
+ };
343
+ },
344
+ });
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: subagent-model-tags
3
+ name: '@hukj/dsh-subagent-model-tags'
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ ![Subagent rows with the model name on the name line, in a widened subagent panel](preview.svg)
@@ -0,0 +1,16 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300">
2
+ <rect width="640" height="300" rx="20" fill="#f3f5f9"/>
3
+ <rect x="88" y="40" width="220" height="14" rx="7" fill="#d6dde7"/>
4
+ <rect x="88" y="62" width="136" height="8" rx="4" fill="#e0e5ed"/>
5
+ <rect x="88" y="94" width="464" height="130" rx="18" fill="#ffffff" stroke="#b7c3d2" stroke-width="2"/>
6
+ <rect x="110" y="122" width="100" height="9" rx="4" fill="#63758c"/>
7
+ <rect x="214" y="119" width="86" height="15" rx="7.5" fill="#e2e9f1"/>
8
+ <rect x="472" y="122" width="64" height="9" rx="4" fill="#d6dde7"/>
9
+ <rect x="110" y="152" width="120" height="9" rx="4" fill="#63758c"/>
10
+ <rect x="234" y="149" width="96" height="15" rx="7.5" fill="#e2e9f1"/>
11
+ <rect x="472" y="152" width="64" height="9" rx="4" fill="#d6dde7"/>
12
+ <rect x="110" y="182" width="90" height="9" rx="4" fill="#63758c"/>
13
+ <rect x="204" y="179" width="110" height="15" rx="7.5" fill="#e2e9f1"/>
14
+ <rect x="472" y="182" width="64" height="9" rx="4" fill="#d6dde7"/>
15
+ <circle cx="118" cy="248" r="18" fill="#247bbf"/>
16
+ </svg>
package/icon.svg ADDED
@@ -0,0 +1,11 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="8" y="9.5" width="20" height="5" rx="2.5" fill="#9AA8B6" fill-opacity="0.8" />
3
+ <rect x="8" y="18.5" width="8" height="5" rx="2.5" fill="#9AA8B6" fill-opacity="0.8" />
4
+ <rect x="17.5" y="18.5" width="11" height="5" rx="2.5" fill="url(#sm-new)" />
5
+ <defs>
6
+ <linearGradient id="sm-new" x1="17.5" y1="18.5" x2="28.5" y2="23.5" gradientUnits="userSpaceOnUse">
7
+ <stop stop-color="#67C7FE" />
8
+ <stop offset="1" stop-color="#2F7DFF" />
9
+ </linearGradient>
10
+ </defs>
11
+ </svg>
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ /** Host half of the subagent-models bundle; the Client module owns the rendering. */
2
+ export function apply() {}
package/locale/de.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Subagent-Modelle",
4
+ "description": "Zeigt den Modellnamen jedes Subagenten in der Namenszeile seiner Zeile (die zweite Zeile, wenn die Zeile eine Beschreibung zeigt) in den Subagenten-Panels der Kopfzeile (Root-Panel, Geschwister-Umschalter und Kinder-Panel) und verbreitert diese Panels auf 460 px. Der Modellname stammt aus der aufgezeichneten Modellauswahl der jeweiligen Subagenten-Session und wird als provider/model plus Reasoning-Stufe geschrieben; ein Subagent ohne Auswahl und externe Subagenten zeigen einen Gedankenstrich. Der Text wird in die Panel-Zeilen injiziert, daher kann eine künftige Panel-Änderung von DSH ihn verschwinden lassen; ein Panel, das sich keinem bekannten Katalog zuordnen lässt, bleibt ohne Markierung, statt ein falsches Modell zu zeigen.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Subagent models",
4
+ "description": "Shows each subagent's model name on the row's name line — the second line when the row shows a description — in the session-header subagent panels (root panel, sibling switcher, and children panel), and widens those panels to 460px. The model name comes from each subagent session's recorded model selection, written as provider/model and its reasoning effort; a subagent without one, and external subagents, show a dash. The text is injected into the panel rows, so a future DSH panel change can hide it; a panel the plugin cannot pair against a known catalog stays unmarked instead of showing a wrong model.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/es.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Modelos de subagentes",
4
+ "description": "Muestra el nombre del modelo de cada subagente en la línea del nombre de su fila (la segunda línea cuando la fila muestra una descripción) en los paneles de subagentes de la cabecera (panel raíz, selector de hermanos y panel de hijos), y ensancha esos paneles a 460 px. El nombre del modelo proviene de la selección registrada en la sesión de cada subagente, escrito como provider/model y su esfuerzo de razonamiento; un subagente sin selección y los subagentes externos muestran un guion. El texto se inyecta en las filas del panel, así que un cambio futuro del panel de DSH puede ocultarlo; un panel que no puede emparejarse con un catálogo conocido queda sin marcar en lugar de mostrar un modelo incorrecto.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Modèles des sous-agents",
4
+ "description": "Affiche le nom du modèle de chaque sous-agent sur la ligne du nom de sa ligne (la deuxième ligne lorsque la ligne affiche une description) dans les panneaux de sous-agents de l'en-tête (panneau racine, sélecteur de frères, panneau des enfants), et élargit ces panneaux à 460 px. Le nom du modèle provient de la sélection enregistrée dans la session de chaque sous-agent, écrit sous la forme provider/model et son effort de raisonnement ; un sous-agent sans sélection et les sous-agents externes affichent un tiret. Le texte est injecté dans les lignes du panneau : une future modification du panneau par DSH peut le faire disparaître ; un panneau impossible à associer à un catalogue connu reste sans marque plutôt que d'afficher un modèle erroné.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "サブエージェントのモデル",
4
+ "description": "セッションヘッダーのサブエージェントパネル(ルートパネル、兄弟切り替えパネル、子パネル)で、各サブエージェントの名前の行(説明がある行では2行目)に使用モデル名を表示し、パネルを460pxに広げます。モデル名は各サブエージェントのセッションに記録されたモデル選択から取得し、provider/model と推論強度の形式で表示します。記録がないサブエージェントと外部サブエージェントは「—」と表示します。文字はパネル行に注入されるため、将来のDSHのパネル変更で表示されなくなる可能性があります。既知のカタログと対応付けられないパネルは、誤ったモデルを表示せず何も表示しません。",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Modelos de subagentes",
4
+ "description": "Mostra o nome do modelo de cada subagente na linha do nome da sua linha (a segunda linha quando a linha mostra uma descrição) nos painéis de subagentes do cabeçalho (painel raiz, seletor de irmãos e painel de filhos), e alarga esses painéis para 460 px. O nome do modelo vem da seleção registrada na sessão de cada subagente, escrito como provider/model e seu esforço de raciocínio; um subagente sem seleção e os subagentes externos mostram um traço. O texto é injetado nas linhas do painel, então uma futura mudança do painel pelo DSH pode ocultá-lo; um painel que não pode ser associado a um catálogo conhecido fica sem marcação em vez de mostrar um modelo errado.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Модели субагентов",
4
+ "description": "Показывает название модели каждого субагента в строке имени его строки (вторая строка, если строка показывает описание) в панелях субагентов в заголовке сессии (корневая панель, переключатель соседних и панель дочерних), и расширяет эти панели до 460 px. Название модели берётся из сохранённого выбора модели сессии субагента и записывается как provider/model и уровень рассуждений; субагенты без выбора и внешние субагенты показывают прочерк. Текст вставляется в строки панели, поэтому будущее изменение панели в DSH может его скрыть; панель, которую не удаётся сопоставить с известным каталогом, остаётся без пометок, а не показывает неверную модель.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "子代理模型",
4
+ "description": "在会话顶部的子代理面板(根面板、兄弟切换面板、子代理自己的面板)中,为每个子代理的名称行(有描述的行就是第二行)显示所使用的模型名,并将面板加宽到 460px。模型名取自该子代理会话记录的模型选择,格式为 provider/model 加推理档位;没有记录的子代理和 external 子代理显示“—”。文字直接注入在面板行内,DSH 未来改动面板结构时可能失效;无法与已知目录匹配的面板宁可不显示,也不显示错误的模型。",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@hukj/dsh-subagent-model-tags",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Shows each subagent's model in the session-header subagent panels.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/rolfhu/dsh-subagent-model-tags.git"
10
+ },
11
+ "scripts": {
12
+ "test": "node test/selftest.cjs"
13
+ },
14
+ "keywords": ["dsh", "deepseek-harness", "plugin", "subagent", "model"],
15
+ "engines": { "dsh": ">=0.2.2-rc.4 <0.3.0" },
16
+ "publishConfig": { "access": "public" },
17
+ "exports": {
18
+ ".": "./index.js",
19
+ "./client": "./client.js",
20
+ "./locale/*.json": "./locale/*.json",
21
+ "./icon": "./icon.svg"
22
+ },
23
+ "files": ["index.js", "client.js", "cordis.patch.yml", "locale/*.json", "docs/DETAIL.md", "docs/preview.svg", "icon.svg"],
24
+ "dsh": {
25
+ "bundle": { "patch": "./cordis.patch.yml" },
26
+ "client": {
27
+ "platform": "web",
28
+ "immediately": true,
29
+ "inject": ["@deepseek-ai/dsh-client-ui-subagent"]
30
+ }
31
+ }
32
+ }