@linxin666/dsh-client-ui-task-board 0.4.12 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +9 -3
  3. package/README.zh.md +9 -3
  4. package/lib/client.js +1476 -478
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +1280 -65
  7. package/lib/types/client/board/AttachmentField.d.ts +70 -0
  8. package/lib/types/client/board/model-options.d.ts +21 -1
  9. package/lib/types/client/board/source-group.d.ts +27 -0
  10. package/lib/types/client/host-api.d.ts +25 -0
  11. package/lib/types/client/locales.d.ts +17 -0
  12. package/lib/types/client/pending-verify.d.ts +47 -0
  13. package/lib/types/client/service.d.ts +4 -1
  14. package/lib/types/core/attachment.d.ts +132 -0
  15. package/lib/types/core/controller.d.ts +26 -2
  16. package/lib/types/core/extension.d.ts +82 -0
  17. package/lib/types/core/session-reuse.d.ts +7 -1
  18. package/lib/types/core/tasks.d.ts +38 -1
  19. package/lib/types/core/use-cases/task-update.d.ts +21 -0
  20. package/lib/types/core/wire-projection.d.ts +35 -0
  21. package/lib/types/host/attachments.d.ts +250 -0
  22. package/lib/types/host/extension-registry.d.ts +40 -0
  23. package/lib/types/host-ledger.d.ts +16 -0
  24. package/lib/types/host-routes.d.ts +14 -0
  25. package/lib/types/host-runner.d.ts +53 -1
  26. package/lib/types/host-service.d.ts +59 -0
  27. package/lib/types/index.d.ts +23 -0
  28. package/lib/types/protocol.d.ts +39 -6
  29. package/locale/en.json +6 -0
  30. package/locale/zh.json +6 -0
  31. package/package.json +6 -2
  32. package/src/client/TaskBoardSettingsCard.tsx +11 -1
  33. package/src/client/board/AttachmentField.tsx +383 -0
  34. package/src/client/board/EditTaskModal.tsx +63 -0
  35. package/src/client/board/NewTaskModal.tsx +76 -4
  36. package/src/client/board/TaskBoard.tsx +47 -10
  37. package/src/client/board/TaskDetail.tsx +30 -2
  38. package/src/client/board/model-options.ts +32 -2
  39. package/src/client/board/source-group.ts +94 -0
  40. package/src/client/board.module.css +83 -0
  41. package/src/client/host-api.ts +70 -0
  42. package/src/client/index.ts +11 -0
  43. package/src/client/locales.ts +34 -0
  44. package/src/client/pending-verify.ts +90 -0
  45. package/src/client/service.ts +24 -0
  46. package/src/core/attachment.ts +287 -0
  47. package/src/core/controller.ts +47 -1
  48. package/src/core/extension.ts +86 -0
  49. package/src/core/session-reuse.ts +7 -1
  50. package/src/core/store.ts +10 -1
  51. package/src/core/tasks.ts +49 -0
  52. package/src/core/use-cases/task-update.ts +27 -2
  53. package/src/core/wire-projection.ts +81 -0
  54. package/src/host/attachments.ts +650 -0
  55. package/src/host/extension-registry.ts +150 -5
  56. package/src/host-ledger.ts +32 -4
  57. package/src/host-routes.ts +168 -13
  58. package/src/host-runner.ts +124 -4
  59. package/src/host-service.ts +165 -12
  60. package/src/index.ts +47 -0
  61. package/src/protocol.ts +57 -9
@@ -8,6 +8,7 @@ import type { FreezeSnapshot } from './freeze-snapshot.ts';
8
8
  import type { ExecutionVerification } from './verification.ts';
9
9
  import type { TaskHandover, TaskHandoverInput } from './handover.ts';
10
10
  import { type TaskBoardExtensionPayload } from './extension.ts';
11
+ import { type TaskAttachment } from './attachment.ts';
11
12
  /** Task lifecycle status, one per kanban column. */
12
13
  export type TaskStatus = 'backlog' | 'todo' | 'running' | 'done' | 'failed';
