@fish-under-sea/dsh-client-ui-task-board-fish 1.0.2 → 2.0.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 (125) hide show
  1. package/NOTICE +1 -1
  2. package/README.en.md +6 -4
  3. package/README.md +6 -4
  4. package/README.zh.md +6 -4
  5. package/icon.png +0 -0
  6. package/lib/client.js +4428 -1508
  7. package/lib/client.js.map +1 -1
  8. package/lib/index.js +2670 -496
  9. package/lib/types/client/CardDefaultPresetField.d.ts +35 -0
  10. package/lib/types/client/PluginSettingsCard.d.ts +130 -19
  11. package/lib/types/client/RangeBubble.d.ts +46 -0
  12. package/lib/types/client/SegmentGroup.d.ts +28 -0
  13. package/lib/types/client/TaskBoardSettingsCard.d.ts +63 -0
  14. package/lib/types/client/board/AttachmentField.d.ts +70 -0
  15. package/lib/types/client/board/ExecutionLog.d.ts +24 -0
  16. package/lib/types/client/board/ReasoningEffortField.d.ts +25 -0
  17. package/lib/types/client/board/TaskForm.d.ts +4 -0
  18. package/lib/types/client/board/VerificationReport.d.ts +2 -15
  19. package/lib/types/client/board/model-options.d.ts +87 -0
  20. package/lib/types/client/board/preset-label.d.ts +21 -0
  21. package/lib/types/client/board/preset-roster.d.ts +45 -0
  22. package/lib/types/client/board/source-group.d.ts +27 -0
  23. package/lib/types/client/body-mutations.d.ts +45 -0
  24. package/lib/types/client/host-api.d.ts +25 -0
  25. package/lib/types/client/locales.d.ts +87 -9
  26. package/lib/types/client/pending-verify.d.ts +47 -0
  27. package/lib/types/client/plugin-card-seat.d.ts +3 -1
  28. package/lib/types/client/service.d.ts +4 -1
  29. package/lib/types/client/settings-form.d.ts +73 -51
  30. package/lib/types/core/attachment.d.ts +132 -0
  31. package/lib/types/core/card-defaults.d.ts +78 -0
  32. package/lib/types/core/controller.d.ts +57 -8
  33. package/lib/types/core/execution-summary.d.ts +52 -0
  34. package/lib/types/core/extension.d.ts +116 -0
  35. package/lib/types/core/launch-width.d.ts +31 -0
  36. package/lib/types/core/reasoning-effort.d.ts +57 -0
  37. package/lib/types/core/session-reuse.d.ts +7 -1
  38. package/lib/types/core/spend-budget.d.ts +28 -0
  39. package/lib/types/core/subtask.d.ts +100 -37
  40. package/lib/types/core/tasks.d.ts +94 -10
  41. package/lib/types/core/use-cases/task-create.d.ts +10 -5
  42. package/lib/types/core/use-cases/task-tag.d.ts +36 -0
  43. package/lib/types/core/use-cases/task-update.d.ts +22 -1
  44. package/lib/types/core/wire-projection.d.ts +35 -0
  45. package/lib/types/core/workspace-target.d.ts +23 -3
  46. package/lib/types/host/attachments.d.ts +250 -0
  47. package/lib/types/host/extension-registry.d.ts +40 -0
  48. package/lib/types/host/launch-admission.d.ts +71 -0
  49. package/lib/types/host-ledger.d.ts +114 -47
  50. package/lib/types/host-routes.d.ts +63 -0
  51. package/lib/types/host-runner.d.ts +164 -18
  52. package/lib/types/host-service.d.ts +182 -46
  53. package/lib/types/host-spend.d.ts +52 -0
  54. package/lib/types/index.d.ts +173 -54
  55. package/lib/types/loopback.d.ts +41 -1
  56. package/lib/types/protocol.d.ts +52 -11
  57. package/lib/types/tool-surface.d.ts +1 -0
  58. package/locale/en.json +6 -0
  59. package/locale/zh.json +6 -0
  60. package/package.json +36 -29
  61. package/src/client/CardDefaultPresetField.tsx +101 -0
  62. package/src/client/PluginSettingsCard.tsx +385 -111
  63. package/src/client/RangeBubble.tsx +164 -0
  64. package/src/client/SegmentGroup.tsx +93 -0
  65. package/src/client/TaskBoardSettingsCard.tsx +332 -37
  66. package/src/client/board/AttachmentField.tsx +383 -0
  67. package/src/client/board/EditTaskModal.tsx +63 -0
  68. package/src/client/board/ExecutionLog.tsx +154 -0
  69. package/src/client/board/LinkSubtaskModal.tsx +1 -1
  70. package/src/client/board/NewTaskModal.tsx +154 -45
  71. package/src/client/board/ReasoningEffortField.tsx +50 -0
  72. package/src/client/board/TagManagerModal.tsx +151 -2
  73. package/src/client/board/TaskBoard.tsx +47 -10
  74. package/src/client/board/TaskCard.tsx +45 -23
  75. package/src/client/board/TaskDetail.tsx +468 -258
  76. package/src/client/board/TaskForm.tsx +19 -4
  77. package/src/client/board/VerificationReport.tsx +143 -104
  78. package/src/client/board/model-options.ts +208 -0
  79. package/src/client/board/preset-label.ts +32 -0
  80. package/src/client/board/preset-roster.ts +58 -0
  81. package/src/client/board/source-group.ts +94 -0
  82. package/src/client/board/task-markdown.module.css +11 -8
  83. package/src/client/board-settings.module.css +35 -7
  84. package/src/client/board.module.css +1044 -105
  85. package/src/client/body-mutations.ts +133 -0
  86. package/src/client/host-api.ts +70 -0
  87. package/src/client/index.ts +109 -95
  88. package/src/client/locales.ts +205 -48
  89. package/src/client/pending-verify.ts +90 -0
  90. package/src/client/plugin-card-seat.ts +8 -2
  91. package/src/client/service.ts +24 -0
  92. package/src/client/settings-card.module.css +466 -89
  93. package/src/client/settings-entry-form.ts +0 -1
  94. package/src/client/settings-form.ts +102 -60
  95. package/src/core/attachment.ts +287 -0
  96. package/src/core/card-defaults.ts +132 -0
  97. package/src/core/controller.ts +90 -11
  98. package/src/core/execution-summary.ts +96 -0
  99. package/src/core/extension.ts +120 -0
  100. package/src/core/launch-width.ts +38 -0
  101. package/src/core/reasoning-effort.ts +92 -0
  102. package/src/core/session-reuse.ts +7 -1
  103. package/src/core/spend-budget.ts +35 -0
  104. package/src/core/store.ts +19 -1
  105. package/src/core/subtask.ts +144 -68
  106. package/src/core/tasks.ts +117 -10
  107. package/src/core/use-cases/task-create.ts +27 -16
  108. package/src/core/use-cases/task-tag.ts +56 -0
  109. package/src/core/use-cases/task-update.ts +33 -5
  110. package/src/core/wire-projection.ts +81 -0
  111. package/src/core/workspace-target.ts +27 -3
  112. package/src/host/agent-tools.ts +33 -21
  113. package/src/host/attachments.ts +650 -0
  114. package/src/host/extension-registry.ts +150 -5
  115. package/src/host/launch-admission.ts +139 -0
  116. package/src/host-ledger.ts +248 -117
  117. package/src/host-routes.ts +233 -15
  118. package/src/host-runner.ts +395 -61
  119. package/src/host-service.ts +512 -139
  120. package/src/host-spend.ts +105 -0
  121. package/src/index.ts +312 -92
  122. package/src/loopback.ts +57 -1
  123. package/src/protocol.ts +83 -18
  124. package/src/tool-surface.ts +1 -0
  125. package/icon.svg +0 -3
