@linxin666/dsh-client-ui-task-board 0.4.19 → 0.4.21
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +190 -63
- package/lib/client.js.map +1 -1
- package/lib/index.js +599 -95
- package/lib/types/client/board/TaskForm.d.ts +3 -1
- package/lib/types/client/index.d.ts +7 -1
- package/lib/types/client/native-panel.d.ts +1 -1
- package/lib/types/client/seats.d.ts +36 -2
- package/lib/types/client/settings-form.d.ts +2 -0
- package/lib/types/core/controller.d.ts +1 -1
- package/lib/types/core/extension.d.ts +160 -1
- package/lib/types/core/session-reuse.d.ts +46 -13
- package/lib/types/core/tasks.d.ts +16 -5
- package/lib/types/host/agent-tools.d.ts +12 -2
- package/lib/types/host/extension-registry.d.ts +38 -1
- package/lib/types/host-ledger.d.ts +86 -1
- package/lib/types/host-runner.d.ts +20 -1
- package/lib/types/host-service.d.ts +64 -15
- package/lib/types/protocol.d.ts +18 -1
- package/package.json +1 -1
- package/src/client/board/ExecutionLog.tsx +15 -2
- package/src/client/board/NewTaskModal.tsx +88 -3
- package/src/client/board/TaskDetail.tsx +18 -11
- package/src/client/board/TaskForm.tsx +13 -2
- package/src/client/board.module.css +67 -1
- package/src/client/index.ts +3 -0
- package/src/client/locales.ts +7 -6
- package/src/client/native-panel.tsx +2 -1
- package/src/client/seats.tsx +32 -4
- package/src/client/service.ts +3 -0
- package/src/client/settings-form.ts +21 -2
- package/src/core/controller.ts +9 -3
- package/src/core/execution-summary.ts +3 -2
- package/src/core/extension.ts +159 -1
- package/src/core/session-reuse.ts +58 -21
- package/src/core/store.ts +2 -0
- package/src/core/tasks.ts +16 -5
- package/src/host/agent-tools.ts +70 -17
- package/src/host/extension-registry.ts +157 -2
- package/src/host-ledger.ts +274 -23
- package/src/host-runner.ts +44 -5
- package/src/host-service.ts +190 -37
- package/src/protocol.ts +37 -3
|
@@ -37,7 +37,7 @@ export declare function ModalShell({ ariaLabel, title, error, pending, submitLab
|
|
|
37
37
|
* the same animation pair, and `usePresence` keeps it mounted through the exit
|
|
38
38
|
* leg so collapsing never snaps.
|
|
39
39
|
*/
|
|
40
|
-
export declare function CollapsibleSection({ title, summary, defaultOpen, forceOpen, children, }: {
|
|
40
|
+
export declare function CollapsibleSection({ title, summary, defaultOpen, forceOpen, keepMounted, children, }: {
|
|
41
41
|
title: string;
|
|
42
42
|
/** One-line value preview rendered only while the region is collapsed. */
|
|
43
43
|
summary?: string | undefined;
|
|
@@ -45,6 +45,8 @@ export declare function CollapsibleSection({ title, summary, defaultOpen, forceO
|
|
|
45
45
|
defaultOpen?: boolean;
|
|
46
46
|
/** Open regardless of the stored state: an error inside must stay visible. */
|
|
47
47
|
forceOpen?: boolean;
|
|
48
|
+
/** Keep children mounted while collapsed so provider seats keep their local state. */
|
|
49
|
+
keepMounted?: boolean;
|
|
48
50
|
children: ReactNode;
|
|
49
51
|
}): import("react").JSX.Element;
|
|
50
52
|
/** Title + description + prompt fields shared by the new and edit task forms. */
|
|
@@ -12,7 +12,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
|
12
12
|
import type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
13
13
|
import { type TaskBoardSettings } from './TaskBoardSettingsCard.tsx';
|
|
14
14
|
import { type TaskBoardKey } from './locales.ts';
|
|
15
|
-
import { type TaskBoardCardDecorationProps, type TaskBoardDetailSectionProps, type TaskBoardSettingsSectionProps } from '../core/extension.ts';
|
|
15
|
+
import { type TaskBoardCardDecorationProps, type TaskBoardComposeSectionProps, type TaskBoardDetailSectionProps, type TaskBoardSettingsSectionProps } from '../core/extension.ts';
|
|
16
16
|
/** Domain-owned description of one settings namespace a family card binds. */
|
|
17
17
|
export interface SettingsFormSpec<T> {
|
|
18
18
|
/** Settings namespace the card edits. */
|
|
@@ -69,6 +69,12 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
69
69
|
scope: 'root';
|
|
70
70
|
owner: TaskBoardCardDecorationProps;
|
|
71
71
|
};
|
|
72
|
+
/** Provider new-card section; the board declares and renders it in the create dialog. */
|
|
73
|
+
'task-board.compose.section': {
|
|
74
|
+
kind: 'list';
|
|
75
|
+
scope: 'root';
|
|
76
|
+
owner: TaskBoardComposeSectionProps;
|
|
77
|
+
};
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
/** Owner share of a plugin card (the section supplies nothing). */
|
|
@@ -31,7 +31,7 @@ export declare function TaskBoardPanelIcon({ size }: {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function TaskBoardPanel({ controller, renderSlot }: {
|
|
33
33
|
controller: BoardController;
|
|
34
|
-
/** Child-slot renderer the registration declares (detail
|
|
34
|
+
/** Child-slot renderer the registration declares (detail, card decoration, new-card section). */
|
|
35
35
|
renderSlot?: SlotRenderBinding;
|
|
36
36
|
}): ReactNode;
|
|
37
37
|
/**
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The board's child seats, threaded from the slot registration that declares
|
|
3
|
+
* them down to the components that consume them.
|
|
4
|
+
*
|
|
5
|
+
* The framework hands the declaring component a `renderSlot` binding; the board
|
|
6
|
+
* wraps that binding in a React context so a provider's contribution can render
|
|
7
|
+
* deep inside TaskDetail, the card, the settings card, or the create dialog
|
|
8
|
+
* without those components knowing which providers exist.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-task-board/client/seats
|
|
11
|
+
*/
|
|
12
|
+
import { Component } from 'react';
|
|
1
13
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type TaskBoardCardDecorationProps, type TaskBoardDetailSectionProps, type TaskBoardSettingsSectionProps } from '../core/extension.ts';
|
|
3
|
-
/** The
|
|
14
|
+
import { type TaskBoardCardDecorationProps, type TaskBoardComposeSectionProps, type TaskBoardDetailSectionProps, type TaskBoardSettingsSectionProps } from '../core/extension.ts';
|
|
15
|
+
/** The four provider seats, adapted to plain render functions. */
|
|
4
16
|
export interface TaskBoardSeats {
|
|
5
17
|
detailSection: (props: TaskBoardDetailSectionProps) => ReactNode;
|
|
6
18
|
settingsSection: (props: TaskBoardSettingsSectionProps) => ReactNode;
|
|
7
19
|
cardDecoration: (props: TaskBoardCardDecorationProps) => ReactNode;
|
|
20
|
+
composeSection: (props: TaskBoardComposeSectionProps) => ReactNode;
|
|
8
21
|
}
|
|
9
22
|
/** Nothing registered: every seat renders empty. */
|
|
10
23
|
export declare const EMPTY_TASK_BOARD_SEATS: TaskBoardSeats;
|
|
@@ -12,6 +25,27 @@ export declare const EMPTY_TASK_BOARD_SEATS: TaskBoardSeats;
|
|
|
12
25
|
export type SlotRenderBinding = (key: string, owner: Record<string, unknown>) => ReactNode;
|
|
13
26
|
/** Adapt one framework renderSlot binding to the board's seat interface. */
|
|
14
27
|
export declare function seatsFromRenderSlot(renderSlot: SlotRenderBinding | undefined): TaskBoardSeats;
|
|
28
|
+
/**
|
|
29
|
+
* Isolation for one seat whose providers render outside the framework's own
|
|
30
|
+
* per-entry boundary: a provider that throws while rendering contributes
|
|
31
|
+
* nothing here instead of taking the surface around the seat down with it.
|
|
32
|
+
* Nothing is rendered in that case — the seat is optional, so its absence is
|
|
33
|
+
* the honest state — and the failure is logged once for the provider's author.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TaskBoardSeatBoundary extends Component<{
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}, {
|
|
38
|
+
failed: boolean;
|
|
39
|
+
}> {
|
|
40
|
+
state: {
|
|
41
|
+
failed: boolean;
|
|
42
|
+
};
|
|
43
|
+
static getDerivedStateFromError(): {
|
|
44
|
+
failed: boolean;
|
|
45
|
+
};
|
|
46
|
+
componentDidCatch(error: unknown): void;
|
|
47
|
+
render(): ReactNode;
|
|
48
|
+
}
|
|
15
49
|
/** Provider the board's registered components wrap their subtree in. */
|
|
16
50
|
export declare const TaskBoardSeatsProvider: import("react").Provider<TaskBoardSeats>;
|
|
17
51
|
/** Read the current seat set (empty when no board registration is above). */
|
|
@@ -111,6 +111,8 @@ export interface NumberConstraints {
|
|
|
111
111
|
integer?: boolean;
|
|
112
112
|
/** The accepted value must be at least this. */
|
|
113
113
|
min?: number;
|
|
114
|
+
/** The accepted value must be at most this. */
|
|
115
|
+
max?: number;
|
|
114
116
|
}
|
|
115
117
|
/** 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
118
|
export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
|
|
@@ -130,7 +130,7 @@ export interface ExecutionOptionsSnapshot {
|
|
|
130
130
|
* (revision/scheduler/power); a full snapshot also carries the deployment
|
|
131
131
|
* constants the UI reads (session default permission, subtask depth).
|
|
132
132
|
*/
|
|
133
|
-
export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'cardDefaults' | 'extensions' | 'attachmentLimits'>;
|
|
133
|
+
export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'extensionsRevision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'cardDefaults' | 'extensions' | 'attachmentLimits'>;
|
|
134
134
|
/** Immutable controller snapshot for UI subscriptions. */
|
|
135
135
|
export interface ControllerSnapshot {
|
|
136
136
|
tasks: readonly TaskRecord[];
|
|
@@ -28,6 +28,12 @@ export declare const TASK_BOARD_DETAIL_SECTION = "task-board.detail.section";
|
|
|
28
28
|
export declare const TASK_BOARD_SETTINGS_SECTION = "task-board.settings.section";
|
|
29
29
|
/** Child seat a provider registers its card decoration into. */
|
|
30
30
|
export declare const TASK_BOARD_CARD_DECORATION = "task-board.card.decoration";
|
|
31
|
+
/**
|
|
32
|
+
* Child seat a provider registers its new-card section into: its own
|
|
33
|
+
* create-time configuration, rendered inside the create dialog's execution
|
|
34
|
+
* settings, whose draft the board stores on the card it creates.
|
|
35
|
+
*/
|
|
36
|
+
export declare const TASK_BOARD_COMPOSE_SECTION = "task-board.compose.section";
|
|
31
37
|
/** Every child seat the board declares for extensions, in render order. */
|
|
32
38
|
export declare const TASK_BOARD_EXTENSION_SEATS: readonly string[];
|
|
33
39
|
/**
|
|
@@ -195,6 +201,87 @@ export interface TaskBoardSessionsFace {
|
|
|
195
201
|
*/
|
|
196
202
|
followUp(taskId: string, text: string): Promise<void>;
|
|
197
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Why the board is opening a run. The four entries reach the launch path from
|
|
206
|
+
* different places and a provider may want to answer only some of them: the
|
|
207
|
+
* board's own run action ({@link 'manual'}), a settled card sent back to run
|
|
208
|
+
* again ({@link 'rerun'}), an armed schedule ({@link 'schedule'}), and the
|
|
209
|
+
* `task_board_run` model-visible tool ({@link 'tool'}).
|
|
210
|
+
*
|
|
211
|
+
* A rework arrives as `manual`: it is the same human entry point, opening a
|
|
212
|
+
* run in the card's own conversation rather than a fresh one.
|
|
213
|
+
*/
|
|
214
|
+
export type TaskBoardLaunchTrigger = 'manual' | 'rerun' | 'schedule' | 'tool';
|
|
215
|
+
/** Context of one launch the board is about to open. */
|
|
216
|
+
export interface TaskBoardLaunchContext {
|
|
217
|
+
/** Which entry asked for this run. */
|
|
218
|
+
trigger: TaskBoardLaunchTrigger;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* What a launch handler decided for one run.
|
|
222
|
+
*
|
|
223
|
+
* `local` keeps the board's own execution and only adds context, so a provider
|
|
224
|
+
* that runs a card through an ordinary session (a session told to drive
|
|
225
|
+
* something else, for instance) reads exactly the launch the board would have
|
|
226
|
+
* made. `external` hands the whole run to the provider: the board opens no
|
|
227
|
+
* session and writes no execution record.
|
|
228
|
+
*/
|
|
229
|
+
export type TaskBoardLaunchDecision =
|
|
230
|
+
/**
|
|
231
|
+
* Run the card locally through the board's own session, with `promptPreamble`
|
|
232
|
+
* injected ahead of the card's prompt on the same path the board's tag
|
|
233
|
+
* prompts take. A blank preamble injects nothing.
|
|
234
|
+
*/
|
|
235
|
+
{
|
|
236
|
+
kind: 'local';
|
|
237
|
+
promptPreamble?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The provider takes this run over. The board creates no session and records
|
|
241
|
+
* no execution; it only moves the card into the running column, which is
|
|
242
|
+
* already the board's own way of saying work is under way outside a Host-run
|
|
243
|
+
* session. The provider closes the card through the existing
|
|
244
|
+
* `record-external-outcome` action once its own run settles.
|
|
245
|
+
*/
|
|
246
|
+
| {
|
|
247
|
+
kind: 'external';
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The provider refuses this run. The board opens nothing, writes nothing and
|
|
251
|
+
* answers the caller with `code: reason`, so a second run request against a
|
|
252
|
+
* card the provider already holds is an explicit refusal rather than a
|
|
253
|
+
* silent overwrite. A scheduled occurrence is skipped instead of thrown.
|
|
254
|
+
*/
|
|
255
|
+
| {
|
|
256
|
+
kind: 'refuse';
|
|
257
|
+
code: string;
|
|
258
|
+
reason: string;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Decide whether one launch belongs to the provider, and how it runs.
|
|
262
|
+
* @param task - the card about to run.
|
|
263
|
+
* @param context - which entry asked for this run.
|
|
264
|
+
* @returns a decision, or undefined to leave the run to the board unchanged.
|
|
265
|
+
*/
|
|
266
|
+
export type TaskBoardLaunchHandler = (task: TaskRecord, context: TaskBoardLaunchContext) => TaskBoardLaunchDecision | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Launch interception: the seam through which a provider takes a run over.
|
|
269
|
+
*
|
|
270
|
+
* The board consults the registered handlers at its single launch gate — before
|
|
271
|
+
* any session exists and before any execution record is written — for every
|
|
272
|
+
* trigger. Handlers run in registration order and the first one that answers
|
|
273
|
+
* anything other than undefined decides that launch. A handler that throws is
|
|
274
|
+
* isolated and treated as undefined, so a broken provider costs one run's
|
|
275
|
+
* interception and never the launch itself.
|
|
276
|
+
*/
|
|
277
|
+
export interface TaskBoardLaunchFace {
|
|
278
|
+
/**
|
|
279
|
+
* Register one launch handler. The returned disposer unregisters it, and the
|
|
280
|
+
* handler is released with the extension's own stop, so a switched-off
|
|
281
|
+
* provider is never consulted.
|
|
282
|
+
*/
|
|
283
|
+
intercept(handler: TaskBoardLaunchHandler): () => void;
|
|
284
|
+
}
|
|
198
285
|
/** Storage face for one extension's own payload on a task. */
|
|
199
286
|
export interface TaskBoardIntegrationFace {
|
|
200
287
|
/** Read this extension's payload, or undefined when the task carries none. */
|
|
@@ -247,6 +334,14 @@ export interface TaskBoardExtensionHost {
|
|
|
247
334
|
* probes the face and keeps working against a board that serves none.
|
|
248
335
|
*/
|
|
249
336
|
sessions?: TaskBoardSessionsFace;
|
|
337
|
+
/**
|
|
338
|
+
* Launch interception: the provider decides, per run, whether the board's own
|
|
339
|
+
* session launches it or whether this provider takes the run over. Optional
|
|
340
|
+
* on the same terms as {@link TaskBoardExtensionHost.sessions} — the API
|
|
341
|
+
* version stays 1, so a provider probes the face before using it, and a board
|
|
342
|
+
* that serves no launch gate keeps launching every card itself.
|
|
343
|
+
*/
|
|
344
|
+
launch?: TaskBoardLaunchFace;
|
|
250
345
|
integration: TaskBoardIntegrationFace;
|
|
251
346
|
events: TaskBoardEventFace;
|
|
252
347
|
/**
|
|
@@ -271,6 +366,20 @@ export interface TaskBoardExtension {
|
|
|
271
366
|
stop?(): void;
|
|
272
367
|
/** Route one dispatched action; the returned value goes back to the dispatcher. */
|
|
273
368
|
handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>;
|
|
369
|
+
/**
|
|
370
|
+
* Model-facing summary of one card this provider owns, merged into the card
|
|
371
|
+
* the `task_board_get` / `task_board_list` tools return under `remote`. An
|
|
372
|
+
* object may carry `localPermission: false` to say the board's local session
|
|
373
|
+
* permission gate does not apply to the card, which drops `permissionPending`
|
|
374
|
+
* from the tool output. Optional: the API version stays 1.
|
|
375
|
+
*/
|
|
376
|
+
describeTask?(task: TaskRecord): Record<string, unknown> | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* The handle of the run the provider took over for `taskId`, read right after
|
|
379
|
+
* `task_board_run` so the caller gets identifiers instead of an empty list.
|
|
380
|
+
* Optional on the same terms as {@link TaskBoardExtension.describeTask}.
|
|
381
|
+
*/
|
|
382
|
+
describeRun?(taskId: string): Record<string, unknown> | undefined;
|
|
274
383
|
}
|
|
275
384
|
/** Board mirror an extension's browser half observes. */
|
|
276
385
|
export interface TaskBoardClientMirror {
|
|
@@ -280,6 +389,19 @@ export interface TaskBoardClientMirror {
|
|
|
280
389
|
tasks: readonly TaskRecord[];
|
|
281
390
|
/** Published extension summaries, keyed by extension id (opaque to the board). */
|
|
282
391
|
extensions: Readonly<Record<string, unknown>>;
|
|
392
|
+
/**
|
|
393
|
+
* Whether at least one authoritative Host snapshot has arrived in this page.
|
|
394
|
+
* Absent on older boards or test mirrors; false while `/bootstrap` is still
|
|
395
|
+
* in flight, so providers do not misread an initial empty `{}` as unmounted.
|
|
396
|
+
*/
|
|
397
|
+
hydrated?: boolean;
|
|
398
|
+
/** Local workspaces registered in the runtime, for provider workspace pickers. */
|
|
399
|
+
workspaces?: readonly {
|
|
400
|
+
workspaceId: string;
|
|
401
|
+
title: string;
|
|
402
|
+
}[];
|
|
403
|
+
/** Last Host transport refusal message (e.g. a refused extension action), when any. */
|
|
404
|
+
lastError?: string;
|
|
283
405
|
}
|
|
284
406
|
/** Whether a task should be shown on the board; false hides it. */
|
|
285
407
|
export type TaskBoardVisibilityPredicate = (task: TaskRecord) => boolean;
|
|
@@ -325,6 +447,38 @@ export interface TaskBoardSettingsSectionProps {
|
|
|
325
447
|
export interface TaskBoardCardDecorationProps {
|
|
326
448
|
task: TaskRecord;
|
|
327
449
|
}
|
|
450
|
+
/** Optional metadata a provider reports alongside its new-card draft. */
|
|
451
|
+
export interface TaskBoardComposeDraftOptions {
|
|
452
|
+
/** One-line label included in the collapsed Run Mode summary. */
|
|
453
|
+
summary?: string;
|
|
454
|
+
/**
|
|
455
|
+
* Validation blocker message: while non-empty, the create dialog refuses to
|
|
456
|
+
* submit or run locally and forces the Run Mode section open.
|
|
457
|
+
*/
|
|
458
|
+
error?: string;
|
|
459
|
+
}
|
|
460
|
+
/** Owner props of the new-card compose seat. */
|
|
461
|
+
export interface TaskBoardComposeSectionProps {
|
|
462
|
+
/**
|
|
463
|
+
* Report the draft this provider wants written into the new card's
|
|
464
|
+
* `integrations` under `extensionId` — that is, what the board stores when
|
|
465
|
+
* the create dialog is submitted. The id is the provider's own extension id,
|
|
466
|
+
* the same key its payload lives under on every other card; a later call for
|
|
467
|
+
* the same id replaces the earlier draft instead of merging with it, and
|
|
468
|
+
* `undefined` withdraws it, so a provider that clears its picker leaves no
|
|
469
|
+
* entry behind. The draft stands until the dialog submits or its provider
|
|
470
|
+
* replaces or withdraws it, because collapsing the region that holds the seat
|
|
471
|
+
* must never discard a choice already made. The board never interprets the
|
|
472
|
+
* payload: a draft that is not a plain JSON object or that exceeds
|
|
473
|
+
* {@link TASK_BOARD_PAYLOAD_LIMIT_BYTES} is dropped from the card being
|
|
474
|
+
* created and named in one warning, and the create itself still happens.
|
|
475
|
+
*/
|
|
476
|
+
contribute(extensionId: string, payload: TaskBoardExtensionPayload | undefined, options?: TaskBoardComposeDraftOptions): void;
|
|
477
|
+
/** Initial integrations of the source card when duplicating an existing card. */
|
|
478
|
+
initialIntegrations?: Readonly<Record<string, unknown>>;
|
|
479
|
+
/** Incremented each time the user submits the dialog, so providers can reveal untouched field errors. */
|
|
480
|
+
submitAttempt?: number;
|
|
481
|
+
}
|
|
328
482
|
/**
|
|
329
483
|
* Host-half service face published under {@link TASK_BOARD_SERVICE_NAME}. A
|
|
330
484
|
* provider package's host half resolves this from the shared cordis service
|
|
@@ -357,8 +511,13 @@ export interface TaskBoardHostFace {
|
|
|
357
511
|
* retries one envelope does not apply it twice. Refusals are the ledger's:
|
|
358
512
|
* they throw with the Host's own text, which is why this face adds no code
|
|
359
513
|
* table of its own.
|
|
514
|
+
*
|
|
515
|
+
* `trigger` says which entry asked for a run, when the caller knows better
|
|
516
|
+
* than the board's default: the `task_board_run` tool passes `tool` so a
|
|
517
|
+
* launch handler can tell an agent's run from a person's. Only a `run` action
|
|
518
|
+
* reads it — `rerun`, `rework` and the human run path are their own triggers.
|
|
360
519
|
*/
|
|
361
|
-
apply(requestId: string, action: TaskBoardAction, initiator?: string): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
|
|
520
|
+
apply(requestId: string, action: TaskBoardAction, initiator?: string, trigger?: TaskBoardLaunchTrigger): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
|
|
362
521
|
/**
|
|
363
522
|
* Follow the board's change notifications. The listener receives no payload —
|
|
364
523
|
* a consumer that needs the state reads {@link snapshot} — and the returned
|
|
@@ -4,27 +4,60 @@
|
|
|
4
4
|
* unit-testable without a gateway.
|
|
5
5
|
*/
|
|
6
6
|
import type { TaskRecord } from './tasks.ts';
|
|
7
|
+
/** Everything the reuse rule reads beyond the card's own execution history. */
|
|
8
|
+
export interface ReuseOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Continue the settled session regardless of the card's own `reuseSession`
|
|
11
|
+
* opt-in. A rework is exactly that case: the reviewer read the previous run's
|
|
12
|
+
* session and sent it back. The force waives the opt-in, never the evidence.
|
|
13
|
+
*/
|
|
14
|
+
force?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The Workspace registry's global archive set (issue #2068).
|
|
17
|
+
*
|
|
18
|
+
* A Session in that set can never run a turn: the Host's archived-session
|
|
19
|
+
* gate rejects its first step before any model request is issued, so a
|
|
20
|
+
* launch that prompts into one settles as the opaque failure `agent turn
|
|
21
|
+
* ended without completing: blocked`. A card that keeps one conversation may
|
|
22
|
+
* still lose it to a bulk archive of the sidebar, and every later scheduled
|
|
23
|
+
* run would fail there, so reuse has to step aside instead of dying.
|
|
24
|
+
*
|
|
25
|
+
* Absent means this deployment's registry face cannot report an archive set.
|
|
26
|
+
* That is unknown evidence, never proof that nothing is archived: the rule
|
|
27
|
+
* then keeps its pre-archive-set behavior instead of inventing a refusal,
|
|
28
|
+
* because a registry face without the getter serves no archive action for the
|
|
29
|
+
* board to defend against.
|
|
30
|
+
*/
|
|
31
|
+
archivedSessionIds?: ReadonlySet<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The session the newest settled execution ran in, or undefined when no
|
|
35
|
+
* execution carries one.
|
|
36
|
+
*
|
|
37
|
+
* The launch path calls the reuse rule after `startExecution` appended this
|
|
38
|
+
* run's own open record, so the array tail is always an unsettled row at that
|
|
39
|
+
* point and the scan has to skip it (issue #1587).
|
|
40
|
+
* @param task - the task whose history is read.
|
|
41
|
+
* @returns the newest settled session id, if any.
|
|
42
|
+
*/
|
|
43
|
+
export declare function newestSettledSessionId(task: TaskRecord): string | undefined;
|
|
7
44
|
/**
|
|
8
45
|
* Pick the session a new execution of this task may continue in, or undefined
|
|
9
46
|
* to mint a fresh conversation. Reuse requires ALL of:
|
|
10
|
-
* - the task opted in (`reuseSession === true`);
|
|
11
|
-
* - the task's newest
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* - the roster is known and that session is present and idle.
|
|
47
|
+
* - the task opted in (`reuseSession === true`) unless the caller forces it;
|
|
48
|
+
* - the task's newest settled execution carries a session id (issue #1587);
|
|
49
|
+
* - the roster is known and that session is present and idle;
|
|
50
|
+
* - that session is not archived, when the deployment reports an archive set
|
|
51
|
+
* (issue #2068).
|
|
16
52
|
*
|
|
17
53
|
* An unknown roster (session/list unavailable) never reuses: minting a fresh
|
|
18
54
|
* conversation is always safe, prompting into a session we cannot see is not.
|
|
55
|
+
* An archived session is refused for the same reason — the Host will not run a
|
|
56
|
+
* turn in it, so continuing there can only fail the run that tried.
|
|
19
57
|
* @param task - the task about to run.
|
|
20
58
|
* @param idleSessionIds - ids the last roster saw as present and not running;
|
|
21
59
|
* undefined when that roster is unknown.
|
|
22
|
-
* @param options
|
|
23
|
-
* own `reuseSession` opt-in. A rework is exactly that case: the reviewer read
|
|
24
|
-
* the previous run's session and sent it back. Every condition above still
|
|
25
|
-
* applies — the force waives the opt-in, never the evidence.
|
|
60
|
+
* @param options - force and the archive set; see {@link ReuseOptions}.
|
|
26
61
|
* @returns the session id to continue in, or undefined for a fresh session.
|
|
27
62
|
*/
|
|
28
|
-
export declare function reusableSessionId(task: TaskRecord, idleSessionIds: ReadonlySet<string> | undefined, options?:
|
|
29
|
-
force?: boolean;
|
|
30
|
-
}): string | undefined;
|
|
63
|
+
export declare function reusableSessionId(task: TaskRecord, idleSessionIds: ReadonlySet<string> | undefined, options?: ReuseOptions): string | undefined;
|
|
@@ -24,8 +24,11 @@ export type ExecutionOutcome = 'succeeded' | 'failed' | 'cancelled';
|
|
|
24
24
|
export interface ExecutionSummary {
|
|
25
25
|
/** Last assistant message text of the run, bounded by {@link EXECUTION_SUMMARY_LIMIT}. */
|
|
26
26
|
text: string;
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Seq of the session event that text came from. Absent on an external run's
|
|
29
|
+
* conclusion, which was never read out of a Host session.
|
|
30
|
+
*/
|
|
31
|
+
seq?: number;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* Upper bound of one recorded summary, in characters. The ledger stores a
|
|
@@ -62,8 +65,16 @@ export interface ExecutionRecord {
|
|
|
62
65
|
endedAt: number | undefined;
|
|
63
66
|
/** Outcome once settled. */
|
|
64
67
|
result: ExecutionOutcome | undefined;
|
|
65
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Human failure text when the run failed (prompt rejection or agent error).
|
|
70
|
+
* Only a failure writes it: an external run's success conclusion rides
|
|
71
|
+
* {@link ExecutionRecord.summary}.
|
|
72
|
+
*/
|
|
66
73
|
error: string | undefined;
|
|
74
|
+
/** Stable machine-readable failure code a provider reported with the verdict. */
|
|
75
|
+
errorCode?: string;
|
|
76
|
+
/** One line telling the caller whether and how to retry a failed external run. */
|
|
77
|
+
retryHint?: string;
|
|
67
78
|
/**
|
|
68
79
|
* Session id of the DSH session that issued the run/rerun action (issue #6
|
|
69
80
|
* audit origin). Client-asserted, not a trust boundary; absent when the run
|
|
@@ -381,8 +392,8 @@ export interface TaskRecord {
|
|
|
381
392
|
* Whether later executions continue in the previous execution's session
|
|
382
393
|
* (issue #1419) instead of minting a fresh conversation per run. Absent or
|
|
383
394
|
* false keeps the historical one-session-per-execution behavior; the reuse
|
|
384
|
-
* itself only happens when that session is idle
|
|
385
|
-
* {@link reusableSessionId}).
|
|
395
|
+
* itself only happens when that session is idle, still present, and not
|
|
396
|
+
* archived (issue #2068; see {@link reusableSessionId}).
|
|
386
397
|
*/
|
|
387
398
|
reuseSession?: boolean;
|
|
388
399
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
import { type TaskRecord } from '../core/tasks.ts';
|
|
2
3
|
import type { TaskBoardAction, TaskBoardSnapshot } from '../protocol.ts';
|
|
4
|
+
import type { TaskBoardLaunchTrigger } from '../core/extension.ts';
|
|
3
5
|
/**
|
|
4
6
|
* The narrow Host face the tools need. TaskBoardHostService satisfies it
|
|
5
7
|
* structurally, so tests and a future host can drive the same surface.
|
|
@@ -7,8 +9,16 @@ import type { TaskBoardAction, TaskBoardSnapshot } from '../protocol.ts';
|
|
|
7
9
|
export interface TaskBoardToolHost {
|
|
8
10
|
/** Current board snapshot (tasks + scheduler + power + deployment constants). */
|
|
9
11
|
snapshot(): TaskBoardSnapshot;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Submit one confirmed Host action; returns the resulting snapshot. `trigger`
|
|
14
|
+
* names the entry that asked for a run when the tool knows it is the tool, so
|
|
15
|
+
* a provider's launch handler can tell an agent's run from a person's.
|
|
16
|
+
*/
|
|
17
|
+
apply(requestId: string, action: TaskBoardAction, initiator?: string, trigger?: TaskBoardLaunchTrigger): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
|
|
18
|
+
/** What running providers say about one card, keyed by extension id (optional). */
|
|
19
|
+
describeTask?(task: TaskRecord): Record<string, Record<string, unknown>> | undefined;
|
|
20
|
+
/** The run handle a provider holds for one card, keyed by extension id (optional). */
|
|
21
|
+
describeRun?(taskId: string): Record<string, Record<string, unknown>> | undefined;
|
|
12
22
|
}
|
|
13
23
|
/** Registered tool names, in registration order. */
|
|
14
24
|
export declare const TASK_BOARD_TOOL_NAMES: readonly ["task_board_list", "task_board_get", "task_board_create", "task_board_update", "task_board_set_parent", "task_board_run", "task_board_manage", "task_board_schedule"];
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
13
13
|
import type { HostTaskLedger } from '../host-ledger.ts';
|
|
14
14
|
import type { TaskBoardAction, TaskBoardSnapshot } from '../protocol.ts';
|
|
15
|
-
import { type TaskBoardExecutionSettledEvent, type TaskBoardExtension, type TaskBoardExtensionActionRequest, type TaskBoardExtensionPayload, type TaskBoardStatusChangedEvent, type TaskBoardTaskDeletedEvent } from '../core/extension.ts';
|
|
15
|
+
import { type TaskBoardExecutionSettledEvent, type TaskBoardExtension, type TaskBoardExtensionActionRequest, type TaskBoardExtensionPayload, type TaskBoardLaunchContext, type TaskBoardLaunchDecision, type TaskBoardStatusChangedEvent, type TaskBoardTaskDeletedEvent } from '../core/extension.ts';
|
|
16
|
+
import { type TaskRecord } from '../core/tasks.ts';
|
|
16
17
|
/** Diagnosable refusal raised by the registry and the capability face. */
|
|
17
18
|
export declare class TaskBoardExtensionError extends Error {
|
|
18
19
|
readonly code: string;
|
|
@@ -52,6 +53,8 @@ export interface TaskBoardExtensionRegistryOptions {
|
|
|
52
53
|
rework?: TaskBoardReworkApplier;
|
|
53
54
|
/** Resolve the deployment's tool registry; absent loses the tool surface only. */
|
|
54
55
|
toolRegistry?: () => TaskBoardExtensionToolRegistry | undefined;
|
|
56
|
+
/** Notified whenever a provider publishes, changes, or withdraws its summary. */
|
|
57
|
+
onPublished?: () => void;
|
|
55
58
|
now?: () => number;
|
|
56
59
|
uuid?: () => string;
|
|
57
60
|
logger?: TaskBoardExtensionLogger;
|
|
@@ -66,10 +69,14 @@ export declare class TaskBoardExtensionRegistry {
|
|
|
66
69
|
private readonly uuid;
|
|
67
70
|
private readonly logger;
|
|
68
71
|
private toolResolver;
|
|
72
|
+
private readonly onPublished;
|
|
73
|
+
private publishedVersionCounter;
|
|
69
74
|
/** Board master switch (enabled config); providers start only while it is on. */
|
|
70
75
|
private boardEnabled;
|
|
71
76
|
private disposed;
|
|
72
77
|
constructor(options: TaskBoardExtensionRegistryOptions);
|
|
78
|
+
/** Monotonic revision of the published extension summaries map. */
|
|
79
|
+
get publishedRevision(): number;
|
|
73
80
|
/**
|
|
74
81
|
* Pin (or replace) the deployment's tool registry. A registry that appears
|
|
75
82
|
* after a provider started is picked up here, which is what keeps the tool
|
|
@@ -96,6 +103,30 @@ export declare class TaskBoardExtensionRegistry {
|
|
|
96
103
|
* unknown, currently gated off, or does not implement the action.
|
|
97
104
|
*/
|
|
98
105
|
handleAction(request: TaskBoardExtensionActionRequest): Promise<unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* The board's single launch gate: ask every running provider whether this run
|
|
108
|
+
* is theirs.
|
|
109
|
+
*
|
|
110
|
+
* Consulted by the ledger at the one point every trigger passes — before a
|
|
111
|
+
* session exists and before an execution record is written — so the order
|
|
112
|
+
* here is the only ordering a provider can observe: registration order, first
|
|
113
|
+
* decision wins. A handler that throws is isolated and treated as "not mine",
|
|
114
|
+
* exactly as if it had answered undefined, because a provider's bug must cost
|
|
115
|
+
* its own interception and never the launch. Without a registered handler
|
|
116
|
+
* this answers nothing at all and the launch path is untouched.
|
|
117
|
+
* @param task - the card about to run.
|
|
118
|
+
* @param context - which entry asked for this run.
|
|
119
|
+
* @returns the first decision a running provider made, or undefined.
|
|
120
|
+
*/
|
|
121
|
+
interceptLaunch(task: TaskRecord, context: TaskBoardLaunchContext): TaskBoardLaunchDecision | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* What the running providers say about one card, keyed by extension id.
|
|
124
|
+
* Isolated per provider: a throw drops that provider's entry only.
|
|
125
|
+
*/
|
|
126
|
+
describeTask(task: TaskRecord): Record<string, Record<string, unknown>> | undefined;
|
|
127
|
+
/** The run handle a running provider holds for one card, keyed by extension id. */
|
|
128
|
+
describeRun(taskId: string): Record<string, Record<string, unknown>> | undefined;
|
|
129
|
+
private describe;
|
|
99
130
|
/** Published summaries of currently running providers, keyed by extension id. */
|
|
100
131
|
published(): Record<string, TaskBoardExtensionPayload>;
|
|
101
132
|
/** Fan a status change out to every running provider, isolated per callback. */
|
|
@@ -147,5 +178,11 @@ export declare class TaskBoardExtensionRegistry {
|
|
|
147
178
|
private linkedTasks;
|
|
148
179
|
private writeIntegration;
|
|
149
180
|
private publish;
|
|
181
|
+
/**
|
|
182
|
+
* Hold one launch handler for a running provider. The handler is dropped when
|
|
183
|
+
* the provider stops or is unregistered, so the disposer only has to cover the
|
|
184
|
+
* provider's own early withdrawal.
|
|
185
|
+
*/
|
|
186
|
+
private addLaunchHandler;
|
|
150
187
|
private registerTool;
|
|
151
188
|
}
|