@yankeguo/dsh-client-ui-devlead 0.3.0-rc.1 → 0.3.0-rc.2
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/lib/client.js +30 -8
- package/package.json +3 -2
package/lib/client.js
CHANGED
|
@@ -62,7 +62,7 @@ window.__ModuleLoader__.load({
|
|
|
62
62
|
return typeof value === "string" && TRANSITION_SET.has(value);
|
|
63
63
|
}
|
|
64
64
|
function excerptLine(text, max) {
|
|
65
|
-
const collapsed = text.replace(/\s+/gu, " ").trim();
|
|
65
|
+
const collapsed = text.replace(/\s+/gu, " ").replace(/[\u0000-\u001f\u007f-\u009f]/gu, "").trim();
|
|
66
66
|
if (collapsed.length === 0) return void 0;
|
|
67
67
|
const budget = Number.isFinite(max) ? Math.floor(max) : Number.POSITIVE_INFINITY;
|
|
68
68
|
if (budget < 1) return void 0;
|
|
@@ -134,19 +134,23 @@ window.__ModuleLoader__.load({
|
|
|
134
134
|
const turn = Number.isInteger(notification.turn) && notification.turn > 0 ? notification.turn : 0;
|
|
135
135
|
const tooltip = isDevLeadTransition(notification.transition) ? notificationLine(notification) : `${who} \u2014 ${String(notification.transition)}`;
|
|
136
136
|
const error = typeof notification.error === "string" ? excerptLine(notification.error, DEVLEAD_ERROR_EXCERPT_MAX) : void 0;
|
|
137
|
+
const summary = typeof notification.summary === "string" ? excerptLine(notification.summary, DEVLEAD_ERROR_EXCERPT_MAX) : void 0;
|
|
137
138
|
return {
|
|
138
139
|
tooltip,
|
|
139
140
|
who,
|
|
140
141
|
turn,
|
|
141
142
|
transition: String(notification.transition),
|
|
142
143
|
labelKey: transitionLabelKey(notification.transition),
|
|
143
|
-
error
|
|
144
|
+
error,
|
|
145
|
+
summary
|
|
144
146
|
};
|
|
145
147
|
}
|
|
146
148
|
function latestNotification(notifications) {
|
|
149
|
+
if (!Array.isArray(notifications)) return null;
|
|
147
150
|
return notifications.at(-1) ?? null;
|
|
148
151
|
}
|
|
149
152
|
function summarizeWatched(watchedSessions, rows, statuses) {
|
|
153
|
+
if (!Array.isArray(watchedSessions)) return { watched: 0, running: 0, missing: 0 };
|
|
150
154
|
const seen = /* @__PURE__ */ new Set();
|
|
151
155
|
let running = 0;
|
|
152
156
|
let missing = 0;
|
|
@@ -188,25 +192,32 @@ window.__ModuleLoader__.load({
|
|
|
188
192
|
};
|
|
189
193
|
}
|
|
190
194
|
function latestReport(reports) {
|
|
195
|
+
if (!Array.isArray(reports)) return null;
|
|
191
196
|
return reports.at(-1) ?? null;
|
|
192
197
|
}
|
|
193
198
|
|
|
194
199
|
// packages/client-ui/src/client/DevLeadBar.tsx
|
|
195
200
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
196
201
|
function DevLeadBar({
|
|
202
|
+
useSession,
|
|
197
203
|
useProjection,
|
|
198
204
|
useSessions,
|
|
199
205
|
useSessionStatus,
|
|
200
206
|
t
|
|
201
207
|
}) {
|
|
208
|
+
const subagent = useSession((snapshot) => snapshot.subagent !== null) ?? false;
|
|
202
209
|
const projection = useProjection(DEVLEAD_PROJECTION_KEY);
|
|
203
210
|
const rows = useSessions((state) => state.byId);
|
|
204
211
|
const statuses = useSessionStatus((current) => current);
|
|
205
212
|
const enabled = projection?.enabled ?? false;
|
|
213
|
+
if (subagent) return null;
|
|
206
214
|
if (projection === void 0 || !enabled) return null;
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const
|
|
215
|
+
const watchedSessions = Array.isArray(projection.sessions) ? projection.sessions : [];
|
|
216
|
+
const notifications = Array.isArray(projection.notifications) ? projection.notifications : [];
|
|
217
|
+
const reports = Array.isArray(projection.reports) ? projection.reports : [];
|
|
218
|
+
const summary = summarizeWatched(watchedSessions, rows, statuses);
|
|
219
|
+
const latest = latestNotification(notifications);
|
|
220
|
+
const latestRep = latestReport(reports);
|
|
210
221
|
const showReport = latestRep !== null && (latest === null || epochMillis(latestRep.at) >= epochMillis(latest.at));
|
|
211
222
|
const notice = !showReport && latest !== null ? notificationSummary(latest) : null;
|
|
212
223
|
const reportNotice = showReport && latestRep !== null ? reportSummary(latestRep) : null;
|
|
@@ -277,7 +288,14 @@ window.__ModuleLoader__.load({
|
|
|
277
288
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: notice.who }),
|
|
278
289
|
notice.turn > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-turn", children: t("notification.turn", { turn: notice.turn }) }),
|
|
279
290
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(notice.labelKey) }),
|
|
280
|
-
notice.error !== void 0
|
|
291
|
+
notice.error !== void 0 ? (
|
|
292
|
+
// Only a real Host failure excerpt wears the error ink.
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: notice.error })
|
|
294
|
+
) : notice.summary !== void 0 ? (
|
|
295
|
+
// A settled turn's assistant excerpt is neutral detail, like a
|
|
296
|
+
// report's summary: the dot and label carry the outcome.
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-detail", children: notice.summary })
|
|
298
|
+
) : null
|
|
281
299
|
] })
|
|
282
300
|
}
|
|
283
301
|
)
|
|
@@ -332,11 +350,13 @@ window.__ModuleLoader__.load({
|
|
|
332
350
|
};
|
|
333
351
|
var ALREADY_ACTIVE_PREFIX = "Another Session is already in DevLead mode: ";
|
|
334
352
|
var ALREADY_ACTIVE_INSTRUCTION = ". Run /devlead off there first";
|
|
353
|
+
var ALREADY_ACTIVE_TAIL = `${ALREADY_ACTIVE_INSTRUCTION}, then enable this Session.`;
|
|
335
354
|
function alreadyActiveDetails(message) {
|
|
336
355
|
if (!message.startsWith(ALREADY_ACTIVE_PREFIX)) return void 0;
|
|
337
356
|
const rest = message.slice(ALREADY_ACTIVE_PREFIX.length);
|
|
338
|
-
const end = rest.
|
|
357
|
+
const end = rest.lastIndexOf(ALREADY_ACTIVE_INSTRUCTION);
|
|
339
358
|
if (end <= 0) return void 0;
|
|
359
|
+
if (rest.slice(end) !== ALREADY_ACTIVE_TAIL) return void 0;
|
|
340
360
|
const session = rest.slice(0, end).trim();
|
|
341
361
|
return session.length === 0 ? void 0 : { session };
|
|
342
362
|
}
|
|
@@ -408,11 +428,13 @@ window.__ModuleLoader__.load({
|
|
|
408
428
|
|
|
409
429
|
// packages/client-ui/src/client/DevLeadIconToggle.tsx
|
|
410
430
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
411
|
-
function DevLeadIconToggle({ useProjection, executeCommand, t }) {
|
|
431
|
+
function DevLeadIconToggle({ useSession, useProjection, executeCommand, t }) {
|
|
432
|
+
const subagent = useSession((snapshot) => snapshot.subagent !== null) ?? false;
|
|
412
433
|
const projection = useProjection(DEVLEAD_PROJECTION_KEY);
|
|
413
434
|
const enabled = projection?.enabled ?? false;
|
|
414
435
|
const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
|
|
415
436
|
const [attempt, setAttempt] = (0, import_react2.useState)("on");
|
|
437
|
+
if (subagent) return null;
|
|
416
438
|
if (projection === void 0) return null;
|
|
417
439
|
const direction = enabled ? "off" : "on";
|
|
418
440
|
const failureText = failure === null ? null : failureMessage(failure, t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-client-ui-devlead",
|
|
3
|
-
"version": "0.3.0-rc.
|
|
3
|
+
"version": "0.3.0-rc.2",
|
|
4
4
|
"description": "DevLead surfaces: the composer-toolbar toggle that switches the mode on or off, the status strip above the composer while the mode is on, and a DevLead mark on the Session's sidebar row.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"./package.json": "./package.json"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
+
"LICENSE",
|
|
15
16
|
"lib",
|
|
16
17
|
"locale/*.json",
|
|
17
18
|
"README.md"
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"@deepseek-ai/cordis": "~4.1.0"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@yankeguo/dsh-devlead-protocol": "0.3.0-rc.
|
|
39
|
+
"@yankeguo/dsh-devlead-protocol": "0.3.0-rc.2"
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
42
|
"dsh": ">=0.2.2-rc.1 <0.3.0"
|