@@ -16,6 +16,7 @@ import { TagManagerModal } from './TagManagerModal.tsx'
16
16
  import { cardTimeline, groupByRecency, readCompactColumns, RECENCY_KEY, writeCompactColumns, type RecencyGroup } from './card-view.ts'
17
17
  import { TaskCard } from './TaskCard.tsx'
18
18
  import { TaskDetail } from './TaskDetail.tsx'
19
+ import { groupTasksBySource, isSourceGroupFolded, readSourceGroupFolds, sourceGroupFoldKey, writeSourceGroupFolds, type SourceGroupView } from './source-group.ts'
19
20
 
20
21
  /** Sentinel option value of the project row's "register a new project" entry. */
21
22
  export const NEW_PROJECT_VALUE = '__dsh_new_project__'
@@ -140,6 +141,8 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
140
141
  // Density is a per-column browser preference: the long settled column starts
141
142
  // compact, and each column header toggles its own density.
142
143
  const [compactColumns, setCompactColumns] = useState<TaskStatus[]>(() => readCompactColumns(globalThis.localStorage))
144
+ // Source-group fold overrides persist per browser; done starts folded.
145
+ const [sourceFolds, setSourceFolds] = useState(() => readSourceGroupFolds(globalThis.localStorage))
143
146
  // Grouped columns whose folded "earlier" group the user expanded this visit.
