@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,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form model behind the plugin settings card. Every control applies itself:
|
|
3
|
+
* a pick (a segment, a select option, a reset) writes the moment it is made,
|
|
4
|
+
* and typed text writes once typing pauses or the reader leaves the field.
|
|
5
|
+
* Between the edit and the write the edit is held here as a draft, so what is
|
|
6
|
+
* on screen is exactly what the write will store; a write the Host refuses
|
|
7
|
+
* puts a pick back to the stored value and keeps typed text for correcting.
|
|
8
|
+
* Family-shared slice inlined into each plugin's client bundle.
|
|
9
|
+
*/
|
|
10
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
11
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
12
|
+
/** The write one field's draft text performs when it is applied. */
|
|
13
|
+
export type FieldWrite = {
|
|
14
|
+
kind: 'set';
|
|
15
|
+
value: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'clear';
|
|
18
|
+
};
|
|
19
|
+
/** How one field converts between its stored value and its draft text. */
|
|
20
|
+
export interface FieldSpec {
|
|
21
|
+
/** Field name inside the namespace section. */
|
|
22
|
+
field: string;
|
|
23
|
+
/**
|
|
24
|
+
* How the reader enters a value, which decides when it is written: a `pick`
|
|
25
|
+
* is a whole value at once and applies immediately; `type` is text arriving
|
|
26
|
+
* a keystroke at a time and applies once typing pauses or the field is left.
|
|
27
|
+
*/
|
|
28
|
+
entry: 'pick' | 'type';
|
|
29
|
+
/**
|
|
30
|
+
* Whether the Host treats this field as a secret and redacts its value from
|
|
31
|
+
* the read-back (role('secret') in the section schema). Redacted secrets are
|
|
32
|
+
* never compared against the draft on save: the Host strips them from every
|
|
33
|
+
* wire view layer, so the settled snapshot carries nothing to read back. A
|
|
34
|
+
* staged secret set is judged by the mutation settling; the rest of its
|
|
35
|
+
* batch, when one exists, is still judged by read-back, and the atomic
|
|
36
|
+
* mutation lands every write or none.
|
|
37
|
+
*/
|
|
38
|
+
secret?: boolean;
|
|
39
|
+
/** Render a stored value as draft text; the empty string when the section carries none. */
|
|
40
|
+
format: (value: unknown) => string;
|
|
41
|
+
/**
|
|
42
|
+
* The write this draft text performs, or undefined when the text is not a
|
|
43
|
+
* value this field accepts — which holds the draft unwritten rather than
|
|
44
|
+
* discarding it.
|
|
45
|
+
*/
|
|
46
|
+
parse: (text: string) => FieldWrite | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** One field as the card renders it. */
|
|
49
|
+
export interface FieldState {
|
|
50
|
+
/** Draft text the control renders. */
|
|
51
|
+
text: string;
|
|
52
|
+
/** Whether the field leaves (or will leave) a user-layer entry. */
|
|
53
|
+
overridden: boolean;
|
|
54
|
+
/** Whether the draft is not a value this field accepts, which holds it unwritten. */
|
|
55
|
+
invalid: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** Form state every plugin settings card shares. */
|
|
58
|
+
export interface CardShell {
|
|
59
|
+
/** False while the namespace is still loading; the card renders nothing. */
|
|
60
|
+
available: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the namespace is actually served to this client. False when the
|
|
63
|
+
* Host deployment does not expose it (e.g. the owning plugin's settings
|
|
64
|
+
* domain is not mounted): the card renders an explanation
|
|
65
|
+
* instead of its form, so a missing namespace never looks like a missing
|
|
66
|
+
* plugin.
|
|
67
|
+
*/
|
|
68
|
+
exposed: boolean;
|
|
69
|
+
/** Whether the Host document accepts writes. */
|
|
70
|
+
writable: boolean;
|
|
71
|
+
/** Whether the form holds drafts not yet written (typed text waiting for its pause). */
|
|
72
|
+
dirty: boolean;
|
|
73
|
+
/** Whether any draft is invalid, which holds it unwritten. */
|
|
74
|
+
invalid: boolean;
|
|
75
|
+
/** Whether a write is crossing the wire. */
|
|
76
|
+
saving: boolean;
|
|
77
|
+
/** Whether the last write did not land; cleared by the next edit or write. */
|
|
78
|
+
failed: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The rejection code/message the Host returned for the last failed save,
|
|
81
|
+
* surfaced next to the generic failure text. Undefined while no save has
|
|
82
|
+
* failed (or the failure carried no server reason).
|
|
83
|
+
*/
|
|
84
|
+
failedReason?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The write actions the card's slot entry injects. */
|
|
87
|
+
export interface CardActions {
|
|
88
|
+
/** Take draft text for one field; a pick writes at once, typed text after a pause. */
|
|
89
|
+
edit: (field: string, text: string) => void;
|
|
90
|
+
/** Clear one field at once, so it re-inherits the composition layer. */
|
|
91
|
+
resetField: (field: string) => void;
|
|
92
|
+
/** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
|
|
93
|
+
save: () => void;
|
|
94
|
+
/** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
|
|
95
|
+
discard: () => void;
|
|
96
|
+
}
|
|
97
|
+
/** How long typed text rests before it is written. */
|
|
98
|
+
export declare const TYPE_PAUSE_MS = 600;
|
|
99
|
+
/** One durable write inside the save's atomic form mutation. */
|
|
100
|
+
export interface BatchedWrite {
|
|
101
|
+
/** Field this entry writes. */
|
|
102
|
+
field: string;
|
|
103
|
+
/** set stores a value; unset drops the leaf. */
|
|
104
|
+
op: 'set' | 'unset';
|
|
105
|
+
/** Value for op set (absent for unset). */
|
|
106
|
+
value?: unknown;
|
|
107
|
+
}
|
|
108
|
+
/** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */
|
|
109
|
+
export interface NumberConstraints {
|
|
110
|
+
/** The accepted value must be a whole number. */
|
|
111
|
+
integer?: boolean;
|
|
112
|
+
/** The accepted value must be at least this. */
|
|
113
|
+
min?: number;
|
|
114
|
+
}
|
|
115
|
+
/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
|
|
116
|
+
export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
|
|
117
|
+
/**
|
|
118
|
+
* A free-text field. An empty draft clears the field. `entry` is `pick` when
|
|
119
|
+
* the text arrives whole from a picker (a preset or a reasoning level).
|
|
120
|
+
*/
|
|
121
|
+
export declare function textField(field: string, entry?: FieldSpec['entry']): FieldSpec;
|
|
122
|
+
/**
|
|
123
|
+
* A free-text field the Host treats as a secret and redacts from the read-back
|
|
124
|
+
* (role('secret') in the section schema). The card still edits it like text,
|
|
125
|
+
* but a save never compares the redacted value back: the staged set is judged
|
|
126
|
+
* by the mutation settling (see {@link FieldSpec.secret}).
|
|
127
|
+
*/
|
|
128
|
+
export declare function secretField(field: string): FieldSpec;
|
|
129
|
+
/** A boolean field, edited through true/false draft text. */
|
|
130
|
+
export declare function booleanField(field: string): FieldSpec;
|
|
131
|
+
/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
|
|
132
|
+
export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
|
|
133
|
+
/**
|
|
134
|
+
* Applies one card's edits to one settings namespace as the reader makes them.
|
|
135
|
+
*
|
|
136
|
+
* The Host is the only authority on whether a value was accepted — its
|
|
137
|
+
* validators own the constraints no schema can express — so the outcome is
|
|
138
|
+
* read back from the section rather than predicted here. A write that did not
|
|
139
|
+
* land puts each pick back to the stored value, the way a switch that could not
|
|
140
|
+
* flip springs back, and keeps typed text so the reader can correct it instead
|
|
141
|
+
* of retyping.
|
|
142
|
+
*/
|
|
143
|
+
export declare class CardForm<T> {
|
|
144
|
+
private readonly scope;
|
|
145
|
+
private readonly specs;
|
|
146
|
+
private readonly staged;
|
|
147
|
+
private readonly listeners;
|
|
148
|
+
/** The form subscription installed in the constructor; released by dispose(). */
|
|
149
|
+
private readonly disposeForm;
|
|
150
|
+
private disposed;
|
|
151
|
+
/** The pending write of typed text, waiting for typing to pause. */
|
|
152
|
+
private typePause;
|
|
153
|
+
private saving;
|
|
154
|
+
/** A save asked for while one was in flight; it runs once the first settles (#1754). */
|
|
155
|
+
private saveQueued;
|
|
156
|
+
private failed;
|
|
157
|
+
private failedReason;
|
|
158
|
+
/** @param scope - the bound configuration form for this card's namespace. */
|
|
159
|
+
constructor(scope: ConfigForm<T>, specs: FieldSpec[]);
|
|
160
|
+
/**
|
|
161
|
+
* Release the form subscription and every bound store listener. The card
|
|
162
|
+
* must call this on teardown; later calls are no-ops.
|
|
163
|
+
*/
|
|
164
|
+
dispose(): void;
|
|
165
|
+
/** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
|
|
166
|
+
bind<S>(project: () => S): SnapshotStore<S>;
|
|
167
|
+
/** Read the card-level state: what the Host serves, and what is still waiting to be written. */
|
|
168
|
+
shell(): CardShell;
|
|
169
|
+
/** Read one field's state from the effective section and its staged draft. */
|
|
170
|
+
field(field: string): FieldState;
|
|
171
|
+
/** The actions the card's slot registration injects. */
|
|
172
|
+
actions(): CardActions;
|
|
173
|
+
/**
|
|
174
|
+
* Run one write, and re-run it once if another was asked for while this one
|
|
175
|
+
* was still in flight.
|
|
176
|
+
*
|
|
177
|
+
* A write is a Host round trip that also drives the profile reconcile, and
|
|
178
|
+
* the Host runs it inside one exclusive transaction. Answering an edit that
|
|
179
|
+
* arrives mid-flight by returning immediately dropped it with no explanation
|
|
180
|
+
* (#1754). Serializing instead means an edit made while another write is
|
|
181
|
+
* still settling is written against the settled state.
|
|
182
|
+
* @returns settlement after the mutation and the read-back.
|
|
183
|
+
*/
|
|
184
|
+
requestSave(): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Write every valid draft in one atomic form mutation, then re-seed from
|
|
187
|
+
* what the Host accepted. A draft the field does not accept stays on screen,
|
|
188
|
+
* unwritten, without holding the others back.
|
|
189
|
+
*
|
|
190
|
+
* The batch rides one mutate, so cross-field validate hooks (baseURL+model)
|
|
191
|
+
* judge it as a unit: the Host either applies every write or refuses the
|
|
192
|
+
* batch. The form contract answers a refusal or a skipped write with `false`
|
|
193
|
+
* (it recovers with a fresh Host view instead of throwing), so the outcome is
|
|
194
|
+
* judged twice: the answer itself, and then the settled snapshot read back
|
|
195
|
+
* one planned write at a time. One missed write fails the whole batch. A
|
|
196
|
+
* transport that rejects instead (the dsh-web bridge controller on a dead
|
|
197
|
+
* connection) reports through the same failure path with its rejection
|
|
198
|
+
* message. A batch that did not land puts its picks and clears back to the
|
|
199
|
+
* stored value and keeps its typed text, so the reader can correct it.
|
|
200
|
+
* @returns settlement after the mutation and the read-back.
|
|
201
|
+
*/
|
|
202
|
+
save(): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Every staged edit a write would carry. An entry whose draft is not a value
|
|
205
|
+
* its field accepts carries no write: the form is still dirty, and the draft
|
|
206
|
+
* stays on screen rather than being dropped. A staged edit that matches the
|
|
207
|
+
* effective section is not a write at all.
|
|
208
|
+
* @returns the planned writes, in the order the fields were staged.
|
|
209
|
+
*/
|
|
210
|
+
private plan;
|
|
211
|
+
/**
|
|
212
|
+
* Read-back judgment for a planned set: the user layer must hold the
|
|
213
|
+
* intended value once the mutation has settled.
|
|
214
|
+
*/
|
|
215
|
+
private landedSet;
|
|
216
|
+
/**
|
|
217
|
+
* Read-back judgment for a planned unset: the field must be gone from the
|
|
218
|
+
* user layer once the mutation has settled.
|
|
219
|
+
*/
|
|
220
|
+
private landedUnset;
|
|
221
|
+
/**
|
|
222
|
+
* Take one edit and schedule its write: a pick or a clear is written now,
|
|
223
|
+
* typed text once typing has rested for TYPE_PAUSE_MS.
|
|
224
|
+
*/
|
|
225
|
+
private stage;
|
|
226
|
+
/** Write every pending draft now, taking the place of a waiting pause. */
|
|
227
|
+
private applyNow;
|
|
228
|
+
private specOf;
|
|
229
|
+
private snapshotOf;
|
|
230
|
+
private sectionValue;
|
|
231
|
+
private baseValue;
|
|
232
|
+
private userLayer;
|
|
233
|
+
private stored;
|
|
234
|
+
private publish;
|
|
235
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/** The live switch the installer follows; the settings form supplies it. */
|
|
17
|
+
export interface ExtensionEnabledSource {
|
|
18
|
+
/** Whether the extension is currently enabled (absent config means enabled). */
|
|
19
|
+
read(): boolean;
|
|
20
|
+
/** Observe switch changes; the returned disposer removes the listener. */
|
|
21
|
+
subscribe(listener: () => void): () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Install the team browser half.
|
|
25
|
+
* @param ctx - client context (slot registry).
|
|
26
|
+
* @param source - the extension's live enabled switch.
|
|
27
|
+
* @returns disposer releasing every contribution.
|
|
28
|
+
*/
|
|
29
|
+
export declare function installTeamClientHalf(ctx: ClientContext, source: ExtensionEnabledSource): () => void;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { ReactElement } from 'react';
|
|
13
|
+
import type { TaskBoardCardDecorationProps, TaskBoardDetailSectionProps } from '../../core/contract.ts';
|
|
14
|
+
import { type TeamIssueLink } from '../../core/identity.ts';
|
|
15
|
+
/**
|
|
16
|
+
* Translate one hub status.
|
|
17
|
+
* @param status - the collaboration status the hub reported.
|
|
18
|
+
* @returns the localized label, or the raw status for a value this build predates.
|
|
19
|
+
*/
|
|
20
|
+
export declare function statusLabel(status: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* The hub status badge of one mirrored card.
|
|
23
|
+
* @param props - the card the board renders.
|
|
24
|
+
* @returns the badge, or nothing for a card that mirrors no issue.
|
|
25
|
+
*/
|
|
26
|
+
export declare function TeamCardDecoration({ task }: TaskBoardCardDecorationProps): ReactElement | null;
|
|
27
|
+
/**
|
|
28
|
+
* The team section of one card's detail view.
|
|
29
|
+
* @param props - the card the board renders, plus the action dispatcher.
|
|
30
|
+
* @returns the section, or nothing for a card that mirrors no issue.
|
|
31
|
+
*/
|
|
32
|
+
export declare function TeamDetailSection({ task }: TaskBoardDetailSectionProps): ReactElement | null;
|
|
33
|
+
/**
|
|
34
|
+
* Render the issue identity of one linkage.
|
|
35
|
+
* @param link - the card's linkage back to the hub.
|
|
36
|
+
* @returns the label, e.g. "issue #12".
|
|
37
|
+
*/
|
|
38
|
+
export declare function issueLabel(link: TeamIssueLink): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 is one nested settings card of the board's topic list, exactly like
|
|
13
|
+
* the sibling provider sections: the family card chrome supplies the border, the
|
|
14
|
+
* header, the body insets and the hairline between rows, so this module owns only
|
|
15
|
+
* the rows themselves. Its rows use the shared field grid (label and hint on the
|
|
16
|
+
* left, the control at the trailing edge) instead of a hand-rolled flex row, so a
|
|
17
|
+
* label is never squeezed into a character-per-line column by the control beside
|
|
18
|
+
* it.
|
|
19
|
+
*
|
|
20
|
+
* The block stays reachable while the extension is switched off, because it is
|
|
21
|
+
* where the switch is turned back on; it only reports that fact instead of
|
|
22
|
+
* pretending the forms still apply.
|
|
23
|
+
*
|
|
24
|
+
* @module dsh-task-board-team/client/team/settings
|
|
25
|
+
*/
|
|
26
|
+
import { type ReactElement } from 'react';
|
|
27
|
+
import type { TaskBoardSettingsSectionProps } from '../../core/contract.ts';
|
|
28
|
+
import type { TeamExtensionSummary } from '../../host/service.ts';
|
|
29
|
+
/** What the published summary carries about the configuration itself. */
|
|
30
|
+
interface PublishedConfiguration {
|
|
31
|
+
hubUrl?: string;
|
|
32
|
+
teamId?: string;
|
|
33
|
+
hostname?: string;
|
|
34
|
+
tokenConfigured?: boolean;
|
|
35
|
+
questionWaitMinutes?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read the configuration half of one summary.
|
|
39
|
+
* @param summary - the published summary, or undefined.
|
|
40
|
+
* @returns the configuration fields the card renders.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readConfiguration(summary: TeamExtensionSummary | undefined): PublishedConfiguration;
|
|
43
|
+
/**
|
|
44
|
+
* The body of the settings card: the configuration form and what the Host
|
|
45
|
+
* reports about it. It is its own component so the card can own the disclosure
|
|
46
|
+
* and the write report while this half owns the drafts.
|
|
47
|
+
* @param props - the board's action dispatcher, plus the write report the card
|
|
48
|
+
* renders in its footer.
|
|
49
|
+
* @returns the card body.
|
|
50
|
+
*/
|
|
51
|
+
export declare function TeamSettingsBody({ dispatch, onSaved }: {
|
|
52
|
+
dispatch: TaskBoardSettingsSectionProps['dispatch'];
|
|
53
|
+
onSaved: (accepted: boolean) => void;
|
|
54
|
+
}): ReactElement;
|
|
55
|
+
/**
|
|
56
|
+
* The settings block: one topic of the board's own settings card.
|
|
57
|
+
*
|
|
58
|
+
* Closed on arrival like the sibling provider card — the settings page opens as
|
|
59
|
+
* a topic list, and this topic is one of them. The body is read only by a reader
|
|
60
|
+
* who opens it, and its rows are written through the board's action channel, so
|
|
61
|
+
* the card holds no staged draft: save and discard are the no-ops of an
|
|
62
|
+
* always-committed form, and the footer reports a refused write.
|
|
63
|
+
* @param props - the board's settings seat props.
|
|
64
|
+
* @returns the block.
|
|
65
|
+
*/
|
|
66
|
+
export declare function TeamSettingsSection({ dispatch }: TaskBoardSettingsSectionProps): ReactElement;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TeamExtensionSummary } from '../../host/service.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Take the summaries the board snapshot carries.
|
|
4
|
+
* @param extensions - the snapshot's published extension summaries.
|
|
5
|
+
*/
|
|
6
|
+
export declare function acceptPublishedSummaries(extensions: Readonly<Record<string, unknown>> | undefined): void;
|
|
7
|
+
/** Drop the published summary: a hidden provider must not look like live state. */
|
|
8
|
+
export declare function clearSummary(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Read the live summary.
|
|
11
|
+
* @returns the summary, or undefined before the Host published one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSummary(): TeamExtensionSummary | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Read one card's collaboration view.
|
|
16
|
+
* @param taskId - the board card id.
|
|
17
|
+
* @returns the view, or undefined when this card mirrors no issue.
|
|
18
|
+
*/
|
|
19
|
+
export declare function cardViewOf(taskId: string): TeamExtensionSummary['cards'][string] | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Subscribe one component to the live summary.
|
|
22
|
+
* @returns the current summary and a re-render on every change.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useTeamSummary(): TeamExtensionSummary | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Validate one published payload into the summary shape.
|
|
27
|
+
*
|
|
28
|
+
* A payload from another revision of this extension is read for the fields it
|
|
29
|
+
* does carry and never trusted for the ones it does not, so a version skew
|
|
30
|
+
* degrades one section instead of throwing inside the board's render.
|
|
31
|
+
* @param raw - the opaque payload the board forwarded.
|
|
32
|
+
* @returns the summary, or undefined when it carries no usable shape.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readSummary(raw: unknown): TeamExtensionSummary | undefined;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same-shape restatement of the task board's external-provider contract.
|
|
3
|
+
*
|
|
4
|
+
* The board owns this contract (`packages/dsh-task-board/src/core/extension.ts`)
|
|
5
|
+
* and this package may not import the board's internals, so every type and
|
|
6
|
+
* constant the extension consumes is restated here with an identical shape and
|
|
7
|
+
* resolved at runtime through the shared cordis service name. Nothing in this
|
|
8
|
+
* module is a value import of a board package: the declarations are erased and
|
|
9
|
+
* the service lookup is a plain property read.
|
|
10
|
+
*
|
|
11
|
+
* Two capabilities ride the contract as OPTIONAL members (the API version stays
|
|
12
|
+
* 1): `sessions.followUp` and `tasks.rework`. A provider probes for them and
|
|
13
|
+
* degrades visibly where a deployment serves neither, which is what
|
|
14
|
+
* {@link probeTaskBoardCapabilities} reports.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-task-board-team/core/contract
|
|
17
|
+
*/
|
|
18
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
19
|
+
import type { ExecutionOutcome, TaskRecord, TaskStatus } from './task-record.ts';
|
|
20
|
+
/** Cordis service name the board's host and browser halves each publish. */
|
|
21
|
+
export declare const TASK_BOARD_SERVICE_NAME = "taskBoard";
|
|
22
|
+
/** Contract version this extension was built against. */
|
|
23
|
+
export declare const TASK_BOARD_API_VERSION = 1;
|
|
24
|
+
/** Child seat a provider registers its task-detail section into. */
|
|
25
|
+
export declare const TASK_BOARD_DETAIL_SECTION = "task-board.detail.section";
|
|
26
|
+
/** Child seat a provider registers its settings section into. */
|
|
27
|
+
export declare const TASK_BOARD_SETTINGS_SECTION = "task-board.settings.section";
|
|
28
|
+
/** Child seat a provider registers its card decoration into. */
|
|
29
|
+
export declare const TASK_BOARD_CARD_DECORATION = "task-board.card.decoration";
|
|
30
|
+
/** Largest free text one provider call pushes into an execution, in characters. */
|
|
31
|
+
export declare const TASK_BOARD_MESSAGE_MAX_LENGTH = 4000;
|
|
32
|
+
/** One opaque provider payload the board stores without interpreting. */
|
|
33
|
+
export type TaskBoardExtensionPayload = Record<string, unknown>;
|
|
34
|
+
/** One action the browser half dispatches over the board's same-origin channel. */
|
|
35
|
+
export interface TaskBoardExtensionActionRequest {
|
|
36
|
+
/** Id of the extension the action belongs to. */
|
|
37
|
+
extensionId: string;
|
|
38
|
+
/** Provider-owned action name, routed back to this extension's handleAction. */
|
|
39
|
+
action: string;
|
|
40
|
+
/** Task the action targets, when it targets one. */
|
|
41
|
+
taskId?: string;
|
|
42
|
+
/** Opaque provider payload. */
|
|
43
|
+
payload?: TaskBoardExtensionPayload;
|
|
44
|
+
}
|
|
45
|
+
/** Deliver one extension action through the board's same-origin action channel. */
|
|
46
|
+
export type TaskBoardExtensionDispatch = (request: TaskBoardExtensionActionRequest) => Promise<boolean>;
|
|
47
|
+
/** Draft one provider creates a task from. */
|
|
48
|
+
export interface TaskBoardTaskDraft {
|
|
49
|
+
title: string;
|
|
50
|
+
description: string;
|
|
51
|
+
prompt: string;
|
|
52
|
+
/** Column the created card opens in; absent means the board default. */
|
|
53
|
+
status?: TaskStatus;
|
|
54
|
+
/** Parent card id, when the provider materializes a subtask. */
|
|
55
|
+
parentId?: string;
|
|
56
|
+
/** Workspace the execution must run in; absent leaves the board's own rules. */
|
|
57
|
+
workspaceId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Agent preset the created card's execution must be composed from.
|
|
60
|
+
*
|
|
61
|
+
* Optional in the contract like the two capability members, so a provider
|
|
62
|
+
* passes it and then CHECKS it survived: a board revision that serves no draft
|
|
63
|
+
* preset drops the field silently, and a card that fell back to the deployment
|
|
64
|
+
* default must not be started as if the member's own preset had been pinned.
|
|
65
|
+
*/
|
|
66
|
+
mode?: string;
|
|
67
|
+
/** Pinned model for the created card's execution. */
|
|
68
|
+
model?: string;
|
|
69
|
+
/** Reasoning effort for that model route. */
|
|
70
|
+
reasoningEffort?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Options of {@link TaskBoardTasksFace.create}. */
|
|
73
|
+
export interface TaskBoardCreateOptions {
|
|
74
|
+
/** Opaque payload stored under the creating extension's id. */
|
|
75
|
+
payload?: TaskBoardExtensionPayload;
|
|
76
|
+
/** Create the card off-board: it exists in the ledger but is never shown. */
|
|
77
|
+
hidden?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** One task linked to an extension, with that extension's own payload. */
|
|
80
|
+
export interface TaskBoardLinkedTask {
|
|
81
|
+
task: TaskRecord;
|
|
82
|
+
payload: TaskBoardExtensionPayload;
|
|
83
|
+
}
|
|
84
|
+
/** Task reads and writes the board grants an extension. */
|
|
85
|
+
export interface TaskBoardTasksFace {
|
|
86
|
+
/** Every task in the ledger, most recent mutation last. */
|
|
87
|
+
list(): readonly TaskRecord[];
|
|
88
|
+
/** One task by id, or undefined. */
|
|
89
|
+
get(taskId: string): TaskRecord | undefined;
|
|
90
|
+
/** Create a task through the board's own creation gate. Throws on refusal. */
|
|
91
|
+
create(draft: TaskBoardTaskDraft, options?: TaskBoardCreateOptions): TaskRecord;
|
|
92
|
+
/** Patch a task's content through the board's content gate. Throws when frozen. */
|
|
93
|
+
patchContent(taskId: string, patch: {
|
|
94
|
+
title?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
prompt?: string;
|
|
97
|
+
}): void;
|
|
98
|
+
/** Move a task through the board's status gates. Throws on refusal. */
|
|
99
|
+
setStatus(taskId: string, status: TaskStatus, initiator?: string): void;
|
|
100
|
+
/** Every task carrying this extension's payload. */
|
|
101
|
+
linked(): readonly TaskBoardLinkedTask[];
|
|
102
|
+
/**
|
|
103
|
+
* Re-run an executed card in its ORIGINAL session with rework instructions.
|
|
104
|
+
*
|
|
105
|
+
* Optional in the contract: a board built against the earlier shape serves
|
|
106
|
+
* none, so a provider probes before using it.
|
|
107
|
+
*/
|
|
108
|
+
rework?(taskId: string, instructions: string, initiator?: string): void;
|
|
109
|
+
}
|
|
110
|
+
/** Execution-session face: delivery into a run the board already has. */
|
|
111
|
+
export interface TaskBoardSessionsFace {
|
|
112
|
+
/** Queue one follow-up user message into the card's current or latest session. */
|
|
113
|
+
followUp(taskId: string, text: string): Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
/** Storage face for one extension's own payload on a task. */
|
|
116
|
+
export interface TaskBoardIntegrationFace {
|
|
117
|
+
/** Read this extension's payload, or undefined when the task carries none. */
|
|
118
|
+
read(taskId: string): TaskBoardExtensionPayload | undefined;
|
|
119
|
+
/** Shallow-merge this extension's payload into the task. */
|
|
120
|
+
write(taskId: string, payload: TaskBoardExtensionPayload): void;
|
|
121
|
+
}
|
|
122
|
+
/** Status-change notification. */
|
|
123
|
+
export interface TaskBoardStatusChangedEvent {
|
|
124
|
+
taskId: string;
|
|
125
|
+
status: TaskStatus;
|
|
126
|
+
previous: TaskStatus;
|
|
127
|
+
initiator?: string;
|
|
128
|
+
}
|
|
129
|
+
/** Execution-settlement notification. */
|
|
130
|
+
export interface TaskBoardExecutionSettledEvent {
|
|
131
|
+
taskId: string;
|
|
132
|
+
executionId: string;
|
|
133
|
+
outcome: ExecutionOutcome;
|
|
134
|
+
error?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Task-deletion notification. */
|
|
137
|
+
export interface TaskBoardTaskDeletedEvent {
|
|
138
|
+
taskId: string;
|
|
139
|
+
}
|
|
140
|
+
/** Event subscriptions an extension registers for; every callback runs isolated. */
|
|
141
|
+
export interface TaskBoardEventFace {
|
|
142
|
+
onStatusChanged(callback: (event: TaskBoardStatusChangedEvent) => void): () => void;
|
|
143
|
+
onExecutionSettled(callback: (event: TaskBoardExecutionSettledEvent) => void): () => void;
|
|
144
|
+
onTaskDeleted(callback: (event: TaskBoardTaskDeletedEvent) => void): () => void;
|
|
145
|
+
}
|
|
146
|
+
/** Host capability face handed to one extension while it is started. */
|
|
147
|
+
export interface TaskBoardExtensionHost {
|
|
148
|
+
tasks: TaskBoardTasksFace;
|
|
149
|
+
/** Delivery into a card's execution session; optional member of the contract. */
|
|
150
|
+
sessions?: TaskBoardSessionsFace;
|
|
151
|
+
integration: TaskBoardIntegrationFace;
|
|
152
|
+
events: TaskBoardEventFace;
|
|
153
|
+
/** Publish this extension's read-only summary into the board snapshot. */
|
|
154
|
+
publish(summary: TaskBoardExtensionPayload): void;
|
|
155
|
+
/** Register one model-visible tool; the returned disposer unregisters it. */
|
|
156
|
+
registerTool(definition: ToolDefinition): () => void;
|
|
157
|
+
}
|
|
158
|
+
/** One external provider contributed to the task board. */
|
|
159
|
+
export interface TaskBoardExtension {
|
|
160
|
+
/** Stable extension id; also the key of this extension's integration payload. */
|
|
161
|
+
readonly id: string;
|
|
162
|
+
/** Contract version this extension was built against. */
|
|
163
|
+
readonly apiVersion: number;
|
|
164
|
+
/** Volatile per-extension switch; absent means enabled. Read at use time. */
|
|
165
|
+
enabled?(): boolean;
|
|
166
|
+
/** Acquire the capability face and start any provider-side work. */
|
|
167
|
+
start?(host: TaskBoardExtensionHost): void;
|
|
168
|
+
/** Release provider-side work. Never clears stored data. */
|
|
169
|
+
stop?(): void;
|
|
170
|
+
/** Route one dispatched action; the returned value goes back to the dispatcher. */
|
|
171
|
+
handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>;
|
|
172
|
+
}
|
|
173
|
+
/** Which optional capabilities the board serving this deployment really has. */
|
|
174
|
+
export interface TaskBoardCapabilities {
|
|
175
|
+
/** The board can deliver a follow-up message into an execution session. */
|
|
176
|
+
followUp: boolean;
|
|
177
|
+
/** The board can re-run an executed card in its own session. */
|
|
178
|
+
rework: boolean;
|
|
179
|
+
/** The host process exposes the board's own action surface (see {@link TaskBoardActionSeat}). */
|
|
180
|
+
run: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The board's in-process action seat.
|
|
184
|
+
*
|
|
185
|
+
* The provider contract covers everything this extension does EXCEPT starting an
|
|
186
|
+
* execution: the capability face has create, patch, move, follow-up and rework,
|
|
187
|
+
* and no member that runs a card. The board's host face does carry the action
|
|
188
|
+
* applier the browser and the remote bridge drive it through, so the row probes
|
|
189
|
+
* for it and records the capability as absent when a deployment serves none —
|
|
190
|
+
* the mirror card is still created and the settings card says this Host cannot
|
|
191
|
+
* start it.
|
|
192
|
+
*/
|
|
193
|
+
export interface TaskBoardActionSeat {
|
|
194
|
+
/** Apply one board action through every gate the board already has. */
|
|
195
|
+
apply(requestId: string, action: Record<string, unknown>, initiator?: string): unknown;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Probe the optional capabilities of the capability face one board handed over.
|
|
199
|
+
* @param host - the capability face a provider was started with.
|
|
200
|
+
* @param run - whether the row found the board's action seat.
|
|
201
|
+
* @returns which optional capabilities this deployment really serves.
|
|
202
|
+
*/
|
|
203
|
+
export declare function probeTaskBoardCapabilities(host: TaskBoardExtensionHost, run: boolean): TaskBoardCapabilities;
|
|
204
|
+
/** Host-half service face published under {@link TASK_BOARD_SERVICE_NAME}. */
|
|
205
|
+
export interface TaskBoardHostFace {
|
|
206
|
+
/** Admit one provider extension; the returned disposer releases it. */
|
|
207
|
+
registerExtension(extension: TaskBoardExtension): () => void;
|
|
208
|
+
/** Whether the board currently runs a given extension. */
|
|
209
|
+
isExtensionEnabled(extensionId: string): boolean;
|
|
210
|
+
/** The board's in-process action seat, when this board revision serves one. */
|
|
211
|
+
apply?(requestId: string, action: Record<string, unknown>, initiator?: string): unknown;
|
|
212
|
+
}
|
|
213
|
+
/** The narrow context seat the resolvers need. */
|
|
214
|
+
export interface ContextSeat {
|
|
215
|
+
get(name: string): unknown;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Resolve the board's host-half face by service name.
|
|
219
|
+
* @param ctx - host context.
|
|
220
|
+
* @returns the host face, or undefined when the board is not loaded.
|
|
221
|
+
*/
|
|
222
|
+
export declare function resolveTaskBoardHostFace(ctx: ContextSeat): TaskBoardHostFace | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve the board's in-process action seat from the same service.
|
|
225
|
+
* @param ctx - host context.
|
|
226
|
+
* @returns the seat, or undefined when this board revision serves no applier.
|
|
227
|
+
*/
|
|
228
|
+
export declare function resolveTaskBoardActionSeat(ctx: ContextSeat): TaskBoardActionSeat | undefined;
|
|
229
|
+
/** Owner props of the task-detail seat. */
|
|
230
|
+
export interface TaskBoardDetailSectionProps {
|
|
231
|
+
task: TaskRecord;
|
|
232
|
+
dispatch: TaskBoardExtensionDispatch;
|
|
233
|
+
}
|
|
234
|
+
/** Owner props of the settings seat. */
|
|
235
|
+
export interface TaskBoardSettingsSectionProps {
|
|
236
|
+
dispatch: TaskBoardExtensionDispatch;
|
|
237
|
+
}
|
|
238
|
+
/** Owner props of the card-decoration seat. */
|
|
239
|
+
export interface TaskBoardCardDecorationProps {
|
|
240
|
+
task: TaskRecord;
|
|
241
|
+
}
|
|
242
|
+
/** Board mirror an extension's browser half observes. */
|
|
243
|
+
export interface TaskBoardClientMirror {
|
|
244
|
+
/** Whether the board's master switch currently runs the extension faces. */
|
|
245
|
+
enabled: boolean;
|
|
246
|
+
/** Tasks the board currently holds. */
|
|
247
|
+
tasks: readonly TaskRecord[];
|
|
248
|
+
/** Published extension summaries, keyed by extension id. */
|
|
249
|
+
extensions: Readonly<Record<string, unknown>>;
|
|
250
|
+
}
|
|
251
|
+
/** Whether a task should be shown on the board; false hides it. */
|
|
252
|
+
export type TaskBoardVisibilityPredicate = (task: TaskRecord) => boolean;
|
|
253
|
+
/** Client capability face the board's browser half provides. */
|
|
254
|
+
export interface TaskBoardClientFace {
|
|
255
|
+
/** Deliver one action through the board's same-origin action channel. */
|
|
256
|
+
dispatch(request: TaskBoardExtensionActionRequest): Promise<boolean>;
|
|
257
|
+
/** Register one card visibility predicate; the returned disposer removes it. */
|
|
258
|
+
registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void;
|
|
259
|
+
/** Subscribe to the board mirror. */
|
|
260
|
+
subscribe(callback: (mirror: TaskBoardClientMirror) => void): () => void;
|
|
261
|
+
/** Read the current board mirror. */
|
|
262
|
+
snapshot(): TaskBoardClientMirror;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Resolve the board's browser-half client face by service name.
|
|
266
|
+
* @param ctx - browser context.
|
|
267
|
+
* @returns the client face, or undefined when the board is not loaded.
|
|
268
|
+
*/
|
|
269
|
+
export declare function resolveTaskBoardClientFace(ctx: ContextSeat): TaskBoardClientFace | undefined;
|