@yankeguo/dsh-client-ui-devlead 0.4.0 → 0.4.2-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 CHANGED
@@ -29,6 +29,7 @@ window.__ModuleLoader__.load({
29
29
  inject: () => inject
30
30
  });
31
31
  module.exports = __toCommonJS(index_exports);
32
+ var import_dsh_client_ui_primitives7 = require("@deepseek-ai/dsh-client-ui-primitives");
32
33
 
33
34
  // packages/client-ui/src/client/DevLeadBar.tsx
34
35
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
@@ -115,6 +116,112 @@ window.__ModuleLoader__.load({
115
116
  return `${who} \u2014 report ${kind}${suffix}`;
116
117
  }
117
118
 
119
+ // packages/protocol/src/board.ts
120
+ var import_zod = require("zod");
121
+ var DEVLEAD_BOARD_SCHEMA_VERSION = 1;
122
+ var DEVLEAD_BOARD_DIR_SEGMENTS = [".dsh", "devlead"];
123
+ var DEVLEAD_BOARD_FILE_NAME = "board.json";
124
+ var DEVLEAD_BOARD_MAX_BYTES = 256 * 1024;
125
+ var DEVLEAD_BOARD_READ_MAX_BYTES = 64 * 1024;
126
+ var DEVLEAD_BOARD_MAX_PROJECTS = 50;
127
+ var DEVLEAD_BOARD_MAX_TASKS = 200;
128
+ var DEVLEAD_BOARD_MAX_BLOCKERS = 50;
129
+ var DEVLEAD_BOARD_TEXT_MAX = 4e3;
130
+ var DEVLEAD_BOARD_ID_MAX = 128;
131
+ var DEVLEAD_BOARD_TITLE_MAX = 200;
132
+ var DEVLEAD_BOARD_PATH_MAX = 4096;
133
+ var DEVLEAD_BOARD_TIMESTAMP_MAX = 64;
134
+ function pointerSegment(value) {
135
+ return String(value).replaceAll("~", "~0").replaceAll("/", "~1");
136
+ }
137
+ function devLeadBoardIssuePointer(path) {
138
+ return path.length === 0 ? "" : `/${path.map(pointerSegment).join("/")}`;
139
+ }
140
+ function devLeadBoardIssueViews(issues) {
141
+ return issues.map((issue) => ({
142
+ pointer: devLeadBoardIssuePointer(issue.path),
143
+ message: issue.message
144
+ }));
145
+ }
146
+ var idSchema = import_zod.z.string().min(1).max(DEVLEAD_BOARD_ID_MAX);
147
+ var titleSchema = import_zod.z.string().min(1).max(DEVLEAD_BOARD_TITLE_MAX);
148
+ var textSchema = import_zod.z.string().max(DEVLEAD_BOARD_TEXT_MAX);
149
+ var timestampSchema = import_zod.z.string().max(DEVLEAD_BOARD_TIMESTAMP_MAX).pipe(import_zod.z.iso.datetime());
150
+ var blockerSchema = import_zod.z.object({
151
+ id: idSchema,
152
+ text: import_zod.z.string().min(1).max(DEVLEAD_BOARD_TEXT_MAX),
153
+ since: timestampSchema,
154
+ sessionId: idSchema.optional()
155
+ }).strict();
156
+ var taskSchema = import_zod.z.object({
157
+ id: idSchema,
158
+ title: import_zod.z.string().min(1).max(DEVLEAD_BOARD_TEXT_MAX),
159
+ status: import_zod.z.enum(["todo", "doing", "blocked", "done"]),
160
+ ownerSessionId: idSchema.optional(),
161
+ updatedAt: timestampSchema
162
+ }).strict();
163
+ function createDevLeadBoardSchema(isAbsolutePath) {
164
+ const projectSchema = import_zod.z.object({
165
+ id: idSchema,
166
+ workspace: import_zod.z.object({
167
+ path: import_zod.z.string().min(1).max(DEVLEAD_BOARD_PATH_MAX).refine(isAbsolutePath, {
168
+ message: "workspace path must be absolute"
169
+ }),
170
+ title: titleSchema
171
+ }).strict(),
172
+ status: import_zod.z.enum(["active", "blocked", "paused", "done"]),
173
+ priority: import_zod.z.enum(["low", "medium", "high"]),
174
+ goal: textSchema,
175
+ focus: textSchema,
176
+ next: textSchema,
177
+ blockers: import_zod.z.array(blockerSchema).max(DEVLEAD_BOARD_MAX_BLOCKERS),
178
+ tasks: import_zod.z.array(taskSchema).max(DEVLEAD_BOARD_MAX_TASKS),
179
+ updatedAt: timestampSchema
180
+ }).strict();
181
+ const boardSchema = import_zod.z.object({
182
+ schemaVersion: import_zod.z.literal(DEVLEAD_BOARD_SCHEMA_VERSION),
183
+ revision: import_zod.z.number().int().nonnegative().safe(),
184
+ updatedAt: timestampSchema,
185
+ updatedBy: import_zod.z.object({ sessionId: idSchema, title: titleSchema }).strict(),
186
+ projects: import_zod.z.array(projectSchema).max(DEVLEAD_BOARD_MAX_PROJECTS)
187
+ }).strict().superRefine((board, context) => {
188
+ const projectIds = /* @__PURE__ */ new Set();
189
+ const workspacePaths = /* @__PURE__ */ new Set();
190
+ board.projects.forEach((project, projectIndex) => {
191
+ if (projectIds.has(project.id)) {
192
+ context.addIssue({
193
+ code: "custom",
194
+ path: ["projects", projectIndex, "id"],
195
+ message: `duplicate project id "${project.id}"`
196
+ });
197
+ }
198
+ projectIds.add(project.id);
199
+ if (workspacePaths.has(project.workspace.path)) {
200
+ context.addIssue({
201
+ code: "custom",
202
+ path: ["projects", projectIndex, "workspace", "path"],
203
+ message: `duplicate workspace path "${project.workspace.path}"`
204
+ });
205
+ }
206
+ workspacePaths.add(project.workspace.path);
207
+ for (const [field, entries] of [["blockers", project.blockers], ["tasks", project.tasks]]) {
208
+ const ids = /* @__PURE__ */ new Set();
209
+ entries.forEach((entry, entryIndex) => {
210
+ if (ids.has(entry.id)) {
211
+ context.addIssue({
212
+ code: "custom",
213
+ path: ["projects", projectIndex, field, entryIndex, "id"],
214
+ message: `duplicate ${field} id "${entry.id}"`
215
+ });
216
+ }
217
+ ids.add(entry.id);
218
+ });
219
+ }
220
+ });
221
+ });
222
+ return boardSchema;
223
+ }
224
+
118
225
  // packages/client-ui/src/client/format.ts
119
226
  var TRANSITION_LABEL_KEYS = {
120
227
  completed: "transition.completed",
@@ -399,10 +506,688 @@ window.__ModuleLoader__.load({
399
506
  );
400
507
  }
401
508
 
402
- // packages/client-ui/src/client/DevLeadIconToggle.tsx
403
- var import_react2 = require("react");
509
+ // packages/client-ui/src/client/DevLeadBoardButton.tsx
404
510
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
405
511
 
512
+ // packages/client-ui/src/client/sessionMark.ts
513
+ function devLeadRowEnabled(summary) {
514
+ return summary?.projectionValues?.[DEVLEAD_MODE_PROJECTION_KEY]?.enabled === true;
515
+ }
516
+ function devLeadRowSummaryOf(byId, sessionId) {
517
+ return Object.hasOwn(byId, sessionId) ? byId[sessionId] : void 0;
518
+ }
519
+ var watchedIdsCache = /* @__PURE__ */ new WeakMap();
520
+ function watchedIdsOf(byId) {
521
+ const cached = watchedIdsCache.get(byId);
522
+ if (cached !== void 0) return cached;
523
+ const watched = /* @__PURE__ */ new Set();
524
+ for (const [leadId, lead] of Object.entries(byId)) {
525
+ if (!devLeadRowEnabled(lead)) continue;
526
+ const sessions = lead?.projectionValues?.[DEVLEAD_WATCH_PROJECTION_KEY]?.sessions;
527
+ if (!Array.isArray(sessions)) continue;
528
+ for (const candidate of sessions) {
529
+ if (typeof candidate !== "string" || candidate.length === 0 || candidate === leadId) continue;
530
+ watched.add(candidate);
531
+ }
532
+ }
533
+ watchedIdsCache.set(byId, watched);
534
+ return watched;
535
+ }
536
+ function devLeadRowWatched(sessionId, byId) {
537
+ if (devLeadRowEnabled(devLeadRowSummaryOf(byId, sessionId))) return false;
538
+ return watchedIdsOf(byId).has(sessionId);
539
+ }
540
+
541
+ // packages/client-ui/src/client/board.ts
542
+ var DEVLEAD_BOARD_GLOBAL = "__DSH_DEVLEAD_BOARD__";
543
+ var DEVLEAD_BOARD_TAB_KIND = "devlead-board";
544
+ var DEVLEAD_BOARD_TAB_ID = "@yankeguo/dsh-client-ui-devlead/board";
545
+ function isAbsoluteWorkspacePath(value, platform) {
546
+ if (platform === "win32") {
547
+ return /^(?:[\\/]|[A-Za-z]:[\\/])/u.test(value);
548
+ }
549
+ return value.startsWith("/");
550
+ }
551
+ var schemas = /* @__PURE__ */ new Map();
552
+ function devLeadBoardSchemaFor(platform = "posix") {
553
+ const cached = schemas.get(platform);
554
+ if (cached !== void 0) return cached;
555
+ const schema = createDevLeadBoardSchema((value) => isAbsoluteWorkspacePath(value, platform));
556
+ schemas.set(platform, schema);
557
+ return schema;
558
+ }
559
+ var devLeadBoardSchema = devLeadBoardSchemaFor();
560
+ var DevLeadBoardParseError = class extends Error {
561
+ constructor(message, options) {
562
+ super(message, options);
563
+ this.name = "DevLeadBoardParseError";
564
+ }
565
+ };
566
+ function readDevLeadBoardConfig(value) {
567
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
568
+ const record = value;
569
+ if (record.schemaVersion !== DEVLEAD_BOARD_SCHEMA_VERSION) return void 0;
570
+ if (record.pathPlatform !== "posix" && record.pathPlatform !== "win32") return void 0;
571
+ if (typeof record.boardPath !== "string" || record.boardPath.trim().length === 0) return void 0;
572
+ if (record.boardPath.length > DEVLEAD_BOARD_PATH_MAX || !isAbsoluteWorkspacePath(record.boardPath, record.pathPlatform)) return void 0;
573
+ if (record.leadSessionId !== void 0) {
574
+ if (typeof record.leadSessionId !== "string" || record.leadSessionId.length === 0) return void 0;
575
+ }
576
+ if (record.override !== void 0 && typeof record.override !== "boolean") return void 0;
577
+ return {
578
+ boardPath: record.boardPath,
579
+ schemaVersion: DEVLEAD_BOARD_SCHEMA_VERSION,
580
+ pathPlatform: record.pathPlatform,
581
+ ...record.leadSessionId === void 0 ? {} : { leadSessionId: record.leadSessionId },
582
+ ...record.override === void 0 ? {} : { override: record.override }
583
+ };
584
+ }
585
+ function currentDevLeadBoardConfig() {
586
+ return readDevLeadBoardConfig(globalThis[DEVLEAD_BOARD_GLOBAL]);
587
+ }
588
+ function detectDevLeadBoardPathPlatform(cwd) {
589
+ if (cwd.startsWith("/")) return "posix";
590
+ if (cwd.startsWith("\\") || /^[A-Za-z]:/u.test(cwd)) return "win32";
591
+ return void 0;
592
+ }
593
+ function joinDevLeadBoardPath(cwd, platform) {
594
+ const segments = [...DEVLEAD_BOARD_DIR_SEGMENTS, DEVLEAD_BOARD_FILE_NAME];
595
+ return platform === "win32" ? joinWin32Path(cwd, segments) : joinPosixPath(cwd, segments);
596
+ }
597
+ function joinPosixPath(cwd, segments) {
598
+ const parts = [];
599
+ for (const part of `${cwd}/${segments.join("/")}`.split("/")) {
600
+ if (part.length === 0 || part === ".") continue;
601
+ if (part === "..") {
602
+ parts.pop();
603
+ continue;
604
+ }
605
+ parts.push(part);
606
+ }
607
+ return `/${parts.join("/")}`;
608
+ }
609
+ function joinWin32Path(cwd, segments) {
610
+ const path = `${cwd.replaceAll("/", "\\")}\\${segments.join("\\")}`;
611
+ let prefix;
612
+ let rest;
613
+ const drive = /^[A-Za-z]:\\/u.exec(path);
614
+ if (drive !== null) {
615
+ prefix = drive[0];
616
+ rest = path.slice(3);
617
+ } else if (path.startsWith("\\\\")) {
618
+ prefix = "\\\\";
619
+ rest = path.slice(2);
620
+ } else {
621
+ prefix = "\\";
622
+ rest = path.slice(1);
623
+ }
624
+ const parts = [];
625
+ for (const part of rest.split("\\")) {
626
+ if (part.length === 0 || part === ".") continue;
627
+ if (part === "..") {
628
+ parts.pop();
629
+ continue;
630
+ }
631
+ parts.push(part);
632
+ }
633
+ return `${prefix}${parts.join("\\")}`;
634
+ }
635
+ function boardConfigOf(global) {
636
+ return {
637
+ boardPath: global.boardPath,
638
+ schemaVersion: DEVLEAD_BOARD_SCHEMA_VERSION,
639
+ pathPlatform: global.pathPlatform
640
+ };
641
+ }
642
+ function resolveDevLeadBoardConfig({ sessionId, cwd, global }) {
643
+ if (global !== void 0) {
644
+ if (global.override === true) return boardConfigOf(global);
645
+ if (global.leadSessionId !== void 0) {
646
+ if (global.leadSessionId === sessionId) return boardConfigOf(global);
647
+ } else if (global.override === void 0) {
648
+ return boardConfigOf(global);
649
+ }
650
+ }
651
+ const root = cwd?.trim() ?? "";
652
+ if (root.length === 0) return void 0;
653
+ const platform = global?.pathPlatform ?? detectDevLeadBoardPathPlatform(root);
654
+ if (platform === void 0 || !isAbsoluteWorkspacePath(root, platform)) return void 0;
655
+ return {
656
+ boardPath: joinDevLeadBoardPath(root, platform),
657
+ schemaVersion: DEVLEAD_BOARD_SCHEMA_VERSION,
658
+ pathPlatform: platform
659
+ };
660
+ }
661
+ function resolveDevLeadBoardSessionConfig(sessionId, row, global) {
662
+ if (row === void 0 || row.origin === "subagent" || !devLeadRowEnabled(row)) return void 0;
663
+ return resolveDevLeadBoardConfig({ sessionId, cwd: row.cwd, global });
664
+ }
665
+ function parseDevLeadBoardBytes(bytes, pathPlatform = "posix") {
666
+ if (bytes.byteLength > DEVLEAD_BOARD_MAX_BYTES) {
667
+ throw new DevLeadBoardParseError(`board file exceeds ${DEVLEAD_BOARD_MAX_BYTES} bytes`);
668
+ }
669
+ let text;
670
+ try {
671
+ text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
672
+ } catch (error) {
673
+ throw new DevLeadBoardParseError("board file is not valid UTF-8", { cause: error });
674
+ }
675
+ return parseDevLeadBoard(text, pathPlatform);
676
+ }
677
+ function parseDevLeadBoard(text, pathPlatform = "posix") {
678
+ let value;
679
+ try {
680
+ value = JSON.parse(text);
681
+ } catch (error) {
682
+ throw new DevLeadBoardParseError("board file is not valid JSON", { cause: error });
683
+ }
684
+ const parsed = devLeadBoardSchemaFor(pathPlatform).safeParse(value);
685
+ if (!parsed.success) {
686
+ const first = devLeadBoardIssueViews(parsed.error.issues)[0];
687
+ const pointer = first === void 0 || first.pointer.length === 0 ? "/" : first.pointer;
688
+ throw new DevLeadBoardParseError(
689
+ `board schema v1 validation failed at ${pointer}: ${first?.message ?? "unknown issue"}`,
690
+ { cause: parsed.error }
691
+ );
692
+ }
693
+ return parsed.data;
694
+ }
695
+ var STATUS_ORDER = ["blocked", "active", "paused", "done"];
696
+ var PRIORITY_RANK = { high: 0, medium: 1, low: 2 };
697
+ function compareDevLeadBoardProjects(left, right) {
698
+ return PRIORITY_RANK[left.priority] - PRIORITY_RANK[right.priority] || Date.parse(right.updatedAt) - Date.parse(left.updatedAt) || left.id.localeCompare(right.id);
699
+ }
700
+ function groupDevLeadBoardProjects(board) {
701
+ return STATUS_ORDER.flatMap((status) => {
702
+ const projects = board.projects.filter((project) => project.status === status).sort(compareDevLeadBoardProjects);
703
+ return projects.length === 0 ? [] : [{ status, projects }];
704
+ });
705
+ }
706
+ function projectStatusTone(status) {
707
+ switch (status) {
708
+ case "blocked":
709
+ return "warning";
710
+ case "active":
711
+ return "info";
712
+ case "done":
713
+ return "success";
714
+ case "paused":
715
+ return "neutral";
716
+ }
717
+ }
718
+ function taskStatusTone(status) {
719
+ switch (status) {
720
+ case "blocked":
721
+ return "warning";
722
+ case "doing":
723
+ return "info";
724
+ case "done":
725
+ return "success";
726
+ case "todo":
727
+ return "quiet";
728
+ }
729
+ }
730
+ function taskProgress(project) {
731
+ return { done: project.tasks.filter((task) => task.status === "done").length, total: project.tasks.length };
732
+ }
733
+ function truncateSessionId(value) {
734
+ const characters = Array.from(value);
735
+ return characters.length <= 18 ? value : `${characters.slice(0, 10).join("")}\u2026${characters.slice(-5).join("")}`;
736
+ }
737
+ function normalizedWorkspacePath(value, platform) {
738
+ let normalized = platform === "win32" ? value.replaceAll("\\", "/").toLowerCase() : value;
739
+ const root = platform === "win32" ? /^(?:[a-z]:\/|\/+)$/u.test(normalized) : normalized === "/";
740
+ if (!root) normalized = normalized.replace(/\/+$/u, "");
741
+ return normalized;
742
+ }
743
+ function unlistedDevLeadWorkspaces(board, workspaces, sessions, pathPlatform = "posix") {
744
+ const listedPaths = new Set(board.projects.map((project) => normalizedWorkspacePath(project.workspace.path, pathPlatform)));
745
+ return workspaces.filter((workspace) => !listedPaths.has(normalizedWorkspacePath(workspace.path, pathPlatform))).map((workspace) => {
746
+ let latest = Number.NEGATIVE_INFINITY;
747
+ for (const sessionId of workspace.sessionIds) {
748
+ const updatedAt = sessions[sessionId]?.updatedAt;
749
+ if (typeof updatedAt === "number" && Number.isFinite(updatedAt)) latest = Math.max(latest, updatedAt);
750
+ }
751
+ return {
752
+ ...workspace,
753
+ sessionCount: workspace.sessionIds.length,
754
+ ...Number.isFinite(latest) ? { lastActivityAt: new Date(latest).toISOString() } : {}
755
+ };
756
+ }).sort((left, right) => {
757
+ const leftTime = left.lastActivityAt === void 0 ? Number.NEGATIVE_INFINITY : Date.parse(left.lastActivityAt);
758
+ const rightTime = right.lastActivityAt === void 0 ? Number.NEGATIVE_INFINITY : Date.parse(right.lastActivityAt);
759
+ return rightTime - leftTime || left.title.localeCompare(right.title) || left.workspaceId.localeCompare(right.workspaceId);
760
+ });
761
+ }
762
+ function boardRelativeTime(iso, now) {
763
+ const elapsed = Math.max(0, now - Date.parse(iso));
764
+ if (elapsed < 6e4) return { unit: "now", n: 0 };
765
+ if (elapsed < 36e5) return { unit: "minutes", n: Math.floor(elapsed / 6e4) };
766
+ if (elapsed < 864e5) return { unit: "hours", n: Math.floor(elapsed / 36e5) };
767
+ return { unit: "days", n: Math.floor(elapsed / 864e5) };
768
+ }
769
+
770
+ // packages/client-ui/src/client/DevLeadBoardButton.tsx
771
+ var import_jsx_runtime2 = require("react/jsx-runtime");
772
+ function DevLeadBoardTitle({ t }) {
773
+ return t("board.title");
774
+ }
775
+ function DevLeadBoardButton({ onOpen, sessionId, useSessions, t }) {
776
+ const visible = useSessions((snapshot) => resolveDevLeadBoardSessionConfig(sessionId, snapshot.byId[sessionId], currentDevLeadBoardConfig()) !== void 0);
777
+ const label = t("board.open");
778
+ if (!visible) return null;
779
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tooltip, { label, side: "bottom", delayMs: 300, maxWidth: 240, portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
780
+ import_dsh_client_ui_primitives2.Button,
781
+ {
782
+ variant: "ghost",
783
+ size: "sm",
784
+ className: "devlead-board-open",
785
+ "aria-label": label,
786
+ "data-devlead-board-open": "true",
787
+ onClick: onOpen,
788
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconFlatListOutlineRegular, { size: 16 })
789
+ }
790
+ ) });
791
+ }
792
+
793
+ // packages/client-ui/src/client/DevLeadBoardPanel.tsx
794
+ var import_react2 = require("react");
795
+ var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
796
+
797
+ // packages/client-ui/src/client/useBoardFile.ts
798
+ var import_react = require("react");
799
+ var DISABLED = { status: "disabled", refreshing: false };
800
+ function initialState(config) {
801
+ return config === void 0 ? DISABLED : { status: "loading", refreshing: false };
802
+ }
803
+ function errorMessage(error) {
804
+ return error instanceof Error ? error.message : String(error);
805
+ }
806
+ function isNotFound(result) {
807
+ return !result.ok && result.error.code === "workspace-file/not-found";
808
+ }
809
+ function useBoardFile({
810
+ sessionId,
811
+ config,
812
+ files,
813
+ debounceMs = 120,
814
+ pollMs = 4e3,
815
+ pollMaxMs = 3e4,
816
+ now = Date.now
817
+ }) {
818
+ const [state, setState] = (0, import_react.useState)(() => initialState(config));
819
+ const [watch, setWatch] = (0, import_react.useState)(config === void 0 ? "disabled" : "connecting");
820
+ const [watchGeneration, setWatchGeneration] = (0, import_react.useState)(0);
821
+ const generation = (0, import_react.useRef)(0);
822
+ const readAbort = (0, import_react.useRef)(void 0);
823
+ const refreshRead = (0, import_react.useCallback)(() => {
824
+ if (config === void 0) {
825
+ generation.current += 1;
826
+ readAbort.current?.abort();
827
+ setState(DISABLED);
828
+ return;
829
+ }
830
+ const request = ++generation.current;
831
+ readAbort.current?.abort();
832
+ const controller = new AbortController();
833
+ readAbort.current = controller;
834
+ setState((previous) => ({
835
+ ...previous,
836
+ status: previous.status === "disabled" ? "loading" : previous.status,
837
+ refreshing: true
838
+ }));
839
+ const settle = (next) => {
840
+ if (generation.current !== request || controller.signal.aborted) return;
841
+ setState(next);
842
+ };
843
+ const fail = (kind, error) => {
844
+ if (generation.current !== request || controller.signal.aborted) return;
845
+ setState((previous) => ({
846
+ status: "error",
847
+ error: { kind, message: errorMessage(error) },
848
+ ...previous.lastSuccessAt === void 0 ? {} : { lastSuccessAt: previous.lastSuccessAt },
849
+ refreshing: false
850
+ }));
851
+ };
852
+ void (async () => {
853
+ try {
854
+ const metadata = await files.stat(sessionId, config.boardPath, controller.signal);
855
+ if (generation.current !== request || controller.signal.aborted) return;
856
+ if (!metadata.ok) {
857
+ if (isNotFound(metadata)) {
858
+ settle({ status: "empty", refreshing: false });
859
+ } else {
860
+ fail("read", metadata.error);
861
+ }
862
+ return;
863
+ }
864
+ if (metadata.value.bytes !== void 0 && metadata.value.bytes > DEVLEAD_BOARD_MAX_BYTES) {
865
+ fail("parse", new DevLeadBoardParseError(`board file exceeds ${DEVLEAD_BOARD_MAX_BYTES} bytes`));
866
+ return;
867
+ }
868
+ const content = await files.readBytes(sessionId, config.boardPath, {}, controller.signal);
869
+ if (generation.current !== request || controller.signal.aborted) return;
870
+ if (!content.ok) {
871
+ if (isNotFound(content)) {
872
+ settle({ status: "empty", refreshing: false });
873
+ } else {
874
+ fail("read", content.error);
875
+ }
876
+ return;
877
+ }
878
+ if (!content.value.eof || content.value.data.byteLength > DEVLEAD_BOARD_MAX_BYTES) {
879
+ fail("parse", new DevLeadBoardParseError("board file is truncated or too large"));
880
+ return;
881
+ }
882
+ let board;
883
+ try {
884
+ board = parseDevLeadBoardBytes(content.value.data, config.pathPlatform);
885
+ } catch (error) {
886
+ fail("parse", error);
887
+ return;
888
+ }
889
+ settle({
890
+ status: "ready",
891
+ board,
892
+ lastSuccessAt: new Date(now()).toISOString(),
893
+ refreshing: false
894
+ });
895
+ } catch (error) {
896
+ if (generation.current !== request || controller.signal.aborted) return;
897
+ fail("read", error);
898
+ }
899
+ })();
900
+ }, [config, files, now, sessionId]);
901
+ (0, import_react.useEffect)(() => {
902
+ if (config === void 0) {
903
+ setState(DISABLED);
904
+ setWatch("disabled");
905
+ return;
906
+ }
907
+ setWatch("connecting");
908
+ let disposed = false;
909
+ let timer;
910
+ const watcher = new AbortController();
911
+ const schedule = () => {
912
+ if (timer !== void 0) clearTimeout(timer);
913
+ timer = setTimeout(() => {
914
+ timer = void 0;
915
+ refreshRead();
916
+ }, debounceMs);
917
+ };
918
+ const pump = async () => {
919
+ try {
920
+ const stream = files.changes(sessionId, config.boardPath, watcher.signal);
921
+ try {
922
+ for await (const frame of stream) {
923
+ if (disposed) return;
924
+ if (frame.kind === "ready") {
925
+ setWatch("live");
926
+ refreshRead();
927
+ } else if (frame.kind === "change") schedule();
928
+ }
929
+ } finally {
930
+ stream.dispose();
931
+ }
932
+ } catch {
933
+ } finally {
934
+ if (!disposed) setWatch("ended");
935
+ }
936
+ };
937
+ void pump();
938
+ refreshRead();
939
+ return () => {
940
+ disposed = true;
941
+ if (timer !== void 0) clearTimeout(timer);
942
+ generation.current += 1;
943
+ watcher.abort();
944
+ readAbort.current?.abort();
945
+ };
946
+ }, [config, debounceMs, files, refreshRead, sessionId, watchGeneration]);
947
+ (0, import_react.useEffect)(() => {
948
+ if (config === void 0 || state.status !== "empty") return;
949
+ let delay = pollMs;
950
+ let timer;
951
+ const schedule = () => {
952
+ timer = setTimeout(() => {
953
+ timer = void 0;
954
+ refreshRead();
955
+ delay = Math.min(delay * 2, pollMaxMs);
956
+ schedule();
957
+ }, delay);
958
+ };
959
+ schedule();
960
+ return () => {
961
+ if (timer !== void 0) clearTimeout(timer);
962
+ };
963
+ }, [config, pollMs, pollMaxMs, refreshRead, state.status]);
964
+ const refresh = (0, import_react.useCallback)(() => {
965
+ refreshRead();
966
+ if (config !== void 0) setWatchGeneration((current) => current + 1);
967
+ }, [config, refreshRead]);
968
+ return { ...state, watch, refresh };
969
+ }
970
+
971
+ // packages/client-ui/src/client/DevLeadBoardPanel.tsx
972
+ var import_jsx_runtime3 = require("react/jsx-runtime");
973
+ function DevLeadBoardPanel({ sessionId, files, useWorkspaces, useSessions, t }) {
974
+ const sessions = useSessions((snapshot) => snapshot);
975
+ const summary = sessions.byId[sessionId];
976
+ const resolved = resolveDevLeadBoardSessionConfig(sessionId, summary, currentDevLeadBoardConfig());
977
+ const config = (0, import_react2.useMemo)(() => resolved, [resolved?.boardPath, resolved?.pathPlatform]);
978
+ const { refresh, watch, ...state } = useBoardFile({ sessionId, config, files });
979
+ const workspaces = useWorkspaces((snapshot) => snapshot);
980
+ const [now, setNow] = (0, import_react2.useState)(() => Date.now());
981
+ (0, import_react2.useEffect)(() => {
982
+ const timer = setInterval(() => {
983
+ setNow(Date.now());
984
+ }, 6e4);
985
+ return () => {
986
+ clearInterval(timer);
987
+ };
988
+ }, []);
989
+ const unlisted = state.status === "ready" && state.board !== void 0 ? unlistedDevLeadWorkspaces(state.board, workspaces.items, sessions.byId, config?.pathPlatform) : [];
990
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
991
+ DevLeadBoardPanelView,
992
+ {
993
+ state,
994
+ onRefresh: refresh,
995
+ now,
996
+ t,
997
+ unlisted,
998
+ workspacePhase: workspaces.phase,
999
+ workspaceError: workspaces.state === "error",
1000
+ sessionPhase: sessions.phase,
1001
+ watch
1002
+ }
1003
+ );
1004
+ }
1005
+ function RelativeTime({ iso, now, t }) {
1006
+ const relative = boardRelativeTime(iso, now);
1007
+ const text = relative.unit === "now" ? t("board.time.now") : t(`board.time.${relative.unit}`, { count: relative.n });
1008
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("time", { dateTime: iso, title: iso, children: text });
1009
+ }
1010
+ function ProjectField({ label, text, className = "" }) {
1011
+ if (text.trim().length === 0) return null;
1012
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `devlead-board-field ${className}`.trim(), children: [
1013
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-board-field-label", children: label }),
1014
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: text })
1015
+ ] });
1016
+ }
1017
+ function ProjectCard({ project, now, t }) {
1018
+ const progress = taskProgress(project);
1019
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "devlead-board-card", "data-devlead-board-project": project.id, "data-status": project.status, children: [
1020
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "devlead-board-card-header", children: [
1021
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-card-heading", children: [
1022
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h5", { children: project.workspace.title }),
1023
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "devlead-board-project-id", title: project.id, children: project.id })
1024
+ ] }),
1025
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-card-badges", children: [
1026
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "data-board-status": project.status, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Pill, { className: "devlead-board-status", children: t(`board.status.${project.status}`) }) }),
1027
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "outline", children: t(`board.priority.${project.priority}`) })
1028
+ ] })
1029
+ ] }),
1030
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "devlead-board-workspace", title: project.workspace.path, children: project.workspace.path }),
1031
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProjectField, { label: t("board.field.goal"), text: project.goal }),
1032
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProjectField, { label: t("board.field.focus"), text: project.focus }),
1033
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProjectField, { label: t("board.field.next"), text: project.next }),
1034
+ project.blockers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "devlead-board-blockers", "aria-label": t("board.blockers"), children: [
1035
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("h6", { children: [
1036
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconWarningOutlineRegular, { size: 14 }),
1037
+ t("board.blockers")
1038
+ ] }),
1039
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { children: project.blockers.map((blocker) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
1040
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: blocker.text }),
1041
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "devlead-board-blocker-since", children: [
1042
+ t("board.blocker.since"),
1043
+ " ",
1044
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: blocker.since, now, t })
1045
+ ] })
1046
+ ] }, blocker.id)) })
1047
+ ] }),
1048
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "devlead-board-tasks", "data-devlead-board-tasks": project.id, children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("summary", { children: t("board.tasks.summary", { done: progress.done, total: progress.total }) }),
1050
+ project.tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "devlead-board-muted", children: t("board.tasks.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { children: project.tasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { "data-task-status": task.status, children: [
1051
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-task-heading", children: [
1052
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-board-task-title", children: task.title }),
1053
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: taskStatusTone(task.status), children: t(`board.task.status.${task.status}`) })
1054
+ ] }),
1055
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-task-meta", children: [
1056
+ task.ownerSessionId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("code", { title: task.ownerSessionId, children: [
1057
+ t("board.task.owner"),
1058
+ " ",
1059
+ truncateSessionId(task.ownerSessionId)
1060
+ ] }),
1061
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: task.updatedAt, now, t })
1062
+ ] })
1063
+ ] }, task.id)) })
1064
+ ] }),
1065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { className: "devlead-board-card-footer", children: [
1066
+ t("board.project.updated"),
1067
+ " ",
1068
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: project.updatedAt, now, t })
1069
+ ] })
1070
+ ] });
1071
+ }
1072
+ function DevLeadBoardPanelView({
1073
+ state,
1074
+ onRefresh,
1075
+ now,
1076
+ t,
1077
+ unlisted = [],
1078
+ workspacePhase = "ready",
1079
+ workspaceError = false,
1080
+ sessionPhase = "ready",
1081
+ watch = "live"
1082
+ }) {
1083
+ const idPrefix = (0, import_react2.useId)();
1084
+ if (state.status === "disabled") return null;
1085
+ const board = state.board;
1086
+ const blocked = board?.projects.filter((project) => project.status === "blocked").length ?? 0;
1087
+ const groups = board === void 0 ? [] : groupDevLeadBoardProjects(board);
1088
+ const refreshState = state.status === "error" ? "error" : watch === "ended" ? "warning" : state.refreshing || state.status === "loading" || watch === "connecting" ? "ongoing" : state.status === "ready" ? "done" : "idle";
1089
+ const statusText = state.status === "error" ? t("board.refresh.error") : watch === "ended" ? t("board.watch.ended") : state.refreshing || state.status === "loading" ? t("board.refresh.loading") : watch === "connecting" ? t("board.watch.connecting") : state.status === "ready" ? t("board.refresh.ready") : t("board.refresh.empty");
1090
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board", "data-devlead-board": "true", "data-state": state.status, children: [
1091
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "devlead-board-header", children: [
1092
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-title-row", children: [
1093
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-title-group", children: [
1094
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("board.title") }),
1095
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: t("board.readonly") })
1096
+ ] }),
1097
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Tooltip, { label: t("board.refresh.action"), side: "left", delayMs: 300, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1098
+ import_dsh_client_ui_primitives3.Button,
1099
+ {
1100
+ variant: "ghost",
1101
+ size: "sm",
1102
+ className: "devlead-board-refresh",
1103
+ "aria-label": t("board.refresh.action"),
1104
+ "aria-busy": state.refreshing,
1105
+ disabled: state.refreshing,
1106
+ onClick: onRefresh,
1107
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconRefreshOutlineRegular, { size: 15 })
1108
+ }
1109
+ ) })
1110
+ ] }),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-meta", children: [
1112
+ board !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-board-revision", children: t("board.revision", { revision: board.revision }) }),
1113
+ board !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: board.updatedAt, now, t }),
1114
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "devlead-board-refresh-state", role: "status", "aria-live": "polite", children: [
1115
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: refreshState, size: 9 }),
1116
+ statusText
1117
+ ] })
1118
+ ] })
1119
+ ] }),
1120
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-content", children: [
1121
+ state.status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "devlead-board-placeholder", role: "status", children: t("board.loading") }),
1122
+ state.status === "empty" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-placeholder", "data-devlead-board-empty": "file", children: [
1123
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: t("board.empty.title") }),
1124
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("board.empty.description") })
1125
+ ] }),
1126
+ state.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-error", role: "alert", "data-devlead-board-error": state.error?.kind ?? "read", children: [
1127
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: t(state.error?.kind === "parse" ? "board.error.parse" : "board.error.read") }),
1128
+ state.lastSuccessAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
1129
+ t("board.lastSuccess"),
1130
+ " ",
1131
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: state.lastSuccessAt, now, t })
1132
+ ] }),
1133
+ state.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "devlead-board-error-detail", children: state.error.message }),
1134
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", onClick: onRefresh, disabled: state.refreshing, children: [
1135
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconRefreshOutlineRegular, { size: 14 }),
1136
+ t("board.retry")
1137
+ ] })
1138
+ ] }),
1139
+ state.status === "ready" && board !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1140
+ blocked > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-blocked-notice", role: "status", children: [
1141
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconWarningOutlineRegular, { size: 15 }),
1142
+ t("board.blocked.notice", { count: blocked })
1143
+ ] }),
1144
+ board.projects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-placeholder", "data-devlead-board-empty": "projects", children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: t("board.emptyProjects.title") }),
1146
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("board.emptyProjects.description") })
1147
+ ] }),
1148
+ groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1149
+ "section",
1150
+ {
1151
+ className: "devlead-board-group",
1152
+ "data-board-group": group.status,
1153
+ "aria-labelledby": `${idPrefix}-group-${group.status}`,
1154
+ children: [
1155
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "devlead-board-group-header", children: [
1156
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { id: `${idPrefix}-group-${group.status}`, children: t(`board.status.${group.status}`) }),
1157
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: projectStatusTone(group.status), children: group.projects.length })
1158
+ ] }),
1159
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "devlead-board-cards", children: group.projects.map((project) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProjectCard, { project, now, t }, project.id)) })
1160
+ ]
1161
+ },
1162
+ group.status
1163
+ ))
1164
+ ] }),
1165
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "devlead-board-unlisted", "data-devlead-board-unlisted": "true", children: [
1166
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("summary", { children: t("board.unlisted.title") }),
1167
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-board-unlisted-body", children: [
1168
+ state.status !== "ready" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("board.unlisted.unavailable") }),
1169
+ state.status === "ready" && workspaceError && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", children: t("board.unlisted.error") }),
1170
+ state.status === "ready" && !workspaceError && workspacePhase === "pending" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("board.unlisted.pending") }),
1171
+ state.status === "ready" && !workspaceError && workspacePhase === "ready" && unlisted.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("board.unlisted.empty") }),
1172
+ state.status === "ready" && !workspaceError && workspacePhase === "ready" && unlisted.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "devlead-board-unlisted-list", children: unlisted.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { "data-devlead-board-unlisted-project": workspace.workspaceId, children: [
1173
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: workspace.title }),
1174
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { title: workspace.path, children: workspace.path }),
1175
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
1176
+ t("board.unlisted.sessions", { count: workspace.sessionCount }),
1177
+ " \xB7 ",
1178
+ sessionPhase === "pending" && workspace.sessionCount > 0 ? t("board.unlisted.activityPending") : workspace.lastActivityAt === void 0 ? t("board.unlisted.noActivity") : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelativeTime, { iso: workspace.lastActivityAt, now, t })
1179
+ ] })
1180
+ ] }, workspace.workspaceId)) })
1181
+ ] })
1182
+ ] })
1183
+ ] })
1184
+ ] });
1185
+ }
1186
+
1187
+ // packages/client-ui/src/client/DevLeadIconToggle.tsx
1188
+ var import_react4 = require("react");
1189
+ var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
1190
+
406
1191
  // packages/client-ui/src/client/results.ts
