dsh-dock 0.5.0 → 0.6.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.
@@ -12,8 +12,10 @@ const modelsStore = {
12
12
  set(patch) { this.snap = Object.assign({}, this.snap, patch); for (const fn of this.listeners) fn(); },
13
13
  load() {
14
14
  if (this.snap.loading) return;
15
- this.set({ loading: true });
16
- fetch("/dsh-dock/models", { signal: AbortSignal.timeout(20000) })
15
+ this.set({ loading: true, error: null });
16
+ // Provider 可在 DSH 原生模型设置中随时增删;不要复用浏览器缓存,
17
+ // 否则返回本页时仍可能看到旧的共享快照。
18
+ fetch("/dsh-dock/models", { cache: "no-store", signal: AbortSignal.timeout(20000) })
17
19
  .then((res) => (res.ok ? res.json() : Promise.reject(new Error("模型目录接口 HTTP " + res.status))))
18
20
  .then((data) => this.set({ data: data, loading: false, error: null }))
19
21
  .catch((e) => this.set({ loading: false, error: (e && e.message) || String(e) }));
@@ -81,6 +83,15 @@ function ModelsView() {
81
83
  const [vpDirty, setVpDirty] = react.useState(false);
82
84
  const [vpSaving, setVpSaving] = react.useState(false);
83
85
  const [vpMsg, setVpMsg] = react.useState(null);
86
+ const [vpDirectExpanded, setVpDirectExpanded] = react.useState(false);
87
+
88
+ // 每次进入模型设置都重新读取官方目录。modelsStore 是跨页面共享快照,
89
+ // 原生设置刚新增 Provider 时不能要求用户再滚到页面底部手动刷新。
90
+ react.useEffect(() => { modelsStore.load(); }, []);
91
+ const refreshModels = () => {
92
+ setBuiltKey(null);
93
+ modelsStore.load();
94
+ };
84
95
 
85
96
  const cur = providers.length > 0 ? (providers.find((p) => p.id === selId) || providers[0]) : null;
86
97
  // 选中 Provider 或目录刷新时重建草稿(render 期受控重置;msg 只在切 Provider/编辑时清)
@@ -199,7 +210,7 @@ function ModelsView() {
199
210
  DKM_MODALITIES.map(([v, label]) => react.createElement("label", {
200
211
  key: v,
201
212
  className: "dkm-check",
202
- title: v === "image" ? "勾选=端点原生支持图片(原图直发,图片理解代理跳过);纯文本模型勿勾——收图会自动交给图片理解代理识别" : null
213
+ title: v === "image" ? "由你声明该端点支持图片:保存后原图直发,并可作为视觉模型候选。系统不会替你猜测;端点实际不支持时取消勾选即可恢复走图片理解代理" : null
203
214
  },
204
215
  react.createElement("input", {
205
216
  type: "checkbox",
@@ -251,6 +262,11 @@ function ModelsView() {
251
262
  react.createElement("button", { type: "button", className: "dkm-mini", title: "一键取消全部强度档", onClick: () => patchModel(i, allLevels(false)) }, "取消全选"))));
252
263
 
253
264
  const body = [];
265
+ if (data) {
266
+ body.push(react.createElement("div", { key: "refresh", className: "dkm-topbar" },
267
+ react.createElement("span", { className: "dkm-sub" }, "已载入 " + providers.length + " 个 Provider;在 DSH 原生模型设置中新增后,返回本页会自动更新"),
268
+ react.createElement("button", { type: "button", className: "dkb-refresh", disabled: snap.loading || saving, onClick: refreshModels }, snap.loading ? "刷新中…" : "刷新模型目录")));
269
+ }
254
270
  if (snap.error) {
255
271
  body.push(react.createElement("div", { key: "err", className: "dkm-error" },
256
272
  "模型目录拉取失败:" + snap.error + " ",
@@ -266,14 +282,26 @@ function ModelsView() {
266
282
  "图片理解代理需要新版宿主进程:当前 dsh web 较旧,重启后此面板可用。"));
267
283
  }
268
284
  if (data && data.visionProxy !== undefined && vpDraft) {
269
- // 图片能力以运行时视角(runtimeInput,与官方投影同源)为准,无则回退条目 input
270
- const effInput = (m) => (m.runtimeInput && m.runtimeInput.length > 0 ? m.runtimeInput : m.input) || [];
285
+ // 用户在模型设置里勾选「图片」即可决定原图直发和视觉候选;
286
+ // 运行时目录仅作自动提示,不能排除用户明确声明的模型。
287
+ // 无论哪种来源都不等同于联网实测,凭据、额度和上游状态仍以真实调用为准。
288
+ const runtimeImage = (m) => Array.isArray(m.runtimeInput) && m.runtimeInput.indexOf("image") >= 0;
289
+ const declaredImage = (m) => Array.isArray(m.input) && m.input.indexOf("image") >= 0;
271
290
  const vpDirect = [];
272
291
  const vpProxied = [];
273
292
  for (const p of providers) {
274
293
  for (const m of (p.models || [])) {
275
- const item = { key: p.id + "/" + m.id, label: (p.displayName || p.id) + " / " + (m.name || m.id), model: m.name || m.id };
276
- (effInput(m).indexOf("image") >= 0 ? vpDirect : vpProxied).push(item);
294
+ const declared = declaredImage(m);
295
+ const runtime = runtimeImage(m);
296
+ const source = declared ? "你已标记图片" : (runtime ? "运行时识别" : "未标记图片");
297
+ const item = {
298
+ key: p.id + "/" + m.id,
299
+ label: (p.displayName || p.id) + " / " + (m.name || m.id) + "(" + source + ")",
300
+ model: m.name || m.id,
301
+ source: source,
302
+ declared: declared,
303
+ };
304
+ ((declared || runtime) ? vpDirect : vpProxied).push(item);
277
305
  }
278
306
  }
279
307
  const vpCandidates = vpDirect.slice();
@@ -309,18 +337,28 @@ function ModelsView() {
309
337
  !vpKnown && vpDraft.provider ? react.createElement("option", { value: vpKey }, vpDraft.provider + " / " + vpDraft.model + "(当前)") : null,
310
338
  vpCandidates.map((c) => react.createElement("option", { key: c.key, value: c.key }, c.label))),
311
339
  vpCandidates.length === 0
312
- ? react.createElement("span", { className: "dkm-sub" }, "目录里暂无多模态模型——先在下方给真·多模态模型勾选「图片」输入类型")
340
+ ? react.createElement("span", { className: "dkm-sub" }, "还没有标记图片能力的模型——在下方给你确认支持图片的模型勾选「图片」并保存")
313
341
  : null),
314
342
  react.createElement("div", { className: "dkm-sub" },
315
- "判定与官方运行时同源:「图片」勾选(或目录默认)= 端点原生支持、原图直发;其余模型收图自动走视觉模型。注意:若端点实际不认图却勾了「图片」,模型会看不见图片、转而用工具瞎折腾——不确定就不要勾,交给代理。"),
343
+ "以你在下方勾选的「图片」为准;运行时识别只是辅助提示。它不代表已联网实测可调用,实际可用性仍取决于 Provider 凭据、额度与上游服务。若端点实际不认图,取消该模型的「图片」勾选即可恢复走图片理解代理。"),
316
344
  vpDirect.length > 0
317
- ? react.createElement("div", { className: "dkm-checks" },
318
- react.createElement("span", { className: "dkm-label" }, "原图直发(多模态," + vpDirect.length + "):"),
319
- vpDirect.map((c) => react.createElement("span", { key: c.key, className: "dkm-chip", title: c.key }, c.model)))
345
+ ? react.createElement("div", { className: "dkm-capabilities" },
346
+ react.createElement("div", { className: "dkm-checks" },
347
+ react.createElement("span", { className: "dkm-label" }, "原图直发候选(你的标记优先," + vpDirect.length + "):"),
348
+ react.createElement("button", {
349
+ type: "button",
350
+ className: "dkm-mini",
351
+ "aria-expanded": vpDirectExpanded,
352
+ onClick: () => setVpDirectExpanded(!vpDirectExpanded)
353
+ }, vpDirectExpanded ? "收起列表" : "展开列表")),
354
+ vpDirectExpanded
355
+ ? react.createElement("div", { className: "dkm-checks dkm-capability-list" },
356
+ vpDirect.map((c) => react.createElement("span", { key: c.key, className: "dkm-chip", title: c.key + " · " + c.source }, c.model)))
357
+ : null)
320
358
  : null,
321
359
  vpProxied.length > 0
322
360
  ? react.createElement("div", { className: "dkm-checks" },
323
- react.createElement("span", { className: "dkm-label" }, "走视觉代理(纯文本," + vpProxied.length + "):"),
361
+ react.createElement("span", { className: "dkm-label" }, "走视觉代理(未标记图片," + vpProxied.length + "):"),
324
362
  react.createElement("span", { className: "dkm-sub" }, vpProxied.map((c) => c.model).join("、")))
325
363
  : null,
326
364
  react.createElement("div", { className: "dkm-savebar" },
@@ -379,7 +417,7 @@ function ModelsView() {
379
417
  react.createElement("div", { className: "dkm-savebar" },
380
418
  react.createElement("span", { className: "dkm-msg" }, dirty ? "有未保存的修改" : "无未保存修改"),
381
419
  react.createElement("button", { type: "button", className: "dkm-save", disabled: !dirty || saving, onClick: save }, saving ? "保存中…" : "保存写回官方配置"),
382
- react.createElement("button", { type: "button", className: "dkb-refresh", disabled: saving, onClick: () => { setBuiltKey(null); modelsStore.load(); } }, "重新拉取"),
420
+ react.createElement("button", { type: "button", className: "dkb-refresh", disabled: saving || snap.loading, onClick: refreshModels }, snap.loading ? "刷新中…" : "重新拉取"),
383
421
  msg ? react.createElement("span", { className: "dkm-msg " + (msg.ok ? "ok" : "err") }, msg.text) : null)));
384
422
  }
385
423
  return react.createElement("div", { className: "dkm-list" }, body);
@@ -438,6 +476,9 @@ export const feature = {
438
476
  ".dkm-msg.ok{color:var(--dsw-alias-state-success-primary);}",
439
477
  ".dkm-msg.err{color:var(--dsw-alias-state-error-primary);}",
440
478
  ".dkm-list{display:flex;flex-direction:column;gap:8px;}",
479
+ ".dkm-topbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;}",
480
+ ".dkm-capabilities{display:flex;flex-direction:column;gap:6px;}",
481
+ ".dkm-capability-list{max-height:168px;overflow:auto;padding:2px 0 2px 2px;}",
441
482
  ".dkm-ro{color:var(--dsw-alias-label-secondary);font-size:12px;}",
442
483
  ".dkm-mini{cursor:pointer;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:999px;padding:1px 8px;font-family:inherit;font-size:11px;flex:none;}",
443
484
  ".dkm-mini:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-secondary);}",
@@ -1,27 +1,52 @@
1
1
  // dsh-dock · 功能模块【主题信息】· 客户端视图(纯 Client 功能,无宿主半部)
2
2
  import react from "react";
3
+ import { useEffect, useState } from "react";
3
4
 
4
- function readThemeLabel(ctx) {
5
+ // dsh 客户端主题服务(@deepseek-ai/dsh-client-ui-theme 的 ctx.provide("theme", ...))快照结构:
6
+ // { preference: 'light'|'dark'|'system', active: { id, colorScheme, tokens }, themes, revision }
7
+ // preference 是用户偏好;active.id 是解析后的实际生效主题(preference 为 system 时落到 light/dark)。
8
+ // 注意:快照顶层没有 id/name 字段——直接读 snap.id 只会得到 undefined(曾导致本页显示"未知")。
9
+ const PREFERENCE_LABELS = { light: "亮色", dark: "暗色", system: "跟随系统" };
10
+ const THEME_LABELS = { light: "亮色", dark: "暗色" };
11
+
12
+ function readThemeInfo(ctx) {
5
13
  const theme = ctx && ctx.get ? ctx.get("theme") : undefined;
6
- if (theme === undefined) return { err: "theme 服务不可用" };
14
+ if (!theme || typeof theme.getTheme !== "function") return { err: "theme 服务不可用" };
7
15
  let snap = null;
8
- try { snap = theme.getTheme(); }
9
- catch (err) { return { err: "读取失败:" + String((err && err.message) || err) }; }
10
- const label = snap && typeof snap.id === "string" ? snap.id
11
- : snap && typeof snap.name === "string" ? snap.name : "未知";
16
+ try { snap = theme.getTheme(); } catch (err) { return { err: "读取失败:" + String((err && err.message) || err) }; }
17
+ const preference = snap && typeof snap.preference === "string" ? snap.preference : "";
18
+ const activeId = snap && snap.active && typeof snap.active.id === "string" ? snap.active.id : "";
19
+ // 偏好 → 中文;system 且实际主题与偏好不同名时补注实际生效值(跟随系统 = 亮色/暗色)
20
+ const label = (PREFERENCE_LABELS[preference] || preference || "未知")
21
+ + (activeId && activeId !== preference && THEME_LABELS[activeId] ? "(实际" + THEME_LABELS[activeId] + ")" : "");
12
22
  return { label };
13
23
  }
14
24
 
25
+ function useThemeInfo(ctx) {
26
+ const [info, setInfo] = useState(() => readThemeInfo(ctx));
27
+ useEffect(() => {
28
+ // 设置页「外观」行切换主题时实时刷新(快照 revision 递增,theme/change 事件广播)
29
+ let off = null;
30
+ try {
31
+ if (ctx && typeof ctx.on === "function") {
32
+ off = ctx.on("theme/change", () => setInfo(readThemeInfo(ctx)));
33
+ }
34
+ } catch { /* 无订阅能力时降级为静态显示 */ }
35
+ return () => { try { if (typeof off === "function") off(); } catch { /* 清理失败静默 */ } };
36
+ }, [ctx]);
37
+ return info;
38
+ }
39
+
15
40
  function ThemeView(props) {
16
- const r = readThemeLabel(props && props.ctx);
41
+ const r = useThemeInfo(props && props.ctx);
17
42
  if (r.err) return react.createElement("div", null, r.err);
18
43
  return react.createElement("div", null, "当前主题:" + r.label);
19
44
  }
20
45
 
21
46
  function ThemeStat(props) {
22
- const r = readThemeLabel(props && props.ctx);
47
+ const r = useThemeInfo(props && props.ctx);
23
48
  if (r.err) return react.createElement("span", null, r.err);
24
- return react.createElement("span", null, "当前主题:" + r.label);
49
+ return react.createElement("span", null, "主题:" + r.label);
25
50
  }
26
51
 
27
52
  export const feature = {
@@ -29,7 +54,7 @@ export const feature = {
29
54
  name: "主题信息",
30
55
  order: 150,
31
56
  accent: "#a78bfa",
32
- description: "示例功能:读取当前主题快照(纯 Client)",
57
+ description: "读取当前主题快照:偏好与实际生效主题(纯 Client,主题切换实时刷新)",
33
58
  View: ThemeView,
34
59
  HomeStat: ThemeStat,
35
60
  };
@@ -540,9 +540,11 @@ export function TokenLogChip(props) {
540
540
  }, [sid]);
541
541
  if (!sid) return null;
542
542
  const t = snap.totals;
543
+ // chip 文案用紧凑金额(2 位小数):fmtCost 对小金额输出 6 位小数,chip 里太长会撑爆输入卡工具行;
544
+ // 完整金额在 title 悬浮提示里。
543
545
  const label = snap.err && !t
544
546
  ? (snap.err.includes("重启") ? "用量·需重启宿主" : "用量·失败")
545
- : (t ? "⛁ " + fmtCompact(t.totalTokens) + (t.cost > 0 ? " · " + fmtCost(t.cost) : "") : "⛁ …");
547
+ : (t ? "⛁ " + fmtCompact(t.totalTokens) + (t.cost > 0 ? " · $" + t.cost.toFixed(2) : "") : "⛁ …");
546
548
  const title = t
547
549
  ? "本会话 " + fmtNum(t.calls) + " 次调用 · " + fmtNum(t.totalTokens) + " Token · " + fmtCost(t.cost) + "(估算)\n点击在功能坞查看用量记录"
548
550
  : (snap.err ? snap.err + "\n" : "") + "点击在功能坞查看用量记录";
@@ -20,6 +20,17 @@ function contentHasImageDeep(content) {
20
20
  return false
21
21
  }
22
22
 
23
+ /**
24
+ * 用户在 dsh-dock 模型设置里勾选「图片」后的声明。
25
+ * 这不是联网探测结果,而是明确让用户决定端点能力:声明后原图直发,
26
+ * 未声明时才继续参考运行时目录或走图片理解代理。
27
+ */
28
+ function hasUserDeclaredImage(directory, provider, model) {
29
+ const p = (directory.providers || []).find((x) => x && x.id === provider)
30
+ const m = p && Array.isArray(p.models) ? p.models.find((x) => x && x.id === model) : undefined
31
+ return !!(m && Array.isArray(m.input) && m.input.includes('image'))
32
+ }
33
+
23
34
  /** 让视觉模型描述一张图片,返回识别文本(失败抛错)。 */
24
35
  async function describeImage(deps, cfg, block, signal) {
25
36
  const prompt = '请用中文详细描述这张图片的内容:主体、文字(若有则逐字转写)、数据/图表要点、与编码任务相关的细节。控制在 300 字以内,直接输出描述,不要客套。'
@@ -127,10 +138,19 @@ async function transformForVisionProxy(deps, options) {
127
138
  if (!options.messages.some((m) => m && contentHasImageDeep(m.content))) return options
128
139
  log(`带图请求 ${options.provider}/${options.model}`)
129
140
 
130
- // 目标模型是否支持图片:优先问运行时(llm.resolveModelInfo,与官方投影同源:
131
- // entry.input → 内置目录 → 路由默认),避免插件目录误判"靠内置目录继承多模态"的
132
- // 模型(如 kimi-k2.7,条目未写 input 但目录里是 [text,image]);
133
- // 旧宿主无此方法或单次解析失败时,退回插件目录视图兜底。
141
+ // 图片能力判定的优先级:用户在模型设置里勾选「图片」优先。
142
+ // 运行时目录只是自动提示,无法识别或识别错误时不能覆盖用户的明确决定。
143
+ // 这让 kimi-k2.7-code 等端点可由用户声明多模态并原图直发;若端点实际不支持,
144
+ // 上游会返回错误,用户取消勾选即可恢复走图片理解代理。
145
+ const directory = deps.directory()
146
+ if (hasUserDeclaredImage(directory, options.provider, options.model)) {
147
+ log(`跳过 ${options.provider}/${options.model}:用户已声明图片能力(原图直发)`)
148
+ return options
149
+ }
150
+
151
+ // 未声明时再问运行时(llm.resolveModelInfo,与官方投影同源:
152
+ // entry.input → 内置目录 → 路由默认);旧宿主无此方法或单次解析失败时,
153
+ // 保守走图片理解代理,避免猜错端点能力。
134
154
  let imageCapable
135
155
  try {
136
156
  const info = deps.resolveModelInfo ? await deps.resolveModelInfo(options.provider, options.model) : undefined
@@ -138,12 +158,6 @@ async function transformForVisionProxy(deps, options) {
138
158
  } catch {
139
159
  // 落到目录回退
140
160
  }
141
- if (imageCapable === undefined) {
142
- const dir = deps.directory()
143
- const p = (dir.providers || []).find((x) => x.id === options.provider)
144
- const m = p && Array.isArray(p.models) ? p.models.find((x) => x.id === options.model) : undefined
145
- imageCapable = !!(m && Array.isArray(m.input) && m.input.includes('image'))
146
- }
147
161
  if (imageCapable) {
148
162
  log(`跳过 ${options.provider}/${options.model}:运行时判定多模态(原图直发)`)
149
163
  return options
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-dock",
3
- "version": "0.5.0",
4
- "description": "DeepSeek Harness 功能坞插件(dsh-dock):模块化功能中枢——每个功能一个 features/ 模块(可单独提取成包发布,又可经 dockBridge 装回面板)。含用量记录(LLM 调用记账/费用统计)、模型设置、图片理解代理、模型余额、任务动画(8 种氛围动效 + 桌面伙伴 3D 场景、完成通知与提示音、钉钉推送,开关独立、配置持久化);侧栏入口 + 可拖拽弹窗(最大化/最小化/缩放)。",
3
+ "version": "0.6.0",
4
+ "description": "DeepSeek Harness 功能坞插件(dsh-dock):模块化功能中枢——每个功能一个 features/ 模块(可单独提取成包发布,又可经 dockBridge 装回面板)。含用量记录(LLM 调用记账/费用统计)、模型设置、图片理解代理、模型余额、任务动画(8 种氛围动效 + 桌面伙伴 3D 场景、完成通知与提示音、钉钉/飞书推送,开关独立、配置持久化);侧栏入口 + 可拖拽弹窗(最大化/最小化/缩放)。",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "files": [
package/src/client.jsx CHANGED
@@ -107,9 +107,13 @@ const SHELL_CSS = [
107
107
  ".dock-badge{flex:none;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;font-size:12px;}",
108
108
  ".dock-body{border-top:1px solid var(--dsw-alias-border-l1);padding-top:8px;color:var(--dsw-alias-label-secondary);display:flex;flex-direction:column;gap:4px;}",
109
109
  // 侧栏入口按钮(docke2- 前缀)+ 功能坞弹出面板(dockm- 前缀,仿 dsh 设置的居中模态:遮罩 + 对话框,左导航 + 右内容)
110
- ".docke2-btn{box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;border:none;background:transparent;color:var(--dsw-alias-label-secondary);border-radius:10px;height:32px;font-family:inherit;font-size:13px;line-height:32px;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
111
- ".docke2-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
110
+ // 侧栏入口按钮(docke2- 前缀):与 dsh 设置按钮(.VOzbGW_trigger)几何逐条对齐——
111
+ // 宽栏同为整宽左对齐行按钮(高 42、margin 4/-2、padding 0 10px 0 8px、圆角 12),窄栏同为 36 圆钮居中,
112
+ // 使两按钮上下成列、左右边缘完全对齐(此前右对齐/叠放都会错位)。
113
+ ".docke2-btn{box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;border:none;background:transparent;color:var(--dsw-alias-label-primary);border-radius:12px;width:calc(100% + 4px);height:42px;margin:4px -2px;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
114
+ ".docke2-btn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
112
115
  ".docke2-btn.docke2-on{color:var(--dsw-alias-accent,#4d9fff);background:var(--dsw-alias-accent-soft,color-mix(in srgb,var(--dsw-alias-accent,#4d9fff) 12%,transparent));}",
116
+ ".docke2-btn.docke2-rail{width:36px;height:36px;margin:8px 0 10px;padding:0;border-radius:50%;justify-content:center;gap:0;}",
113
117
  ".docke2-label{white-space:nowrap;overflow:hidden;}",
114
118
  ".dockm-backdrop{position:fixed;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 55%,transparent);backdrop-filter:blur(4px);pointer-events:auto;animation:dockm-fade .15s var(--ds-ease-in-out);}",
115
119
  "@keyframes dockm-fade{from{opacity:0}to{opacity:1}}",
@@ -174,8 +178,15 @@ const SHELL_CSS = [
174
178
  ".dockh-foot{display:flex;align-items:center;gap:8px;}",
175
179
  ".dockh-go{color:var(--dsw-alias-label-tertiary);font-size:11px;}",
176
180
  // 会话输入区工具行 chips(dockchip- 前缀):余额/用量随身小控件,挂在模型选择器左侧
177
- ".dockchip-row{display:inline-flex;align-items:center;gap:4px;min-width:0;}",
178
- ".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 8px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
181
+ // 溢出兼容(两层防护,缺一不可):
182
+ // 1) 宽度上限:宿主 .row 是 flex-wrap:wrap 且换行优先于收缩,chips 一长 tools 整行变宽,
183
+ // 右侧模型选择器/发送键被挤到第二行(左右错位)。宿主 .row 带 container-type:inline-size,
184
+ // 用容器单位 cqw 让上限随输入卡宽度自适应(窄卡少占、宽卡多占);不支持 cqw 的老内核退回固定 280px。
185
+ // 2) 截断:超限部分用省略号截断(完整数值在 title 悬浮提示里),防 chips 凸出输入卡圆角(悬空)。
186
+ ".dockchip-row{display:inline-flex;align-items:center;gap:4px;min-width:0;flex:0 1 auto;overflow:hidden;max-width:280px;}",
187
+ "@supports (width:1cqw){.dockchip-row{max-width:min(280px,36cqw);}}",
188
+ ".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 8px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;min-width:0;overflow:hidden;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
189
+ ".dockchip > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}",
179
190
  ".dockchip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
180
191
  ".dockchip .dockchip-dot{width:6px;height:6px;border-radius:50%;flex:none;}",
181
192
  ".dockchip.err{color:var(--dsw-alias-state-error-primary);}"
@@ -221,8 +232,9 @@ function useExternalVersion() {
221
232
  // ---- 弹层窗口几何记忆(页面生命周期内):拖动/缩放后记住位置与尺寸,重开还原 ----
222
233
  let lastGeom = { x: null, y: null, w: null, h: null };
223
234
 
224
- function DockIcon() {
225
- return react.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
235
+ function DockIcon(props) {
236
+ const size = (props && props.size) || 16;
237
+ return react.createElement("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
226
238
  react.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
227
239
  react.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
228
240
  react.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
@@ -235,18 +247,12 @@ function DockEntry(props) {
235
247
  react.useEffect(() => subscribePanel(() => setOpen(panelNav.open)), []);
236
248
  return react.createElement("button", {
237
249
  type: "button",
238
- className: "docke2-btn" + (open ? " docke2-on" : ""),
239
- style: wide
240
- // 与设置按钮精确同框:设置 trigger 宽栏 = 42px 高、margin-top 4 → 下移 46px、高度同为 42,
241
- // 使本按钮的四条边与设置按钮完全重合(同一水平线);rail = 36px、margin-top 8 → 下移 44px、高 36 亦然。
242
- // zIndex 保证盖在满宽设置按钮之上(其右侧为空白区,不遮齿轮图标)
243
- ? { marginLeft: "auto", transform: "translateY(46px)", zIndex: 1, height: 42, lineHeight: "42px", padding: "0 12px" }
244
- : { transform: "translateY(44px)", zIndex: 1, width: 36, height: 36, justifyContent: "center", padding: 0 },
250
+ className: "docke2-btn" + (open ? " docke2-on" : "") + (wide ? "" : " docke2-rail"),
245
251
  title: "功能坞",
246
252
  "aria-label": "功能坞",
247
253
  "aria-expanded": open,
248
254
  onClick: () => setPanelOpen(!open)
249
- }, react.createElement(DockIcon, null), wide ? react.createElement("span", { className: "docke2-label" }, "功能坞") : null);
255
+ }, react.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? react.createElement("span", { className: "docke2-label" }, "功能坞") : null);
250
256
  }
251
257
 
252
258
  // ---- 功能坞弹出面板:shell.overlay(仿 dsh 设置:居中模态 = 遮罩 + 对话框) ----
package/src/host-core.js CHANGED
@@ -32,6 +32,9 @@ export const DockConfig = z.object({
32
32
  // 钉钉群机器人推送(宿主侧直发,浏览器关着也能推;事件跟随 notifyOnComplete/notifyOnError)
33
33
  dingtalkEnabled: z.boolean().default(false),
34
34
  dingtalkWebhook: z.string().default(''),
35
+ // 飞书群机器人推送(宿主侧直发,浏览器关着也能推;事件跟随 notifyOnComplete/notifyOnError)
36
+ feishuEnabled: z.boolean().default(false),
37
+ feishuWebhook: z.string().default(''),
35
38
  }).default({}),
36
39
  })
37
40