@yankeguo/dsh-command-devlead 0.2.2 → 0.2.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/README.md +2 -2
- package/lib/index.js +54 -14
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @yankeguo/dsh-command-devlead
|
|
2
2
|
|
|
3
|
-
The human-facing `/devlead` command behind the
|
|
3
|
+
The human-facing `/devlead` command behind the composer-toolbar toggle; it also owns watch-set changes,
|
|
4
4
|
damage recovery, and the human-readable status view. The status output includes
|
|
5
5
|
`Worktree isolation: available|unavailable` so a human can see whether the optional
|
|
6
6
|
checkout-isolation capability is composed.
|
|
@@ -41,7 +41,7 @@ dsh plugin --profile desktop add @yankeguo/dsh-devlead-bundle
|
|
|
41
41
|
|
|
42
42
|
## 中文
|
|
43
43
|
|
|
44
|
-
`@yankeguo/dsh-command-devlead` 提供人类 `/devlead`
|
|
44
|
+
`@yankeguo/dsh-command-devlead` 提供人类 `/devlead` 命令:模式状态、reset、watch/unwatch。
|
|
45
45
|
0.2.0 起 `/devlead reset`(以及冻结时 `/devlead off`)追加 `plugin:devlead/reset` 记录并解冻
|
|
46
46
|
损坏的 fold;reset 会丢弃该会话的 watch 集合与通知 digest。命令按 DSH `rawInput` 契约解析,
|
|
47
47
|
不接受附件,前缀引用在变更前由 core 穷尽验证,变更后的标题与正文来自同一 post-mutation 快照。完整中文文档见
|
package/lib/index.js
CHANGED
|
@@ -17,35 +17,66 @@ function splitHead(input) {
|
|
|
17
17
|
if (separator === -1) return { head: input.toLowerCase(), rest: "" };
|
|
18
18
|
return { head: input.slice(0, separator).toLowerCase(), rest: input.slice(separator).trim() };
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
var QUOTE_PAIRS = [
|
|
21
|
+
['"', '"'],
|
|
22
|
+
["'", "'"],
|
|
23
|
+
["\u201C", "\u201D"],
|
|
24
|
+
["\u2018", "\u2019"],
|
|
25
|
+
["\u300C", "\u300D"],
|
|
26
|
+
["\u300E", "\u300F"],
|
|
27
|
+
["\uFF02", "\uFF02"]
|
|
28
|
+
];
|
|
29
|
+
function closingQuoteOf(opening) {
|
|
30
|
+
return QUOTE_PAIRS.find(([open]) => open === opening)?.[1];
|
|
31
|
+
}
|
|
32
|
+
function isClosingQuote(value) {
|
|
33
|
+
return QUOTE_PAIRS.some(([, close]) => close === value);
|
|
27
34
|
}
|
|
28
35
|
function unexpectedArgument(subcommand) {
|
|
29
36
|
return invalid(`The /devlead ${subcommand} subcommand does not take an argument.`);
|
|
30
37
|
}
|
|
31
38
|
function parseSessionArgument(subcommand, text) {
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
39
|
+
const raw = text.trim();
|
|
40
|
+
if (raw.length === 0) {
|
|
34
41
|
return invalid(
|
|
35
42
|
`/devlead ${subcommand} requires a Session id or a unique id prefix. Run /devlead to inspect the current watch set.`
|
|
36
43
|
);
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
const closer = closingQuoteOf(raw[0] ?? "");
|
|
46
|
+
if (closer !== void 0) {
|
|
47
|
+
const end = raw.indexOf(closer, 1);
|
|
48
|
+
if (end === -1) {
|
|
49
|
+
return invalid(
|
|
50
|
+
`The /devlead ${subcommand} Session reference has an unmatched quote; wrap the whole reference in one matching pair of quotes.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (raw.slice(end + 1).trim().length > 0) {
|
|
54
|
+
return invalid(
|
|
55
|
+
`"/devlead ${subcommand}" takes exactly one Session reference; unexpected text follows the quoted reference.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const session = raw.slice(1, end).trim();
|
|
59
|
+
if (session.length === 0) {
|
|
60
|
+
return invalid(`/devlead ${subcommand} requires a Session id or a unique id prefix.`);
|
|
61
|
+
}
|
|
62
|
+
if (/\s/u.test(session)) {
|
|
63
|
+
return invalid(
|
|
64
|
+
`"/devlead ${subcommand}" takes one Session reference without spaces; pass the full Session id or a unique id prefix.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return { kind: subcommand, session };
|
|
68
|
+
}
|
|
69
|
+
if (isClosingQuote(raw[raw.length - 1] ?? "")) {
|
|
39
70
|
return invalid(
|
|
40
71
|
`The /devlead ${subcommand} Session reference has an unmatched quote; wrap the whole reference in one matching pair of quotes.`
|
|
41
72
|
);
|
|
42
73
|
}
|
|
43
|
-
if (/\s/u.test(
|
|
74
|
+
if (/\s/u.test(raw)) {
|
|
44
75
|
return invalid(
|
|
45
76
|
`"/devlead ${subcommand}" takes one Session reference without spaces; pass the full Session id or a unique id prefix.`
|
|
46
77
|
);
|
|
47
78
|
}
|
|
48
|
-
return { kind: subcommand, session };
|
|
79
|
+
return { kind: subcommand, session: raw };
|
|
49
80
|
}
|
|
50
81
|
function parseDevLeadCommand(rawInput) {
|
|
51
82
|
const input = rawInput.trim();
|
|
@@ -76,6 +107,11 @@ function parseDevLeadCommand(rawInput) {
|
|
|
76
107
|
case "reset":
|
|
77
108
|
return unexpectedArgument(head);
|
|
78
109
|
default:
|
|
110
|
+
if (head === `/${DEVLEAD_COMMAND_NAME.toLowerCase()}`) {
|
|
111
|
+
return invalid(
|
|
112
|
+
'Pass only the text after the command name (for example "on"), not the full /devlead line.'
|
|
113
|
+
);
|
|
114
|
+
}
|
|
79
115
|
return invalid(`Unknown /devlead subcommand "${head}".`);
|
|
80
116
|
}
|
|
81
117
|
}
|
|
@@ -144,7 +180,7 @@ function sessionLabel(view) {
|
|
|
144
180
|
return sessionRefLabel(view.sessionId, view.title);
|
|
145
181
|
}
|
|
146
182
|
function sessionStateLabel(view) {
|
|
147
|
-
const state = view.archived ? "archived" : view.running ? "running" : view.live ? "idle" : "cold";
|
|
183
|
+
const state = view.archived ? view.running ? "archived (running)" : "archived" : view.running ? "running" : view.live ? "idle" : "cold";
|
|
148
184
|
const parts = [state];
|
|
149
185
|
if (view.running && (view.pendingInputs ?? 0) > 0) parts.push(`${view.pendingInputs} queued`);
|
|
150
186
|
if (view.lastTurn !== void 0) {
|
|
@@ -157,7 +193,7 @@ function sessionStateLabel(view) {
|
|
|
157
193
|
function watchedLines(snapshot) {
|
|
158
194
|
const total = snapshot.watched.length + snapshot.missingWatched.length;
|
|
159
195
|
if (total === 0) return ["Watched sessions: none"];
|
|
160
|
-
const running = snapshot.watched.filter((view) => view.running).length;
|
|
196
|
+
const running = snapshot.watched.filter((view) => view.running && !view.archived).length;
|
|
161
197
|
const summary = running === 0 ? `Watched sessions: ${total}` : `Watched sessions: ${total} (${running} running)`;
|
|
162
198
|
const lines = [summary];
|
|
163
199
|
for (const view of snapshot.watched) lines.push(` - ${sessionLabel(view)} \u2014 ${sessionStateLabel(view)}`);
|
|
@@ -356,6 +392,10 @@ function friendlyDevLeadError(error) {
|
|
|
356
392
|
return `The Workspace could not be resolved: ${error.message}`;
|
|
357
393
|
case "DEVLEAD_DIRECTORY_MISSING":
|
|
358
394
|
return `The target directory is missing: ${error.message}`;
|
|
395
|
+
case "DEVLEAD_MODEL_UNAVAILABLE":
|
|
396
|
+
return `The requested model is not available on this Host: ${error.message}. Use a provider/model pair the Host advertises, or omit it to use the Host default.`;
|
|
397
|
+
case "DEVLEAD_TEAM_UNAVAILABLE":
|
|
398
|
+
return `Agent Teams is not available on this Host: ${error.message}. Omit agent_teams, or use a Host composition that includes the Agent Teams service.`;
|
|
359
399
|
default: {
|
|
360
400
|
const unknownCode = error.code;
|
|
361
401
|
return `The DevLead request failed (${String(unknownCode)}): ${error.message}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-command-devlead",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@deepseek-ai/cordis": "~4.1.0",
|
|
20
|
-
"@deepseek-ai/dsh-commands": "0.2.2-rc.1"
|
|
20
|
+
"@deepseek-ai/dsh-commands": ">=0.2.2-rc.1 <0.3.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@yankeguo/dsh-devlead": "0.2.
|
|
24
|
-
"@yankeguo/dsh-devlead-protocol": "0.2.
|
|
23
|
+
"@yankeguo/dsh-devlead": "0.2.4",
|
|
24
|
+
"@yankeguo/dsh-devlead-protocol": "0.2.4"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"dsh": ">=0.2.2-rc.1 <0.3.0"
|