@linxin666/dsh-client-ui-task-board-team 0.0.0-stage → 0.4.13

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.
Files changed (65) hide show
  1. package/LICENSE +202 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +66 -2
  4. package/README.zh.md +67 -0
  5. package/cordis.patch.yml +14 -0
  6. package/icon.svg +3 -0
  7. package/lib/client.js +1117 -0
  8. package/lib/index.js +2968 -0
  9. package/lib/types/client/index.d.ts +58 -0
  10. package/lib/types/client/locales.d.ts +83 -0
  11. package/lib/types/client/optional-service.d.ts +22 -0
  12. package/lib/types/client/team/extension.d.ts +29 -0
  13. package/lib/types/client/team/sections.d.ts +38 -0
  14. package/lib/types/client/team/settings.d.ts +41 -0
  15. package/lib/types/client/team/summary.d.ts +34 -0
  16. package/lib/types/core/contract.d.ts +269 -0
  17. package/lib/types/core/hub-protocol.d.ts +175 -0
  18. package/lib/types/core/identity.d.ts +96 -0
  19. package/lib/types/core/mirror.d.ts +51 -0
  20. package/lib/types/core/question-report.d.ts +84 -0
  21. package/lib/types/core/settlement.d.ts +49 -0
  22. package/lib/types/core/task-record.d.ts +59 -0
  23. package/lib/types/core/timers.d.ts +20 -0
  24. package/lib/types/host/bindings.d.ts +92 -0
  25. package/lib/types/host/channel.d.ts +44 -0
  26. package/lib/types/host/credentials.d.ts +63 -0
  27. package/lib/types/host/extension.d.ts +57 -0
  28. package/lib/types/host/hub-client.d.ts +157 -0
  29. package/lib/types/host/questions.d.ts +105 -0
  30. package/lib/types/host/service.d.ts +209 -0
  31. package/lib/types/host/setup.d.ts +152 -0
  32. package/lib/types/host/tools.d.ts +19 -0
  33. package/lib/types/host/waterfall.d.ts +39 -0
  34. package/lib/types/index.d.ts +152 -0
  35. package/locale/en.json +6 -0
  36. package/locale/zh.json +6 -0
  37. package/package.json +83 -3
  38. package/src/client/css-modules.d.ts +5 -0
  39. package/src/client/index.ts +139 -0
  40. package/src/client/locales.ts +154 -0
  41. package/src/client/optional-service.ts +30 -0
  42. package/src/client/team/extension.ts +185 -0
  43. package/src/client/team/sections.tsx +159 -0
  44. package/src/client/team/settings.tsx +242 -0
  45. package/src/client/team/summary.ts +156 -0
  46. package/src/client/team/team.module.css +122 -0
  47. package/src/core/contract.ts +326 -0
  48. package/src/core/hub-protocol.ts +217 -0
  49. package/src/core/identity.ts +193 -0
  50. package/src/core/mirror.ts +88 -0
  51. package/src/core/question-report.ts +144 -0
  52. package/src/core/settlement.ts +84 -0
  53. package/src/core/task-record.ts +65 -0
  54. package/src/core/timers.ts +34 -0
  55. package/src/host/bindings.ts +211 -0
  56. package/src/host/channel.ts +97 -0
  57. package/src/host/credentials.ts +147 -0
  58. package/src/host/extension.ts +197 -0
  59. package/src/host/hub-client.ts +287 -0
  60. package/src/host/questions.ts +275 -0
  61. package/src/host/service.ts +1421 -0
  62. package/src/host/setup.ts +259 -0
  63. package/src/host/tools.ts +70 -0
  64. package/src/host/waterfall.ts +51 -0
  65. package/src/index.ts +452 -0