13
14
  /** Settled outcome of one execution attempt. */
@@ -33,6 +34,19 @@ export interface ExecutionSummary {
33
34
  * {@link ExecutionSummary.seq} into the session history.
34
35
  */
35
36
  export declare const EXECUTION_SUMMARY_LIMIT = 4000;
37
+ /**
38
+ * Rework input recorded on the execution it opened: the reviewer's instructions
39
+ * for redoing work in the card's own session.
40
+ */
41
+ export interface ExecutionRework {
42
+ /** The rework instructions this run was given, as the reviewer wrote them. */
43
+ instructions: string;
44
+ }
45
+ /**
46
+ * Repair a persisted rework block: only a non-blank instruction string
47
+ * survives, so a hand-edited ledger loses the block instead of the execution.
48
+ */
49
+ export declare function normalizeExecutionRework(value: unknown): ExecutionRework | undefined;
36
50
  /**
37
51
  * One real execution attempt: the run's own id, the dsh session that ran it
38
52
  * (filled once the session is created), and the settled outcome once the
@@ -72,6 +86,13 @@ export interface ExecutionRecord {
72
86
  * `sessionId` and never claims a verdict the Host observed.
73
87
  */
74
88
  external?: boolean;
89
+ /**
90
+ * Rework instructions this execution carries as extra input: a reviewer sent
91
+ * the previous run back, so the card re-ran in the same session with these
92
+ * instructions instead of having its frozen content rewritten. Absent on
93
+ * every ordinary run.
94
+ */
95
+ rework?: ExecutionRework;
75
96
  /** Freeze instant captured from the card snapshot when the run opened. */
76
97
  frozenAt?: number;
77
98
  /** Freeze source session captured from the card snapshot when the run opened. */
@@ -452,6 +473,14 @@ export interface TaskRecord {
452
473
  * absent means on-board.
453
474
  */
454
475
  hidden?: boolean;
476
+ /**
477
+ * Files and images the card carries (issue #1979). Metadata only: the bytes
478
+ * live in the official attachment storage, and this record names the stored
479
+ * object, its size and the digest of the exact bytes the Host verified
480
+ * there. Additive and absent on every card written before the field
481
+ * existed, so an old card keeps running exactly as it did.
482
+ */
483
+ attachments?: TaskAttachment[];
455
484
  }
456
485
  /**
457
486
  * Statuses a task may be archived from: every status but `running`, whose
@@ -548,6 +577,12 @@ export interface NewTaskInput {
548
577
  status?: TaskStatus;
549
578
  /** Create the card off-board (held in the ledger, never rendered). */
550
579
  hidden?: boolean;
580
+ /**
581
+ * Files and images the new card carries (issue #1979). The metadata is
582
+ * host-verified against the official attachment storage before it reaches
583
+ * the ledger, so a create never records a claim the storage cannot prove.
584
+ */
585
+ attachments?: TaskAttachment[];
551
586
  }
552
587
  /** The five kanban columns, in display order. */