407
1192
  function presentMessage(value) {
408
1193
  if (value === void 0) return void 0;
@@ -489,19 +1274,19 @@ window.__ModuleLoader__.load({
489
1274
  }
490
1275
 
491
1276
  // packages/client-ui/src/client/useDevLeadAdmission.ts
492
- var import_react = require("react");
1277
+ var import_react3 = require("react");
493
1278
  function useDevLeadAdmission(executeCommand, resetKey) {
494
- const [state, dispatch] = (0, import_react.useReducer)(devLeadAdmissionReducer, DEVLEAD_ADMISSION_IDLE);
495
- const [gate] = (0, import_react.useState)(createDevLeadAdmissionGate);
496
- const aliveRef = (0, import_react.useRef)(true);
497
- (0, import_react.useEffect)(() => {
1279
+ const [state, dispatch] = (0, import_react3.useReducer)(devLeadAdmissionReducer, DEVLEAD_ADMISSION_IDLE);
1280
+ const [gate] = (0, import_react3.useState)(createDevLeadAdmissionGate);
1281
+ const aliveRef = (0, import_react3.useRef)(true);
1282
+ (0, import_react3.useEffect)(() => {
498
1283
  aliveRef.current = true;
499
1284
  return () => {
500
1285
  aliveRef.current = false;
501
1286
  };
502
1287
  }, []);
503
- const resetKeyRef = (0, import_react.useRef)(resetKey);
504
- (0, import_react.useEffect)(() => {
1288
+ const resetKeyRef = (0, import_react3.useRef)(resetKey);
1289
+ (0, import_react3.useEffect)(() => {
505
1290
  resetKeyRef.current = resetKey;
506
1291
  dispatch({ type: "reset" });
507
1292
  }, [resetKey]);
@@ -520,13 +1305,13 @@ window.__ModuleLoader__.load({
520
1305
  }
521
1306
 
522
1307
  // packages/client-ui/src/client/DevLeadIconToggle.tsx
523
- var import_jsx_runtime2 = require("react/jsx-runtime");
1308
+ var import_jsx_runtime4 = require("react/jsx-runtime");
524
1309
  function DevLeadIconToggle({ useSession, useProjection, executeCommand, t }) {
525
1310
  const subagent = useSession((snapshot) => snapshot.subagent !== null) ?? false;
526
1311
  const projection = useProjection(DEVLEAD_PROJECTION_KEY);
527
1312
  const enabled = projection?.enabled ?? false;
528
1313
  const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
529
- const [attempt, setAttempt] = (0, import_react2.useState)("on");
1314
+ const [attempt, setAttempt] = (0, import_react4.useState)("on");
530
1315
  if (subagent) return null;
531
1316
  if (projection === void 0) return null;
532
1317
  const direction = enabled ? "off" : "on";
@@ -541,9 +1326,9 @@ window.__ModuleLoader__.load({
541
1326
  attempt === "off" ? "toggle.failed.status.disable" : "toggle.failed.status",
542
1327
  { message: failureText }
543
1328
  );
544
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
545
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
546
- import_dsh_client_ui_primitives2.Tooltip,
1329
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1330
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1331
+ import_dsh_client_ui_primitives4.Tooltip,
547
1332
  {
548
1333
  label,
549
1334
  side: "top",
@@ -551,8 +1336,8 @@ window.__ModuleLoader__.load({
551
1336
  maxWidth: 300,
552
1337
  portal: true,
553
1338
  openOnClick: failure !== null,
554
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
555
- import_dsh_client_ui_primitives2.Button,
1339
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1340
+ import_dsh_client_ui_primitives4.Button,
556
1341
  {
557
1342
  variant: "ghost",
558
1343
  size: "sm",
@@ -570,75 +1355,44 @@ window.__ModuleLoader__.load({
570
1355
  run(`/${DEVLEAD_COMMAND_NAME} ${direction}`);
571
1356
  },
572
1357
  children: [
573
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconUsersOutlineRegular, { size: 16 }),
574
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "devlead-toggle-label", children: t("toggle.label") })
1358
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.IconUsersOutlineRegular, { size: 16 }),
1359
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "devlead-toggle-label", children: t("toggle.label") })
575
1360
  ]
576
1361
  }
577
1362
  )
578
1363
  }
579
1364
  ),
580
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "devlead-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: status })
1365
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "devlead-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: status })
581
1366
  ] });
582
1367
  }
583
1368
 
584
1369
  // packages/client-ui/src/client/DevLeadSessionHoverMark.tsx
585
- var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
586
-
587
- // packages/client-ui/src/client/sessionMark.ts
588
- function devLeadRowEnabled(summary) {
589
- return summary?.projectionValues?.[DEVLEAD_MODE_PROJECTION_KEY]?.enabled === true;
590
- }
591
- function devLeadRowSummaryOf(byId, sessionId) {
592
- return Object.hasOwn(byId, sessionId) ? byId[sessionId] : void 0;
593
- }
594
- var watchedIdsCache = /* @__PURE__ */ new WeakMap();
595
- function watchedIdsOf(byId) {
596
- const cached = watchedIdsCache.get(byId);
597
- if (cached !== void 0) return cached;
598
- const watched = /* @__PURE__ */ new Set();
599
- for (const [leadId, lead] of Object.entries(byId)) {
600
- if (!devLeadRowEnabled(lead)) continue;
601
- const sessions = lead?.projectionValues?.[DEVLEAD_WATCH_PROJECTION_KEY]?.sessions;
602
- if (!Array.isArray(sessions)) continue;
603
- for (const candidate of sessions) {
604
- if (typeof candidate !== "string" || candidate.length === 0 || candidate === leadId) continue;
605
- watched.add(candidate);
606
- }
607
- }
608
- watchedIdsCache.set(byId, watched);
609
- return watched;
610
- }
611
- function devLeadRowWatched(sessionId, byId) {
612
- if (devLeadRowEnabled(devLeadRowSummaryOf(byId, sessionId))) return false;
613
- return watchedIdsOf(byId).has(sessionId);
614
- }
615
-
616
- // packages/client-ui/src/client/DevLeadSessionHoverMark.tsx
617
- var import_jsx_runtime3 = require("react/jsx-runtime");
1370
+ var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
1371
+ var import_jsx_runtime5 = require("react/jsx-runtime");
618
1372
  function DevLeadSessionHoverMark({ sessionId, useSessions, t }) {
619
1373
  const enabled = useSessions((state) => devLeadRowEnabled(devLeadRowSummaryOf(state.byId, sessionId)));
620
1374
  const watched = useSessions((state) => devLeadRowWatched(sessionId, state.byId));
621
1375
  if (enabled) {
622
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-row-hover", "data-devlead-row-hover": "true", children: [
623
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-row-hover-glyph", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-row-hover-active-dot" }) }),
624
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("row.hover.enabled") })
1376
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "devlead-row-hover", "data-devlead-row-hover": "true", children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "devlead-row-hover-glyph", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "devlead-row-hover-active-dot" }) }),
1378
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: t("row.hover.enabled") })
625
1379
  ] });
