@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,193 @@
|
|
|
1
|
+
/* Team provider seats: tokens only.
|
|
2
|
+
*
|
|
3
|
+
* The settings block's chrome, rows and inputs belong to the shared family card
|
|
4
|
+
* slice (`settings-card.module.css`, generated); this file owns the detail
|
|
5
|
+
* block's own lines, the settings row controls the shared slice has no class for
|
|
6
|
+
* (the status word, the group headings and the action row) and the badge.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.section {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 10px;
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title {
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
color: var(--dsw-alias-label-primary);
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* One label/value line: the label column sizes to its own text, so a long value
|
|
24
|
+
wraps inside the remaining width instead of squeezing the label into a
|
|
25
|
+
character-per-line column. */
|
|
26
|
+
.row {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: max-content minmax(0, 1fr);
|
|
29
|
+
align-items: baseline;
|
|
30
|
+
gap: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.label {
|
|
34
|
+
color: var(--dsw-alias-label-secondary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.value {
|
|
38
|
+
min-width: 0;
|
|
39
|
+
color: var(--dsw-alias-label-primary);
|
|
40
|
+
text-align: right;
|
|
41
|
+
overflow-wrap: anywhere;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* A status word that keeps its own line beside a label, never wrapping into it. */
|
|
45
|
+
.status {
|
|
46
|
+
flex: none;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
color: var(--dsw-alias-label-secondary);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.badge {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 4px;
|
|
56
|
+
border: 1px solid var(--dsw-alias-border-secondary);
|
|
57
|
+
border-radius: 999px;
|
|
58
|
+
padding: 0 6px;
|
|
59
|
+
font-size: 11px;
|
|
60
|
+
line-height: 18px;
|
|
61
|
+
color: var(--dsw-alias-label-secondary);
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.badge[data-hub-status='in_review'] {
|
|
66
|
+
border-color: var(--dsw-alias-border-primary);
|
|
67
|
+
color: var(--dsw-alias-label-primary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.badge[data-hub-status='running'] {
|
|
71
|
+
border-color: var(--dsw-alias-border-primary);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.badge[data-hub-status='failed'] {
|
|
75
|
+
border-style: dashed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.list {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 6px;
|
|
82
|
+
margin: 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
list-style: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.entry {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: 2px;
|
|
91
|
+
padding: 4px 0;
|
|
92
|
+
border-top: 1px solid var(--dsw-alias-border-secondary);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.meta {
|
|
96
|
+
color: var(--dsw-alias-label-secondary);
|
|
97
|
+
font-size: 11px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.body {
|
|
101
|
+
color: var(--dsw-alias-label-primary);
|
|
102
|
+
white-space: pre-wrap;
|
|
103
|
+
overflow-wrap: anywhere;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.error {
|
|
107
|
+
color: var(--dsw-alias-label-secondary);
|
|
108
|
+
border-left: 2px solid var(--dsw-alias-border-primary);
|
|
109
|
+
padding-left: 6px;
|
|
110
|
+
margin: 12px 0 0;
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
overflow-wrap: anywhere;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* A heading inside the card body that groups the rows under it. */
|
|
116
|
+
.groupTitle {
|
|
117
|
+
margin: 18px 0 0;
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
color: var(--dsw-alias-label-secondary);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* The card's own action row, under the form it commits. */
|
|
124
|
+
.actions {
|
|
125
|
+
display: flex;
|
|
126
|
+
gap: 8px;
|
|
127
|
+
flex-wrap: wrap;
|
|
128
|
+
padding: 16px 0 4px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* The row's committing action: the primary-action token trio, so it stays
|
|
132
|
+
legible in every theme and under skins. Never brand-primary as a fill. */
|
|
133
|
+
.primaryButton {
|
|
134
|
+
padding: 4px 14px;
|
|
135
|
+
border: 1px solid transparent;
|
|
136
|
+
border-radius: 8px;
|
|
137
|
+
background: var(--dsw-alias-button-primary-fill, var(--dsw-alias-label-primary));
|
|
138
|
+
color: var(--dsw-alias-label-primary-foreground, var(--dsw-alias-bg-layer-3));
|
|
139
|
+
font: inherit;
|
|
140
|
+
font-size: 13px;
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
line-height: 18px;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.primaryButton:hover:not(:disabled) {
|
|
147
|
+
background: var(--dsw-alias-button-primary-hover, var(--dsw-alias-button-primary-fill, var(--dsw-alias-label-primary)));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.primaryButton:focus-visible {
|
|
151
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
152
|
+
outline-offset: 2px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* A secondary action of the same row: the card surface with a hairline. */
|
|
156
|
+
.button {
|
|
157
|
+
padding: 4px 12px;
|
|
158
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
159
|
+
border-radius: 8px;
|
|
160
|
+
background: transparent;
|
|
161
|
+
color: var(--dsw-alias-label-primary);
|
|
162
|
+
font: inherit;
|
|
163
|
+
font-size: 13px;
|
|
164
|
+
line-height: 18px;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.button:hover:not(:disabled) {
|
|
169
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.button:focus-visible {
|
|
173
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
174
|
+
outline-offset: 2px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.primaryButton:disabled,
|
|
178
|
+
.button:disabled {
|
|
179
|
+
opacity: 0.45;
|
|
180
|
+
cursor: default;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.saved {
|
|
184
|
+
margin: 8px 0 0;
|
|
185
|
+
font-size: 12px;
|
|
186
|
+
color: var(--dsw-alias-label-secondary);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.empty {
|
|
190
|
+
color: var(--dsw-alias-label-secondary);
|
|
191
|
+
padding-top: 12px;
|
|
192
|
+
margin: 0;
|
|
193
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
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
|
+
|
|
21
|
+
/** Cordis service name the board's host and browser halves each publish. */
|
|
22
|
+
export const TASK_BOARD_SERVICE_NAME = 'taskBoard'
|
|
23
|
+
|
|
24
|
+
/** Contract version this extension was built against. */
|
|
25
|
+
export const TASK_BOARD_API_VERSION = 1
|
|
26
|
+
|
|
27
|
+
/** Child seat a provider registers its task-detail section into. */
|
|
28
|
+
export const TASK_BOARD_DETAIL_SECTION = 'task-board.detail.section'
|
|
29
|
+
/** Child seat a provider registers its settings section into. */
|
|
30
|
+
export const TASK_BOARD_SETTINGS_SECTION = 'task-board.settings.section'
|
|
31
|
+
/** Child seat a provider registers its card decoration into. */
|
|
32
|
+
export const TASK_BOARD_CARD_DECORATION = 'task-board.card.decoration'
|
|
33
|
+
|
|
34
|
+
/** Largest free text one provider call pushes into an execution, in characters. */
|
|
35
|
+
export const TASK_BOARD_MESSAGE_MAX_LENGTH = 4_000
|
|
36
|
+
|
|
37
|
+
/** One opaque provider payload the board stores without interpreting. */
|
|
38
|
+
export type TaskBoardExtensionPayload = Record<string, unknown>
|
|
39
|
+
|
|
40
|
+
/** One action the browser half dispatches over the board's same-origin channel. */
|
|
41
|
+
export interface TaskBoardExtensionActionRequest {
|
|
42
|
+
/** Id of the extension the action belongs to. */
|
|
43
|
+
extensionId: string
|
|
44
|
+
/** Provider-owned action name, routed back to this extension's handleAction. */
|
|
45
|
+
action: string
|
|
46
|
+
/** Task the action targets, when it targets one. */
|
|
47
|
+
taskId?: string
|
|
48
|
+
/** Opaque provider payload. */
|
|
49
|
+
payload?: TaskBoardExtensionPayload
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Deliver one extension action through the board's same-origin action channel. */
|
|
53
|
+
export type TaskBoardExtensionDispatch = (request: TaskBoardExtensionActionRequest) => Promise<boolean>
|
|
54
|
+
|
|
55
|
+
/** Draft one provider creates a task from. */
|
|
56
|
+
export interface TaskBoardTaskDraft {
|
|
57
|
+
title: string
|
|
58
|
+
description: string
|
|
59
|
+
prompt: string
|
|
60
|
+
/** Column the created card opens in; absent means the board default. */
|
|
61
|
+
status?: TaskStatus
|
|
62
|
+
/** Parent card id, when the provider materializes a subtask. */
|
|
63
|
+
parentId?: string
|
|
64
|
+
/** Workspace the execution must run in; absent leaves the board's own rules. */
|
|
65
|
+
workspaceId?: string
|
|
66
|
+
/**
|
|
67
|
+
* Agent preset the created card's execution must be composed from.
|
|
68
|
+
*
|
|
69
|
+
* Optional in the contract like the two capability members, so a provider
|
|
70
|
+
* passes it and then CHECKS it survived: a board revision that serves no draft
|
|
71
|
+
* preset drops the field silently, and a card that fell back to the deployment
|
|
72
|
+
* default must not be started as if the member's own preset had been pinned.
|
|
73
|
+
*/
|
|
74
|
+
mode?: string
|
|
75
|
+
/** Pinned model for the created card's execution. */
|
|
76
|
+
model?: string
|
|
77
|
+
/** Reasoning effort for that model route. */
|
|
78
|
+
reasoningEffort?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Options of {@link TaskBoardTasksFace.create}. */
|
|
82
|
+
export interface TaskBoardCreateOptions {
|
|
83
|
+
/** Opaque payload stored under the creating extension's id. */
|
|
84
|
+
payload?: TaskBoardExtensionPayload
|
|
85
|
+
/** Create the card off-board: it exists in the ledger but is never shown. */
|
|
86
|
+
hidden?: boolean
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** One task linked to an extension, with that extension's own payload. */
|
|
90
|
+
export interface TaskBoardLinkedTask {
|
|
91
|
+
task: TaskRecord
|
|
92
|
+
payload: TaskBoardExtensionPayload
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Task reads and writes the board grants an extension. */
|
|
96
|
+
export interface TaskBoardTasksFace {
|
|
97
|
+
/** Every task in the ledger, most recent mutation last. */
|
|
98
|
+
list(): readonly TaskRecord[]
|
|
99
|
+
/** One task by id, or undefined. */
|
|
100
|
+
get(taskId: string): TaskRecord | undefined
|
|
101
|
+
/** Create a task through the board's own creation gate. Throws on refusal. */
|
|
102
|
+
create(draft: TaskBoardTaskDraft, options?: TaskBoardCreateOptions): TaskRecord
|
|
103
|
+
/** Patch a task's content through the board's content gate. Throws when frozen. */
|
|
104
|
+
patchContent(taskId: string, patch: { title?: string; description?: string; prompt?: string }): void
|
|
105
|
+
/** Move a task through the board's status gates. Throws on refusal. */
|
|
106
|
+
setStatus(taskId: string, status: TaskStatus, initiator?: string): void
|
|
107
|
+
/** Every task carrying this extension's payload. */
|
|
108
|
+
linked(): readonly TaskBoardLinkedTask[]
|
|
109
|
+
/**
|
|
110
|
+
* Re-run an executed card in its ORIGINAL session with rework instructions.
|
|
111
|
+
*
|
|
112
|
+
* Optional in the contract: a board built against the earlier shape serves
|
|
113
|
+
* none, so a provider probes before using it.
|
|
114
|
+
*/
|
|
115
|
+
rework?(taskId: string, instructions: string, initiator?: string): void
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Execution-session face: delivery into a run the board already has. */
|
|
119
|
+
export interface TaskBoardSessionsFace {
|
|
120
|
+
/** Queue one follow-up user message into the card's current or latest session. */
|
|
121
|
+
followUp(taskId: string, text: string): Promise<void>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Storage face for one extension's own payload on a task. */
|
|
125
|
+
export interface TaskBoardIntegrationFace {
|
|
126
|
+
/** Read this extension's payload, or undefined when the task carries none. */
|
|
127
|
+
read(taskId: string): TaskBoardExtensionPayload | undefined
|
|
128
|
+
/** Shallow-merge this extension's payload into the task. */
|
|
129
|
+
write(taskId: string, payload: TaskBoardExtensionPayload): void
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Status-change notification. */
|
|
133
|
+
export interface TaskBoardStatusChangedEvent {
|
|
134
|
+
taskId: string
|
|
135
|
+
status: TaskStatus
|
|
136
|
+
previous: TaskStatus
|
|
137
|
+
initiator?: string
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Execution-settlement notification. */
|
|
141
|
+
export interface TaskBoardExecutionSettledEvent {
|
|
142
|
+
taskId: string
|
|
143
|
+
executionId: string
|
|
144
|
+
outcome: ExecutionOutcome
|
|
145
|
+
error?: string
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Task-deletion notification. */
|
|
149
|
+
export interface TaskBoardTaskDeletedEvent {
|
|
150
|
+
taskId: string
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Event subscriptions an extension registers for; every callback runs isolated. */
|
|
154
|
+
export interface TaskBoardEventFace {
|
|
155
|
+
onStatusChanged(callback: (event: TaskBoardStatusChangedEvent) => void): () => void
|
|
156
|
+
onExecutionSettled(callback: (event: TaskBoardExecutionSettledEvent) => void): () => void
|
|
157
|
+
onTaskDeleted(callback: (event: TaskBoardTaskDeletedEvent) => void): () => void
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Host capability face handed to one extension while it is started. */
|
|
161
|
+
export interface TaskBoardExtensionHost {
|
|
162
|
+
tasks: TaskBoardTasksFace
|
|
163
|
+
/** Delivery into a card's execution session; optional member of the contract. */
|
|
164
|
+
sessions?: TaskBoardSessionsFace
|
|
165
|
+
integration: TaskBoardIntegrationFace
|
|
166
|
+
events: TaskBoardEventFace
|
|
167
|
+
/** Publish this extension's read-only summary into the board snapshot. */
|
|
168
|
+
publish(summary: TaskBoardExtensionPayload): void
|
|
169
|
+
/** Register one model-visible tool; the returned disposer unregisters it. */
|
|
170
|
+
registerTool(definition: ToolDefinition): () => void
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** One external provider contributed to the task board. */
|
|
174
|
+
export interface TaskBoardExtension {
|
|
175
|
+
/** Stable extension id; also the key of this extension's integration payload. */
|
|
176
|
+
readonly id: string
|
|
177
|
+
/** Contract version this extension was built against. */
|
|
178
|
+
readonly apiVersion: number
|
|
179
|
+
/** Volatile per-extension switch; absent means enabled. Read at use time. */
|
|
180
|
+
enabled?(): boolean
|
|
181
|
+
/** Acquire the capability face and start any provider-side work. */
|
|
182
|
+
start?(host: TaskBoardExtensionHost): void
|
|
183
|
+
/** Release provider-side work. Never clears stored data. */
|
|
184
|
+
stop?(): void
|
|
185
|
+
/** Route one dispatched action; the returned value goes back to the dispatcher. */
|
|
186
|
+
handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Which optional capabilities the board serving this deployment really has. */
|
|
190
|
+
export interface TaskBoardCapabilities {
|
|
191
|
+
/** The board can deliver a follow-up message into an execution session. */
|
|
192
|
+
followUp: boolean
|
|
193
|
+
/** The board can re-run an executed card in its own session. */
|
|
194
|
+
rework: boolean
|
|
195
|
+
/** The host process exposes the board's own action surface (see {@link TaskBoardActionSeat}). */
|
|
196
|
+
run: boolean
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The board's in-process action seat.
|
|
201
|
+
*
|
|
202
|
+
* The provider contract covers everything this extension does EXCEPT starting an
|
|
203
|
+
* execution: the capability face has create, patch, move, follow-up and rework,
|
|
204
|
+
* and no member that runs a card. The board's host face does carry the action
|
|
205
|
+
* applier the browser and the remote bridge drive it through, so the row probes
|
|
206
|
+
* for it and records the capability as absent when a deployment serves none —
|
|
207
|
+
* the mirror card is still created and the settings card says this Host cannot
|
|
208
|
+
* start it.
|
|
209
|
+
*/
|
|
210
|
+
export interface TaskBoardActionSeat {
|
|
211
|
+
/** Apply one board action through every gate the board already has. */
|
|
212
|
+
apply(requestId: string, action: Record<string, unknown>, initiator?: string): unknown
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Probe the optional capabilities of the capability face one board handed over.
|
|
217
|
+
* @param host - the capability face a provider was started with.
|
|
218
|
+
* @param run - whether the row found the board's action seat.
|
|
219
|
+
* @returns which optional capabilities this deployment really serves.
|
|
220
|
+
*/
|
|
221
|
+
export function probeTaskBoardCapabilities(host: TaskBoardExtensionHost, run: boolean): TaskBoardCapabilities {
|
|
222
|
+
return {
|
|
223
|
+
followUp: typeof host.sessions?.followUp === 'function',
|
|
224
|
+
rework: typeof host.tasks.rework === 'function',
|
|
225
|
+
run,
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Host-half service face published under {@link TASK_BOARD_SERVICE_NAME}. */
|
|
230
|
+
export interface TaskBoardHostFace {
|
|
231
|
+
/** Admit one provider extension; the returned disposer releases it. */
|
|
232
|
+
registerExtension(extension: TaskBoardExtension): () => void
|
|
233
|
+
/** Whether the board currently runs a given extension. */
|
|
234
|
+
isExtensionEnabled(extensionId: string): boolean
|
|
235
|
+
/** The board's in-process action seat, when this board revision serves one. */
|
|
236
|
+
apply?(requestId: string, action: Record<string, unknown>, initiator?: string): unknown
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** The narrow context seat the resolvers need. */
|
|
240
|
+
export interface ContextSeat {
|
|
241
|
+
get(name: string): unknown
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Resolve the board's host-half face by service name.
|
|
246
|
+
* @param ctx - host context.
|
|
247
|
+
* @returns the host face, or undefined when the board is not loaded.
|
|
248
|
+
*/
|
|
249
|
+
export function resolveTaskBoardHostFace(ctx: ContextSeat): TaskBoardHostFace | undefined {
|
|
250
|
+
try {
|
|
251
|
+
const face = ctx.get(TASK_BOARD_SERVICE_NAME) as TaskBoardHostFace | undefined
|
|
252
|
+
return face !== undefined && typeof (face as { registerExtension?: unknown }).registerExtension === 'function'
|
|
253
|
+
? face
|
|
254
|
+
: undefined
|
|
255
|
+
} catch {
|
|
256
|
+
return undefined
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Resolve the board's in-process action seat from the same service.
|
|
262
|
+
* @param ctx - host context.
|
|
263
|
+
* @returns the seat, or undefined when this board revision serves no applier.
|
|
264
|
+
*/
|
|
265
|
+
export function resolveTaskBoardActionSeat(ctx: ContextSeat): TaskBoardActionSeat | undefined {
|
|
266
|
+
try {
|
|
267
|
+
const face = ctx.get(TASK_BOARD_SERVICE_NAME) as TaskBoardActionSeat | undefined
|
|
268
|
+
return face !== undefined && typeof (face as { apply?: unknown }).apply === 'function' ? face : undefined
|
|
269
|
+
} catch {
|
|
270
|
+
return undefined
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Owner props of the task-detail seat. */
|
|
274
|
+
export interface TaskBoardDetailSectionProps {
|
|
275
|
+
task: TaskRecord
|
|
276
|
+
dispatch: TaskBoardExtensionDispatch
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Owner props of the settings seat. */
|
|
280
|
+
export interface TaskBoardSettingsSectionProps {
|
|
281
|
+
dispatch: TaskBoardExtensionDispatch
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Owner props of the card-decoration seat. */
|
|
285
|
+
export interface TaskBoardCardDecorationProps {
|
|
286
|
+
task: TaskRecord
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Board mirror an extension's browser half observes. */
|
|
290
|
+
export interface TaskBoardClientMirror {
|
|
291
|
+
/** Whether the board's master switch currently runs the extension faces. */
|
|
292
|
+
enabled: boolean
|
|
293
|
+
/** Tasks the board currently holds. */
|
|
294
|
+
tasks: readonly TaskRecord[]
|
|
295
|
+
/** Published extension summaries, keyed by extension id. */
|
|
296
|
+
extensions: Readonly<Record<string, unknown>>
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** Whether a task should be shown on the board; false hides it. */
|
|
300
|
+
export type TaskBoardVisibilityPredicate = (task: TaskRecord) => boolean
|
|
301
|
+
|
|
302
|
+
/** Client capability face the board's browser half provides. */
|
|
303
|
+
export interface TaskBoardClientFace {
|
|
304
|
+
/** Deliver one action through the board's same-origin action channel. */
|
|
305
|
+
dispatch(request: TaskBoardExtensionActionRequest): Promise<boolean>
|
|
306
|
+
/** Register one card visibility predicate; the returned disposer removes it. */
|
|
307
|
+
registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void
|
|
308
|
+
/** Subscribe to the board mirror. */
|
|
309
|
+
subscribe(callback: (mirror: TaskBoardClientMirror) => void): () => void
|
|
310
|
+
/** Read the current board mirror. */
|
|
311
|
+
snapshot(): TaskBoardClientMirror
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Resolve the board's browser-half client face by service name.
|
|
316
|
+
* @param ctx - browser context.
|
|
317
|
+
* @returns the client face, or undefined when the board is not loaded.
|
|
318
|
+
*/
|
|
319
|
+
export function resolveTaskBoardClientFace(ctx: ContextSeat): TaskBoardClientFace | undefined {
|
|
320
|
+
try {
|
|
321
|
+
const face = ctx.get(TASK_BOARD_SERVICE_NAME) as TaskBoardClientFace | undefined
|
|
322
|
+
return face !== undefined && typeof (face as { dispatch?: unknown }).dispatch === 'function' ? face : undefined
|
|
323
|
+
} catch {
|
|
324
|
+
return undefined
|
|
325
|
+
}
|
|
326
|
+
}
|