@fish-under-sea/dsh-client-ui-task-board-fish 1.0.2 → 1.1.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 (123) hide show
  1. package/NOTICE +1 -1
  2. package/README.en.md +4 -4
  3. package/README.md +4 -4
  4. package/README.zh.md +4 -4
  5. package/lib/client.js +4428 -1508
  6. package/lib/client.js.map +1 -1
  7. package/lib/index.js +2670 -496
  8. package/lib/types/client/CardDefaultPresetField.d.ts +35 -0
  9. package/lib/types/client/PluginSettingsCard.d.ts +130 -19
  10. package/lib/types/client/RangeBubble.d.ts +46 -0
  11. package/lib/types/client/SegmentGroup.d.ts +28 -0
  12. package/lib/types/client/TaskBoardSettingsCard.d.ts +63 -0
  13. package/lib/types/client/board/AttachmentField.d.ts +70 -0
  14. package/lib/types/client/board/ExecutionLog.d.ts +24 -0
  15. package/lib/types/client/board/ReasoningEffortField.d.ts +25 -0
  16. package/lib/types/client/board/TaskForm.d.ts +4 -0
  17. package/lib/types/client/board/VerificationReport.d.ts +2 -15
  18. package/lib/types/client/board/model-options.d.ts +87 -0
  19. package/lib/types/client/board/preset-label.d.ts +21 -0
  20. package/lib/types/client/board/preset-roster.d.ts +45 -0
  21. package/lib/types/client/board/source-group.d.ts +27 -0
  22. package/lib/types/client/body-mutations.d.ts +45 -0
  23. package/lib/types/client/host-api.d.ts +25 -0
  24. package/lib/types/client/locales.d.ts +87 -9
  25. package/lib/types/client/pending-verify.d.ts +47 -0
  26. package/lib/types/client/plugin-card-seat.d.ts +3 -1
  27. package/lib/types/client/service.d.ts +4 -1
  28. package/lib/types/client/settings-form.d.ts +73 -51
  29. package/lib/types/core/attachment.d.ts +132 -0
  30. package/lib/types/core/card-defaults.d.ts +78 -0
  31. package/lib/types/core/controller.d.ts +57 -8
  32. package/lib/types/core/execution-summary.d.ts +52 -0
  33. package/lib/types/core/extension.d.ts +116 -0
  34. package/lib/types/core/launch-width.d.ts +31 -0
  35. package/lib/types/core/reasoning-effort.d.ts +57 -0
  36. package/lib/types/core/session-reuse.d.ts +7 -1
  37. package/lib/types/core/spend-budget.d.ts +28 -0
  38. package/lib/types/core/subtask.d.ts +100 -37
  39. package/lib/types/core/tasks.d.ts +94 -10
  40. package/lib/types/core/use-cases/task-create.d.ts +10 -5
  41. package/lib/types/core/use-cases/task-tag.d.ts +36 -0
  42. package/lib/types/core/use-cases/task-update.d.ts +22 -1
  43. package/lib/types/core/wire-projection.d.ts +35 -0
  44. package/lib/types/core/workspace-target.d.ts +23 -3
  45. package/lib/types/host/attachments.d.ts +250 -0
  46. package/lib/types/host/extension-registry.d.ts +40 -0
  47. package/lib/types/host/launch-admission.d.ts +71 -0
  48. package/lib/types/host-ledger.d.ts +114 -47
  49. package/lib/types/host-routes.d.ts +63 -0
  50. package/lib/types/host-runner.d.ts +164 -18
  51. package/lib/types/host-service.d.ts +182 -46
  52. package/lib/types/host-spend.d.ts +52 -0
  53. package/lib/types/index.d.ts +173 -54
  54. package/lib/types/loopback.d.ts +41 -1
  55. package/lib/types/protocol.d.ts +52 -11
  56. package/lib/types/tool-surface.d.ts +1 -0
  57. package/locale/en.json +6 -0
  58. package/locale/zh.json +6 -0
  59. package/package.json +35 -28
  60. package/src/client/CardDefaultPresetField.tsx +101 -0
  61. package/src/client/PluginSettingsCard.tsx +385 -111
  62. package/src/client/RangeBubble.tsx +164 -0
  63. package/src/client/SegmentGroup.tsx +93 -0
  64. package/src/client/TaskBoardSettingsCard.tsx +332 -37
  65. package/src/client/board/AttachmentField.tsx +383 -0
  66. package/src/client/board/EditTaskModal.tsx +63 -0
  67. package/src/client/board/ExecutionLog.tsx +154 -0
  68. package/src/client/board/LinkSubtaskModal.tsx +1 -1
  69. package/src/client/board/NewTaskModal.tsx +154 -45
  70. package/src/client/board/ReasoningEffortField.tsx +50 -0
  71. package/src/client/board/TagManagerModal.tsx +151 -2
  72. package/src/client/board/TaskBoard.tsx +47 -10
  73. package/src/client/board/TaskCard.tsx +45 -23
  74. package/src/client/board/TaskDetail.tsx +468 -258
  75. package/src/client/board/TaskForm.tsx +19 -4
  76. package/src/client/board/VerificationReport.tsx +143 -104
  77. package/src/client/board/model-options.ts +208 -0
  78. package/src/client/board/preset-label.ts +32 -0
  79. package/src/client/board/preset-roster.ts +58 -0
  80. package/src/client/board/source-group.ts +94 -0
  81. package/src/client/board/task-markdown.module.css +11 -8
  82. package/src/client/board-settings.module.css +35 -7
  83. package/src/client/board.module.css +1044 -105
  84. package/src/client/body-mutations.ts +133 -0
  85. package/src/client/host-api.ts +70 -0
  86. package/src/client/index.ts +109 -95
  87. package/src/client/locales.ts +205 -48
  88. package/src/client/pending-verify.ts +90 -0
  89. package/src/client/plugin-card-seat.ts +8 -2
  90. package/src/client/service.ts +24 -0
  91. package/src/client/settings-card.module.css +466 -89
  92. package/src/client/settings-entry-form.ts +0 -1
  93. package/src/client/settings-form.ts +102 -60
  94. package/src/core/attachment.ts +287 -0
  95. package/src/core/card-defaults.ts +132 -0
  96. package/src/core/controller.ts +90 -11
  97. package/src/core/execution-summary.ts +96 -0
  98. package/src/core/extension.ts +120 -0
  99. package/src/core/launch-width.ts +38 -0
  100. package/src/core/reasoning-effort.ts +92 -0
  101. package/src/core/session-reuse.ts +7 -1
  102. package/src/core/spend-budget.ts +35 -0
  103. package/src/core/store.ts +19 -1
  104. package/src/core/subtask.ts +144 -68
  105. package/src/core/tasks.ts +117 -10
  106. package/src/core/use-cases/task-create.ts +27 -16
  107. package/src/core/use-cases/task-tag.ts +56 -0
  108. package/src/core/use-cases/task-update.ts +33 -5
  109. package/src/core/wire-projection.ts +81 -0
  110. package/src/core/workspace-target.ts +27 -3
  111. package/src/host/agent-tools.ts +33 -21
  112. package/src/host/attachments.ts +650 -0
  113. package/src/host/extension-registry.ts +150 -5
  114. package/src/host/launch-admission.ts +139 -0
  115. package/src/host-ledger.ts +248 -117
  116. package/src/host-routes.ts +233 -15
  117. package/src/host-runner.ts +395 -61
  118. package/src/host-service.ts +512 -139
  119. package/src/host-spend.ts +105 -0
  120. package/src/index.ts +312 -92
  121. package/src/loopback.ts +57 -1
  122. package/src/protocol.ts +83 -18
  123. package/src/tool-surface.ts +1 -0
