dsh-project-tasks 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,1088 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-project-tasks",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react = require("react");
8
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ //#region ../../../source/deepseek-harness/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
11
+ function r(e) {
12
+ var t, f, n = "";
13
+ if ("string" == typeof e || "number" == typeof e) n += e;
14
+ else if ("object" == typeof e) if (Array.isArray(e)) {
15
+ var o = e.length;
16
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
17
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
18
+ return n;
19
+ }
20
+ function clsx() {
21
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
22
+ return n;
23
+ }
24
+ //#endregion
25
+ //#region src/client/api.ts
26
+ /** Path prefix owning every task-board route. */
27
+ const BASE = "/taskboard";
28
+ /** Unwrap the `{ok, ...}` envelope, throwing on a transport or payload error. */
29
+ async function unwrap(pending) {
30
+ const res = await pending;
31
+ let body;
32
+ try {
33
+ body = await res.json();
34
+ } catch {
35
+ throw new Error(`task-board: HTTP ${res.status}`);
36
+ }
37
+ const record = body;
38
+ if (!res.ok || record.ok !== true) throw new Error(record.error ?? `task-board: HTTP ${res.status}`);
39
+ return body;
40
+ }
41
+ const post = (path, body, signal) => fetch(`${BASE}${path}`, {
42
+ method: "POST",
43
+ headers: { "content-type": "application/json" },
44
+ body: JSON.stringify(body),
45
+ ...signal === void 0 ? {} : { signal }
46
+ });
47
+ /** Read the full board snapshot. */
48
+ async function fetchState(signal) {
49
+ return (await unwrap(fetch(`${BASE}/api/state`, signal === void 0 ? {} : { signal }))).state;
50
+ }
51
+ /** Create a task. */
52
+ async function createTask(input) {
53
+ return (await unwrap(post("/api/create", input))).task;
54
+ }
55
+ /** Update a task (title/description/priority/status/doneSummary/doneFiles). */
56
+ async function updateTask(input) {
57
+ return (await unwrap(post("/api/update", input))).task;
58
+ }
59
+ /** Delete a task. */
60
+ async function deleteTask(id) {
61
+ return (await unwrap(post("/api/delete", { id }))).deleted;
62
+ }
63
+ /** Run a lifecycle action (start/verify/reject/block/unblock) on a task. */
64
+ async function taskAction(id, action, reason) {
65
+ return (await unwrap(post("/api/update", {
66
+ id,
67
+ action,
68
+ ...reason === void 0 ? {} : { blockedReason: reason }
69
+ }))).task;
70
+ }
71
+ /** Archive every done task (optionally scoped to a project); returns the count. */
72
+ async function archiveDone(project) {
73
+ return (await unwrap(post("/api/archive-done", project === void 0 ? {} : { project }))).archived;
74
+ }
75
+ /** Enable/disable the background auto-claim poller. */
76
+ async function setAutoClaim(enabled) {
77
+ return (await unwrap(post("/api/auto-claim", { enabled }))).autoClaim;
78
+ }
79
+ /**
80
+ * Subscribe to the board's live state over SSE.
81
+ * @param onState - called with every pushed board state (including the opening one).
82
+ * @returns a function closing the connection.
83
+ */
84
+ function subscribeBoard(onState) {
85
+ const source = new EventSource(`${BASE}/events`);
86
+ source.onmessage = (event) => {
87
+ try {
88
+ const frame = JSON.parse(event.data);
89
+ if (frame.type === "state" && frame.state !== void 0) onState(frame.state);
90
+ } catch {}
91
+ };
92
+ return () => {
93
+ source.close();
94
+ };
95
+ }
96
+ //#endregion
97
+ //#region \0dsh-css:/Users/hyper/Documents/hyper/project/extensions/dsh-task-board/src/client/TaskBoardPage.module.css.mjs
98
+ const css = ".UxClrW_page{background:var(--dsw-alias-bg-base);flex-direction:column;height:100%;display:flex;overflow:hidden}.UxClrW_header{flex:none;justify-content:space-between;align-items:flex-start;gap:16px;padding:24px 28px 0;display:flex}.UxClrW_headerLeft{min-width:0}.UxClrW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:20px;font-weight:600}.UxClrW_subtitle{color:var(--dsw-alias-label-tertiary);margin:3px 0 0;font-size:12.5px}.UxClrW_headerRight{flex:none;align-items:center;gap:8px;display:flex}.UxClrW_projectPicker{align-items:center;gap:6px;display:inline-flex}.UxClrW_projectLabel{color:var(--dsw-alias-label-tertiary);font-size:12px}.UxClrW_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);max-width:240px;height:30px;color:var(--dsw-alias-label-secondary);border-radius:8px;padding:0 8px;font-size:12.5px}.UxClrW_refresh,.UxClrW_newBtn,.UxClrW_ghostBtn{cursor:pointer;white-space:nowrap;border-radius:8px;align-items:center;gap:6px;height:30px;padding:0 12px;font-size:12.5px;display:inline-flex}.UxClrW_refresh,.UxClrW_ghostBtn{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary)}.UxClrW_refresh:hover,.UxClrW_ghostBtn:hover{background:var(--dsw-alias-interactive-bg-hover)}.UxClrW_newBtn{background:var(--dsw-alias-button-primary-fill,#2f6feb);color:var(--dsw-alias-label-primary-inverted,#fff);border:none;font-weight:550}.UxClrW_newBtn:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,#2f6feb)}.UxClrW_newBtn:disabled{opacity:.45;cursor:not-allowed}.UxClrW_error{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);border-radius:8px;margin:12px 28px 0;padding:8px 12px;font-size:12.5px}.UxClrW_draft{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1,#00000005);border-radius:12px;flex-wrap:wrap;align-items:center;gap:8px;margin:14px 28px 0;padding:12px;display:flex}.UxClrW_input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);min-width:160px;height:30px;color:var(--dsw-alias-label-primary);border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.UxClrW_input:focus-visible,.UxClrW_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#2f6feb);outline-offset:1px}.UxClrW_board{flex:1;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));align-items:start;gap:14px;padding:16px 28px 40px;display:grid;overflow-y:auto}.UxClrW_loading{color:var(--dsw-alias-label-tertiary);flex:1;justify-content:center;align-items:center;font-size:13px;display:flex}.UxClrW_column{background:var(--dsw-alias-bg-layer-1,#00000005);border-radius:14px;flex-direction:column;gap:10px;min-width:0;padding:12px;display:flex}.UxClrW_columnDone{opacity:.96}.UxClrW_columnHeader{align-items:center;gap:8px;padding:2px 4px 6px;display:flex}.UxClrW_columnDot{background:var(--dsw-alias-label-tertiary);border-radius:50%;width:8px;height:8px}.UxClrW_columnDot[data-status=todo]{background:var(--dsw-alias-label-tertiary)}.UxClrW_columnDot[data-status=in_progress]{background:var(--dsw-alias-brand-primary,#2f6feb)}.UxClrW_columnDot[data-status=done]{background:var(--dsw-alias-state-business-primary,#10a37f)}.UxClrW_columnTitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.UxClrW_columnCount{min-width:20px;height:18px;color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:999px;justify-content:center;align-items:center;padding:0 6px;font-size:11px;font-weight:600;display:inline-flex}.UxClrW_columnEmpty{color:var(--dsw-alias-label-tertiary);margin:8px 4px;font-size:12px}.UxClrW_cardList{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.UxClrW_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);border-radius:11px;flex-direction:column;gap:7px;padding:11px 12px;display:flex}.UxClrW_cardHigh{border-color:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b7791f) 45%, var(--dsw-alias-border-l2))}.UxClrW_cardTop{align-items:baseline;gap:8px;display:flex}.UxClrW_cardTitle{min-width:0;color:var(--dsw-alias-label-primary);word-break:break-word;flex:1;font-size:13px;font-weight:550}.UxClrW_cardAge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.UxClrW_cardDesc{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;margin:0;font-size:12px;line-height:1.45}.UxClrW_cardMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:6px;font-size:11px;display:flex}.UxClrW_projectBadge{background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;padding:1px 7px}.UxClrW_priorityBadge{border-radius:6px;padding:1px 7px}.UxClrW_priorityBadge[data-p=high]{color:var(--dsw-alias-state-warn-primary,#b7791f);background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b7791f) 14%, transparent)}.UxClrW_priorityBadge[data-p=low]{color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-interactive-bg-hover)}.UxClrW_claimed{color:var(--dsw-alias-label-tertiary)}.UxClrW_doneSummary{border-top:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);word-break:break-word;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;margin:0;padding-top:6px;font-size:11.5px;line-height:1.45;display:-webkit-box;overflow:hidden}.UxClrW_doneSummary:hover,.UxClrW_doneSummary:focus-visible{-webkit-line-clamp:unset;line-clamp:unset;overflow:visible}.UxClrW_cardActions{align-items:center;gap:6px;display:flex}.UxClrW_iconBtn{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);min-width:26px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:6px;justify-content:center;align-items:center;padding:0 6px;font-size:12px;display:inline-flex}.UxClrW_iconBtn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.UxClrW_iconBtn:disabled{opacity:.35;cursor:not-allowed}.UxClrW_deleteBtn:hover{color:var(--dsw-alias-state-error-primary)}.UxClrW_deleteConfirm{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary);font-size:11px}@media (width<=900px){.UxClrW_board{grid-template-columns:minmax(0,1fr)}}.UxClrW_autoToggle{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);cursor:pointer;white-space:nowrap;border-radius:8px;align-items:center;gap:7px;height:30px;padding:0 10px;display:inline-flex}.UxClrW_autoInput{opacity:0;pointer-events:none;width:1px;height:1px;position:absolute}.UxClrW_autoSwitch{background:var(--dsw-alias-border-l3,#c8c8cc);border-radius:999px;flex:none;width:28px;height:16px;transition:background .14s;position:relative}.UxClrW_autoSwitch:after{content:\"\";background:var(--dsw-static-neutral-00,#fff);border-radius:50%;width:12px;height:12px;transition:transform .14s;position:absolute;top:2px;left:2px;box-shadow:0 1px 2px #00000040}.UxClrW_autoInput:checked+.UxClrW_autoSwitch{background:var(--dsw-alias-state-business-primary,#2f6feb)}.UxClrW_autoInput:checked+.UxClrW_autoSwitch:after{transform:translate(12px)}.UxClrW_autoInput:focus-visible+.UxClrW_autoSwitch{outline:2px solid var(--dsw-alias-brand-primary,#2f6feb);outline-offset:2px}.UxClrW_autoLabel{color:var(--dsw-alias-label-secondary);font-size:12.5px}.UxClrW_readyToggle{color:var(--dsw-alias-label-secondary);white-space:nowrap;align-items:center;gap:6px;font-size:12px;display:inline-flex}.UxClrW_cardActions{flex-wrap:wrap;align-items:center;gap:6px;margin-top:2px;display:flex}.UxClrW_actionBtn{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:6px;padding:0 9px;font-size:11.5px}.UxClrW_actionBtn:hover{background:var(--dsw-alias-interactive-bg-hover)}.UxClrW_actionPrimary{background:var(--dsw-alias-button-primary-fill,#2f6feb);color:var(--dsw-alias-label-primary-inverted,#fff);border:none;font-weight:550}.UxClrW_actionPrimary:hover{background:var(--dsw-alias-button-primary-hover,#2f6feb)}.UxClrW_actionGhost{color:var(--dsw-alias-label-tertiary)}.UxClrW_columnBlocked{background:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d33) 6%, transparent)}.UxClrW_cardBlocked{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d33) 40%, var(--dsw-alias-border-l2))}.UxClrW_blockReason{color:var(--dsw-alias-state-error-primary);margin:0;font-size:11.5px}.UxClrW_columnDot[data-status=draft]{background:var(--dsw-alias-label-tertiary)}.UxClrW_columnDot[data-status=ready]{background:var(--dsw-alias-state-warn-primary,#b7791f)}.UxClrW_columnDot[data-status=review]{background:var(--dsw-alias-state-business-tertiary,#2f6feb)}.UxClrW_columnDot[data-status=blocked]{background:var(--dsw-alias-state-error-primary,#d33)}.UxClrW_deleteBtn{margin-left:auto}.UxClrW_tabActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.UxClrW_columnAction{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);height:20px;color:var(--dsw-alias-label-tertiary);cursor:pointer;border-radius:6px;margin-left:auto;padding:0 7px;font-size:10.5px}.UxClrW_columnAction:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.UxClrW_moreBtn{border:1px dashed var(--dsw-alias-border-l2);height:26px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border-radius:8px;align-self:flex-start;margin-top:4px;padding:0 10px;font-size:12px}.UxClrW_moreBtn:hover{color:var(--dsw-alias-label-secondary);border-style:solid}.UxClrW_archivePane{flex:1;max-width:900px;padding:16px 28px 40px;overflow-y:auto}.UxClrW_archiveHead{align-items:center;gap:8px;margin-bottom:12px;display:flex}.UxClrW_archiveTitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:15px;font-weight:600}.UxClrW_editTextarea{resize:vertical;height:auto;min-height:54px;padding:6px 10px;font-family:inherit;line-height:1.4}";
99
+ const tagId = "dsh-project-tasks/TaskBoardPage.module.css";
100
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
101
+ const tag = document.createElement("style");
102
+ tag.dataset.plugin = "dsh-project-tasks";
103
+ tag.dataset.pluginCss = tagId;
104
+ tag.textContent = css;
105
+ document.head.appendChild(tag);
106
+ }
107
+ var TaskBoardPage_module_css_default = {
108
+ "actionBtn": "UxClrW_actionBtn",
109
+ "actionGhost": "UxClrW_actionGhost",
110
+ "actionPrimary": "UxClrW_actionPrimary",
111
+ "archiveHead": "UxClrW_archiveHead",
112
+ "archivePane": "UxClrW_archivePane",
113
+ "archiveTitle": "UxClrW_archiveTitle",
114
+ "autoInput": "UxClrW_autoInput",
115
+ "autoLabel": "UxClrW_autoLabel",
116
+ "autoSwitch": "UxClrW_autoSwitch",
117
+ "autoToggle": "UxClrW_autoToggle",
118
+ "blockReason": "UxClrW_blockReason",
119
+ "board": "UxClrW_board",
120
+ "card": "UxClrW_card",
121
+ "cardActions": "UxClrW_cardActions",
122
+ "cardAge": "UxClrW_cardAge",
123
+ "cardBlocked": "UxClrW_cardBlocked",
124
+ "cardDesc": "UxClrW_cardDesc",
125
+ "cardHigh": "UxClrW_cardHigh",
126
+ "cardList": "UxClrW_cardList",
127
+ "cardMeta": "UxClrW_cardMeta",
128
+ "cardTitle": "UxClrW_cardTitle",
129
+ "cardTop": "UxClrW_cardTop",
130
+ "claimed": "UxClrW_claimed",
131
+ "column": "UxClrW_column",
132
+ "columnAction": "UxClrW_columnAction",
133
+ "columnBlocked": "UxClrW_columnBlocked",
134
+ "columnCount": "UxClrW_columnCount",
135
+ "columnDone": "UxClrW_columnDone",
136
+ "columnDot": "UxClrW_columnDot",
137
+ "columnEmpty": "UxClrW_columnEmpty",
138
+ "columnHeader": "UxClrW_columnHeader",
139
+ "columnTitle": "UxClrW_columnTitle",
140
+ "deleteBtn": "UxClrW_deleteBtn",
141
+ "deleteConfirm": "UxClrW_deleteConfirm",
142
+ "doneSummary": "UxClrW_doneSummary",
143
+ "draft": "UxClrW_draft",
144
+ "editTextarea": "UxClrW_editTextarea",
145
+ "error": "UxClrW_error",
146
+ "ghostBtn": "UxClrW_ghostBtn",
147
+ "header": "UxClrW_header",
148
+ "headerLeft": "UxClrW_headerLeft",
149
+ "headerRight": "UxClrW_headerRight",
150
+ "iconBtn": "UxClrW_iconBtn",
151
+ "input": "UxClrW_input",
152
+ "loading": "UxClrW_loading",
153
+ "moreBtn": "UxClrW_moreBtn",
154
+ "newBtn": "UxClrW_newBtn",
155
+ "page": "UxClrW_page",
156
+ "priorityBadge": "UxClrW_priorityBadge",
157
+ "projectBadge": "UxClrW_projectBadge",
158
+ "projectLabel": "UxClrW_projectLabel",
159
+ "projectPicker": "UxClrW_projectPicker",
160
+ "readyToggle": "UxClrW_readyToggle",
161
+ "refresh": "UxClrW_refresh",
162
+ "select": "UxClrW_select",
163
+ "subtitle": "UxClrW_subtitle",
164
+ "tabActive": "UxClrW_tabActive",
165
+ "title": "UxClrW_title"
166
+ };
167
+ //#endregion
168
+ //#region src/client/TaskBoardPage.tsx
169
+ /**
170
+ * DSH Task Board page: a kanban of project tasks across the full lifecycle —
171
+ * Draft · Ready · In progress · Review · Done · Blocked. The human creates and
172
+ * moves tasks; an agent processes a project's ready/in-progress tasks via the
173
+ * `task_board_*` tools; the board stays live over SSE.
174
+ */
175
+ /** Columns in board order. */
176
+ const COLUMNS = [
177
+ "draft",
178
+ "ready",
179
+ "in_progress",
180
+ "review",
181
+ "done",
182
+ "blocked"
183
+ ];
184
+ /** How many done cards show before the Done column collapses. */
185
+ const DONE_COLLAPSED = 10;
186
+ /** Last path segment of a directory. */
187
+ function baseName(path) {
188
+ const parts = path.replace(/\\/g, "/").split("/").filter(Boolean);
189
+ return parts[parts.length - 1] ?? path;
190
+ }
191
+ /** Relative "updated" label. */
192
+ function ageLabel(updatedAt, now, t) {
193
+ const diff = Math.max(0, now - updatedAt);
194
+ const min = 6e4;
195
+ if (diff < min) return t("time.now");
196
+ if (diff < 60 * min) return t("time.minutes", { n: Math.floor(diff / min) });
197
+ if (diff < 1440 * min) return t("time.hours", { n: Math.floor(diff / (60 * min)) });
198
+ return t("time.days", { n: Math.floor(diff / (1440 * min)) });
199
+ }
200
+ /**
201
+ * Render the task board.
202
+ * @param props - injected services and copy.
203
+ * @returns the global task-board page.
204
+ */
205
+ function TaskBoardPage(props) {
206
+ const { useWorkspaces, currentProject, t } = props;
207
+ const workspaceSnapshot = useWorkspaces((state) => state);
208
+ const projects = (0, react.useMemo)(() => {
209
+ const seen = /* @__PURE__ */ new Set();
210
+ const out = [];
211
+ for (const item of workspaceSnapshot.items) {
212
+ if (item.path === "" || seen.has(item.path)) continue;
213
+ seen.add(item.path);
214
+ out.push({
215
+ path: item.path,
216
+ title: item.title
217
+ });
218
+ }
219
+ return out;
220
+ }, [workspaceSnapshot]);
221
+ const [board, setBoard] = (0, react.useState)(void 0);
222
+ const [error, setError] = (0, react.useState)(void 0);
223
+ const [now, setNow] = (0, react.useState)(() => Date.now());
224
+ const [projectFilter, setProjectFilter] = (0, react.useState)("all");
225
+ const [priorityFilter, setPriorityFilter] = (0, react.useState)("all");
226
+ const [drafting, setDrafting] = (0, react.useState)(false);
227
+ const [draftProject, setDraftProject] = (0, react.useState)("");
228
+ const [draftTitle, setDraftTitle] = (0, react.useState)("");
229
+ const [draftDesc, setDraftDesc] = (0, react.useState)("");
230
+ const [draftPriority, setDraftPriority] = (0, react.useState)("normal");
231
+ const [draftReady, setDraftReady] = (0, react.useState)(false);
232
+ const [draftReuseIdle, setDraftReuseIdle] = (0, react.useState)(false);
233
+ const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(void 0);
234
+ const [showArchived, setShowArchived] = (0, react.useState)(false);
235
+ const [doneExpanded, setDoneExpanded] = (0, react.useState)(false);
236
+ (0, react.useEffect)(() => {
237
+ const timer = setInterval(() => {
238
+ setNow(Date.now());
239
+ }, 3e4);
240
+ return () => {
241
+ clearInterval(timer);
242
+ };
243
+ }, []);
244
+ (0, react.useEffect)(() => {
245
+ let alive = true;
246
+ fetchState().then((state) => {
247
+ if (alive) {
248
+ setBoard(state);
249
+ setError(void 0);
250
+ }
251
+ }).catch((e) => {
252
+ if (alive) setError(e instanceof Error ? e.message : String(e));
253
+ });
254
+ const close = subscribeBoard((state) => {
255
+ setBoard(state);
256
+ setError(void 0);
257
+ });
258
+ return () => {
259
+ alive = false;
260
+ close();
261
+ };
262
+ }, []);
263
+ const refresh = async () => {
264
+ try {
265
+ setBoard(await fetchState());
266
+ setError(void 0);
267
+ } catch (e) {
268
+ setError(e instanceof Error ? e.message : String(e));
269
+ }
270
+ };
271
+ const run = async (op) => {
272
+ try {
273
+ await op();
274
+ } catch (e) {
275
+ setError(e instanceof Error ? e.message : String(e));
276
+ }
277
+ };
278
+ const defaultProject = currentProject !== void 0 && currentProject !== "" ? currentProject : projects[0]?.path ?? "";
279
+ const openDraft = () => {
280
+ setDrafting(true);
281
+ setDraftProject(defaultProject);
282
+ setDraftTitle("");
283
+ setDraftDesc("");
284
+ setDraftPriority("normal");
285
+ setDraftReady(false);
286
+ setDraftReuseIdle(false);
287
+ };
288
+ const submitDraft = async () => {
289
+ const title = draftTitle.trim();
290
+ if (title === "" || draftProject === "") return;
291
+ await run(async () => {
292
+ await createTask({
293
+ project: draftProject,
294
+ title,
295
+ ...draftDesc.trim() === "" ? {} : { description: draftDesc.trim() },
296
+ priority: draftPriority,
297
+ status: draftReady ? "ready" : "draft",
298
+ reuseIdle: draftReuseIdle
299
+ });
300
+ setDrafting(false);
301
+ });
302
+ };
303
+ const remove = async (id) => {
304
+ if (confirmDeleteId !== id) {
305
+ setConfirmDeleteId(id);
306
+ return;
307
+ }
308
+ setConfirmDeleteId(void 0);
309
+ await run(() => deleteTask(id));
310
+ };
311
+ const tasks = board?.tasks ?? [];
312
+ const inProject = (task) => projectFilter === "all" || task.project === projectFilter;
313
+ const inPriority = (task) => priorityFilter === "all" || task.priority === priorityFilter;
314
+ const visible = tasks.filter((task) => task.archived !== true && inProject(task) && inPriority(task));
315
+ const archivedTasks = tasks.filter((task) => task.archived === true && inProject(task)).sort((a, b) => b.updatedAt - a.updatedAt);
316
+ const rank = (p) => p === "high" ? 2 : p === "normal" ? 1 : 0;
317
+ const byStatus = (status) => visible.filter((task) => task.status === status).sort((a, b) => rank(b.priority) - rank(a.priority) || b.updatedAt - a.updatedAt);
318
+ const autoClaim = board?.autoClaim === true;
319
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
320
+ className: TaskBoardPage_module_css_default.page,
321
+ "aria-label": t("page.title"),
322
+ "data-testid": "task-board-page",
323
+ children: [
324
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
325
+ className: TaskBoardPage_module_css_default.header,
326
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
327
+ className: TaskBoardPage_module_css_default.headerLeft,
328
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
329
+ className: TaskBoardPage_module_css_default.title,
330
+ children: t("page.title")
331
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
332
+ className: TaskBoardPage_module_css_default.subtitle,
333
+ children: t("page.subtitle")
334
+ })]
335
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
336
+ className: TaskBoardPage_module_css_default.headerRight,
337
+ children: [
338
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
339
+ className: TaskBoardPage_module_css_default.autoToggle,
340
+ title: t("auto.hint"),
341
+ children: [
342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
343
+ type: "checkbox",
344
+ className: TaskBoardPage_module_css_default.autoInput,
345
+ checked: autoClaim,
346
+ onChange: (e) => {
347
+ run(() => setAutoClaim(e.target.checked));
348
+ }
349
+ }),
350
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
351
+ className: TaskBoardPage_module_css_default.autoSwitch,
352
+ "aria-hidden": "true"
353
+ }),
354
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
355
+ className: TaskBoardPage_module_css_default.autoLabel,
356
+ children: t("auto.label")
357
+ })
358
+ ]
359
+ }),
360
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
361
+ className: TaskBoardPage_module_css_default.projectPicker,
362
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
363
+ className: TaskBoardPage_module_css_default.projectLabel,
364
+ children: t("priority.label")
365
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
366
+ className: TaskBoardPage_module_css_default.select,
367
+ value: priorityFilter,
368
+ onChange: (e) => {
369
+ setPriorityFilter(e.target.value);
370
+ },
371
+ children: [
372
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
373
+ value: "all",
374
+ children: t("priority.all")
375
+ }),
376
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
377
+ value: "high",
378
+ children: t("priority.high")
379
+ }),
380
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
381
+ value: "normal",
382
+ children: t("priority.normal")
383
+ }),
384
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
385
+ value: "low",
386
+ children: t("priority.low")
387
+ })
388
+ ]
389
+ })]
390
+ }),
391
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
392
+ className: TaskBoardPage_module_css_default.projectPicker,
393
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
394
+ className: TaskBoardPage_module_css_default.projectLabel,
395
+ children: t("project.label")
396
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
397
+ className: TaskBoardPage_module_css_default.select,
398
+ value: projectFilter,
399
+ onChange: (e) => {
400
+ setProjectFilter(e.target.value);
401
+ },
402
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
403
+ value: "all",
404
+ children: t("project.all")
405
+ }), projects.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
406
+ value: p.path,
407
+ children: [
408
+ p.title,
409
+ " · ",
410
+ baseName(p.path)
411
+ ]
412
+ }, p.path))]
413
+ })]
414
+ }),
415
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
416
+ type: "button",
417
+ className: TaskBoardPage_module_css_default.refresh,
418
+ "aria-label": t("refresh"),
419
+ onClick: () => {
420
+ refresh();
421
+ },
422
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 13 }), t("refresh")]
423
+ }),
424
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
425
+ type: "button",
426
+ className: clsx(TaskBoardPage_module_css_default.refresh, showArchived && TaskBoardPage_module_css_default.tabActive),
427
+ onClick: () => {
428
+ setShowArchived((v) => !v);
429
+ },
430
+ children: showArchived ? t("archive.back") : t("archive.open")
431
+ }),
432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
433
+ type: "button",
434
+ className: TaskBoardPage_module_css_default.newBtn,
435
+ onClick: openDraft,
436
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 13 }), t("new.action")]
437
+ })
438
+ ]
439
+ })]
440
+ }),
441
+ error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
442
+ className: TaskBoardPage_module_css_default.error,
443
+ role: "alert",
444
+ children: t("error.load", { message: error })
445
+ }),
446
+ drafting && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
447
+ className: TaskBoardPage_module_css_default.draft,
448
+ children: [
449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
450
+ className: TaskBoardPage_module_css_default.select,
451
+ value: draftProject,
452
+ onChange: (e) => {
453
+ setDraftProject(e.target.value);
454
+ },
455
+ "aria-label": t("new.projectPrompt"),
456
+ children: [projects.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
457
+ value: "",
458
+ children: t("new.projectPrompt")
459
+ }), projects.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
460
+ value: p.path,
461
+ children: [
462
+ p.title,
463
+ " · ",
464
+ baseName(p.path)
465
+ ]
466
+ }, p.path))]
467
+ }),
468
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
469
+ className: TaskBoardPage_module_css_default.input,
470
+ placeholder: t("new.placeholder.title"),
471
+ value: draftTitle,
472
+ onChange: (e) => {
473
+ setDraftTitle(e.target.value);
474
+ }
475
+ }),
476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
477
+ className: TaskBoardPage_module_css_default.input,
478
+ placeholder: t("new.placeholder.description"),
479
+ value: draftDesc,
480
+ onChange: (e) => {
481
+ setDraftDesc(e.target.value);
482
+ }
483
+ }),
484
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
485
+ className: TaskBoardPage_module_css_default.select,
486
+ value: draftPriority,
487
+ onChange: (e) => {
488
+ setDraftPriority(e.target.value);
489
+ },
490
+ "aria-label": "priority",
491
+ children: [
492
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
493
+ value: "low",
494
+ children: t("priority.low")
495
+ }),
496
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
497
+ value: "normal",
498
+ children: t("priority.normal")
499
+ }),
500
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
501
+ value: "high",
502
+ children: t("priority.high")
503
+ })
504
+ ]
505
+ }),
506
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
507
+ className: TaskBoardPage_module_css_default.readyToggle,
508
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
509
+ type: "checkbox",
510
+ checked: draftReady,
511
+ onChange: (e) => {
512
+ setDraftReady(e.target.checked);
513
+ }
514
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("new.readyNow") })]
515
+ }),
516
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
517
+ className: TaskBoardPage_module_css_default.readyToggle,
518
+ title: t("new.reuseIdleHint"),
519
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
520
+ type: "checkbox",
521
+ checked: draftReuseIdle,
522
+ onChange: (e) => {
523
+ setDraftReuseIdle(e.target.checked);
524
+ }
525
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("new.reuseIdle") })]
526
+ }),
527
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
528
+ type: "button",
529
+ className: TaskBoardPage_module_css_default.newBtn,
530
+ disabled: draftTitle.trim() === "" || draftProject === "",
531
+ onClick: () => {
532
+ submitDraft();
533
+ },
534
+ children: t("new.submit")
535
+ }),
536
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
537
+ type: "button",
538
+ className: TaskBoardPage_module_css_default.ghostBtn,
539
+ onClick: () => {
540
+ setDrafting(false);
541
+ },
542
+ children: t("new.cancel")
543
+ })
544
+ ]
545
+ }),
546
+ board === void 0 && error === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
547
+ className: TaskBoardPage_module_css_default.loading,
548
+ children: t("loading")
549
+ }) : showArchived ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
550
+ className: TaskBoardPage_module_css_default.archivePane,
551
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
552
+ className: TaskBoardPage_module_css_default.archiveHead,
553
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
554
+ className: TaskBoardPage_module_css_default.archiveTitle,
555
+ children: t("archive.title")
556
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
557
+ className: TaskBoardPage_module_css_default.columnCount,
558
+ children: archivedTasks.length
559
+ })]
560
+ }), archivedTasks.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
561
+ className: TaskBoardPage_module_css_default.columnEmpty,
562
+ children: t("archive.empty")
563
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
564
+ className: TaskBoardPage_module_css_default.cardList,
565
+ children: archivedTasks.map((task) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TaskCard, {
566
+ task,
567
+ now,
568
+ t,
569
+ confirming: confirmDeleteId === task.id,
570
+ onAction: (action) => {
571
+ run(() => taskAction(task.id, action));
572
+ },
573
+ onStatus: (status2) => {
574
+ run(() => updateTask({
575
+ id: task.id,
576
+ status: status2
577
+ }));
578
+ },
579
+ onSave: (patch) => {
580
+ run(() => updateTask({
581
+ id: task.id,
582
+ ...patch
583
+ }));
584
+ },
585
+ onDelete: () => {
586
+ remove(task.id);
587
+ }
588
+ }, task.id))
589
+ })]
590
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
591
+ className: TaskBoardPage_module_css_default.board,
592
+ children: COLUMNS.map((status) => {
593
+ const all = byStatus(status);
594
+ const isDone = status === "done";
595
+ const collapsed = isDone && !doneExpanded && all.length > DONE_COLLAPSED;
596
+ const items = collapsed ? all.slice(0, DONE_COLLAPSED) : all;
597
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
598
+ className: clsx(TaskBoardPage_module_css_default.column, status === "blocked" && TaskBoardPage_module_css_default.columnBlocked, isDone && TaskBoardPage_module_css_default.columnDone),
599
+ "aria-label": t(`column.${status}`),
600
+ children: [
601
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
602
+ className: TaskBoardPage_module_css_default.columnHeader,
603
+ children: [
604
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
605
+ className: TaskBoardPage_module_css_default.columnDot,
606
+ "data-status": status,
607
+ "aria-hidden": "true"
608
+ }),
609
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
610
+ className: TaskBoardPage_module_css_default.columnTitle,
611
+ children: t(`column.${status}`)
612
+ }),
613
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
614
+ className: TaskBoardPage_module_css_default.columnCount,
615
+ children: all.length
616
+ }),
617
+ isDone && all.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
618
+ type: "button",
619
+ className: TaskBoardPage_module_css_default.columnAction,
620
+ onClick: () => {
621
+ run(() => archiveDone(projectFilter === "all" ? void 0 : projectFilter));
622
+ },
623
+ children: t("archive.allDone")
624
+ })
625
+ ]
626
+ }),
627
+ items.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
628
+ className: TaskBoardPage_module_css_default.columnEmpty,
629
+ children: t(`column.empty.${status}`)
630
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
631
+ className: TaskBoardPage_module_css_default.cardList,
632
+ children: items.map((task) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TaskCard, {
633
+ task,
634
+ now,
635
+ t,
636
+ confirming: confirmDeleteId === task.id,
637
+ onAction: (action) => {
638
+ run(() => taskAction(task.id, action));
639
+ },
640
+ onStatus: (status2) => {
641
+ run(() => updateTask({
642
+ id: task.id,
643
+ status: status2
644
+ }));
645
+ },
646
+ onSave: (patch) => {
647
+ run(() => updateTask({
648
+ id: task.id,
649
+ ...patch
650
+ }));
651
+ },
652
+ onDelete: () => {
653
+ remove(task.id);
654
+ }
655
+ }, task.id))
656
+ }),
657
+ collapsed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
658
+ type: "button",
659
+ className: TaskBoardPage_module_css_default.moreBtn,
660
+ onClick: () => {
661
+ setDoneExpanded(true);
662
+ },
663
+ children: t("archive.showMore", { n: all.length - DONE_COLLAPSED })
664
+ }),
665
+ isDone && doneExpanded && all.length > DONE_COLLAPSED && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
666
+ type: "button",
667
+ className: TaskBoardPage_module_css_default.moreBtn,
668
+ onClick: () => {
669
+ setDoneExpanded(false);
670
+ },
671
+ children: t("archive.showLess")
672
+ })
673
+ ]
674
+ }, status);
675
+ })
676
+ })
677
+ ]
678
+ });
679
+ }
680
+ /** One task card with lifecycle-appropriate actions. */
681
+ function TaskCard(props) {
682
+ const { task, now, confirming, t, onAction, onStatus, onDelete, onSave } = props;
683
+ const [editing, setEditing] = (0, react.useState)(false);
684
+ const [eTitle, setETitle] = (0, react.useState)(task.title);
685
+ const [eDesc, setEDesc] = (0, react.useState)(task.description ?? "");
686
+ const [ePriority, setEPriority] = (0, react.useState)(task.priority);
687
+ const beginEdit = () => {
688
+ setETitle(task.title);
689
+ setEDesc(task.description ?? "");
690
+ setEPriority(task.priority);
691
+ setEditing(true);
692
+ };
693
+ const commitEdit = () => {
694
+ const title = eTitle.trim();
695
+ if (title === "") return;
696
+ onSave({
697
+ title,
698
+ ...eDesc.trim() === "" ? {} : { description: eDesc.trim() },
699
+ priority: ePriority
700
+ });
701
+ setEditing(false);
702
+ };
703
+ const btn = (label, onClick, cls) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
704
+ type: "button",
705
+ className: clsx(TaskBoardPage_module_css_default.actionBtn, cls),
706
+ onClick,
707
+ children: label
708
+ });
709
+ let actions;
710
+ switch (task.status) {
711
+ case "draft":
712
+ actions = [btn(t("act.confirmReady"), () => {
713
+ onStatus("ready");
714
+ }, TaskBoardPage_module_css_default.actionPrimary)];
715
+ break;
716
+ case "ready":
717
+ actions = [btn(t("act.start"), () => {
718
+ onAction("start");
719
+ }, TaskBoardPage_module_css_default.actionPrimary)];
720
+ break;
721
+ case "in_progress":
722
+ actions = [btn(t("act.complete"), () => {
723
+ onStatus("review");
724
+ }, TaskBoardPage_module_css_default.actionPrimary)];
725
+ break;
726
+ case "review":
727
+ actions = [btn(t("act.verify"), () => {
728
+ onAction("verify");
729
+ }, TaskBoardPage_module_css_default.actionPrimary), btn(t("act.reject"), () => {
730
+ onAction("reject");
731
+ })];
732
+ break;
733
+ case "done":
734
+ actions = [];
735
+ break;
736
+ case "blocked":
737
+ actions = [btn(t("act.unblock"), () => {
738
+ onAction("unblock");
739
+ }, TaskBoardPage_module_css_default.actionPrimary)];
740
+ break;
741
+ }
742
+ if (editing) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
743
+ className: TaskBoardPage_module_css_default.card,
744
+ children: [
745
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
746
+ className: TaskBoardPage_module_css_default.input,
747
+ value: eTitle,
748
+ onChange: (e) => {
749
+ setETitle(e.target.value);
750
+ },
751
+ placeholder: t("new.placeholder.title"),
752
+ "aria-label": "title"
753
+ }),
754
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
755
+ className: clsx(TaskBoardPage_module_css_default.input, TaskBoardPage_module_css_default.editTextarea),
756
+ value: eDesc,
757
+ onChange: (e) => {
758
+ setEDesc(e.target.value);
759
+ },
760
+ placeholder: t("new.placeholder.description"),
761
+ "aria-label": "description"
762
+ }),
763
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
764
+ className: TaskBoardPage_module_css_default.select,
765
+ value: ePriority,
766
+ onChange: (e) => {
767
+ setEPriority(e.target.value);
768
+ },
769
+ "aria-label": "priority",
770
+ children: [
771
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
772
+ value: "low",
773
+ children: t("priority.low")
774
+ }),
775
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
776
+ value: "normal",
777
+ children: t("priority.normal")
778
+ }),
779
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
780
+ value: "high",
781
+ children: t("priority.high")
782
+ })
783
+ ]
784
+ }),
785
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
786
+ className: TaskBoardPage_module_css_default.cardActions,
787
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
788
+ type: "button",
789
+ className: clsx(TaskBoardPage_module_css_default.actionBtn, TaskBoardPage_module_css_default.actionPrimary),
790
+ disabled: eTitle.trim() === "",
791
+ onClick: commitEdit,
792
+ children: t("edit.save")
793
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
794
+ type: "button",
795
+ className: TaskBoardPage_module_css_default.actionBtn,
796
+ onClick: () => {
797
+ setEditing(false);
798
+ },
799
+ children: t("edit.cancel")
800
+ })]
801
+ })
802
+ ]
803
+ });
804
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
805
+ className: clsx(TaskBoardPage_module_css_default.card, task.priority === "high" && TaskBoardPage_module_css_default.cardHigh, task.status === "blocked" && TaskBoardPage_module_css_default.cardBlocked),
806
+ children: [
807
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
808
+ className: TaskBoardPage_module_css_default.cardTop,
809
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
810
+ className: TaskBoardPage_module_css_default.cardTitle,
811
+ children: task.title
812
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
813
+ className: TaskBoardPage_module_css_default.cardAge,
814
+ children: ageLabel(task.updatedAt, now, t)
815
+ })]
816
+ }),
817
+ task.description !== void 0 && task.description !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
818
+ className: TaskBoardPage_module_css_default.cardDesc,
819
+ children: task.description
820
+ }),
821
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
822
+ className: TaskBoardPage_module_css_default.cardMeta,
823
+ children: [
824
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
825
+ className: TaskBoardPage_module_css_default.projectBadge,
826
+ title: task.project,
827
+ children: baseName(task.project)
828
+ }),
829
+ task.priority !== "normal" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
830
+ className: TaskBoardPage_module_css_default.priorityBadge,
831
+ "data-p": task.priority,
832
+ children: t(`priority.${task.priority}`)
833
+ }),
834
+ task.claimedBy !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
835
+ className: TaskBoardPage_module_css_default.claimed,
836
+ children: t("card.claimedBy", { session: task.claimedBy.sessionId.slice(0, 12) })
837
+ })
838
+ ]
839
+ }),
840
+ task.status === "blocked" && task.blockedReason !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
841
+ className: TaskBoardPage_module_css_default.blockReason,
842
+ children: t("card.blockedReason", { reason: task.blockedReason })
843
+ }),
844
+ (task.status === "review" || task.status === "done") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
845
+ className: TaskBoardPage_module_css_default.doneSummary,
846
+ title: task.doneSummary,
847
+ children: t("card.doneSummary", { summary: task.doneSummary ?? t("card.noSummary") })
848
+ }),
849
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
850
+ className: TaskBoardPage_module_css_default.cardActions,
851
+ children: [
852
+ actions,
853
+ task.archived === true ? btn(t("act.unarchive"), () => {
854
+ onAction("unarchive");
855
+ }) : task.status === "done" ? btn(t("act.archive"), () => {
856
+ onAction("archive");
857
+ }, TaskBoardPage_module_css_default.actionGhost) : task.status !== "blocked" && btn(t("act.block"), () => {
858
+ onAction("block");
859
+ }, TaskBoardPage_module_css_default.actionGhost),
860
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
861
+ type: "button",
862
+ className: TaskBoardPage_module_css_default.iconBtn,
863
+ "aria-label": t("card.edit"),
864
+ title: t("card.edit"),
865
+ onClick: beginEdit,
866
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, { size: 12 })
867
+ }),
868
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
869
+ type: "button",
870
+ className: clsx(TaskBoardPage_module_css_default.iconBtn, confirming && TaskBoardPage_module_css_default.deleteConfirm),
871
+ "aria-label": confirming ? t("card.confirmDelete") : t("card.delete"),
872
+ onClick: onDelete,
873
+ children: confirming ? t("card.confirmDelete") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 12 })
874
+ })
875
+ ]
876
+ })
877
+ ]
878
+ });
879
+ }
880
+ //#endregion
881
+ //#region src/client/TaskBoardIcon.tsx
882
+ /** Decorative occupant for the Task board sidebar entry. */
883
+ /**
884
+ * Render the checklist glyph at the size the sidebar asks for; the sidebar owns
885
+ * the accessible navigation label.
886
+ * @param props - the sidebar's icon share.
887
+ * @returns decorative checklist icon.
888
+ */
889
+ function TaskBoardIcon({ size }) {
890
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChecklistOutlineRegular, { size });
891
+ }
892
+ //#endregion
893
+ //#region src/client/locales.ts
894
+ /** `taskBoard` namespace dictionaries. */
895
+ /** Dictionary namespace owned by this plugin. */
896
+ const NS = "taskBoard";
897
+ /** Simplified Chinese dictionary (source of truth for keys). */
898
+ const zh = {
899
+ "panel.label": "任务看板",
900
+ "page.title": "任务看板",
901
+ "page.subtitle": "按项目维护任务,交给 agent 领取执行,完成后人工验收",
902
+ "refresh": "刷新",
903
+ "loading": "加载中…",
904
+ "auto.label": "自动认领",
905
+ "auto.hint": "开启后,后台定时把「待处理」的任务自动转到「进行中」(供 agent 拉取执行)",
906
+ "project.label": "项目",
907
+ "project.all": "全部项目",
908
+ "project.unknown": "未知项目",
909
+ "new.action": "新建任务",
910
+ "new.placeholder.title": "任务标题",
911
+ "new.placeholder.description": "描述(可选)",
912
+ "new.projectPrompt": "选择项目",
913
+ "new.readyNow": "直接标记为待处理",
914
+ "new.reuseIdle": "复用空闲会话",
915
+ "new.reuseIdleHint": "自动派发时,若该项目有空闲会话则在其上继续,而不是新建会话(默认不勾选)",
916
+ "new.submit": "创建",
917
+ "new.cancel": "取消",
918
+ "priority.label": "优先级",
919
+ "priority.all": "全部",
920
+ "priority.low": "低",
921
+ "priority.normal": "中",
922
+ "priority.high": "高",
923
+ "column.draft": "待定",
924
+ "column.ready": "待处理",
925
+ "column.in_progress": "进行中",
926
+ "column.review": "待验证",
927
+ "column.done": "已完成",
928
+ "column.blocked": "阻断",
929
+ "column.empty.draft": "没有待定的任务",
930
+ "column.empty.ready": "没有待处理的任务",
931
+ "column.empty.in_progress": "没有进行中的任务",
932
+ "column.empty.review": "没有待验证的任务",
933
+ "column.empty.done": "还没有已完成的任务",
934
+ "column.empty.blocked": "没有被阻断的任务",
935
+ "act.confirmReady": "确认处理",
936
+ "act.start": "▶ 开始",
937
+ "act.complete": "完成待验收",
938
+ "act.verify": "验收通过",
939
+ "act.reject": "退回",
940
+ "act.block": "阻断",
941
+ "act.unblock": "解除阻断",
942
+ "act.archive": "归档",
943
+ "act.unarchive": "取消归档",
944
+ "archive.open": "归档",
945
+ "archive.back": "返回看板",
946
+ "archive.title": "已归档任务",
947
+ "archive.empty": "没有已归档的任务",
948
+ "archive.allDone": "全部归档",
949
+ "archive.showMore": "展开其余 {n} 个",
950
+ "archive.showLess": "收起",
951
+ "card.claimedBy": "由 {session} 领取",
952
+ "card.doneSummary": "完成摘要:{summary}",
953
+ "card.blockedReason": "阻断原因:{reason}",
954
+ "card.edit": "编辑任务",
955
+ "edit.save": "保存",
956
+ "edit.cancel": "取消",
957
+ "card.delete": "删除任务",
958
+ "card.confirmDelete": "再次点击确认",
959
+ "card.noSummary": "(无摘要)",
960
+ "empty.title": "还没有任务",
961
+ "empty.hint": "点右上角「新建任务」,或在下方选择项目后创建第一个任务。",
962
+ "error.load": "操作失败:{message}",
963
+ "time.now": "刚刚",
964
+ "time.minutes": "{n} 分钟前",
965
+ "time.hours": "{n} 小时前",
966
+ "time.days": "{n} 天前"
967
+ };
968
+ /** English dictionary (must match every key). */
969
+ const en = {
970
+ "panel.label": "Task board",
971
+ "page.title": "Task board",
972
+ "page.subtitle": "Project tasks an agent can pull, execute, and that a human verifies",
973
+ "refresh": "Refresh",
974
+ "loading": "Loading…",
975
+ "auto.label": "Auto-claim",
976
+ "auto.hint": "When on, a background poller moves \"ready\" tasks to \"in progress\" for an agent to pick up.",
977
+ "project.label": "Project",
978
+ "project.all": "All projects",
979
+ "project.unknown": "Unknown project",
980
+ "new.action": "New task",
981
+ "new.placeholder.title": "Task title",
982
+ "new.placeholder.description": "Description (optional)",
983
+ "new.projectPrompt": "Choose a project",
984
+ "new.readyNow": "Mark ready now",
985
+ "new.reuseIdle": "Reuse idle session",
986
+ "new.reuseIdleHint": "On auto-dispatch, continue in an idle session in the same project instead of creating a new one (off by default)",
987
+ "new.submit": "Create",
988
+ "new.cancel": "Cancel",
989
+ "priority.label": "Priority",
990
+ "priority.all": "All",
991
+ "priority.low": "Low",
992
+ "priority.normal": "Normal",
993
+ "priority.high": "High",
994
+ "column.draft": "Draft",
995
+ "column.ready": "Ready",
996
+ "column.in_progress": "In progress",
997
+ "column.review": "Review",
998
+ "column.done": "Done",
999
+ "column.blocked": "Blocked",
1000
+ "column.empty.draft": "No drafts",
1001
+ "column.empty.ready": "Nothing ready",
1002
+ "column.empty.in_progress": "Nothing in progress",
1003
+ "column.empty.review": "Nothing awaiting review",
1004
+ "column.empty.done": "Nothing completed yet",
1005
+ "column.empty.blocked": "Nothing blocked",
1006
+ "act.confirmReady": "Confirm ready",
1007
+ "act.start": "▶ Start",
1008
+ "act.complete": "Complete for review",
1009
+ "act.verify": "Accept",
1010
+ "act.reject": "Reject",
1011
+ "act.block": "Block",
1012
+ "act.unblock": "Unblock",
1013
+ "act.archive": "Archive",
1014
+ "act.unarchive": "Restore",
1015
+ "archive.open": "Archived",
1016
+ "archive.back": "Back to board",
1017
+ "archive.title": "Archived tasks",
1018
+ "archive.empty": "No archived tasks",
1019
+ "archive.allDone": "Archive all",
1020
+ "archive.showMore": "Show {n} more",
1021
+ "archive.showLess": "Show less",
1022
+ "card.claimedBy": "Claimed by {session}",
1023
+ "card.doneSummary": "Summary: {summary}",
1024
+ "card.blockedReason": "Blocked: {reason}",
1025
+ "card.edit": "Edit task",
1026
+ "edit.save": "Save",
1027
+ "edit.cancel": "Cancel",
1028
+ "card.delete": "Delete task",
1029
+ "card.confirmDelete": "Click again to confirm",
1030
+ "card.noSummary": "(no summary)",
1031
+ "empty.title": "No tasks yet",
1032
+ "empty.hint": "Use \"New task\" in the header, or pick a project and create the first one.",
1033
+ "error.load": "Action failed: {message}",
1034
+ "time.now": "just now",
1035
+ "time.minutes": "{n}m ago",
1036
+ "time.hours": "{n}h ago",
1037
+ "time.days": "{n}d ago"
1038
+ };
1039
+ //#endregion
1040
+ //#region src/client/index.ts
1041
+ /** Stable main-panel id for the task board page. */
1042
+ const PANEL_ID = "taskBoard";
1043
+ /**
1044
+ * Required services: the slot registry and dictionaries, the layout that owns
1045
+ * the main-panel selection, and the workspace list for the project selector.
1046
+ */
1047
+ const inject = [
1048
+ "slots",
1049
+ "locale",
1050
+ "layout",
1051
+ "workspaces"
1052
+ ];
1053
+ /**
1054
+ * Client plugin body: register the dictionaries, the global task board page, and
1055
+ * the sidebar entry that selects it.
1056
+ * @param ctx - client root context.
1057
+ */
1058
+ function apply(ctx) {
1059
+ ctx.effect(() => ctx.locale.register(NS, {
1060
+ zh,
1061
+ en
1062
+ }), "dsh-task-board: dictionaries");
1063
+ const t = ctx.locale.bind(NS);
1064
+ ctx.slots.inject("main", () => ctx.slots.register({
1065
+ name: "main",
1066
+ key: PANEL_ID,
1067
+ locale: NS,
1068
+ inject: () => ({
1069
+ hooks: { workspaces: ctx.workspaces.list },
1070
+ currentProject: void 0
1071
+ })
1072
+ }, TaskBoardPage));
1073
+ ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
1074
+ name: "sidebar.panellist",
1075
+ id: PANEL_ID,
1076
+ order: 6,
1077
+ locale: NS,
1078
+ label: () => t("panel.label")
1079
+ }, TaskBoardIcon));
1080
+ }
1081
+ //#endregion
1082
+ exports.apply = apply;
1083
+ exports.inject = inject;
1084
+ return module.exports;
1085
+ }
1086
+ });
1087
+
1088
+ //# sourceMappingURL=client.js.map