dsh-dispatch-board 0.2.2 → 0.2.4
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/README.md +12 -3
- package/lib/client.js +370 -40
- package/lib/index.js +723 -13
- package/package.json +1 -1
- package/presets/taskboard.patch.yml +24 -7
package/lib/client.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* sidebar.right.pane.tab / .title 提供正文与 chip,conversation.session.header.actions
|
|
7
7
|
* 提供会话 header 入口按钮;只显示 cwd 与当前会话工作区相同的任务(窄栏 lane / 宽栏四列)。
|
|
8
8
|
* 2. 左侧栏「平台任务看板」—— sidebar.panellist 入口图标(todo+doing 角标)+ main
|
|
9
|
-
* (key: taskboard-platform)
|
|
10
|
-
*
|
|
9
|
+
* (key: taskboard-platform) 页面;显示全部工作区的任务(卡片显示标题 + 一行工作区标签 +
|
|
10
|
+
* 操作按钮,备注 / 结论等信息都在详情浮层;右栏看板没有这行标签,工作区只在详情里看),
|
|
11
11
|
* 新建任务必须选工作区(add-task 传 cwd,不传 sessionId)。
|
|
12
12
|
*
|
|
13
13
|
* 数据通道:Host 在 webServer 注册的 /taskboard 前缀路由,经 Connection RPC 信封调用
|
|
@@ -127,8 +127,14 @@ window.__ModuleLoader__.load({
|
|
|
127
127
|
// ── 卡片 ───────────────────────────────────────────────────
|
|
128
128
|
// 卡片正文只有标题 + 操作按钮:note / result / lastError / meta 全部收进详情浮层,
|
|
129
129
|
// 看板上只靠标题辨认任务(完整信息点标题看详情)。
|
|
130
|
+
// 唯一例外:全局平台看板多一行工作区标签(.tb-card-workspace,v0.2.4),
|
|
131
|
+
// 右栏看板不传 workspaceLabel,卡片结构维持「标题 + 操作按钮」不变。
|
|
130
132
|
'.tb-card{display:flex;flex-direction:column;gap:6px;padding:9px 10px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);border-left:3px solid var(--tb-accent);border-radius:var(--dsw-radius-sm);min-width:0;box-sizing:border-box}',
|
|
131
133
|
'.tb-card-title{font:var(--dsw-font-xxs-strong-12);font-weight:600;line-height:1.45;word-break:break-word}',
|
|
134
|
+
// 平台看板卡片上的一行工作区标签(v0.2.4):单行、超长省略,标题仍是第一眼信息。
|
|
135
|
+
// 只有全局看板的 Col 传入 workspaceLabel 时才渲染(右栏看板绑定单个工作区,不重复显示)。
|
|
136
|
+
'.tb-card-workspace{display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:var(--dsw-font-xxxs-11);color:var(--dsw-alias-label-tertiary);letter-spacing:0}',
|
|
137
|
+
'.tb-card-workspace[data-empty=true]{opacity:.65}',
|
|
132
138
|
'.tb-card-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap;padding-top:2px}',
|
|
133
139
|
'.tb-edit{display:flex;flex-direction:column;gap:6px}',
|
|
134
140
|
'.tb-edit-actions{display:flex;align-items:center;gap:6px;justify-content:flex-end}',
|
|
@@ -175,6 +181,8 @@ window.__ModuleLoader__.load({
|
|
|
175
181
|
'.tb-detail{width:100%;max-width:900px;max-height:calc(100vh - 48px);display:flex;flex-direction:column;overflow:hidden;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);border-radius:14px;box-shadow:0 28px 72px rgba(0,0,0,.42);animation:tb-pop-in .14s ease-out}',
|
|
176
182
|
'@keyframes tb-pop-in{from{transform:translateY(6px) scale(.99);opacity:.6}to{transform:none;opacity:1}}',
|
|
177
183
|
'.tb-detail-head{display:flex;align-items:flex-start;gap:10px;padding:13px 16px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);flex:0 0 auto}',
|
|
184
|
+
// 浮层内提示条(t-71):遮罩 z-index:9000 会盖住看板顶部横幅,跳转失败必须就近显示在浮层里。
|
|
185
|
+
'.tb-detail-banner{flex:0 0 auto;padding:10px 16px 0}',
|
|
178
186
|
'.tb-detail-headline{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:6px}',
|
|
179
187
|
'.tb-detail-badges{display:flex;flex-wrap:wrap;align-items:center;gap:5px}',
|
|
180
188
|
'.tb-detail-title{margin:0;font:var(--dsw-font-sm-13);font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary);word-break:break-word}',
|
|
@@ -349,6 +357,7 @@ window.__ModuleLoader__.load({
|
|
|
349
357
|
'.tb-card{background:var(--tb-surface);border:1px solid var(--tb-hairline-soft);border-left:1px solid var(--tb-hairline-soft);border-radius:var(--dsw-radius-md,12px);padding:10px 11px;box-shadow:var(--tb-shadow-1);transition:box-shadow .18s ease,transform .18s ease,border-color .18s ease}',
|
|
350
358
|
'.tb-card:hover{box-shadow:var(--tb-shadow-2);border-color:var(--tb-hairline);transform:translateY(-1px)}',
|
|
351
359
|
'.tb-card-title{font:600 12.5px/1.45 var(--dsh-font-family-text-default,-apple-system,sans-serif);color:var(--tb-text);letter-spacing:0}',
|
|
360
|
+
'.tb-card-workspace{color:var(--tb-text-3);font-size:10px;line-height:1.45}',
|
|
352
361
|
'.tb-empty{color:var(--tb-text-3);font-size:11px;padding:12px 6px;text-align:center;border:0;background:transparent}',
|
|
353
362
|
'.tb-foot{color:var(--tb-text-3);font-size:10px;padding-top:2px;border-top:1px solid var(--tb-hairline-soft)}',
|
|
354
363
|
'.tb-foot code{background:var(--dsw-alias-bg-skeleton);border-radius:5px;padding:1px 5px;font-size:9.5px}',
|
|
@@ -502,6 +511,9 @@ window.__ModuleLoader__.load({
|
|
|
502
511
|
'card.deleteConfirmShort': '确认删除',
|
|
503
512
|
'card.detail': '详情',
|
|
504
513
|
'card.openChat': '对话',
|
|
514
|
+
// v0.2.4:点「对话」失败不再静默(服务缺失 / 目标会话已关闭或不存在)。
|
|
515
|
+
'openSession.failed': '无法打开对话:会话 {session} 已关闭或不存在',
|
|
516
|
+
'openSession.unavailable': '无法打开对话:会话导航服务未就绪,请稍后重试',
|
|
505
517
|
'detail.sessions': '关联对话',
|
|
506
518
|
'detail.creatorSession': '发起对话',
|
|
507
519
|
'detail.runSession': '执行对话',
|
|
@@ -685,6 +697,9 @@ window.__ModuleLoader__.load({
|
|
|
685
697
|
'card.deleteConfirmShort': 'Confirm delete',
|
|
686
698
|
'card.detail': 'Details',
|
|
687
699
|
'card.openChat': 'Chat',
|
|
700
|
+
// Unreleased (0.2.4 candidate): a failed 对话 click must never be silent.
|
|
701
|
+
'openSession.failed': 'Cannot open conversation: session {session} is closed or unavailable',
|
|
702
|
+
'openSession.unavailable': 'Cannot open conversation: session navigation is not ready yet, please retry',
|
|
688
703
|
'detail.sessions': 'Linked conversations',
|
|
689
704
|
'detail.creatorSession': 'Created in',
|
|
690
705
|
'detail.runSession': 'Dispatched to',
|
|
@@ -939,6 +954,23 @@ window.__ModuleLoader__.load({
|
|
|
939
954
|
return baseName(path)
|
|
940
955
|
}
|
|
941
956
|
|
|
957
|
+
/** 卡片工作区标签的兜底占位:任务没有 cwd(老任务 / 没归属)时显示。 */
|
|
958
|
+
const WORKSPACE_LABEL_NONE = '\u2014'
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* 平台看板卡片上的一行工作区标签(v0.2.4):只给**全局看板**用,
|
|
962
|
+
* 右栏看板不调用(那块看板绑定单个工作区,再标一遍是重复信息)。
|
|
963
|
+
* - `cwd` 命中 `snapshot.workspaces` → 用该工作区的 `title`;
|
|
964
|
+
* - `cwd` 未注册 / `title` 为空 → 回退路径尾段 `baseName(cwd)`(与下拉选项同一规则);
|
|
965
|
+
* - `cwd` 为空 / 非字符串 → `—` 占位(不抛错,渲染里不会出现 undefined)。
|
|
966
|
+
*/
|
|
967
|
+
function taskWorkspaceLabel(workspaces, task) {
|
|
968
|
+
const cwd = task && typeof task.cwd === 'string' ? task.cwd : ''
|
|
969
|
+
if (cwd === '') return WORKSPACE_LABEL_NONE
|
|
970
|
+
const label = workspaceTitleOf(workspaces, cwd)
|
|
971
|
+
return label !== '' ? label : WORKSPACE_LABEL_NONE
|
|
972
|
+
}
|
|
973
|
+
|
|
942
974
|
/**
|
|
943
975
|
* 右栏「本工作区看板」的过滤:
|
|
944
976
|
* - cwd 与当前工作区相同的任务;或
|
|
@@ -966,6 +998,27 @@ window.__ModuleLoader__.load({
|
|
|
966
998
|
return list.filter((task) => task && samePath(task.cwd, filterPath))
|
|
967
999
|
}
|
|
968
1000
|
|
|
1001
|
+
/**
|
|
1002
|
+
* 恢复平台看板的工作区选择(两处共用:顶部「工作区」过滤 = `config.workspaceFilter`,
|
|
1003
|
+
* 新建行「任务所属工作区」= `config.workspaceDraft`;各自独立持久化、互不串值):
|
|
1004
|
+
* - `stored` 为空 / 字段缺失 / 脏数据(非字符串)→ `''`(过滤 = 全部工作区、新建行 = 未选择,
|
|
1005
|
+
* 都是未持久化时的默认选择);
|
|
1006
|
+
* - `stored` 命中当前工作区列表(`samePath` 归一化比较)→ 返回注册表里的规范 path;
|
|
1007
|
+
* - `stored` 非空但已不在列表里(工作区被删 / 改名)→ `''`(回退默认,不把无效值当选中项);
|
|
1008
|
+
* - 工作区列表为空(注册表还没就绪)→ `null`,调用方应等下一条 snapshot 再判定,
|
|
1009
|
+
* 别把「列表暂时为空」误判成「工作区已删除」而覆盖用户选择。
|
|
1010
|
+
*/
|
|
1011
|
+
function resolveWorkspaceSelection(stored, workspaces) {
|
|
1012
|
+
const value = typeof stored === 'string' ? stored.trim() : ''
|
|
1013
|
+
if (value === '') return ''
|
|
1014
|
+
const list = (Array.isArray(workspaces) ? workspaces : []).filter(
|
|
1015
|
+
(item) => item && typeof item.path === 'string' && item.path !== '',
|
|
1016
|
+
)
|
|
1017
|
+
if (list.length === 0) return null
|
|
1018
|
+
const hit = list.find((item) => samePath(item.path, value))
|
|
1019
|
+
return hit ? hit.path : ''
|
|
1020
|
+
}
|
|
1021
|
+
|
|
969
1022
|
// 会话 id 形如 session-xxxxxxxx…:取尾部更可区分(头部对每个会话都一样)。
|
|
970
1023
|
function shortSession(sessionId) {
|
|
971
1024
|
if (typeof sessionId !== 'string' || sessionId === '') return '–'
|
|
@@ -1873,18 +1926,53 @@ window.__ModuleLoader__.load({
|
|
|
1873
1926
|
// 用会话 header / 右栏看板渲染时记下的值当「当前对话」;拿不到就禁用主会话绑定并提示。
|
|
1874
1927
|
let lastConversationSessionId = ''
|
|
1875
1928
|
|
|
1876
|
-
/**
|
|
1929
|
+
/**
|
|
1930
|
+
* 在看板里直接跳到某个会话(发起对话 / 执行对话 / 组长对话)。
|
|
1931
|
+
* 返回 `{ ok, reason, sessionId }`,调用方据此给用户**可见**反馈——跳转失败绝不静默:
|
|
1932
|
+
* - `invalid`:没有目标 id;
|
|
1933
|
+
* - `unavailable`:宿主没注入 `uiWorkspace`(或它没有 `openSession`);
|
|
1934
|
+
* - `error`:`openSession` 同步抛错。典型是 `sessions.retain: unknown session <id>`
|
|
1935
|
+
* (目标会话已被移除 / 客户端此刻解析不到),也可能来自会话控制器已销毁。
|
|
1936
|
+
* `uiWorkspace.openSession` 是同步 void:能抛错就说明这次导航没有发生。
|
|
1937
|
+
*/
|
|
1877
1938
|
function openSessionById(sessionId) {
|
|
1878
|
-
if (typeof sessionId !== 'string' || sessionId === '') return
|
|
1939
|
+
if (typeof sessionId !== 'string' || sessionId === '') return { ok: false, reason: 'invalid', sessionId: '' }
|
|
1879
1940
|
if (!uiWorkspaceService || typeof uiWorkspaceService.openSession !== 'function') {
|
|
1880
1941
|
console.warn('[dsh-dispatch-board] uiWorkspace 不可用,无法跳转会话:' + sessionId)
|
|
1881
|
-
return
|
|
1942
|
+
return { ok: false, reason: 'unavailable', sessionId }
|
|
1882
1943
|
}
|
|
1883
1944
|
try {
|
|
1884
1945
|
uiWorkspaceService.openSession(sessionId)
|
|
1946
|
+
return { ok: true, sessionId }
|
|
1885
1947
|
} catch (error) {
|
|
1886
1948
|
console.warn('[dsh-dispatch-board] 跳转会话失败:' + describeErr(error))
|
|
1949
|
+
return { ok: false, reason: 'error', sessionId, error }
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* 按顺序尝试多个候选会话(worker → 组长 → 发起 → poll 兜底):
|
|
1955
|
+
* 第一个能打开的立即返回;`unavailable` 时后面的目标必然同样打不开,直接停。
|
|
1956
|
+
*/
|
|
1957
|
+
function openFirstAvailable(candidates) {
|
|
1958
|
+
const list = Array.isArray(candidates) ? candidates : []
|
|
1959
|
+
let last = { ok: false, reason: 'invalid', sessionId: '' }
|
|
1960
|
+
for (const sessionId of list) {
|
|
1961
|
+
if (typeof sessionId !== 'string' || sessionId === '') continue
|
|
1962
|
+
const result = openSessionById(sessionId)
|
|
1963
|
+
if (result.ok) return result
|
|
1964
|
+
last = result
|
|
1965
|
+
if (result.reason === 'unavailable') break
|
|
1887
1966
|
}
|
|
1967
|
+
return last
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
/** 跳转失败的顶部提示文案(两块看板共用;`t` 由组件传入,保持纯函数可测)。 */
|
|
1971
|
+
function sessionFailureText(t, result, candidates) {
|
|
1972
|
+
if (result && result.reason === 'unavailable') return t('openSession.unavailable')
|
|
1973
|
+
const list = Array.isArray(candidates) ? candidates : []
|
|
1974
|
+
const first = list.find((id) => typeof id === 'string' && id !== '') || ''
|
|
1975
|
+
return t('openSession.failed', { session: shortSession(first) })
|
|
1888
1976
|
}
|
|
1889
1977
|
|
|
1890
1978
|
function openBoard(retry = 0) {
|
|
@@ -2107,15 +2195,28 @@ window.__ModuleLoader__.load({
|
|
|
2107
2195
|
/**
|
|
2108
2196
|
* 任务关联的会话(卡片「对话」按钮的跳转目标),优先级:
|
|
2109
2197
|
* worker 子会话(真正执行任务的对话)→ 组长会话(dispatchedSessionId)→ 发起对话(sessionId)
|
|
2110
|
-
* → 老 Host 的 poll 兜底(doing
|
|
2198
|
+
* → 老 Host 的 poll 兜底(doing)。
|
|
2199
|
+
*
|
|
2200
|
+
* 返回**去重后的候选链**(v0.2.4):worker 子会话是子 Agent 会话,客户端未必解析得到
|
|
2201
|
+
* (侧栏隐藏、依赖父会话 catalog),打不开时不能连累整次点击——调用方按顺序试到第一个能打开的。
|
|
2111
2202
|
*/
|
|
2203
|
+
function sessionCandidatesOf(task) {
|
|
2204
|
+
if (!task) return []
|
|
2205
|
+
const out = []
|
|
2206
|
+
const push = (value) => {
|
|
2207
|
+
if (typeof value === 'string' && value !== '' && out.indexOf(value) < 0) out.push(value)
|
|
2208
|
+
}
|
|
2209
|
+
push(workerSessionOf(task))
|
|
2210
|
+
push(task.dispatchedSessionId)
|
|
2211
|
+
push(task.sessionId)
|
|
2212
|
+
push(pollFallbackSessionOf(task))
|
|
2213
|
+
return out
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/** 卡片「对话」按钮显示的目标(候选链首个);没有关联会话返回空串(不渲染按钮)。 */
|
|
2112
2217
|
function sessionOf(task) {
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
if (worker !== '') return worker
|
|
2116
|
-
if (typeof task.dispatchedSessionId === 'string' && task.dispatchedSessionId !== '') return task.dispatchedSessionId
|
|
2117
|
-
if (typeof task.sessionId === 'string' && task.sessionId !== '') return task.sessionId
|
|
2118
|
-
return pollFallbackSessionOf(task)
|
|
2218
|
+
const candidates = sessionCandidatesOf(task)
|
|
2219
|
+
return candidates.length > 0 ? candidates[0] : ''
|
|
2119
2220
|
}
|
|
2120
2221
|
|
|
2121
2222
|
/* ── 子组件 ───────────────────────────────────────────── */
|
|
@@ -2132,6 +2233,25 @@ window.__ModuleLoader__.load({
|
|
|
2132
2233
|
)
|
|
2133
2234
|
}
|
|
2134
2235
|
|
|
2236
|
+
/**
|
|
2237
|
+
* 平台看板卡片上的一行工作区标签(v0.2.4):纯展示,不调 hooks。
|
|
2238
|
+
* 文本由调用方算好(`taskWorkspaceLabel`);`title` 兜完整工作区路径(过长时单行省略),
|
|
2239
|
+
* `data-empty` 让「没有 cwd」的占位(—)弱化一点。右栏看板不传 label → 整块不渲染。
|
|
2240
|
+
*/
|
|
2241
|
+
function WorkspaceTag(props) {
|
|
2242
|
+
const label = props && typeof props.label === 'string' ? props.label : ''
|
|
2243
|
+
if (label === '') return null
|
|
2244
|
+
return h(
|
|
2245
|
+
'div',
|
|
2246
|
+
{
|
|
2247
|
+
className: 'tb-card-workspace',
|
|
2248
|
+
'data-empty': props.empty === true ? 'true' : 'false',
|
|
2249
|
+
title: typeof props.path === 'string' && props.path !== '' ? props.path : undefined,
|
|
2250
|
+
},
|
|
2251
|
+
label,
|
|
2252
|
+
)
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2135
2255
|
function Col(props) {
|
|
2136
2256
|
const t = bind.t
|
|
2137
2257
|
const busy = bind.busy
|
|
@@ -2139,6 +2259,8 @@ window.__ModuleLoader__.load({
|
|
|
2139
2259
|
const status = props.status
|
|
2140
2260
|
const list = props.tasks
|
|
2141
2261
|
const compact = props.compact === true
|
|
2262
|
+
// 只有平台看板传 workspaceLabel((task) => 展示名);右栏看板不传 → 卡片不带工作区标签。
|
|
2263
|
+
const workspaceLabelOf = typeof props.workspaceLabel === 'function' ? props.workspaceLabel : null
|
|
2142
2264
|
return h(
|
|
2143
2265
|
'section',
|
|
2144
2266
|
{
|
|
@@ -2182,7 +2304,17 @@ window.__ModuleLoader__.load({
|
|
|
2182
2304
|
),
|
|
2183
2305
|
list.length === 0
|
|
2184
2306
|
? h('div', { className: 'tb-empty' }, t('column.empty.' + status))
|
|
2185
|
-
: h(
|
|
2307
|
+
: h(
|
|
2308
|
+
'div',
|
|
2309
|
+
{ className: 'tb-cards' },
|
|
2310
|
+
list.map((task) =>
|
|
2311
|
+
h(Card, {
|
|
2312
|
+
key: task.id,
|
|
2313
|
+
task,
|
|
2314
|
+
workspaceLabel: workspaceLabelOf ? workspaceLabelOf(task) : '',
|
|
2315
|
+
}),
|
|
2316
|
+
),
|
|
2317
|
+
),
|
|
2186
2318
|
)
|
|
2187
2319
|
}
|
|
2188
2320
|
|
|
@@ -2235,6 +2367,9 @@ window.__ModuleLoader__.load({
|
|
|
2235
2367
|
const t = bind.t
|
|
2236
2368
|
const list = props && Array.isArray(props.tasks) ? props.tasks : []
|
|
2237
2369
|
const actions = bind.actions
|
|
2370
|
+
// 第五列也是全局视角(只有平台看板渲染它):同样显示工作区标签;
|
|
2371
|
+
// 右栏的「待你处理」是顶部条(.tb-needs-item,不是卡片),不受影响。
|
|
2372
|
+
const workspaceLabelOf = props && typeof props.workspaceLabel === 'function' ? props.workspaceLabel : null
|
|
2238
2373
|
return h(
|
|
2239
2374
|
'section',
|
|
2240
2375
|
{
|
|
@@ -2278,6 +2413,11 @@ window.__ModuleLoader__.load({
|
|
|
2278
2413
|
task.title,
|
|
2279
2414
|
),
|
|
2280
2415
|
h('div', { className: 'tb-needs-card-q', title: task.question || '' }, task.question || ''),
|
|
2416
|
+
h(WorkspaceTag, {
|
|
2417
|
+
label: workspaceLabelOf ? workspaceLabelOf(task) : '',
|
|
2418
|
+
empty: !(typeof task.cwd === 'string' && task.cwd !== ''),
|
|
2419
|
+
path: typeof task.cwd === 'string' ? task.cwd : '',
|
|
2420
|
+
}),
|
|
2281
2421
|
h(
|
|
2282
2422
|
'div',
|
|
2283
2423
|
{ className: 'tb-card-actions' },
|
|
@@ -2300,6 +2440,9 @@ window.__ModuleLoader__.load({
|
|
|
2300
2440
|
const actions = bind.actions
|
|
2301
2441
|
const task = props.task
|
|
2302
2442
|
const status = task.status
|
|
2443
|
+
// 工作区标签(v0.2.4):只有平台看板的 Col 传值;右栏看板传空串 → 不渲染。
|
|
2444
|
+
const workspaceLabel = typeof props.workspaceLabel === 'string' ? props.workspaceLabel : ''
|
|
2445
|
+
const hasCwd = typeof task.cwd === 'string' && task.cwd !== ''
|
|
2303
2446
|
const isEditing = editing !== null && editing.id === task.id
|
|
2304
2447
|
const busyKey = 'update:' + task.id
|
|
2305
2448
|
// 行内二次确认:不用 window.confirm(浏览器可能已勾选「阻止此页面的其它对话框」,那样确认永远为 false,
|
|
@@ -2366,16 +2509,19 @@ window.__ModuleLoader__.load({
|
|
|
2366
2509
|
cardActions.push([confirmingDelete ? 'deleteConfirmShort' : 'delete', requestDelete, false])
|
|
2367
2510
|
}
|
|
2368
2511
|
|
|
2369
|
-
// 卡片只留标题 + 操作按钮:note / result / lastError / id /
|
|
2512
|
+
// 卡片只留标题 + 操作按钮:note / result / lastError / id / 时间 /
|
|
2370
2513
|
// 执行者 / 组长这些背景信息都在详情浮层里看(点标题或「详情」)。
|
|
2514
|
+
// 唯一例外是全局平台看板多一行工作区标签(WorkspaceTag,由 props.workspaceLabel 控制)。
|
|
2371
2515
|
// 少这一整段后卡片高度由内容决定(.tb-card-fixed 的标题固定 2 行高度 +
|
|
2372
2516
|
// 标题/按钮之间只留 gap,不再用整卡 min-height + 操作行 margin-top:auto 撑空行)。
|
|
2373
2517
|
|
|
2374
2518
|
cardActions.unshift(['detail', () => actions.openDetail(task), false])
|
|
2375
2519
|
// 卡片「对话」优先 worker 子会话(真正干活的对话),其次组长 / 发起对话;title 用实际目标 id 便于辨认。
|
|
2520
|
+
// 点击走 actions.openChat(task):worker 打不开时自动回退组长 / 发起会话,全部失败出顶部提示(不静默)。
|
|
2376
2521
|
const cardSessionId = sessionOf(task)
|
|
2377
2522
|
if (cardSessionId !== '') {
|
|
2378
|
-
|
|
2523
|
+
const openChatAction = () => (typeof actions.openChat === 'function' ? actions.openChat(task) : actions.openSession(cardSessionId))
|
|
2524
|
+
cardActions.push(['openChat', openChatAction, false, cardSessionId])
|
|
2379
2525
|
}
|
|
2380
2526
|
|
|
2381
2527
|
return h(
|
|
@@ -2399,6 +2545,9 @@ window.__ModuleLoader__.load({
|
|
|
2399
2545
|
},
|
|
2400
2546
|
task.title,
|
|
2401
2547
|
),
|
|
2548
|
+
// 工作区标签放在标题与操作行之间(副标题位):不挤标题的 2 行高度,
|
|
2549
|
+
// 单行省略;cwd 为空时显示「—」占位。
|
|
2550
|
+
h(WorkspaceTag, { label: workspaceLabel, empty: !hasCwd, path: hasCwd ? task.cwd : '' }),
|
|
2402
2551
|
h(
|
|
2403
2552
|
'div',
|
|
2404
2553
|
{ className: 'tb-card-actions' },
|
|
@@ -2516,6 +2665,11 @@ window.__ModuleLoader__.load({
|
|
|
2516
2665
|
'\u00d7',
|
|
2517
2666
|
),
|
|
2518
2667
|
),
|
|
2668
|
+
// t-71:浮层内会话按钮失败时,提示条渲染在浮层内部——`.tb-detail-mask` 是 z-index:9000
|
|
2669
|
+
// 的全屏遮罩,看板顶部的 notice 横幅会被它盖住,用户看起来仍是「点了没反应」。
|
|
2670
|
+
props.notice && props.notice.text
|
|
2671
|
+
? h('div', { className: 'tb-detail-banner' }, h(Banner, { item: props.notice, onClose: props.onDismissNotice }))
|
|
2672
|
+
: null,
|
|
2519
2673
|
h(
|
|
2520
2674
|
'div',
|
|
2521
2675
|
{ className: 'tb-detail-body' },
|
|
@@ -2845,7 +2999,7 @@ window.__ModuleLoader__.load({
|
|
|
2845
2999
|
return h('div', { className: 'tb-leads', role: 'group', 'aria-label': t('lead.barLabel') }, cells)
|
|
2846
3000
|
}
|
|
2847
3001
|
|
|
2848
|
-
return { Banner, Col, Detail, LeadBar, NeedsBanner, NeedsColumn }
|
|
3002
|
+
return { Banner, Col, Detail, LeadBar, NeedsBanner, NeedsColumn, sessionCandidatesOf }
|
|
2849
3003
|
}
|
|
2850
3004
|
|
|
2851
3005
|
/* ── 看板页 ─────────────────────────────────────────────── */
|
|
@@ -2876,6 +3030,8 @@ window.__ModuleLoader__.load({
|
|
|
2876
3030
|
const [busy, setBusy] = useState('')
|
|
2877
3031
|
const [confirmDeleteId, setConfirmDeleteId] = useState(null)
|
|
2878
3032
|
const [detailId, setDetailId] = useState(null)
|
|
3033
|
+
// t-71:详情浮层内的会话跳转失败提示(渲染在浮层内部;顶部横幅会被 .tb-detail-mask 遮住)。
|
|
3034
|
+
const [detailNotice, setDetailNotice] = useState(null)
|
|
2879
3035
|
// v0.2.2「待你处理」:回答草稿 / 行内错误(详情浮层只读,不持有 state)。
|
|
2880
3036
|
const [answerDraft, setAnswerDraft] = useState('')
|
|
2881
3037
|
const [answerError, setAnswerError] = useState('')
|
|
@@ -3159,6 +3315,43 @@ window.__ModuleLoader__.load({
|
|
|
3159
3315
|
setNote((prev) => removeAttachmentRef(prev, id))
|
|
3160
3316
|
}
|
|
3161
3317
|
|
|
3318
|
+
/* ── 跳到关联会话(v0.2.4):失败不再静默 ─────────── */
|
|
3319
|
+
/**
|
|
3320
|
+
* 统一反馈:能打开就跳转,打不开就出 warn 横幅(`setNotice`,§5.2)。
|
|
3321
|
+
* 返回底层结果,便于把纯逻辑与 UI 拆开测试。
|
|
3322
|
+
*
|
|
3323
|
+
* t-71:浮层开着时把提示交给浮层(`detailNotice`)渲染——`.tb-detail-mask` 是 z-index:9000
|
|
3324
|
+
* 的全屏遮罩,看板顶部横幅在它下面,用户看不见。成功跳转顺带清掉上一次的会话失败提示;
|
|
3325
|
+
* `kind:'session'` 标记保证只清自己设的提示,不误清「派发成功」「已归档」等其它通知。
|
|
3326
|
+
*/
|
|
3327
|
+
function reportSessionFailure(result, candidates) {
|
|
3328
|
+
if (result && result.ok) {
|
|
3329
|
+
setNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
3330
|
+
setDetailNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
3331
|
+
return result
|
|
3332
|
+
}
|
|
3333
|
+
const item = { tone: 'warn', text: sessionFailureText(t, result, candidates), kind: 'session' }
|
|
3334
|
+
if (detailId !== null) {
|
|
3335
|
+
setDetailNotice(item)
|
|
3336
|
+
setNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
3337
|
+
} else {
|
|
3338
|
+
setNotice(item)
|
|
3339
|
+
}
|
|
3340
|
+
return result
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
/** 单个会话 id 的跳转(组长条 / 详情「关联对话」用)。 */
|
|
3344
|
+
function openSessionAction(sessionId) {
|
|
3345
|
+
return reportSessionFailure(openSessionById(sessionId), [sessionId])
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
/** 任务卡片的「对话」:按候选链(worker → 组长 → 发起 → poll 兜底)试到第一个能打开的。 */
|
|
3349
|
+
function openChatAction(task) {
|
|
3350
|
+
const pieces = boardPiecesRef.current
|
|
3351
|
+
const candidates = pieces && typeof pieces.sessionCandidatesOf === 'function' ? pieces.sessionCandidatesOf(task) : []
|
|
3352
|
+
return reportSessionFailure(openFirstAvailable(candidates), candidates)
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3162
3355
|
/* ── 组长条动作(v0.2.0)────────────────────────────────── */
|
|
3163
3356
|
// 三个新 RPC:bind-main-session {sessionId} / clear-main-session {} / ensure-workspace-lead {cwd}。
|
|
3164
3357
|
// 失败走 run() 的顶部错误条(errorText),不乐观更新、不崩。
|
|
@@ -3172,7 +3365,7 @@ window.__ModuleLoader__.load({
|
|
|
3172
3365
|
if (typeof cwd !== 'string' || cwd === '') return
|
|
3173
3366
|
run('lead:ensure', () => callRpc('ensure-workspace-lead', { cwd }), t('lead.ensureOk'))
|
|
3174
3367
|
},
|
|
3175
|
-
openSession: (sessionIdToOpen) =>
|
|
3368
|
+
openSession: (sessionIdToOpen) => openSessionAction(sessionIdToOpen),
|
|
3176
3369
|
}
|
|
3177
3370
|
|
|
3178
3371
|
/* ── 子组件(与平台看板共用)──────────────────────────── */
|
|
@@ -3189,16 +3382,19 @@ window.__ModuleLoader__.load({
|
|
|
3189
3382
|
// v0.2.2:换一条任务就清掉上一条的回答草稿 / 错误,避免答案串台。
|
|
3190
3383
|
setAnswerDraft('')
|
|
3191
3384
|
setAnswerError('')
|
|
3385
|
+
// t-71:上一条任务的会话失败提示也不带到新浮层。
|
|
3386
|
+
setDetailNotice(null)
|
|
3192
3387
|
setDetailId(task.id)
|
|
3193
3388
|
},
|
|
3194
3389
|
// 「对话」按钮传目标会话 id;仍兼容传任务对象的旧调用(取 dispatched → creator)。
|
|
3390
|
+
// 失败(目标会话已关闭 / 服务缺失)出 warn 提示,不再只 console.warn(v0.2.4)。
|
|
3195
3391
|
openSession: (target) => {
|
|
3196
|
-
if (typeof target === 'string')
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
}
|
|
3200
|
-
openSessionById(target && (target.dispatchedSessionId || target.sessionId))
|
|
3392
|
+
if (typeof target === 'string') return openSessionAction(target)
|
|
3393
|
+
const candidates = target ? [target.dispatchedSessionId, target.sessionId] : []
|
|
3394
|
+
return reportSessionFailure(openFirstAvailable(candidates), candidates)
|
|
3201
3395
|
},
|
|
3396
|
+
// 卡片「对话」专用:worker 打不开时回退组长 / 发起会话(候选链见 sessionCandidatesOf)。
|
|
3397
|
+
openChat: (task) => openChatAction(task),
|
|
3202
3398
|
startEdit,
|
|
3203
3399
|
saveEdit,
|
|
3204
3400
|
setEditing,
|
|
@@ -3488,14 +3684,19 @@ window.__ModuleLoader__.load({
|
|
|
3488
3684
|
task: detailTask,
|
|
3489
3685
|
onClose: () => {
|
|
3490
3686
|
setDetailId(null)
|
|
3687
|
+
setDetailNotice(null)
|
|
3491
3688
|
setAnswerDraft('')
|
|
3492
3689
|
setAnswerError('')
|
|
3493
3690
|
},
|
|
3494
3691
|
onStatus: (status) => {
|
|
3495
3692
|
setDetailId(null)
|
|
3693
|
+
setDetailNotice(null)
|
|
3496
3694
|
updateTask(detailTask.id, { status })
|
|
3497
3695
|
},
|
|
3498
|
-
|
|
3696
|
+
// t-71:浮层内会话按钮失败时,提示条渲染在浮层内部(遮罩盖住顶部的 notice 横幅)。
|
|
3697
|
+
notice: detailNotice,
|
|
3698
|
+
onDismissNotice: () => setDetailNotice(null),
|
|
3699
|
+
openSession: (sessionId) => openSessionAction(sessionId),
|
|
3499
3700
|
})
|
|
3500
3701
|
: null,
|
|
3501
3702
|
)
|
|
@@ -3564,6 +3765,8 @@ window.__ModuleLoader__.load({
|
|
|
3564
3765
|
const [busy, setBusy] = useState('')
|
|
3565
3766
|
const [confirmDeleteId, setConfirmDeleteId] = useState(null)
|
|
3566
3767
|
const [detailId, setDetailId] = useState(null)
|
|
3768
|
+
// t-71:详情浮层内的会话跳转失败提示(渲染在浮层内部;顶部横幅会被 .tb-detail-mask 遮住)。
|
|
3769
|
+
const [detailNotice, setDetailNotice] = useState(null)
|
|
3567
3770
|
// v0.2.2「待你处理」:回答草稿 / 行内错误(详情浮层只读,不持有 state)。
|
|
3568
3771
|
const [answerDraft, setAnswerDraft] = useState('')
|
|
3569
3772
|
const [answerError, setAnswerError] = useState('')
|
|
@@ -3584,11 +3787,39 @@ window.__ModuleLoader__.load({
|
|
|
3584
3787
|
const [filterPath, setFilterPath] = useState('')
|
|
3585
3788
|
const [workspaceCwd, setWorkspaceCwd] = useState('')
|
|
3586
3789
|
const aliveRef = useRef(true)
|
|
3790
|
+
// v0.2.3:工作区过滤选择的恢复只做一次;用户手动切换后不再被 snapshot 覆盖。
|
|
3791
|
+
const filterRestoredRef = useRef(false)
|
|
3792
|
+
const filterTouchedRef = useRef(false)
|
|
3793
|
+
// v0.2.3:新建行「任务所属工作区」选择同样只恢复一次、用户改过就不再被覆盖。
|
|
3794
|
+
const draftRestoredRef = useRef(false)
|
|
3795
|
+
const draftTouchedRef = useRef(false)
|
|
3587
3796
|
|
|
3588
3797
|
const refresh = useCallback(() => {
|
|
3589
3798
|
return callRpc('snapshot', {}).then((res) => {
|
|
3590
3799
|
if (!aliveRef.current) return res
|
|
3591
3800
|
if (res.ok && res.value) {
|
|
3801
|
+
// 恢复持久化的「工作区」过滤选择(config.workspaceFilter):
|
|
3802
|
+
// resolveWorkspaceSelection 返回 null 表示工作区列表还没就绪,留到下一次 snapshot 再判定。
|
|
3803
|
+
if (!filterRestoredRef.current && !filterTouchedRef.current) {
|
|
3804
|
+
const value = res.value
|
|
3805
|
+
const stored = value.config ? value.config.workspaceFilter : ''
|
|
3806
|
+
const resolved = resolveWorkspaceSelection(stored, value.workspaces)
|
|
3807
|
+
if (resolved !== null) {
|
|
3808
|
+
filterRestoredRef.current = true
|
|
3809
|
+
if (resolved !== '') setFilterPath(resolved)
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
// v0.2.3:恢复新建行「任务所属工作区」选择(config.workspaceDraft)。
|
|
3813
|
+
// 同样只在工作区列表就绪后判定一次;'' = 未选择(占位,提交保持禁用)。
|
|
3814
|
+
if (!draftRestoredRef.current && !draftTouchedRef.current) {
|
|
3815
|
+
const value = res.value
|
|
3816
|
+
const storedDraft = value.config ? value.config.workspaceDraft : ''
|
|
3817
|
+
const resolvedDraft = resolveWorkspaceSelection(storedDraft, value.workspaces)
|
|
3818
|
+
if (resolvedDraft !== null) {
|
|
3819
|
+
draftRestoredRef.current = true
|
|
3820
|
+
if (resolvedDraft !== '') setWorkspaceCwd(resolvedDraft)
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3592
3823
|
setSnap(res.value)
|
|
3593
3824
|
setError(null)
|
|
3594
3825
|
setFailures(0)
|
|
@@ -3641,7 +3872,15 @@ window.__ModuleLoader__.load({
|
|
|
3641
3872
|
})
|
|
3642
3873
|
}
|
|
3643
3874
|
|
|
3644
|
-
|
|
3875
|
+
// v0.2.3:选中的工作区可能在页面打开期间被删 / 改名——不在当前列表里就不再当成选中项。
|
|
3876
|
+
const activeFilter = resolveWorkspaceSelection(filterPath, workspaces) || ''
|
|
3877
|
+
// v0.2.3:新建行的「任务所属工作区」同样按 snapshot.workspaces 校验——
|
|
3878
|
+
// 选中的工作区在页面打开期间被删 / 改名 → 回退占位(提交重新禁用),不拿失效路径建任务。
|
|
3879
|
+
const activeWorkspaceCwd = resolveWorkspaceSelection(workspaceCwd, workspaces) || ''
|
|
3880
|
+
// v0.2.4:平台看板卡片上的工作区标签——title 优先、目录名回退、无 cwd 用「—」。
|
|
3881
|
+
// 只传给平台看板的 Col / NeedsColumn;右栏看板本来就绑定单个工作区,不重复显示。
|
|
3882
|
+
const workspaceLabelOf = (task) => taskWorkspaceLabel(workspaces, task)
|
|
3883
|
+
const visibleAll = tasksForFilter(allTasks, activeFilter)
|
|
3645
3884
|
// v0.2.2(§1.9):flagged 任务只进最左第五列,不重复出现在普通四列。
|
|
3646
3885
|
const needsUser = needsUserTasks(visibleAll)
|
|
3647
3886
|
const visibleTasks = withoutNeedsUser(visibleAll)
|
|
@@ -3684,7 +3923,7 @@ window.__ModuleLoader__.load({
|
|
|
3684
3923
|
setNotice({ tone: 'warn', text: t('composer.empty') })
|
|
3685
3924
|
return
|
|
3686
3925
|
}
|
|
3687
|
-
if (
|
|
3926
|
+
if (activeWorkspaceCwd === '') {
|
|
3688
3927
|
setNotice({ tone: 'warn', text: t('platform.workspaceRequired') })
|
|
3689
3928
|
return
|
|
3690
3929
|
}
|
|
@@ -3695,7 +3934,8 @@ window.__ModuleLoader__.load({
|
|
|
3695
3934
|
return
|
|
3696
3935
|
}
|
|
3697
3936
|
// 平台看板不绑会话:任务归属由所选工作区决定(cwd),派发由宿主自动挑会话。
|
|
3698
|
-
|
|
3937
|
+
// 用校验后的 activeWorkspaceCwd:选中的工作区被删 / 改名时不会把失效路径写进任务。
|
|
3938
|
+
const payload = { title: trimmedTitle, cwd: activeWorkspaceCwd }
|
|
3699
3939
|
if (note.trim() !== '') payload.note = note.trim()
|
|
3700
3940
|
run('add', () => callRpc('add-task', payload)).then((value) => {
|
|
3701
3941
|
if (!value) return
|
|
@@ -3710,6 +3950,43 @@ window.__ModuleLoader__.load({
|
|
|
3710
3950
|
run('update:' + id, () => callRpc('update-task', Object.assign({ id }, patch)), successText)
|
|
3711
3951
|
}
|
|
3712
3952
|
|
|
3953
|
+
/**
|
|
3954
|
+
* v0.2.3:切换「工作区」过滤 → **立即**持久化(不等到卸载,刷新页面 / 重启 Host 后仍是它)。
|
|
3955
|
+
* 写失败只 console.warn,不影响看板显示(set-workspace-filter 是 best-effort,§3.1)。
|
|
3956
|
+
*/
|
|
3957
|
+
function changeWorkspaceFilter(next) {
|
|
3958
|
+
filterTouchedRef.current = true
|
|
3959
|
+
filterRestoredRef.current = true
|
|
3960
|
+
setFilterPath(next)
|
|
3961
|
+
callRpc('set-workspace-filter', { path: next }).then((res) => {
|
|
3962
|
+
if (!res || res.ok !== true) {
|
|
3963
|
+
const reason = res && res.error && res.error.message ? res.error.message : 'unknown'
|
|
3964
|
+
console.warn('[taskboard] 保存工作区选择失败:' + reason)
|
|
3965
|
+
return
|
|
3966
|
+
}
|
|
3967
|
+
if (res.value && res.value.saved === false) console.warn('[taskboard] 工作区选择未落盘(内存已更新)')
|
|
3968
|
+
})
|
|
3969
|
+
}
|
|
3970
|
+
|
|
3971
|
+
/**
|
|
3972
|
+
* v0.2.3:切换新建行「任务所属工作区」→ **立即**持久化
|
|
3973
|
+
* (去别的会话再点回看板 / 刷新页面 / 重启 Host 后仍是它)。
|
|
3974
|
+
* 写失败只 console.warn,不影响看板显示(set-workspace-draft 是 best-effort,§3.1)。
|
|
3975
|
+
*/
|
|
3976
|
+
function changeWorkspaceCwd(next) {
|
|
3977
|
+
draftTouchedRef.current = true
|
|
3978
|
+
draftRestoredRef.current = true
|
|
3979
|
+
setWorkspaceCwd(next)
|
|
3980
|
+
callRpc('set-workspace-draft', { path: next }).then((res) => {
|
|
3981
|
+
if (!res || res.ok !== true) {
|
|
3982
|
+
const reason = res && res.error && res.error.message ? res.error.message : 'unknown'
|
|
3983
|
+
console.warn('[taskboard] 保存任务所属工作区失败:' + reason)
|
|
3984
|
+
return
|
|
3985
|
+
}
|
|
3986
|
+
if (res.value && res.value.saved === false) console.warn('[taskboard] 任务所属工作区未落盘(内存已更新)')
|
|
3987
|
+
})
|
|
3988
|
+
}
|
|
3989
|
+
|
|
3713
3990
|
function removeTask(task) {
|
|
3714
3991
|
// 二次确认由卡片上的按钮承担(见 Card 的 confirmingDelete),这里不再弹原生 confirm。
|
|
3715
3992
|
setConfirmDeleteId(null)
|
|
@@ -3817,6 +4094,40 @@ window.__ModuleLoader__.load({
|
|
|
3817
4094
|
setNote((prev) => removeAttachmentRef(prev, id))
|
|
3818
4095
|
}
|
|
3819
4096
|
|
|
4097
|
+
/* ── 跳到关联会话(v0.2.4):失败不再静默 ─────────── */
|
|
4098
|
+
/**
|
|
4099
|
+
* 与右栏看板同一套反馈:能打开就跳转,打不开就出 warn 横幅。
|
|
4100
|
+
* t-71:浮层开着时提示渲染在浮层内部(`detailNotice`),否则看板顶部横幅会被遮罩盖住;
|
|
4101
|
+
* 成功跳转只清 `kind:'session'` 的旧提示(不误清派发 / 归档等其它通知)。
|
|
4102
|
+
*/
|
|
4103
|
+
function reportSessionFailure(result, candidates) {
|
|
4104
|
+
if (result && result.ok) {
|
|
4105
|
+
setNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
4106
|
+
setDetailNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
4107
|
+
return result
|
|
4108
|
+
}
|
|
4109
|
+
const item = { tone: 'warn', text: sessionFailureText(t, result, candidates), kind: 'session' }
|
|
4110
|
+
if (detailId !== null) {
|
|
4111
|
+
setDetailNotice(item)
|
|
4112
|
+
setNotice((prev) => (prev && prev.kind === 'session' ? null : prev))
|
|
4113
|
+
} else {
|
|
4114
|
+
setNotice(item)
|
|
4115
|
+
}
|
|
4116
|
+
return result
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
/** 单个会话 id 的跳转(组长条 / 详情「关联对话」用)。 */
|
|
4120
|
+
function openSessionAction(sessionId) {
|
|
4121
|
+
return reportSessionFailure(openSessionById(sessionId), [sessionId])
|
|
4122
|
+
}
|
|
4123
|
+
|
|
4124
|
+
/** 任务卡片的「对话」:按候选链(worker → 组长 → 发起 → poll 兜底)试到第一个能打开的。 */
|
|
4125
|
+
function openChatAction(task) {
|
|
4126
|
+
const pieces = boardPiecesRef.current
|
|
4127
|
+
const candidates = pieces && typeof pieces.sessionCandidatesOf === 'function' ? pieces.sessionCandidatesOf(task) : []
|
|
4128
|
+
return reportSessionFailure(openFirstAvailable(candidates), candidates)
|
|
4129
|
+
}
|
|
4130
|
+
|
|
3820
4131
|
/* ── 组长条动作(v0.2.0,与右栏看板同一套 RPC)──────────── */
|
|
3821
4132
|
const leadActions = {
|
|
3822
4133
|
bindMain: () => {
|
|
@@ -3828,7 +4139,7 @@ window.__ModuleLoader__.load({
|
|
|
3828
4139
|
if (typeof cwd !== 'string' || cwd === '') return
|
|
3829
4140
|
run('lead:ensure', () => callRpc('ensure-workspace-lead', { cwd }), t('lead.ensureOk'))
|
|
3830
4141
|
},
|
|
3831
|
-
openSession: (sessionIdToOpen) =>
|
|
4142
|
+
openSession: (sessionIdToOpen) => openSessionAction(sessionIdToOpen),
|
|
3832
4143
|
}
|
|
3833
4144
|
|
|
3834
4145
|
// 组件身份保持稳定(同右栏看板):bind 存 ref、只改字段,pieces 只创建一次。
|
|
@@ -3843,16 +4154,19 @@ window.__ModuleLoader__.load({
|
|
|
3843
4154
|
// v0.2.2:换一条任务就清掉上一条的回答草稿 / 错误,避免答案串台。
|
|
3844
4155
|
setAnswerDraft('')
|
|
3845
4156
|
setAnswerError('')
|
|
4157
|
+
// t-71:上一条任务的会话失败提示也不带到新浮层。
|
|
4158
|
+
setDetailNotice(null)
|
|
3846
4159
|
setDetailId(task.id)
|
|
3847
4160
|
},
|
|
3848
4161
|
// 「对话」按钮传目标会话 id;仍兼容传任务对象的旧调用(取 dispatched → creator)。
|
|
4162
|
+
// 失败(目标会话已关闭 / 服务缺失)出 warn 提示,不再只 console.warn(v0.2.4)。
|
|
3849
4163
|
openSession: (target) => {
|
|
3850
|
-
if (typeof target === 'string')
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
}
|
|
3854
|
-
openSessionById(target && (target.dispatchedSessionId || target.sessionId))
|
|
4164
|
+
if (typeof target === 'string') return openSessionAction(target)
|
|
4165
|
+
const candidates = target ? [target.dispatchedSessionId, target.sessionId] : []
|
|
4166
|
+
return reportSessionFailure(openFirstAvailable(candidates), candidates)
|
|
3855
4167
|
},
|
|
4168
|
+
// 卡片「对话」专用:worker 打不开时回退组长 / 发起会话(候选链见 sessionCandidatesOf)。
|
|
4169
|
+
openChat: (task) => openChatAction(task),
|
|
3856
4170
|
startEdit,
|
|
3857
4171
|
saveEdit,
|
|
3858
4172
|
setEditing,
|
|
@@ -3900,7 +4214,7 @@ window.__ModuleLoader__.load({
|
|
|
3900
4214
|
const skipReason = poll.lastSkipReason || ''
|
|
3901
4215
|
const skipKey = 'poll.skip.' + skipReason
|
|
3902
4216
|
const skipText = skipReason === '' ? '' : t(skipKey) === skipKey ? skipReason : t(skipKey)
|
|
3903
|
-
const workspaceRequired =
|
|
4217
|
+
const workspaceRequired = activeWorkspaceCwd === ''
|
|
3904
4218
|
|
|
3905
4219
|
const presetBanner = (() => {
|
|
3906
4220
|
if (!preset) return null
|
|
@@ -4028,8 +4342,10 @@ window.__ModuleLoader__.load({
|
|
|
4028
4342
|
className: 'tb-select tb-workspace-select',
|
|
4029
4343
|
'aria-label': t('platform.workspace'),
|
|
4030
4344
|
title: t('platform.workspaceRequired'),
|
|
4031
|
-
|
|
4032
|
-
|
|
4345
|
+
// v0.2.3:下拉值用校验后的 activeWorkspaceCwd——上次选的工作区被删 /
|
|
4346
|
+
// 改名时回退占位,不把失效值当选中项(选择本身由 config.workspaceDraft 持久化)。
|
|
4347
|
+
value: activeWorkspaceCwd,
|
|
4348
|
+
onChange: (event) => changeWorkspaceCwd(event.target.value),
|
|
4033
4349
|
},
|
|
4034
4350
|
h('option', { value: '' }, t('platform.workspacePlaceholder')),
|
|
4035
4351
|
workspaceOptions.map((option) => h('option', { key: option.path, value: option.path }, option.title)),
|
|
@@ -4108,8 +4424,8 @@ window.__ModuleLoader__.load({
|
|
|
4108
4424
|
{
|
|
4109
4425
|
className: 'tb-select',
|
|
4110
4426
|
'aria-label': t('platform.filter'),
|
|
4111
|
-
value:
|
|
4112
|
-
onChange: (event) =>
|
|
4427
|
+
value: activeFilter,
|
|
4428
|
+
onChange: (event) => changeWorkspaceFilter(event.target.value),
|
|
4113
4429
|
},
|
|
4114
4430
|
h('option', { value: '' }, t('platform.filterAll')),
|
|
4115
4431
|
workspaceOptions.map((option) => h('option', { key: option.path, value: option.path }, option.title)),
|
|
@@ -4126,8 +4442,12 @@ window.__ModuleLoader__.load({
|
|
|
4126
4442
|
'div',
|
|
4127
4443
|
{ className: 'tb-board', 'data-layout': 'wide', 'data-needs': needsUser.length > 0 ? 'true' : 'false' },
|
|
4128
4444
|
// 第五列「待你处理」放最左(在「待开始」之前),仅非空时渲染。
|
|
4129
|
-
needsUser.length > 0
|
|
4130
|
-
|
|
4445
|
+
needsUser.length > 0
|
|
4446
|
+
? h(NeedsColumn, { key: 'needsUser', tasks: needsUser, workspaceLabel: workspaceLabelOf })
|
|
4447
|
+
: null,
|
|
4448
|
+
STATUS_ORDER.map((status) =>
|
|
4449
|
+
h(Col, { key: status, status, tasks: groups[status], compact: false, workspaceLabel: workspaceLabelOf }),
|
|
4450
|
+
),
|
|
4131
4451
|
),
|
|
4132
4452
|
|
|
4133
4453
|
h(
|
|
@@ -4144,14 +4464,19 @@ window.__ModuleLoader__.load({
|
|
|
4144
4464
|
task: detailTask,
|
|
4145
4465
|
onClose: () => {
|
|
4146
4466
|
setDetailId(null)
|
|
4467
|
+
setDetailNotice(null)
|
|
4147
4468
|
setAnswerDraft('')
|
|
4148
4469
|
setAnswerError('')
|
|
4149
4470
|
},
|
|
4150
4471
|
onStatus: (status) => {
|
|
4151
4472
|
setDetailId(null)
|
|
4473
|
+
setDetailNotice(null)
|
|
4152
4474
|
updateTask(detailTask.id, { status })
|
|
4153
4475
|
},
|
|
4154
|
-
|
|
4476
|
+
// t-71:浮层内会话按钮失败时,提示条渲染在浮层内部(遮罩盖住顶部的 notice 横幅)。
|
|
4477
|
+
notice: detailNotice,
|
|
4478
|
+
onDismissNotice: () => setDetailNotice(null),
|
|
4479
|
+
openSession: (sessionId) => openSessionAction(sessionId),
|
|
4155
4480
|
})
|
|
4156
4481
|
: null,
|
|
4157
4482
|
)
|
|
@@ -4277,8 +4602,13 @@ window.__ModuleLoader__.load({
|
|
|
4277
4602
|
normalizePath,
|
|
4278
4603
|
samePath,
|
|
4279
4604
|
workspaceTitleOf,
|
|
4605
|
+
// v0.2.4:平台看板卡片的工作区标签(title 优先 / 目录名回退 / 空 cwd 占位)
|
|
4606
|
+
taskWorkspaceLabel,
|
|
4607
|
+
workspaceLabelNone: WORKSPACE_LABEL_NONE,
|
|
4280
4608
|
tasksForWorkspace,
|
|
4281
4609
|
tasksForFilter,
|
|
4610
|
+
// v0.2.3:看板「工作区」过滤选择的恢复 / 脏值回退
|
|
4611
|
+
resolveWorkspaceSelection,
|
|
4282
4612
|
parseRichText,
|
|
4283
4613
|
splitLooseSegments,
|
|
4284
4614
|
renderInline,
|