dsh-cabinet-mode 0.5.3 → 0.5.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.5.4] - 2026-11-07
6
+
7
+ ### Fixed
8
+
9
+ - Draw task dependencies from the blocker to the blocked task; keep the endpoint
10
+ dot on the blocked task and animate active edges in that direction.
11
+ - Open teammate sessions from task titles and member cards through the optional
12
+ native workspace service. Current, failed and provisioning members stay inert;
13
+ lead-owned and unassigned task titles remain plain text.
14
+
15
+ ### Verification
16
+
17
+ - Passed the existing client regressions and all 43 package/composition checks
18
+ with the local DSH 0.2.2-rc.1 runtime on Windows.
19
+ - Exercised the installed plugin in an isolated DSH web profile with browser-only
20
+ team projection fixtures and real empty sessions: measured edge endpoints and
21
+ animation, then confirmed task-title and member-card clicks selected the target
22
+ session. No model calls or full agent-team task execution were exercised.
23
+
5
24
  ## [0.5.3] - 2026-11-07
6
25
 
7
26
  ### Fixed
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cabinet Mode (内阁模式) for DeepSeek Harness
2
2
 
3
- **Version compatibility (0.5.3):** Targets DSH **0.2.2-rc.1**. This patch repairs per-office model selection before the host freezes each step; 0.5.1/0.5.2 only repaired preset loading and display metadata. Verified with official host components and isolated profiles, without real model calls; see the model regression scope below. Earlier rc.3/rc.5 UI and installation results are historical evidence for earlier packages. On DSH 0.2.1-rc.3/rc.5 retain the previously verified package, including 0.5.0: the current preset omits the separate list_agents entry required on rc.5. Select the compatible version in the market.
3
+ **Version compatibility (0.5.4):** Targets DSH **0.2.2-rc.1**. This patch corrects dependency flow and opens teammate sessions from task titles and member cards; it retains the per-office model selection fix before the host freezes each step; 0.5.1/0.5.2 only repaired preset loading and display metadata. Verified with official host components and isolated profiles, without real model calls; see the model regression scope below. Earlier rc.3/rc.5 UI and installation results are historical evidence for earlier packages. On DSH 0.2.1-rc.3/rc.5 retain the previously verified package, including 0.5.0: the current preset omits the separate list_agents entry required on rc.5. Select the compatible version in the market.
4
4
 
5
5
  [中文](README.zh.md) | English
6
6
 
@@ -37,7 +37,7 @@ and the rest) come from the profile-level
37
37
  ship them**.
38
38
 
39
39
  This bundle declares **no hard DSH version gate**: no `engines.dsh`, no DSH