626
1380
  }
627
1381
  if (!watched) return null;
628
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "devlead-row-hover", "data-devlead-row-hover": "true", "data-devlead-row-watched": "true", children: [
629
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "devlead-row-hover-glyph", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconGoalOutlineRegular, { size: 14 }) }),
630
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("row.hover.watched") })
1382
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "devlead-row-hover", "data-devlead-row-hover": "true", "data-devlead-row-watched": "true", children: [
1383
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "devlead-row-hover-glyph", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconGoalOutlineRegular, { size: 14 }) }),
1384
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: t("row.hover.watched") })
631
1385
  ] });
632
1386
  }
633
1387
 
634
1388
  // packages/client-ui/src/client/DevLeadSessionMark.tsx
635
- var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
636
- var import_jsx_runtime4 = require("react/jsx-runtime");
1389
+ var import_dsh_client_ui_primitives6 = require("@deepseek-ai/dsh-client-ui-primitives");
1390
+ var import_jsx_runtime6 = require("react/jsx-runtime");
637
1391
  function DevLeadSessionMark({ sessionId, useSessions, t }) {
638
1392
  const enabled = useSessions((state) => devLeadRowEnabled(devLeadRowSummaryOf(state.byId, sessionId)));
639
1393
  const watched = useSessions((state) => devLeadRowWatched(sessionId, state.byId));
640
1394
  if (enabled) {
641
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1395
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
642
1396
  "span",
643
1397
  {
644
1398
  className: "devlead-sr-only",
@@ -649,14 +1403,14 @@ window.__ModuleLoader__.load({
649
1403
  );
650
1404
  }
651
1405
  if (!watched) return null;
652
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1406
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
653
1407
  "span",
654
1408
  {
655
1409
  className: "devlead-row-mark devlead-row-mark-watched",
656
1410
  role: "img",
657
1411
  "aria-label": t("row.watched.aria"),
658
1412
  "data-devlead-row-mark": "watched",
659
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.IconGoalOutlineRegular, { size: 13 })
1413
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives6.IconGoalOutlineRegular, { size: 13 })
660
1414
  }
661
1415
  );