@@ -1,14 +1,15 @@
1
1
  /**
2
- * Staged form model behind the plugin settings card. A card stages what the
3
- * user types and writes it only when they save — the settings write is a
4
- * durable, revision-fenced document mutation, so staging keeps what is on
5
- * screen exactly what a save would store. Family-shared slice inlined into
6
- * each plugin's client bundle; mirrors the official ui-plugin-config
7
- * card-store pattern.
2
+ * Form model behind the plugin settings card. Every control applies itself:
3
+ * a pick (a segment, a select option, a reset) writes the moment it is made,
4
+ * and typed text writes once typing pauses or the reader leaves the field.
5
+ * Between the edit and the write the edit is held here as a draft, so what is
6
+ * on screen is exactly what the write will store; a write the Host refuses
7
+ * puts a pick back to the stored value and keeps typed text for correcting.
8
+ * Family-shared slice inlined into each plugin's client bundle.
8
9
  */
9
10
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
10
11
  import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
11
- /** The write one field's staged text performs when the card is saved. */
12
+ /** The write one field's draft text performs when it is applied. */
12
13
  export type FieldWrite = {
13
14
  kind: 'set';
14
15
  value: unknown;
@@ -19,6 +20,12 @@ export type FieldWrite = {
19
20
  export interface FieldSpec {
20
21
  /** Field name inside the namespace section. */
21
22
  field: string;
23
+ /**
24
+ * How the reader enters a value, which decides when it is written: a `pick`
25
+ * is a whole value at once and applies immediately; `type` is text arriving
26
+ * a keystroke at a time and applies once typing pauses or the field is left.
27
+ */
28
+ entry: 'pick' | 'type';
22
29
  /**
23
30
  * Whether the Host treats this field as a secret and redacts its value from
24
31
  * the read-back (role('secret') in the section schema). Redacted secrets are
@@ -32,8 +39,9 @@ export interface FieldSpec {
32
39
  /** Render a stored value as draft text; the empty string when the section carries none. */
33
40
  format: (value: unknown) => string;
34
41
  /**
35
- * The write this draft text stages, or undefined when the text is not a
36
- * value this field accepts — which blocks the save rather than discarding it.
42
+ * The write this draft text performs, or undefined when the text is not a
43
+ * value this field accepts — which holds the draft unwritten rather than
44
+ * discarding it.
37
45
  */
38
46
  parse: (text: string) => FieldWrite | undefined;
39
47
  }
@@ -41,9 +49,9 @@ export interface FieldSpec {
41
49
  export interface FieldState {
42
50
  /** Draft text the control renders. */
43
51
  text: string;
44
- /** Whether saving would leave a user-layer entry for this field. */
52
+ /** Whether the field leaves (or will leave) a user-layer entry. */
45
53
  overridden: boolean;
46
- /** Whether the draft is not a value this field accepts, which blocks saving. */
54
+ /** Whether the draft is not a value this field accepts, which holds it unwritten. */
47
55
  invalid: boolean;
48
56
  }
49
57
  /** Form state every plugin settings card shares. */
@@ -60,13 +68,13 @@ export interface CardShell {
60
68
  exposed: boolean;
61
69
  /** Whether the Host document accepts writes. */
62
70
  writable: boolean;
63
- /** Whether the form holds edits that a save would write. */
71
+ /** Whether the form holds drafts not yet written (typed text waiting for its pause). */
64
72
  dirty: boolean;
65
- /** Whether any staged draft is invalid, which blocks the save. */
73
+ /** Whether any draft is invalid, which holds it unwritten. */
66
74
  invalid: boolean;
67
- /** Whether a save is crossing the wire. */
75
+ /** Whether a write is crossing the wire. */
68
76
  saving: boolean;
69
- /** Whether the last save did not land as staged; cleared by the next edit or save. */
77
+ /** Whether the last write did not land; cleared by the next edit or write. */
70
78
  failed: boolean;
71
79
  /**
72
80
  * The rejection code/message the Host returned for the last failed save,
@@ -77,15 +85,17 @@ export interface CardShell {
77
85
  }
78
86
  /** The write actions the card's slot entry injects. */
79
87
  export interface CardActions {
80
- /** Stage draft text for one field. */
88
+ /** Take draft text for one field; a pick writes at once, typed text after a pause. */
81
89
  edit: (field: string, text: string) => void;
82
- /** Stage a clear, so saving lets the field re-inherit the composition layer. */
90
+ /** Clear one field at once, so it re-inherits the composition layer. */
83
91
  resetField: (field: string) => void;
84
- /** Write every staged edit, then re-seed from what the Host accepted. */
92
+ /** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
85
93
  save: () => void;
86
- /** Drop every staged edit. */
94
+ /** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
87
95
  discard: () => void;
88
96
  }
97
+ /** How long typed text rests before it is written. */
98
+ export declare const TYPE_PAUSE_MS = 600;
89
99
  /** One durable write inside the save's atomic form mutation. */
90
100
  export interface BatchedWrite {
91
101
  /** Field this entry writes. */
@@ -102,10 +112,13 @@ export interface NumberConstraints {
102
112
  /** The accepted value must be at least this. */
103
113
  min?: number;
104
114
  }
105
- /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints blocks the save. */
115
+ /** 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. */
106
116
  export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
107
- /** A free-text field. An empty draft clears the field. */
108
- export declare function textField(field: string): FieldSpec;
117
+ /**
118
+ * A free-text field. An empty draft clears the field. `entry` is `pick` when
119
+ * the text arrives whole from a picker (a preset or a reasoning level).
120
+ */
121
+ export declare function textField(field: string, entry?: FieldSpec['entry']): FieldSpec;
109
122
  /**
110
123
  * A free-text field the Host treats as a secret and redacts from the read-back
111
124
  * (role('secret') in the section schema). The card still edits it like text,
@@ -118,12 +131,14 @@ export declare function booleanField(field: string): FieldSpec;
118
131
  /** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
119
132
  export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
120
133
  /**
121
- * Stages one card's edits over one settings namespace and writes them on save.
134
+ * Applies one card's edits to one settings namespace as the reader makes them.
122
135
  *
123
136
  * The Host is the only authority on whether a value was accepted — its
124
137
  * validators own the constraints no schema can express — so the outcome is
125
- * read back from the section rather than predicted here. A save that did not
126
- * land keeps its drafts, so the user can correct them instead of retyping.
138
+ * read back from the section rather than predicted here. A write that did not
139
+ * land puts each pick back to the stored value, the way a switch that could not
140
+ * flip springs back, and keeps typed text so the reader can correct it instead
141
+ * of retyping.
127
142
  */
128
143
  export declare class CardForm<T> {
129
144
  private readonly scope;
@@ -133,6 +148,8 @@ export declare class CardForm<T> {
133
148
  /** The form subscription installed in the constructor; released by dispose(). */
134
149
  private readonly disposeForm;
135
150
  private disposed;
151
+ /** The pending write of typed text, waiting for typing to pause. */
152
+ private typePause;
136
153
  private saving;
137
154
  /** A save asked for while one was in flight; it runs once the first settles (#1754). */
138
155
  private saveQueued;
@@ -147,47 +164,46 @@ export declare class CardForm<T> {
147
164
  dispose(): void;
148
165
  /** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
149
166
  bind<S>(project: () => S): SnapshotStore<S>;
150
- /** Read the card-level state: what the Host serves, and what a save would do. */
167
+ /** Read the card-level state: what the Host serves, and what is still waiting to be written. */
151
168
  shell(): CardShell;
152
169
  /** Read one field's state from the effective section and its staged draft. */
153
170
  field(field: string): FieldState;
154
171
  /** The actions the card's slot registration injects. */
155
172
  actions(): CardActions;
156
173
  /**
157
- * Write every staged edit in one atomic form mutation, then re-seed from
158
- * what the Host accepted.
174
+ * Run one write, and re-run it once if another was asked for while this one
175
+ * was still in flight.
159
176
  *
160
- * The whole batch rides one mutate, so cross-field validate hooks
161
- * (baseURL+model) judge it as a unit: the Host either applies every write
162
- * or refuses the batch. The form contract answers a refusal or a skipped
163
- * write with `false` (it recovers with a fresh Host view instead of
164
- * throwing), so the outcome is judged twice: the answer itself, and then the
165
- * settled snapshot read back one planned write at a time. One missed write
166
- * fails the whole save. A transport that rejects instead (the dsh-web bridge
167
- * controller on a dead connection) reports through the same failure path
168
- * with its rejection message. A save that did not land keeps its drafts, so
169
- * the user can correct them instead of retyping.
177
+ * A write is a Host round trip that also drives the profile reconcile, and
178
+ * the Host runs it inside one exclusive transaction. Answering an edit that
179
+ * arrives mid-flight by returning immediately dropped it with no explanation
180
+ * (#1754). Serializing instead means an edit made while another write is
181
+ * still settling is written against the settled state.
170
182
  * @returns settlement after the mutation and the read-back.
171
183
  */
184
+ requestSave(): Promise<void>;
172
185
  /**
173
- * Run one save, and re-run it once if another was asked for while this one
174
- * was still in flight.
186
+ * Write every valid draft in one atomic form mutation, then re-seed from
187
+ * what the Host accepted. A draft the field does not accept stays on screen,
188
+ * unwritten, without holding the others back.
175
189
  *
176
- * A save is a Host round trip that also drives the profile reconcile, and
177
- * the Host runs that write inside one exclusive transaction. Answering a
178
- * press that arrives mid-flight by returning immediately dropped the edit
179
- * with no explanation, which is the "the save button stops working after a
180
- * few rounds" report (#1754). Serializing instead means a save pressed while
181
- * another is still settling runs against the settled state - which is what
182
- * the operator meant by pressing it again.
190
+ * The batch rides one mutate, so cross-field validate hooks (baseURL+model)
191
+ * judge it as a unit: the Host either applies every write or refuses the
192
+ * batch. The form contract answers a refusal or a skipped write with `false`
193
+ * (it recovers with a fresh Host view instead of throwing), so the outcome is
194
+ * judged twice: the answer itself, and then the settled snapshot read back
195
+ * one planned write at a time. One missed write fails the whole batch. A
196
+ * transport that rejects instead (the dsh-web bridge controller on a dead
197
+ * connection) reports through the same failure path with its rejection
198
+ * message. A batch that did not land puts its picks and clears back to the
199
+ * stored value and keeps its typed text, so the reader can correct it.
183
200
  * @returns settlement after the mutation and the read-back.
184
201
  */
185
- requestSave(): Promise<void>;
186
202
  save(): Promise<void>;
187
203
  /**
188
- * Every staged edit a save would write. An entry whose draft is not a value
189
- * its field accepts carries no write: the form is still dirty, and the save
190
- * refuses rather than dropping the edit. A staged edit that matches the
204
+ * Every staged edit a write would carry. An entry whose draft is not a value
205
+ * its field accepts carries no write: the form is still dirty, and the draft
206
+ * stays on screen rather than being dropped. A staged edit that matches the
191
207
  * effective section is not a write at all.
192
208
  * @returns the planned writes, in the order the fields were staged.
193
209
  */
@@ -202,7 +218,13 @@ export declare class CardForm<T> {
202
218
  * user layer once the mutation has settled.
203
219
  */
204
220
  private landedUnset;
221
+ /**
222
+ * Take one edit and schedule its write: a pick or a clear is written now,
223
+ * typed text once typing has rested for TYPE_PAUSE_MS.
224
+ */
205
225
  private stage;
226
+ /** Write every pending draft now, taking the place of a waiting pause. */
227
+ private applyNow;
206
228
  private specOf;
207
229
  private snapshotOf;
208
230
  private sectionValue;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Card attachments: the durable metadata a card keeps about the files and
3
+ * images it carries.
4
+ *
5
+ * The ledger stores METADATA only — never bytes, never base64, never a data
6
+ * URL, never an upload timestamp. The bytes live in the official attachment
7
+ * storage; this record says WHICH object, how large it is, and what it is, so
8
+ * an execution can resolve the object and the Host can prove the recorded
9
+ * claim against the storage before the claim reaches the ledger.
10
+ *
11
+ * The module is pure (no cordis, no runtime imports) so both halves — the Host
12
+ * ledger and the browser form — share one vocabulary and one set of limits.
13
+ */
14
+ /** What one attachment holds: a raster image or an arbitrary file. */
15
+ export type TaskAttachmentKind = 'image' | 'file';
16
+ /**
17
+ * One attachment of a card: identity, size and type, plus the digest of the
18
+ * exact bytes the Host stored.
19
+ *
20
+ * An image carries its intrinsic pixel size; a file carries neither. The
21
+ * display name is always the CANONICAL form (see
22
+ * {@link canonicalAttachmentName}): single-line, without any path part, so a
23
+ * name can never break the prompt an execution reads.
24
+ */
25
+ export interface TaskAttachment {
26
+ /** Whether the object is a raster image or an arbitrary file. */
27
+ kind: TaskAttachmentKind;
28
+ /** Opaque storage identifier of the stored object; never a path or a URL. */
29
+ attachmentId: string;
30
+ /** Canonical display name; never a local path, never multi-line. */
31
+ name: string;
32
+ /** Exact stored byte length. */
33
+ bytes: number;
34
+ /** Media type of the stored bytes. */
35
+ mediaType: string;
36
+ /** Lowercase hex sha256 digest of the exact stored bytes. */
37
+ sha256: string;
38
+ /** Intrinsic pixel width; images only, always positive. */
39
+ width?: number;
40
+ /** Intrinsic pixel height; images only, always positive. */
41
+ height?: number;
42
+ }
43
+ /** Maximum number of attachments one card may carry. */
44
+ export declare const TASK_ATTACHMENT_LIMIT = 8;
45
+ /** Maximum byte length of one attachment (10 MiB). */
46
+ export declare const TASK_ATTACHMENT_MAX_BYTES: number;
47
+ /** Maximum byte length of all attachments of one card together (32 MiB). */
48
+ export declare const TASK_ATTACHMENT_TOTAL_MAX_BYTES: number;
49
+ /** Raster media types the official image path accepts. */
50
+ export declare const TASK_ATTACHMENT_IMAGE_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
51
+ /**
52
+ * The canonical display name of an attachment.
53
+ *
54
+ * A name reaches the ledger from two directions: the browser picks it, and an
55
+ * execution prompt reads it. Both make one form mandatory — the name must be
56
+ * a single line without any path part, so it can neither break out of the
57
+ * prompt line nor point at a directory.
58
+ *
59
+ * The canonical form is therefore: the LEAF of whatever path-like text was
60
+ * offered, every control character (a newline included) turned into a space,
61
+ * whitespace runs collapsed into one space, the result trimmed and bounded.
62
+ * An empty result becomes a fixed placeholder.
63
+ *
64
+ * The Host upload path canonicalizes the name BEFORE publishing it, and the
65
+ * wire gate accepts only a name that already IS canonical — so the name the
66
+ * ledger holds and the name the storage holds are the same string.
67
+ * @param value - the offered name.
68
+ * @returns the canonical name.
69
+ */
70
+ export declare function canonicalAttachmentName(value: unknown): string;
71
+ /**
72
+ * Whether an unknown value is a well-formed attachment (the STRICT gate: the
73
+ * wire path uses it, so a hand-written payload cannot smuggle an extra field
74
+ * onto the ledger, a path-like name, or an image without its pixel size).
75
+ * @param value - the candidate attachment.
76
+ * @returns whether the value is a usable attachment.
77
+ */
78
+ export declare function isTaskAttachment(value: unknown): value is TaskAttachment;
79
+ /**
80
+ * Repair one persisted attachment entry: canonicalize its name and keep the
81
+ * fields that are usable. An entry that cannot be repaired — an unknown kind,
82
+ * a malformed identifier, an image without its pixel size — is dropped.
83
+ * @param value - the persisted entry.
84
+ * @returns the repaired attachment, or undefined when it cannot be repaired.
85
+ */
86
+ export declare function repairAttachment(value: unknown): TaskAttachment | undefined;
87
+ /**
88
+ * Whether a list satisfies the card-wide attachment limits: the count, the
89
+ * per-item byte cap, and the total byte cap.
90
+ * @param attachments - the candidate list.
91
+ * @returns whether the list fits every limit.
92
+ */
93
+ export declare function attachmentsWithinLimits(attachments: readonly TaskAttachment[]): boolean;
94
+ /**
95
+ * Drop the repeated storage identifiers of a list, keeping the FIRST entry of
96
+ * each identifier.
97
+ *
98
+ * The storage is content-addressed, so the same bytes uploaded twice produce
99
+ * the same identifier. A list that carried the identifier twice would render
100
+ * two rows for one object and claim it twice against the card's limits, so the
101
+ * list is deduplicated at the boundary that can produce it.
102
+ * @param attachments - the candidate list.
103
+ * @returns the deduplicated list, in the original order.
104
+ */
105
+ export declare function dedupeAttachments(attachments: readonly TaskAttachment[]): TaskAttachment[];
106
+ /**
107
+ * Whether an unknown value is a well-formed attachment LIST (the strict wire
108
+ * gate). The list must be non-empty: clearing attachments is expressed by
109
+ * omitting the field (create) or by an explicit null (update), never by an
110
+ * empty array. A list that repeats one storage identifier is refused: one
111
+ * object cannot be claimed twice.
112
+ * @param value - the candidate list.
113
+ * @returns whether the list may reach the ledger.
114
+ */
115
+ export declare function isTaskAttachmentList(value: unknown): value is TaskAttachment[];
116
+ /**
117
+ * Repair a persisted attachment list: canonicalize the names, drop the
118
+ * entries that cannot be repaired, deduplicate the storage identifiers, and
119
+ * cap the count and the byte totals. Returns undefined when nothing usable
120
+ * remains, so the caller clears the field instead of storing an empty list —
121
+ * the same policy the tag and schedule repairs follow.
122
+ * @param value - the persisted value.
123
+ * @returns the repaired list, or undefined when nothing survives.
124
+ */
125
+ export declare function normalizeAttachments(value: unknown): TaskAttachment[] | undefined;
126
+ /**
127
+ * The attachment of a list whose storage identifier matches, or undefined.
128
+ * @param attachments - the list to search.
129
+ * @param attachmentId - the storage identifier to find.
130
+ * @returns the matching attachment, or undefined.
131
+ */
132
+ export declare function findAttachment(attachments: readonly TaskAttachment[] | undefined, attachmentId: string): TaskAttachment | undefined;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * New-card defaults: the execution targets a freshly created card starts from,
3
+ * and how they combine with what the caller picked and with the card a subtask
4
+ * or a duplicate is created from.
5
+ *
6
+ * Framework-free (no cordis, no runtime imports) because BOTH halves compile
7
+ * it: the Host resolves the seed when it writes the card, and the browser
8
+ * resolves the same seed to open the new-task dialog on it. One pure function
9
+ * is the only place the rules live, so the dialog and the ledger cannot drift.
10
+ *
11
+ * Every target is resolved in ONE order: what the caller picked wins over the
12
+ * value carried over from the card this one is created from, which wins over
13
+ * the board's new-card defaults, and a target nothing supplies stays blank
14
+ * ("no pin, resolved at run time"). A duplicate is a copy of its source and a
15
+ * subtask is derived from its parent, so both keep the source's own pins and
16
+ * fill only the fields that source left unset.
17
+ *
18
+ * The permission of a PARENT is the one exception: it never participates. The
19
+ * permission is not copied onto a card at creation — doing so would also have
20
+ * to copy the parent's human confirmation to stay runnable, and a detached
21
+ * child would keep both, so one confirmed parent would mint unbounded confirmed
22
+ * elevated roots. It is resolved along the ancestor chain at launch instead
23
+ * (core/subtask.ts), which is what makes detaching remove the inheritance by
24
+ * construction. A duplicate is not a hierarchy link, so it copies the
25
+ * permission like every other target. The board's own default permission is not
26
+ * a parent binding either and does apply to a subtask; it only pre-fills the
27
+ * card, and a value above the session baseline still needs a human
28
+ * confirmation before the card may run.
29
+ *
30
+ * The reasoning level is bound to the model route it was chosen for and never
31
+ * crosses to another one:
32
+ *
33
+ * - a level the caller picked is used as it stands;
34
+ * - a caller that pinned a model of its own inherits no level at all, not
35
+ * even one the same model happens to carry on the source card;
36
+ * - otherwise the source card's level travels with the source value it was
37
+ * stored on, exactly as the card's own model/level pair does, and wins over
38
+ * the board default level, so a board that configures none behaves exactly
39
+ * as the create path always has;
40
+ * - a board default level applies only while the card's final model IS the
41
+ * configured default model, and a blank default model makes it inert —
42
+ * a level the resolved model does not declare could only be refused by
43
+ * model selection at run time.
44
+ */
45
+ import type { TaskRecord } from './tasks.ts';
46
+ /** The board's configured new-card defaults; a blank target means "not set". */
47
+ export interface CardDefaults {
48
+ /** Agent preset a new card starts from. */
49
+ mode?: string;
50
+ /** Permission a new card starts from. */
51
+ permission?: string;
52
+ /** Model a new card starts from. */
53
+ model?: string;
54
+ /** Reasoning level a new card starts from, for the model above. */
55
+ reasoningEffort?: string;
56
+ }
57
+ /** The card a new one is created from, and how it is derived from it. */
58
+ export interface CardTargetSource {
59
+ /** A copy of the source card, or a subtask of it. */
60
+ kind: 'duplicate' | 'parent';
61
+ /** The source card's execution targets. */
62
+ task: Pick<TaskRecord, 'mode' | 'permission' | 'model' | 'reasoningEffort'>;
63
+ }
64
+ /** The resolved targets of the card about to be created; blank means "unset". */
65
+ export interface CardTargetSeed {
66
+ mode: string;
67
+ permission: string;
68
+ model: string;
69
+ reasoningEffort: string;
70
+ }
71
+ /**
72
+ * Resolve the execution targets a new card starts from.
73
+ * @param defaults - the board's configured new-card defaults, if any.
74
+ * @param source - the card this one is created from (a duplicate or a parent), if any.
75
+ * @param picked - what the caller chose explicitly; a non-blank value wins.
76
+ * @returns the four targets, blank where nothing supplies a value.
77
+ */
78
+ export declare function resolveCardTargets(defaults: CardDefaults | undefined, source: CardTargetSource | undefined, picked?: Partial<CardTargetSeed>): CardTargetSeed;
@@ -13,10 +13,11 @@
13
13
  */
14
14
  import type { TaskStore } from './store.ts';
15
15
  import { type NewTaskInput, type TaskRecord, type TaskStatus } from './tasks.ts';
16
+ import type { TaskAttachment, TaskAttachmentKind } from './attachment.ts';
16
17
  import { type SetSchedulePatch } from './use-cases/task-schedule.ts';
17
18
  import { type TaskUpdatePatch } from './use-cases/task-update.ts';
18
19
  import type { TaskBoardAction, TaskBoardEventPayload, TaskBoardParseDraft, TaskBoardParseRequest, TaskBoardSnapshot } from '../protocol.ts';
19
- import type { TaskBoardExtensionActionRequest, TaskBoardVisibilityPredicate } from './extension.ts';
20
+ import type { TaskBoardExtensionActionRequest, TaskBoardGroupingSelector, TaskBoardVisibilityPredicate } from './extension.ts';
20
21
  export interface TaskBoardTransport {
21
22
  bootstrap(legacy: readonly TaskRecord[]): Promise<TaskBoardSnapshot>;
22
23
  state(): Promise<TaskBoardSnapshot>;
@@ -31,6 +32,12 @@ export interface TaskBoardTransport {
31
32
  * that cannot parse simply omits it, and the form hides the section.
32
33
  */
33
34
  parseDraft?(request: TaskBoardParseRequest, signal?: AbortSignal): Promise<TaskBoardParseDraft>;
35
+ /**
36
+ * Upload one file or image into the Host's attachment storage. Optional: a
37
+ * deployment that serves no attachment storage omits it, and the form then
38
+ * refuses to stage an attachment.
39
+ */
40
+ uploadAttachment?(file: File, kind: TaskAttachmentKind): Promise<TaskAttachment>;
34
41
  }
35
42
  /**
36
43
  * The sessions face the controller needs for navigation awareness. The Client
@@ -100,6 +107,17 @@ export interface ExecutionModelOption {
100
107
  name?: string;
101
108
  label?: string;
102
109
  provider?: string;
110
+ /**
111
+ * Reasoning metadata the adapter declares for this exact route. An effort
112
+ * picker is offered only while `supported`, and its choices are `efforts` —
113
+ * the ids the target model really accepts, so the UI never offers (or keeps)
114
+ * a level the model would reject. Absent means the deployment published no
115
+ * capability for this model; the card value is then left untouched.
116
+ */
117
+ reasoning?: {
118
+ supported: boolean;
119
+ efforts?: readonly string[];
120
+ };
103
121
  }
104
122
  /** The execution-target option sets the UI feeds into the controller. */
105
123
  export interface ExecutionOptionsSnapshot {
@@ -112,7 +130,7 @@ export interface ExecutionOptionsSnapshot {
112
130
  * (revision/scheduler/power); a full snapshot also carries the deployment
113
131
  * constants the UI reads (session default permission, subtask depth).
114
132
  */
115
- export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'teamRunAvailable' | 'goalRunEnabled' | 'extensions'>;
133
+ export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'goalRunEnabled' | 'cardDefaults' | 'extensions' | 'attachmentLimits'>;
116
134
  /** Immutable controller snapshot for UI subscriptions. */
117
135
  export interface ControllerSnapshot {
118
136
  tasks: readonly TaskRecord[];
@@ -136,6 +154,8 @@ export interface ControllerSnapshot {
136
154
  * hand-built snapshot (tests, a shell-less composition) defaults to visible.
137
155
  */
138
156
  visibility?: readonly TaskBoardVisibilityPredicate[];
157
+ /** Provider source-group selectors, in registration order; browser-only functions. */
158
+ grouping?: readonly TaskBoardGroupingSelector[];
139
159
  /** Read-only summaries published by running extensions, keyed by extension id. */
140
160
  extensions?: Readonly<Record<string, unknown>>;
141
161
  }
@@ -163,6 +183,8 @@ export declare class BoardController {
163
183
  private hostState;
164
184
  /** Provider visibility predicates (immutable array; replaced on change). */
165
185
  private visibility;
186
+ /** Provider source-group selectors (immutable array; replaced on change). */
187
+ private grouping;
166
188
  private remoteSubscribed;
167
189
  private remoteInitialization;
168
190
  /** @param deps - store and the sessions navigation face. */
@@ -177,6 +199,8 @@ export declare class BoardController {
177
199
  * both changes notify subscribers so the board re-renders.
178
200
  */
179
201
  registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void;
202
+ /** Register one source-group selector; registration order breaks ownership ties. */
203
+ registerGrouping(selector: TaskBoardGroupingSelector): () => void;
180
204
  /**
181
205
  * Deliver one provider action through the board's same-origin channel. A
182
206
  * board without a Host transport (the legacy in-memory path) refuses it.
@@ -187,6 +211,19 @@ export declare class BoardController {
187
211
  isHostBacked(): boolean;
188
212
  /** Retry initial migration/state synchronization after an explicit Host error. */
189
213
  retryHostSync(): Promise<boolean>;
214
+ /**
215
+ * Re-read the authoritative Host snapshot.
216
+ *
217
+ * The board's volatile deployment configuration — the new-card defaults among
218
+ * it — is republished the moment the settings document is written, but the SSE
219
+ * frame that republish emits carries the value as of BEFORE the write (the
220
+ * loader hands the update to the fiber while the new document is not yet
221
+ * visible to it), so a mirror that followed frames alone would stay one edit
222
+ * behind and the create dialog would prefill from the previous defaults for
223
+ * the rest of the session. The surface that owns the write asks for the
224
+ * snapshot again instead of trusting the frame.
225
+ */
226
+ refreshHostState(): void;
190
227
  /**
191
228
  * Show the board. The layout owns which panel the center column renders, so
192
229
  * the state flip and the panel selection travel together here; a composition
@@ -255,6 +292,17 @@ export declare class BoardController {
255
292
  * phrases every failure for the user, so its message surfaces unchanged.
256
293
  */
257
294
  parseTaskDraft(request: TaskBoardParseRequest, signal?: AbortSignal): Promise<TaskBoardParseDraft>;
295
+ /**
296
+ * Upload one attachment into the Host's attachment storage.
297
+ *
298
+ * The form calls this when the card is SAVED, never when a file is picked:
299
+ * a staged file is a local preview until the card is really saved.
300
+ * @param file - the picked file.
301
+ * @param kind - whether the file is stored as an image or verbatim.
302
+ * @returns the metadata the Host computed, or undefined when this
303
+ * deployment serves no attachment storage.
304
+ */
305
+ uploadAttachment(file: File, kind: TaskAttachmentKind): Promise<TaskAttachment | undefined>;
258
306
  moveTask(id: string, status: TaskStatus): void;
259
307
  deleteTask(id: string): void;
260
308
  /**
@@ -359,12 +407,13 @@ export declare class BoardController {
359
407
  */
360
408
  private mirrorDepth;
361
409
  /**
362
- * Project a Host snapshot onto the browser's mirror. SSE frames and partial
363
- * snapshots carry only the volatile subset (revision/scheduler/power), so the
364
- * deployment constants the UI reads — the session-default permission the
365
- * confirmation banner compares against and the subtask depth limit — are
366
- * carried over from the last full snapshot instead of being dropped by a
367
- * heartbeat frame.
410
+ * Project a Host snapshot onto the browser's mirror. Every snapshot the
411
+ * transport serves is a full document (bootstrap/state/action all answer
412
+ * `TaskBoardHostService.snapshot()`), so the deployment constants the UI reads
413
+ * — the session-default permission the confirmation banner compares against,
414
+ * the subtask depth limit, the platform switches and the extensions a provider
415
+ * published — are taken as published, carried over only where the snapshot
416
+ * itself omits the key.
368
417
  */
369
418
  private mirrorOf;
370
419
  private refreshRemote;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * What one execution left behind: the text of its last assistant message,
3
+ * recorded on the execution record next to the verdict it belongs to.
4
+ *
5
+ * A settled execution used to carry only a verdict, so a parent card could see
6
+ * that a subtask succeeded without ever seeing what it produced, and had to
7
+ * guess or redo the work. The card's own content cannot answer that: card
8
+ * content is the plan and freezes at the first execution
9
+ * (`canEditTaskContent`), so the closing words of a run are recorded on the
10
+ * execution record instead.
11
+ *
12
+ * Pure (no cordis, no runtime imports) so the settlement path is unit-testable
13
+ * without a session, and so a text-less run degrades to "no field" rather than
14
+ * to an empty string.
15
+ */
16
+ import { type ExecutionSummary } from './tasks.ts';
17
+ /** Structural view of one session event, as both readers expose it. */
18
+ export interface SummaryEvent {
19
+ type?: unknown;
20
+ seq?: unknown;
21
+ time?: unknown;
22
+ data?: unknown;
23
+ }
24
+ /**
25
+ * Bound one summary, keeping its tail: the closing paragraphs carry the
26
+ * conclusion a reader is after, and the omitted opening is announced instead of
27
+ * silently dropped. Mirrors the evidence reader's tail bound.
28
+ */
29
+ export declare function truncateExecutionSummary(text: string, limit?: number): string;
30
+ /**
31
+ * The summary one execution's own events support.
32
+ *
33
+ * Only events at or after `startedAt` belong to this run: a reused session
34
+ * carries the history of earlier executions, which must not be reported as this
35
+ * one's output. The last assistant message WITH prose wins — a trailing
36
+ * tool-call or reasoning-only message has nothing to leave behind, so the reader
37
+ * walks back to the last one that speaks.
38
+ * @param events - the session events the inspection already read.
39
+ * @param startedAt - the execution's start instant (ms epoch); 0 means "all".
40
+ * @returns the bounded summary with the seq it came from, or undefined when the
41
+ * run left no usable text.
42
+ */
43
+ export declare function executionSummaryOf(events: readonly SummaryEvent[], startedAt: number): ExecutionSummary | undefined;
44
+ /**
45
+ * Repair one persisted or reported summary.
46
+ *
47
+ * A summary is informational, so an unreadable one is dropped on its own rather
48
+ * than costing the execution (or the task row) it hangs on. A hand-edited
49
+ * overlong text is bounded on the way in, so no reader ever holds more than the
50
+ * limit.
51
+ */
52
+ export declare function normalizeExecutionSummary(value: unknown): ExecutionSummary | undefined;