40
- `peerDependencies`, no install-time version check. Earlier package releases were tested on DSH **0.2.1-rc.3**; use the compatibility guidance above for 0.5.3 (see [DSH-side constraints](#dsh-side-constraints)).
40
+ `peerDependencies`, no install-time version check. Earlier package releases were tested on DSH **0.2.1-rc.3**; use the compatibility guidance above for 0.5.4 (see [DSH-side constraints](#dsh-side-constraints)).
41
41
 
42
42
  ## Cabinet member settings
43
43
 
@@ -258,7 +258,7 @@ On failure, show the exact error. For $.format must be 1, replace the webpage so
258
258
  Use this only when the market is unavailable or for local development. Fully quit desktop DSH first to release the profile lock, then install the release bundle:
259
259
 
260
260
  ```sh
261
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.3/dsh-cabinet-mode-0.5.3.tgz
261
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.4/dsh-cabinet-mode-0.5.4.tgz
262
262
  dsh plugin --profile desktop list
263
263
  ```
264
264
 
@@ -273,7 +273,7 @@ the same install command with the new version URL (or pick the new `.tgz` in the
273
273
  plugin page), then fully quit and restart DeepSeek Harness:
274
274
 
275
275
  ```sh
276
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.3/dsh-cabinet-mode-0.5.3.tgz
276
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.4/dsh-cabinet-mode-0.5.4.tgz
277
277
  ```
278
278
 
279
279
  `dsh plugin --profile desktop list` should report the new version. Upgrades were
package/README.zh.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 内阁模式(Cabinet Mode)· DeepSeek Harness 插件
2
2
 
3
- **版本兼容(0.5.3):** 面向 DSH **0.2.2-rc.1**,在宿主固定每步模型前完成官职模型选择;0.5.1/0.5.2 仅修复了预设加载和显示元数据。已使用官方宿主组件与隔离 profile 验证,未调用真实模型;测试范围见下文。旧 rc.3/rc.5 的界面及安装记录仅适用于当时的包。DSH 0.2.1-rc.3/rc.5 用户应保留原先已验证版本(包括 0.5.0),当前预设已移除 rc.5 所需的独立 list_agents 入口;请在商店选择匹配版本。
3
+ **版本兼容(0.5.4):** 面向 DSH **0.2.2-rc.1**,修正依赖连线方向,支持点击任务名和成员卡打开会话,并保留在宿主固定每步模型前完成官职模型选择的修复;0.5.1/0.5.2 仅修复了预设加载和显示元数据。已使用官方宿主组件与隔离 profile 验证,未调用真实模型;测试范围见下文。旧 rc.3/rc.5 的界面及安装记录仅适用于当时的包。DSH 0.2.1-rc.3/rc.5 用户应保留原先已验证版本(包括 0.5.0),当前预设已移除 rc.5 所需的独立 list_agents 入口;请在商店选择匹配版本。
4
4
 
5
5
  [English](README.md) | 中文
6
6
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  它声明**两行**——`preset-cabinet`(一条 `@deepseek-ai/dsh-agent-preset` 声明)与 `cabinet-ui`(载入本包 JavaScript 的 Loader 行)——并复用 DSH **标准模式**(Standard Mode)出厂的 22 行插件清单,因此工具与标准模式一致;与出厂模式的差异是 persona,并另加右栏「内阁」面板。团队工具(`spawn_teammate`、`team_task_*` 等)由 profile 层的 `@deepseek-ai/dsh-experimental-agent-team-profile` 提供,**本 preset 未内置**。
23
23
 
24
- 本包声明 **无 DSH 版本硬限制**:没有 `engines.dsh`、没有 DSH `peerDependencies`、安装时不做版本检查。旧包曾在 DSH **0.2.1-rc.3** 实测;0.5.3 请遵循上方版本兼容说明(见 [DSH 侧限制与说明](#dsh-侧限制与说明))。
24
+ 本包声明 **无 DSH 版本硬限制**:没有 `engines.dsh`、没有 DSH `peerDependencies`、安装时不做版本检查。旧包曾在 DSH **0.2.1-rc.3** 实测;0.5.4 请遵循上方版本兼容说明(见 [DSH 侧限制与说明](#dsh-侧限制与说明))。
25
25
 
26
26
  ## 内阁成员配置
27
27
 
@@ -189,7 +189,7 @@ https://raw.githubusercontent.com/luodaoyi/dsh-cabinet-mode/market-index/marketp
189
189
  仅在商店不可用或本地开发时使用。先完全退出桌面 DSH,释放 profile 锁,再执行:
190
190
 
191
191
  ```sh
192
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.3/dsh-cabinet-mode-0.5.3.tgz
192
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.4/dsh-cabinet-mode-0.5.4.tgz
193
193
  dsh plugin --profile desktop list
194
194
  ```
195
195
 
@@ -200,7 +200,7 @@ dsh plugin --profile desktop list
200
200
  若通过插件市场安装:刷新市场,先在**已安装**页卸载旧版本,再从**插件市场**安装新版本,然后重启——没有 tgz URL 要换,也没有一键更新。否则用同一条安装命令换新版本 URL(或在插件页选新 `.tgz`),然后完全退出并重启 DeepSeek Harness:
201
201
 
202
202
  ```sh
203
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.3/dsh-cabinet-mode-0.5.3.tgz
203
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.5.4/dsh-cabinet-mode-0.5.4.tgz
204
204
  ```
205
205
 
206
206
  `dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
package/client.js CHANGED
@@ -2407,8 +2407,13 @@ window.__ModuleLoader__.load({
2407
2407
  'body[data-ds-dark-theme] .cabinet-status-running{color:#4ade80}body[data-ds-dark-theme] .cabinet-status-inactive{color:#adb2b8}body[data-ds-dark-theme] .cabinet-status-provisioning{color:#f7ad31}body[data-ds-dark-theme] .cabinet-status-failed{color:#f25a5a}',
2408
2408
  '.cabinet-task-pending{color:#61666b}.cabinet-task-in_progress{color:#2563eb}.cabinet-task-completed{color:#15803d}',
2409
2409
  'body[data-ds-dark-theme] .cabinet-task-pending{color:#adb2b8}body[data-ds-dark-theme] .cabinet-task-in_progress{color:#60a5fa}body[data-ds-dark-theme] .cabinet-task-completed{color:#4ed17e}',
2410
- // task dependency edges (blocked → blocker): one class per blocker state,
2410
+ // task dependency edges (blocker → blocked): one class per blocker state,
2411
2411
  // same palette as TASK_COLOR (done #22c55e / active #3b82f6 / pending #9aa0a6)
2412
+ // Flow direction: the path now runs blocker → blocked, and a dash pattern
2413
+ // starts at path distance ≡ -offset, so animating offset 0 → -24 slides
2414
+ // the dashes toward the path END — with the arrow, toward the blocked
2415
+ // task. No sign flip was needed after reversing the path; this is a desk
2416
+ // derivation from the SVG dash rule, not a browser observation (未验证).
2412
2417
  '@keyframes cabinetEdgeFlow{to{stroke-dashoffset:-24}}',
2413
2418
  '.cabinet-edge{fill:none;stroke-width:1.5;stroke-linecap:round}',
2414
2419
  '.cabinet-edge-done{stroke:light-dark(#15803d,#4ade80)}',
@@ -2554,6 +2559,34 @@ window.__ModuleLoader__.load({
2554
2559
  let memberWriter = null;
2555
2560
  /** Host remote handle for the model catalog; null degrades the picker to text. */
2556
2561
  let memberRemote = null;
2562
+ /**
2563
+ * Optional uiWorkspace opener, captured by ctx.inject() inside apply()
2564
+ * (same pattern as memberRemote/memberWriter). It stays null on a
2565
+ * deployment without the workspace service, and every panel click then
2566
+ * degrades to a silent no-op instead of throwing at the panel.
2567
+ */
2568
+ let cabinetOpenSession = null;
2569
+ /**
2570
+ * Open a teammate's child session the way the native roster does
2571
+ * (dsh-experimental-client-ui-agent-team openTeammate): the Lead session
2572
+ * is the parent, the member id the child, mode "continuable"; when the
2573
+ * target IS the parent the native code takes the plain-string branch, so
2574
+ * mirror that too. Returns false when the channel or the id is missing —
2575
+ * callers simply do nothing, no exception reaches the panel.
2576
+ */
2577
+ function openCabinetSession(childSessionId, parentSessionId) {
2578
+ const open = cabinetOpenSession;
2579
+ if (typeof open !== 'function') return false;
2580
+ if (typeof childSessionId !== 'string' || childSessionId === '') return false;
2581
+ try {
2582
+ if (parentSessionId && childSessionId === parentSessionId) open(parentSessionId);
2583
+ else open({ parentSessionId: parentSessionId ?? childSessionId, childSessionId, mode: 'continuable' });
2584
+ return true;
2585
+ } catch (error) {
2586
+ try { console.warn('[cabinet-ui] open session failed:', error); } catch (ignored) { /* console may be unavailable */ }
2587
+ return false;
2588
+ }
2589
+ }
2557
2590
  const MEMBER_LISTENERS = new Set();
2558
2591
  let memberT = (key) => key;
2559
2592
  function clampMemberText(value, limit) {
@@ -2996,13 +3029,23 @@ window.__ModuleLoader__.load({
2996
3029
  // line one; status dot + state text (+ live dots / model) on line two.
2997
3030
  // State text carries a theme-aware class so 11px copy clears 3:1 in both
2998
3031
  // themes; the badge keeps lead's formula with a light-theme dark amber.
2999
- function MemberCard({ member, running, model, isCurrent, lead, statusLabel, t, size, children }) {
3032
+ function MemberCard({ member, running, model, isCurrent, lead, statusLabel, t, size, onOpen, children }) {
3000
3033
  const tt = typeof t === 'function' ? t : (key) => key;
3001
3034
  const status = member.phase === 'active' ? (running ? 'running' : 'inactive') : member.phase;
3035
+ // Availability mirrors the native roster row (agent-team TeamMemberRow):
3036
+ // the session you are already viewing, and failed/provisioning members,
3037
+ // are inert — no click, no pointer cursor. Opening also needs a real
3038
+ // session id, which is what member.id is (sessionIdSchema).
3039
+ const canOpen = typeof onOpen === 'function'
3040
+ && isCurrent !== true
3041
+ && member.phase !== 'failed'
3042
+ && member.phase !== 'provisioning'
3043
+ && typeof member.id === 'string' && member.id !== '';
3002
3044
  return h('div', { className: lead ? 'cabinet-card cabinet-card-lead' : 'cabinet-card', style: { position: 'relative', zIndex: 1 } }, [
3003
3045
  h('div', {
3004
3046
  key: 'who',
3005
- style: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', minWidth: 0 }
3047
+ onClick: canOpen ? () => onOpen(member) : undefined,
3048
+ style: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', minWidth: 0, cursor: canOpen ? 'pointer' : undefined }
3006
3049
  }, [
3007
3050
  h(Avatar, { key: 'avatar', name: member.name, size: size || 22, live: status === 'running' }),
3008
3051
  h('span', {
@@ -3039,11 +3082,16 @@ window.__ModuleLoader__.load({
3039
3082
  ]);
3040
3083
  }
3041
3084
 
3042
- function TaskLine({ task, blockerOf, t, taskLabel, ownerRunning }) {
3085
+ function TaskLine({ task, blockerOf, t, taskLabel, ownerRunning, onOpenOwner }) {
3043
3086
  const [openBlockers, setOpenBlockers] = React.useState(true);
3044
3087
  const status = TASK_COLOR[task.status] ? task.status : 'pending';
3045
3088
  const color = TASK_COLOR[status];
3046
3089
  const blockers = Array.isArray(task.blockedBy) ? [...new Set(task.blockedBy.filter((id) => typeof id === 'string' && id !== task.id))] : [];
3090
+ // The subject itself is the affordance, but only when the panel handed
3091
+ // us a resolved opener: lead-owned, unassigned, foreign-owner and
3092
+ // inert-owner tasks arrive with onOpenOwner === null and keep the plain
3093
+ // look (no onClick, no pointer cursor).
3094
+ const openTask = typeof onOpenOwner === 'function';
3047
3095
  const parts = [
3048
3096
  h('span', {
3049
3097
  key: 'dot',
@@ -3053,8 +3101,9 @@ window.__ModuleLoader__.load({
3053
3101
  h('span', { key: 'st', className: 'cabinet-task-' + status, style: { fontSize: 11, flex: 'none' } }, taskLabel(status)),
3054
3102
  h('span', {
3055
3103
  key: 'subj',
3056
- style: { fontSize: 12.5, color: INK, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
3057
- title: task.subject
3104
+ style: { fontSize: 12.5, color: INK, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', cursor: openTask ? 'pointer' : undefined },
3105
+ title: task.subject,
3106
+ onClick: openTask ? () => onOpenOwner(task) : undefined
3058
3107
  }, task.subject)
3059
3108
  ];
3060
3109
  if (!task.ownerName) {
@@ -3100,11 +3149,13 @@ window.__ModuleLoader__.load({
3100
3149
  }, children);
3101
3150
  }
3102
3151
 
3103
- // Dependency-edge overlay: one cubic path + one blocker-side dot per edge,
3104
- // paths are masked behind card interiors; endpoint dots remain visible. The
3105
- // layer is pointer-transparent, so rows stay
3106
- // clickable. `data-cabinet-edge="<blocked>-><blocker>"` plus a
3107
- // cabinet-edge-pending/active/done class makes every edge assertable.
3152
+ // Dependency-edge overlay: one cubic path + one blocked-side dot per edge
3153
+ // (the line leaves the blocker's row and lands on the blocked task's row),
3154
+ // masked behind card interiors while endpoint dots remain visible. The
3155
+ // layer is pointer-transparent, so rows stay clickable.
3156
+ // `data-cabinet-edge="<blocked>-><blocker>"` — key format is unchanged by
3157
+ // the geometry flip — plus a cabinet-edge-pending/active/done class makes
3158
+ // every edge assertable.
3108
3159
  function TaskEdgeLayer({ edges, cards = [] }) {
3109
3160
  const maskId = React.useId();
3110
3161
  if (!Array.isArray(edges) || edges.length === 0) return null;
@@ -3240,16 +3291,19 @@ window.__ModuleLoader__.load({
3240
3291
  }
3241
3292
  return paths;
3242
3293
  }
3243
- // One cubic per dependency: from the blocked task's row to its blocker's
3244
- // row, both endpoints taken from task-row DOM rects relative to the
3245
- // overlay container. State mirrors the BLOCKER's status — completed →
3246
- // solid green, in_progress → flowing dashes (travelling toward the
3247
- // blocker, "the dependency is progressing"), pending → static grey
3248
- // dashes; a missing or deleted blocker, or an unmeasured row, draws
3249
- // nothing (tolerant, never throws). Edges sharing a source row or a
3250
- // target row fan their control points apart so parallel lines never sit
3251
- // exactly on top of each other. Returns null while the panel is hidden
3252
- // (zero-size base) so a collapsed pane keeps the last drawing.
3294
+ // One cubic per dependency: from the BLOCKER's row to the blocked task's
3295
+ // row (首辅 → 阁臣 reading on a normal board), both endpoints taken from
3296
+ // task-row DOM rects relative to the overlay container. The edge key stays
3297
+ // `<blocked>-><blocker>` — only the geometry flipped, so data-cabinet-edge
3298
+ // and the CSS class names keep their old form. State mirrors the BLOCKER's
3299
+ // status — completed → solid green, in_progress → flowing dashes
3300
+ // (travelling with the arrow, toward the blocked task, "the dependency is
3301
+ // progressing"), pending → static grey dashes; a missing or deleted
3302
+ // blocker, or an unmeasured row, draws nothing (tolerant, never throws).
3303
+ // Edges sharing a source row or a target row fan their control points
3304
+ // apart so parallel lines never sit exactly on top of each other. Returns
3305
+ // null while the panel is hidden (zero-size base) so a collapsed pane
3306
+ // keeps the last drawing.
3253
3307
  function buildTaskEdges(base, tasks, rectOf, isLive) {
3254
3308
  if (!base || base.width === 0 || base.height === 0) return null;
3255
3309
  const list = Array.isArray(tasks) ? tasks : [];
@@ -3275,8 +3329,13 @@ window.__ModuleLoader__.load({
3275
3329
  seen.add(key);
3276
3330
  const blocker = byId.get(blockerId);
3277
3331
  if (!blocker || blocker.status === 'deleted') continue; // missing/removed task: skip, don't crash
3278
- const from = rectOf(task.id);
3279
- const to = rectOf(blockerId);
3332
+ // Geometry reversed: the path starts on the blocker's row and
3333
+ // ends on the blocked task's row (the key above still reads
3334
+ // blocked->blocker). from/to drive the anchors, fromId/toId the
3335
+ // parallel-edge fan, and the endpoint dot lands on edge.e — i.e.
3336
+ // on the blocked task.
3337
+ const from = rectOf(blockerId);
3338
+ const to = rectOf(task.id);
3280
3339
  if (!from || !to || from.width === 0 || from.height === 0 || to.width === 0 || to.height === 0) continue;
3281
3340
  const state = blocker.status === 'completed' ? 'done'
3282
3341
  : blocker.status === 'in_progress' ? 'active'
@@ -3285,8 +3344,8 @@ window.__ModuleLoader__.load({
3285
3344
  key,
3286
3345
  state,
3287
3346
  live: state === 'active' && typeof isLive === 'function' && isLive(blockerId) === true,
3288
- fromId: task.id,
3289
- toId: blockerId,
3347
+ fromId: blockerId,
3348
+ toId: task.id,
3290
3349
  from: rel(from),
3291
3350
  to: rel(to)
3292
3351
  });
@@ -3325,9 +3384,10 @@ window.__ModuleLoader__.load({
3325
3384
  edge.c2 = [c2x, c2y];
3326
3385
  edge.e = [ex, ey];
3327
3386
  }
3328
- // Parallel-edge offset: edges from the same row (or into the same
3329
- // blocker row) share an anchor, so shift their control points apart
3330
- // perpendicular to the travel axis (7px pitch, centred on the group).
3387
+ // Parallel-edge offset: edges leaving the same blocker row (or arriving
3388
+ // at the same blocked row) share an anchor, so shift their control
3389
+ // points apart perpendicular to the travel axis (7px pitch, centred on
3390
+ // the group). fromId is the blocker, toId the blocked task.
3331
3391
  const fan = (pointField, idField, prefix) => {
3332
3392
  const groups = new Map();
3333
3393
  for (const edge of edges) {
@@ -3576,6 +3636,24 @@ window.__ModuleLoader__.load({
3576
3636
  const isLeadTask = (task) => task.ownerName === 'lead' || (lead !== undefined && task.ownerName === lead.name);
3577
3637
  const unassigned = tasks.filter((task) => !task.ownerName);
3578
3638
  const leadOwn = tasks.filter((task) => task.ownerName !== undefined && isLeadTask(task));
3639
+
3640
+ // ---- click-to-open a member's child session (optional channel) ----
3641
+ // cabinetOpenSession is filled by ctx.inject(['uiWorkspace']) in apply()
3642
+ // and stays null when the service is missing — the helpers below then
3643
+ // return false and the click does nothing. Availability follows the
3644
+ // native roster's inert rule (agent-team: self / failed / provisioning
3645
+ // never open); lead-owned and unassigned tasks resolve to no member at
3646
+ // all, so the panel hands TaskLine null and nothing is bound.
3647
+ const openableMember = (member) => Boolean(member)
3648
+ && typeof member.id === 'string' && member.id !== ''
3649
+ && member.id !== sessionId
3650
+ && member.phase !== 'failed'
3651
+ && member.phase !== 'provisioning';
3652
+ const openMemberSession = (member) => openableMember(member) && openCabinetSession(member.id, leadSessionId);
3653
+ const ownerMemberOf = (task) => (task && task.ownerName && !isLeadTask(task) ? memberByName.get(task.ownerName) : undefined);
3654
+ const openOwnerSession = (task) => openMemberSession(ownerMemberOf(task));
3655
+ // Per-task opener handed to TaskLine: null means "do not bind".
3656
+ const ownerOpener = (task) => (openableMember(ownerMemberOf(task)) ? openOwnerSession : null);
3579
3657
  const rosterNames = new Set(mates.map((member) => member.name));
3580
3658
  const foreignOwners = [];
3581
3659
  for (const task of tasks) {
@@ -3599,7 +3677,8 @@ window.__ModuleLoader__.load({
3599
3677
  lead: true,
3600
3678
  size: 26,
3601
3679
  statusLabel,
3602
- t: tt
3680
+ t: tt,
3681
+ onOpen: openMemberSession
3603
3682
  });
3604
3683
 
3605
3684
  // Cells: every minister first, then 未分派 / 首辅自办 / 不在册 as
@@ -3657,6 +3736,7 @@ window.__ModuleLoader__.load({
3657
3736
  isCurrent: member.id === sessionId,
3658
3737
  statusLabel,
3659
3738
  t: tt,
3739
+ onOpen: openMemberSession,
3660
3740
  // tasks live inside the card, elbow-connected by RailList
3661
3741
  children: own.length > 0
3662
3742
  ? h(RailList, { key: 'tasks', style: { marginTop: 4 } }, own.map((task) => h(TaskLine, {
@@ -3665,7 +3745,8 @@ window.__ModuleLoader__.load({
3665
3745
  blockerOf,
3666
3746
  t: tt,
3667
3747
  taskLabel,
3668
- ownerRunning: memberRunning
3748
+ ownerRunning: memberRunning,
3749
+ onOpenOwner: ownerOpener(task)
3669
3750
  })))
3670
3751
  : h('div', { key: 'tasks', style: { fontSize: 11, color: INK3, padding: '2px 0' } }, tt('task.none'))
3671
3752
  });
@@ -3681,7 +3762,8 @@ window.__ModuleLoader__.load({
3681
3762
  blockerOf,
3682
3763
  t: tt,
3683
3764
  taskLabel,
3684
- ownerRunning: false
3765
+ ownerRunning: false,
3766
+ onOpenOwner: ownerOpener(task)
3685
3767
  })))
3686
3768
  ]);
3687
3769
  }
@@ -4122,6 +4204,19 @@ window.__ModuleLoader__.load({
4122
4204
  return () => { if (memberRemote === remote) memberRemote = null; };
4123
4205
  }, 'cabinet-ui: model catalog remote');
4124
4206
  });
4207
+ // Optional navigation channel for the panel's click-to-open rows. The
4208
+ // manifest inject list above stays untouched: without the workspace
4209
+ // service this callback never runs, cabinetOpenSession stays null and
4210
+ // every click no-ops — the same degradation as the remote channel.
4211
+ ctx.inject(['uiWorkspace'], (scope) => {
4212
+ const workspace = scope.uiWorkspace;
4213
+ if (!workspace || typeof workspace.openSession !== 'function') return;
4214
+ scope.effect(() => {
4215
+ const opener = (target) => workspace.openSession(target);
4216
+ cabinetOpenSession = opener;
4217
+ return () => { if (cabinetOpenSession === opener) cabinetOpenSession = null; };
4218
+ }, 'cabinet-ui: open teammate session');
4219
+ });
4125
4220
  // Stage one: declare the page type. No patterns => a page type, opened by kind.
4126
4221
  ctx.effect(() => ctx.sidebarRightTabs.register({
4127
4222
  id: TAB_ID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cabinet-mode",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Cabinet Mode (内阁模式) for DeepSeek Harness: a declarative DSH bundle that adds a dual-identity Lead/teammate agent preset for the Great Ming Research Bureau cabinet team.",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.svg",
@@ -234,7 +234,7 @@ assert.ok(classByKey['t-audit->t-build'].includes('cabinet-edge-active'), classB
234
234
  assert.ok(classByKey['t-audit->t-build'].includes('cabinet-edge-live'), 'running-owner flow edge is distinguishable');
235
235
  assert.ok(classByKey['t-extra->t-audit'].includes('cabinet-edge-pending'), classByKey['t-extra->t-audit']);
236
236
  const edgeDots = layerEls.filter((node) => node.type === 'circle');
237
- assert.equal(edgeDots.length, 5, 'every edge ends in a dot on the blocker side');
237
+ assert.equal(edgeDots.length, 5, 'every edge ends in a dot on the blocked side');
238
238
  assert.ok(edgeDots.every((dot) => dot.props['data-cabinet-edge-dot'].includes('->')));
239
239
  assert.equal(client.TaskEdgeLayer({ edges: [] }), null, 'no edges → no overlay layer');
240
240
  // panel render: cross-member tasks all expose measurement anchors, no premature edges
@@ -270,6 +270,102 @@ assert.ok(reducedMedia.includes('.cabinet-edge-active') && reducedMedia.includes
270
270
  assert.ok(source.includes('.cabinet-edge-done{stroke:light-dark(#15803d,#4ade80)}'), 'done edge has theme-specific green contrast');
271
271
  assert.ok(source.includes('.cabinet-edge-pending{stroke:light-dark(#6b7280,#9ca3af)'), 'pending edge is static grey');
272
272
  assert.ok(source.includes('cabinetEdgeFlow'), 'active edge gets the dash-offset flow');
273
+ // --- direction: the path LEAVES the blocker's row and LANDS on the blocked
274
+ // task's row, dot included; the key still reads <blocked>-><blocker> because
275
+ // only the geometry flipped (首辅 → 阁臣) ---
276
+ const rectBoundary = (point, id) => {
277
+ const rect = edgeRects.get(id);
278
+ if (!rect) return false;
279
+ const [x, y] = point;
280
+ return ((x === rect.left || x === rect.right) && y >= rect.top && y <= rect.bottom)
281
+ || ((y === rect.top || y === rect.bottom) && x >= rect.left && x <= rect.right);
282
+ };
283
+ const dPoints = (d) => d.split(/[MC]/).slice(1).map((part) => part.trim().split(/\s+/).map(Number));
284
+ const near = (a, b) => Math.abs(a - b) < 0.05;
285
+ for (const edge of built) {
286
+ const [blockedId, blockerId] = edge.key.split('->');
287
+ const [start, curve] = dPoints(edge.d);
288
+ const end = curve.slice(-2);
289
+ assert.ok(near(start[0], edge.s[0]) && near(start[1], edge.s[1]), `${edge.key}: M must sit on the start anchor`);
290
+ assert.ok(near(end[0], edge.e[0]) && near(end[1], edge.e[1]), `${edge.key}: path end must sit on the end anchor`);
291
+ assert.equal(edge.ex, edge.e[0], `${edge.key}: dot x is the path end`);
292
+ assert.equal(edge.ey, edge.e[1], `${edge.key}: dot y is the path end`);
293
+ assert.ok(rectBoundary(start, blockerId), `${edge.key}: start anchor lies on the BLOCKER row ${blockerId}`);
294
+ assert.ok(rectBoundary(end, blockedId), `${edge.key}: end anchor lies on the BLOCKED row ${blockedId}`);
295
+ assert.ok(!rectBoundary(start, blockedId), `${edge.key}: start is not on the blocked row — direction is blocker → blocked`);
296
+ assert.ok(!rectBoundary(end, blockerId), `${edge.key}: end is not on the blocker row`);
297
+ }
298
+ // --- click-to-open: only a resolvable, non-inert target binds a handler ---
299
+ const openLog = [];
300
+ const recordOpen = (target) => { openLog.push(target); return true; };
301
+ const subjectOf = (line) => elements(line).find((node) => node.props?.key === 'subj');
302
+ const boundLine = subjectOf(client.TaskLine({ task: tasks[0], t: (key) => key, taskLabel: (status) => status, onOpenOwner: recordOpen }));
303
+ assert.equal(typeof boundLine.props.onClick, 'function', 'a resolved owner binds the subject span');
304
+ assert.equal(boundLine.props.style.cursor, 'pointer', 'a bound subject shows the pointer cursor');
305
+ boundLine.props.onClick();
306
+ assert.deepEqual(openLog, [tasks[0]], 'clicking the subject invokes the opener once with the task');
307
+ for (const task of [
308
+ { id: 'k-lead', subject: 'lead work', ownerName: 'lead', status: 'pending' },
309
+ { id: 'k-none', subject: 'nobody', status: 'pending' },
310
+ ]) {
311
+ const subject = subjectOf(client.TaskLine({ task, t: (key) => key, taskLabel: (status) => status, onOpenOwner: null }));
312
+ assert.equal(subject.props.onClick, undefined, `${task.id}: no click binding without an opener`);
313
+ assert.equal(subject.props.style.cursor, undefined, `${task.id}: no pointer cursor without an opener`);
314
+ }
315
+ // panel level: the resolver decides who gets an opener
316
+ const clickTeam = {
317
+ members: [
318
+ { id: 'lead-session', name: 'lead', role: 'lead', phase: 'active' },
319
+ { id: 'm-works', name: 'works', role: 'mate', phase: 'active' },
320
+ { id: 'm-dali', name: 'dali', role: 'mate', phase: 'failed' },
321
+ { id: 'm-yushi', name: 'yushi', role: 'mate', phase: 'provisioning' },
322
+ ],
323
+ tasks: [
324
+ { id: 'k-lead', subject: 'lead owns this', ownerName: 'lead', status: 'pending' },
325
+ { id: 'k-none', subject: 'no owner', status: 'pending' },
326
+ { id: 'k-works', subject: 'works owns this', ownerName: 'works', status: 'pending' },
327
+ { id: 'k-dali', subject: 'dali owns this', ownerName: 'dali', status: 'pending' },
328
+ { id: 'k-yushi', subject: 'yushi owns this', ownerName: 'yushi', status: 'pending' },
329
+ ],
330
+ };
331
+ const clickEls = elements(render(clickTeam, client.zh));
332
+ const subjectByTitle = new Map();
333
+ for (const node of clickEls) if (node.props?.key === 'subj') subjectByTitle.set(node.props.title, node);
334
+ assert.equal(subjectByTitle.size, clickTeam.tasks.length, 'every task subject rendered');
335
+ assert.equal(subjectByTitle.get('lead owns this').props.onClick, undefined, 'lead task: panel hands no opener');
336
+ assert.equal(subjectByTitle.get('no owner').props.onClick, undefined, 'unassigned task: panel hands no opener');
337
+ assert.equal(typeof subjectByTitle.get('works owns this').props.onClick, 'function', 'teammate task binds');
338
+ assert.equal(subjectByTitle.get('dali owns this').props.onClick, undefined, 'failed-owner task: no opener');
339
+ assert.equal(subjectByTitle.get('yushi owns this').props.onClick, undefined, 'provisioning-owner task: no opener');
340
+ assert.equal(subjectByTitle.get('works owns this').props.style.cursor, 'pointer', 'clickable subject shows the pointer');
341
+ assert.equal(subjectByTitle.get('lead owns this').props.style.cursor, undefined, 'lead task keeps the plain cursor');
342
+ // a bound click with no uiWorkspace channel must degrade silently, never throw
343
+ assert.equal(subjectByTitle.get('works owns this').props.onClick(), false, 'missing channel → silent false, no throw');
344
+ // member cards: same inert rule as the native roster row (self / failed / provisioning)
345
+ const cardWho = (member, extra) => elements(client.MemberCard({
346
+ member, statusLabel: (status) => status, ...extra,
347
+ })).find((node) => node.props?.key === 'who');
348
+ const activeWho = cardWho({ id: 'm-works', name: 'works', phase: 'active' }, { isCurrent: false, onOpen: recordOpen });
349
+ assert.equal(typeof activeWho.props.onClick, 'function', 'active non-current member binds');
350
+ assert.equal(activeWho.props.style.cursor, 'pointer', 'clickable member card shows the pointer');
351
+ assert.equal(activeWho.props.onClick(), true, 'click forwards to the opener');
352
+ for (const [label, member, extra] of [
353
+ ['self', { id: 'lead-session', name: 'lead', phase: 'active' }, { isCurrent: true, onOpen: recordOpen }],
354
+ ['failed', { id: 'm-dali', name: 'dali', phase: 'failed' }, { isCurrent: false, onOpen: recordOpen }],
355
+ ['provisioning', { id: 'm-yushi', name: 'yushi', phase: 'provisioning' }, { isCurrent: false, onOpen: recordOpen }],
356
+ ['no id', { name: 'works', phase: 'active' }, { isCurrent: false, onOpen: recordOpen }],
357
+ ['no channel', { id: 'm-works', name: 'works', phase: 'active' }, { isCurrent: false }],
358
+ ]) {
359
+ const who = cardWho(member, extra);
360
+ assert.equal(who.props.onClick, undefined, `${label}: no click binding`);
361
+ assert.equal(who.props.style.cursor, undefined, `${label}: no pointer cursor`);
362
+ }
363
+ // panel level: exactly the one openable member card is bound
364
+ const whoNodes = clickEls.filter((node) => node.props?.key === 'who');
365
+ assert.equal(whoNodes.length, clickTeam.members.length, 'one who-row per member');
366
+ assert.deepEqual(whoNodes.map((node) => typeof node.props.onClick), ['undefined', 'function', 'undefined', 'undefined'],
367
+ 'lead(self)/failed/provisioning cards stay inert, the active mate binds');
368
+
273
369
  console.log('PASS: avatars, stale-team warnings, and distinct member/owner/group identities; mocked React, not browser E2E');
274
370
  console.log('PASS: task dependency edges — data attributes, three states, missing-blocker tolerance, reduced-motion CSS, geometry refresh gate');
275
371
 
@@ -291,3 +387,4 @@ const adjacent=client.buildTaskEdges(edgeBase,[{id:'top'},{id:'bottom',blockedBy
291
387
  assert.equal(adjacent.length,1);assert.notEqual(adjacent[0].s[1],adjacent[0].e[1]);
292
388
  assert.ok(adjacent[0].c1[0]>adjacent[0].s[0]);
293
389
  console.log('PASS: adjacent same-column rows retain a nonzero gutter curve');
390
+ console.log('PASS: edge direction blocker → blocked (start on blocker row, dot on blocked row) and click-to-open binding rules (lead/unassigned/inert never bind)');