662
1416
  }
@@ -664,7 +1418,7 @@ window.__ModuleLoader__.load({
664
1418
  // packages/client-ui/src/client/locales.ts
665
1419
  var zh = {
666
1420
  "meta.title": "DevLead \u754C\u9762",
667
- "meta.description": "DevLead \u6A21\u5F0F\u7684 Web \u754C\u9762\uFF1A\u8F93\u5165\u6846\u5DE5\u5177\u6761\u7684 DevLead \u5F00\u5173\uFF08\u4E24\u6001\u5747\u53EF\u5207\u6362\uFF09\u3001\u6A21\u5F0F\u5F00\u542F\u540E\u663E\u793A\u7684\u72B6\u6001\u6761\uFF0C\u4EE5\u53CA\u4FA7\u8FB9\u680F\u4E2D\u6FC0\u6D3B DevLead \u884C\u4E0E\u5DF2\u5173\u6CE8\u4F1A\u8BDD\u7684\u6807\u8BB0\u3002",
1421
+ "meta.description": "DevLead \u6A21\u5F0F\u7684 Web \u754C\u9762\uFF1A\u6A21\u5F0F\u5F00\u5173\u4E0E\u72B6\u6001\u6761\u3001\u4FA7\u8FB9\u680F\u4F1A\u8BDD\u6807\u8BB0\uFF0C\u4EE5\u53CA\u53EA\u8BFB\u9879\u76EE\u770B\u677F\u3002",
668
1422
  "bar.aria": "DevLead \u72B6\u6001\u680F",
669
1423
  "label": "DevLead",
670
1424
  "hint.enabled": "DevLead \u5DF2\u5F00\u542F\uFF1A\u5DF2\u5173\u6CE8\u4F1A\u8BDD\u7684\u8F6E\u6B21\u7ED3\u675F\u4E0E\u4E2D\u9014\u6C47\u62A5\u4F1A\u901A\u77E5\u672C\u4F1A\u8BDD\uFF1B\u963B\u585E/\u5F85\u51B3\u7B56/\u63D0\u95EE\u4F1A\u8BF7\u6C42\u5524\u9192\uFF0C\u8FDB\u5EA6/\u544A\u77E5\u4EC5\u4F5C\u80CC\u666F\u3001\u4E0D\u5524\u9192\u3002",
@@ -714,6 +1468,60 @@ window.__ModuleLoader__.load({
714
1468
  "transition.interrupted": "\u5DF2\u4E2D\u65AD",
715
1469
  "transition.forked": "\u5DF2\u5206\u53C9",
716
1470
  "transition.unknown": "\u672A\u77E5\u72B6\u6001",
1471
+ "board.title": "\u9879\u76EE\u770B\u677F",
1472
+ "board.open": "\u6253\u5F00\u9879\u76EE\u770B\u677F",
1473
+ "board.guide": "\u67E5\u770B lead \u7EF4\u62A4\u7684\u9879\u76EE\u72B6\u6001\u3001\u7126\u70B9\u3001\u963B\u585E\u4E0E\u4EFB\u52A1\uFF1B\u7528\u6237\u53EA\u8BFB\u3002",
1474
+ "board.readonly": "\u53EA\u8BFB",
1475
+ "board.revision": "r{revision}",
1476
+ "board.refresh.action": "\u5237\u65B0\u9879\u76EE\u770B\u677F",
1477
+ "board.refresh.loading": "\u8BFB\u53D6\u4E2D",
1478
+ "board.refresh.error": "\u9519\u8BEF",
1479
+ "board.refresh.ready": "\u6B63\u5E38",
1480
+ "board.refresh.empty": "\u6682\u65E0\u6570\u636E",
1481
+ "board.watch.connecting": "\u6B63\u5728\u8FDE\u63A5\u81EA\u52A8\u66F4\u65B0",
1482
+ "board.watch.ended": "\u81EA\u52A8\u66F4\u65B0\u5DF2\u65AD\u5F00\uFF0C\u8BF7\u624B\u52A8\u5237\u65B0",
1483
+ "board.time.now": "\u521A\u521A",
1484
+ "board.time.minutes": "{count} \u5206\u949F\u524D",
1485
+ "board.time.hours": "{count} \u5C0F\u65F6\u524D",
1486
+ "board.time.days": "{count} \u5929\u524D",
1487
+ "board.status.active": "\u8FDB\u884C\u4E2D",
1488
+ "board.status.blocked": "\u5DF2\u963B\u585E",
1489
+ "board.status.paused": "\u5DF2\u6682\u505C",
1490
+ "board.status.done": "\u5DF2\u5B8C\u6210",
1491
+ "board.priority.low": "\u4F4E\u4F18\u5148\u7EA7",
1492
+ "board.priority.medium": "\u4E2D\u4F18\u5148\u7EA7",
1493
+ "board.priority.high": "\u9AD8\u4F18\u5148\u7EA7",
1494
+ "board.field.goal": "\u76EE\u6807",
1495
+ "board.field.focus": "\u5F53\u524D\u7126\u70B9",
1496
+ "board.field.next": "\u4E0B\u4E00\u6B65",
1497
+ "board.blockers": "\u963B\u585E\u9879",
1498
+ "board.blocker.since": "\u59CB\u4E8E",
1499
+ "board.tasks.summary": "\u4EFB\u52A1 {done}/{total} \u5DF2\u5B8C\u6210",
1500
+ "board.tasks.empty": "\u8FD8\u6CA1\u6709\u4EFB\u52A1",
1501
+ "board.task.owner": "\u8D1F\u8D23\u4F1A\u8BDD",
1502
+ "board.task.status.todo": "\u5F85\u529E",
1503
+ "board.task.status.doing": "\u8FDB\u884C\u4E2D",
1504
+ "board.task.status.blocked": "\u5DF2\u963B\u585E",
1505
+ "board.task.status.done": "\u5DF2\u5B8C\u6210",
1506
+ "board.project.updated": "\u66F4\u65B0\u4E8E",
1507
+ "board.loading": "\u6B63\u5728\u8BFB\u53D6\u9879\u76EE\u770B\u677F\u2026",
1508
+ "board.empty.title": "\u8FD8\u6CA1\u6709\u770B\u677F\u6570\u636E",
1509
+ "board.empty.description": "lead AI \u9996\u6B21\u901A\u8FC7\u770B\u677F\u5DE5\u5177\u5199\u5165\u540E\uFF0C\u9879\u76EE\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",
1510
+ "board.emptyProjects.title": "\u770B\u677F\u4E2D\u8FD8\u6CA1\u6709\u9879\u76EE",
1511
+ "board.emptyProjects.description": "\u770B\u677F\u6587\u4EF6\u5DF2\u5C31\u7EEA\uFF1Blead AI \u6DFB\u52A0\u9879\u76EE\u540E\u4F1A\u81EA\u52A8\u5237\u65B0\u3002",
1512
+ "board.error.parse": "\u770B\u677F\u6587\u4EF6\u89E3\u6790\u5931\u8D25",
1513
+ "board.error.read": "\u770B\u677F\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25",
1514
+ "board.lastSuccess": "\u6700\u540E\u6210\u529F\u8BFB\u53D6\uFF1A",
1515
+ "board.retry": "\u91CD\u8BD5",
1516
+ "board.blocked.notice": "{count} \u4E2A\u9879\u76EE\u5DF2\u963B\u585E\uFF0C\u8BF7\u4F18\u5148\u5904\u7406\u3002",
1517
+ "board.unlisted.title": "\u672A\u5728\u770B\u677F\u4E2D\u7684\u9879\u76EE",
1518
+ "board.unlisted.empty": "\u6240\u6709\u5DF2\u6CE8\u518C workspace \u90FD\u5DF2\u5728\u770B\u677F\u4E2D\u3002",
1519
+ "board.unlisted.pending": "\u6B63\u5728\u8BFB\u53D6\u5DF2\u6CE8\u518C workspace\u2026",
1520
+ "board.unlisted.error": "\u5DF2\u6CE8\u518C workspace \u6E05\u5355\u8BFB\u53D6\u5931\u8D25\uFF1B\u8BF7\u7A0D\u540E\u91CD\u65B0\u6253\u5F00\u9762\u677F\u91CD\u8BD5\u3002",
1521
+ "board.unlisted.unavailable": "\u770B\u677F\u6587\u4EF6\u5C31\u7EEA\u540E\uFF0C\u8FD9\u91CC\u4F1A\u5217\u51FA\u672A\u5728\u770B\u677F\u4E2D\u7684\u5DF2\u6CE8\u518C workspace\u3002",
1522
+ "board.unlisted.sessions": "{count} \u4E2A\u4F1A\u8BDD",
1523
+ "board.unlisted.activityPending": "\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u6D3B\u52A8",
1524
+ "board.unlisted.noActivity": "\u6682\u65E0\u4F1A\u8BDD\u6D3B\u52A8",
717
1525
  "error.alreadyActive": "\u53E6\u4E00\u4E2A\u4F1A\u8BDD\u5DF2\u5904\u4E8E DevLead \u6A21\u5F0F\uFF1A{session}\u3002\u8BF7\u5148\u5728\u90A3\u91CC\u6267\u884C /devlead off\uFF0C\u518D\u5F00\u542F\u672C\u4F1A\u8BDD\u3002",
718
1526
  "error.fallback.transport": "\u547D\u4EE4\u5931\u8D25",
719
1527
  "error.fallback.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD",
@@ -722,7 +1530,7 @@ window.__ModuleLoader__.load({
722
1530
  };
723
1531
  var en = {
724
1532
  "meta.title": "DevLead UI",
725
- "meta.description": "Web UI for DevLead mode: the composer-toolbar toggle that switches the mode on or off, the status strip shown while the mode is on, and the active-DevLead and watched-session marks in the sidebar.",
1533
+ "meta.description": "Web UI for DevLead mode: the mode toggle and status strip, sidebar Session marks, and the read-only project board.",
726
1534
  "bar.aria": "DevLead status bar",
727
1535
  "label": "DevLead",
728
1536
  "hint.enabled": "DevLead is on: watched-session turn ends and mid-turn reports notify this session; blocked/decision reports and questions request a wake, while progress/fyi are background context and do not wake.",
@@ -772,6 +1580,60 @@ window.__ModuleLoader__.load({
772
1580
  "transition.interrupted": "interrupted",
773
1581
  "transition.forked": "forked",
774
1582
  "transition.unknown": "unknown state",
1583
+ "board.title": "Project board",
1584
+ "board.open": "Open project board",
1585
+ "board.guide": "Read lead-maintained project status, focus, blockers, and tasks. Read-only for people.",
1586
+ "board.readonly": "Read-only",
1587
+ "board.revision": "r{revision}",
1588
+ "board.refresh.action": "Refresh project board",
1589
+ "board.refresh.loading": "Reading",
1590
+ "board.refresh.error": "Error",
1591
+ "board.refresh.ready": "Up to date",
1592
+ "board.refresh.empty": "No data",
1593
+ "board.watch.connecting": "Connecting live updates",
1594
+ "board.watch.ended": "Live updates disconnected; refresh manually",
1595
+ "board.time.now": "just now",
1596
+ "board.time.minutes": "{count} min ago",
1597
+ "board.time.hours": "{count} hr ago",
1598
+ "board.time.days": "{count} d ago",
1599
+ "board.status.active": "Active",
1600
+ "board.status.blocked": "Blocked",
1601
+ "board.status.paused": "Paused",
1602
+ "board.status.done": "Done",
1603
+ "board.priority.low": "Low priority",
1604
+ "board.priority.medium": "Medium priority",
1605
+ "board.priority.high": "High priority",
1606
+ "board.field.goal": "Goal",
1607
+ "board.field.focus": "Focus",
1608
+ "board.field.next": "Next",
1609
+ "board.blockers": "Blockers",
1610
+ "board.blocker.since": "since",
1611
+ "board.tasks.summary": "Tasks {done}/{total} done",
1612
+ "board.tasks.empty": "No tasks yet",
1613
+ "board.task.owner": "Owner",
1614
+ "board.task.status.todo": "To do",
1615
+ "board.task.status.doing": "Doing",
1616
+ "board.task.status.blocked": "Blocked",
1617
+ "board.task.status.done": "Done",
1618
+ "board.project.updated": "Updated",
1619
+ "board.loading": "Reading the project board\u2026",
1620
+ "board.empty.title": "No board data yet",
1621
+ "board.empty.description": "Projects appear here after the lead AI first writes through the board tool.",
1622
+ "board.emptyProjects.title": "No projects on the board yet",
1623
+ "board.emptyProjects.description": "The board file is ready; it refreshes after the lead AI adds a project.",
1624
+ "board.error.parse": "Could not parse the board file",
1625
+ "board.error.read": "Could not read the board file",
1626
+ "board.lastSuccess": "Last successful read:",
1627
+ "board.retry": "Retry",
1628
+ "board.blocked.notice": "{count} project(s) blocked. Prioritize these projects.",
1629
+ "board.unlisted.title": "Projects not on the board",
1630
+ "board.unlisted.empty": "Every registered workspace is already on the board.",
1631
+ "board.unlisted.pending": "Reading registered workspaces\u2026",
1632
+ "board.unlisted.error": "Could not read registered workspaces; reopen the panel later to retry.",
1633
+ "board.unlisted.unavailable": "Once the board file is ready, registered workspaces absent from it appear here.",
1634
+ "board.unlisted.sessions": "{count} session(s)",
1635
+ "board.unlisted.activityPending": "Reading Session activity",
1636
+ "board.unlisted.noActivity": "No Session activity",
775
1637
  "error.alreadyActive": "Another Session is already in DevLead mode: {session}. Run /devlead off there first, then enable this Session.",
776
1638
  "error.fallback.transport": "command failed",
777
1639
  "error.fallback.rejected": "command rejected",
@@ -1173,6 +2035,448 @@ window.__ModuleLoader__.load({
1173
2035
  flex: none;
1174
2036
  align-items: center;
1175
2037
  }
2038
+
2039
+ /* Read-only project board: the right Sidebar owns pane sizing and scrolling;
2040
+ this surface only guards its own width and wraps arbitrary board free text. */
2041
+ .devlead-board-open {
2042
+ flex: none;
2043
+ width: 28px;
2044
+ color: var(--dsw-alias-label-secondary, GrayText);
2045
+ }
2046
+
2047
+ .devlead-board,
2048
+ .devlead-board * {
2049
+ box-sizing: border-box;
2050
+ }
2051
+
2052
+ .devlead-board {
2053
+ display: flex;
2054
+ flex-direction: column;
2055
+ width: 100%;
2056
+ max-width: 100%;
2057
+ min-width: 0;
2058
+ height: 100%;
2059
+ overflow: hidden;
2060
+ background: var(--dsw-specific-menu, Canvas);
2061
+ color: var(--dsw-alias-label-primary, CanvasText);
2062
+ font-family: inherit;
2063
+ font-size: 13px;
2064
+ line-height: 20px;
2065
+ }
2066
+
2067
+ .devlead-board-header {
2068
+ flex: none;
2069
+ min-width: 0;
2070
+ padding: 12px 14px 10px;
2071
+ border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2072
+ }
2073
+
2074
+ .devlead-board-title-row,
2075
+ .devlead-board-title-group,
2076
+ .devlead-board-meta,
2077
+ .devlead-board-card-header,
2078
+ .devlead-board-card-badges,
2079
+ .devlead-board-task-heading,
2080
+ .devlead-board-task-meta {
2081
+ display: flex;
2082
+ min-width: 0;
2083
+ align-items: center;
2084
+ }
2085
+
2086
+ .devlead-board-title-row {
2087
+ justify-content: space-between;
2088
+ gap: 8px;
2089
+ }
2090
+
2091
+ .devlead-board-title-group {
2092
+ flex: 1 1 auto;
2093
+ flex-wrap: wrap;
2094
+ gap: 8px;
2095
+ }
2096
+
2097
+ .devlead-board-title-group h3,
2098
+ .devlead-board-card-heading h5,
2099
+ .devlead-board-group-header h4,
2100
+ .devlead-board-placeholder h4,
2101
+ .devlead-board-error h4,
2102
+ .devlead-board-blockers h6 {
2103
+ margin: 0;
2104
+ font: inherit;
2105
+ font-weight: 600;
2106
+ }
2107
+
2108
+ .devlead-board-title-group h3 {
2109
+ font-size: 15px;
2110
+ line-height: 24px;
2111
+ }
2112
+
2113
+ .devlead-board-refresh {
2114
+ flex: none;
2115
+ width: 28px;
2116
+ }
2117
+
2118
+ .devlead-board-meta {
2119
+ flex-wrap: wrap;
2120
+ gap: 4px 10px;
2121
+ margin-top: 4px;
2122
+ color: var(--dsw-alias-label-secondary, GrayText);
2123
+ font-size: 12px;
2124
+ }
2125
+
2126
+ .devlead-board-revision {
2127
+ font-variant-numeric: tabular-nums;
2128
+ }
2129
+
2130
+ .devlead-board-refresh-state {
2131
+ display: inline-flex;
2132
+ align-items: center;
2133
+ gap: 5px;
2134
+ margin-left: auto;
2135
+ }
2136
+
2137
+ .devlead-board-content {
2138
+ flex: 1 1 auto;
2139
+ min-width: 0;
2140
+ min-height: 0;
2141
+ padding: 12px;
2142
+ overflow-x: hidden;
2143
+ overflow-y: auto;
2144
+ overscroll-behavior: contain;
2145
+ }
2146
+
2147
+ .devlead-board-placeholder,
2148
+ .devlead-board-error {
2149
+ max-width: 100%;
2150
+ padding: 20px 14px;
2151
+ border: 1px dashed var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2152
+ border-radius: var(--dsw-radius-lg, 12px);
2153
+ color: var(--dsw-alias-label-secondary, GrayText);
2154
+ text-align: center;
2155
+ }
2156
+
2157
+ .devlead-board-placeholder p,
2158
+ .devlead-board-error p,
2159
+ .devlead-board-unlisted-body p {
2160
+ margin: 6px 0 0;
2161
+ overflow-wrap: anywhere;
2162
+ }
2163
+
2164
+ .devlead-board-error {
2165
+ border-color: var(--dsw-alias-state-error-primary, #c0392b);
2166
+ color: var(--dsw-alias-label-error, #c0392b);
2167
+ }
2168
+
2169
+ .devlead-board-error-detail {
2170
+ display: block;
2171
+ max-width: 100%;
2172
+ margin: 10px 0;
2173
+ overflow-wrap: anywhere;
2174
+ color: var(--dsw-alias-label-secondary, GrayText);
2175
+ font-family: inherit;
2176
+ font-size: 12px;
2177
+ white-space: pre-wrap;
2178
+ }
2179
+
2180
+ .devlead-board-blocked-notice {
2181
+ display: flex;
2182
+ align-items: flex-start;
2183
+ gap: 7px;
2184
+ margin-bottom: 12px;
2185
+ padding: 8px 10px;
2186
+ border: 1px solid var(--dsw-alias-state-warn-primary, #a15c00);
2187
+ border-radius: var(--dsw-radius-lg, 12px);
2188
+ color: var(--dsw-alias-state-warn-primary, #a15c00);
2189
+ }
2190
+
2191
+ .devlead-board-blocked-notice > svg {
2192
+ flex: none;
2193
+ margin-top: 3px;
2194
+ }
2195
+
2196
+ .devlead-board-group + .devlead-board-group {
2197
+ margin-top: 18px;
2198
+ }
2199
+
2200
+ .devlead-board-group-header {
2201
+ display: flex;
2202
+ align-items: center;
2203
+ justify-content: space-between;
2204
+ gap: 8px;
2205
+ margin: 0 2px 8px;
2206
+ color: var(--dsw-alias-label-secondary, GrayText);
2207
+ }
2208
+
2209
+ .devlead-board-cards {
2210
+ display: grid;
2211
+ grid-template-columns: minmax(0, 1fr);
2212
+ gap: 10px;
2213
+ min-width: 0;
2214
+ }
2215
+
2216
+ .devlead-board-card {
2217
+ min-width: 0;
2218
+ max-width: 100%;
2219
+ padding: 12px;
2220
+ overflow: hidden;
2221
+ border: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2222
+ border-radius: var(--dsw-radius-lg, 12px);
2223
+ background: var(--dsw-specific-menu, Canvas);
2224
+ box-shadow: var(--dsw-elevation-panel, 0 1px 2px rgba(0, 0, 0, 0.08));
2225
+ }
2226
+
2227
+ .devlead-board-card[data-status="blocked"] {
2228
+ border-color: var(--dsw-alias-state-warn-primary, #a15c00);
2229
+ }
2230
+
2231
+ .devlead-board-card-header {
2232
+ align-items: flex-start;
2233
+ flex-wrap: wrap;
2234
+ gap: 8px;
2235
+ }
2236
+
2237
+ .devlead-board-card-heading {
2238
+ flex: 1 1 140px;
2239
+ min-width: 0;
2240
+ }
2241
+
2242
+ .devlead-board-card-heading h5 {
2243
+ overflow-wrap: anywhere;
2244
+ }
2245
+
2246
+ .devlead-board-project-id {
2247
+ display: block;
2248
+ margin-top: 1px;
2249
+ overflow: hidden;
2250
+ color: var(--dsw-alias-label-tertiary, GrayText);
2251
+ font-size: 11px;
2252
+ text-overflow: ellipsis;
2253
+ white-space: nowrap;
2254
+ }
2255
+
2256
+ .devlead-board-card-badges {
2257
+ flex: 0 1 auto;
2258
+ flex-wrap: wrap;
2259
+ justify-content: flex-end;
2260
+ gap: 5px;
2261
+ min-width: 0;
2262
+ max-width: 100%;
2263
+ }
2264
+
2265
+ .devlead-board-status {
2266
+ pointer-events: none;
2267
+ }
2268
+
2269
+ [data-board-status="blocked"] .devlead-board-status {
2270
+ color: var(--dsw-alias-state-warn-primary, #a15c00);
2271
+ }
2272
+
2273
+ [data-board-status="active"] .devlead-board-status {
2274
+ color: var(--dsw-alias-state-business-primary, #4176e6);
2275
+ }
2276
+
2277
+ [data-board-status="done"] .devlead-board-status {
2278
+ color: var(--dsw-alias-state-success-primary, #2e7d32);
2279
+ }
2280
+
2281
+ .devlead-board-workspace {
2282
+ display: block;
2283
+ max-width: 100%;
2284
+ margin-top: 8px;
2285
+ overflow-wrap: anywhere;
2286
+ color: var(--dsw-alias-label-secondary, GrayText);
2287
+ font-size: 11px;
2288
+ white-space: normal;
2289
+ }
2290
+
2291
+ .devlead-board-field {
2292
+ min-width: 0;
2293
+ margin-top: 10px;
2294
+ }
2295
+
2296
+ .devlead-board-field-label {
2297
+ display: block;
2298
+ color: var(--dsw-alias-label-tertiary, GrayText);
2299
+ font-size: 11px;
2300
+ font-weight: 500;
2301
+ }
2302
+
2303
+ .devlead-board-field p {
2304
+ margin: 2px 0 0;
2305
+ overflow-wrap: anywhere;
2306
+ white-space: pre-wrap;
2307
+ }
2308
+
2309
+ .devlead-board-blockers {
2310
+ margin-top: 10px;
2311
+ padding: 8px 10px;
2312
+ border-radius: var(--dsw-radius-lg, 12px);
2313
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12));
2314
+ color: var(--dsw-alias-state-warn-primary, #a15c00);
2315
+ }
2316
+
2317
+ .devlead-board-blockers h6 {
2318
+ display: flex;
2319
+ align-items: center;
2320
+ gap: 5px;
2321
+ }
2322
+
2323
+ .devlead-board-blockers ul,
2324
+ .devlead-board-tasks ul {
2325
+ margin: 6px 0 0;
2326
+ padding: 0;
2327
+ list-style: none;
2328
+ }
2329
+
2330
+ .devlead-board-blockers li + li {
2331
+ margin-top: 8px;
2332
+ padding-top: 8px;
2333
+ border-top: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2334
+ }
2335
+
2336
+ .devlead-board-blockers li > span:first-child {
2337
+ display: block;
2338
+ overflow-wrap: anywhere;
2339
+ white-space: pre-wrap;
2340
+ }
2341
+
2342
+ .devlead-board-blocker-since {
2343
+ display: block;
2344
+ margin-top: 2px;
2345
+ color: var(--dsw-alias-label-secondary, GrayText);
2346
+ font-size: 11px;
2347
+ }
2348
+
2349
+ .devlead-board-tasks {
2350
+ min-width: 0;
2351
+ margin-top: 10px;
2352
+ border-top: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2353
+ }
2354
+
2355
+ .devlead-board-tasks summary,
2356
+ .devlead-board-unlisted summary {
2357
+ min-width: 0;
2358
+ padding: 8px 0 0;
2359
+ overflow-wrap: anywhere;
2360
+ color: var(--dsw-alias-label-secondary, GrayText);
2361
+ cursor: pointer;
2362
+ font-weight: 500;
2363
+ }
2364
+
2365
+ .devlead-board-tasks li {
2366
+ min-width: 0;
2367
+ padding: 8px 0;
2368
+ border-top: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2369
+ }
2370
+
2371
+ .devlead-board-task-heading {
2372
+ align-items: flex-start;
2373
+ gap: 8px;
2374
+ }
2375
+
2376
+ .devlead-board-task-title {
2377
+ flex: 1 1 auto;
2378
+ min-width: 0;
2379
+ overflow-wrap: anywhere;
2380
+ white-space: pre-wrap;
2381
+ }
2382
+
2383
+ .devlead-board-task-heading > span:last-child {
2384
+ flex: none;
2385
+ }
2386
+
2387
+ .devlead-board-task-meta {
2388
+ flex-wrap: wrap;
2389
+ gap: 4px 8px;
2390
+ margin-top: 3px;
2391
+ color: var(--dsw-alias-label-tertiary, GrayText);
2392
+ font-size: 11px;
2393
+ }
2394
+
2395
+ .devlead-board-task-meta code {
2396
+ overflow-wrap: anywhere;
2397
+ font-family: inherit;
2398
+ }
2399
+
2400
+ .devlead-board-card-footer {
2401
+ margin-top: 8px;
2402
+ color: var(--dsw-alias-label-tertiary, GrayText);
2403
+ font-size: 11px;
2404
+ text-align: right;
2405
+ }
2406
+
2407
+ .devlead-board-muted {
2408
+ color: var(--dsw-alias-label-tertiary, GrayText);
2409
+ }
2410
+
2411
+ .devlead-board-unlisted {
2412
+ min-width: 0;
2413
+ margin-top: 16px;
2414
+ padding-top: 2px;
2415
+ border-top: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2416
+ }
2417
+
2418
+ .devlead-board-unlisted-body {
2419
+ padding: 8px 2px 0;
2420
+ color: var(--dsw-alias-label-secondary, GrayText);
2421
+ font-size: 12px;
2422
+ }
2423
+
2424
+ .devlead-board-unlisted-list {
2425
+ margin: 0;
2426
+ padding: 0;
2427
+ list-style: none;
2428
+ }
2429
+
2430
+ .devlead-board-unlisted-list li {
2431
+ min-width: 0;
2432
+ padding: 8px 0;
2433
+ border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
2434
+ }
2435
+
2436
+ .devlead-board-unlisted-list li:last-child {
2437
+ border-bottom: 0;
2438
+ }
2439
+
2440
+ .devlead-board-unlisted-list strong,
2441
+ .devlead-board-unlisted-list code,
2442
+ .devlead-board-unlisted-list span {
2443
+ display: block;
2444
+ min-width: 0;
2445
+ overflow-wrap: anywhere;
2446
+ }
2447
+
2448
+ .devlead-board-unlisted-list strong {
2449
+ color: var(--dsw-alias-label-primary, CanvasText);
2450
+ }
2451
+
2452
+ .devlead-board-unlisted-list code {
2453
+ margin-top: 2px;
2454
+ color: var(--dsw-alias-label-tertiary, GrayText);
2455
+ font-size: 11px;
2456
+ white-space: normal;
2457
+ }
2458
+
2459
+ .devlead-board-unlisted-list span {
2460
+ margin-top: 3px;
2461
+ }
2462
+
2463
+ @media (max-width: 480px) {
2464
+ .devlead-board-header {
2465
+ padding-inline: 10px;
2466
+ }
2467
+
2468
+ .devlead-board-content {
2469
+ padding: 10px;
2470
+ }
2471
+
2472
+ .devlead-board-card {
2473
+ padding: 10px;
2474
+ }
2475
+
2476
+ .devlead-board-refresh-state {
2477
+ margin-left: 0;
2478
+ }
2479
+ }
1176
2480
  `;
1177
2481
  var STYLE_TAG_STATE = /* @__PURE__ */ Symbol.for("@yankeguo/dsh-client-ui-devlead.style-tag");
1178
2482
  function styleTagState() {
@@ -1216,7 +2520,17 @@ window.__ModuleLoader__.load({
1216
2520
 
1217
2521
  // packages/client-ui/src/client/index.tsx
1218
2522
  var NS = "devlead";
1219
- var inject = ["slots", "sessions", "remote", "remote.commands", "locale"];
2523
+ var inject = [
2524
+ "slots",
2525
+ "sessions",
2526
+ "remote",
2527
+ "remote.commands",
2528
+ "remote.workspaceFiles",
2529
+ "locale",
2530
+ "sidebarRight",
2531
+ "sidebarRightTabs",
2532
+ "workspaces"
2533
+ ];
1220
2534
  function apply(ctx) {
1221
2535
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "devlead: dictionaries");
1222
2536
  ctx.effect(() => ensureStyleTag(), "devlead: styles");
@@ -1255,6 +2569,113 @@ window.__ModuleLoader__.load({
1255
2569
  order: 20,
1256
2570
  locale: NS
1257
2571
  }, DevLeadSessionHoverMark));
2572
+ const sessions = ctx.sessions;
2573
+ let boardSurfaceDisposers = [];
2574
+ const boardEligible = (sessionId) => resolveDevLeadBoardSessionConfig(
2575
+ sessionId,
2576
+ sessions.list.getSnapshot().byId[sessionId],
2577
+ currentDevLeadBoardConfig()
2578
+ ) !== void 0;
2579
+ const closeBoardTabs = () => {
2580
+ const onScreen = ctx.sidebarRight.mounted.getSnapshot();
2581
+ if (onScreen === void 0) return;
2582
+ for (const tab of ctx.sidebarRight.openTabs.getSnapshot()) {
2583
+ if (tab.sessionId !== onScreen || tab.kind !== DEVLEAD_BOARD_TAB_KIND) continue;
2584
+ try {
2585
+ ctx.sidebarRight.close(tab.tabId);
2586
+ } catch {
2587
+ }
2588
+ }
2589
+ };
2590
+ const disposeBoardSurfaces = () => {
2591
+ const disposers = boardSurfaceDisposers;
2592
+ if (disposers.length === 0) return;
2593
+ boardSurfaceDisposers = [];
2594
+ for (const dispose of [...disposers].reverse()) {
2595
+ try {
2596
+ dispose();
2597
+ } catch {
2598
+ }
2599
+ }
2600
+ closeBoardTabs();
2601
+ };
2602
+ const ensureBoardSurfaces = (sessionId) => {
2603
+ if (sessionId === void 0) return false;
2604
+ if (boardSurfaceDisposers.length > 0) return true;
2605
+ if (!boardEligible(sessionId)) return false;
2606
+ const t = ctx.locale.bind(NS);
2607
+ const disposers = [];
2608
+ try {
2609
+ disposers.push(ctx.sidebarRightTabs.register({
2610
+ id: DEVLEAD_BOARD_TAB_ID,
2611
+ kind: DEVLEAD_BOARD_TAB_KIND,
2612
+ title: () => t("board.title"),
2613
+ guide: [{
2614
+ id: "open",
2615
+ order: 30,
2616
+ title: () => t("board.title"),
2617
+ description: () => t("board.guide"),
2618
+ icon: import_dsh_client_ui_primitives7.IconFlatListOutlineRegular
2619
+ }]
2620
+ }));
2621
+ disposers.push(ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
2622
+ name: "sidebar.right.pane.tab",
2623
+ key: DEVLEAD_BOARD_TAB_ID,
2624
+ locale: NS,
2625
+ // The body resolves its own path from the tab Session's summary plus
2626
+ // the Host global, so the injected face keeps only the shared Remote.
2627
+ inject: () => ({ files: ctx.remote.workspaceFiles })
2628
+ }, DevLeadBoardPanel)));
2629
+ disposers.push(ctx.slots.inject("sidebar.right.pane.tab.title", () => ctx.slots.register({
2630
+ name: "sidebar.right.pane.tab.title",
2631
+ key: DEVLEAD_BOARD_TAB_ID,
2632
+ locale: NS
2633
+ }, DevLeadBoardTitle)));
2634
+ } catch {
2635
+ for (const dispose of disposers.reverse()) {
2636
+ try {
2637
+ dispose();
2638
+ } catch {
2639
+ }
2640
+ }
2641
+ return false;
2642
+ }
2643
+ boardSurfaceDisposers = disposers;
2644
+ return true;
2645
+ };
2646
+ ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
2647
+ name: "conversation.session.header.utilities",
2648
+ id: "devlead-board",
2649
+ // Next to the shipped Schedule entry (-5), left of the overflow menu.
2650
+ order: -4,
2651
+ locale: NS,
2652
+ inject: (sessionId) => ({
2653
+ onOpen: () => {
2654
+ if (!ensureBoardSurfaces(sessionId)) return;
2655
+ ctx.sidebarRight.openTab(DEVLEAD_BOARD_TAB_KIND);
2656
+ }
2657
+ })
2658
+ }, DevLeadBoardButton));
2659
+ ctx.effect(() => {
2660
+ const sync = () => {
2661
+ const onScreen = ctx.sidebarRight.mounted.getSnapshot();
2662
+ if (onScreen !== void 0 && boardEligible(onScreen)) {
2663
+ ensureBoardSurfaces(onScreen);
2664
+ } else {
2665
+ disposeBoardSurfaces();
2666
+ closeBoardTabs();
2667
+ }
2668
+ };
2669
+ const offMounted = ctx.sidebarRight.mounted.subscribe(sync);
2670
+ const offSessions = sessions.list.subscribe(sync);
2671
+ sync();
2672
+ return () => {
2673
+ offMounted();
2674
+ offSessions();
2675
+ disposeBoardSurfaces();
2676
+ closeBoardTabs();
2677
+ };
2678
+ }, "devlead: board surfaces");
1258
2679
  }
1259
2680
 
1260
2681
  return module.exports;