@yankeguo/dsh-command-devlead 0.2.4 → 0.2.6

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/README.md CHANGED
@@ -6,7 +6,7 @@ damage recovery, and the human-readable status view. The status output includes
6
6
  checkout-isolation capability is composed.
7
7
 
8
8
  ```text
9
- /devlead # status: mode, worktree capability, watched sessions, recent notifications
9
+ /devlead # status: mode, worktree capability, watched sessions, recent notifications/reports
10
10
  /devlead on # enable DevLead mode for this Session (human-only)
11
11
  /devlead off # disable it; on a frozen fold it recovers by resetting the damaged state
12
12
  /devlead reset # human-only recovery: discard this Session's DevLead state (mode/watch/digest)
@@ -14,6 +14,13 @@ checkout-isolation capability is composed.
14
14
  /devlead unwatch <session> # stop watching it
15
15
  ```
16
16
 
17
+ DevLead mode is Host-wide and single-active: exactly one Session may hold it across every
18
+ Workspace. `/devlead on` in a second Session is refused with `DEVLEAD_ALREADY_ACTIVE`, whose
19
+ message names the occupying Session and says to run `/devlead off` there first; the refused
20
+ Session's projection stays disabled. Off/reset release the slot immediately, and archiving the
21
+ holder makes it releasable on the next admission/startup (the core writes the durable mode-off
22
+ when it can).
23
+
17
24
  The command parses the DSH `CommandInvocation.rawInput` contract (text after the command name),
18
25
  does not accept composer attachments, and renders domain failures as friendly text instead of
19
26
  throwing. Prefix references are confirmed with the core's exhaustive resolver before a watch
@@ -21,9 +28,20 @@ mutation, so a bounded listing cannot silently shadow another matching Session.
21
28
  derived from a post-mutation snapshot, so a concurrent command cannot leave the title describing a
22
29
  different state than the rendered body.
23
30
 
31
+ The status view also renders the five newest mid-turn reports (`Recent reports:`) with timestamp,
32
+ sender, kind, and summary/message; report errors (not-watched / `DEVLEAD_NOT_SUPERVISED`, rate-limited, invalid fields) are
33
+ rendered as friendly command text. A report is not sent by the command itself; watched Sessions
34
+ use the `devlead_report` tool.
35
+
36
+ An archived DevLead holder no longer blocks `/devlead on`: admission treats archived Sessions as
37
+ inactive and records a durable tombstone when the mode-off cannot be written. `/devlead status`
38
+ lists such holders under `Archived DevLead holders (ignored for admission)` with the action
39
+ `unarchive and run /devlead off, or delete it`; opening the unarchived Session reconciles it so a
40
+ second enabled lead is not left behind.
41
+
24
42
  `/devlead reset` appends a `plugin:devlead/reset` durable record: replay applies it before the
25
43
  corruption freeze check, so a Session whose earlier `plugin:devlead/*` record is corrupt becomes
26
- usable again (both projections restart from the default disabled state). `/devlead off` runs the
44
+ usable again (all three projections restart from the default disabled state). `/devlead off` runs the
27
45
  same recovery when the fold is frozen; `/devlead on` refuses and asks for the explicit reset.
28
46
 
29
47
  ## Install
@@ -42,7 +60,16 @@ dsh plugin --profile desktop add @yankeguo/dsh-devlead-bundle
42
60
  ## 中文
43
61
 
44
62
  `@yankeguo/dsh-command-devlead` 提供人类 `/devlead` 命令:模式状态、reset、watch/unwatch。
63
+ DevLead 模式全局单活:第二个会话执行 `/devlead on` 会以 `DEVLEAD_ALREADY_ACTIVE` 被拒,
64
+ 消息给出占用者并提示先在占用者上 `/devlead off`;关闭/重置立即释放,归档占用者在下一次
65
+ 准入/启动时可被释放。
66
+ 状态视图还会列出最近 5 条中途汇报(`Recent reports:`,含时间、sender、kind、summary/message);
67
+ not-watched(`DEVLEAD_NOT_SUPERVISED`)/ rate-limited / 参数错误都会转成友好命令文本。命令本身不发送汇报;已关注会话
68
+ 使用 `devlead_report` 工具。已归档 DevLead 占用者不再阻塞 `/devlead on`:准入把它视为非 active,
69
+ mode-off 写不掉时记录 durable tombstone;`/devlead status` 的
70
+ `Archived DevLead holders (ignored for admission)` 会列出它并提示 unarchive + `/devlead off`
71
+ 或删除,打开后 reconciliation 会消除双活。
45
72
  0.2.0 起 `/devlead reset`(以及冻结时 `/devlead off`)追加 `plugin:devlead/reset` 记录并解冻
46
- 损坏的 fold;reset 会丢弃该会话的 watch 集合与通知 digest。命令按 DSH `rawInput` 契约解析,
73
+ 损坏的 fold;reset 会丢弃该会话的关注集合与通知 digest。命令按 DSH `rawInput` 契约解析,
47
74
  不接受附件,前缀引用在变更前由 core 穷尽验证,变更后的标题与正文来自同一 post-mutation 快照。完整中文文档见
