@linxin666/dsh-client-ui-task-board 0.4.3 → 0.4.5
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/README.i18n.yaml +2 -2
- package/README.md +56 -18
- package/README.zh.md +56 -18
- package/lib/client.js +6242 -958
- package/lib/client.js.map +1 -1
- package/lib/index.js +3475 -234
- package/lib/types/client/PluginSettingsCard.d.ts +7 -0
- package/lib/types/client/TaskBoardSettingsCard.d.ts +19 -3
- package/lib/types/client/board/ClampedMarkdown.d.ts +3 -0
- package/lib/types/client/board/ConfirmDialog.d.ts +4 -1
- package/lib/types/client/board/EditTaskModal.d.ts +5 -2
- package/lib/types/client/board/LinkSubtaskModal.d.ts +5 -2
- package/lib/types/client/board/NewTaskModal.d.ts +4 -1
- package/lib/types/client/board/TagManagerModal.d.ts +26 -0
- package/lib/types/client/board/TaskBoard.d.ts +10 -1
- package/lib/types/client/board/TaskCard.d.ts +14 -1
- package/lib/types/client/board/TaskDetail.d.ts +3 -1
- package/lib/types/client/board/TaskForm.d.ts +23 -2
- package/lib/types/client/board/VerificationReport.d.ts +23 -0
- package/lib/types/client/board/card-view.d.ts +113 -0
- package/lib/types/client/board/icons.d.ts +32 -0
- package/lib/types/client/board/overlay.d.ts +69 -0
- package/lib/types/client/board/preset-label.d.ts +22 -0
- package/lib/types/client/board/status-key.d.ts +15 -0
- package/lib/types/client/board/task-markdown.d.ts +19 -0
- package/lib/types/client/board-card-seat.d.ts +34 -0
- package/lib/types/client/host-api.d.ts +24 -1
- package/lib/types/client/index.d.ts +19 -0
- package/lib/types/client/locales.d.ts +141 -3
- package/lib/types/client/native-panel.d.ts +6 -20
- package/lib/types/client/schedule-zone.d.ts +47 -0
- package/lib/types/client/seats.d.ts +18 -0
- package/lib/types/client/service.d.ts +32 -0
- package/lib/types/client/settings-form.d.ts +16 -0
- package/lib/types/core/controller.d.ts +38 -1
- package/lib/types/core/degraded-reason.d.ts +46 -0
- package/lib/types/core/extension.d.ts +283 -0
- package/lib/types/core/handover.d.ts +13 -1
- package/lib/types/core/issue-form.d.ts +16 -0
- package/lib/types/core/package-name.d.ts +9 -0
- package/lib/types/core/schedule.d.ts +95 -20
- package/lib/types/core/subtask.d.ts +30 -11
- package/lib/types/core/tasks.d.ts +110 -5
- package/lib/types/core/use-cases/task-create.d.ts +2 -1
- package/lib/types/core/use-cases/task-schedule.d.ts +8 -4
- package/lib/types/core/use-cases/task-tag.d.ts +48 -0
- package/lib/types/core/use-cases/task-update.d.ts +5 -3
- package/lib/types/core/verification.d.ts +386 -0
- package/lib/types/core/workspace-target.d.ts +41 -0
- package/lib/types/host/agent-tools.d.ts +1 -1
- package/lib/types/host/extension-registry.d.ts +111 -0
- package/lib/types/host/llm-dispatch.d.ts +63 -0
- package/lib/types/host/verification-gate.d.ts +71 -0
- package/lib/types/host/verification-runner.d.ts +108 -0
- package/lib/types/host/workspace-evidence.d.ts +53 -0
- package/lib/types/host-ledger.d.ts +107 -11
- package/lib/types/host-runner.d.ts +99 -4
- package/lib/types/host-service.d.ts +114 -2
- package/lib/types/index.d.ts +80 -26
- package/lib/types/protocol.d.ts +53 -3
- package/lib/types/tool-surface.d.ts +71 -0
- package/package.json +27 -26
- package/src/client/PluginSettingsCard.tsx +9 -0
- package/src/client/TaskBoardSettingsCard.tsx +304 -65
- package/src/client/board/ClampedMarkdown.tsx +69 -0
- package/src/client/board/ConfirmDialog.tsx +7 -3
- package/src/client/board/EditTaskModal.tsx +5 -2
- package/src/client/board/LinkSubtaskModal.tsx +30 -15
- package/src/client/board/NewTaskModal.tsx +288 -151
- package/src/client/board/TagManagerModal.tsx +235 -0
- package/src/client/board/TaskBoard.tsx +259 -103
- package/src/client/board/TaskCard.tsx +238 -86
- package/src/client/board/TaskDetail.tsx +154 -59
- package/src/client/board/TaskForm.tsx +61 -6
- package/src/client/board/VerificationReport.tsx +203 -0
- package/src/client/board/card-view.ts +220 -0
- package/src/client/board/icons.tsx +89 -0
- package/src/client/board/overlay.tsx +189 -0
- package/src/client/board/preset-label.ts +44 -0
- package/src/client/board/status-key.ts +27 -0
- package/src/client/board/task-markdown.module.css +137 -0
- package/src/client/board/task-markdown.tsx +106 -0
- package/src/client/board-card-seat.ts +102 -0
- package/src/client/board-settings.module.css +66 -0
- package/src/client/board.module.css +602 -68
- package/src/client/host-api.ts +109 -6
- package/src/client/index.ts +48 -6
- package/src/client/locales.ts +290 -12
- package/src/client/native-panel.tsx +18 -2
- package/src/client/schedule-zone.ts +135 -0
- package/src/client/seats.tsx +58 -0
- package/src/client/service.ts +94 -0
- package/src/client/settings-card.module.css +31 -5
- package/src/client/settings-form.ts +27 -1
- package/src/core/controller.ts +101 -5
- package/src/core/degraded-reason.ts +81 -0
- package/src/core/extension.ts +376 -0
- package/src/core/freeze-snapshot.ts +2 -2
- package/src/core/handover.ts +16 -1
- package/src/core/issue-form.ts +19 -0
- package/src/core/package-name.ts +9 -0
- package/src/core/schedule.ts +211 -55
- package/src/core/store.ts +26 -1
- package/src/core/subtask.ts +77 -22
- package/src/core/tasks.ts +138 -10
- package/src/core/use-cases/task-create.ts +14 -2
- package/src/core/use-cases/task-parent.ts +3 -2
- package/src/core/use-cases/task-schedule.ts +17 -6
- package/src/core/use-cases/task-tag.ts +110 -0
- package/src/core/use-cases/task-update.ts +13 -4
- package/src/core/verification.ts +826 -0
- package/src/core/workspace-target.ts +59 -0
- package/src/host/agent-tools.ts +58 -24
- package/src/host/extension-registry.ts +509 -0
- package/src/host/llm-dispatch.ts +87 -0
- package/src/host/verification-gate.ts +331 -0
- package/src/host/verification-runner.ts +535 -0
- package/src/host/workspace-evidence.ts +176 -0
- package/src/host-ai.ts +15 -9
- package/src/host-ledger.ts +342 -51
- package/src/host-routes.ts +15 -2
- package/src/host-runner.ts +219 -20
- package/src/host-service.ts +346 -26
- package/src/index.ts +204 -16
- package/src/protocol.ts +122 -9
- package/src/tool-surface.ts +95 -0
- package/lib/types/host/run-guarded.d.ts +0 -39
- package/src/host/run-guarded.ts +0 -76
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The task board's external provider extension contract.
|
|
3
|
+
*
|
|
4
|
+
* This module is the single source of truth for how another plugin adds a
|
|
5
|
+
* provider surface to the task board: the cordis service name both halves
|
|
6
|
+
* publish, the API version they negotiate, the child seats a provider renders
|
|
7
|
+
* into, the host capability face a provider implements against, and the client
|
|
8
|
+
* capability face the board's browser half provides. It is framework-free and
|
|
9
|
+
* shared by the host and browser programs; the only imported SDK type is
|
|
10
|
+
* type-only, so the browser bundle never pulls a value out of an SDK package.
|
|
11
|
+
*
|
|
12
|
+
* @module dsh-task-board/core/extension
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools'
|
|
15
|
+
import type { ExecutionOutcome, TaskRecord, TaskStatus } from './tasks.ts'
|
|
16
|
+
|
|
17
|
+
/** Cordis service name the host and browser halves each publish. */
|
|
18
|
+
export const TASK_BOARD_SERVICE_NAME = 'taskBoard'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Contract version of {@link TASK_BOARD_SERVICE_NAME}. A provider declares the
|
|
22
|
+
* version it was built against; the board refuses (visibly) any other version
|
|
23
|
+
* instead of guessing at a stale shape.
|
|
24
|
+
*/
|
|
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
|
+
/** Every child seat the board declares for extensions, in render order. */
|
|
35
|
+
export const TASK_BOARD_EXTENSION_SEATS: readonly string[] = [
|
|
36
|
+
TASK_BOARD_DETAIL_SECTION,
|
|
37
|
+
TASK_BOARD_SETTINGS_SECTION,
|
|
38
|
+
TASK_BOARD_CARD_DECORATION,
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Largest accepted extension payload, in bytes of its JSON serialization. One
|
|
43
|
+
* integration entry — and one action payload — may carry schema the board does
|
|
44
|
+
* not interpret, but never enough of it to bloat the ledger or the action
|
|
45
|
+
* channel.
|
|
46
|
+
*/
|
|
47
|
+
export const TASK_BOARD_PAYLOAD_LIMIT_BYTES = 64 * 1024
|
|
48
|
+
|
|
49
|
+
/** Depth beyond which a payload is refused instead of walked. */
|
|
50
|
+
const PAYLOAD_DEPTH_LIMIT = 64
|
|
51
|
+
|
|
52
|
+
/** One opaque provider payload the board stores and forwards without interpreting. */
|
|
53
|
+
export type TaskBoardExtensionPayload = Record<string, unknown>
|
|
54
|
+
|
|
55
|
+
/** Whether a value is a plain JSON value (no undefined, function, symbol, bigint or cycle). */
|
|
56
|
+
function isJsonValue(value: unknown, depth: number): boolean {
|
|
57
|
+
if (depth > PAYLOAD_DEPTH_LIMIT) return false
|
|
58
|
+
if (value === null) return true
|
|
59
|
+
switch (typeof value) {
|
|
60
|
+
case 'string':
|
|
61
|
+
case 'boolean':
|
|
62
|
+
return true
|
|
63
|
+
case 'number':
|
|
64
|
+
return Number.isFinite(value)
|
|
65
|
+
// A provider's in-memory metadata legitimately clears a field by setting it
|
|
66
|
+
// to undefined; JSON serialization drops such a key, so the persisted
|
|
67
|
+
// payload is still pure JSON.
|
|
68
|
+
case 'undefined':
|
|
69
|
+
return true
|
|
70
|
+
case 'object':
|
|
71
|
+
break
|
|
72
|
+
default:
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
if (Array.isArray(value)) return value.every(item => isJsonValue(item, depth + 1))
|
|
76
|
+
const prototype = Object.getPrototypeOf(value)
|
|
77
|
+
if (prototype !== Object.prototype && prototype !== null) return false
|
|
78
|
+
return Object.values(value as Record<string, unknown>).every(item => isJsonValue(item, depth + 1))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Validate one extension payload: a pure JSON object whose serialization fits
|
|
83
|
+
* {@link TASK_BOARD_PAYLOAD_LIMIT_BYTES}. Arrays, primitives and non-plain
|
|
84
|
+
* objects are refused; the board never interprets the keys.
|
|
85
|
+
* @param value - candidate payload.
|
|
86
|
+
* @returns whether the value is an acceptable opaque payload.
|
|
87
|
+
*/
|
|
88
|
+
export function isTaskBoardExtensionPayload(value: unknown): value is TaskBoardExtensionPayload {
|
|
89
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false
|
|
90
|
+
if (!isJsonValue(value, 0)) return false
|
|
91
|
+
try {
|
|
92
|
+
return new TextEncoder().encode(JSON.stringify(value)).length <= TASK_BOARD_PAYLOAD_LIMIT_BYTES
|
|
93
|
+
} catch {
|
|
94
|
+
return false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Byte length of a value's JSON serialization, or undefined when it does not serialize. */
|
|
99
|
+
export function taskBoardPayloadBytes(value: unknown): number | undefined {
|
|
100
|
+
try {
|
|
101
|
+
return new TextEncoder().encode(JSON.stringify(value)).length
|
|
102
|
+
} catch {
|
|
103
|
+
return undefined
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Normalize a task's whole integrations container: a plain JSON object whose
|
|
109
|
+
* values are each an opaque provider payload within the size limit. A malformed
|
|
110
|
+
* container normalizes to undefined (the field is dropped), and one malformed
|
|
111
|
+
* entry is dropped alone so a single bad provider can never take a card — or
|
|
112
|
+
* another provider's data — with it.
|
|
113
|
+
* @param value - candidate container from the wire, the ledger, or a create input.
|
|
114
|
+
* @returns the cleaned container, or undefined when nothing usable remains.
|
|
115
|
+
*/
|
|
116
|
+
export function normalizeTaskIntegrations(value: unknown): Record<string, TaskBoardExtensionPayload> | undefined {
|
|
117
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return undefined
|
|
118
|
+
const prototype = Object.getPrototypeOf(value)
|
|
119
|
+
if (prototype !== Object.prototype && prototype !== null) return undefined
|
|
120
|
+
const result: Record<string, TaskBoardExtensionPayload> = {}
|
|
121
|
+
for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {
|
|
122
|
+
if (key === '') continue
|
|
123
|
+
if (!isTaskBoardExtensionPayload(entry)) continue
|
|
124
|
+
result[key] = entry
|
|
125
|
+
}
|
|
126
|
+
return Object.keys(result).length === 0 ? undefined : result
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** One action a provider dispatches over the board's same-origin channel. */
|
|
130
|
+
export interface TaskBoardExtensionActionRequest {
|
|
131
|
+
/** Id of the extension the action belongs to. */
|
|
132
|
+
extensionId: string
|
|
133
|
+
/** Provider-owned action name, routed back to that extension's handleAction. */
|
|
134
|
+
action: string
|
|
135
|
+
/** Task the action targets, when it targets one. */
|
|
136
|
+
taskId?: string
|
|
137
|
+
/** Opaque provider payload, bounded like every other extension payload. */
|
|
138
|
+
payload?: TaskBoardExtensionPayload
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Deliver one extension action through the board's same-origin action channel.
|
|
143
|
+
* The extension never opens an HTTP surface of its own.
|
|
144
|
+
*/
|
|
145
|
+
export type TaskBoardExtensionDispatch = (request: TaskBoardExtensionActionRequest) => Promise<boolean>
|
|
146
|
+
|
|
147
|
+
/** Draft one provider creates a task from. */
|
|
148
|
+
export interface TaskBoardTaskDraft {
|
|
149
|
+
title: string
|
|
150
|
+
description: string
|
|
151
|
+
prompt: string
|
|
152
|
+
/** Column the created card opens in; absent means the board default (todo). */
|
|
153
|
+
status?: TaskStatus
|
|
154
|
+
/** Parent card id, when the provider materializes a subtask. */
|
|
155
|
+
parentId?: string
|
|
156
|
+
/**
|
|
157
|
+
* Workspace the execution must run in. Absent leaves the board's own
|
|
158
|
+
* inheritance rules in charge (the creating session's workspace for a root
|
|
159
|
+
* card, else the recent workspace at execution time), so a provider that has
|
|
160
|
+
* no reason to know better pins nothing.
|
|
161
|
+
*/
|
|
162
|
+
workspaceId?: string
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Options of {@link TaskBoardTasksFace.create}. */
|
|
166
|
+
export interface TaskBoardCreateOptions {
|
|
167
|
+
/** Opaque payload stored under the creating extension's id. */
|
|
168
|
+
payload?: TaskBoardExtensionPayload
|
|
169
|
+
/** Create the card off-board: it exists in the ledger but is never shown on the board. */
|
|
170
|
+
hidden?: boolean
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** One task linked to an extension, with that extension's own payload. */
|
|
174
|
+
export interface TaskBoardLinkedTask {
|
|
175
|
+
task: TaskRecord
|
|
176
|
+
payload: TaskBoardExtensionPayload
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Task reads and writes the board grants an extension. */
|
|
180
|
+
export interface TaskBoardTasksFace {
|
|
181
|
+
/** Every task in the ledger, most recent mutation last. */
|
|
182
|
+
list(): readonly TaskRecord[]
|
|
183
|
+
/** One task by id, or undefined. */
|
|
184
|
+
get(taskId: string): TaskRecord | undefined
|
|
185
|
+
/**
|
|
186
|
+
* Create a task through the board's own creation gate; the payload lands
|
|
187
|
+
* under the creating extension's id. Throws on a refused draft.
|
|
188
|
+
*/
|
|
189
|
+
create(draft: TaskBoardTaskDraft, options?: TaskBoardCreateOptions): TaskRecord
|
|
190
|
+
/**
|
|
191
|
+
* Patch a task's content. Reuses the board's own content gate: a task that
|
|
192
|
+
* has started executing keeps its recorded title/description/prompt.
|
|
193
|
+
* Throws when the card is frozen.
|
|
194
|
+
*/
|
|
195
|
+
patchContent(taskId: string, patch: { title?: string; description?: string; prompt?: string }): void
|
|
196
|
+
/**
|
|
197
|
+
* Move a task through the board's existing status gates (running lock,
|
|
198
|
+
* permission confirmation gate). Throws on refusal.
|
|
199
|
+
*/
|
|
200
|
+
setStatus(taskId: string, status: TaskStatus, initiator?: string): void
|
|
201
|
+
/** Every task carrying this extension's payload. */
|
|
202
|
+
linked(): readonly TaskBoardLinkedTask[]
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Storage face for one extension's own payload on a task. */
|
|
206
|
+
export interface TaskBoardIntegrationFace {
|
|
207
|
+
/** Read this extension's payload, or undefined when the task carries none. */
|
|
208
|
+
read(taskId: string): TaskBoardExtensionPayload | undefined
|
|
209
|
+
/**
|
|
210
|
+
* Shallow-merge this extension's payload into the task: the given keys
|
|
211
|
+
* replace the stored ones, and a key explicitly set to undefined clears it.
|
|
212
|
+
* The board stores the result opaquely; a non-JSON or oversized payload is
|
|
213
|
+
* refused.
|
|
214
|
+
*/
|
|
215
|
+
write(taskId: string, payload: TaskBoardExtensionPayload): void
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Status-change notification. */
|
|
219
|
+
export interface TaskBoardStatusChangedEvent {
|
|
220
|
+
taskId: string
|
|
221
|
+
status: TaskStatus
|
|
222
|
+
previous: TaskStatus
|
|
223
|
+
initiator?: string
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Execution-settlement notification. */
|
|
227
|
+
export interface TaskBoardExecutionSettledEvent {
|
|
228
|
+
taskId: string
|
|
229
|
+
executionId: string
|
|
230
|
+
outcome: ExecutionOutcome
|
|
231
|
+
error?: string
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Task-deletion notification. */
|
|
235
|
+
export interface TaskBoardTaskDeletedEvent {
|
|
236
|
+
taskId: string
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Event subscriptions an extension registers for. Every callback runs isolated:
|
|
241
|
+
* a throw is logged and never interrupts the board's own execution path.
|
|
242
|
+
*/
|
|
243
|
+
export interface TaskBoardEventFace {
|
|
244
|
+
onStatusChanged(callback: (event: TaskBoardStatusChangedEvent) => void): () => void
|
|
245
|
+
onExecutionSettled(callback: (event: TaskBoardExecutionSettledEvent) => void): () => void
|
|
246
|
+
onTaskDeleted(callback: (event: TaskBoardTaskDeletedEvent) => void): () => void
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Host capability face handed to one extension while it is started. The face
|
|
251
|
+
* lives for the extension's enabled lifetime; the board revokes it by calling
|
|
252
|
+
* the extension's stop().
|
|
253
|
+
*/
|
|
254
|
+
export interface TaskBoardExtensionHost {
|
|
255
|
+
tasks: TaskBoardTasksFace
|
|
256
|
+
integration: TaskBoardIntegrationFace
|
|
257
|
+
events: TaskBoardEventFace
|
|
258
|
+
/**
|
|
259
|
+
* Publish this extension's read-only summary; it lands in the snapshot's
|
|
260
|
+
* extensions[id] for the extension's browser half to render.
|
|
261
|
+
*/
|
|
262
|
+
publish(summary: TaskBoardExtensionPayload): void
|
|
263
|
+
/** Register one model-visible tool; the returned disposer unregisters it. */
|
|
264
|
+
registerTool(definition: ToolDefinition): () => void
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** One external provider contributed to the task board. */
|
|
268
|
+
export interface TaskBoardExtension {
|
|
269
|
+
/** Stable extension id; also the key of this extension's integration payload. */
|
|
270
|
+
readonly id: string
|
|
271
|
+
/** Contract version this extension was built against. */
|
|
272
|
+
readonly apiVersion: number
|
|
273
|
+
/** Volatile per-extension switch; absent means enabled. Read at use time. */
|
|
274
|
+
enabled?(): boolean
|
|
275
|
+
/** Acquire the capability face and start any provider-side work. */
|
|
276
|
+
start?(host: TaskBoardExtensionHost): void
|
|
277
|
+
/** Release provider-side work. Never clears stored data. */
|
|
278
|
+
stop?(): void
|
|
279
|
+
/** Route one dispatched action; the returned value goes back to the dispatcher. */
|
|
280
|
+
handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Board mirror an extension's browser half observes. */
|
|
284
|
+
export interface TaskBoardClientMirror {
|
|
285
|
+
/** Whether the board's master switch currently runs the extension faces. */
|
|
286
|
+
enabled: boolean
|
|
287
|
+
/** Tasks the board currently holds. */
|
|
288
|
+
tasks: readonly TaskRecord[]
|
|
289
|
+
/** Published extension summaries, keyed by extension id (opaque to the board). */
|
|
290
|
+
extensions: Readonly<Record<string, unknown>>
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Whether a task should be shown on the board; false hides it. */
|
|
294
|
+
export type TaskBoardVisibilityPredicate = (task: TaskRecord) => boolean
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Client capability face the board's browser half provides. A provider's
|
|
298
|
+
* browser half resolves it from the shared cordis service name; it never
|
|
299
|
+
* value-imports the board package.
|
|
300
|
+
*/
|
|
301
|
+
export interface TaskBoardClientFace {
|
|
302
|
+
/** Deliver one action through the board's same-origin action channel. */
|
|
303
|
+
dispatch(request: TaskBoardExtensionActionRequest): Promise<boolean>
|
|
304
|
+
/** Register one card visibility predicate; the returned disposer removes it. */
|
|
305
|
+
registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void
|
|
306
|
+
/** Subscribe to the board mirror. */
|
|
307
|
+
subscribe(callback: (mirror: TaskBoardClientMirror) => void): () => void
|
|
308
|
+
/** Read the current board mirror. */
|
|
309
|
+
snapshot(): TaskBoardClientMirror
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Owner props of the task-detail seat. */
|
|
313
|
+
export interface TaskBoardDetailSectionProps {
|
|
314
|
+
task: TaskRecord
|
|
315
|
+
dispatch: TaskBoardExtensionDispatch
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** Owner props of the settings seat. */
|
|
319
|
+
export interface TaskBoardSettingsSectionProps {
|
|
320
|
+
dispatch: TaskBoardExtensionDispatch
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/** Owner props of the card-decoration seat. */
|
|
324
|
+
export interface TaskBoardCardDecorationProps {
|
|
325
|
+
task: TaskRecord
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Host-half service face published under {@link TASK_BOARD_SERVICE_NAME}. A
|
|
330
|
+
* provider package's host half resolves this from the shared cordis service
|
|
331
|
+
* and registers its extension; the board's ledger never crosses this boundary.
|
|
332
|
+
*/
|
|
333
|
+
export interface TaskBoardHostFace {
|
|
334
|
+
/**
|
|
335
|
+
* Admit one provider extension. Idempotent by extension id; the returned
|
|
336
|
+
* disposer releases it without clearing stored data.
|
|
337
|
+
*/
|
|
338
|
+
registerExtension(extension: TaskBoardExtension): () => void
|
|
339
|
+
/** Whether the board currently runs a given extension (board x extension). */
|
|
340
|
+
isExtensionEnabled(extensionId: string): boolean
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare module '@deepseek-ai/cordis' {
|
|
344
|
+
interface Context {
|
|
345
|
+
/**
|
|
346
|
+
* The board's extension service. The host half publishes
|
|
347
|
+
* {@link TaskBoardHostFace}; the browser half publishes
|
|
348
|
+
* {@link TaskBoardClientFace} under the same name. The two halves never run
|
|
349
|
+
* in one process, so the browser half resolves its face through
|
|
350
|
+
* {@link resolveTaskBoardClientFace} and this shared declaration names the
|
|
351
|
+
* host face that registration-side consumers type against.
|
|
352
|
+
*/
|
|
353
|
+
taskBoard: TaskBoardHostFace
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** The narrow context seat {@link resolveTaskBoardClientFace} needs. */
|
|
358
|
+
export interface TaskBoardClientContextSeat {
|
|
359
|
+
get(name: string): unknown
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Resolve the browser half's client capability face by service name. Returns
|
|
364
|
+
* undefined when the board is not loaded or the service is not served, so a
|
|
365
|
+
* provider's browser half can degrade instead of throwing.
|
|
366
|
+
* @param ctx - client context.
|
|
367
|
+
* @returns the client face, or undefined.
|
|
368
|
+
*/
|
|
369
|
+
export function resolveTaskBoardClientFace(ctx: TaskBoardClientContextSeat): TaskBoardClientFace | undefined {
|
|
370
|
+
try {
|
|
371
|
+
const face = ctx.get(TASK_BOARD_SERVICE_NAME) as TaskBoardClientFace | undefined
|
|
372
|
+
return face !== undefined && typeof (face as { dispatch?: unknown }).dispatch === 'function' ? face : undefined
|
|
373
|
+
} catch {
|
|
374
|
+
return undefined
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -48,8 +48,8 @@ const SECTION_NAMES: Record<SectionKey, string> = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Sensitive patterns, each matched globally over every field body:
|
|
50
50
|
* PEM private key blocks (whole block collapses to one marker), Bearer
|
|
51
|
-
* credentials, OpenAI sk-,
|
|
52
|
-
* and AWS access key ids.
|
|
51
|
+
* credentials, OpenAI sk-, `ghp_`-shaped provider tokens, GitLab glpat-,
|
|
52
|
+
* Slack xox* tokens, and AWS access key ids.
|
|
53
53
|
*/
|
|
54
54
|
const SENSITIVE_PATTERNS: RegExp[] = [
|
|
55
55
|
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
|
package/src/core/handover.ts
CHANGED
|
@@ -40,7 +40,11 @@ export const HANDOVER_MAX_TOTAL_BYTES = 8 * 1024
|
|
|
40
40
|
/** Per target-id (workspace/preset) byte cap. */
|
|
41
41
|
export const HANDOVER_MAX_TARGET_BYTES = 256
|
|
42
42
|
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Fail-safe baseline for the confirmation gate: what it falls back to when the
|
|
45
|
+
* deployment pins no baseline of its own and the Host's default permission
|
|
46
|
+
* preset cannot be read. Every elevation above it stays gated.
|
|
47
|
+
*/
|
|
44
48
|
export const DEFAULT_SESSION_PERMISSION: TaskPermission = 'read-only'
|
|
45
49
|
|
|
46
50
|
/** Permission elevation rank (higher = more authority). */
|
|
@@ -105,6 +109,17 @@ export function exceedsSessionDefault(permission: TaskPermission | undefined, se
|
|
|
105
109
|
return (PERMISSION_RANK.get(permission) ?? -1) > (PERMISSION_RANK.get(sessionDefault) ?? -1)
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Whether a session running at `holder` already carries `permission`: the
|
|
114
|
+
* permission is absent, or its rank does not exceed the holder's. A teammate
|
|
115
|
+
* inherits the Lead session's permission and cannot be narrowed below it, so a
|
|
116
|
+
* subtask's own pin is carried by a team run exactly when this holds, and a pin
|
|
117
|
+
* it does not carry would be silently dropped instead.
|
|
118
|
+
*/
|
|
119
|
+
export function permissionCarriedBy(holder: TaskPermission, permission: TaskPermission | undefined): boolean {
|
|
120
|
+
return !exceedsSessionDefault(permission, holder)
|
|
121
|
+
}
|
|
122
|
+
|
|
108
123
|
/**
|
|
109
124
|
* The confirmation-gate predicate: an elevated permission without a human
|
|
110
125
|
* confirmation stamp. Manual run/rerun and cron must refuse such a card.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue-form vocabulary the card excerpt recognizes.
|
|
3
|
+
*
|
|
4
|
+
* Issue forms from an issue tracker (and the zh templates this family's repositories use)
|
|
5
|
+
* write the same section headings and empty-field placeholders on every issue.
|
|
6
|
+
* The patterns are data about those forms, not UI copy, so they live in the
|
|
7
|
+
* shared core rather than in a locale dictionary; the browser half imports them.
|
|
8
|
+
*
|
|
9
|
+
* @module @linxin666/dsh-client-ui-task-board/core/issue-form
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Section headings whose body is the issue's own summary (zh and en forms). */
|
|
13
|
+
export const SUMMARY_HEADING = /^(?:摘要|概要|概述|简介|描述|问题描述|问题|现象|summary|description|overview|problem|what happened)$/i
|
|
14
|
+
|
|
15
|
+
/** Values an issue form writes for an empty field. */
|
|
16
|
+
export const EMPTY_FIELD = /^(?:_?no response_?|n\/a|none|无|暂无)$/i
|
|
17
|
+
|
|
18
|
+
/** A trailing colon (ASCII or full-width) after a heading. */
|
|
19
|
+
export const HEADING_COLON = /[:\uFF1A]\s*$/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm identity of this plugin. The dsh-web-all degraded ledger is keyed by the
|
|
3
|
+
* real plugin package name of a family row, and this plugin's browser half
|
|
4
|
+
* must name its OWN row there to learn why its Host API is missing (issue
|
|
5
|
+
* #1730): the served bundle cannot derive the name, because a family row
|
|
6
|
+
* mounts the package from a versioned profile path. The host half spells the
|
|
7
|
+
* same name in its single-mount guard (src/index.ts); the two move together.
|
|
8
|
+
*/
|
|
9
|
+
export const TASK_BOARD_PACKAGE = '@linxin666/dsh-client-ui-task-board'
|