144
147
  const [unfolded, setUnfolded] = useState<string[]>([])
145
148
  const [showNew, setShowNew] = useState(false)
@@ -250,15 +253,13 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
250
253
  />
251
254
  )
252
255
  /**
253
- * Settled cards in recency groups, newest first. A column longer than the
254
- * fold threshold folds its oldest group behind a disclosure, so a column of
255
- * a hundred finished issues opens on what happened lately; a text or label
256
- * search never folds, because a match hidden behind a fold reads as no match.
256
+ * Recency groups nested inside one source group. The fold key includes the
257
+ * source, so expanding one repository's earlier cards opens no other group's.
257
258
  */
258
- const renderGrouped = (columnKey: string, tasks: TaskRecord[], compact: boolean, archived: boolean) => {
259
+ const renderRecencyGroups = (foldScope: string, tasks: TaskRecord[], compact: boolean, archived: boolean) => {
259
260
  const buckets = groupByRecency(tasks, task => cardTimeline(task, archived).at, now, timeZone)
260
261
  const foldable = !searchActive && tasks.length > COLUMN_FOLD_THRESHOLD && buckets.length > 1
261
- const open = unfolded.includes(columnKey)
262
+ const open = unfolded.includes(foldScope)
262
263
  return buckets.map(bucket => {
263
264
  const folded = foldable && bucket.group === buckets[buckets.length - 1]!.group && !open
264
265
  return (
@@ -273,7 +274,7 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
273
274
  data-dsh-part="card-group-toggle"
274
275
  aria-expanded={!folded}
275
276
  onClick={() => {
276
- setUnfolded(current => current.includes(columnKey) ? current.filter(entry => entry !== columnKey) : [...current, columnKey])
277
+ setUnfolded(current => current.includes(foldScope) ? current.filter(entry => entry !== foldScope) : [...current, foldScope])
277
278
  }}
278
279
  >
279
280
  {folded ? t('board.group.expand', { count: String(bucket.items.length) }) : t('board.group.collapse')}
@@ -286,6 +287,43 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
286
287
  })
287
288
  }
288
289
 
290
+ /** Every column and the archive first split by provider-owned source. */
291
+ const renderSourceGroups = (view: SourceGroupView, tasks: TaskRecord[], compact: boolean, archived: boolean) => {
292
+ const recency = archived || GROUPED_COLUMNS.includes(view as TaskStatus)
293
+ return groupTasksBySource(tasks, snapshot.grouping ?? []).map(bucket => {
294
+ const foldKey = sourceGroupFoldKey(view, bucket.id)
295
+ const folded = isSourceGroupFolded(sourceFolds, view, bucket.id, searchActive)
296
+ const label = bucket.local ? t('board.source.local') : bucket.label
297
+ return (
298
+ <div key={bucket.id} className={`${css.cardGroup} ${css.sourceGroup}`} data-dsh-part="card-group">
299
+ <div className={`${css.cardGroupHeader} ${css.sourceGroupHeader}`}>
300
+ <span className={css.sourceGroupLabel}>{label}</span>
301
+ <span className={css.cardGroupCount}>{bucket.items.length}</span>
302
+ <button
303
+ type="button"
304
+ className={css.linkButton}
305
+ data-dsh-part="card-group-toggle"
306
+ aria-expanded={!folded}
307
+ disabled={searchActive}
308
+ onClick={() => {
309
+ setSourceFolds(current => {
310
+ const next = { ...current, [foldKey]: !isSourceGroupFolded(current, view, bucket.id, false) }
311
+ writeSourceGroupFolds(globalThis.localStorage, next)
312
+ return next
313
+ })
314
+ }}
315
+ >
316
+ {folded ? t('board.group.expand', { count: String(bucket.items.length) }) : t('board.group.collapse')}
317
+ </button>
318
+ </div>
319
+ {!folded && (recency
320
+ ? renderRecencyGroups(foldKey, bucket.items, compact, archived)
321
+ : bucket.items.map(task => renderCard(task, compact)))}
322
+ </div>
323
+ )
324
+ })
325
+ }
326
+
289
327
  return (
290
328
  <div className={css.board} data-dsh-taskboard-board="" data-dsh-plugin="task-board">
291
329
  <header className={css.boardHeader}>
@@ -472,7 +510,7 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
472
510
  <span className={css.columnCount}>{visible.length}</span>
473
511
  </header>
474
512
  <div className={css.cards}>
475
- {renderGrouped(ARCHIVE_COLUMN, visible, false, true)}
513
+ {renderSourceGroups(ARCHIVE_COLUMN, visible, false, true)}
476
514
  {visible.length === 0 && (
477
515
  <div className={css.columnEmpty}>{tagFilter.length > 0 ? t('board.tagEmpty') : t('archive.empty')}</div>
478
516
  )}
@@ -485,7 +523,6 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
485
523
  // never does, because only the runner opens an execution.
486
524
  const isManualDropTarget = MANUAL_STATUSES.includes(column.status)
487
525
  const compact = compactColumns.includes(column.status)
488
- const grouped = GROUPED_COLUMNS.includes(column.status)
489
526
  return (
490
527
  <section
491
528
  key={column.status}
@@ -524,7 +561,7 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
524
561
  </button>
525
562
  </header>
526
563
  <div className={css.cards}>
527
- {grouped ? renderGrouped(column.status, tasks, compact, false) : tasks.map(task => renderCard(task, compact))}
564
+ {renderSourceGroups(column.status, tasks, compact, false)}
528
565
  {tasks.length === 0 && (
529
566
  <div className={css.columnEmpty}>{tagFilter.length > 0 ? t('board.tagEmpty') : t('board.empty')}</div>
530
567
  )}
@@ -168,6 +168,36 @@ function TaskCardInner({
168
168
  outcome.declared ? t('card.declaredHint') : '',
169
169
  ].filter(Boolean).join('\n')
170
170
 
171
+ // The status rail is one reserved row in every state: a label while a run is
172
+ // in flight, the settled result badge beside the run count, and the spinner
173
+ // box that is the same size whether or not it holds a spinner. Nothing here
174
+ // can add or remove a row, so a state change cannot resize the card.
175
+ const runningLabel = !archived && latest !== undefined && executionLabel(latest) === 'running'
176
+ ? (runningKey !== undefined
177
+ ? t(runningKey)
178
+ : latest.ownResult === undefined ? t('detail.result.running') : t('detail.subtasks.waiting'))
179
+ : ''
180
+ // Archived cards settle outside the board's judgement, so they keep the plain
181
+ // text result instead of a badge that would paint a tone they do not own.
182
+ const settledResult = archived ? undefined : latest?.result
183
+ const resultPrefix = settledResult === undefined && !busy && resultText !== '' ? `${resultText} · ` : ''
184
+ const runLine = latest === undefined ? undefined : (
185
+ <span
186
+ className={css.cardRun}
187
+ data-dsh-part="card-run"
188
+ data-result={settledResult}
189
+ data-declared={outcome.declared || undefined}
190
+ title={outcome.declared ? t('card.declaredHint') : undefined}
191
+ >
192
+ {settledResult !== undefined && (
193
+ <span className={css.cardResult} data-result={settledResult}>{resultText}</span>
194
+ )}
195
+ <span className={css.cardRuns}>
196
+ {resultPrefix}{runs} {t('board.runs')}
197
+ {outcome.declared ? ` · ${t('card.declared')}` : ''}
198
+ </span>
199
+ </span>
200
+ )
171
201
  const sessionMark = sessionId !== undefined && (onOpenSession !== undefined ? (
172
202
  <button
173
203
  type="button"
@@ -220,7 +250,9 @@ function TaskCardInner({
220
250
  <span className={css.cardMeta}>
221
251
  {decoration}
222
252
  {timeLabel}
223
- {!archived && (busy || pending) && <span className={css.cardSpinner} aria-hidden="true" />}
253
+ <span className={css.cardSpinnerSlot} aria-hidden="true">
254
+ {!archived && (busy || pending) && <span className={css.cardSpinner} />}
255
+ </span>
224
256
  </span>
225
257
  ) : (
226
258
  <>
@@ -281,30 +313,20 @@ function TaskCardInner({
281
313
  {t(task.schedule.mode === 'once' ? 'card.scheduledOnce' : 'card.scheduled')}
282
314
  </span>
283
315
  )}
284
- {latest !== undefined && (
285
- <span
286
- className={css.cardRun}
287
- data-dsh-part="card-run"
288
- data-result={archived || latest.result === undefined ? undefined : latest.result}
289
- data-declared={outcome.declared || undefined}
290
- title={outcome.declared ? t('card.declaredHint') : undefined}
291
- >
292
- {!busy && resultText !== '' ? `${resultText} · ` : ''}
293
- {runs} {t('board.runs')}
294
- {outcome.declared ? ` · ${t('card.declared')}` : ''}
295
- </span>
296
- )}
297
- {sessionMark}
298
- {!archived && (busy || pending) && <span className={css.cardSpinner} aria-hidden="true" />}
299
316
  </span>
300
- {!archived && pending && <span className={css.cardRunningLabel}>{t('board.pending')}…</span>}
301
- {!archived && latest !== undefined && executionLabel(latest) === 'running' && (
302
- <span className={css.cardRunningLabel}>
303
- {runningKey !== undefined
304
- ? t(runningKey)
305
- : latest.ownResult === undefined ? t('detail.result.running') : t('detail.subtasks.waiting')}…
317
+ <span className={css.cardStatus}>
318
+ <span className={css.cardStatusText}>
319
+ {!archived && pending && <span className={css.cardRunningLabel}>{t('board.pending')}…</span>}
320
+ {runningLabel !== '' && <span className={css.cardRunningLabel}>{runningLabel}…</span>}
321
+ {runLine}
306
322
  </span>
307
- )}
323
+ <span className={css.cardStatusTrail}>
324
+ <span className={css.cardSpinnerSlot} aria-hidden="true">
325
+ {!archived && (busy || pending) && <span className={css.cardSpinner} />}
326
+ </span>
327
+ {sessionMark}
328
+ </span>
329
+ </span>
308
330
  </>
309
331
  )}
310
332
  </article>