553
588
  export declare const COLUMNS: readonly {
@@ -623,8 +658,10 @@ export declare function withSchedule(task: TaskRecord, patch: Partial<ScheduleRu
623
658
  * running execution record. Returns the new task and the new execution.
624
659
  * @param runGroupId - cascade run group, when this run also opened executions
625
660
  * for the task's subtasks (see `core/subtask.ts`).
661
+ * @param rework - the reviewer's instructions, when this run is a rework of the
662
+ * card's previous work; recorded on the execution it opens.
626
663
  */
627
- export declare function startExecution(task: TaskRecord, now: number, executionId: string, initiatedBy?: string, runGroupId?: string): {
664
+ export declare function startExecution(task: TaskRecord, now: number, executionId: string, initiatedBy?: string, runGroupId?: string, rework?: ExecutionRework): {
628
665
  task: TaskRecord;
629
666
  execution: ExecutionRecord;
630
667
  };
@@ -9,6 +9,7 @@
9
9
  * stale UI can never persist a value the execution service rejects.
10
10
  */
11
11
  import { type TaskRecord, type TaskTag } from '../tasks.ts';
12
+ import { type TaskAttachment } from '../attachment.ts';
12
13
  import type { FreezeSnapshot } from '../freeze-snapshot.ts';
13
14
  import type { TaskHandoverInput } from '../handover.ts';
14
15
  /**
@@ -28,6 +29,15 @@ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' |
28
29
  * explicit null (or a list that normalizes to nothing) clears them.
29
30
  */
30
31
  tags?: TaskTag[] | null;
32
+ /**
33
+ * Replaces the card's attachments (issue #1979).
34
+ *
35
+ * The attachments freeze WITH the card content: they are part of what the
36
+ * card hands to its execution, so an executed or archived card keeps the
37
+ * ones it ran with, exactly as it keeps the prompt it ran with. An explicit
38
+ * null clears them; a present array replaces the whole set.
39
+ */
40
+ attachments?: TaskAttachment[] | null;
31
41
  };
32
42
  /** The fields that edit the task's content (what the user reads and what the
33
43
  * next execution sends). Unlike the execution targets they stay editable only
@@ -35,6 +45,17 @@ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' |
35
45
  * recorded prompt is the record of what actually ran, so it becomes read-only.
36
46
  */
37
47
  export declare const TASK_CONTENT_FIELDS: readonly ["title", "description", "prompt"];
48
+ /**
49
+ * The fields that freeze with the card content: the text the card says AND
50
+ * the attachments it carries.
51
+ *
52
+ * The attachments freeze with the content because they ARE part of what the
53
+ * card hands to its execution: a card whose first run already consumed an
54
+ * image keeps that image, and the record of what ran stays what it was. An
55
+ * executed or archived card therefore refuses an attachment change exactly
56
+ * as it refuses a prompt change.
57
+ */
58
+ export declare const TASK_FROZEN_FIELDS: readonly ["title", "description", "prompt", "attachments"];
38
59
  /** Whether an update patch touches any task-content field. */
39
60
  export declare function hasContentPatch(patch: TaskUpdatePatch): boolean;
40
61
  /**
@@ -0,0 +1,35 @@
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;
@@ -0,0 +1,250 @@
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[];
@@ -31,11 +31,25 @@ export interface TaskBoardExtensionToolRegistry {
31
31
  export type TaskBoardActionApplier = (action: Exclude<TaskBoardAction, {
32
32
  kind: 'extension-action';
33
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;
34
38
  /** Registry dependencies. */
35
39
  export interface TaskBoardExtensionRegistryOptions {
36
40
  ledger: HostTaskLedger;
37
41
  /** Apply an action through the board service (gates, run dispatch, schedule). */
38
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;
39
53
  /** Resolve the deployment's tool registry; absent loses the tool surface only. */
40
54
  toolRegistry?: () => TaskBoardExtensionToolRegistry | undefined;
41
55
  now?: () => number;
@@ -46,6 +60,8 @@ export declare class TaskBoardExtensionRegistry {
46
60
  private readonly entries;
47
61
  private readonly ledger;
48
62
  private readonly applyAction;
63
+ private readonly followUpDelivery;
64
+ private readonly reworkApply;
49
65
  private readonly now;
50
66
  private readonly uuid;
51
67
  private readonly logger;
@@ -104,6 +120,30 @@ export declare class TaskBoardExtensionRegistry {
104
120
  private createTask;
105
121
  private patchContent;
106
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;
107
147
  private linkedTasks;
108
148
  private writeIntegration;
109
149
  private publish;
@@ -299,6 +299,20 @@ export declare class HostTaskLedger {
299
299
  * @returns the first refusal, or undefined when the run may start.
300
300
  */
301
301
  private bindingRefusal;
302
+ /**
303
+ * The rework block a rework request opens its execution with, or the refusal
304
+ * that names why there is nothing to rework.
305
+ *
306
+ * Read from the ledger alone: a card that never ran, and a card whose runs
307
+ * recorded no session, have no conversation to send the reviewer's
308
+ * instructions into. Minting one would hand those instructions to an agent
309
+ * that never saw the work being sent back, which is the opposite of what a
310
+ * rework asks for.
311
+ * @param task - the card being reworked.
312
+ * @param instructions - the reviewer's instructions, already validated.
313
+ * @returns the block recorded on the opened execution.
314
+ */
315
+ private reworkInput;
302
316
  /** Whether a task or any of its subtasks still has an open execution. */
303
317
  private subtreeHasOpenExecution;
304
318
  /** The descendants of a card that still hold work, as the launch prompt names them. */
@@ -319,6 +333,8 @@ export declare class HostTaskLedger {
319
333
  * @param progress - when set, this run was a due occurrence and the root's
320
334
  * rule is advanced (counter, next target, stop/skip record) in the same
321
335
  * atomic commit that opened the execution.
336
+ * @param rework - the reviewer's instructions, when this run redoes previous
337
+ * work; recorded on the execution it opens.
322
338
  */
323
339
  private startRun;
324
340
  /**
@@ -2,6 +2,13 @@ import type { IncomingMessage } from 'node:http';
2
2
  import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
3
3
  import type { TaskBoardHostService } from './host-service.ts';
4
4
  import { type TaskBoardParseDraft, type TaskBoardParseRequest } from './protocol.ts';
5
+ import { type TaskBoardAttachmentStore } from './host/attachments.ts';
6
+ /**
7
+ * Comment-frame cadence on the event stream. It keeps the connection alive
8
+ * through intermediaries that would close an idle one; it is not a frame the
9
+ * browser reports to the panel (an SSE comment is invisible to EventSource).
10
+ */
11
+ export declare const HEARTBEAT_MS = 15000;
5
12
  /** Header replaced by an authenticated same-host reverse proxy. */
6
13
  export declare const TASK_BOARD_PROXY_TOKEN_HEADER = "x-dsh-task-board-proxy-token";
7
14
  /**
@@ -48,6 +55,13 @@ export interface TaskBoardRouteAccess {
48
55
  */
49
56
  export interface TaskBoardRouteOptions {
50
57
  parseTask?: (request: TaskBoardParseRequest, signal: AbortSignal) => Promise<TaskBoardParseDraft>;
58
+ /**
59
+ * The official attachment storage, read at request time so a deployment that
60
+ * mounts it after these routes still gains the attachment surface. Absent
61
+ * means this deployment stores no attachments, and every attachment route
62
+ * answers with a typed "storage unavailable" failure.
63
+ */
64
+ attachments?: () => TaskBoardAttachmentStore | undefined;
51
65
  }
52
66
  interface ResolvedRouteAccess {
53
67
  trustedProxyHosts: ReadonlySet<string>;
@@ -5,6 +5,7 @@ import type { CommandResult } from '@deepseek-ai/dsh-commands/types';
5
5
  import type { Workspace } from '@deepseek-ai/dsh-workspace/types';
6
6
  import type { ModelCatalogView } from './core/verification.ts';
7
7
  import type { ExecutionSummary, TaskRecord } from './core/tasks.ts';
8
+ import { type ExecutionFilePart, type ModelInfoResolver, type TaskBoardAttachmentStore } from './host/attachments.ts';
8
9
  /**
9
10
  * Host services needed to validate a task's workspace before creating a
10
11
  * session, and to resolve the workspace an unpinned card runs in.
@@ -131,6 +132,22 @@ export interface PromptContext {
131
132
  mode: 'cron' | 'once';
132
133
  cron?: string;
133
134
  };
135
+ /**
136
+ * Rework provenance: the instructions a reviewer sent the previous run back
137
+ * with. Present exactly when this execution continues the card's own session
138
+ * to redo work, so the agent reads why it is being asked again instead of
139
+ * seeing the card body a second time with no explanation.
140
+ */
141
+ rework?: {
142
+ instructions: string;
143
+ };
144
+ /**
145
+ * The card's attached files, resolved to readable host paths for THIS
146
+ * execution. Present exactly when the card carries files: the section is a
147
+ * preamble of its own, separate from the handover references, so the two
148
+ * kinds of reference stay distinguishable to the reading agent.
149
+ */
150
+ files?: readonly ExecutionFilePart[];
134
151
  }
135
152
  /**
136
153
  * Build the execution prompt for one task.
@@ -149,10 +166,23 @@ export declare function promptText(task: TaskRecord, context?: PromptContext): s
149
166
  * @returns the objective text for `/goal <objective>`.
150
167
  */
151
168
  export declare function goalObjective(prompt: string): string;
169
+ /**
170
+ * The optional runtime faces an execution needs beyond the session gateway:
171
+ * the official attachment storage and the model-info reader the image
172
+ * preflight uses. Both are read live, so a deployment that mounts them after
173
+ * the board still gains the capability.
174
+ */
175
+ export interface TaskBoardRuntimeFaces {
176
+ /** The official attachment storage, or undefined when the deployment has none. */
177
+ attachments?: () => TaskBoardAttachmentStore | undefined;
178
+ /** The model-info reader, or undefined when the deployment serves no model information. */
179
+ llm?: () => ModelInfoResolver | undefined;
180
+ }
152
181
  export declare class HostExecutionRunner {
153
182
  private readonly gateway;
154
183
  private readonly commands?;
155
184
  private readonly workspaceRegistry?;
185
+ private readonly faces;
156
186
  /**
157
187
  * Newest event sequence per session whose COMPLETE history walk (reaching
158
188
  * the execution boundary) found no matching execution end. A later walk may
@@ -171,7 +201,7 @@ export declare class HostExecutionRunner {
171
201
  constructor(gateway: SessionGateway | TypertGateway, commands?: SessionCommandDispatcher | undefined, workspaceRegistry?: TaskBoardWorkspaceRegistry | undefined, unavailableRetry?: {
172
202
  attempts?: number;
173
203
  backoffMs?: number;
174
- }, ownerPeer?: GatewayPeer);
204
+ }, ownerPeer?: GatewayPeer, faces?: TaskBoardRuntimeFaces);
175
205
  private invoke;
176
206
  private stream;
177
207
  /**
@@ -226,6 +256,18 @@ export declare class HostExecutionRunner {
226
256
  */
227
257
  catalog?: ModelCatalogView;
228
258
  }): Promise<string>;
259
+ /**
260
+ * Queue one follow-up user message into an existing execution session.
261
+ *
262
+ * This is the same `session/prompt` call a launch makes, with none of the
263
+ * launch pins: a follow-up continues a conversation the board already
264
+ * composed, so it must not re-assert the permission, rename the session, or
265
+ * switch the model. The message is queued behind whatever that session is
266
+ * doing, which is what lets a caller reach a run that is still working.
267
+ * @param sessionId - the session the card's execution recorded.
268
+ * @param text - the message to deliver, already validated by the caller.
269
+ */
270
+ followUp(sessionId: string, text: string): Promise<void>;
229
271
  /**
230
272
  * Fail closed when a reused session records a different Agent preset than
231
273
  * the one this task pins.
@@ -267,6 +309,16 @@ export declare class HostExecutionRunner {
267
309
  * prompt is never queued behind a run at the wrong level.
268
310
  */
269
311
  private pinAndPrompt;
312
+ /**
313
+ * Resolve a card's attachments for one execution.
314
+ *
315
+ * A card without attachments resolves to nothing, even in a deployment that
316
+ * serves no attachment storage at all. A card WITH attachments cannot run
317
+ * without the storage: the run fails with a readable reason instead of
318
+ * silently dropping the attachment and running the card as if it carried
319
+ * none.
320
+ */
321
+ private resolveAttachments;
270
322
  /**
271
323
  * Read the host's model catalog: the default route an unconfigured session
272
324
  * starts at, and each provider's models with the reasoning metadata its