dsh-dispatch-board 0.5.6 → 0.5.9

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.
package/lib/client.js CHANGED
@@ -42,7 +42,7 @@ window.__ModuleLoader__.load({
42
42
  const BUNDLE_ID = 'dsh-dispatch-board'
43
43
  const RPC_CHANNEL = '/taskboard'
44
44
  const CSS_TAG_ID = BUNDLE_ID + '/client.css'
45
- const PLUGIN_VERSION = '0.5.6' // 兜底值:正常走 snapshot.pluginVersion(宿主读 package.json)
45
+ const PLUGIN_VERSION = '0.5.9' // 兜底值:正常走 snapshot.pluginVersion(宿主读 package.json)
46
46
  const ARCHIVE_RETENTION_PRESETS = [0, 5, 15, 30, 60, 120, 360, 1440]
47
47
  const POLL_VISIBLE_MS = 2000
48
48
  const POLL_HIDDEN_MS = 10000
@@ -501,6 +501,14 @@ window.__ModuleLoader__.load({
501
501
  '.tb-card-fixed .tb-card-actions .tb-btn-primary:hover:not(:disabled){background:var(--tb-accent);color:var(--dsw-alias-label-primary-foreground,#fff);border-color:transparent;filter:none}',
502
502
  '.tb-card-fixed .tb-card-actions .tb-btn-danger{background:transparent;color:var(--tb-danger)}',
503
503
  '.tb-card-fixed .tb-card-actions .tb-btn-danger:hover:not(:disabled){background:color-mix(in srgb,var(--tb-danger) 12%,transparent);border-color:transparent}',
504
+
505
+ // ── v0.5.8:卡片「执行中」六角星转圈(worker 会话 running)─────────────
506
+ // 11px 六角星挂在标题文字前;不活跃时**完全不渲染**(不占位),
507
+ // inline-block + vertical-align 只作用于标题行内,不改卡片高度 / 布局。
508
+ '.tb-card-spinner{display:inline-block;width:11px;height:11px;margin-right:5px;vertical-align:-2px;color:currentColor;animation:tb-spin 1.1s linear infinite;transform-origin:50% 50%}',
509
+ '@keyframes tb-spin{to{transform:rotate(360deg)}}',
510
+ // 减少动效偏好:放慢到 3s(不停,仍能看出「在跑」)。
511
+ '@media (prefers-reduced-motion: reduce){.tb-card-spinner{animation-duration:3s}}',
504
512
  ].join('\n')
505
513
 
506
514
  function injectCss() {
@@ -602,6 +610,8 @@ window.__ModuleLoader__.load({
602
610
  'card.deleteConfirmShort': '确认删除',
603
611
  'card.detail': '详情',
604
612
  'card.openChat': '对话',
613
+ // v0.5.7:卡片标题前的「执行中」转圈动画(worker 会话 running 时显示,纯视觉无按钮)。
614
+ 'card.running': '执行中',
605
615
  // v0.2.4:点「对话」失败不再静默(服务缺失 / 目标会话已关闭或不存在)。
606
616
  'openSession.failed': '无法打开对话:会话 {session} 已关闭或不存在',
607
617
  'openSession.unavailable': '无法打开对话:会话导航服务未就绪,请稍后重试',
@@ -822,6 +832,8 @@ window.__ModuleLoader__.load({
822
832
  'card.deleteConfirmShort': 'Confirm delete',
823
833
  'card.detail': 'Details',
824
834
  'card.openChat': 'Chat',
835
+ // v0.5.7: spinner in front of the card title while the worker session is running.
836
+ 'card.running': 'Running',
825
837
  // Unreleased (0.2.4 candidate): a failed 对话 click must never be silent.
826
838
  'openSession.failed': 'Cannot open conversation: session {session} is closed or unavailable',
827
839
  'openSession.unavailable': 'Cannot open conversation: session navigation is not ready yet, please retry',
@@ -1235,6 +1247,30 @@ window.__ModuleLoader__.load({
1235
1247
  return hostWritten !== '' ? hostWritten : workerSessionOf(task)
1236
1248
  }
1237
1249
 
1250
+ /**
1251
+ * v0.5.7:`snapshot.runningSessions` → Set(卡片「执行中」动画用)。
1252
+ * 旧 Host 没有这个字段 → 空集:不渲染动画,也不报错(字段纯运行时视图,不落盘,§3.2)。
1253
+ */
1254
+ function runningSessionSet(snapshot) {
1255
+ const list = snapshot && Array.isArray(snapshot.runningSessions) ? snapshot.runningSessions : []
1256
+ const out = new Set()
1257
+ for (const id of list) {
1258
+ if (typeof id === 'string' && id !== '') out.add(id)
1259
+ }
1260
+ return out
1261
+ }
1262
+
1263
+ /**
1264
+ * 卡片「执行中」判定(v0.5.7):doing + 宿主记的 `workerSessionId` 非空 + 该会话此刻 running。
1265
+ * 只用宿主独占字段 `workerSessionId`(`assignee` 是组长写的自由文本,不能当会话 id)。
1266
+ */
1267
+ function isWorkerRunning(task, runningSessions) {
1268
+ if (!task || task.status !== 'doing') return false
1269
+ if (!(runningSessions instanceof Set)) return false
1270
+ const workerId = typeof task.workerSessionId === 'string' ? task.workerSessionId.trim() : ''
1271
+ return workerId !== '' && runningSessions.has(workerId)
1272
+ }
1273
+
1238
1274
  /* ── v0.2.0 组长条(主会话 / 工作区组长)纯展示函数 ───────── */
1239
1275
 
1240
1276
  // 「派发到」的四个合法值:v0.2.0 起默认 workspace-lead(缺省 / 未知一律回退它,不要回退 new)。
@@ -2749,6 +2785,8 @@ window.__ModuleLoader__.load({
2749
2785
  const hasCwd = typeof task.cwd === 'string' && task.cwd !== ''
2750
2786
  const isEditing = editing !== null && editing.id === task.id
2751
2787
  const busyKey = 'update:' + task.id
2788
+ // v0.5.7:worker 会话正在跑 → 标题前挂转圈动画(纯视觉,不改状态机 / RPC)。
2789
+ const workerRunning = isWorkerRunning(task, bind.runningSessions)
2752
2790
  // 行内二次确认:不用 window.confirm(浏览器可能已勾选「阻止此页面的其它对话框」,那样确认永远为 false,
2753
2791
  // 表现就是「点了删除没反应」)。状态放在看板组件里,Card 保持纯展示。
2754
2792
  const confirmingDelete = typeof actions.isConfirmingDelete === 'function' && actions.isConfirmingDelete(task.id)
@@ -2863,6 +2901,23 @@ window.__ModuleLoader__.load({
2863
2901
  }
2864
2902
  },
2865
2903
  },
2904
+ // v0.5.8:执行中动画(六角星转圈;不活跃时完全不渲染,不占位)。
2905
+ workerRunning
2906
+ ? h(
2907
+ 'svg',
2908
+ {
2909
+ className: 'tb-card-spinner',
2910
+ viewBox: '0 0 16 16',
2911
+ role: 'status',
2912
+ 'aria-label': t('card.running'),
2913
+ focusable: 'false',
2914
+ },
2915
+ h('path', {
2916
+ d: 'M8 1.4 L9.4 5.58 L13.72 4.7 L10.8 8 L13.72 11.3 L9.4 10.42 L8 14.6 L6.6 10.42 L2.28 11.3 L5.2 8 L2.28 4.7 L6.6 5.58 Z',
2917
+ fill: 'currentColor',
2918
+ }),
2919
+ )
2920
+ : null,
2866
2921
  task.title,
2867
2922
  ),
2868
2923
  // v0.5.3 阻塞卡:警示标签 + lastError 首行摘要(单行省略,title 兜全文,完整文本看详情「最近异常」)。
@@ -3711,6 +3766,8 @@ window.__ModuleLoader__.load({
3711
3766
  const allTasks = (snap && snap.tasks) || []
3712
3767
  const poll = (snap && snap.poll) || {}
3713
3768
  const agents = (snap && snap.agents) || []
3769
+ // v0.5.7:此刻 running 的会话(卡片「执行中」动画,宿主运行时视图)。
3770
+ const runningSessions = runningSessionSet(snap)
3714
3771
  const workspaces = (snap && snap.workspaces) || []
3715
3772
  const currentAgent = sessionId === '' ? null : agents.find((agent) => agent && agent.sessionId === sessionId) || null
3716
3773
  // 冷会话(历史会话)不在 agents 里:挂载后问宿主要一次它的工作区,提示才有「工作区:xxx」。
@@ -4120,6 +4177,8 @@ window.__ModuleLoader__.load({
4120
4177
  boardBindRef.current.retentionDraft = retentionDraft
4121
4178
  boardBindRef.current.answerDraft = answerDraft
4122
4179
  boardBindRef.current.answerError = answerError
4180
+ // v0.5.7:卡片「执行中」动画的 running 会话集合(每次渲染刷新,2s 轮询跟上状态)。
4181
+ boardBindRef.current.runningSessions = runningSessions
4123
4182
  if (boardPiecesRef.current === null) boardPiecesRef.current = createBoardPieces(boardBindRef.current)
4124
4183
  const Banner = boardPiecesRef.current.Banner
4125
4184
  const Col = boardPiecesRef.current.Col
@@ -4618,6 +4677,8 @@ window.__ModuleLoader__.load({
4618
4677
  const workspaces = (snap && snap.workspaces) || []
4619
4678
  const poll = (snap && snap.poll) || {}
4620
4679
  const preset = (snap && snap.preset) || null
4680
+ // v0.5.7:此刻 running 的会话(卡片「执行中」动画,两块看板同一口径)。
4681
+ const runningSessions = runningSessionSet(snap)
4621
4682
 
4622
4683
  // 工作区选项:同一路径只列一次(保持注册顺序)。
4623
4684
  const workspaceOptions = []
@@ -5058,6 +5119,8 @@ window.__ModuleLoader__.load({
5058
5119
  boardBindRef.current.retentionDraft = retentionDraft
5059
5120
  boardBindRef.current.answerDraft = answerDraft
5060
5121
  boardBindRef.current.answerError = answerError
5122
+ // v0.5.7:卡片「执行中」动画的 running 会话集合(平台看板与右栏同口径)。
5123
+ boardBindRef.current.runningSessions = runningSessions
5061
5124
  if (boardPiecesRef.current === null) boardPiecesRef.current = createBoardPieces(boardBindRef.current)
5062
5125
  const Banner = boardPiecesRef.current.Banner
5063
5126
  const Col = boardPiecesRef.current.Col
package/lib/index.js CHANGED
@@ -2865,6 +2865,43 @@ function workspaceLabelFor(key, cwd, workspaces) {
2865
2865
  return baseName(cwd)
2866
2866
  }
2867
2867
 
2868
+ /**
2869
+ * v0.5.7:此刻**真正在跑**的会话 id 列表(snapshot.runningSessions,§3.2)。
2870
+ * 纯运行时视图,不落盘、不改任务模型:
2871
+ * 1. agents.roots() 里 status === 'running' 的根会话;
2872
+ * 2. 所有任务里 `workerSessionId` 非空、且 `agents.get(id)` 的 status === 'running' 的 worker 会话
2873
+ * (worker 是子 Agent,不在 agents.roots() 里,只能按 id 查)。
2874
+ * Client 用它给「进行中 + worker 在跑」的卡片标题前挂转圈动画。
2875
+ */
2876
+ export function collectRunningSessions(agents, state) {
2877
+ const out = []
2878
+ const seen = new Set()
2879
+ const push = (sessionId) => {
2880
+ if (typeof sessionId !== 'string' || sessionId === '' || seen.has(sessionId)) return
2881
+ seen.add(sessionId)
2882
+ out.push(sessionId)
2883
+ }
2884
+ let roots = []
2885
+ try {
2886
+ roots = agents && typeof agents.roots === 'function' ? agents.roots() : []
2887
+ } catch {
2888
+ roots = []
2889
+ }
2890
+ for (const agent of Array.isArray(roots) ? roots : []) {
2891
+ if (!agent || agent.status !== 'running') continue
2892
+ push(agentSessionId(agent))
2893
+ }
2894
+ const tasks = state && Array.isArray(state.tasks) ? state.tasks : []
2895
+ for (const task of tasks) {
2896
+ if (!task) continue
2897
+ const workerId = asString(task.workerSessionId).trim()
2898
+ if (workerId === '') continue
2899
+ const live = liveAgentOf(agents, workerId)
2900
+ if (live && live.status === 'running') push(workerId)
2901
+ }
2902
+ return out
2903
+ }
2904
+
2868
2905
  /** 工作区组长运行时视图(snapshot.leads.workspaces,§3.2):按 config.workspaceLeads 的对象键顺序。 */
2869
2906
  export function buildWorkspaceLeadRefs(config, agents, workspaces, archived = new Set()) {
2870
2907
  const cfg = normalizeConfig(config)
@@ -2909,6 +2946,8 @@ export function buildSnapshot(rt, now = Date.now(), preset = rt.presetInfo || nu
2909
2946
  lastSkipReason: rt.poll.lastSkipReason || null,
2910
2947
  },
2911
2948
  agents: listAgents(rt),
2949
+ // v0.5.7:此刻 running 的会话 id(根会话 + 任务 worker 会话),纯运行时视图(§3.2 / §5.2)。
2950
+ runningSessions: collectRunningSessions(agentsService, rt.state),
2912
2951
  workspaces,
2913
2952
  // v0.2.0:组长 / 主会话运行时视图(组长条用;revision 不变也会变)。
2914
2953
  leads: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dispatch-board",
3
- "version": "0.5.6",
3
+ "version": "0.5.9",
4
4
  "description": "DeepSeek Harness 插件:派单看板 + 工作区组长模式。组长派 worker 执行,看板按状态列跟踪进度与结论(归档列可折叠)。A dispatch board and workspace-lead mode for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",