@linxin666/dsh-client-ui-task-board-team 0.0.0-stage → 0.4.14
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 +1490 -0
- package/lib/index.js +2968 -0
- package/lib/types/client/PluginSettingsCard.d.ts +255 -0
- package/lib/types/client/RangeBubble.d.ts +46 -0
- package/lib/types/client/SegmentGroup.d.ts +28 -0
- package/lib/types/client/index.d.ts +58 -0
- package/lib/types/client/locales.d.ts +90 -0
- package/lib/types/client/optional-service.d.ts +22 -0
- package/lib/types/client/settings-form.d.ts +235 -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 +67 -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 +84 -3
- package/src/client/PluginSettingsCard.tsx +838 -0
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +139 -0
- package/src/client/locales.ts +168 -0
- package/src/client/optional-service.ts +30 -0
- package/src/client/settings-card.module.css +821 -0
- package/src/client/settings-form.ts +510 -0
- package/src/client/team/extension.ts +185 -0
- package/src/client/team/sections.tsx +159 -0
- package/src/client/team/settings.tsx +348 -0
- package/src/client/team/summary.ts +156 -0
- package/src/client/team/team.module.css +193 -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,164 @@
|
|
|
1
|
+
// Generated by scripts/sync-shared.mjs from shared/client/settings/RangeBubble.tsx. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
|
|
2
|
+
/**
|
|
3
|
+
* Coarse adjustment for a bounded number: resting the pointer on the control
|
|
4
|
+
* (or moving focus into it) raises a small bubble holding a slider across the
|
|
5
|
+
* field's whole range, so a large change is one drag instead of many presses
|
|
6
|
+
* or a retyped value. The control itself stays the precise entry.
|
|
7
|
+
*
|
|
8
|
+
* The bubble belongs to the anchor's subtree, so moving from the control onto
|
|
9
|
+
* the bubble never counts as leaving. It opens after a short rest and closes a
|
|
10
|
+
* moment after the pointer and focus have both gone, so crossing the control
|
|
11
|
+
* on the way elsewhere does not flash it. While a drag is in progress the
|
|
12
|
+
* bubble stays put even if the pointer strays off it.
|
|
13
|
+
*
|
|
14
|
+
* Dragging reports each value through `onInput`, so the field shows it live;
|
|
15
|
+
* releasing the thumb, or a key press on it, reports `onCommit` once. The
|
|
16
|
+
* bubble opens on the side of the control that has room inside the nearest
|
|
17
|
+
* scrolling ancestor, so a row near the top of a settings page does not hang
|
|
18
|
+
* its bubble under the page edge.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { useEffect, useRef, useState, type ChangeEvent, type CSSProperties, type KeyboardEvent, type ReactNode } from 'react'
|
|
22
|
+
import css from './settings-card.module.css'
|
|
23
|
+
|
|
24
|
+
/** Rest on the control before the bubble opens. */
|
|
25
|
+
const OPEN_DELAY_MS = 220
|
|
26
|
+
/** Grace after pointer and focus have left before the bubble closes. */
|
|
27
|
+
const CLOSE_DELAY_MS = 200
|
|
28
|
+
/** Room the bubble needs between the control and the scroller's edge. */
|
|
29
|
+
const BUBBLE_ROOM_PX = 64
|
|
30
|
+
|
|
31
|
+
/** Props of {@link RangeBubble}. */
|
|
32
|
+
export interface RangeBubbleProps {
|
|
33
|
+
/** Lowest value the slider reaches. */
|
|
34
|
+
min: number
|
|
35
|
+
/** Highest value the slider reaches. */
|
|
36
|
+
max: number
|
|
37
|
+
/** Slider granularity. */
|
|
38
|
+
step: number
|
|
39
|
+
/** Current value; a value outside the range parks the thumb at the nearer end. */
|
|
40
|
+
value: number
|
|
41
|
+
/** Accessible name of the slider. */
|
|
42
|
+
label: string
|
|
43
|
+
/** Disables the bubble along with the control. */
|
|
44
|
+
disabled?: boolean
|
|
45
|
+
/** Each value while the thumb moves. */
|
|
46
|
+
onInput: (value: number) => void
|
|
47
|
+
/** The value the thumb was released on, once per drag or key press. */
|
|
48
|
+
onCommit: (value: number) => void
|
|
49
|
+
/** The precise control the bubble hangs off. */
|
|
50
|
+
children: ReactNode
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The nearest ancestor that scrolls vertically, or the viewport's root. */
|
|
54
|
+
function scroller(node: HTMLElement): HTMLElement {
|
|
55
|
+
for (let parent = node.parentElement; parent !== null; parent = parent.parentElement) {
|
|
56
|
+
const overflow = getComputedStyle(parent).overflowY
|
|
57
|
+
if (overflow === 'auto' || overflow === 'scroll') return parent
|
|
58
|
+
}
|
|
59
|
+
return node.ownerDocument.documentElement
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Render the control with its coarse-adjustment bubble.
|
|
64
|
+
* @param props - the range, the value and the two report callbacks.
|
|
65
|
+
* @returns the anchor holding the control and the bubble.
|
|
66
|
+
*/
|
|
67
|
+
export function RangeBubble(props: RangeBubbleProps): ReactNode {
|
|
68
|
+
const { min, max, step, disabled = false } = props
|
|
69
|
+
const [open, setOpen] = useState(false)
|
|
70
|
+
const [side, setSide] = useState<'above' | 'below'>('above')
|
|
71
|
+
const [live, setLive] = useState<number | null>(null)
|
|
72
|
+
const anchorRef = useRef<HTMLDivElement | null>(null)
|
|
73
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
|
|
74
|
+
const hovered = useRef(false)
|
|
75
|
+
const focused = useRef(false)
|
|
76
|
+
const dragging = useRef(false)
|
|
77
|
+
|
|
78
|
+
useEffect(() => () => { clearTimeout(timer.current) }, [])
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (disabled) {
|
|
81
|
+
clearTimeout(timer.current)
|
|
82
|
+
setOpen(false)
|
|
83
|
+
}
|
|
84
|
+
}, [disabled])
|
|
85
|
+
|
|
86
|
+
const show = (): void => {
|
|
87
|
+
const anchor = anchorRef.current
|
|
88
|
+
if (anchor !== null) {
|
|
89
|
+
const room = anchor.getBoundingClientRect().top - scroller(anchor).getBoundingClientRect().top
|
|
90
|
+
setSide(room >= BUBBLE_ROOM_PX ? 'above' : 'below')
|
|
91
|
+
}
|
|
92
|
+
setOpen(true)
|
|
93
|
+
}
|
|
94
|
+
const schedule = (): void => {
|
|
95
|
+
clearTimeout(timer.current)
|
|
96
|
+
if (disabled) return
|
|
97
|
+
if (hovered.current || focused.current || dragging.current) {
|
|
98
|
+
if (!open) timer.current = setTimeout(show, focused.current ? 0 : OPEN_DELAY_MS)
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
timer.current = setTimeout(() => { setOpen(false) }, CLOSE_DELAY_MS)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const commit = (value: number): void => {
|
|
105
|
+
dragging.current = false
|
|
106
|
+
setLive(null)
|
|
107
|
+
props.onCommit(value)
|
|
108
|
+
schedule()
|
|
109
|
+
}
|
|
110
|
+
const onChange = (event: ChangeEvent<HTMLInputElement>): void => {
|
|
111
|
+
const value = Number(event.target.value)
|
|
112
|
+
setLive(value)
|
|
113
|
+
props.onInput(value)
|
|
114
|
+
}
|
|
115
|
+
const onKeyUp = (event: KeyboardEvent<HTMLInputElement>): void => {
|
|
116
|
+
if (live !== null) commit(live)
|
|
117
|
+
if (event.key === 'Escape') {
|
|
118
|
+
clearTimeout(timer.current)
|
|
119
|
+
setOpen(false)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const shown = live ?? Math.min(max, Math.max(min, props.value))
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div
|
|
126
|
+
ref={anchorRef}
|
|
127
|
+
className={css.rangeAnchor}
|
|
128
|
+
onPointerEnter={() => { hovered.current = true; schedule() }}
|
|
129
|
+
onPointerLeave={() => { hovered.current = false; schedule() }}
|
|
130
|
+
onFocus={() => { focused.current = true; schedule() }}
|
|
131
|
+
onBlur={(event) => {
|
|
132
|
+
if (event.currentTarget.contains(event.relatedTarget as Node | null)) return
|
|
133
|
+
focused.current = false
|
|
134
|
+
if (live !== null) commit(live)
|
|
135
|
+
else schedule()
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
{props.children}
|
|
139
|
+
<div className={css.rangeBubble} data-open={open ? '' : undefined} data-side={side}>
|
|
140
|
+
<input
|
|
141
|
+
type="range"
|
|
142
|
+
className={css.rangeSlider}
|
|
143
|
+
min={min}
|
|
144
|
+
max={max}
|
|
145
|
+
step={step}
|
|
146
|
+
value={shown}
|
|
147
|
+
aria-label={props.label}
|
|
148
|
+
tabIndex={open ? 0 : -1}
|
|
149
|
+
disabled={disabled}
|
|
150
|
+
style={{ '--range-fill': `${((shown - min) / (max - min)) * 100}%` } as CSSProperties}
|
|
151
|
+
onPointerDown={() => { dragging.current = true }}
|
|
152
|
+
onPointerUp={(event) => { commit(Number(event.currentTarget.value)) }}
|
|
153
|
+
onPointerCancel={(event) => { commit(Number(event.currentTarget.value)) }}
|
|
154
|
+
onChange={onChange}
|
|
155
|
+
onKeyUp={onKeyUp}
|
|
156
|
+
/>
|
|
157
|
+
<span className={css.rangeEnds} aria-hidden="true">
|
|
158
|
+
<span>{min}</span>
|
|
159
|
+
<span>{max}</span>
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Generated by scripts/sync-shared.mjs from shared/client/settings/SegmentGroup.tsx. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
|
|
2
|
+
/**
|
|
3
|
+
* The family's segmented control: a quiet track whose options share one
|
|
4
|
+
* highlight that slides to the pressed option, instead of each option fading
|
|
5
|
+
* its own background out and the next one in. The settings fields' small
|
|
6
|
+
* choices and the Web Extensions TAB strip both render through it, so the two
|
|
7
|
+
* read as one control.
|
|
8
|
+
*
|
|
9
|
+
* The caller builds the option buttons and marks the pressed one with
|
|
10
|
+
* `data-active`; the group measures that button after every render and writes
|
|
11
|
+
* its box as four custom properties, and the stylesheet draws the highlight
|
|
12
|
+
* there (`.segmentGroup[data-pill]::before`). Attribute and first placement
|
|
13
|
+
* land in the same task, so the highlight appears in place and only later
|
|
14
|
+
* changes slide. A ResizeObserver re-measures when the group or an option
|
|
15
|
+
* changes size: a longer locale, a font arriving, a container growing, a
|
|
16
|
+
* strip wrapping onto a second line.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Children, useLayoutEffect, useRef, type HTMLAttributes, type ReactNode } from 'react'
|
|
20
|
+
import css from './settings-card.module.css'
|
|
21
|
+
|
|
22
|
+
/** The attribute marking a group whose highlight has been placed. */
|
|
23
|
+
const PILL_ATTR = 'data-pill'
|
|
24
|
+
/** The pressed option, relative to the group. */
|
|
25
|
+
const ACTIVE_SELECTOR = ':scope > [data-active]'
|
|
26
|
+
const PILL_PROPERTIES = ['--segment-pill-x', '--segment-pill-y', '--segment-pill-w', '--segment-pill-h'] as const
|
|
27
|
+
|
|
28
|
+
/** Props of {@link SegmentGroup}: the track's own attributes and the option buttons. */
|
|
29
|
+
export interface SegmentGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
30
|
+
/** The option buttons; the pressed one carries `data-active`. */
|
|
31
|
+
children: ReactNode
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Write the highlight's box from the pressed option's box, or take the
|
|
36
|
+
* highlight off when nothing is pressed or the group has no layout yet.
|
|
37
|
+
* The two boxes are read in viewport pixels and turned back into the group's
|
|
38
|
+
* own CSS pixels, so a dialog that opens through a scale transform still
|
|
39
|
+
* lands the highlight on its option.
|
|
40
|
+
*/
|
|
41
|
+
function placePill(group: HTMLElement): void {
|
|
42
|
+
const item = group.querySelector<HTMLElement>(ACTIVE_SELECTOR)
|
|
43
|
+
const box = group.getBoundingClientRect()
|
|
44
|
+
if (item === null || group.offsetWidth === 0 || box.width === 0) {
|
|
45
|
+
group.removeAttribute(PILL_ATTR)
|
|
46
|
+
for (const property of PILL_PROPERTIES) group.style.removeProperty(property)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
const scale = box.width / group.offsetWidth
|
|
50
|
+
const itemBox = item.getBoundingClientRect()
|
|
51
|
+
const values = [
|
|
52
|
+
(itemBox.left - box.left) / scale - group.clientLeft,
|
|
53
|
+
(itemBox.top - box.top) / scale - group.clientTop,
|
|
54
|
+
itemBox.width / scale,
|
|
55
|
+
itemBox.height / scale,
|
|
56
|
+
]
|
|
57
|
+
values.forEach((value, index) => {
|
|
58
|
+
group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`)
|
|
59
|
+
})
|
|
60
|
+
if (!group.hasAttribute(PILL_ATTR)) group.setAttribute(PILL_ATTR, '')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Render a segmented track around the caller's option buttons.
|
|
65
|
+
* @param props - the track's attributes (role, accessible name, key handler) and its options.
|
|
66
|
+
* @returns the track.
|
|
67
|
+
*/
|
|
68
|
+
export function SegmentGroup(props: SegmentGroupProps): ReactNode {
|
|
69
|
+
const { children, className, ...rest } = props
|
|
70
|
+
const group = useRef<HTMLDivElement | null>(null)
|
|
71
|
+
const count = Children.count(children)
|
|
72
|
+
|
|
73
|
+
// Placed before the frame is painted, after every render: a press moves the
|
|
74
|
+
// pressed mark and the highlight follows it in the same frame.
|
|
75
|
+
useLayoutEffect(() => {
|
|
76
|
+
if (group.current !== null) placePill(group.current)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
useLayoutEffect(() => {
|
|
80
|
+
const element = group.current
|
|
81
|
+
if (element === null || typeof ResizeObserver === 'undefined') return undefined
|
|
82
|
+
const observer = new ResizeObserver(() => { placePill(element) })
|
|
83
|
+
observer.observe(element)
|
|
84
|
+
for (const item of Array.from(element.children)) observer.observe(item)
|
|
85
|
+
return () => { observer.disconnect() }
|
|
86
|
+
}, [count])
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div {...rest} ref={group} className={className === undefined ? css.segmentGroup : `${css.segmentGroup} ${className}`}>
|
|
90
|
+
{children}
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser half of the task-board team provider extension.
|
|
3
|
+
*
|
|
4
|
+
* It registers this extension's copy, then contributes three seats: the card
|
|
5
|
+
* decoration and the task-detail section (both behind the extension's own
|
|
6
|
+
* switch, which is read from the settings form), and the configuration block
|
|
7
|
+
* inside the board's own settings card (behind the board service alone, because
|
|
8
|
+
* that block is where the switch and the Host Token live).
|
|
9
|
+
*
|
|
10
|
+
* Failure policy: a missing slot registry, locale service or board service is
|
|
11
|
+
* handled, never thrown — the web shell fails the whole boot when a plugin apply
|
|
12
|
+
* throws, and one external plugin must not take the GUI down.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-task-board-team/client
|
|
15
|
+
*/
|
|
16
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
|
17
|
+
import type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
18
|
+
// Type-only: pulls the settings-surface Context merge (ctx.configForms).
|
|
19
|
+
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
20
|
+
// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its
|
|
21
|
+
// LocaleNamespaceMap merge table.
|
|
22
|
+
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
|
23
|
+
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
|
24
|
+
import type {} from '@deepseek-ai/dsh-client-ui-slots'
|
|
25
|
+
import { installTeamClientHalf, type ExtensionEnabledSource } from './team/extension.ts'
|
|
26
|
+
import { optionalService } from './optional-service.ts'
|
|
27
|
+
import { en, setRuntimeTranslate, t, zh, type TeamKey } from './locales.ts'
|
|
28
|
+
|
|
29
|
+
/** Locale namespace this half owns. */
|
|
30
|
+
export const NS = 'task-board-team'
|
|
31
|
+
|
|
32
|
+
/** Settings namespace the block edits. */
|
|
33
|
+
export const SETTINGS_NAMESPACE = 'task-board-team'
|
|
34
|
+
|
|
35
|
+
/** Profile entry ids this package's patch rows carry, most specific first. */
|
|
36
|
+
export const ENTRY_IDS: readonly string[] = ['web-ui-task-board-team', 'ui-task-board-team', SETTINGS_NAMESPACE]
|
|
37
|
+
|
|
38
|
+
/** The settings value this extension's own form carries. */
|
|
39
|
+
export interface TeamSettingsValue {
|
|
40
|
+
enabled?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
44
|
+
interface SlotMap {
|
|
45
|
+
/** Provider task-detail section; the board declares and renders it. */
|
|
46
|
+
'task-board.detail.section': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardDetailSectionProps }
|
|
47
|
+
/** Provider settings section; the board declares and renders it. */
|
|
48
|
+
'task-board.settings.section': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardSettingsSectionProps }
|
|
49
|
+
/** Provider card decoration; the board declares and renders it. */
|
|
50
|
+
'task-board.card.decoration': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardCardDecorationProps }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface LocaleNamespaceMap {
|
|
54
|
+
/** The team provider extension copy. */
|
|
55
|
+
'task-board-team': TeamKey
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A form for a page that serves this namespace to nobody: it never answers, so
|
|
61
|
+
* the seats follow the documented default (enabled) instead of failing.
|
|
62
|
+
* @returns an inert configuration form.
|
|
63
|
+
*/
|
|
64
|
+
function unavailableForm(): ConfigForm<TeamSettingsValue> {
|
|
65
|
+
const snapshot: ConfigFormSnapshot<TeamSettingsValue> = {
|
|
66
|
+
status: 'unavailable',
|
|
67
|
+
value: undefined,
|
|
68
|
+
base: undefined,
|
|
69
|
+
user: undefined,
|
|
70
|
+
revision: undefined,
|
|
71
|
+
writable: false,
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
getSnapshot: () => snapshot,
|
|
75
|
+
subscribe: () => () => {},
|
|
76
|
+
set: async () => false,
|
|
77
|
+
unset: async () => false,
|
|
78
|
+
mutate: async () => false,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Bind the settings form this extension's switch is read from.
|
|
84
|
+
* @param ctx - the browser plugin context.
|
|
85
|
+
* @returns the form, or an inert one when the page serves no such namespace.
|
|
86
|
+
*/
|
|
87
|
+
function bindSettingsForm(ctx: ClientContext): ConfigForm<TeamSettingsValue> {
|
|
88
|
+
// Read through the optional accessor: the shell throws on an undeclared
|
|
89
|
+
// service property, and one external plugin must not fail the whole boot.
|
|
90
|
+
const forms = optionalService(ctx, 'configForms') as { describe?: unknown } | undefined
|
|
91
|
+
if (forms === undefined) return unavailableForm()
|
|
92
|
+
const binder = optionalService(ctx, 'webUiSettings') as
|
|
93
|
+
{ bind?: <T>(spec: { namespace: string }) => ConfigForm<T> } | undefined
|
|
94
|
+
if (binder !== undefined && typeof binder.bind === 'function') {
|
|
95
|
+
try {
|
|
96
|
+
return binder.bind<TeamSettingsValue>({ namespace: SETTINGS_NAMESPACE })
|
|
97
|
+
} catch {
|
|
98
|
+
return unavailableForm()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return unavailableForm()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Runtime face of the locale service this half registers its copy into. */
|
|
105
|
+
interface LocaleSeat {
|
|
106
|
+
register(namespace: string, dictionaries: { zh: unknown; en: unknown }): () => void
|
|
107
|
+
bind(namespace: string): unknown
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Mount the extension's browser half.
|
|
112
|
+
* @param ctx - the browser plugin context.
|
|
113
|
+
*/
|
|
114
|
+
export function apply(ctx: ClientContext): void {
|
|
115
|
+
const locale = optionalService(ctx, 'locale') as LocaleSeat | undefined
|
|
116
|
+
|
|
117
|
+
ctx.effect(() => {
|
|
118
|
+
if (locale === undefined) return () => {}
|
|
119
|
+
try {
|
|
120
|
+
return locale.register(NS, { zh, en })
|
|
121
|
+
} catch {
|
|
122
|
+
return () => {}
|
|
123
|
+
}
|
|
124
|
+
}, 'task-board-team: dictionaries')
|
|
125
|
+
|
|
126
|
+
// Wire the SDK translate seat into the module-level t the seats use, so a
|
|
127
|
+
// runtime language switch reaches them without a reload.
|
|
128
|
+
if (locale !== undefined) {
|
|
129
|
+
try { setRuntimeTranslate(locale.bind(NS) as (key: TeamKey) => string) } catch { void t }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const scope = bindSettingsForm(ctx)
|
|
133
|
+
const enabledSource: ExtensionEnabledSource = {
|
|
134
|
+
read: () => scope.getSnapshot().value?.enabled !== false,
|
|
135
|
+
subscribe: listener => scope.subscribe(listener),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ctx.effect(() => installTeamClientHalf(ctx, enabledSource), 'task-board-team: provider seats')
|
|
139
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
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.description': '把云端 team-hub 指派给本机 dsh-agents 成员的 issue 领成看板镜像卡并在本机执行',
|
|
15
|
+
'section.hub': 'Hub 地址',
|
|
16
|
+
'section.team': '团队 ID',
|
|
17
|
+
'section.token': 'Host Token',
|
|
18
|
+
'section.token.configured': '已配置(保存在宿主侧,不回显)',
|
|
19
|
+
'section.token.missing': '未配置',
|
|
20
|
+
'section.token.placeholder': '粘贴 Host Token,保存后只在宿主侧使用',
|
|
21
|
+
'section.token.placeholderShort': '粘贴 Token',
|
|
22
|
+
'section.token.save': '保存 Token',
|
|
23
|
+
'section.token.clear': '清除 Token',
|
|
24
|
+
'section.agents': '团队 Agent 绑定',
|
|
25
|
+
'section.agents.empty': '尚未绑定任何 dsh-agents 成员,本机不会领取任何团队任务',
|
|
26
|
+
'section.agents.hint': '填写 dsh-agents 的成员 ID,用逗号分隔',
|
|
27
|
+
'section.questionWait': '本地兜底等待(分钟)',
|
|
28
|
+
'section.questionWait.hint': '0 = 不设本地上限,一直等到 hub 给出终态(回答、过期或撤回)',
|
|
29
|
+
'section.save': '保存设置',
|
|
30
|
+
'section.saved': '已保存',
|
|
31
|
+
'section.refresh': '立即领取',
|
|
32
|
+
'section.connection': '连接状态',
|
|
33
|
+
'section.connection.idle': '未启动',
|
|
34
|
+
'section.connection.connecting': '正在注册',
|
|
35
|
+
'section.connection.online': '在线',
|
|
36
|
+
'section.connection.reconnecting': '正在重连',
|
|
37
|
+
'section.connection.error': '连接失败',
|
|
38
|
+
'section.host': '主机',
|
|
39
|
+
'section.heartbeat': '最近心跳',
|
|
40
|
+
'section.reconnects': '重连次数',
|
|
41
|
+
'section.capabilities': '能力',
|
|
42
|
+
'section.capability.followUp': '后续消息投递',
|
|
43
|
+
'section.capability.rework': '同会话返工',
|
|
44
|
+
'section.capability.run': '自动开始执行',
|
|
45
|
+
'section.capability.available': '可用',
|
|
46
|
+
'section.capability.missing': '不可用',
|
|
47
|
+
'section.capability.followUpMissing': '当前看板版本不提供 followUp,评论里 @ 本机 Agent 时只能记在活动流里',
|
|
48
|
+
'section.capability.reworkMissing': '当前看板版本不提供 rework,收到返工请求时只记录,不会重跑',
|
|
49
|
+
'section.capability.runMissing': '当前看板版本不提供执行入口,领取到的卡片需要人工在看板上开始',
|
|
50
|
+
'section.capability.presetPin': '建卡时钉住预设与模型',
|
|
51
|
+
'section.capability.presetPinMissing': '当前看板版本无法在建卡时钉住 Agent 预设、模型与思考档位,因此领取到的镜像卡没有启动,需要人工处理',
|
|
52
|
+
'section.problems': '配置问题',
|
|
53
|
+
'settings.collapse': '收起设置',
|
|
54
|
+
'settings.expand': '展开设置',
|
|
55
|
+
'settings.notExposed': '当前版本未向设置页暴露本扩展的配置命名空间,配置表单不可用。',
|
|
56
|
+
'settings.readOnly': '当前部署的设置只读。',
|
|
57
|
+
'settings.saveFailed': '部署未接受这次改动。',
|
|
58
|
+
'detail.title': '团队协作',
|
|
59
|
+
'detail.issue': '团队 issue',
|
|
60
|
+
'detail.assignee': '负责人',
|
|
61
|
+
'detail.reviewer': '审阅人',
|
|
62
|
+
'detail.agent': '执行 Agent',
|
|
63
|
+
'detail.status': 'Hub 状态',
|
|
64
|
+
'detail.comments': '评论',
|
|
65
|
+
'detail.activity': '活动',
|
|
66
|
+
'detail.pending': '待回答的问题',
|
|
67
|
+
'detail.empty': '暂无',
|
|
68
|
+
'detail.error': '最近错误',
|
|
69
|
+
'status.todo': '待办',
|
|
70
|
+
'status.assigned': '已分配',
|
|
71
|
+
'status.waiting_host': '等待执行节点',
|
|
72
|
+
'status.running': '执行中',
|
|
73
|
+
'status.in_review': '待审阅',
|
|
74
|
+
'status.done': '已完成',
|
|
75
|
+
'status.canceled': '已取消',
|
|
76
|
+
'status.failed': '失败',
|
|
77
|
+
'unavailable': '本扩展的团队配置尚不可用',
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
export type TeamKey = keyof typeof zh
|
|
81
|
+
|
|
82
|
+
export const en: Record<TeamKey, string> = {
|
|
83
|
+
'section.title': 'Team collaboration',
|
|
84
|
+
'section.description': "Claims the issues the cloud team-hub assigns to this machine's dsh-agents members and runs them as board mirror cards",
|
|
85
|
+
'section.hub': 'Hub URL',
|
|
86
|
+
'section.team': 'Team ID',
|
|
87
|
+
'section.token': 'Host Token',
|
|
88
|
+
'section.token.configured': 'Configured (kept host-side, never echoed)',
|
|
89
|
+
'section.token.missing': 'Not configured',
|
|
90
|
+
'section.token.placeholder': 'Paste the Host Token; it is used host-side only',
|
|
91
|
+
'section.token.placeholderShort': 'Paste token',
|
|
92
|
+
'section.token.save': 'Save token',
|
|
93
|
+
'section.token.clear': 'Clear token',
|
|
94
|
+
'section.agents': 'Team Agent bindings',
|
|
95
|
+
'section.agents.empty': 'No dsh-agents member is bound, so this machine claims nothing',
|
|
96
|
+
'section.agents.hint': 'dsh-agents member ids, separated by commas',
|
|
97
|
+
'section.questionWait': 'Local fallback wait (minutes)',
|
|
98
|
+
'section.questionWait.hint': '0 = no local cap; wait for the hub to settle the question (answered, expired or withdrawn)',
|
|
99
|
+
'section.save': 'Save settings',
|
|
100
|
+
'section.saved': 'Saved',
|
|
101
|
+
'section.refresh': 'Claim now',
|
|
102
|
+
'section.connection': 'Connection',
|
|
103
|
+
'section.connection.idle': 'Stopped',
|
|
104
|
+
'section.connection.connecting': 'Registering',
|
|
105
|
+
'section.connection.online': 'Online',
|
|
106
|
+
'section.connection.reconnecting': 'Reconnecting',
|
|
107
|
+
'section.connection.error': 'Connection failed',
|
|
108
|
+
'section.host': 'Host',
|
|
109
|
+
'section.heartbeat': 'Last heartbeat',
|
|
110
|
+
'section.reconnects': 'Reconnects',
|
|
111
|
+
'section.capabilities': 'Capabilities',
|
|
112
|
+
'section.capability.followUp': 'Follow-up delivery',
|
|
113
|
+
'section.capability.rework': 'Rework in session',
|
|
114
|
+
'section.capability.run': 'Start executions',
|
|
115
|
+
'section.capability.available': 'Available',
|
|
116
|
+
'section.capability.missing': 'Unavailable',
|
|
117
|
+
'section.capability.followUpMissing': 'This board revision serves no followUp, so a mention is only recorded on the activity stream',
|
|
118
|
+
'section.capability.reworkMissing': 'This board revision serves no rework, so a rework request is recorded and never re-run',
|
|
119
|
+
'section.capability.runMissing': 'This board revision serves no execution entry, so a claimed card has to be started on the board',
|
|
120
|
+
'section.capability.presetPin': 'Pinning a preset and model on create',
|
|
121
|
+
'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',
|
|
122
|
+
'section.problems': 'Configuration problems',
|
|
123
|
+
'settings.collapse': 'Hide settings',
|
|
124
|
+
'settings.expand': 'Show settings',
|
|
125
|
+
'settings.notExposed': 'This version does not expose the settings namespace of this extension to the configuration page, so the form is unavailable.',
|
|
126
|
+
'settings.readOnly': 'This deployment serves settings read-only.',
|
|
127
|
+
'settings.saveFailed': 'The deployment did not accept this change.',
|
|
128
|
+
'detail.title': 'Team collaboration',
|
|
129
|
+
'detail.issue': 'Team issue',
|
|
130
|
+
'detail.assignee': 'Assignee',
|
|
131
|
+
'detail.reviewer': 'Reviewer',
|
|
132
|
+
'detail.agent': 'Executing agent',
|
|
133
|
+
'detail.status': 'Hub status',
|
|
134
|
+
'detail.comments': 'Comments',
|
|
135
|
+
'detail.activity': 'Activity',
|
|
136
|
+
'detail.pending': 'Open questions',
|
|
137
|
+
'detail.empty': 'Nothing yet',
|
|
138
|
+
'detail.error': 'Last error',
|
|
139
|
+
'status.todo': 'Todo',
|
|
140
|
+
'status.assigned': 'Assigned',
|
|
141
|
+
'status.waiting_host': 'Waiting for the execution node',
|
|
142
|
+
'status.running': 'Running',
|
|
143
|
+
'status.in_review': 'In review',
|
|
144
|
+
'status.done': 'Done',
|
|
145
|
+
'status.canceled': 'Canceled',
|
|
146
|
+
'status.failed': 'Failed',
|
|
147
|
+
'unavailable': 'The team configuration of this extension is not available',
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The translate seat the seats use when the client locale service is absent. */
|
|
151
|
+
let translate: (key: TeamKey) => string = key => zh[key]
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Install the runtime translate seat.
|
|
155
|
+
* @param bound - the locale-bound lookup of this namespace.
|
|
156
|
+
*/
|
|
157
|
+
export function setRuntimeTranslate(bound: (key: TeamKey) => string): void {
|
|
158
|
+
translate = bound
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Translate one key of this namespace.
|
|
163
|
+
* @param key - dictionary key.
|
|
164
|
+
* @returns the localized string.
|
|
165
|
+
*/
|
|
166
|
+
export function t(key: TeamKey): string {
|
|
167
|
+
return translate(key)
|
|
168
|
+
}
|
|
@@ -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
|
+
}
|