dsh-dock 0.25.0 → 0.25.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/client.js CHANGED
@@ -2132,6 +2132,7 @@ __export(client_exports, {
2132
2132
  dockBridge: () => dockBridge,
2133
2133
  dragToPercent: () => dragToPercent,
2134
2134
  fmtDateTime: () => fmtDateTime,
2135
+ gitPanelEnabled: () => gitPanelEnabled,
2135
2136
  inject: () => inject,
2136
2137
  readSessionDir: () => currentSessionDir,
2137
2138
  splitterStep: () => splitterStep,
@@ -17348,8 +17349,19 @@ function openGit(ctx, target) {
17348
17349
  function installClient2(ctx) {
17349
17350
  if (!ctx || typeof ctx !== "object") return;
17350
17351
  dockCtx = ctx;
17352
+ const syncers = [];
17353
+ function syncAll() {
17354
+ for (const fn of syncers) {
17355
+ try {
17356
+ fn();
17357
+ } catch {
17358
+ }
17359
+ }
17360
+ }
17351
17361
  try {
17352
- ensureLoaded();
17362
+ const pending = ensureLoaded();
17363
+ if (pending && typeof pending.then === "function") pending.then(syncAll, syncAll);
17364
+ else syncAll();
17353
17365
  } catch {
17354
17366
  }
17355
17367
  onServices2(ctx, ["sidebarRightTabs", "slots"], (scope) => {
@@ -17357,7 +17369,7 @@ function installClient2(ctx) {
17357
17369
  const slots = serviceOf2(scope, "slots");
17358
17370
  if (!tabs || typeof tabs.register !== "function") return;
17359
17371
  if (!slots || typeof slots.inject !== "function" || typeof slots.register !== "function") return;
17360
- const register = () => {
17372
+ const mount = () => {
17361
17373
  const disposers = [];
17362
17374
  disposers.push(tabs.register({
17363
17375
  id: GIT_TAB_ID,
@@ -17391,8 +17403,44 @@ function installClient2(ctx) {
17391
17403
  }
17392
17404
  };
17393
17405
  };
17394
- if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: Git \u62BD\u5C49\u9875\u7B7E");
17395
- else register();
17406
+ let unmount = null;
17407
+ const sync = () => {
17408
+ const want = gitPanelEnabled();
17409
+ if (want && !unmount) {
17410
+ unmount = mount();
17411
+ } else if (!want && unmount) {
17412
+ try {
17413
+ unmount();
17414
+ } catch {
17415
+ }
17416
+ unmount = null;
17417
+ }
17418
+ };
17419
+ syncers.push(sync);
17420
+ const start = () => {
17421
+ sync();
17422
+ return subscribe(sync);
17423
+ };
17424
+ if (typeof scope.effect === "function") {
17425
+ scope.effect(() => {
17426
+ const stop = start();
17427
+ return () => {
17428
+ try {
17429
+ stop();
17430
+ } catch {
17431
+ }
17432
+ if (unmount) {
17433
+ try {
17434
+ unmount();
17435
+ } catch {
17436
+ }
17437
+ unmount = null;
17438
+ }
17439
+ };
17440
+ }, "dsh-dock: Git \u62BD\u5C49\u9875\u7B7E");
17441
+ } else {
17442
+ start();
17443
+ }
17396
17444
  });
17397
17445
  onServices2(ctx, ["slots"], (scope) => {
17398
17446
  const slots = serviceOf2(scope, "slots");
@@ -17480,7 +17528,7 @@ function GitHistoryIcon() {
17480
17528
  }
17481
17529
 
17482
17530
  // src/client.jsx
17483
- var DOCK_VERSION = "0.25.0";
17531
+ var DOCK_VERSION = "0.25.1";
17484
17532
  var BUILTIN_FEATURES = [feature, feature2, feature3, feature11, feature4, feature5, feature6, feature7, feature8, feature9, feature10, feature12];
17485
17533
  var PLANNED_FEATURES = [];
17486
17534
  var PLANNED_NOTES = {};
@@ -50,7 +50,8 @@ export const DSH_TOOL_GROUPS = [
50
50
  key: 'gitPanel',
51
51
  name: 'Git仓库操作',
52
52
  description: '打开后:右侧抽屉里多一个「Git仓库操作」页签(默认当前会话目录的仓库,可看提交历史与工作区、提交与推送);「工作区文件」的目录与文件右键多一条「查看 Git 历史」。不需要系统目录选择弹窗,服务器部署同样可用。',
53
- default: false,
53
+ // 用户要求:装好即可用,默认勾选;不想要的人可以主动取消。
54
+ default: true,
54
55
  },
55
56
  ],
56
57
  },
@@ -1801,8 +1801,19 @@ export function installClient(ctx) {
1801
1801
  if (!ctx || typeof ctx !== "object") return;
1802
1802
  // 页签正文拿不到 ctx,装配时存一份给 GitTabBody 用
1803
1803
  dockCtx = ctx;
1804
- // 先把 DSH功能 的配置拉一次:开关值决定入口出不出现
1805
- try { ensureDshtoolsLoaded(); } catch { /* 旧宿主/桩:按关闭处理 */ }
1804
+ // 先把 DSH功能 的配置拉一次:开关值决定入口出不出现。
1805
+ // 这是**异步**的:同步读到的还是空 store,直接判断会把开关当成关着,
1806
+ // 页签永远不注册。所以加载落定后要统一重跑一次 sync。
1807
+ /** 各挂载点的 sync 函数,加载完成后统一重跑。 */
1808
+ const syncers = [];
1809
+ function syncAll() {
1810
+ for (const fn of syncers) { try { fn(); } catch { /* 单个失败不影响其它 */ } }
1811
+ }
1812
+ try {
1813
+ const pending = ensureDshtoolsLoaded();
1814
+ if (pending && typeof pending.then === "function") pending.then(syncAll, syncAll);
1815
+ else syncAll();
1816
+ } catch { /* 旧宿主/桩:按关闭处理 */ }
1806
1817
 
1807
1818
  // ---- 1. 抽屉页签:类型 + 正文 + 标题 ----
1808
1819
  onServices(ctx, ["sidebarRightTabs", "slots"], (scope) => {
@@ -1810,7 +1821,13 @@ export function installClient(ctx) {
1810
1821
  const slots = serviceOf(scope, "slots");
1811
1822
  if (!tabs || typeof tabs.register !== "function") return;
1812
1823
  if (!slots || typeof slots.inject !== "function" || typeof slots.register !== "function") return;
1813
- const register = () => {
1824
+ /**
1825
+ * 注册抽屉页签与引导卡片。
1826
+ *
1827
+ * 开关关着时必须**什么都不注册**:用户明确要求「没勾选就啥都不显示」,
1828
+ * 引导卡片是总入口,之前这里无条件注册,导致刚装好、还没勾选就能在入口列表里看到它。
1829
+ */
1830
+ const mount = () => {
1814
1831
  const disposers = [];
1815
1832
  disposers.push(tabs.register({
1816
1833
  id: GIT_TAB_ID,
@@ -1841,8 +1858,39 @@ export function installClient(ctx) {
1841
1858
  }
1842
1859
  };
1843
1860
  };
1844
- if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: Git 抽屉页签");
1845
- else register();
1861
+ /**
1862
+ * 按当前开关状态挂载或卸载。
1863
+ *
1864
+ * 关掉时不仅要注销注册,还要把已经打开的页签关掉——否则用户取消勾选后,
1865
+ * 抽屉里那个页签还在,只是点进去报错。
1866
+ */
1867
+ let unmount = null;
1868
+ const sync = () => {
1869
+ const want = gitPanelEnabled();
1870
+ if (want && !unmount) {
1871
+ unmount = mount();
1872
+ } else if (!want && unmount) {
1873
+ try { unmount(); } catch { /* 已卸载 */ }
1874
+ unmount = null;
1875
+ }
1876
+ };
1877
+ syncers.push(sync);
1878
+ const start = () => {
1879
+ sync();
1880
+ // 开关变化时重新对齐:勾上就出现,取消就消失
1881
+ return subscribeDshtools(sync);
1882
+ };
1883
+ if (typeof scope.effect === "function") {
1884
+ scope.effect(() => {
1885
+ const stop = start();
1886
+ return () => {
1887
+ try { stop(); } catch { /* 已卸载 */ }
1888
+ if (unmount) { try { unmount(); } catch { /* 已卸载 */ } unmount = null; }
1889
+ };
1890
+ }, "dsh-dock: Git 抽屉页签");
1891
+ } else {
1892
+ start();
1893
+ }
1846
1894
  });
1847
1895
 
1848
1896
  // ---- 2. 右键菜单图标:菜单项的 icon.key 只是索引,必须注册到 contextMenu.icon 插槽才有图标 ----
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dock",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "DeepSeek Harness 功能坞插件(dsh-dock):模块化功能中枢——每个功能一个 features/ 模块(可单独提取成包发布,又可经 dockBridge 装回面板)。含用量记录(LLM 调用记账/费用统计,支持各模型自定义单价、多段分时价与周末/节假日谷价)、模型能力、图片理解代理、模型余额、任务动画(19 种运行动画 + 桌面伙伴 3D 场景)、任务通知(完成/异常/需确认通知、提示音、语音播报可选音色、系统通知、钉钉/飞书推送)、运行状态(进行中任务与最近完成一览)、语音朗读(浏览器 TTS 读回复:回合下方喇叭按钮 + 自动朗读)、DSH功能(给 DSH 自带界面补能力:文件右键大文件流式下载、右侧抽屉 Git 仓库操作面板)、Git 管理(提交历史表格与逐行差异、子仓库多选、时间段与提交人筛选、暂存/提交/推送);侧栏入口 + 可拖拽弹窗(最大化/最小化/缩放)。",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/client.jsx CHANGED
@@ -33,7 +33,7 @@ import { feature as fDshTools, installClient as installDshTools } from "../featu
33
33
  import { installClient as installGit, css as GIT_CSS, DirBrowser as GitDirBrowser, GitView as GitPanelView } from "../features/git/view.jsx";
34
34
 
35
35
  const name = "dsh-dock";
36
- const DOCK_VERSION = "0.25.0";
36
+ const DOCK_VERSION = "0.25.1";
37
37
 
38
38
  // ---- 内置功能注册表:新功能 = features/<id>/ 加模块 + 这里 import 一行 ----
39
39
  const BUILTIN_FEATURES = [fTokenlog, fModelconfig, fProviderConfig, fMcpConfig, fBalance, fAnimation, fNotify, fRunState, fTts, fGames, fMobileRelay, fDshTools];
@@ -311,7 +311,7 @@ function scheduleInitialCss() {
311
311
  if (typeof document === "undefined" || initialCssSchedule || (dockCssTag && dockCssTag.isConnected && dockCssTag.dataset.plugin === "dsh-dock")) return;
312
312
  const run = () => {
313
313
  initialCssSchedule = null;
314
- ensureCss();
314
+ ensureCss();
315
315
  };
316
316
  if (typeof window !== "undefined" && typeof window.requestIdleCallback === "function") {
317
317
  initialCssSchedule = { type: "idle", id: window.requestIdleCallback(run, { timeout: 350 }) };
@@ -798,6 +798,8 @@ export const inject = ["timer"];
798
798
  export { dockBridge };
799
799
  // 测试探针:目录浏览器单独导出,便于用例直接渲染校验(不参与运行逻辑)
800
800
  export { GitDirBrowser as DirBrowser };
801
+ // 测试探针:Git 面板开关(验证「没勾选就不注册入口」)
802
+ export { gitPanelEnabled } from "../features/git/view.jsx";
801
803
  export { GitPanelView as GitView };
802
804
  // 测试探针:会话目录读取函数(验证按 sessionId 取值,而非全局当前会话)
803
805
  export { currentSessionDir as readSessionDir } from "../features/git/rpc.js";
package/src/host-core.js CHANGED
@@ -193,6 +193,19 @@ export const DockConfig = z.object({
193
193
  /** 大文件下载(流式):文件超过 32 MiB 时右键多出「下载(大文件)」。 */
194
194
  streamingDownload: z.boolean().default(true),
195
195
  }).default({}),
196
+ /**
197
+ * 界面增强:给 DSH 自带界面补的入口。
198
+ *
199
+ * 这里必须与 features/dshtools/host.js 的 DSH_TOOL_GROUPS 逐项对齐——
200
+ * 写入时是整段回写(next 会带上所有分组),schema 里没声明的分组会让
201
+ * settings.describe 算不出该条目的表单,取消勾选时报
202
+ * 「Plugin entry "dsh-dock" is no longer configurable」。
203
+ */
204
+ interface: z.object({
205
+ /** Git 仓库操作:右侧抽屉页签 + 工作区文件右键「查看 Git 历史」。 */
206
+ // 默认开启:装好即可用;不想要的人在功能坞里取消勾选。
207
+ gitPanel: z.boolean().default(true),
208
+ }).default({}),
196
209
  }).default({}).volatile(),
197
210
  })
198
211