@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
package/src/loopback.ts CHANGED
@@ -8,6 +8,19 @@
8
8
  * Semantics: RFC 5735 IPv4 127/8, ::1, IPv4-mapped ::ffff:127/8 (matching the
9
9
  * remote-web-ui gate), localhost hostnames, plus the browser same-origin
10
10
  * markers (sec-fetch-site and Origin) for the request-level fence.
11
+ *
12
+ * A reverse proxy in front of the host rewrites the Host header to its own
13
+ * upstream literal (a Cloudflare tunnel, frp and an nginx reverse proxy all
14
+ * dial 127.0.0.1:<port>), and the socket the origin sees is the proxy's, which
15
+ * is loopback by construction. Both halves of the fence then hold for a public
16
+ * request. Forwarding headers are the signal that a hop stands in between: a
17
+ * request that carries CF-Connecting-IP or X-Forwarded-For is answered through
18
+ * a proxy and is never treated as a local one (issue #1906).
19
+ *
20
+ * An operator who runs that proxy or tunnel themselves can opt into the
21
+ * narrower case: isForwardedLoopbackRequest describes a forwarded request that
22
+ * still landed on this machine's loopback upstream, and a route family admits
23
+ * it only behind its own default-off switch (issue #1918).
11
24
  * @module dsh-web-shared/host/loopback
12
25
  */
13
26
 
@@ -36,13 +49,29 @@ export function isLoopbackHostname(hostname: string): boolean {
36
49
  return isIPv4Loopback(hostname)
37
50
  }
38
51
 
52
+ /**
53
+ * Whether a reverse proxy stood between the client and this host: the request
54
+ * carries CF-Connecting-IP or X-Forwarded-For. Either header is stamped by a
55
+ * hop that forwards traffic, so the request did not originate on this machine.
56
+ * @param request - node HTTP request.
57
+ * @returns true when a forwarding header is present.
58
+ */
59
+ export function isProxiedRequest(request: IncomingMessage): boolean {
60
+ return request.headers['cf-connecting-ip'] !== undefined
61
+ || request.headers['x-forwarded-for'] !== undefined
62
+ }
63
+
39
64
  /**
40
65
  * Request-level trust fence: a loopback socket address AND a loopback Host
41
66
  * header, plus browser same-origin markers. The socket address is
42
- * authoritative; X-Forwarded-For is never trusted.
67
+ * authoritative for a direct connection; a request that carries a forwarding
68
+ * header is refused outright, because a proxy in front of the host makes both
69
+ * the socket address and the Host header describe the proxy rather than the
70
+ * client. X-Forwarded-For is therefore never evidence *for* loopback.
43
71
  */
44
72
  export function isLoopbackRequest(request: IncomingMessage): boolean {
45
73
  if (!isLoopbackAddress(request.socket.remoteAddress)) return false
74
+ if (isProxiedRequest(request)) return false
46
75
  const host = request.headers.host
47
76
  if (typeof host !== 'string') return false
48
77
  let hostUrl: URL
@@ -61,3 +90,30 @@ export function isLoopbackRequest(request: IncomingMessage): boolean {
61
90
  return false
62
91
  }
63
92
  }
93
+
94
+ /**
95
+ * Whether a forwarded request landed on this machine's loopback upstream: a
96
+ * forwarding header (the proxy's own stamp), a loopback socket address (the
97
+ * proxy dials 127.0.0.1:<port>), and a loopback Host header (the proxy rewrote
98
+ * the authority to its upstream literal).
99
+ *
100
+ * This is a fact about the route, not a trust decision. A public request to a
101
+ * tunnel satisfies all three by construction, because the proxy is the client
102
+ * of this process: only a caller that operates the proxy can decide it stands
103
+ * for the browser, which is why every consumer keeps this behind an explicit
104
+ * default-off switch and its own browser markers. isLoopbackRequest is
105
+ * unchanged and still refuses a forwarded request (issue #1906).
106
+ * @param request - node HTTP request.
107
+ * @returns true when a forwarding header, a loopback socket, and a loopback Host all hold.
108
+ */
109
+ export function isForwardedLoopbackRequest(request: IncomingMessage): boolean {
110
+ if (!isProxiedRequest(request)) return false
111
+ if (!isLoopbackAddress(request.socket.remoteAddress)) return false
112
+ const host = request.headers.host
113
+ if (typeof host !== 'string') return false
114
+ try {
115
+ return isLoopbackHostname(new URL('http://' + host).hostname)
116
+ } catch {
117
+ return false
118
+ }
119
+ }
package/src/protocol.ts CHANGED
@@ -5,15 +5,18 @@ import { parseLedger } from './core/store.ts'
5
5
  import { isValidTimeZone } from './core/schedule.ts'
6
6
  import { sanitizeFreezeSnapshot, type FreezeSnapshot } from './core/freeze-snapshot.ts'
7
7
  import { sanitizeHandover, type TaskHandoverInput } from './core/handover.ts'
8
- import { isTaskBoardExtensionPayload, normalizeTaskIntegrations, type TaskBoardExtensionPayload } from './core/extension.ts'
8
+ import { TASK_BOARD_MESSAGE_MAX_LENGTH, isTaskBoardExtensionPayload, normalizeTaskIntegrations, type TaskBoardExtensionPayload } from './core/extension.ts'
9
9
  import { normalizeVerification, type ModelCatalogView, type VerificationContract, type VerificationSettings } from './core/verification.ts'
10
+ import { isTaskAttachmentList, TASK_ATTACHMENT_LIMIT, TASK_ATTACHMENT_MAX_BYTES, TASK_ATTACHMENT_TOTAL_MAX_BYTES } from './core/attachment.ts'
10
11
 
11
12
  /** Freeze payload carried by create/update actions after the gate (redacted in place). */
12
13
  type FreezePayload = FreezeSnapshot & { redacted?: boolean; frozenBy?: string }
13
14
 
14
- export const TASK_BOARD_SCHEMA_VERSION = 6 as const
15
- /** Ledger documents written before v6; loaded once and migrated on startup. */
16
- export const TASK_BOARD_LEGACY_SCHEMA_VERSION = 5 as const
15
+ export const TASK_BOARD_SCHEMA_VERSION = 7 as const
16
+ /** Ledger documents written before v7; loaded once and migrated on startup. */
17
+ export const TASK_BOARD_LEGACY_SCHEMA_VERSION = 6 as const
18
+ /** Ledger documents written before v6 (the scheduling mode and run budget). */
19
+ export const TASK_BOARD_PRE_RUN_BUDGET_SCHEMA_VERSION = 5 as const
17
20
  /** Ledger documents written before v5; migrated through the v5 normalization too. */
18
21
  export const TASK_BOARD_PRE_ACCEPTANCE_SCHEMA_VERSION = 4 as const
19
22
  /** Ledger documents written before v4; migrated through the v4 normalization too. */
@@ -29,12 +32,14 @@ export const TASK_BOARD_OLDEST_SCHEMA_VERSION = 2 as const
29
32
  export const TASK_BOARD_ZONE_STAMP_SCHEMA_VERSION = 4 as const
30
33
  /**
31
34
  * Every older generation the loader migrates in place. v5 only added the
32
- * per-execution acceptance block and v6 only added the scheduling mode and run
33
- * budget, so the migration is the normalization pass that re-validates each
34
- * row; a document from any listed generation upgrades losslessly.
35
+ * per-execution acceptance block, v6 only added the scheduling mode and run
36
+ * budget, and v7 only added the card attachment metadata, so the migration is
37
+ * the normalization pass that re-validates each row; a document from any
38
+ * listed generation upgrades losslessly.
35
39
  */
36
40
  export const TASK_BOARD_MIGRATABLE_SCHEMA_VERSIONS: readonly number[] = [
37
41
  TASK_BOARD_LEGACY_SCHEMA_VERSION,
42
+ TASK_BOARD_PRE_RUN_BUDGET_SCHEMA_VERSION,
38
43
  TASK_BOARD_PRE_ACCEPTANCE_SCHEMA_VERSION,
39
44
  TASK_BOARD_OLDER_SCHEMA_VERSION,
40
45
  TASK_BOARD_OLDEST_SCHEMA_VERSION,
@@ -80,11 +85,6 @@ export interface TaskBoardSnapshot {
80
85
  * disable the subtask controls; the Host ledger is the authority.
81
86
  */
82
87
  maxSubtaskDepth?: number
83
- /**
84
- * Whether this deployment serves the Agent Teams service, so a task may opt
85
- * into team execution (Team Lead session plus one teammate per subtask).
86
- */
87
- teamRunAvailable?: boolean
88
88
  /**
89
89
  * Live GLOBAL native-/goal switch. The browser uses it to disable the
90
90
  * task-level option (and explain that the global switch must be turned on
@@ -93,11 +93,39 @@ export interface TaskBoardSnapshot {
93
93
  * flight.
94
94
  */
95
95
  goalRunEnabled?: boolean
96
+ /**
97
+ * New-card defaults this deployment configures: what the create dialog opens
98
+ * with, and what the create path fills an omitted target from when the caller
99
+ * opts in (`applyCardDefaults`). A target the board configures nothing for is
100
+ * omitted rather than published blank, so the browser can tell "no default
101
+ * model" from "a blank one".
102
+ */
103
+ cardDefaults?: { mode?: string; permission?: TaskPermission; model?: string; reasoningEffort?: string }
96
104
  /**
97
105
  * Read-only summaries published by running extensions, keyed by extension id.
98
106
  * The board forwards them verbatim; it never interprets their shape.
99
107
  */
100
108
  extensions?: Record<string, unknown>
109
+ /**
110
+ * The attachment limits this deployment enforces, so the browser can refuse
111
+ * an oversized selection before it uploads anything. The board's own caps
112
+ * are the ceiling; a deployment whose attachment storage publishes stricter
113
+ * image limits lowers the bounds it publishes here.
114
+ */
115
+ attachmentLimits?: {
116
+ /** Maximum number of attachments one card may carry. */
117
+ maxAttachments: number
118
+ /** Maximum byte length of one attachment. */
119
+ maxBytes: number
120
+ /** Maximum byte length of all attachments of one card together. */
121
+ maxTotalBytes: number
122
+ /** Maximum number of IMAGES one card may carry (the official per-message budget). */
123
+ maxImages: number
124
+ /** Maximum byte length of one image. */
125
+ maxImageBytes: number
126
+ /** Maximum byte length of all images of one card together (the official per-message budget). */
127
+ maxMessageImageBytes: number
128
+ }
101
129
  }
102
130
 
103
131
  /**
@@ -178,6 +206,12 @@ export type TaskBoardAction =
178
206
  | { kind: 'set-schedule'; taskId: string; patch: SetSchedulePatch }
179
207
  | { kind: 'run'; taskId: string }
180
208
  | { kind: 'rerun'; taskId: string }
209
+ /**
210
+ * Re-run an executed card in its own session, carrying rework instructions as
211
+ * this run's additional input. Every run gate applies exactly as it does to
212
+ * `rerun`, and the card's frozen content is never rewritten.
213
+ */
214
+ | { kind: 'rework'; taskId: string; instructions: string }
181
215
  | { kind: 'confirm-permission'; taskId: string }
182
216
  | { kind: 'set-parent'; taskId: string; parentId: string | null }
183
217
  /** Ledger-wide label management; see core/use-cases/task-tag.ts. */
@@ -263,7 +297,13 @@ function validImportedKnownFields(value: Record<string, unknown>): boolean {
263
297
  // must carry a well-formed list or none at all, so a hand-edited export
264
298
  // cannot smuggle a malformed tag past the gate.
265
299
  if (value.tags !== undefined && !isTaskTagList(value.tags)) return false
300
+ // The model pin is carried by the import (with the level bound to it), so a
301
+ // non-string value is refused here like the other carried known fields.
302
+ if (value.model !== undefined && typeof value.model !== 'string') return false
266
303
  if (value.integrations !== undefined && normalizeTaskIntegrations(value.integrations) === undefined) return false
304
+ // 安全门(对抗场景 e):import 不接受附件——旧版浏览器导出从不携带附件,
305
+ // 一条声称携带附件的导入必须被拒绝,而不是让未经校验的引用进入账本。
306
+ if (value.attachments !== undefined) return false
267
307
  if (value.schedule !== undefined && !validImportedSchedule(value.schedule)) return false
268
308
  if (value.executions !== undefined) {
269
309
  if (!Array.isArray(value.executions)) return false
@@ -326,7 +366,15 @@ function importedTask(value: unknown): TaskRecord | undefined {
326
366
  ...(task.parentId === undefined ? {} : { parentId: task.parentId }),
327
367
  ...(task.workspaceId === undefined ? {} : { workspaceId: task.workspaceId }),
328
368
  ...(task.mode === undefined ? {} : { mode: task.mode }),
369
+ // The model pin rides the import together with the level bound to it: the
370
+ // two are one pair, and an imported level without its model would run at
371
+ // whatever route the session happens to be on. Blank text means "no pin",
372
+ // like every other target, so it is not carried as a pin of its own.
373
+ ...(typeof task.model !== 'string' || task.model.trim() === '' ? {} : { model: task.model }),
329
374
  ...(task.permission === undefined ? {} : { permission: task.permission }),
375
+ // The reasoning effort rides the import like the other execution targets: it
376
+ // is the user's own card preference, not a verdict.
377
+ ...(task.reasoningEffort === undefined ? {} : { reasoningEffort: task.reasoningEffort }),
330
378
  ...(task.reuseSession === undefined ? {} : { reuseSession: task.reuseSession }),
331
379
  ...(task.goalRun === undefined ? {} : { goalRun: task.goalRun }),
332
380
  // The per-card acceptance opt-out rides the import like the /goal opt-in:
@@ -372,17 +420,25 @@ function handoverPayload(value: unknown): TaskHandoverInput | undefined {
372
420
 
373
421
  function createInput(value: unknown): value is NewTaskInput {
374
422
  const input = record(value)
375
- if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reuseSession', 'teamRun', 'goalRun', 'skipVerification', 'tags', 'integrations'])) return false
423
+ if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reasoningEffort', 'applyCardDefaults', 'reuseSession', 'goalRun', 'skipVerification', 'tags', 'integrations', 'attachments'])) return false
376
424
  if (input.parentId !== undefined && (typeof input.parentId !== 'string' || input.parentId.trim() === '')) return false
377
425
  if (typeof input.title !== 'string' || typeof input.description !== 'string' || typeof input.prompt !== 'string') return false
378
- if (!optionalString(input.workspaceId) || !optionalString(input.mode) || !optionalString(input.model)) return false
426
+ // The reasoning effort is an adapter-owned id the Host resolves against the
427
+ // live model catalog, so this gate only keeps a malformed value (a number, an
428
+ // object, null) off the ledger; blank text means "inherit" like every other
429
+ // pinned target.
430
+ if (!optionalString(input.workspaceId) || !optionalString(input.mode) || !optionalString(input.model) || !optionalString(input.reasoningEffort)) return false
431
+ if (input.applyCardDefaults !== undefined && typeof input.applyCardDefaults !== 'boolean') return false
379
432
  if (input.reuseSession !== undefined && typeof input.reuseSession !== 'boolean') return false
380
- if (input.teamRun !== undefined && typeof input.teamRun !== 'boolean') return false
381
433
  if (input.goalRun !== undefined && typeof input.goalRun !== 'boolean') return false
382
434
  if (input.skipVerification !== undefined && typeof input.skipVerification !== 'boolean') return false
383
435
  if (input.permission !== undefined && !isTaskPermission(input.permission)) return false
384
436
  if (input.tags !== undefined && !isTaskTagList(input.tags)) return false
385
437
  if (input.integrations !== undefined && normalizeTaskIntegrations(input.integrations) === undefined) return false
438
+ // Attachments are host-verified against the official storage before the
439
+ // ledger sees them; the wire gate only keeps a malformed, duplicated or
440
+ // oversized list off the action.
441
+ if (input.attachments !== undefined && !isTaskAttachmentList(input.attachments)) return false
386
442
  if (input.freeze !== undefined && freezePayload(input.freeze) === undefined) return false
387
443
  if (input.handover !== undefined && handoverPayload(input.handover) === undefined) return false
388
444
  if (input.schedule !== undefined) {
@@ -402,22 +458,24 @@ function createInput(value: unknown): value is NewTaskInput {
402
458
 
403
459
  function updatePatch(value: unknown): boolean {
404
460
  const patch = record(value)
405
- if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reuseSession', 'teamRun', 'goalRun', 'skipVerification', 'tags'])) return false
461
+ if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reasoningEffort', 'reuseSession', 'goalRun', 'skipVerification', 'tags', 'attachments'])) return false
406
462
  // null (or false) clears the reuse opt-in; only a real boolean is accepted.
407
463
  if (patch.reuseSession !== undefined && patch.reuseSession !== null && typeof patch.reuseSession !== 'boolean') return false
408
- if (patch.teamRun !== undefined && patch.teamRun !== null && typeof patch.teamRun !== 'boolean') return false
409
464
  // The goal opt-in is tri-state: null/true return the card to its default
410
465
  // (goal run), false pins a single plain turn.
411
466
  if (patch.goalRun !== undefined && patch.goalRun !== null && typeof patch.goalRun !== 'boolean') return false
412
467
  // The acceptance opt-out is the mirror tri-state: null/false return the card
413
468
  // to inheriting the board-wide switch, true pins it out of the gate.
414
469
  if (patch.skipVerification !== undefined && patch.skipVerification !== null && typeof patch.skipVerification !== 'boolean') return false
415
- for (const key of ['title', 'description', 'prompt', 'workspaceId', 'mode', 'model'] as const) {
470
+ for (const key of ['title', 'description', 'prompt', 'workspaceId', 'mode', 'model', 'reasoningEffort'] as const) {
416
471
  if (!optionalString(patch[key])) return false
417
472
  }
418
473
  if (patch.permission !== undefined && !isTaskPermission(patch.permission)) return false
419
474
  // null clears the label set; a present array must be a well-formed list.
420
475
  if (patch.tags !== undefined && patch.tags !== null && !isTaskTagList(patch.tags)) return false
476
+ // null clears the attachment set; a present array replaces it wholesale and
477
+ // must be a well-formed list within the card-wide limits.
478
+ if (patch.attachments !== undefined && patch.attachments !== null && !isTaskAttachmentList(patch.attachments)) return false
421
479
  // null clears the snapshot; an object must pass the freeze gate.
422
480
  if (patch.freeze !== undefined && patch.freeze !== null && freezePayload(patch.freeze) === undefined) return false
423
481
  // Same convention for the handover bundle.
@@ -575,6 +633,13 @@ function parseEnvelopeAction(value: unknown): TaskBoardActionEnvelope | undefine
575
633
  },
576
634
  }
577
635
  }
636
+ case 'rework': {
637
+ if (!exactKeys(action, ['kind', 'taskId', 'instructions'])) return undefined
638
+ if (taskId === undefined || typeof action.instructions !== 'string') return undefined
639
+ const instructions = action.instructions.trim()
640
+ if (instructions === '' || instructions.length > TASK_BOARD_MESSAGE_MAX_LENGTH) return undefined
641
+ return { requestId: envelope.requestId, action: { kind: 'rework', taskId, instructions } }
642
+ }
578
643
  case 'confirm-permission':
579
644
  case 'delete':
580
645
  case 'archive':
@@ -32,6 +32,7 @@
32
32
  export const PLUGIN_TOOL_SECTION_ORDERS = {
33
33
  ssh: 150,
34
34
  'task-board': 200,
35
+ agents: 220,
35
36
  } as const
36
37
 
37
38
  /** One plugin id keyed by {@link PLUGIN_TOOL_SECTION_ORDERS}. */