@fish-under-sea/dsh-client-ui-task-board-fish 2.2.2 → 2.3.0

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.
Files changed (104) hide show
  1. package/README.en.md +4 -4
  2. package/package.json +5 -4
  3. package/README.i18n.yaml +0 -6
  4. package/README.md +0 -31
  5. package/README.zh.md +0 -31
  6. package/lib/client.js +0 -15861
  7. package/lib/client.js.map +0 -1
  8. package/lib/index.js +0 -12653
  9. package/lib/types/client/CardDefaultPresetField.d.ts +0 -35
  10. package/lib/types/client/PluginSettingsCard.d.ts +0 -255
  11. package/lib/types/client/RangeBubble.d.ts +0 -46
  12. package/lib/types/client/SegmentGroup.d.ts +0 -28
  13. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -155
  14. package/lib/types/client/apply-guard.d.ts +0 -25
  15. package/lib/types/client/board/AttachmentField.d.ts +0 -70
  16. package/lib/types/client/board/ClampedMarkdown.d.ts +0 -3
  17. package/lib/types/client/board/ConfirmDialog.d.ts +0 -15
  18. package/lib/types/client/board/EditTaskModal.d.ts +0 -17
  19. package/lib/types/client/board/ExecutionLog.d.ts +0 -24
  20. package/lib/types/client/board/LinkSubtaskModal.d.ts +0 -14
  21. package/lib/types/client/board/NewTaskModal.d.ts +0 -26
  22. package/lib/types/client/board/ReasoningEffortField.d.ts +0 -25
  23. package/lib/types/client/board/TagManagerModal.d.ts +0 -26
  24. package/lib/types/client/board/TaskBoard.d.ts +0 -26
  25. package/lib/types/client/board/TaskCard.d.ts +0 -36
  26. package/lib/types/client/board/TaskDetail.d.ts +0 -9
  27. package/lib/types/client/board/TaskForm.d.ts +0 -76
  28. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  29. package/lib/types/client/board/card-view.d.ts +0 -113
  30. package/lib/types/client/board/icons.d.ts +0 -32
  31. package/lib/types/client/board/model-options.d.ts +0 -87
  32. package/lib/types/client/board/overlay.d.ts +0 -69
  33. package/lib/types/client/board/parse-model-pref.d.ts +0 -4
  34. package/lib/types/client/board/preset-label.d.ts +0 -43
  35. package/lib/types/client/board/preset-roster.d.ts +0 -45
  36. package/lib/types/client/board/source-group.d.ts +0 -27
  37. package/lib/types/client/board/status-key.d.ts +0 -19
  38. package/lib/types/client/board/task-markdown.d.ts +0 -19
  39. package/lib/types/client/body-mutations.d.ts +0 -45
  40. package/lib/types/client/host-api.d.ts +0 -88
  41. package/lib/types/client/index.d.ts +0 -128
  42. package/lib/types/client/locales.d.ts +0 -521
  43. package/lib/types/client/main-session.d.ts +0 -32
  44. package/lib/types/client/native-panel.d.ts +0 -48
  45. package/lib/types/client/pending-verify.d.ts +0 -47
  46. package/lib/types/client/plugin-card-seat.d.ts +0 -110
  47. package/lib/types/client/schedule-presets.d.ts +0 -10
  48. package/lib/types/client/schedule-zone.d.ts +0 -97
  49. package/lib/types/client/seats.d.ts +0 -18
  50. package/lib/types/client/service.d.ts +0 -35
  51. package/lib/types/client/settings-entry-form.d.ts +0 -49
  52. package/lib/types/client/settings-form.d.ts +0 -235
  53. package/lib/types/core/attachment.d.ts +0 -132
  54. package/lib/types/core/card-defaults.d.ts +0 -78
  55. package/lib/types/core/controller.d.ts +0 -422
  56. package/lib/types/core/degraded-reason.d.ts +0 -46
  57. package/lib/types/core/execution-summary.d.ts +0 -52
  58. package/lib/types/core/extension.d.ts +0 -399
  59. package/lib/types/core/freeze-snapshot.d.ts +0 -71
  60. package/lib/types/core/handover.d.ts +0 -70
  61. package/lib/types/core/issue-form.d.ts +0 -16
  62. package/lib/types/core/launch-width.d.ts +0 -31
  63. package/lib/types/core/package-name.d.ts +0 -9
  64. package/lib/types/core/poll-cadence.d.ts +0 -31
  65. package/lib/types/core/reasoning-effort.d.ts +0 -57
  66. package/lib/types/core/schedule.d.ts +0 -124
  67. package/lib/types/core/session-reuse.d.ts +0 -30
  68. package/lib/types/core/spend-budget.d.ts +0 -28
  69. package/lib/types/core/store.d.ts +0 -64
  70. package/lib/types/core/subtask.d.ts +0 -204
  71. package/lib/types/core/tasks.d.ts +0 -685
  72. package/lib/types/core/use-cases/task-archive.d.ts +0 -20
  73. package/lib/types/core/use-cases/task-create.d.ts +0 -32
  74. package/lib/types/core/use-cases/task-delete.d.ts +0 -27
  75. package/lib/types/core/use-cases/task-parent.d.ts +0 -21
  76. package/lib/types/core/use-cases/task-schedule.d.ts +0 -96
  77. package/lib/types/core/use-cases/task-tag.d.ts +0 -84
  78. package/lib/types/core/use-cases/task-update.d.ts +0 -77
  79. package/lib/types/core/verification-budget.d.ts +0 -52
  80. package/lib/types/core/verification.d.ts +0 -753
  81. package/lib/types/core/wire-projection.d.ts +0 -35
  82. package/lib/types/core/workspace-target.d.ts +0 -61
  83. package/lib/types/dsh-home.d.ts +0 -16
  84. package/lib/types/host/agent-tools.d.ts +0 -27
  85. package/lib/types/host/attachments.d.ts +0 -250
  86. package/lib/types/host/extension-registry.d.ts +0 -151
  87. package/lib/types/host/launch-admission.d.ts +0 -71
  88. package/lib/types/host/llm-dispatch.d.ts +0 -63
  89. package/lib/types/host/verification-gate.d.ts +0 -95
  90. package/lib/types/host/verification-runner.d.ts +0 -139
  91. package/lib/types/host/workspace-evidence.d.ts +0 -53
  92. package/lib/types/host-ai.d.ts +0 -51
  93. package/lib/types/host-ledger.d.ts +0 -452
  94. package/lib/types/host-routes.d.ts +0 -99
  95. package/lib/types/host-runner.d.ts +0 -401
  96. package/lib/types/host-service.d.ts +0 -517
  97. package/lib/types/host-spend.d.ts +0 -52
  98. package/lib/types/http.d.ts +0 -59
  99. package/lib/types/index.d.ts +0 -441
  100. package/lib/types/loopback.d.ts +0 -64
  101. package/lib/types/mount-once.d.ts +0 -55
  102. package/lib/types/power-inhibitor.d.ts +0 -73
  103. package/lib/types/protocol.d.ts +0 -253
  104. package/lib/types/tool-surface.d.ts +0 -72
