@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
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Copy of the team provider's browser half.
3
+ *
4
+ * The Chinese dictionary is the key source: every other locale tracks exactly
5
+ * these keys (the repository gate enforces parity), and no user-facing string is
6
+ * written inline in a component. The third language is carried centrally by
7
+ * dsh-i18n, which is why this module ships zh and en only.
8
+ *
9
+ * @module dsh-task-board-team/client/locales
10
+ */
11
+
12
+ export const zh = {
13
+ 'section.title': '团队协作',
14
+ 'section.hub': 'Hub 地址',
15
+ 'section.team': '团队 ID',
16
+ 'section.token': 'Host Token',
17
+ 'section.token.configured': '已配置(保存在宿主侧,不回显)',
18
+ 'section.token.missing': '未配置',
19
+ 'section.token.placeholder': '粘贴 Host Token,保存后只在宿主侧使用',
20
+ 'section.token.save': '保存 Token',
21
+ 'section.token.clear': '清除 Token',
22
+ 'section.agents': '团队 Agent 绑定',
23
+ 'section.agents.empty': '尚未绑定任何 dsh-agents 成员,本机不会领取任何团队任务',
24
+ 'section.agents.hint': '填写 dsh-agents 的成员 ID,用逗号分隔',
25
+ 'section.questionWait': '本地兜底等待(分钟)',
26
+ 'section.questionWait.hint': '0 = 不设本地上限,一直等到 hub 给出终态(回答、过期或撤回)',
27
+ 'section.save': '保存设置',
28
+ 'section.saved': '已保存',
29
+ 'section.refresh': '立即领取',
30
+ 'section.connection': '连接状态',
31
+ 'section.connection.idle': '未启动',
32
+ 'section.connection.connecting': '正在注册',
33
+ 'section.connection.online': '在线',
34
+ 'section.connection.reconnecting': '正在重连',
35
+ 'section.connection.error': '连接失败',
36
+ 'section.host': '主机',
37
+ 'section.heartbeat': '最近心跳',
38
+ 'section.reconnects': '重连次数',
39
+ 'section.capabilities': '能力',
40
+ 'section.capability.followUp': '后续消息投递',
41
+ 'section.capability.rework': '同会话返工',
42
+ 'section.capability.run': '自动开始执行',
43
+ 'section.capability.available': '可用',
44
+ 'section.capability.missing': '不可用',
45
+ 'section.capability.followUpMissing': '当前看板版本不提供 followUp,评论里 @ 本机 Agent 时只能记在活动流里',
46
+ 'section.capability.reworkMissing': '当前看板版本不提供 rework,收到返工请求时只记录,不会重跑',
47
+ 'section.capability.runMissing': '当前看板版本不提供执行入口,领取到的卡片需要人工在看板上开始',
48
+ 'section.capability.presetPin': '建卡时钉住预设与模型',
49
+ 'section.capability.presetPinMissing': '当前看板版本无法在建卡时钉住 Agent 预设、模型与思考档位,因此领取到的镜像卡没有启动,需要人工处理',
50
+ 'section.problems': '配置问题',
51
+ 'detail.title': '团队协作',
52
+ 'detail.issue': '团队 issue',
53
+ 'detail.assignee': '负责人',
54
+ 'detail.reviewer': '审阅人',
55
+ 'detail.agent': '执行 Agent',
56
+ 'detail.status': 'Hub 状态',
57
+ 'detail.comments': '评论',
58
+ 'detail.activity': '活动',
59
+ 'detail.pending': '待回答的问题',
60
+ 'detail.empty': '暂无',
61
+ 'detail.error': '最近错误',
62
+ 'status.todo': '待办',
63
+ 'status.assigned': '已分配',
64
+ 'status.waiting_host': '等待执行节点',
65
+ 'status.running': '执行中',
66
+ 'status.in_review': '待审阅',
67
+ 'status.done': '已完成',
68
+ 'status.canceled': '已取消',
69
+ 'status.failed': '失败',
70
+ 'unavailable': '本扩展的团队配置尚不可用',
71
+ } as const
72
+
73
+ export type TeamKey = keyof typeof zh
74
+
75
+ export const en: Record<TeamKey, string> = {
76
+ 'section.title': 'Team collaboration',
77
+ 'section.hub': 'Hub URL',
78
+ 'section.team': 'Team ID',
79
+ 'section.token': 'Host Token',
80
+ 'section.token.configured': 'Configured (kept host-side, never echoed)',
81
+ 'section.token.missing': 'Not configured',
82
+ 'section.token.placeholder': 'Paste the Host Token; it is used host-side only',
83
+ 'section.token.save': 'Save token',
84
+ 'section.token.clear': 'Clear token',
85
+ 'section.agents': 'Team Agent bindings',
86
+ 'section.agents.empty': 'No dsh-agents member is bound, so this machine claims nothing',
87
+ 'section.agents.hint': 'dsh-agents member ids, separated by commas',
88
+ 'section.questionWait': 'Local fallback wait (minutes)',
89
+ 'section.questionWait.hint': '0 = no local cap; wait for the hub to settle the question (answered, expired or withdrawn)',
90
+ 'section.save': 'Save settings',
91
+ 'section.saved': 'Saved',
92
+ 'section.refresh': 'Claim now',
93
+ 'section.connection': 'Connection',
94
+ 'section.connection.idle': 'Stopped',
95
+ 'section.connection.connecting': 'Registering',
96
+ 'section.connection.online': 'Online',
97
+ 'section.connection.reconnecting': 'Reconnecting',
98
+ 'section.connection.error': 'Connection failed',
99
+ 'section.host': 'Host',
100
+ 'section.heartbeat': 'Last heartbeat',
101
+ 'section.reconnects': 'Reconnects',
102
+ 'section.capabilities': 'Capabilities',
103
+ 'section.capability.followUp': 'Follow-up delivery',
104
+ 'section.capability.rework': 'Rework in session',
105
+ 'section.capability.run': 'Start executions',
106
+ 'section.capability.available': 'Available',
107
+ 'section.capability.missing': 'Unavailable',
108
+ 'section.capability.followUpMissing': 'This board revision serves no followUp, so a mention is only recorded on the activity stream',
109
+ 'section.capability.reworkMissing': 'This board revision serves no rework, so a rework request is recorded and never re-run',
110
+ 'section.capability.runMissing': 'This board revision serves no execution entry, so a claimed card has to be started on the board',
111
+ 'section.capability.presetPin': 'Pinning a preset and model on create',
112
+ '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',
113
+ 'section.problems': 'Configuration problems',
114
+ 'detail.title': 'Team collaboration',
115
+ 'detail.issue': 'Team issue',
116
+ 'detail.assignee': 'Assignee',
117
+ 'detail.reviewer': 'Reviewer',
118
+ 'detail.agent': 'Executing agent',
119
+ 'detail.status': 'Hub status',
120
+ 'detail.comments': 'Comments',
121
+ 'detail.activity': 'Activity',
122
+ 'detail.pending': 'Open questions',
123
+ 'detail.empty': 'Nothing yet',
124
+ 'detail.error': 'Last error',
125
+ 'status.todo': 'Todo',
126
+ 'status.assigned': 'Assigned',
127
+ 'status.waiting_host': 'Waiting for the execution node',
128
+ 'status.running': 'Running',
129
+ 'status.in_review': 'In review',
130
+ 'status.done': 'Done',
131
+ 'status.canceled': 'Canceled',
132
+ 'status.failed': 'Failed',
133
+ 'unavailable': 'The team configuration of this extension is not available',
134
+ }
135
+
136
+ /** The translate seat the seats use when the client locale service is absent. */
137
+ let translate: (key: TeamKey) => string = key => zh[key]
138
+
139
+ /**
140
+ * Install the runtime translate seat.
141
+ * @param bound - the locale-bound lookup of this namespace.
142
+ */
143
+ export function setRuntimeTranslate(bound: (key: TeamKey) => string): void {
144
+ translate = bound
145
+ }
146
+
147
+ /**
148
+ * Translate one key of this namespace.
149
+ * @param key - dictionary key.
150
+ * @returns the localized string.
151
+ */
152
+ export function t(key: TeamKey): string {
153
+ return translate(key)
154
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Optional service access for the browser half.
3
+ *
4
+ * The web shell's context throws when a plugin reads a service it did not
5
+ * declare in its inject contract — an entry that wants to tolerate a deployment
6
+ * without a settings surface or slot registry therefore cannot read those names
7
+ * as plain properties. `ctx.get` resolves the same service without the inject
8
+ * requirement, and answers undefined when nothing serves it.
9
+ *
10
+ * @module dsh-task-board-team/client/optional-service
11
+ */
12
+ import type { Context as ClientContext } from '@deepseek-ai/cordis'
13
+
14
+ /**
15
+ * Read one optional service by name, outside the inject contract.
16
+ *
17
+ * One external plugin must never take the GUI down: an unsupported read is
18
+ * reported as "no such service" instead of reaching the shell's boot check.
19
+ * @param ctx - the browser plugin context.
20
+ * @param name - the service name to resolve.
21
+ * @returns the service, or undefined when this deployment serves none.
22
+ */
23
+ export function optionalService(ctx: ClientContext, name: string): unknown {
24
+ try {
25
+ const get = (ctx as unknown as { get?: (name: string) => unknown }).get
26
+ return get === undefined ? undefined : get.call(ctx, name)
27
+ } catch {
28
+ return undefined
29
+ }
30
+ }
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Browser-half installer for the team provider.
3
+ *
4
+ * A provider's browser half registers its own contributions into the child seats
5
+ * the board declares; it resolves the board's client capability face from the
6
+ * shared service name and adds no HTTP surface of its own. The board publishes
7
+ * that service inside its own apply and the aggregate mounts client children
8
+ * without ordering those applies, so the seats live behind a cordis dependency
9
+ * scope (ctx.inject) rather than a one-shot lookup: the scope mounts when the
10
+ * board serves the service and unloads — releasing every seat — when it is
11
+ * withdrawn.
12
+ *
13
+ * @module dsh-task-board-team/client/team/extension
14
+ */
15
+ import type { Context as ClientContext } from '@deepseek-ai/cordis'
16
+ import { TEAM_EXTENSION_ID } from '../../core/identity.ts'
17
+ import {
18
+ resolveTaskBoardClientFace,
19
+ TASK_BOARD_CARD_DECORATION,
20
+ TASK_BOARD_DETAIL_SECTION,
21
+ TASK_BOARD_SETTINGS_SECTION,
22
+ type TaskBoardClientFace,
23
+ } from '../../core/contract.ts'
24
+ import { TeamCardDecoration, TeamDetailSection } from './sections.tsx'
25
+ import { TeamSettingsSection } from './settings.tsx'
26
+ import { optionalService } from '../optional-service.ts'
27
+ import { acceptPublishedSummaries, clearSummary } from './summary.ts'
28
+
29
+ /** Locale namespace the seats bind to. */
30
+ const LOCALE_NS = 'task-board-team'
31
+
32
+ /** The live switch the installer follows; the settings form supplies it. */
33
+ export interface ExtensionEnabledSource {
34
+ /** Whether the extension is currently enabled (absent config means enabled). */
35
+ read(): boolean
36
+ /** Observe switch changes; the returned disposer removes the listener. */
37
+ subscribe(listener: () => void): () => void
38
+ }
39
+
40
+ /** The slice of the slot registry this installer uses. */
41
+ interface SlotRegistry {
42
+ register(options: Record<string, unknown>, component: unknown): () => void
43
+ inject?(key: string, callback: () => () => void): () => void
44
+ }
45
+
46
+ /**
47
+ * Register one contribution, then keep it registered across every re-declaration
48
+ * of the seat it lives in.
49
+ * @param slots - the slot registry.
50
+ * @param seat - the seat key.
51
+ * @param component - the component to render into it.
52
+ * @param withLocale - whether the seat passes a locale namespace to the component.
53
+ * @returns disposer releasing the contribution.
54
+ */
55
+ function registerSeat(
56
+ slots: SlotRegistry,
57
+ seat: string,
58
+ component: unknown,
59
+ withLocale: boolean,
60
+ ): () => void {
61
+ const register = (): (() => void) => {
62
+ try {
63
+ const dispose = slots.register({
64
+ name: seat,
65
+ id: TEAM_EXTENSION_ID,
66
+ ...(withLocale ? { locale: LOCALE_NS } : {}),
67
+ }, component)
68
+ return () => {
69
+ try { dispose() } catch { /* best-effort */ }
70
+ }
71
+ } catch (error) {
72
+ console.error('[dsh-task-board-team] seat registration failed: ' + seat, error)
73
+ return () => {}
74
+ }
75
+ }
76
+ if (typeof slots.inject !== 'function') return register()
77
+ try {
78
+ return slots.inject(seat, register)
79
+ } catch (error) {
80
+ console.error('[dsh-task-board-team] seat could not follow its declaration: ' + seat, error)
81
+ return register()
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Install the team browser half.
87
+ * @param ctx - client context (slot registry).
88
+ * @param source - the extension's live enabled switch.
89
+ * @returns disposer releasing every contribution.
90
+ */
91
+ export function installTeamClientHalf(ctx: ClientContext, source: ExtensionEnabledSource): () => void {
92
+ let rendering: ReturnType<ClientContext['inject']> | undefined
93
+ let configuration: ReturnType<ClientContext['inject']> | undefined
94
+ // The shell throws on an undeclared service property, so the registry is
95
+ // probed instead of read: a page that serves no slot registry loses only this
96
+ // provider's contributions, never the whole boot.
97
+ const slots = optionalService(ctx, 'slots') as SlotRegistry | undefined
98
+ if (slots === undefined) return () => {}
99
+
100
+ const install = (): void => {
101
+ if (rendering !== undefined) return
102
+ rendering = ctx.inject(['taskBoard'], (scope: ClientContext) => {
103
+ scope.effect(() => installSeats(scope, slots), 'task-board-team: provider seats')
104
+ })
105
+ }
106
+
107
+ const release = (): void => {
108
+ const current = rendering
109
+ rendering = undefined
110
+ if (current === undefined) return
111
+ void current.dispose()
112
+ // A hidden provider publishes no summary; keep the last one from looking
113
+ // like live state on a settings page that is still open.
114
+ clearSummary()
115
+ }
116
+
117
+ const apply = (): void => {
118
+ if (source.read()) install()
119
+ else release()
120
+ }
121
+
122
+ // The configuration block outlives the extension's own switch: it is where the
123
+ // switch and the credential live.
124
+ configuration = ctx.inject(['taskBoard'], (scope: ClientContext) => {
125
+ scope.effect(
126
+ () => registerSeat(slots, TASK_BOARD_SETTINGS_SECTION, TeamSettingsSection, true),
127
+ 'task-board-team: provider settings section',
128
+ )
129
+ })
130
+
131
+ const unsubscribe = source.subscribe(apply)
132
+ apply()
133
+
134
+ return () => {
135
+ unsubscribe()
136
+ release()
137
+ const currentConfiguration = configuration
138
+ configuration = undefined
139
+ if (currentConfiguration !== undefined) void currentConfiguration.dispose()
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Register the rendering seats and the mirror subscription for as long as the
145
+ * board's own master switch is on.
146
+ * @param ctx - client context.
147
+ * @param slots - the slot registry.
148
+ * @returns disposer releasing every contribution.
149
+ */
150
+ function installSeats(ctx: ClientContext, slots: SlotRegistry): () => void {
151
+ const face: TaskBoardClientFace | undefined = resolveTaskBoardClientFace(ctx)
152
+ if (face === undefined) {
153
+ console.error('[dsh-task-board-team] the taskBoard service does not answer the client contract')
154
+ return () => {}
155
+ }
156
+ const seats: Array<() => void> = []
157
+ let registered = false
158
+
159
+ const ensure = (): void => {
160
+ if (registered) return
161
+ registered = true
162
+ seats.push(registerSeat(slots, TASK_BOARD_DETAIL_SECTION, TeamDetailSection, true))
163
+ seats.push(registerSeat(slots, TASK_BOARD_CARD_DECORATION, TeamCardDecoration, false))
164
+ }
165
+ const release = (): void => {
166
+ registered = false
167
+ for (const dispose of seats.splice(0)) {
168
+ try { dispose() } catch { /* best-effort */ }
169
+ }
170
+ }
171
+
172
+ const unsubscribe = face.subscribe(mirror => {
173
+ if (mirror.enabled) ensure()
174
+ else release()
175
+ acceptPublishedSummaries(mirror.extensions)
176
+ })
177
+ const current = face.snapshot()
178
+ if (current.enabled) ensure()
179
+ acceptPublishedSummaries(current.extensions)
180
+
181
+ return () => {
182
+ unsubscribe()
183
+ release()
184
+ }
185
+ }
@@ -0,0 +1,159 @@
1
+ /**
2
+ * The two rendering seats of the team provider: the task-detail section and the
3
+ * card decoration.
4
+ *
5
+ * Both read the published summary the Host pushes through the board mirror; the
6
+ * card payload itself (the issue id, attempt id and lease) is read off the card
7
+ * the seat was handed, so a mirror card is recognizable even before the first
8
+ * summary arrives.
9
+ *
10
+ * @module dsh-task-board-team/client/team/sections
11
+ */
12
+ import type { CSSProperties, ReactElement } from 'react'
13
+ import type { TaskBoardCardDecorationProps, TaskBoardDetailSectionProps } from '../../core/contract.ts'
14
+ import { readTaskIssueLink, type TeamIssueLink } from '../../core/identity.ts'
15
+ import type { TeamCardView } from '../../host/service.ts'
16
+ import { t, type TeamKey } from '../locales.ts'
17
+ import { useTeamSummary } from './summary.ts'
18
+ import styles from './team.module.css'
19
+
20
+ /** Hub status the badge renders; the key set is the protocol's own status column. */
21
+ const STATUS_KEYS: Record<string, TeamKey> = {
22
+ todo: 'status.todo',
23
+ assigned: 'status.assigned',
24
+ waiting_host: 'status.waiting_host',
25
+ running: 'status.running',
26
+ in_review: 'status.in_review',
27
+ done: 'status.done',
28
+ canceled: 'status.canceled',
29
+ failed: 'status.failed',
30
+ }
31
+
32
+ /**
33
+ * Translate one hub status.
34
+ * @param status - the collaboration status the hub reported.
35
+ * @returns the localized label, or the raw status for a value this build predates.
36
+ */
37
+ export function statusLabel(status: string | undefined): string {
38
+ if (status === undefined) return t('detail.empty')
39
+ const key = STATUS_KEYS[status]
40
+ return key === undefined ? status : t(key)
41
+ }
42
+
43
+ /**
44
+ * The hub status badge of one mirrored card.
45
+ * @param props - the card the board renders.
46
+ * @returns the badge, or nothing for a card that mirrors no issue.
47
+ */
48
+ export function TeamCardDecoration({ task }: TaskBoardCardDecorationProps): ReactElement | null {
49
+ useTeamSummary()
50
+ const link = readTaskIssueLink(task as never)
51
+ if (link === undefined) return null
52
+ const status = link.hubStatus
53
+ if (status === undefined) {
54
+ return <span className={styles.badge} data-dsh-plugin="task-board-team" data-dsh-part="team-badge">{t('detail.title')}</span>
55
+ }
56
+ return (
57
+ <span className={styles.badge} data-dsh-plugin="task-board-team" data-dsh-part="team-badge" data-hub-status={status}>
58
+ {statusLabel(status)}
59
+ </span>
60
+ )
61
+ }
62
+
63
+ /** One line of the detail block: label and value. */
64
+ function Field({ label, value }: { label: string; value: string }): ReactElement {
65
+ return (
66
+ <div className={styles.row}>
67
+ <span className={styles.label}>{label}</span>
68
+ <span className={styles.value}>{value}</span>
69
+ </div>
70
+ )
71
+ }
72
+
73
+ /** The comments and activity one card carries, newest last. */
74
+ function Streams({ view }: { view: TeamCardView | undefined }): ReactElement {
75
+ const comments = view?.comments ?? []
76
+ const activity = view?.activity ?? []
77
+ return (
78
+ <>
79
+ <div>
80
+ <p className={styles.title}>{t('detail.comments')}</p>
81
+ {comments.length === 0
82
+ ? <p className={styles.empty}>{t('detail.empty')}</p>
83
+ : (
84
+ <ul className={styles.list} data-dsh-part="team-comments">
85
+ {comments.map(comment => (
86
+ <li key={comment.id} className={styles.entry}>
87
+ <span className={styles.meta}>{comment.author}</span>
88
+ <span className={styles.body}>{comment.content}</span>
89
+ </li>
90
+ ))}
91
+ </ul>
92
+ )}
93
+ </div>
94
+ <div>
95
+ <p className={styles.title}>{t('detail.activity')}</p>
96
+ {activity.length === 0
97
+ ? <p className={styles.empty}>{t('detail.empty')}</p>
98
+ : (
99
+ <ul className={styles.list} data-dsh-part="team-activity">
100
+ {activity.map(entry => (
101
+ <li key={entry.id} className={styles.entry}>
102
+ <span className={styles.meta}>{entry.type}</span>
103
+ <span className={styles.body}>{entry.text}</span>
104
+ </li>
105
+ ))}
106
+ </ul>
107
+ )}
108
+ </div>
109
+ </>
110
+ )
111
+ }
112
+
113
+ /**
114
+ * The team section of one card's detail view.
115
+ * @param props - the card the board renders, plus the action dispatcher.
116
+ * @returns the section, or nothing for a card that mirrors no issue.
117
+ */
118
+ export function TeamDetailSection({ task }: TaskBoardDetailSectionProps): ReactElement | null {
119
+ const summary = useTeamSummary()
120
+ const link = readTaskIssueLink(task as never)
121
+ if (link === undefined) return null
122
+ const view = summary?.cards[task.id]
123
+ const pending = (summary?.pendingQuestions ?? []).filter(question => question.taskId === task.id)
124
+ const agent = summary?.agents.find(candidate => candidate.memberId === link.agentMemberId)
125
+ const style: CSSProperties = {}
126
+ return (
127
+ <div className={styles.section} data-dsh-plugin="task-board-team" data-dsh-part="team-detail" style={style}>
128
+ <p className={styles.title}>{t('detail.title')}</p>
129
+ <Field label={t('detail.issue')} value={issueLabel(link)} />
130
+ <Field label={t('detail.status')} value={statusLabel(view?.hubStatus ?? link.hubStatus)} />
131
+ <Field label={t('detail.agent')} value={agent?.name ?? link.agentId ?? t('detail.empty')} />
132
+ <Field label={t('detail.assignee')} value={link.assignee ?? t('detail.empty')} />
133
+ <Field label={t('detail.reviewer')} value={link.reviewer ?? t('detail.empty')} />
134
+ {pending.length === 0 ? null : (
135
+ <div>
136
+ <p className={styles.title}>{t('detail.pending')}</p>
137
+ <ul className={styles.list} data-dsh-part="team-questions">
138
+ {pending.map(question => (
139
+ <li key={question.id} className={styles.entry}>
140
+ <span className={styles.body}>{question.question}</span>
141
+ </li>
142
+ ))}
143
+ </ul>
144
+ </div>
145
+ )}
146
+ <Streams view={view} />
147
+ {view?.lastError === undefined ? null : <p className={styles.error}>{t('detail.error')}: {view.lastError}</p>}
148
+ </div>
149
+ )
150
+ }
151
+
152
+ /**
153
+ * Render the issue identity of one linkage.
154
+ * @param link - the card's linkage back to the hub.
155
+ * @returns the label, e.g. "issue #12".
156
+ */
157
+ export function issueLabel(link: TeamIssueLink): string {
158
+ return link.issueNumber === undefined ? link.issueId : 'issue #' + String(link.issueNumber)
159
+ }