@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.
- package/LICENSE +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +66 -2
- package/README.zh.md +67 -0
- package/cordis.patch.yml +14 -0
- package/icon.svg +3 -0
- package/lib/client.js +1117 -0
- package/lib/index.js +2968 -0
- package/lib/types/client/index.d.ts +58 -0
- package/lib/types/client/locales.d.ts +83 -0
- package/lib/types/client/optional-service.d.ts +22 -0
- package/lib/types/client/team/extension.d.ts +29 -0
- package/lib/types/client/team/sections.d.ts +38 -0
- package/lib/types/client/team/settings.d.ts +41 -0
- package/lib/types/client/team/summary.d.ts +34 -0
- package/lib/types/core/contract.d.ts +269 -0
- package/lib/types/core/hub-protocol.d.ts +175 -0
- package/lib/types/core/identity.d.ts +96 -0
- package/lib/types/core/mirror.d.ts +51 -0
- package/lib/types/core/question-report.d.ts +84 -0
- package/lib/types/core/settlement.d.ts +49 -0
- package/lib/types/core/task-record.d.ts +59 -0
- package/lib/types/core/timers.d.ts +20 -0
- package/lib/types/host/bindings.d.ts +92 -0
- package/lib/types/host/channel.d.ts +44 -0
- package/lib/types/host/credentials.d.ts +63 -0
- package/lib/types/host/extension.d.ts +57 -0
- package/lib/types/host/hub-client.d.ts +157 -0
- package/lib/types/host/questions.d.ts +105 -0
- package/lib/types/host/service.d.ts +209 -0
- package/lib/types/host/setup.d.ts +152 -0
- package/lib/types/host/tools.d.ts +19 -0
- package/lib/types/host/waterfall.d.ts +39 -0
- package/lib/types/index.d.ts +152 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +83 -3
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +139 -0
- package/src/client/locales.ts +154 -0
- package/src/client/optional-service.ts +30 -0
- package/src/client/team/extension.ts +185 -0
- package/src/client/team/sections.tsx +159 -0
- package/src/client/team/settings.tsx +242 -0
- package/src/client/team/summary.ts +156 -0
- package/src/client/team/team.module.css +122 -0
- package/src/core/contract.ts +326 -0
- package/src/core/hub-protocol.ts +217 -0
- package/src/core/identity.ts +193 -0
- package/src/core/mirror.ts +88 -0
- package/src/core/question-report.ts +144 -0
- package/src/core/settlement.ts +84 -0
- package/src/core/task-record.ts +65 -0
- package/src/core/timers.ts +34 -0
- package/src/host/bindings.ts +211 -0
- package/src/host/channel.ts +97 -0
- package/src/host/credentials.ts +147 -0
- package/src/host/extension.ts +197 -0
- package/src/host/hub-client.ts +287 -0
- package/src/host/questions.ts +275 -0
- package/src/host/service.ts +1421 -0
- package/src/host/setup.ts +259 -0
- package/src/host/tools.ts +70 -0
- package/src/host/waterfall.ts +51 -0
- package/src/index.ts +452 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The team configuration block inside the board's own settings card.
|
|
3
|
+
*
|
|
4
|
+
* It renders what the Host published (hub URL, team id, hostname, whether a Host
|
|
5
|
+
* Token is configured, the live connection state and which optional board
|
|
6
|
+
* capabilities this deployment really serves) and it writes through the board's
|
|
7
|
+
* same-origin action channel, which is the only channel a provider has. A token
|
|
8
|
+
* value travels exactly once, from this input to the Host, and is never read
|
|
9
|
+
* back: the field always renders empty and the status line says whether one is
|
|
10
|
+
* stored.
|
|
11
|
+
*
|
|
12
|
+
* The block stays reachable while the extension is switched off, because it is
|
|
13
|
+
* where the switch is turned back on; it only reports that fact instead of
|
|
14
|
+
* pretending the forms still apply.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-task-board-team/client/team/settings
|
|
17
|
+
*/
|
|
18
|
+
import { useState, type ReactElement } from 'react'
|
|
19
|
+
import type { TaskBoardExtensionDispatch, TaskBoardSettingsSectionProps } from '../../core/contract.ts'
|
|
20
|
+
import { TEAM_EXTENSION_ID } from '../../core/identity.ts'
|
|
21
|
+
import type { TeamExtensionSummary } from '../../host/service.ts'
|
|
22
|
+
import { t, type TeamKey } from '../locales.ts'
|
|
23
|
+
import { useTeamSummary } from './summary.ts'
|
|
24
|
+
import styles from './team.module.css'
|
|
25
|
+
|
|
26
|
+
/** What the published summary carries about the configuration itself. */
|
|
27
|
+
interface PublishedConfiguration {
|
|
28
|
+
hubUrl?: string
|
|
29
|
+
teamId?: string
|
|
30
|
+
hostname?: string
|
|
31
|
+
tokenConfigured?: boolean
|
|
32
|
+
questionWaitMinutes?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Read the configuration half of one summary.
|
|
37
|
+
* @param summary - the published summary, or undefined.
|
|
38
|
+
* @returns the configuration fields the card renders.
|
|
39
|
+
*/
|
|
40
|
+
export function readConfiguration(summary: TeamExtensionSummary | undefined): PublishedConfiguration {
|
|
41
|
+
const configuration = summary?.configuration
|
|
42
|
+
if (configuration === undefined) return {}
|
|
43
|
+
return {
|
|
44
|
+
...(configuration.hubUrl === undefined ? {} : { hubUrl: configuration.hubUrl }),
|
|
45
|
+
...(configuration.teamId === undefined ? {} : { teamId: configuration.teamId }),
|
|
46
|
+
...(configuration.hostname === undefined ? {} : { hostname: configuration.hostname }),
|
|
47
|
+
...(configuration.tokenConfigured === undefined ? {} : { tokenConfigured: configuration.tokenConfigured }),
|
|
48
|
+
...(configuration.questionWaitMinutes === undefined ? {} : { questionWaitMinutes: configuration.questionWaitMinutes }),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Dispatch one action of this extension.
|
|
54
|
+
* @param dispatch - the board's action dispatcher.
|
|
55
|
+
* @param action - provider-owned action name.
|
|
56
|
+
* @param payload - opaque payload.
|
|
57
|
+
* @returns whether the board accepted the action.
|
|
58
|
+
*/
|
|
59
|
+
async function send(
|
|
60
|
+
dispatch: TaskBoardExtensionDispatch,
|
|
61
|
+
action: string,
|
|
62
|
+
payload?: Record<string, unknown>,
|
|
63
|
+
): Promise<boolean> {
|
|
64
|
+
try {
|
|
65
|
+
return await dispatch({
|
|
66
|
+
extensionId: TEAM_EXTENSION_ID,
|
|
67
|
+
action,
|
|
68
|
+
...(payload === undefined ? {} : { payload }),
|
|
69
|
+
})
|
|
70
|
+
} catch {
|
|
71
|
+
return false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** One capability line of the settings block. */
|
|
76
|
+
function Capability({ label, available, missing }: { label: string; available: boolean; missing: string }): ReactElement {
|
|
77
|
+
return (
|
|
78
|
+
<div className={styles.row}>
|
|
79
|
+
<span className={styles.label}>{label}</span>
|
|
80
|
+
<span className={styles.value}>
|
|
81
|
+
{available ? t('section.capability.available') : t('section.capability.missing') + ' — ' + missing}
|
|
82
|
+
</span>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The settings block.
|
|
89
|
+
* @param props - the board's settings seat props.
|
|
90
|
+
* @returns the block.
|
|
91
|
+
*/
|
|
92
|
+
export function TeamSettingsSection({ dispatch }: TaskBoardSettingsSectionProps): ReactElement {
|
|
93
|
+
const summary = useTeamSummary()
|
|
94
|
+
const configuration = readConfiguration(summary)
|
|
95
|
+
const [hubUrl, setHubUrl] = useState<string | undefined>(undefined)
|
|
96
|
+
const [teamId, setTeamId] = useState<string | undefined>(undefined)
|
|
97
|
+
const [members, setMembers] = useState<string | undefined>(undefined)
|
|
98
|
+
const [waitMinutes, setWaitMinutes] = useState<string | undefined>(undefined)
|
|
99
|
+
const [token, setToken] = useState('')
|
|
100
|
+
const [saved, setSaved] = useState(false)
|
|
101
|
+
|
|
102
|
+
const connection = summary?.connection.state ?? 'idle'
|
|
103
|
+
const membersValue = members ?? (summary?.agents ?? []).map(agent => agent.memberId).join(', ')
|
|
104
|
+
const stateKey = ('section.connection.' + connection) as TeamKey
|
|
105
|
+
|
|
106
|
+
const saveSettings = async (): Promise<void> => {
|
|
107
|
+
const bindings = (membersValue ?? '')
|
|
108
|
+
.split(',')
|
|
109
|
+
.map(entry => entry.trim())
|
|
110
|
+
.filter(entry => entry !== '')
|
|
111
|
+
.map(memberId => ({ memberId }))
|
|
112
|
+
const ok = await send(dispatch, 'setup-save', {
|
|
113
|
+
...(hubUrl === undefined ? {} : { hubUrl }),
|
|
114
|
+
...(teamId === undefined ? {} : { teamId }),
|
|
115
|
+
agents: bindings,
|
|
116
|
+
questionWaitMinutes: Number.parseInt(waitMinutes ?? String(configuration.questionWaitMinutes ?? 0), 10) || 0,
|
|
117
|
+
})
|
|
118
|
+
setSaved(ok)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div className={styles.section} data-dsh-plugin="task-board-team" data-dsh-part="team-settings">
|
|
123
|
+
<p className={styles.title}>{t('section.title')}</p>
|
|
124
|
+
<div className={styles.row}>
|
|
125
|
+
<span className={styles.label}>{t('section.connection')}</span>
|
|
126
|
+
<span className={styles.value} data-dsh-part="team-connection">{t(stateKey)}</span>
|
|
127
|
+
</div>
|
|
128
|
+
{summary?.connection.hostId === undefined ? null : (
|
|
129
|
+
<div className={styles.row}>
|
|
130
|
+
<span className={styles.label}>{t('section.host')}</span>
|
|
131
|
+
<span className={styles.value}>{summary.connection.hostId}</span>
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
134
|
+
<label className={styles.row}>
|
|
135
|
+
<span className={styles.label}>{t('section.hub')}</span>
|
|
136
|
+
<input
|
|
137
|
+
className={styles.input}
|
|
138
|
+
value={hubUrl ?? configuration.hubUrl ?? ''}
|
|
139
|
+
placeholder="https://hub.example.com"
|
|
140
|
+
onChange={event => { setHubUrl(event.target.value) }}
|
|
141
|
+
/>
|
|
142
|
+
</label>
|
|
143
|
+
<label className={styles.row}>
|
|
144
|
+
<span className={styles.label}>{t('section.team')}</span>
|
|
145
|
+
<input
|
|
146
|
+
className={styles.input}
|
|
147
|
+
value={teamId ?? configuration.teamId ?? ''}
|
|
148
|
+
placeholder="team_..."
|
|
149
|
+
onChange={event => { setTeamId(event.target.value) }}
|
|
150
|
+
/>
|
|
151
|
+
</label>
|
|
152
|
+
<label className={styles.row}>
|
|
153
|
+
<span className={styles.label}>{t('section.token')}</span>
|
|
154
|
+
<span className={styles.value}>
|
|
155
|
+
{configuration.tokenConfigured === true ? t('section.token.configured') : t('section.token.missing')}
|
|
156
|
+
</span>
|
|
157
|
+
</label>
|
|
158
|
+
<input
|
|
159
|
+
className={styles.input}
|
|
160
|
+
type="password"
|
|
161
|
+
placeholder={t('section.token.placeholder')}
|
|
162
|
+
value={token}
|
|
163
|
+
onChange={event => { setToken(event.target.value) }}
|
|
164
|
+
/>
|
|
165
|
+
<label className={styles.row}>
|
|
166
|
+
<span className={styles.label}>{t('section.agents')}</span>
|
|
167
|
+
<input
|
|
168
|
+
className={styles.input}
|
|
169
|
+
value={membersValue}
|
|
170
|
+
placeholder="member_..."
|
|
171
|
+
onChange={event => { setMembers(event.target.value) }}
|
|
172
|
+
/>
|
|
173
|
+
</label>
|
|
174
|
+
<p className={styles.meta}>{t('section.agents.hint')}</p>
|
|
175
|
+
<label className={styles.row}>
|
|
176
|
+
<span className={styles.label}>{t('section.questionWait')}</span>
|
|
177
|
+
<input
|
|
178
|
+
className={styles.input}
|
|
179
|
+
inputMode="numeric"
|
|
180
|
+
value={waitMinutes ?? String(configuration.questionWaitMinutes ?? 0)}
|
|
181
|
+
onChange={event => { setWaitMinutes(event.target.value) }}
|
|
182
|
+
/>
|
|
183
|
+
</label>
|
|
184
|
+
<p className={styles.meta}>{t('section.questionWait.hint')}</p>
|
|
185
|
+
{(summary?.agents ?? []).length === 0 ? <p className={styles.empty}>{t('section.agents.empty')}</p> : null}
|
|
186
|
+
<div className={styles.actions}>
|
|
187
|
+
<button className={styles.button} type="button" onClick={() => { void saveSettings() }}>{t('section.save')}</button>
|
|
188
|
+
<button
|
|
189
|
+
className={styles.button}
|
|
190
|
+
type="button"
|
|
191
|
+
disabled={token.trim() === ''}
|
|
192
|
+
onClick={() => {
|
|
193
|
+
void send(dispatch, 'set-token', { token }).then(ok => {
|
|
194
|
+
if (ok) { setToken(''); setSaved(true) } else setSaved(false)
|
|
195
|
+
})
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
{t('section.token.save')}
|
|
199
|
+
</button>
|
|
200
|
+
<button className={styles.button} type="button" onClick={() => { void send(dispatch, 'clear-token') }}>{t('section.token.clear')}</button>
|
|
201
|
+
<button className={styles.button} type="button" onClick={() => { void send(dispatch, 'refresh') }}>{t('section.refresh')}</button>
|
|
202
|
+
</div>
|
|
203
|
+
{saved ? <p className={styles.meta}>{t('section.saved')}</p> : null}
|
|
204
|
+
<div>
|
|
205
|
+
<p className={styles.title}>{t('section.capabilities')}</p>
|
|
206
|
+
<Capability
|
|
207
|
+
label={t('section.capability.followUp')}
|
|
208
|
+
available={summary?.capabilities.followUp === true}
|
|
209
|
+
missing={t('section.capability.followUpMissing')}
|
|
210
|
+
/>
|
|
211
|
+
<Capability
|
|
212
|
+
label={t('section.capability.rework')}
|
|
213
|
+
available={summary?.capabilities.rework === true}
|
|
214
|
+
missing={t('section.capability.reworkMissing')}
|
|
215
|
+
/>
|
|
216
|
+
<Capability
|
|
217
|
+
label={t('section.capability.run')}
|
|
218
|
+
available={summary?.capabilities.run === true}
|
|
219
|
+
missing={t('section.capability.runMissing')}
|
|
220
|
+
/>
|
|
221
|
+
<Capability
|
|
222
|
+
label={t('section.capability.presetPin')}
|
|
223
|
+
available={summary?.presetPin === 'supported'}
|
|
224
|
+
missing={t('section.capability.presetPinMissing')}
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
{(summary?.problems ?? []).length === 0 ? null : (
|
|
228
|
+
<div>
|
|
229
|
+
<p className={styles.title}>{t('section.problems')}</p>
|
|
230
|
+
<ul className={styles.list}>
|
|
231
|
+
{(summary?.problems ?? []).map(problem => (
|
|
232
|
+
<li key={problem} className={styles.entry}><span className={styles.body}>{problem}</span></li>
|
|
233
|
+
))}
|
|
234
|
+
</ul>
|
|
235
|
+
</div>
|
|
236
|
+
)}
|
|
237
|
+
{summary?.connection.lastError === undefined ? null : (
|
|
238
|
+
<p className={styles.error}>{summary.connection.lastError}</p>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The published summary this extension's browser half renders.
|
|
3
|
+
*
|
|
4
|
+
* The Host publishes one opaque payload per extension; the board forwards it
|
|
5
|
+
* verbatim in the snapshot and this module is the only place that interprets it.
|
|
6
|
+
* It is a store rather than a hook so the seats (which receive only their owner
|
|
7
|
+
* props) can read one live value and re-render when the board pushes a new one.
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-task-board-team/client/team/summary
|
|
10
|
+
*/
|
|
11
|
+
import { useSyncExternalStore } from 'react'
|
|
12
|
+
import type { TeamExtensionSummary } from '../../host/service.ts'
|
|
13
|
+
|
|
14
|
+
/** The value the seats read. */
|
|
15
|
+
const EMPTY: TeamExtensionSummary | undefined = undefined
|
|
16
|
+
|
|
17
|
+
let current: TeamExtensionSummary | undefined = EMPTY
|
|
18
|
+
const listeners = new Set<() => void>()
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Take the summaries the board snapshot carries.
|
|
22
|
+
* @param extensions - the snapshot's published extension summaries.
|
|
23
|
+
*/
|
|
24
|
+
export function acceptPublishedSummaries(extensions: Readonly<Record<string, unknown>> | undefined): void {
|
|
25
|
+
const entry = extensions?.['task-board-team']
|
|
26
|
+
const next = readSummary(entry)
|
|
27
|
+
if (next === undefined && current === undefined) return
|
|
28
|
+
current = next
|
|
29
|
+
for (const listener of [...listeners]) listener()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Drop the published summary: a hidden provider must not look like live state. */
|
|
33
|
+
export function clearSummary(): void {
|
|
34
|
+
if (current === undefined) return
|
|
35
|
+
current = undefined
|
|
36
|
+
for (const listener of [...listeners]) listener()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Read the live summary.
|
|
41
|
+
* @returns the summary, or undefined before the Host published one.
|
|
42
|
+
*/
|
|
43
|
+
export function getSummary(): TeamExtensionSummary | undefined {
|
|
44
|
+
return current
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Read one card's collaboration view.
|
|
49
|
+
* @param taskId - the board card id.
|
|
50
|
+
* @returns the view, or undefined when this card mirrors no issue.
|
|
51
|
+
*/
|
|
52
|
+
export function cardViewOf(taskId: string): TeamExtensionSummary['cards'][string] | undefined {
|
|
53
|
+
return current?.cards[taskId]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function subscribe(listener: () => void): () => void {
|
|
57
|
+
listeners.add(listener)
|
|
58
|
+
return () => { listeners.delete(listener) }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe one component to the live summary.
|
|
63
|
+
* @returns the current summary and a re-render on every change.
|
|
64
|
+
*/
|
|
65
|
+
export function useTeamSummary(): TeamExtensionSummary | undefined {
|
|
66
|
+
return useSyncExternalStore(subscribe, getSummary, getSummary)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Validate one published payload into the summary shape.
|
|
71
|
+
*
|
|
72
|
+
* A payload from another revision of this extension is read for the fields it
|
|
73
|
+
* does carry and never trusted for the ones it does not, so a version skew
|
|
74
|
+
* degrades one section instead of throwing inside the board's render.
|
|
75
|
+
* @param raw - the opaque payload the board forwarded.
|
|
76
|
+
* @returns the summary, or undefined when it carries no usable shape.
|
|
77
|
+
*/
|
|
78
|
+
export function readSummary(raw: unknown): TeamExtensionSummary | undefined {
|
|
79
|
+
if (typeof raw !== 'object' || raw === null) return undefined
|
|
80
|
+
const value = raw as Partial<TeamExtensionSummary>
|
|
81
|
+
if (typeof value.connection !== 'object' || value.connection === null) return undefined
|
|
82
|
+
const connection = value.connection as TeamExtensionSummary['connection']
|
|
83
|
+
return {
|
|
84
|
+
connection: {
|
|
85
|
+
state: readState(connection.state),
|
|
86
|
+
...(typeof connection.hostId === 'string' ? { hostId: connection.hostId } : {}),
|
|
87
|
+
...(typeof connection.lastHeartbeatAt === 'number' ? { lastHeartbeatAt: connection.lastHeartbeatAt } : {}),
|
|
88
|
+
reconnects: typeof connection.reconnects === 'number' ? connection.reconnects : 0,
|
|
89
|
+
...(typeof connection.lastError === 'string' ? { lastError: connection.lastError } : {}),
|
|
90
|
+
},
|
|
91
|
+
capabilities: {
|
|
92
|
+
followUp: value.capabilities?.followUp === true,
|
|
93
|
+
rework: value.capabilities?.rework === true,
|
|
94
|
+
run: value.capabilities?.run === true,
|
|
95
|
+
},
|
|
96
|
+
agents: Array.isArray(value.agents)
|
|
97
|
+
? value.agents.flatMap(agent => typeof agent?.memberId === 'string' && typeof agent?.name === 'string'
|
|
98
|
+
? [{
|
|
99
|
+
memberId: agent.memberId,
|
|
100
|
+
name: agent.name,
|
|
101
|
+
...(typeof agent.preset === 'string' ? { preset: agent.preset } : {}),
|
|
102
|
+
...(typeof agent.hubAgentId === 'string' ? { hubAgentId: agent.hubAgentId } : {}),
|
|
103
|
+
}]
|
|
104
|
+
: [])
|
|
105
|
+
: [],
|
|
106
|
+
problems: Array.isArray(value.problems) ? value.problems.filter((line): line is string => typeof line === 'string') : [],
|
|
107
|
+
presetPin: value.presetPin === 'supported' || value.presetPin === 'missing' ? value.presetPin : 'unknown',
|
|
108
|
+
cards: typeof value.cards === 'object' && value.cards !== null ? value.cards : {},
|
|
109
|
+
...(readConfigurationField(value.configuration) === undefined
|
|
110
|
+
? {}
|
|
111
|
+
: { configuration: readConfigurationField(value.configuration) as NonNullable<TeamExtensionSummary['configuration']> }),
|
|
112
|
+
pendingQuestions: Array.isArray(value.pendingQuestions)
|
|
113
|
+
? value.pendingQuestions.flatMap(question => typeof question?.taskId === 'string'
|
|
114
|
+
? [{
|
|
115
|
+
id: typeof question.id === 'string' ? question.id : '',
|
|
116
|
+
taskId: question.taskId,
|
|
117
|
+
issueId: typeof question.issueId === 'string' ? question.issueId : '',
|
|
118
|
+
question: typeof question.question === 'string' ? question.question : '',
|
|
119
|
+
askedAt: typeof question.askedAt === 'number' ? question.askedAt : 0,
|
|
120
|
+
...(typeof question.hubQuestionId === 'string' ? { hubQuestionId: question.hubQuestionId } : {}),
|
|
121
|
+
}]
|
|
122
|
+
: [])
|
|
123
|
+
: [],
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Read the configuration half of one published payload.
|
|
129
|
+
* @param raw - the opaque member.
|
|
130
|
+
* @returns the fields this build understands, or undefined when there are none.
|
|
131
|
+
*/
|
|
132
|
+
function readConfigurationField(raw: unknown): TeamExtensionSummary['configuration'] | undefined {
|
|
133
|
+
if (typeof raw !== 'object' || raw === null) return undefined
|
|
134
|
+
const value = raw as Record<string, unknown>
|
|
135
|
+
const configuration: NonNullable<TeamExtensionSummary['configuration']> = {
|
|
136
|
+
...(typeof value.hubUrl === 'string' ? { hubUrl: value.hubUrl } : {}),
|
|
137
|
+
...(typeof value.teamId === 'string' ? { teamId: value.teamId } : {}),
|
|
138
|
+
...(typeof value.hostname === 'string' ? { hostname: value.hostname } : {}),
|
|
139
|
+
...(typeof value.tokenConfigured === 'boolean' ? { tokenConfigured: value.tokenConfigured } : {}),
|
|
140
|
+
...(typeof value.questionWaitMinutes === 'number' ? { questionWaitMinutes: value.questionWaitMinutes } : {}),
|
|
141
|
+
}
|
|
142
|
+
return Object.keys(configuration).length === 0 ? undefined : configuration
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function readState(raw: unknown): TeamExtensionSummary['connection']['state'] {
|
|
146
|
+
switch (raw) {
|
|
147
|
+
case 'idle':
|
|
148
|
+
case 'connecting':
|
|
149
|
+
case 'online':
|
|
150
|
+
case 'reconnecting':
|
|
151
|
+
case 'error':
|
|
152
|
+
return raw
|
|
153
|
+
default:
|
|
154
|
+
return 'idle'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* Team provider seats: one quiet block per surface, tokens only. */
|
|
2
|
+
|
|
3
|
+
.section {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 10px;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.title {
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
color: var(--dsw-alias-label-primary);
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.row {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.label {
|
|
24
|
+
color: var(--dsw-alias-label-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.value {
|
|
28
|
+
color: var(--dsw-alias-label-primary);
|
|
29
|
+
text-align: right;
|
|
30
|
+
overflow-wrap: anywhere;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.badge {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 4px;
|
|
37
|
+
border: 1px solid var(--dsw-alias-border-secondary);
|
|
38
|
+
border-radius: 999px;
|
|
39
|
+
padding: 0 6px;
|
|
40
|
+
font-size: 11px;
|
|
41
|
+
line-height: 18px;
|
|
42
|
+
color: var(--dsw-alias-label-secondary);
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.badge[data-hub-status='in_review'] {
|
|
47
|
+
border-color: var(--dsw-alias-border-primary);
|
|
48
|
+
color: var(--dsw-alias-label-primary);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.badge[data-hub-status='running'] {
|
|
52
|
+
border-color: var(--dsw-alias-border-primary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.badge[data-hub-status='failed'] {
|
|
56
|
+
border-style: dashed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.list {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 6px;
|
|
63
|
+
margin: 0;
|
|
64
|
+
padding: 0;
|
|
65
|
+
list-style: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.entry {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 2px;
|
|
72
|
+
padding: 4px 0;
|
|
73
|
+
border-top: 1px solid var(--dsw-alias-border-secondary);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.meta {
|
|
77
|
+
color: var(--dsw-alias-label-secondary);
|
|
78
|
+
font-size: 11px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.body {
|
|
82
|
+
color: var(--dsw-alias-label-primary);
|
|
83
|
+
white-space: pre-wrap;
|
|
84
|
+
overflow-wrap: anywhere;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.error {
|
|
88
|
+
color: var(--dsw-alias-label-secondary);
|
|
89
|
+
border-left: 2px solid var(--dsw-alias-border-primary);
|
|
90
|
+
padding-left: 6px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.input {
|
|
94
|
+
width: 100%;
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
padding: 4px 6px;
|
|
97
|
+
border: 1px solid var(--dsw-alias-border-secondary);
|
|
98
|
+
border-radius: 6px;
|
|
99
|
+
background: var(--dsw-alias-bg-primary);
|
|
100
|
+
color: var(--dsw-alias-label-primary);
|
|
101
|
+
font: inherit;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.actions {
|
|
105
|
+
display: flex;
|
|
106
|
+
gap: 6px;
|
|
107
|
+
flex-wrap: wrap;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.button {
|
|
111
|
+
padding: 2px 10px;
|
|
112
|
+
border: 1px solid var(--dsw-alias-border-secondary);
|
|
113
|
+
border-radius: 6px;
|
|
114
|
+
background: transparent;
|
|
115
|
+
color: var(--dsw-alias-label-primary);
|
|
116
|
+
font: inherit;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.empty {
|
|
121
|
+
color: var(--dsw-alias-label-secondary);
|
|
122
|
+
}
|