@@ -1,35 +0,0 @@
1
- /**
2
- * What an extension's `integrations` container looks like once it leaves the
3
- * Host.
4
- *
5
- * The container is provider-owned and crosses the board unread, and it also
6
- * crosses the wire: the HTTP snapshot, every action answer, and the remote
7
- * bridge's `board.snapshot` all carry it. A credential a provider stored there
8
- * would therefore reach every browser and phone paired to this Host. This
9
- * module is the one place that decides otherwise: the ledger keeps the payload
10
- * verbatim (the provider reads it back through its in-process capability face,
11
- * and a Host-side consumer reads the ledger itself), while the copy that leaves
12
- * carries no credential.
13
- *
14
- * @module dsh-task-board/core/wire-projection
15
- */
16
- import type { TaskBoardSnapshot } from '../protocol.ts';
17
- import type { TaskRecord } from './tasks.ts';
18
- /**
19
- * The card as the wire may show it: the ledger record with its integration
20
- * entries copied and stripped.
21
- *
22
- * A card that carries no integrations is returned untouched, so a provider that
23
- * stores nothing sees exactly the record the board has always published.
24
- * @param task - the ledger record about to be serialized.
25
- * @returns the projected record; the ledger object is never mutated.
26
- */
27
- export declare function projectTaskForWire(task: TaskRecord): TaskRecord;
28
- /**
29
- * The snapshot as every read path serializes it: the HTTP `state` answer, the
30
- * HTTP `action` answer, and the remote bridge's `board.snapshot` all start from
31
- * the object this returns.
32
- * @param snapshot - the snapshot the Host service built from its live state.
33
- * @returns the same snapshot with each card projected through {@link projectTaskForWire}.
34
- */
35
- export declare function projectSnapshotForWire(snapshot: TaskBoardSnapshot): TaskBoardSnapshot;
@@ -1,61 +0,0 @@
1
- /**
2
- * Workspace targeting for cards that pin none.
3
- *
4
- * The Host answers three questions here instead of leaving them to
5
- * `session.create`, whose own fallback is the Host process working directory
6
- * (the desktop app's profile directory): which workspace a root card inherits
7
- * from the session that created it, which workspace an unpinned run lands in
8
- * when nothing could be inherited, and — when neither names one — the refusal
9
- * that stops the run instead of landing it there.
10
- *
11
- * Structural types only — the Host's `Workspace` entity satisfies them — so the
12
- * browser program compiles this module without importing an SDK value.
13
- *
14
- * @module dsh-task-board/core/workspace-target
15
- */
16
- /** The workspace facts these rules read (a `Workspace` entity subset). */
17
- export interface WorkspaceCandidate {
18
- /** Stable workspace record id. */
19
- readonly id: string;
20
- /** ISO-8601 instant of the workspace's last durable mutation. */
21
- readonly updatedAt: string;
22
- /** Header-validated session ids the workspace owns, most recent first. */
23
- readonly sessionIds: readonly string[];
24
- }
25
- /**
26
- * The workspace that owns one session.
27
- * @param items - the deployment's workspaces.
28
- * @param sessionId - the session whose workspace is requested.
29
- * @returns the owning workspace id, or undefined when none claims the session.
30
- */
31
- export declare function workspaceOwningSession(items: readonly WorkspaceCandidate[], sessionId: string): string | undefined;
32
- /**
33
- * The workspace the board treats as most recently used: the one whose record
34
- * changed last. Attaching a session stamps that instant, so the newest stamp
35
- * tracks where the user most recently opened or resumed a session. The
36
- * deployment's own list order breaks ties, and a stamp that does not parse
37
- * never outranks one that does; a registry whose stamps are all unreadable
38
- * falls back to list order rather than to "no workspace at all".
39
- * @param items - the deployment's workspaces.
40
- * @returns the most recently used workspace id, or undefined when there is none.
41
- */
42
- export declare function mostRecentWorkspaceId(items: readonly WorkspaceCandidate[]): string | undefined;
43
- /**
44
- * The failure text the Host records when a card names no workspace and the
45
- * deployment has none to resolve it to: the run is refused before any session
46
- * exists instead of letting `session.create` fall back to the Host process
47
- * working directory (the desktop app's profile directory), which is never the
48
- * project the user meant.
49
- *
50
- * A finished sentence rather than a code: the ledger stores it as the
51
- * execution's failure text, which the agent tools serve to a model and which
52
- * any client prints verbatim. It names the fix, not the mechanism.
53
- */
54
- export declare const MISSING_WORKSPACE_REASON = "this card pins no workspace; choose a workspace on the card before running";
55
- /**
56
- * Whether a recorded failure text is the missing-workspace refusal, which the
57
- * browser half renders in the reader's own language.
58
- * @param reason - the execution's recorded failure text.
59
- * @returns true when that run was refused for naming no workspace.
60
- */
61
- export declare function isMissingWorkspaceReason(reason: string): boolean;
@@ -1,16 +0,0 @@
1
- /**
2
- * DSH_HOME resolution shared by the plugin family's Host halves: the
3
- * environment override wins, the platform home fallback follows. Mirrors
4
- * what dsh-pet and dsh-liangshen each used to implement locally.
5
- */
6
- /** Expand a leading ~ (or ~user) in a path, platform-style. */
7
- export declare function expandHome(path: string, home?: string): string;
8
- /**
9
- * Resolve the DSH home directory.
10
- * @param env - process environment to read DSH_HOME from.
11
- * @param home - platform home directory fallback (test seam).
12
- * @returns the absolute DSH home path.
13
- */
14
- export declare function resolveDshHome(env?: NodeJS.ProcessEnv, home?: string): string;
15
- /** Resolve the DSH home directory from the live environment. */
16
- export declare function dshHome(): string;
@@ -1,27 +0,0 @@
1
- import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
2
- import type { TaskBoardAction, TaskBoardSnapshot } from '../protocol.ts';
3
- /**
4
- * The narrow Host face the tools need. TaskBoardHostService satisfies it
5
- * structurally, so tests and a future host can drive the same surface.
6
- */
7
- export interface TaskBoardToolHost {
8
- /** Current board snapshot (tasks + scheduler + power + deployment constants). */
9
- snapshot(): TaskBoardSnapshot;
10
- /** Submit one confirmed Host action; returns the resulting snapshot. */
11
- apply(requestId: string, action: TaskBoardAction, initiator?: string): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
12
- }
13
- /** Registered tool names, in registration order. */
14
- 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"];
15
- /**
16
- * The calling session id, for the execution audit trail (the same stamp the
17
- * browser asserts). Absent when a call has no agent behind it.
18
- */
19
- export declare function callingSessionId(exec: {
20
- agent?: unknown;
21
- }): string | undefined;
22
- /**
23
- * Build every task-board tool bound to one Host service.
24
- * @param host - the Host ledger/service face (TaskBoardHostService).
25
- * @returns the tool definitions, in TASK_BOARD_TOOL_NAMES order.
26
- */
27
- export declare function buildTaskBoardTools(host: TaskBoardToolHost): ToolDefinition[];
@@ -1,250 +0,0 @@
1
- import type { IncomingMessage } from 'node:http';
2
- import type { FileAttachmentRef, ImageAttachmentRef, ImageMediaType, StoredImageAttachment } from '@deepseek-ai/dsh-attachment/types';
3
- import { type TaskAttachment, type TaskAttachmentKind } from '../core/attachment.ts';
4
- /**
5
- * The official attachment storage, narrowed to the members the board uses.
6
- *
7
- * The board declares the face structurally (like the other optional services
8
- * it resolves) so the Host half needs no value import of the SDK package: the
9
- * deployment's own attachment service provides it, and a deployment without
10
- * one simply refuses attachment work.
11
- */
12
- export interface TaskBoardAttachmentStore {
13
- /** Deployment-resolved image policy. */
14
- readonly imageLimits: {
15
- maxImageBytes: number;
16
- maxImagesPerMessage: number;
17
- maxMessageImageBytes: number;
18
- maxImagePixels: number;
19
- maxImageDimension: number;
20
- mediaTypes: readonly string[];
21
- };
22
- /** Validate one image without persisting it. */
23
- validateImage(input: {
24
- data: Uint8Array;
25
- mediaType: string;
26
- name?: string;
27
- }): Promise<void>;
28
- /** Validate and durably commit one image. */
29
- saveImage(input: {
30
- data: Uint8Array;
31
- mediaType: string;
32
- name?: string;
33
- }): Promise<ImageAttachmentRef>;
34
- /** Read one image and verify that the bytes still match the reference. */
35
- readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>;
36
- /** Durably commit one file byte-for-byte from bounded chunks. */
37
- saveFileStream(input: {
38
- data: AsyncIterable<Uint8Array>;
39
- signal?: AbortSignal;
40
- name?: string;
41
- }): Promise<FileAttachmentRef>;
42
- /** Read and verify one verbatim stored file as bounded chunks. */
43
- readFileStream(ref: FileAttachmentRef, signal?: AbortSignal): AsyncIterable<Uint8Array>;
44
- /** Locate the verbatim stored file object in the Host filesystem. */
45
- fileHostPath(ref: FileAttachmentRef): string | undefined;
46
- }
47
- /** The stable failure classes the attachment routes answer with. */
48
- export type TaskBoardAttachmentErrorCode = 'invalid-request' | 'unsupported-type' | 'too-large' | 'invalid-image' | 'storage-unavailable' | 'not-found' | 'unreadable';
49
- /**
50
- * One attachment failure, carrying the class the route maps to a status and a
51
- * message that never contains raw bytes or a host path.
52
- */
53
- export declare class TaskBoardAttachmentError extends Error {
54
- readonly code: TaskBoardAttachmentErrorCode;
55
- constructor(code: TaskBoardAttachmentErrorCode, message: string, options?: ErrorOptions);
56
- }
57
- /** The HTTP status one attachment failure class answers with. */
58
- export declare function attachmentErrorStatus(code: TaskBoardAttachmentErrorCode): number;
59
- /** Lowercase hex sha256 digest of the exact bytes. */
60
- export declare function sha256Hex(bytes: Uint8Array): string;
61
- /** Whether a value names one of the raster media types the image path accepts. */
62
- export declare function isImageMediaType(value: unknown): value is ImageMediaType;
63
- /**
64
- * Normalize a client-declared file media type: a well-formed type is kept
65
- * (lowercased), anything else falls back to the opaque binary type. The type
66
- * of a verbatim file is a declaration, not something the storage can prove.
67
- */
68
- export declare function normalizeFileMediaType(value: unknown): string;
69
- /**
70
- * The canonical display name of an upload.
71
- *
72
- * The Host publishes the canonical name, and the ledger stores the same
73
- * string: the wire gate accepts only a name that already IS canonical, so a
74
- * client cannot rename an object into something the storage never saw. The
75
- * canonical form is single-line and free of any path part, which is what
76
- * makes it safe to place in an execution prompt.
77
- */
78
- export declare function sanitizeAttachmentName(value: unknown): string;
79
- /**
80
- * The per-image byte cap this deployment enforces: the board's own ceiling
81
- * lowered by the storage's own policy when that policy is stricter.
82
- */
83
- export declare function effectiveImageByteLimit(store: TaskBoardAttachmentStore | undefined): number;
84
- /**
85
- * Read a whole request body, refusing it the moment it grows past the cap.
86
- * The count is the ACTUAL byte length of the stream, not a declared length.
87
- */
88
- export declare function readRequestBytes(req: IncomingMessage, limit: number): Promise<Uint8Array>;
89
- /**
90
- * A byte stream that measures and digests what it yields.
91
- *
92
- * The file path streams the request straight into the official storage: the
93
- * bytes are never collected in memory, and the count and digest the board
94
- * records are the ones computed from the bytes that actually went in.
95
- */
96
- export declare class MeasuredStream {
97
- private readonly limit;
98
- private readonly hash;
99
- private size;
100
- private finished;
101
- constructor(limit: number);
102
- /** The byte length seen so far. */
103
- get bytes(): number;
104
- /** The digest of the bytes seen so far; final once the stream ended. */
105
- digest(): string;
106
- /** Whether the whole stream was consumed. */
107
- get complete(): boolean;
108
- /** The chunks, refusing the stream the moment it grows past the cap. */
109
- chunks(source: AsyncIterable<Uint8Array>): AsyncGenerator<Uint8Array>;
110
- }
111
- /**
112
- * The request body as a byte stream: the file path hands it straight to the
113
- * official storage, so the bytes are never collected in memory.
114
- */
115
- export declare function requestChunks(req: IncomingMessage): AsyncIterable<Uint8Array>;
116
- /**
117
- * The image reference a recorded attachment stands for. The stored object is
118
- * addressed by its opaque identifier; the rest of the fields are the board's
119
- * own record of what the storage holds.
120
- */
121
- export declare function imageRefOf(attachment: TaskAttachment): ImageAttachmentRef;
122
- /** The file reference a recorded attachment stands for. */
123
- export declare function fileRefOf(attachment: TaskAttachment): FileAttachmentRef;
124
- /**
125
- * Publish one image into the official storage and describe it with
126
- * host-computed metadata.
127
- *
128
- * The image is validated before it is stored (the storage checks the decoded
129
- * bytes against the declared type), and the recorded digest is computed over
130
- * the NORMALIZED bytes the storage actually kept — not over what the client
131
- * sent — so the metadata and the object can never disagree.
132
- */
133
- export declare function storeImage(store: TaskBoardAttachmentStore, data: Uint8Array, name: string, mediaType: string): Promise<TaskAttachment>;
134
- /**
135
- * Publish one file into the official storage and describe it with
136
- * host-computed metadata. The digest is computed from the streamed bytes, so
137
- * the record and the stored object agree by construction.
138
- */
139
- export declare function storeFile(store: TaskBoardAttachmentStore, chunks: AsyncIterable<Uint8Array>, name: string, mediaType: string, signal?: AbortSignal): Promise<{
140
- attachment: TaskAttachment;
141
- bytes: number;
142
- sha256: string;
143
- }>;
144
- /**
145
- * Map an official attachment failure onto the board's own classes, so a
146
- * storage fault reads as "the storage is unavailable" and a rejected image
147
- * reads as "the image is not acceptable" — never as an internal error.
148
- */
149
- export declare function asAttachmentError(error: unknown): TaskBoardAttachmentError;
150
- /**
151
- * Prove every recorded attachment against the official storage: an image is
152
- * read back and compared, a file is streamed and its digest recomputed.
153
- *
154
- * A reference the storage does not know, and a record whose metadata does not
155
- * match the stored bytes, are both a refusal: the action never reaches the
156
- * ledger, so a spoofed client claim can never become a stored fact.
157
- */
158
- export declare function verifyAttachments(store: TaskBoardAttachmentStore, attachments: readonly TaskAttachment[]): Promise<void>;
159
- /**
160
- * The official image batch limits of a deployment: how many images one
161
- * message may carry and how many bytes they may add up to.
162
- *
163
- * The board's own caps (eight attachments, 10 MiB each, 32 MiB per card) stay
164
- * in force; the deployment's policy can only lower them, and it governs the
165
- * IMAGES of one card because that is what one prompt carries.
166
- */
167
- export declare function officialImageBatchLimits(store: TaskBoardAttachmentStore | undefined): {
168
- maxImages: number;
169
- maxImageBytes: number;
170
- maxMessageImageBytes: number;
171
- };
172
- /**
173
- * Refuse a card whose images exceed the deployment's per-message budget.
174
- *
175
- * The check counts only the images: plain files travel as paths and never
176
- * enter the prompt admission, so they are not part of that budget.
177
- * @param store - the official attachment storage.
178
- * @param attachments - the card's attachments.
179
- */
180
- export declare function assertImageBatchWithinLimits(store: TaskBoardAttachmentStore | undefined, attachments: readonly TaskAttachment[]): void;
181
- /** Read one image back and compare it with the recorded metadata. */
182
- export declare function verifyImage(store: TaskBoardAttachmentStore, attachment: TaskAttachment): Promise<void>;
183
- /** Stream one file back and recompute its digest. */
184
- export declare function verifyFile(store: TaskBoardAttachmentStore, attachment: TaskAttachment): Promise<void>;
185
- /**
186
- * The limits the board publishes for its attachments: the board's own caps,
187
- * lowered by the deployment's image policy where that policy is stricter.
188
- */
189
- export declare function publishedAttachmentLimits(store: TaskBoardAttachmentStore | undefined): {
190
- maxAttachments: number;
191
- maxBytes: number;
192
- maxTotalBytes: number;
193
- maxImages: number;
194
- maxImageBytes: number;
195
- maxMessageImageBytes: number;
196
- };
197
- /** One image resolved for an execution prompt. */
198
- export interface ExecutionImagePart {
199
- type: 'image';
200
- mediaType: string;
201
- data: string;
202
- name?: string;
203
- }
204
- /** One file resolved for an execution prompt: its readable host path. */
205
- export interface ExecutionFilePart {
206
- name: string;
207
- path: string;
208
- bytes: number;
209
- mediaType: string;
210
- }
211
- /** The attachments of a card, resolved for one execution. */
212
- export interface ResolvedAttachments {
213
- /** The images, in the order the card lists them. */
214
- images: ExecutionImagePart[];
215
- /** The files, in the order the card lists them. */
216
- files: ExecutionFilePart[];
217
- }
218
- /**
219
- * Resolve a card's attachments for one execution: images become prompt image
220
- * parts, files become readable host paths.
221
- *
222
- * Every execution resolves the attachments afresh — the recorded metadata is
223
- * never trusted on its own, and a file whose host path is missing or
224
- * unreadable fails the run instead of being silently dropped.
225
- */
226
- export declare function resolveExecutionAttachments(store: TaskBoardAttachmentStore, attachments: readonly TaskAttachment[]): Promise<ResolvedAttachments>;
227
- /**
228
- * The attachment section of an execution prompt: the readable paths of the
229
- * card's files, marked read-only.
230
- *
231
- * It is a section of its own — never folded into the handover preamble — so
232
- * the two kinds of reference stay distinguishable to the reading agent.
233
- */
234
- export declare function attachmentPromptPreamble(files: readonly ExecutionFilePart[]): string | undefined;
235
- /** The model-info reader the image preflight uses. */
236
- export type ModelInfoResolver = (provider: string, model: string, signal?: AbortSignal) => Promise<{
237
- inputModalities?: readonly string[];
238
- } | undefined>;
239
- /**
240
- * Refuse an execution whose route cannot read images.
241
- *
242
- * The check uses the ACTUAL route of the session the run is about to use and
243
- * the model's own declared input modalities. A route that declares no
244
- * modalities is UNKNOWN, and an unknown route is allowed: the official model
245
- * catalog publishes no modality information, so it cannot answer this
246
- * question, and refusing on its silence would block every image run.
247
- */
248
- export declare function assertRouteAcceptsImages(resolveModelInfo: ModelInfoResolver | undefined, provider: string, model: string): Promise<void>;
249
- /** The attachment kinds a card may carry, for the wire gates. */
250
- export declare const ATTACHMENT_KINDS: readonly TaskAttachmentKind[];
@@ -1,151 +0,0 @@
1
- /**
2
- * Host-side extension registry: the one place that admits external providers,
3
- * negotiates the contract version, gates them on the board's own enable state,
4
- * fans board events out to them, and routes dispatched provider actions back.
5
- *
6
- * Failure policy (mirrors the board's plugin philosophy): a provider that
7
- * throws, mis-declares its version, or disables itself degrades only its own
8
- * surface. The board keeps serving; the registry records what it refused.
9
- *
10
- * @module dsh-task-board/host/extension-registry
11
- */
12
- import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
13
- import type { HostTaskLedger } from '../host-ledger.ts';
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';
16
- /** Diagnosable refusal raised by the registry and the capability face. */
17
- export declare class TaskBoardExtensionError extends Error {
18
- readonly code: string;
19
- constructor(code: string, message: string);
20
- }
21
- /** Logging seat the registry uses; a deployment may supply its own. */
22
- export interface TaskBoardExtensionLogger {
23
- warn(message: string, ...rest: unknown[]): void;
24
- error(message: string, ...rest: unknown[]): void;
25
- }
26
- /** The deployment's model-visible tool registry, resolved lazily. */
27
- export interface TaskBoardExtensionToolRegistry {
28
- register(definition: ToolDefinition): () => void;
29
- }
30
- /** Applies one board action with every board gate intact (never an extension action). */
31
- export type TaskBoardActionApplier = (action: Exclude<TaskBoardAction, {
32
- kind: 'extension-action';
33
- }>, initiator?: string) => TaskBoardSnapshot;
34
- /** Delivers one follow-up message into an existing execution session. */
35
- export type TaskBoardFollowUpDelivery = (sessionId: string, text: string) => Promise<void>;
36
- /** Applies one rework request through the board's own run path. */
37
- export type TaskBoardReworkApplier = (taskId: string, instructions: string, initiator?: string) => void;
38
- /** Registry dependencies. */
39
- export interface TaskBoardExtensionRegistryOptions {
40
- ledger: HostTaskLedger;
41
- /** Apply an action through the board service (gates, run dispatch, schedule). */
42
- apply?: TaskBoardActionApplier;
43
- /**
44
- * Queue one follow-up message into a session. Absent means this deployment
45
- * serves no session delivery, which the capability face refuses visibly.
46
- */
47
- followUp?: TaskBoardFollowUpDelivery;
48
- /**
49
- * Apply one rework run request (through the same gates a run takes). Absent
50
- * means this deployment serves no rework, which the face refuses visibly.
51
- */
52
- rework?: TaskBoardReworkApplier;
53
- /** Resolve the deployment's tool registry; absent loses the tool surface only. */
54
- toolRegistry?: () => TaskBoardExtensionToolRegistry | undefined;
55
- now?: () => number;
56
- uuid?: () => string;
57
- logger?: TaskBoardExtensionLogger;
58
- }
59
- export declare class TaskBoardExtensionRegistry {
60
- private readonly entries;
61
- private readonly ledger;
62
- private readonly applyAction;
63
- private readonly followUpDelivery;
64
- private readonly reworkApply;
65
- private readonly now;
66
- private readonly uuid;
67
- private readonly logger;
68
- private toolResolver;
69
- /** Board master switch (enabled config); providers start only while it is on. */
70
- private boardEnabled;
71
- private disposed;
72
- constructor(options: TaskBoardExtensionRegistryOptions);
73
- /**
74
- * Pin (or replace) the deployment's tool registry. A registry that appears
75
- * after a provider started is picked up here, which is what keeps the tool
76
- * surface alive across the board's own late service resolution.
77
- */
78
- setToolRegistry(resolver: (() => TaskBoardExtensionToolRegistry | undefined) | undefined): void;
79
- /** Apply the board's master switch; providers start and stop with it. */
80
- setEnabled(enabled: boolean): void;
81
- /** Whether the board currently runs a given extension (board x extension). */
82
- isActive(extensionId: string): boolean;
83
- /**
84
- * Admit one provider. Idempotent by id: a second registration of the same id
85
- * is a no-op that returns the same release handle. A contract-version
86
- * mismatch is refused visibly (logged and thrown) without disturbing the
87
- * board or any other provider.
88
- * @param extension - the provider to admit.
89
- * @returns a disposer releasing the registration (idempotent).
90
- */
91
- registerExtension(extension: TaskBoardExtension): () => void;
92
- /** Remove one provider; its provider-side work stops and its payload stays stored. */
93
- unregister(extensionId: string): void;
94
- /**
95
- * Route one dispatched provider action. Refuses visibly when the extension is
96
- * unknown, currently gated off, or does not implement the action.
97
- */
98
- handleAction(request: TaskBoardExtensionActionRequest): Promise<unknown>;
99
- /** Published summaries of currently running providers, keyed by extension id. */
100
- published(): Record<string, TaskBoardExtensionPayload>;
101
- /** Fan a status change out to every running provider, isolated per callback. */
102
- emitStatusChanged(event: TaskBoardStatusChangedEvent): void;
103
- /** Fan an execution settlement out to every running provider. */
104
- emitExecutionSettled(event: TaskBoardExecutionSettledEvent): void;
105
- /** Fan a task deletion out to every running provider. */
106
- emitTaskDeleted(event: TaskBoardTaskDeletedEvent): void;
107
- /** Stop every provider and release the registry (idempotent). */
108
- dispose(): void;
109
- private emit;
110
- /** Start or stop one entry against the current board + extension gate. */
111
- private reconcile;
112
- private startEntry;
113
- private stopEntry;
114
- /** (Re)register every buffered tool against the current tool registry. */
115
- private syncTools;
116
- private disposeTools;
117
- private assertActive;
118
- /** Build the per-extension capability face. */
119
- private capabilities;
120
- private createTask;
121
- private patchContent;
122
- private setStatus;
123
- /**
124
- * Queue one follow-up message into the session of a card's current or most
125
- * recent execution.
126
- *
127
- * A running card is the point of the capability, so an open execution is not
128
- * a refusal: the message is queued behind the turn that is already going. What
129
- * IS refused is a card with no conversation to deliver into, and a session
130
- * this Host no longer reaches — the delivery refuses, and that refusal must
131
- * reach the provider as such instead of looking like a silent success.
132
- */
133
- private followUp;
134
- /**
135
- * Re-run an executed card in its own session with rework instructions.
136
- *
137
- * The registry decides only what it can read from the ledger — the card
138
- * exists, is not archived, is not running, and has a conversation to continue
139
- * — and then hands the request to the board's own run path, so the running
140
- * lock, the permission confirmation, the acceptance contract and the spend cap
141
- * keep judging it. A board refusal surfaces unchanged, exactly as it does for
142
- * {@link setStatus}, because those are the board's own words.
143
- */
144
- private rework;
145
- /** One task by id, or the refusal that names the unknown id. */
146
- private requireTask;
147
- private linkedTasks;
148
- private writeIntegration;
149
- private publish;
150
- private registerTool;
151
- }
@@ -1,71 +0,0 @@
1
- /**
2
- * Admission control for the session-creating half of a run.
3
- *
4
- * A run opens one session, so the burst this bounds is several runs starting at
5
- * once — several cards run from different tabs, or a due schedule firing while
6
- * a manual run is still launching. Unbounded, the Host asks DSH for N sessions
7
- * in the same tick: the burst the repository's measured guidance caps at three
8
- * heavy implementation subagents (docs/multi-agent-resources.md), with no
9
- * mechanism enforcing it.
10
- *
11
- * The queue is SERVICE-wide, not per run group: the pressure it bounds is the
12
- * machine's (the Host process's memory and the swap it drives), and two run
13
- * groups opened from two tabs share one Host. Admission is round-robin across
14
- * run groups — FIFO inside a group — so one run cannot starve another opened
15
- * after it, and no entry can be starved.
16
- *
17
- * The width is read through a live callback, so a settings edit takes effect on
18
- * the next admission without remounting anything.
19
- *
20
- * @module dsh-task-board/host/launch-admission
21
- */
22
- /** One launch the queue has not started yet. */
23
- export interface QueuedLaunch {
24
- /** Run group this launch belongs to; the unit of round-robin fairness. */
25
- readonly groupId: string;
26
- /**
27
- * Perform the launch. The slot is held until this promise settles, which
28
- * makes "in flight" mean "still creating and prompting its session".
29
- * A rejection is swallowed here so one broken launch can never wedge the
30
- * slot; the caller owns reporting.
31
- */
32
- start(): Promise<void>;
33
- /**
34
- * Called by {@link LaunchAdmissionQueue.drain} for a launch that never
35
- * started, so the caller can take its execution out of the running column.
36
- */
37
- abandon(): void;
38
- }
39
- export declare class LaunchAdmissionQueue {
40
- private readonly width;
41
- /** Waiting launches per run group, in arrival order. */
42
- private readonly waiting;
43
- /** Run groups in round-robin order. */
44
- private rotation;
45
- /** Slot holders of the launches in flight, one per admitted launch. */
46
- private readonly inFlight;
47
- /** Highest number of launches in flight at once; observability and tests. */
48
- peakInFlight: number;
49
- /**
50
- * @param width - live admission width (already normalized by the caller).
51
- */
52
- constructor(width: () => number);
53
- /** Launches the queue has not admitted yet. */
54
- get pendingCount(): number;
55
- /** Launches currently holding a slot. */
56
- get inFlightCount(): number;
57
- /** Admit one launch, immediately if a slot is free. */
58
- enqueue(launch: QueuedLaunch): void;
59
- /**
60
- * Abandon every waiting launch: the queue is being torn down, so an entry
61
- * that never started can never start. Launches already in flight are left
62
- * alone — their session may already exist, and the callers that own them
63
- * settle them through the normal path.
64
- * @returns the abandoned launches, in abandonment order.
65
- */
66
- drain(): QueuedLaunch[];
67
- private pump;
68
- /** The next launch by round-robin across groups and FIFO inside one. */
69
- private takeNext;
70
- private admit;
71
- }