48
75
  [根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与[设计说明](https://github.com/yankeguo/dsh-devlead/blob/main/docs/DESIGN.md)。
package/lib/index.js CHANGED
@@ -120,6 +120,7 @@ function parseDevLeadCommand(rawInput) {
120
120
  import {
121
121
  formatInstant,
122
122
  notificationLine,
123
+ reportLine,
123
124
  transitionLabel
124
125
  } from "@yankeguo/dsh-devlead-protocol";
125
126
 
@@ -172,6 +173,7 @@ function formatCandidates(candidates) {
172
173
 
173
174
  // packages/command/src/render.ts
174
175
  var RECENT_NOTIFICATION_LIMIT = 5;
176
+ var RECENT_REPORT_LIMIT = 5;
175
177
  var HELP_LINE = "Help: /devlead (status) | /devlead on | /devlead off | /devlead reset | /devlead watch <session> | /devlead unwatch <session>";
176
178
  function modeLabel(enabled) {
177
179
  return enabled ? "on" : "off";
@@ -208,12 +210,32 @@ function notificationLines(snapshot) {
208
210
  }
209
211
  return lines;
210
212
  }
213
+ function archivedOccupantLines(snapshot) {
214
+ if (snapshot.archivedOccupants.length === 0) return [];
215
+ return [
216
+ `Archived DevLead holders (ignored for admission): ${String(snapshot.archivedOccupants.length)}`,
217
+ ...snapshot.archivedOccupants.map((occupant) => {
218
+ const label = occupant.title === void 0 ? occupant.sessionId : `${occupant.title} (${occupant.sessionId})`;
219
+ return ` - ${label} \u2014 unarchive and run /devlead off, or delete it`;
220
+ })
221
+ ];
222
+ }
223
+ function reportLines(snapshot) {
224
+ if (snapshot.reports.length === 0) return ["Recent reports: none"];
225
+ const lines = ["Recent reports:"];
226
+ for (const report of snapshot.reports) {
227
+ lines.push(` - ${formatInstant(report.at)} ${reportLine(report)}`);
228
+ }
229
+ return lines;
230
+ }
211
231
  function statusLines(snapshot) {
212
232
  const lines = [
213
233
  `DevLead mode: ${modeLabel(snapshot.enabled)}`,
214
234
  `Worktree isolation: ${snapshot.worktreeIsolation ? "available" : "unavailable"}`,
215
235
  ...watchedLines(snapshot),
216
- ...notificationLines(snapshot)
236
+ ...archivedOccupantLines(snapshot),
237
+ ...notificationLines(snapshot),
238
+ ...reportLines(snapshot)
217
239
  ];
218
240
  if (!snapshot.enabled) {
219
241
  lines.push(
@@ -253,12 +275,15 @@ async function collectStatus(ctx, invocation) {
253
275
  else watched.push(session);
254
276
  }
255
277
  }
278
+ const archivedOccupants = await ctx.devLead.archivedOccupants(invocation.signal);
256
279
  return {
257
280
  enabled: view.enabled,
258
281
  worktreeIsolation: ctx.devLead.worktreeIsolationAvailable,
259
282
  watched,
260
283
  missingWatched,
261
- notifications: view.notifications.slice(-RECENT_NOTIFICATION_LIMIT)
284
+ archivedOccupants,
285
+ notifications: view.notifications.slice(-RECENT_NOTIFICATION_LIMIT),
286
+ reports: view.reports.slice(-RECENT_REPORT_LIMIT)
262
287
  };
263
288
  }
264
289
  async function collectCandidates(ctx, invocation, watchedSessionIds) {
@@ -370,6 +395,11 @@ function friendlyDevLeadError(error) {
370
395
  switch (error.code) {
371
396
  case "DEVLEAD_NOT_ENABLED":
372
397
  return NOT_ENABLED_MESSAGE;
398
+ case "DEVLEAD_ALREADY_ACTIVE":
399
+ return error.message;
400
+ case "DEVLEAD_NOT_SUPERVISED":
401
+ case "DEVLEAD_REPORT_RATE_LIMITED":
402
+ return error.message;
373
403
  case "DEVLEAD_AGENT_NOT_LIVE":
374
404
  return "This Session is no longer live in this Host, so the command cannot run. Open it again from the sidebar and retry.";
375
405
  case "DEVLEAD_INVALID_INPUT":
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead 命令",
4
- "description": "面向人类的 /devlead 命令:开启或关闭 DevLead 模式、监督或取消监督会话、重置损坏状态,并显示状态视图。"
4
+ "description": "面向人类的 /devlead 命令:开启或关闭 DevLead 模式、关注或取消关注会话、重置损坏状态,并显示状态视图。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yankeguo/dsh-command-devlead",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Human-facing /devlead command: enable or disable DevLead mode for the current session and inspect the lead's managed workspaces, sessions, and notifications.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,8 +20,8 @@
20
20
  "@deepseek-ai/dsh-commands": ">=0.2.2-rc.1 <0.3.0"
21
21
  },
22
22
  "dependencies": {
23
- "@yankeguo/dsh-devlead": "0.2.4",
24
- "@yankeguo/dsh-devlead-protocol": "0.2.4"
23
+ "@yankeguo/dsh-devlead": "0.2.6",
24
+ "@yankeguo/dsh-devlead-protocol": "0.2.6"
25
25
  },
26
26
  "engines": {
27
27
  "dsh": ">=0.2.2-rc.1 <0.3.0"