package/lib/client.js ADDED
@@ -0,0 +1,1117 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@linxin666/dsh-client-ui-task-board-team",
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 react_jsx_runtime = require("react/jsx-runtime");
9
+ //#region src/core/identity.ts
10
+ /** Extension id: also the key of this provider's integration payload. */
11
+ const TEAM_EXTENSION_ID = "task-board-team";
12
+ function text(value) {
13
+ return typeof value === "string" && value.trim() !== "" ? value : void 0;
14
+ }
15
+ function count(value) {
16
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
17
+ }
18
+ /**
19
+ * Read one linkage out of an opaque payload.
20
+ * @param payload - the stored payload, or undefined.
21
+ * @returns the linkage, or undefined when the payload carries no issue id.
22
+ */
23
+ function readTeamIssueLink(payload) {
24
+ if (payload === void 0) return void 0;
25
+ const issueId = text(payload.issueId);
26
+ if (issueId === void 0) return void 0;
27
+ const link = { issueId };
28
+ const issueNumber = count(payload.issueNumber);
29
+ if (issueNumber !== void 0) link.issueNumber = issueNumber;
30
+ const attemptId = text(payload.attemptId);
31
+ if (attemptId !== void 0) link.attemptId = attemptId;
32
+ const leaseToken = text(payload.leaseToken);
33
+ if (leaseToken !== void 0) link.leaseToken = leaseToken;
34
+ const leaseExpiresAt = count(payload.leaseExpiresAt);
35
+ if (leaseExpiresAt !== void 0) link.leaseExpiresAt = leaseExpiresAt;
36
+ const agentId = text(payload.agentId);
37
+ if (agentId !== void 0) link.agentId = agentId;
38
+ const agentMemberId = text(payload.agentMemberId);
39
+ if (agentMemberId !== void 0) link.agentMemberId = agentMemberId;
40
+ const preset = text(payload.preset);
41
+ if (preset !== void 0) link.preset = preset;
42
+ const hubStatus = text(payload.hubStatus);
43
+ if (hubStatus !== void 0) link.hubStatus = hubStatus;
44
+ const assignee = text(payload.assignee);
45
+ if (assignee !== void 0) link.assignee = assignee;
46
+ const reviewer = text(payload.reviewer);
47
+ if (reviewer !== void 0) link.reviewer = reviewer;
48
+ const lastError = text(payload.lastError);
49
+ if (lastError !== void 0) link.lastError = lastError;
50
+ const pendingSettle = readPendingSettle(payload.pendingSettle);
51
+ if (pendingSettle !== void 0) link.pendingSettle = pendingSettle;
52
+ return link;
53
+ }
54
+ /**
55
+ * Read one recorded settlement out of an opaque payload.
56
+ * @param value - the stored member, or undefined.
57
+ * @returns the body to retry, or undefined when it carries no usable outcome.
58
+ */
59
+ function readPendingSettle(value) {
60
+ if (typeof value !== "object" || value === null) return void 0;
61
+ const row = value;
62
+ const outcome = row.outcome === "succeeded" || row.outcome === "failed" ? row.outcome : void 0;
63
+ const summary = text(row.summary);
64
+ if (outcome === void 0 || summary === void 0) return void 0;
65
+ const pending = {
66
+ outcome,
67
+ summary
68
+ };
69
+ const error = text(row.error);
70
+ if (error !== void 0) pending.error = error;
71
+ const attemptId = text(row.execution_attempt_id);
72
+ if (attemptId !== void 0) pending.execution_attempt_id = attemptId;
73
+ const evidence = row.verification_evidence;
74
+ if (typeof evidence === "object" && evidence !== null && !Array.isArray(evidence)) pending.verification_evidence = evidence;
75
+ return pending;
76
+ }
77
+ /**
78
+ * Read the linkage off one card.
79
+ * @param task - the card to read.
80
+ * @returns its linkage, or undefined when it does not mirror an issue.
81
+ */
82
+ function readTaskIssueLink(task) {
83
+ return readTeamIssueLink(task.integrations?.[TEAM_EXTENSION_ID]);
84
+ }
85
+ //#endregion
86
+ //#region src/core/contract.ts
87
+ /** Cordis service name the board's host and browser halves each publish. */
88
+ const TASK_BOARD_SERVICE_NAME = "taskBoard";
89
+ /** Child seat a provider registers its task-detail section into. */
90
+ const TASK_BOARD_DETAIL_SECTION = "task-board.detail.section";
91
+ /** Child seat a provider registers its settings section into. */
92
+ const TASK_BOARD_SETTINGS_SECTION = "task-board.settings.section";
93
+ /** Child seat a provider registers its card decoration into. */
94
+ const TASK_BOARD_CARD_DECORATION = "task-board.card.decoration";
95
+ /**
96
+ * Resolve the board's browser-half client face by service name.
97
+ * @param ctx - browser context.
98
+ * @returns the client face, or undefined when the board is not loaded.
99
+ */
100
+ function resolveTaskBoardClientFace(ctx) {
101
+ try {
102
+ const face = ctx.get(TASK_BOARD_SERVICE_NAME);
103
+ return face !== void 0 && typeof face.dispatch === "function" ? face : void 0;
104
+ } catch {
105
+ return;
106
+ }
107
+ }
108
+ //#endregion
109
+ //#region src/client/locales.ts
110
+ /**
111
+ * Copy of the team provider's browser half.
112
+ *
113
+ * The Chinese dictionary is the key source: every other locale tracks exactly
114
+ * these keys (the repository gate enforces parity), and no user-facing string is
115
+ * written inline in a component. The third language is carried centrally by
116
+ * dsh-i18n, which is why this module ships zh and en only.
117
+ *
118
+ * @module dsh-task-board-team/client/locales
119
+ */
120
+ const zh = {
121
+ "section.title": "团队协作",
122
+ "section.hub": "Hub 地址",
123
+ "section.team": "团队 ID",
124
+ "section.token": "Host Token",
125
+ "section.token.configured": "已配置(保存在宿主侧,不回显)",
126
+ "section.token.missing": "未配置",
127
+ "section.token.placeholder": "粘贴 Host Token,保存后只在宿主侧使用",
128
+ "section.token.save": "保存 Token",
129
+ "section.token.clear": "清除 Token",
130
+ "section.agents": "团队 Agent 绑定",
131
+ "section.agents.empty": "尚未绑定任何 dsh-agents 成员,本机不会领取任何团队任务",
132
+ "section.agents.hint": "填写 dsh-agents 的成员 ID,用逗号分隔",
133
+ "section.questionWait": "本地兜底等待(分钟)",
134
+ "section.questionWait.hint": "0 = 不设本地上限,一直等到 hub 给出终态(回答、过期或撤回)",
135
+ "section.save": "保存设置",
136
+ "section.saved": "已保存",
137
+ "section.refresh": "立即领取",
138
+ "section.connection": "连接状态",
139
+ "section.connection.idle": "未启动",
140
+ "section.connection.connecting": "正在注册",
141
+ "section.connection.online": "在线",
142
+ "section.connection.reconnecting": "正在重连",
143
+ "section.connection.error": "连接失败",
144
+ "section.host": "主机",
145
+ "section.heartbeat": "最近心跳",
146
+ "section.reconnects": "重连次数",
147
+ "section.capabilities": "能力",
148
+ "section.capability.followUp": "后续消息投递",
149
+ "section.capability.rework": "同会话返工",
150
+ "section.capability.run": "自动开始执行",
151
+ "section.capability.available": "可用",
152
+ "section.capability.missing": "不可用",
153
+ "section.capability.followUpMissing": "当前看板版本不提供 followUp,评论里 @ 本机 Agent 时只能记在活动流里",
154
+ "section.capability.reworkMissing": "当前看板版本不提供 rework,收到返工请求时只记录,不会重跑",
155
+ "section.capability.runMissing": "当前看板版本不提供执行入口,领取到的卡片需要人工在看板上开始",
156
+ "section.capability.presetPin": "建卡时钉住预设与模型",
157
+ "section.capability.presetPinMissing": "当前看板版本无法在建卡时钉住 Agent 预设、模型与思考档位,因此领取到的镜像卡没有启动,需要人工处理",
158
+ "section.problems": "配置问题",
159
+ "detail.title": "团队协作",
160
+ "detail.issue": "团队 issue",
161
+ "detail.assignee": "负责人",
162
+ "detail.reviewer": "审阅人",
163
+ "detail.agent": "执行 Agent",
164
+ "detail.status": "Hub 状态",
165
+ "detail.comments": "评论",
166
+ "detail.activity": "活动",
167
+ "detail.pending": "待回答的问题",
168
+ "detail.empty": "暂无",
169
+ "detail.error": "最近错误",
170
+ "status.todo": "待办",
171
+ "status.assigned": "已分配",
172
+ "status.waiting_host": "等待执行节点",
173
+ "status.running": "执行中",
174
+ "status.in_review": "待审阅",
175
+ "status.done": "已完成",
176
+ "status.canceled": "已取消",
177
+ "status.failed": "失败",
178
+ "unavailable": "本扩展的团队配置尚不可用"
179
+ };
180
+ const en = {
181
+ "section.title": "Team collaboration",
182
+ "section.hub": "Hub URL",
183
+ "section.team": "Team ID",
184
+ "section.token": "Host Token",
185
+ "section.token.configured": "Configured (kept host-side, never echoed)",
186
+ "section.token.missing": "Not configured",
187
+ "section.token.placeholder": "Paste the Host Token; it is used host-side only",
188
+ "section.token.save": "Save token",
189
+ "section.token.clear": "Clear token",
190
+ "section.agents": "Team Agent bindings",
191
+ "section.agents.empty": "No dsh-agents member is bound, so this machine claims nothing",
192
+ "section.agents.hint": "dsh-agents member ids, separated by commas",
193
+ "section.questionWait": "Local fallback wait (minutes)",
194
+ "section.questionWait.hint": "0 = no local cap; wait for the hub to settle the question (answered, expired or withdrawn)",
195
+ "section.save": "Save settings",
196
+ "section.saved": "Saved",
197
+ "section.refresh": "Claim now",
198
+ "section.connection": "Connection",
199
+ "section.connection.idle": "Stopped",
200
+ "section.connection.connecting": "Registering",
201
+ "section.connection.online": "Online",
202
+ "section.connection.reconnecting": "Reconnecting",
203
+ "section.connection.error": "Connection failed",
204
+ "section.host": "Host",
205
+ "section.heartbeat": "Last heartbeat",
206
+ "section.reconnects": "Reconnects",
207
+ "section.capabilities": "Capabilities",
208
+ "section.capability.followUp": "Follow-up delivery",
209
+ "section.capability.rework": "Rework in session",
210
+ "section.capability.run": "Start executions",
211
+ "section.capability.available": "Available",
212
+ "section.capability.missing": "Unavailable",
213
+ "section.capability.followUpMissing": "This board revision serves no followUp, so a mention is only recorded on the activity stream",
214
+ "section.capability.reworkMissing": "This board revision serves no rework, so a rework request is recorded and never re-run",
215
+ "section.capability.runMissing": "This board revision serves no execution entry, so a claimed card has to be started on the board",
216
+ "section.capability.presetPin": "Pinning a preset and model on create",
217
+ "section.capability.presetPinMissing": "This board revision cannot pin an agent preset, model or reasoning effort when creating a card, so the mirror card was not started and needs a human",
218
+ "section.problems": "Configuration problems",
219
+ "detail.title": "Team collaboration",
220
+ "detail.issue": "Team issue",
221
+ "detail.assignee": "Assignee",
222
+ "detail.reviewer": "Reviewer",
223
+ "detail.agent": "Executing agent",
224
+ "detail.status": "Hub status",
225
+ "detail.comments": "Comments",
226
+ "detail.activity": "Activity",
227
+ "detail.pending": "Open questions",
228
+ "detail.empty": "Nothing yet",
229
+ "detail.error": "Last error",
230
+ "status.todo": "Todo",
231
+ "status.assigned": "Assigned",
232
+ "status.waiting_host": "Waiting for the execution node",
233
+ "status.running": "Running",
234
+ "status.in_review": "In review",
235
+ "status.done": "Done",
236
+ "status.canceled": "Canceled",
237
+ "status.failed": "Failed",
238
+ "unavailable": "The team configuration of this extension is not available"
239
+ };
240
+ /** The translate seat the seats use when the client locale service is absent. */
241
+ let translate = (key) => zh[key];
242
+ /**
243
+ * Install the runtime translate seat.
244
+ * @param bound - the locale-bound lookup of this namespace.
245
+ */
246
+ function setRuntimeTranslate(bound) {
247
+ translate = bound;
248
+ }
249
+ /**
250
+ * Translate one key of this namespace.
251
+ * @param key - dictionary key.
252
+ * @returns the localized string.
253
+ */
254
+ function t(key) {
255
+ return translate(key);
256
+ }
257
+ //#endregion
258
+ //#region src/client/team/summary.ts
259
+ /**
260
+ * The published summary this extension's browser half renders.
261
+ *
262
+ * The Host publishes one opaque payload per extension; the board forwards it
263
+ * verbatim in the snapshot and this module is the only place that interprets it.
264
+ * It is a store rather than a hook so the seats (which receive only their owner
265
+ * props) can read one live value and re-render when the board pushes a new one.
266
+ *
267
+ * @module dsh-task-board-team/client/team/summary
268
+ */
269
+ let current = void 0;
270
+ const listeners = /* @__PURE__ */ new Set();
271
+ /**
272
+ * Take the summaries the board snapshot carries.
273
+ * @param extensions - the snapshot's published extension summaries.
274
+ */
275
+ function acceptPublishedSummaries(extensions) {
276
+ const entry = extensions?.["task-board-team"];
277
+ const next = readSummary(entry);
278
+ if (next === void 0 && current === void 0) return;
279
+ current = next;
280
+ for (const listener of [...listeners]) listener();
281
+ }
282
+ /** Drop the published summary: a hidden provider must not look like live state. */
283
+ function clearSummary() {
284
+ if (current === void 0) return;
285
+ current = void 0;
286
+ for (const listener of [...listeners]) listener();
287
+ }
288
+ /**
289
+ * Read the live summary.
290
+ * @returns the summary, or undefined before the Host published one.
291
+ */
292
+ function getSummary() {
293
+ return current;
294
+ }
295
+ function subscribe(listener) {
296
+ listeners.add(listener);
297
+ return () => {
298
+ listeners.delete(listener);
299
+ };
300
+ }
301
+ /**
302
+ * Subscribe one component to the live summary.
303
+ * @returns the current summary and a re-render on every change.
304
+ */
305
+ function useTeamSummary() {
306
+ return (0, react.useSyncExternalStore)(subscribe, getSummary, getSummary);
307
+ }
308
+ /**
309
+ * Validate one published payload into the summary shape.
310
+ *
311
+ * A payload from another revision of this extension is read for the fields it
312
+ * does carry and never trusted for the ones it does not, so a version skew
313
+ * degrades one section instead of throwing inside the board's render.
314
+ * @param raw - the opaque payload the board forwarded.
315
+ * @returns the summary, or undefined when it carries no usable shape.
316
+ */
317
+ function readSummary(raw) {
318
+ if (typeof raw !== "object" || raw === null) return void 0;
319
+ const value = raw;
320
+ if (typeof value.connection !== "object" || value.connection === null) return void 0;
321
+ const connection = value.connection;
322
+ return {
323
+ connection: {
324
+ state: readState(connection.state),
325
+ ...typeof connection.hostId === "string" ? { hostId: connection.hostId } : {},
326
+ ...typeof connection.lastHeartbeatAt === "number" ? { lastHeartbeatAt: connection.lastHeartbeatAt } : {},
327
+ reconnects: typeof connection.reconnects === "number" ? connection.reconnects : 0,
328
+ ...typeof connection.lastError === "string" ? { lastError: connection.lastError } : {}
329
+ },
330
+ capabilities: {
331
+ followUp: value.capabilities?.followUp === true,
332
+ rework: value.capabilities?.rework === true,
333
+ run: value.capabilities?.run === true
334
+ },
335
+ agents: Array.isArray(value.agents) ? value.agents.flatMap((agent) => typeof agent?.memberId === "string" && typeof agent?.name === "string" ? [{
336
+ memberId: agent.memberId,
337
+ name: agent.name,
338
+ ...typeof agent.preset === "string" ? { preset: agent.preset } : {},
339
+ ...typeof agent.hubAgentId === "string" ? { hubAgentId: agent.hubAgentId } : {}
340
+ }] : []) : [],
341
+ problems: Array.isArray(value.problems) ? value.problems.filter((line) => typeof line === "string") : [],
342
+ presetPin: value.presetPin === "supported" || value.presetPin === "missing" ? value.presetPin : "unknown",
343
+ cards: typeof value.cards === "object" && value.cards !== null ? value.cards : {},
344
+ ...readConfigurationField(value.configuration) === void 0 ? {} : { configuration: readConfigurationField(value.configuration) },
345
+ pendingQuestions: Array.isArray(value.pendingQuestions) ? value.pendingQuestions.flatMap((question) => typeof question?.taskId === "string" ? [{
346
+ id: typeof question.id === "string" ? question.id : "",
347
+ taskId: question.taskId,
348
+ issueId: typeof question.issueId === "string" ? question.issueId : "",
349
+ question: typeof question.question === "string" ? question.question : "",
350
+ askedAt: typeof question.askedAt === "number" ? question.askedAt : 0,
351
+ ...typeof question.hubQuestionId === "string" ? { hubQuestionId: question.hubQuestionId } : {}
352
+ }] : []) : []
353
+ };
354
+ }
355
+ /**
356
+ * Read the configuration half of one published payload.
357
+ * @param raw - the opaque member.
358
+ * @returns the fields this build understands, or undefined when there are none.
359
+ */
360
+ function readConfigurationField(raw) {
361
+ if (typeof raw !== "object" || raw === null) return void 0;
362
+ const value = raw;
363
+ const configuration = {
364
+ ...typeof value.hubUrl === "string" ? { hubUrl: value.hubUrl } : {},
365
+ ...typeof value.teamId === "string" ? { teamId: value.teamId } : {},
366
+ ...typeof value.hostname === "string" ? { hostname: value.hostname } : {},
367
+ ...typeof value.tokenConfigured === "boolean" ? { tokenConfigured: value.tokenConfigured } : {},
368
+ ...typeof value.questionWaitMinutes === "number" ? { questionWaitMinutes: value.questionWaitMinutes } : {}
369
+ };
370
+ return Object.keys(configuration).length === 0 ? void 0 : configuration;
371
+ }
372
+ function readState(raw) {
373
+ switch (raw) {
374
+ case "idle":
375
+ case "connecting":
376
+ case "online":
377
+ case "reconnecting":
378
+ case "error": return raw;
379
+ default: return "idle";
380
+ }
381
+ }
382
+ //#endregion
383
+ //#region \0dsh-css:packages/dsh-task-board-team/src/client/team/team.module.css.mjs
384
+ const css = ".hI068G_section{flex-direction:column;gap:10px;font-size:12px;display:flex}.hI068G_title{color:var(--dsw-alias-label-primary);margin:0;font-size:12px;font-weight:600}.hI068G_row{justify-content:space-between;gap:8px;display:flex}.hI068G_label{color:var(--dsw-alias-label-secondary)}.hI068G_value{color:var(--dsw-alias-label-primary);text-align:right;overflow-wrap:anywhere}.hI068G_badge{border:1px solid var(--dsw-alias-border-secondary);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:999px;align-items:center;gap:4px;padding:0 6px;font-size:11px;line-height:18px;display:inline-flex}.hI068G_badge[data-hub-status=in_review]{border-color:var(--dsw-alias-border-primary);color:var(--dsw-alias-label-primary)}.hI068G_badge[data-hub-status=running]{border-color:var(--dsw-alias-border-primary)}.hI068G_badge[data-hub-status=failed]{border-style:dashed}.hI068G_list{flex-direction:column;gap:6px;margin:0;padding:0;list-style:none;display:flex}.hI068G_entry{border-top:1px solid var(--dsw-alias-border-secondary);flex-direction:column;gap:2px;padding:4px 0;display:flex}.hI068G_meta{color:var(--dsw-alias-label-secondary);font-size:11px}.hI068G_body{color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere}.hI068G_error{color:var(--dsw-alias-label-secondary);border-left:2px solid var(--dsw-alias-border-primary);padding-left:6px}.hI068G_input{box-sizing:border-box;border:1px solid var(--dsw-alias-border-secondary);background:var(--dsw-alias-bg-primary);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:6px;padding:4px 6px}.hI068G_actions{flex-wrap:wrap;gap:6px;display:flex}.hI068G_button{border:1px solid var(--dsw-alias-border-secondary);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:2px 10px}.hI068G_empty{color:var(--dsw-alias-label-secondary)}";
385
+ const tagId = "@linxin666/dsh-client-ui-task-board-team/packages/dsh-task-board-team/src/client/team/team.module.css";
386
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
387
+ const tag = document.createElement("style");
388
+ tag.dataset.plugin = "@linxin666/dsh-client-ui-task-board-team";
389
+ tag.dataset.pluginCss = tagId;
390
+ tag.textContent = css;
391
+ document.head.appendChild(tag);
392
+ }
393
+ var team_module_css_default = {
394
+ "actions": "hI068G_actions",
395
+ "badge": "hI068G_badge",
396
+ "body": "hI068G_body",
397
+ "button": "hI068G_button",
398
+ "empty": "hI068G_empty",
399
+ "entry": "hI068G_entry",
400
+ "error": "hI068G_error",
401
+ "input": "hI068G_input",
402
+ "label": "hI068G_label",
403
+ "list": "hI068G_list",
404
+ "meta": "hI068G_meta",
405
+ "row": "hI068G_row",
406
+ "section": "hI068G_section",
407
+ "title": "hI068G_title",
408
+ "value": "hI068G_value"
409
+ };
410
+ //#endregion
411
+ //#region src/client/team/sections.tsx
412
+ /** Hub status the badge renders; the key set is the protocol's own status column. */
413
+ const STATUS_KEYS = {
414
+ todo: "status.todo",
415
+ assigned: "status.assigned",
416
+ waiting_host: "status.waiting_host",
417
+ running: "status.running",
418
+ in_review: "status.in_review",
419
+ done: "status.done",
420
+ canceled: "status.canceled",
421
+ failed: "status.failed"
422
+ };
423
+ /**
424
+ * Translate one hub status.
425
+ * @param status - the collaboration status the hub reported.
426
+ * @returns the localized label, or the raw status for a value this build predates.
427
+ */
428
+ function statusLabel(status) {
429
+ if (status === void 0) return t("detail.empty");
430
+ const key = STATUS_KEYS[status];
431
+ return key === void 0 ? status : t(key);
432
+ }
433
+ /**
434
+ * The hub status badge of one mirrored card.
435
+ * @param props - the card the board renders.
436
+ * @returns the badge, or nothing for a card that mirrors no issue.
437
+ */
438
+ function TeamCardDecoration({ task }) {
439
+ useTeamSummary();
440
+ const link = readTaskIssueLink(task);
441
+ if (link === void 0) return null;
442
+ const status = link.hubStatus;
443
+ if (status === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
444
+ className: team_module_css_default.badge,
445
+ "data-dsh-plugin": "task-board-team",
446
+ "data-dsh-part": "team-badge",
447
+ children: t("detail.title")
448
+ });
449
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
450
+ className: team_module_css_default.badge,
451
+ "data-dsh-plugin": "task-board-team",
452
+ "data-dsh-part": "team-badge",
453
+ "data-hub-status": status,
454
+ children: statusLabel(status)
455
+ });
456
+ }
457
+ /** One line of the detail block: label and value. */
458
+ function Field({ label, value }) {
459
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
460
+ className: team_module_css_default.row,
461
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
462
+ className: team_module_css_default.label,
463
+ children: label
464
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
465
+ className: team_module_css_default.value,
466
+ children: value
467
+ })]
468
+ });
469
+ }
470
+ /** The comments and activity one card carries, newest last. */
471
+ function Streams({ view }) {
472
+ const comments = view?.comments ?? [];
473
+ const activity = view?.activity ?? [];
474
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
475
+ className: team_module_css_default.title,
476
+ children: t("detail.comments")
477
+ }), comments.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
478
+ className: team_module_css_default.empty,
479
+ children: t("detail.empty")
480
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
481
+ className: team_module_css_default.list,
482
+ "data-dsh-part": "team-comments",
483
+ children: comments.map((comment) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
484
+ className: team_module_css_default.entry,
485
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
486
+ className: team_module_css_default.meta,
487
+ children: comment.author
488
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
489
+ className: team_module_css_default.body,
490
+ children: comment.content
491
+ })]
492
+ }, comment.id))
493
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
494
+ className: team_module_css_default.title,
495
+ children: t("detail.activity")
496
+ }), activity.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
497
+ className: team_module_css_default.empty,
498
+ children: t("detail.empty")
499
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
500
+ className: team_module_css_default.list,
501
+ "data-dsh-part": "team-activity",
502
+ children: activity.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
503
+ className: team_module_css_default.entry,
504
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
505
+ className: team_module_css_default.meta,
506
+ children: entry.type
507
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
508
+ className: team_module_css_default.body,
509
+ children: entry.text
510
+ })]
511
+ }, entry.id))
512
+ })] })] });
513
+ }
514
+ /**
515
+ * The team section of one card's detail view.
516
+ * @param props - the card the board renders, plus the action dispatcher.
517
+ * @returns the section, or nothing for a card that mirrors no issue.
518
+ */
519
+ function TeamDetailSection({ task }) {
520
+ const summary = useTeamSummary();
521
+ const link = readTaskIssueLink(task);
522
+ if (link === void 0) return null;
523
+ const view = summary?.cards[task.id];
524
+ const pending = (summary?.pendingQuestions ?? []).filter((question) => question.taskId === task.id);
525
+ const agent = summary?.agents.find((candidate) => candidate.memberId === link.agentMemberId);
526
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
527
+ className: team_module_css_default.section,
528
+ "data-dsh-plugin": "task-board-team",
529
+ "data-dsh-part": "team-detail",
530
+ style: {},
531
+ children: [
532
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
533
+ className: team_module_css_default.title,
534
+ children: t("detail.title")
535
+ }),
536
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
537
+ label: t("detail.issue"),
538
+ value: issueLabel(link)
539
+ }),
540
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
541
+ label: t("detail.status"),
542
+ value: statusLabel(view?.hubStatus ?? link.hubStatus)
543
+ }),
544
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
545
+ label: t("detail.agent"),
546
+ value: agent?.name ?? link.agentId ?? t("detail.empty")
547
+ }),
548
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
549
+ label: t("detail.assignee"),
550
+ value: link.assignee ?? t("detail.empty")
551
+ }),
552
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
553
+ label: t("detail.reviewer"),
554
+ value: link.reviewer ?? t("detail.empty")
555
+ }),
556
+ pending.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
557
+ className: team_module_css_default.title,
558
+ children: t("detail.pending")
559
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
560
+ className: team_module_css_default.list,
561
+ "data-dsh-part": "team-questions",
562
+ children: pending.map((question) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
563
+ className: team_module_css_default.entry,
564
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
565
+ className: team_module_css_default.body,
566
+ children: question.question
567
+ })
568
+ }, question.id))
569
+ })] }),
570
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Streams, { view }),
571
+ view?.lastError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
572
+ className: team_module_css_default.error,
573
+ children: [
574
+ t("detail.error"),
575
+ ": ",
576
+ view.lastError
577
+ ]
578
+ })
579
+ ]
580
+ });
581
+ }
582
+ /**
583
+ * Render the issue identity of one linkage.
584
+ * @param link - the card's linkage back to the hub.
585
+ * @returns the label, e.g. "issue #12".
586
+ */
587
+ function issueLabel(link) {
588
+ return link.issueNumber === void 0 ? link.issueId : "issue #" + String(link.issueNumber);
589
+ }
590
+ //#endregion
591
+ //#region src/client/team/settings.tsx
592
+ /**
593
+ * The team configuration block inside the board's own settings card.
594
+ *
595
+ * It renders what the Host published (hub URL, team id, hostname, whether a Host
596
+ * Token is configured, the live connection state and which optional board
597
+ * capabilities this deployment really serves) and it writes through the board's
598
+ * same-origin action channel, which is the only channel a provider has. A token
599
+ * value travels exactly once, from this input to the Host, and is never read
600
+ * back: the field always renders empty and the status line says whether one is
601
+ * stored.
602
+ *
603
+ * The block stays reachable while the extension is switched off, because it is
604
+ * where the switch is turned back on; it only reports that fact instead of
605
+ * pretending the forms still apply.
606
+ *
607
+ * @module dsh-task-board-team/client/team/settings
608
+ */
609
+ /**
610
+ * Read the configuration half of one summary.
611
+ * @param summary - the published summary, or undefined.
612
+ * @returns the configuration fields the card renders.
613
+ */
614
+ function readConfiguration(summary) {
615
+ const configuration = summary?.configuration;
616
+ if (configuration === void 0) return {};
617
+ return {
618
+ ...configuration.hubUrl === void 0 ? {} : { hubUrl: configuration.hubUrl },
619
+ ...configuration.teamId === void 0 ? {} : { teamId: configuration.teamId },
620
+ ...configuration.hostname === void 0 ? {} : { hostname: configuration.hostname },
621
+ ...configuration.tokenConfigured === void 0 ? {} : { tokenConfigured: configuration.tokenConfigured },
622
+ ...configuration.questionWaitMinutes === void 0 ? {} : { questionWaitMinutes: configuration.questionWaitMinutes }
623
+ };
624
+ }
625
+ /**
626
+ * Dispatch one action of this extension.
627
+ * @param dispatch - the board's action dispatcher.
628
+ * @param action - provider-owned action name.
629
+ * @param payload - opaque payload.
630
+ * @returns whether the board accepted the action.
631
+ */
632
+ async function send(dispatch, action, payload) {
633
+ try {
634
+ return await dispatch({
635
+ extensionId: TEAM_EXTENSION_ID,
636
+ action,
637
+ ...payload === void 0 ? {} : { payload }
638
+ });
639
+ } catch {
640
+ return false;
641
+ }
642
+ }
643
+ /** One capability line of the settings block. */
644
+ function Capability({ label, available, missing }) {
645
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
646
+ className: team_module_css_default.row,
647
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
648
+ className: team_module_css_default.label,
649
+ children: label
650
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
651
+ className: team_module_css_default.value,
652
+ children: available ? t("section.capability.available") : t("section.capability.missing") + " — " + missing
653
+ })]
654
+ });
655
+ }
656
+ /**
657
+ * The settings block.
658
+ * @param props - the board's settings seat props.
659
+ * @returns the block.
660
+ */
661
+ function TeamSettingsSection({ dispatch }) {
662
+ const summary = useTeamSummary();
663
+ const configuration = readConfiguration(summary);
664
+ const [hubUrl, setHubUrl] = (0, react.useState)(void 0);
665
+ const [teamId, setTeamId] = (0, react.useState)(void 0);
666
+ const [members, setMembers] = (0, react.useState)(void 0);
667
+ const [waitMinutes, setWaitMinutes] = (0, react.useState)(void 0);
668
+ const [token, setToken] = (0, react.useState)("");
669
+ const [saved, setSaved] = (0, react.useState)(false);
670
+ const connection = summary?.connection.state ?? "idle";
671
+ const membersValue = members ?? (summary?.agents ?? []).map((agent) => agent.memberId).join(", ");
672
+ const stateKey = "section.connection." + connection;
673
+ const saveSettings = async () => {
674
+ const bindings = (membersValue ?? "").split(",").map((entry) => entry.trim()).filter((entry) => entry !== "").map((memberId) => ({ memberId }));
675
+ const ok = await send(dispatch, "setup-save", {
676
+ ...hubUrl === void 0 ? {} : { hubUrl },
677
+ ...teamId === void 0 ? {} : { teamId },
678
+ agents: bindings,
679
+ questionWaitMinutes: Number.parseInt(waitMinutes ?? String(configuration.questionWaitMinutes ?? 0), 10) || 0
680
+ });
681
+ setSaved(ok);
682
+ };
683
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
684
+ className: team_module_css_default.section,
685
+ "data-dsh-plugin": "task-board-team",
686
+ "data-dsh-part": "team-settings",
687
+ children: [
688
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
689
+ className: team_module_css_default.title,
690
+ children: t("section.title")
691
+ }),
692
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
693
+ className: team_module_css_default.row,
694
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
695
+ className: team_module_css_default.label,
696
+ children: t("section.connection")
697
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
698
+ className: team_module_css_default.value,
699
+ "data-dsh-part": "team-connection",
700
+ children: t(stateKey)
701
+ })]
702
+ }),
703
+ summary?.connection.hostId === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
704
+ className: team_module_css_default.row,
705
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
706
+ className: team_module_css_default.label,
707
+ children: t("section.host")
708
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
709
+ className: team_module_css_default.value,
710
+ children: summary.connection.hostId
711
+ })]
712
+ }),
713
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
714
+ className: team_module_css_default.row,
715
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
716
+ className: team_module_css_default.label,
717
+ children: t("section.hub")
718
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
719
+ className: team_module_css_default.input,
720
+ value: hubUrl ?? configuration.hubUrl ?? "",
721
+ placeholder: "https://hub.example.com",
722
+ onChange: (event) => {
723
+ setHubUrl(event.target.value);
724
+ }
725
+ })]
726
+ }),
727
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
728
+ className: team_module_css_default.row,
729
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
730
+ className: team_module_css_default.label,
731
+ children: t("section.team")
732
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
733
+ className: team_module_css_default.input,
734
+ value: teamId ?? configuration.teamId ?? "",
735
+ placeholder: "team_...",
736
+ onChange: (event) => {
737
+ setTeamId(event.target.value);
738
+ }
739
+ })]
740
+ }),
741
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
742
+ className: team_module_css_default.row,
743
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
744
+ className: team_module_css_default.label,
745
+ children: t("section.token")
746
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
747
+ className: team_module_css_default.value,
748
+ children: configuration.tokenConfigured === true ? t("section.token.configured") : t("section.token.missing")
749
+ })]
750
+ }),
751
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
752
+ className: team_module_css_default.input,
753
+ type: "password",
754
+ placeholder: t("section.token.placeholder"),
755
+ value: token,
756
+ onChange: (event) => {
757
+ setToken(event.target.value);
758
+ }
759
+ }),
760
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
761
+ className: team_module_css_default.row,
762
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
763
+ className: team_module_css_default.label,
764
+ children: t("section.agents")
765
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
766
+ className: team_module_css_default.input,
767
+ value: membersValue,
768
+ placeholder: "member_...",
769
+ onChange: (event) => {
770
+ setMembers(event.target.value);
771
+ }
772
+ })]
773
+ }),
774
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
775
+ className: team_module_css_default.meta,
776
+ children: t("section.agents.hint")
777
+ }),
778
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
779
+ className: team_module_css_default.row,
780
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
781
+ className: team_module_css_default.label,
782
+ children: t("section.questionWait")
783
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
784
+ className: team_module_css_default.input,
785
+ inputMode: "numeric",
786
+ value: waitMinutes ?? String(configuration.questionWaitMinutes ?? 0),
787
+ onChange: (event) => {
788
+ setWaitMinutes(event.target.value);
789
+ }
790
+ })]
791
+ }),
792
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
793
+ className: team_module_css_default.meta,
794
+ children: t("section.questionWait.hint")
795
+ }),
796
+ (summary?.agents ?? []).length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
797
+ className: team_module_css_default.empty,
798
+ children: t("section.agents.empty")
799
+ }) : null,
800
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
801
+ className: team_module_css_default.actions,
802
+ children: [
803
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
804
+ className: team_module_css_default.button,
805
+ type: "button",
806
+ onClick: () => {
807
+ saveSettings();
808
+ },
809
+ children: t("section.save")
810
+ }),
811
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
812
+ className: team_module_css_default.button,
813
+ type: "button",
814
+ disabled: token.trim() === "",
815
+ onClick: () => {
816
+ send(dispatch, "set-token", { token }).then((ok) => {
817
+ if (ok) {
818
+ setToken("");
819
+ setSaved(true);
820
+ } else setSaved(false);
821
+ });
822
+ },
823
+ children: t("section.token.save")
824
+ }),
825
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
826
+ className: team_module_css_default.button,
827
+ type: "button",
828
+ onClick: () => {
829
+ send(dispatch, "clear-token");
830
+ },
831
+ children: t("section.token.clear")
832
+ }),
833
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
834
+ className: team_module_css_default.button,
835
+ type: "button",
836
+ onClick: () => {
837
+ send(dispatch, "refresh");
838
+ },
839
+ children: t("section.refresh")
840
+ })
841
+ ]
842
+ }),
843
+ saved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
844
+ className: team_module_css_default.meta,
845
+ children: t("section.saved")
846
+ }) : null,
847
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
848
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
849
+ className: team_module_css_default.title,
850
+ children: t("section.capabilities")
851
+ }),
852
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Capability, {
853
+ label: t("section.capability.followUp"),
854
+ available: summary?.capabilities.followUp === true,
855
+ missing: t("section.capability.followUpMissing")
856
+ }),
857
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Capability, {
858
+ label: t("section.capability.rework"),
859
+ available: summary?.capabilities.rework === true,
860
+ missing: t("section.capability.reworkMissing")
861
+ }),
862
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Capability, {
863
+ label: t("section.capability.run"),
864
+ available: summary?.capabilities.run === true,
865
+ missing: t("section.capability.runMissing")
866
+ }),
867
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Capability, {
868
+ label: t("section.capability.presetPin"),
869
+ available: summary?.presetPin === "supported",
870
+ missing: t("section.capability.presetPinMissing")
871
+ })
872
+ ] }),
873
+ (summary?.problems ?? []).length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
874
+ className: team_module_css_default.title,
875
+ children: t("section.problems")
876
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
877
+ className: team_module_css_default.list,
878
+ children: (summary?.problems ?? []).map((problem) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
879
+ className: team_module_css_default.entry,
880
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
881
+ className: team_module_css_default.body,
882
+ children: problem
883
+ })
884
+ }, problem))
885
+ })] }),
886
+ summary?.connection.lastError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
887
+ className: team_module_css_default.error,
888
+ children: summary.connection.lastError
889
+ })
890
+ ]
891
+ });
892
+ }
893
+ //#endregion
894
+ //#region src/client/optional-service.ts
895
+ /**
896
+ * Read one optional service by name, outside the inject contract.
897
+ *
898
+ * One external plugin must never take the GUI down: an unsupported read is
899
+ * reported as "no such service" instead of reaching the shell's boot check.
900
+ * @param ctx - the browser plugin context.
901
+ * @param name - the service name to resolve.
902
+ * @returns the service, or undefined when this deployment serves none.
903
+ */
904
+ function optionalService(ctx, name) {
905
+ try {
906
+ const get = ctx.get;
907
+ return get === void 0 ? void 0 : get.call(ctx, name);
908
+ } catch {
909
+ return;
910
+ }
911
+ }
912
+ //#endregion
913
+ //#region src/client/team/extension.ts
914
+ /** Locale namespace the seats bind to. */
915
+ const LOCALE_NS = "task-board-team";
916
+ /**
917
+ * Register one contribution, then keep it registered across every re-declaration
918
+ * of the seat it lives in.
919
+ * @param slots - the slot registry.
920
+ * @param seat - the seat key.
921
+ * @param component - the component to render into it.
922
+ * @param withLocale - whether the seat passes a locale namespace to the component.
923
+ * @returns disposer releasing the contribution.
924
+ */
925
+ function registerSeat(slots, seat, component, withLocale) {
926
+ const register = () => {
927
+ try {
928
+ const dispose = slots.register({
929
+ name: seat,
930
+ id: TEAM_EXTENSION_ID,
931
+ ...withLocale ? { locale: LOCALE_NS } : {}
932
+ }, component);
933
+ return () => {
934
+ try {
935
+ dispose();
936
+ } catch {}
937
+ };
938
+ } catch (error) {
939
+ console.error("[dsh-task-board-team] seat registration failed: " + seat, error);
940
+ return () => {};
941
+ }
942
+ };
943
+ if (typeof slots.inject !== "function") return register();
944
+ try {
945
+ return slots.inject(seat, register);
946
+ } catch (error) {
947
+ console.error("[dsh-task-board-team] seat could not follow its declaration: " + seat, error);
948
+ return register();
949
+ }
950
+ }
951
+ /**
952
+ * Install the team browser half.
953
+ * @param ctx - client context (slot registry).
954
+ * @param source - the extension's live enabled switch.
955
+ * @returns disposer releasing every contribution.
956
+ */
957
+ function installTeamClientHalf(ctx, source) {
958
+ let rendering;
959
+ let configuration;
960
+ const slots = optionalService(ctx, "slots");
961
+ if (slots === void 0) return () => {};
962
+ const install = () => {
963
+ if (rendering !== void 0) return;
964
+ rendering = ctx.inject(["taskBoard"], (scope) => {
965
+ scope.effect(() => installSeats(scope, slots), "task-board-team: provider seats");
966
+ });
967
+ };
968
+ const release = () => {
969
+ const current = rendering;
970
+ rendering = void 0;
971
+ if (current === void 0) return;
972
+ current.dispose();
973
+ clearSummary();
974
+ };
975
+ const apply = () => {
976
+ if (source.read()) install();
977
+ else release();
978
+ };
979
+ configuration = ctx.inject(["taskBoard"], (scope) => {
980
+ scope.effect(() => registerSeat(slots, TASK_BOARD_SETTINGS_SECTION, TeamSettingsSection, true), "task-board-team: provider settings section");
981
+ });
982
+ const unsubscribe = source.subscribe(apply);
983
+ apply();
984
+ return () => {
985
+ unsubscribe();
986
+ release();
987
+ const currentConfiguration = configuration;
988
+ configuration = void 0;
989
+ if (currentConfiguration !== void 0) currentConfiguration.dispose();
990
+ };
991
+ }
992
+ /**
993
+ * Register the rendering seats and the mirror subscription for as long as the
994
+ * board's own master switch is on.
995
+ * @param ctx - client context.
996
+ * @param slots - the slot registry.
997
+ * @returns disposer releasing every contribution.
998
+ */
999
+ function installSeats(ctx, slots) {
1000
+ const face = resolveTaskBoardClientFace(ctx);
1001
+ if (face === void 0) {
1002
+ console.error("[dsh-task-board-team] the taskBoard service does not answer the client contract");
1003
+ return () => {};
1004
+ }
1005
+ const seats = [];
1006
+ let registered = false;
1007
+ const ensure = () => {
1008
+ if (registered) return;
1009
+ registered = true;
1010
+ seats.push(registerSeat(slots, TASK_BOARD_DETAIL_SECTION, TeamDetailSection, true));
1011
+ seats.push(registerSeat(slots, TASK_BOARD_CARD_DECORATION, TeamCardDecoration, false));
1012
+ };
1013
+ const release = () => {
1014
+ registered = false;
1015
+ for (const dispose of seats.splice(0)) try {
1016
+ dispose();
1017
+ } catch {}
1018
+ };
1019
+ const unsubscribe = face.subscribe((mirror) => {
1020
+ if (mirror.enabled) ensure();
1021
+ else release();
1022
+ acceptPublishedSummaries(mirror.extensions);
1023
+ });
1024
+ const current = face.snapshot();
1025
+ if (current.enabled) ensure();
1026
+ acceptPublishedSummaries(current.extensions);
1027
+ return () => {
1028
+ unsubscribe();
1029
+ release();
1030
+ };
1031
+ }
1032
+ //#endregion
1033
+ //#region src/client/index.ts
1034
+ /** Locale namespace this half owns. */
1035
+ const NS = "task-board-team";
1036
+ /** Settings namespace the block edits. */
1037
+ const SETTINGS_NAMESPACE = "task-board-team";
1038
+ /** Profile entry ids this package's patch rows carry, most specific first. */
1039
+ const ENTRY_IDS = [
1040
+ "web-ui-task-board-team",
1041
+ "ui-task-board-team",
1042
+ SETTINGS_NAMESPACE
1043
+ ];
1044
+ /**
1045
+ * A form for a page that serves this namespace to nobody: it never answers, so
1046
+ * the seats follow the documented default (enabled) instead of failing.
1047
+ * @returns an inert configuration form.
1048
+ */
1049
+ function unavailableForm() {
1050
+ const snapshot = {
1051
+ status: "unavailable",
1052
+ value: void 0,
1053
+ base: void 0,
1054
+ user: void 0,
1055
+ revision: void 0,
1056
+ writable: false
1057
+ };
1058
+ return {
1059
+ getSnapshot: () => snapshot,
1060
+ subscribe: () => () => {},
1061
+ set: async () => false,
1062
+ unset: async () => false,
1063
+ mutate: async () => false
1064
+ };
1065
+ }
1066
+ /**
1067
+ * Bind the settings form this extension's switch is read from.
1068
+ * @param ctx - the browser plugin context.
1069
+ * @returns the form, or an inert one when the page serves no such namespace.
1070
+ */
1071
+ function bindSettingsForm(ctx) {
1072
+ if (optionalService(ctx, "configForms") === void 0) return unavailableForm();
1073
+ const binder = optionalService(ctx, "webUiSettings");
1074
+ if (binder !== void 0 && typeof binder.bind === "function") try {
1075
+ return binder.bind({ namespace: SETTINGS_NAMESPACE });
1076
+ } catch {
1077
+ return unavailableForm();
1078
+ }
1079
+ return unavailableForm();
1080
+ }
1081
+ /**
1082
+ * Mount the extension's browser half.
1083
+ * @param ctx - the browser plugin context.
1084
+ */
1085
+ function apply(ctx) {
1086
+ const locale = optionalService(ctx, "locale");
1087
+ ctx.effect(() => {
1088
+ if (locale === void 0) return () => {};
1089
+ try {
1090
+ return locale.register(NS, {
1091
+ zh,
1092
+ en
1093
+ });
1094
+ } catch {
1095
+ return () => {};
1096
+ }
1097
+ }, "task-board-team: dictionaries");
1098
+ if (locale !== void 0) try {
1099
+ setRuntimeTranslate(locale.bind(NS));
1100
+ } catch {}
1101
+ const scope = bindSettingsForm(ctx);
1102
+ const enabledSource = {
1103
+ read: () => scope.getSnapshot().value?.enabled !== false,
1104
+ subscribe: (listener) => scope.subscribe(listener)
1105
+ };
1106
+ ctx.effect(() => installTeamClientHalf(ctx, enabledSource), "task-board-team: provider seats");
1107
+ }
1108
+ //#endregion
1109
+ exports.ENTRY_IDS = ENTRY_IDS;
1110
+ exports.NS = NS;
1111
+ exports.SETTINGS_NAMESPACE = SETTINGS_NAMESPACE;
1112
+ exports.apply = apply;
1113
+ return module.exports;
1114
+ }
1115
+ });
1116
+
1117
+ //# sourceMappingURL=client.js.map