dsh-team-bots 0.3.70 → 0.3.80
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/docs/assets/global-config.png +0 -0
- package/docs/assets/global-config.zh.png +0 -0
- package/docs/assets/tasks.png +0 -0
- package/docs/assets/tasks.zh.png +0 -0
- package/docs/assets/usage.png +0 -0
- package/docs/assets/usage.zh.png +0 -0
- package/package.json +1 -1
- package/src/db-migrations.js +3 -0
- package/src/db.js +1 -0
- package/src/services/runtime/session.js +10 -1
- package/src/services/scheduler.js +16 -6
- package/src/services/task-dispatch.js +28 -21
- package/src/services/task-review.js +7 -6
- package/src/services/tasks.js +16 -8
- package/src/usage.js +73 -32
- package/ui/i18n/en/settings.js +1 -0
- package/ui/i18n/zh/settings.js +1 -0
- package/ui/modules/cards.js +36 -5
- package/ui/modules/modal-forms.js +8 -8
- package/ui/styles/base.css +27 -23
- package/ui/styles/buttons.css +35 -21
- package/ui/styles/cards.css +6 -4
- package/ui/styles/chat-cards.css +32 -21
- package/ui/styles/chat-composer.css +17 -13
- package/ui/styles/chat-images.css +24 -19
- package/ui/styles/chat.css +5 -3
- package/ui/styles/frame.css +4 -2
- package/ui/styles/global-config.css +3 -2
- package/ui/styles/main.css +2 -1
- package/ui/styles/modal.css +13 -7
- package/ui/styles/settings.css +5 -3
- package/ui/styles/surfaces.css +5 -3
- package/ui/styles/tasks.css +9 -7
- package/ui/styles/toast.css +1 -1
- package/ui/styles/wide.css +6 -7
|
Binary file
|
|
Binary file
|
package/docs/assets/tasks.png
CHANGED
|
Binary file
|
package/docs/assets/tasks.zh.png
CHANGED
|
Binary file
|
package/docs/assets/usage.png
CHANGED
|
Binary file
|
package/docs/assets/usage.zh.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/db-migrations.js
CHANGED
|
@@ -217,8 +217,11 @@ function migrateRuns(db) {
|
|
|
217
217
|
// tasks.time_budget_minutes 存发布时的时效要求(分钟,NULL = 未声明不注入提示词)。
|
|
218
218
|
// tasks.deliverables 存卡面声明的交付物文件路径(JSON 路径数组);核验按路径直接读文件,
|
|
219
219
|
// 交付报告只引用路径不复述正文(DSHBOTS-345 复盘)。
|
|
220
|
+
// tasks.ignored_write_scopes 存声明中被 .gitignore 命中的「染色」条目(JSON 路径数组):
|
|
221
|
+
// 进卡面展示但不参与并行锁判定(全染色卡不与任何写运行串行,见 scheduler 写范围闸门)。
|
|
220
222
|
function migrateTasks(db) {
|
|
221
223
|
addColumn(db, 'tasks', 'write_scopes', "TEXT NOT NULL DEFAULT '[]'")
|
|
224
|
+
addColumn(db, 'tasks', 'ignored_write_scopes', "TEXT NOT NULL DEFAULT '[]'")
|
|
222
225
|
addColumn(db, 'tasks', 'time_budget_minutes', 'INTEGER')
|
|
223
226
|
addColumn(db, 'tasks', 'deliverables', "TEXT NOT NULL DEFAULT '[]'")
|
|
224
227
|
}
|
package/src/db.js
CHANGED
|
@@ -162,6 +162,7 @@ CREATE TABLE IF NOT EXISTS tasks (
|
|
|
162
162
|
estimate REAL,
|
|
163
163
|
time_budget_minutes INTEGER,
|
|
164
164
|
write_scopes TEXT NOT NULL DEFAULT '[]',
|
|
165
|
+
ignored_write_scopes TEXT NOT NULL DEFAULT '[]',
|
|
165
166
|
deliverables TEXT NOT NULL DEFAULT '[]',
|
|
166
167
|
version INTEGER NOT NULL DEFAULT 1,
|
|
167
168
|
created_at TEXT NOT NULL,
|
|
@@ -333,9 +333,18 @@ export const sessionMethods = {
|
|
|
333
333
|
// 让 bot 在旧上下文里自写交接摘要(进行中任务 / 关键决定 / 未决问题)。
|
|
334
334
|
// 幂等双保险:调用前查 trigger_ref 上的 active 运行;INSERT OR IGNORE 兜住同一
|
|
335
335
|
// idempotency_key 的并发插入,避免唯一约束抛错把当前这条对话运行带崩。
|
|
336
|
+
// 幂等键带尝试代次,代次 = 该会话已终态的摘要运行数(排队/在跑不计入):入队本身
|
|
337
|
+
// 不改终态数,并发双入队代次恒同,唯一约束照旧去重;终态(失败/取消/空产出)后
|
|
338
|
+
// 再次触发代次前进,键不再被历史终态行永久占坑。生产事故(2026-11-13 起):固定
|
|
339
|
+
// 会话级键被唯一一条被取消的摘要运行占死,此后每次复用的补排都被 INSERT OR IGNORE
|
|
340
|
+
// 静默吞掉,director 控制面会话越过体积/子代理阈值后结转从未再发生。
|
|
336
341
|
enqueueRolloverSummary({ bot, project, sessionId }) {
|
|
337
342
|
const runId = id('run')
|
|
338
343
|
const queuedAt = new Date().toISOString()
|
|
344
|
+
const generation = this.store.get(
|
|
345
|
+
"SELECT COUNT(*) AS n FROM runs WHERE kind = 'rollover_summary' AND trigger_ref = ? AND status NOT IN ('queued', 'running')",
|
|
346
|
+
sessionId,
|
|
347
|
+
)?.n ?? 0
|
|
339
348
|
const inserted = this.store.run(
|
|
340
349
|
`INSERT OR IGNORE INTO runs(id, project_id, bot_id, kind, mode, trigger_type, trigger_ref, status, attempt, idempotency_key, session_id, queued_at)
|
|
341
350
|
VALUES (?, ?, ?, 'rollover_summary', 'read', 'rollover_summary', ?, 'queued', 1, ?, ?, ?)`,
|
|
@@ -343,7 +352,7 @@ export const sessionMethods = {
|
|
|
343
352
|
project?.id ?? null,
|
|
344
353
|
bot.id,
|
|
345
354
|
sessionId,
|
|
346
|
-
`rollover_summary:${sessionId}`,
|
|
355
|
+
`rollover_summary:${sessionId}:${generation}`,
|
|
347
356
|
sessionId,
|
|
348
357
|
queuedAt,
|
|
349
358
|
)
|
|
@@ -11,7 +11,7 @@ import { MAX_RATE_LIMIT_RETRIES, isQuotaExhausted, isRetryChainError } from './b
|
|
|
11
11
|
import { INTERNAL_FALLBACK_KINDS } from './model-fallback.js'
|
|
12
12
|
import { ensureTaskRelationsSchema, unsatisfiedBlockedDeps } from './task-relations.js'
|
|
13
13
|
import { TASK_BUDGET_ROUNDS, TRANSITIONS, taskDeadlineInfo } from './tasks.js'
|
|
14
|
-
import { effectiveWriteScopes, writeScopesOverlap } from './write-scopes.js'
|
|
14
|
+
import { effectiveWriteScopes, readWriteScopes, writeScopesOverlap } from './write-scopes.js'
|
|
15
15
|
import { runReviewWatchdog } from './review-watchdog.js'
|
|
16
16
|
import { pollGithubSources } from './github-source.js'
|
|
17
17
|
import { staleCardHit } from './notify.js'
|
|
@@ -571,20 +571,25 @@ export const schedulerMethods = {
|
|
|
571
571
|
// claimKey 串行域 = (bot, 工作区)(DSHBOTS-308):键只读 bot_id/project_id(均在列面),
|
|
572
572
|
// 在跑侧与候选侧算的是同一 run 行的同一列,串行不失效(承 DSHBOTS-219 口径)。
|
|
573
573
|
`SELECT r.bot_id, r.kind, r.task_id, r.project_id, r.mode, r.write_scopes, r.trigger_type,
|
|
574
|
-
t.status AS task_status
|
|
574
|
+
t.status AS task_status, t.ignored_write_scopes AS task_ignored_scopes
|
|
575
575
|
FROM runs r LEFT JOIN tasks t ON t.id = r.task_id
|
|
576
576
|
WHERE r.status = 'running'`,
|
|
577
577
|
)
|
|
578
578
|
const activeKeys = new Set(activeRows.map(row => this.claimKey(row)))
|
|
579
|
-
// 同项目在跑的写运行:按写范围判定能否并行。写范围为空 = 未声明 =
|
|
579
|
+
// 同项目在跑的写运行:按写范围判定能否并行。写范围为空 = 未声明 = 保守串行;
|
|
580
|
+
// 染色例外(命中 .gitignore):写范围只剩染色条目的任务运行不参与任何锁——
|
|
581
|
+
// 染色路径没有写保护价值,即使与别的任务写同一文件也放行并行。
|
|
580
582
|
const activeWriteScopes = new Map()
|
|
581
583
|
for (const row of activeRows) {
|
|
582
584
|
if (row.mode !== 'write' || !row.project_id) continue
|
|
583
585
|
// 任务不在「进行中」就不占写槽(DSHBOTS-73):写占用随任务离开进行中即时释放。
|
|
584
586
|
if (!runHoldsWriteLock({ kind: row.kind, mode: row.mode, taskStatus: row.task_status })) continue
|
|
587
|
+
const effective = effectiveWriteScopes(row.write_scopes)
|
|
588
|
+
// 全染色运行不进冲突名单:与任何候选(含未声明候选)互不阻塞。
|
|
589
|
+
if (!effective.length && readWriteScopes(row.task_ignored_scopes).length) continue
|
|
585
590
|
const list = activeWriteScopes.get(row.project_id) ?? []
|
|
586
591
|
// package.json 是版本钩子机械改动,比对前剥掉(DSHBOTS-133),否则全队列判交叠串行。
|
|
587
|
-
list.push(
|
|
592
|
+
list.push(effective)
|
|
588
593
|
activeWriteScopes.set(row.project_id, list)
|
|
589
594
|
}
|
|
590
595
|
let activeTotal = activeRows.length
|
|
@@ -603,7 +608,7 @@ export const schedulerMethods = {
|
|
|
603
608
|
// 候选过滤(DSHBOTS-110):任务已终态(done/canceled)的 queued 任务运行不再领取;
|
|
604
609
|
// 只排 kind='task',非任务运行不受影响。LEFT JOIN 出 NULL 的孤儿任务运行不过滤。
|
|
605
610
|
const candidates = this.store.all(
|
|
606
|
-
`SELECT r
|
|
611
|
+
`SELECT r.*, t.ignored_write_scopes AS task_ignored_scopes FROM runs r LEFT JOIN tasks t ON t.id = r.task_id
|
|
607
612
|
LEFT JOIN messages m ON m.id = r.trigger_ref
|
|
608
613
|
WHERE r.status = 'queued'
|
|
609
614
|
AND NOT (r.kind = 'task' AND COALESCE(t.status, '') IN ('done', 'canceled'))
|
|
@@ -629,8 +634,13 @@ export const schedulerMethods = {
|
|
|
629
634
|
// 单聊运行 project_id 为空,写锁落在各自独立的 _the_bots/<dir>,不占项目锁。
|
|
630
635
|
// 候选侧同样先剥 package.json(DSHBOTS-133):存量 queued 运行快照可能带它,
|
|
631
636
|
// 过滤后任一为空仍按「未声明」保守串行,不降低既有安全边界。
|
|
637
|
+
// 染色例外(命中 .gitignore):候选只剩染色条目时不参与锁,即使与在跑写运行
|
|
638
|
+
// 写同一文件也放行——染色路径没有写保护价值。
|
|
632
639
|
const writeScopes = run.mode === 'write' ? effectiveWriteScopes(run.write_scopes) : []
|
|
633
|
-
|
|
640
|
+
const ignoredOnly = run.mode === 'write'
|
|
641
|
+
&& !writeScopes.length
|
|
642
|
+
&& readWriteScopes(run.task_ignored_scopes).length > 0
|
|
643
|
+
if (run.mode === 'write' && run.project_id && !ignoredOnly) {
|
|
634
644
|
const runningScopes = activeWriteScopes.get(run.project_id) ?? []
|
|
635
645
|
if (runningScopes.some(other => writeScopesOverlap(writeScopes, other))) continue
|
|
636
646
|
}
|
|
@@ -66,15 +66,15 @@ export const taskDispatchMethods = {
|
|
|
66
66
|
},
|
|
67
67
|
// 无主卡领取开工的写范围声明闸门(DSHBOTS-270):与 assignFromBot「派单必须声明写
|
|
68
68
|
// 范围」同口径的预判——卡面清单优先,空则从描述「写范围:」行兜底解析
|
|
69
|
-
// (parseWriteScopesFromDescription
|
|
70
|
-
//
|
|
69
|
+
// (parseWriteScopesFromDescription)。声明非空即放行:有效范围进并行锁;
|
|
70
|
+
// 命中 .gitignore 的条目进染色清单(ignored_write_scopes),不参与锁也不触发拒绝。
|
|
71
71
|
assertClaimScopes(task, project) {
|
|
72
72
|
const declared = readWriteScopes(task.write_scopes)
|
|
73
|
-
const
|
|
73
|
+
const { kept, removed } = filterIgnoredWriteScopes(
|
|
74
74
|
declared.length ? declared : parseWriteScopesFromDescription(task.description),
|
|
75
75
|
this.projectWorkDir(project),
|
|
76
|
-
)
|
|
77
|
-
if (
|
|
76
|
+
)
|
|
77
|
+
if (kept.length || removed.length) return
|
|
78
78
|
throw badRequest(
|
|
79
79
|
`领取开工必须声明写范围:任务 ${project.key}-${task.number} 未声明写范围,`
|
|
80
80
|
+ '其写运行会与同项目其他写运行全部保守串行,一条卡即可堵死队列。'
|
|
@@ -309,17 +309,18 @@ export const taskDispatchMethods = {
|
|
|
309
309
|
}
|
|
310
310
|
return null
|
|
311
311
|
},
|
|
312
|
-
//
|
|
313
|
-
// createTask
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
312
|
+
// 派单清洗三入口共用——createTask(owner 派单路径权威清洗)、assignFromBot(经
|
|
313
|
+
// createTask 同一清洗)、taskUpdateScopes(改卡入口)。两步:
|
|
314
|
+
// ① ignored 染色——命中项目 .gitignore 的条目没有写保护价值,不进 write_scopes
|
|
315
|
+
// (并行锁只认有效范围),但保留进 ignored_write_scopes 供卡面展示:全染色卡
|
|
316
|
+
// 不再触发「必须声明写范围」拒绝,也不与任何写运行串行(同文件也并行)。审计落
|
|
317
|
+
// task.scopes_normalize(ignored=[...])。非 git 目录 / git 不可用时保守放行不清洗。
|
|
318
318
|
// ② 一级目录驳回——清洗后仍不含 / 的条目(src、tests 这类整目录声明)直接拒绝:
|
|
319
319
|
// 整目录会把同项目全部写运行判为冲突锁死并发,这不是清洗能救的,必须改卡。
|
|
320
|
+
// 染色条目不参与该闸(它们不进锁,无锁死风险)。
|
|
320
321
|
normalizeDispatchScopes(project, scopes, { actor, taskId }) {
|
|
321
322
|
const { kept, removed } = filterIgnoredWriteScopes(scopes, this.projectWorkDir(project))
|
|
322
|
-
if (removed.length) this.audit(actor, 'task.scopes_normalize', 'task', taskId, { removed })
|
|
323
|
+
if (removed.length) this.audit(actor, 'task.scopes_normalize', 'task', taskId, { ignored: removed })
|
|
323
324
|
const bare = kept.filter(scope => !scope.includes('/'))
|
|
324
325
|
if (bare.length) {
|
|
325
326
|
throw badRequest(
|
|
@@ -327,7 +328,7 @@ export const taskDispatchMethods = {
|
|
|
327
328
|
+ '整目录声明会锁死同项目全部写运行。',
|
|
328
329
|
)
|
|
329
330
|
}
|
|
330
|
-
return kept
|
|
331
|
+
return { scopes: kept, ignored: removed }
|
|
331
332
|
},
|
|
332
333
|
async assignFromBot(sessionId, input) {
|
|
333
334
|
const { project, actor } = this.ownerContextFor(sessionId)
|
|
@@ -353,7 +354,11 @@ export const taskDispatchMethods = {
|
|
|
353
354
|
// 核验纪律派单闸(DSHBOTS-303):重派/改卡按生效卡面(本次传入优先,缺省回落原卡)。
|
|
354
355
|
this.assertNotVerificationDispatch(project, member.id, input.title ?? task.title, input.description ?? task.description)
|
|
355
356
|
// 派单策略闸(DSHBOTS-314):重派按原卡声明写范围同闸(重派不改写范围,D-232 口径)。
|
|
356
|
-
|
|
357
|
+
// 有效范围 + 染色条目合并判定:染色路径一样会被写盘,不能因染色漏拦只读 bot。
|
|
358
|
+
this.assertWritableDispatch(member.id, [
|
|
359
|
+
...readWriteScopes(task.write_scopes),
|
|
360
|
+
...readWriteScopes(task.ignored_write_scopes),
|
|
361
|
+
])
|
|
357
362
|
// 任务卡修正闭环(DSHBOTS-232 ①):重派可同时改卡面(标题/描述/优先级)——先经
|
|
358
363
|
// updateTask 落卡,卡面变化由其统一触发点通知负责人修正,再走原重派链路。
|
|
359
364
|
// 写范围不在此口改:入队运行快照与调度闸门消费的不是同一份数据,
|
|
@@ -379,21 +384,23 @@ export const taskDispatchMethods = {
|
|
|
379
384
|
}
|
|
380
385
|
// 派单必须声明写范围(程序化闸门,不靠派单方自觉):未声明写范围的任务其写运行会与
|
|
381
386
|
// 同项目所有写运行判为冲突并保守串行,一条空范围任务就能把整队堵死。这里直接拒绝,
|
|
382
|
-
//
|
|
387
|
+
// 而不是留到调度器里把并发能力悄悄吃掉。命中 .gitignore 的染色条目算已声明:
|
|
388
|
+
// 它们进 ignored_write_scopes、不参与并行锁,全染色卡照常派发且不堵任何队列。
|
|
383
389
|
const parsedScopes = input.write_scopes === undefined || input.write_scopes === null
|
|
384
390
|
? parseWriteScopesFromDescription(input.description)
|
|
385
391
|
: parseWriteScopes(input.write_scopes)
|
|
386
|
-
|
|
387
|
-
// 拒绝。原清单透传 createTask 做权威清洗+审计(审计需真实 taskId),此处只预览不落账。
|
|
388
|
-
const scopes = filterIgnoredWriteScopes(parsedScopes, this.projectWorkDir(project)).kept
|
|
389
|
-
// 派单策略闸(DSHBOTS-314):写卡派只读 bot 在入口拒绝;重派分支按原卡声明补一道。
|
|
390
|
-
this.assertWritableDispatch(member.id, scopes)
|
|
391
|
-
if (!scopes.length) {
|
|
392
|
+
if (!parsedScopes.length) {
|
|
392
393
|
throw badRequest(
|
|
393
394
|
'派单必须声明写范围:传 write_scopes 路径数组,或在描述里写一行「写范围:a, b」。'
|
|
394
395
|
+ '未声明会让该任务的写运行与同项目其他写运行全部串行,一条任务即可堵死队列。',
|
|
395
396
|
)
|
|
396
397
|
}
|
|
398
|
+
// 闸门按清洗后清单预判(DSHBOTS-168):染色条目剔除后剩下的有效范围才参与
|
|
399
|
+
// 整目录闸 / 上限闸 / 重复卡闸。原清单透传 createTask 做权威清洗+落库(含染色清单)。
|
|
400
|
+
const scopes = filterIgnoredWriteScopes(parsedScopes, this.projectWorkDir(project)).kept
|
|
401
|
+
// 派单策略闸(DSHBOTS-314):写卡派只读 bot 在入口拒绝;重派分支按原卡声明补一道。
|
|
402
|
+
// 判定用完整声明清单:染色路径一样会被写盘,不能因染色漏拦只读 bot。
|
|
403
|
+
this.assertWritableDispatch(member.id, parsedScopes)
|
|
397
404
|
// 大卡拆分闸(产品化派单纪律):写范围条目超过 maxWriteScopesPerTask 时拒绝整卡
|
|
398
405
|
// 派发——超大范围卡与同项目一切写运行按保守串行互斥,一条卡即可吃掉整队并行能力
|
|
399
406
|
// (2026-11-13 生产实测 run_parallel 触发率仅 26%,主因即大范围声明)。拒绝文案
|
|
@@ -153,10 +153,10 @@ export const taskReviewMethods = {
|
|
|
153
153
|
const task = this.taskRow(taskId)
|
|
154
154
|
if (task.status === 'done' || task.status === 'canceled') throw conflict('任务已结束,不能修改写范围')
|
|
155
155
|
const parsedScopes = parseWriteScopes(writeScopesInput)
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
const scopes = this.normalizeDispatchScopes(this.projectRow(task.project_id), parsedScopes, { actor, taskId })
|
|
159
|
-
if (!scopes.length) throw badRequest('写范围不能为空:未声明的写运行会与同项目所有写运行保守串行')
|
|
156
|
+
// 派单清洗:与派单入口同口径——ignored 染色(进 ignored_write_scopes,不参与并行锁)
|
|
157
|
+
// + 一级目录驳回;有效与染色清单同时为空才落「写范围不能为空」拒绝。
|
|
158
|
+
const { scopes, ignored } = this.normalizeDispatchScopes(this.projectRow(task.project_id), parsedScopes, { actor, taskId })
|
|
159
|
+
if (!scopes.length && !ignored.length) throw badRequest('写范围不能为空:未声明的写运行会与同项目所有写运行保守串行')
|
|
160
160
|
const runningWrite = this.store.get(
|
|
161
161
|
"SELECT id FROM runs WHERE task_id = ? AND status = 'running' AND mode = 'write'",
|
|
162
162
|
taskId,
|
|
@@ -168,10 +168,11 @@ export const taskReviewMethods = {
|
|
|
168
168
|
)
|
|
169
169
|
const from = readWriteScopes(task.write_scopes)
|
|
170
170
|
const serialized = JSON.stringify(scopes)
|
|
171
|
+
const ignoredSerialized = JSON.stringify(ignored)
|
|
171
172
|
this.store.transaction(() => {
|
|
172
173
|
this.store.run(
|
|
173
|
-
'UPDATE tasks SET write_scopes = ?, version = version + 1, updated_at = ? WHERE id = ?',
|
|
174
|
-
serialized, nowIso(), taskId,
|
|
174
|
+
'UPDATE tasks SET write_scopes = ?, ignored_write_scopes = ?, version = version + 1, updated_at = ? WHERE id = ?',
|
|
175
|
+
serialized, ignoredSerialized, nowIso(), taskId,
|
|
175
176
|
)
|
|
176
177
|
for (const run of queuedWrites) {
|
|
177
178
|
this.store.run('UPDATE runs SET write_scopes = ? WHERE id = ?', serialized, run.id)
|
package/src/services/tasks.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { badRequest, conflict, notFound } from '../errors.js'
|
|
8
8
|
import { clampNumber, id, nowIso, projectKey, TASK_ID_PATTERN, text } from '../util.js'
|
|
9
|
-
import { parseDeliverables, parseWriteScopes, parseWriteScopesFromDescription, readDeliverables, readWriteScopes } from './write-scopes.js'
|
|
9
|
+
import { filterIgnoredWriteScopes, parseDeliverables, parseWriteScopes, parseWriteScopesFromDescription, readDeliverables, readWriteScopes } from './write-scopes.js'
|
|
10
10
|
import { ensureAttentionSchema, parseAttention } from './attention-schema.js'
|
|
11
11
|
import { SANDBOX_OVERRIDES } from './file-policy.js'
|
|
12
12
|
import { ensureTaskSandboxSchema } from './task-sandbox-schema.js'
|
|
@@ -173,16 +173,17 @@ export const tasksMethods = {
|
|
|
173
173
|
ensureTaskSandboxSchema(this.store)
|
|
174
174
|
let number
|
|
175
175
|
this.store.transaction(() => {
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
|
|
176
|
+
// 派单清洗:ignored 染色 + 一级目录驳回,与建档同事务——有效清单与染色清单
|
|
177
|
+
// 分别落 write_scopes / ignored_write_scopes(运行快照天然继承有效清单),
|
|
178
|
+
// 审计挂真实 taskId 不产生孤儿行。
|
|
179
|
+
const { scopes: writeScopes, ignored } = this.normalizeDispatchScopes(project, parsedScopes, { actor, taskId })
|
|
179
180
|
const relations = validateTaskRelations({ store: this.store, projectId: project.id, taskId, parentTaskId, blockedBy })
|
|
180
181
|
number = Number(this.store.get('SELECT COALESCE(MAX(number), 0) + 1 AS n FROM tasks WHERE project_id = ?', project.id)?.n ?? 1)
|
|
181
182
|
this.store.run(
|
|
182
183
|
`INSERT INTO tasks(id, project_id, number, title, description, status, priority, assignee_bot_id,
|
|
183
184
|
creator_type, creator_id, review_target, source_message_id, parent_id, parent_task_id, blocked_by, position, due_at, estimate,
|
|
184
|
-
time_budget_minutes, write_scopes, deliverables, sandbox_override, version, created_at, updated_at, completed_at, canceled_at)
|
|
185
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?)`,
|
|
185
|
+
time_budget_minutes, write_scopes, ignored_write_scopes, deliverables, sandbox_override, version, created_at, updated_at, completed_at, canceled_at)
|
|
186
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?)`,
|
|
186
187
|
taskId, project.id, number, title, text(input.description, 40_000), status, priority,
|
|
187
188
|
assigneeId, actor.type, actor.id, actor.type === 'bot' ? 'owner_bot' : 'user',
|
|
188
189
|
input.sourceMessageId ?? null, input.parentId ?? null,
|
|
@@ -190,6 +191,7 @@ export const tasksMethods = {
|
|
|
190
191
|
Number.isFinite(Number(input.position)) ? Number(input.position) : number,
|
|
191
192
|
input.dueAt ? new Date(input.dueAt).toISOString() : null,
|
|
192
193
|
clampNumber(input.estimate, 0, 1000, null), timeBudgetMinutes, JSON.stringify(writeScopes),
|
|
194
|
+
JSON.stringify(ignored),
|
|
193
195
|
JSON.stringify(deliverables),
|
|
194
196
|
sandboxOverride, createdAt, createdAt,
|
|
195
197
|
completedAt, canceledAt,
|
|
@@ -335,7 +337,7 @@ export const tasksMethods = {
|
|
|
335
337
|
task.id,
|
|
336
338
|
)
|
|
337
339
|
const project = this.store.get('SELECT key FROM projects WHERE id = ?', task.project_id)
|
|
338
|
-
const { write_scopes: rawScopes, deliverables: rawDeliverables, time_budget_minutes: rawTimeBudget, ...rest } = task
|
|
340
|
+
const { write_scopes: rawScopes, ignored_write_scopes: rawIgnoredScopes, deliverables: rawDeliverables, time_budget_minutes: rawTimeBudget, ...rest } = task
|
|
339
341
|
// 阶段按事实推导(task-stage 块):与 latestRun 同源;attention 取最近运行的待回答提问。
|
|
340
342
|
const attention = runs[0] ? parseAttention(runs[0].attention_json) : null
|
|
341
343
|
const stage = taskStage(task, runs[0] ?? null, attention)
|
|
@@ -345,6 +347,8 @@ export const tasksMethods = {
|
|
|
345
347
|
identifier: `${project?.key ?? 'T'}-${task.number}`,
|
|
346
348
|
labels,
|
|
347
349
|
writeScopes: readWriteScopes(rawScopes),
|
|
350
|
+
// 染色写范围(命中 .gitignore):进卡面展示但不参与并行锁判定。
|
|
351
|
+
ignoredWriteScopes: readWriteScopes(rawIgnoredScopes),
|
|
348
352
|
deliverables: readDeliverables(rawDeliverables),
|
|
349
353
|
// 时效要求(分钟):null=发布方未提;供 UI 展示与提示词注入共用一个口径。
|
|
350
354
|
timeBudgetMinutes: Number.isFinite(rawTimeBudget) ? rawTimeBudget : null,
|
|
@@ -441,7 +445,11 @@ export const tasksMethods = {
|
|
|
441
445
|
if (patch.dueAt !== undefined) updates.due_at = patch.dueAt ? new Date(patch.dueAt).toISOString() : null
|
|
442
446
|
if (patch.estimate !== undefined) updates.estimate = clampNumber(patch.estimate, 0, 1000, null)
|
|
443
447
|
if (patch.writeScopes !== undefined) {
|
|
444
|
-
|
|
448
|
+
// 与派单入口同口径拆分:命中 .gitignore 的条目染色进 ignored_write_scopes,
|
|
449
|
+
// 有效范围进 write_scopes 参与并行锁。
|
|
450
|
+
const { kept, removed } = filterIgnoredWriteScopes(parseWriteScopes(patch.writeScopes), this.projectWorkDir(this.projectRow(task.project_id)))
|
|
451
|
+
updates.write_scopes = JSON.stringify(kept)
|
|
452
|
+
updates.ignored_write_scopes = JSON.stringify(removed)
|
|
445
453
|
}
|
|
446
454
|
if (patch.deliverables !== undefined) {
|
|
447
455
|
updates.deliverables = JSON.stringify(parseDeliverables(patch.deliverables))
|
package/src/usage.js
CHANGED
|
@@ -108,27 +108,23 @@ function andClause(where, clause) {
|
|
|
108
108
|
return `${where ? `${where} AND` : 'WHERE'} ${clause}`
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
FROM usage_events u ${join} ${where}
|
|
129
|
-
GROUP BY u.currency, u.provider, u.model`,
|
|
130
|
-
...params,
|
|
131
|
-
)
|
|
111
|
+
// 计价状态聚合:与 AGGREGATES 分开——它只服务成本 breakdown,按 (currency, provider, model) 归集。
|
|
112
|
+
const BREAKDOWN_AGGREGATES = `
|
|
113
|
+
SUM(CASE WHEN u.total_cost IS NOT NULL THEN 1 ELSE 0 END) AS priced_calls,
|
|
114
|
+
SUM(CASE WHEN u.total_cost IS NULL THEN 1 ELSE 0 END) AS null_calls,
|
|
115
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NOT NULL THEN u.total_cost ELSE 0 END), 0) AS stored_cost,
|
|
116
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NULL THEN u.input_tokens ELSE 0 END), 0) AS null_input_tokens,
|
|
117
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NULL THEN u.cache_read_tokens ELSE 0 END), 0) AS null_cache_read_tokens,
|
|
118
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NULL THEN u.cache_write_tokens ELSE 0 END), 0) AS null_cache_write_tokens,
|
|
119
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NULL THEN u.output_tokens ELSE 0 END), 0) AS null_output_tokens,
|
|
120
|
+
COALESCE(SUM(CASE WHEN u.total_cost IS NULL THEN u.reasoning_tokens ELSE 0 END), 0) AS null_reasoning_tokens`
|
|
121
|
+
|
|
122
|
+
const EMPTY_BREAKDOWN = { cost: null, costByCurrency: {}, pricedCalls: 0, unpricedCalls: 0, unpricedTokens: 0 }
|
|
123
|
+
|
|
124
|
+
// 分组行 → breakdown:已计价明细用入库时算死的成本,未计价(total_cost IS NULL)按当前价目表
|
|
125
|
+
// 补算;能追认的计入 priced,仍无价可追认的才是真未计价。抽出来给「单次全量查询」与
|
|
126
|
+
// 「分维度预取」共用,避免同一套金额口径在两处各写一遍。
|
|
127
|
+
function mergeBreakdownRows(rows, priceMap, budgetCurrency) {
|
|
132
128
|
const costByCurrency = {}
|
|
133
129
|
let pricedCalls = 0
|
|
134
130
|
let unpricedCalls = 0
|
|
@@ -141,7 +137,6 @@ function costBreakdown(store, where, params, budgetCurrency, prices = null, join
|
|
|
141
137
|
const currency = String(row.currency ?? BUDGET_CURRENCY)
|
|
142
138
|
costByCurrency[currency] = (costByCurrency[currency] ?? 0) + Number(row.stored_cost ?? 0)
|
|
143
139
|
}
|
|
144
|
-
pricedCalls += priced
|
|
145
140
|
const price = lookupPrice(priceMap, row.provider, row.model)
|
|
146
141
|
if (!price) {
|
|
147
142
|
unpricedCalls += nullCalls
|
|
@@ -161,7 +156,7 @@ function costBreakdown(store, where, params, budgetCurrency, prices = null, join
|
|
|
161
156
|
const priceCurrency = String(price.currency ?? BUDGET_CURRENCY)
|
|
162
157
|
costByCurrency[priceCurrency] = (costByCurrency[priceCurrency] ?? 0) + totalCost
|
|
163
158
|
}
|
|
164
|
-
pricedCalls += nullCalls
|
|
159
|
+
pricedCalls += priced + nullCalls
|
|
165
160
|
}
|
|
166
161
|
return {
|
|
167
162
|
cost: costByCurrency[budgetCurrency] ?? null,
|
|
@@ -172,6 +167,18 @@ function costBreakdown(store, where, params, budgetCurrency, prices = null, join
|
|
|
172
167
|
}
|
|
173
168
|
}
|
|
174
169
|
|
|
170
|
+
// 成本聚合(含追认):整段 scope 一次查完,按 (currency, provider, model) 分组后交给
|
|
171
|
+
// mergeBreakdownRows 折算。where 形态由调用方给(分档维度的逐组条件或空)。
|
|
172
|
+
function costBreakdown(store, where, params, budgetCurrency, prices = null, join = '') {
|
|
173
|
+
const rows = store.all(
|
|
174
|
+
`SELECT u.currency AS currency, u.provider AS provider, u.model AS model, ${BREAKDOWN_AGGREGATES}
|
|
175
|
+
FROM usage_events u ${join} ${where}
|
|
176
|
+
GROUP BY u.currency, u.provider, u.model`,
|
|
177
|
+
...params,
|
|
178
|
+
)
|
|
179
|
+
return mergeBreakdownRows(rows, prices ?? currentPriceMap(store), budgetCurrency)
|
|
180
|
+
}
|
|
181
|
+
|
|
175
182
|
function mapTotals(row, breakdown = {
|
|
176
183
|
cost: null, costByCurrency: {}, pricedCalls: 0, unpricedCalls: 0, unpricedTokens: 0,
|
|
177
184
|
}) {
|
|
@@ -429,15 +436,20 @@ function zeroUsageBotRows(store, scope, budgetCurrency) {
|
|
|
429
436
|
}
|
|
430
437
|
const { filters: eventFilters, params: eventParams } = scopeFilters(scope)
|
|
431
438
|
const runWindow = runWindowFilter(scope)
|
|
439
|
+
// 用 EXISTS 逐 bot 判定,不 JOIN runs:JOIN 会按「窗口内运行数 × bot」放大行数,
|
|
440
|
+
// 每个组合再跑一次相关子查询(旧版实测 5.8s)。bots 数量小,两次索引查找即可。
|
|
432
441
|
const rows = store.all(
|
|
433
442
|
`SELECT b.id AS bot_id, b.name AS name
|
|
434
443
|
FROM bots b
|
|
435
|
-
|
|
436
|
-
|
|
444
|
+
WHERE EXISTS (
|
|
445
|
+
SELECT 1 FROM runs r
|
|
446
|
+
WHERE r.bot_id = b.id
|
|
447
|
+
${runFilters.length ? `AND ${runFilters.join(' AND ')}` : ''} AND ${runWindow.clause}
|
|
448
|
+
)
|
|
437
449
|
AND NOT EXISTS (
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
450
|
+
SELECT 1 FROM usage_events u
|
|
451
|
+
WHERE u.bot_id = b.id${eventFilters.length ? ` AND ${eventFilters.join(' AND ')}` : ''}
|
|
452
|
+
)
|
|
441
453
|
ORDER BY b.name`,
|
|
442
454
|
...runParams, ...runWindow.params, ...eventParams,
|
|
443
455
|
)
|
|
@@ -509,8 +521,9 @@ function byBotRows(store, scope, budgetCurrency, prices = null) {
|
|
|
509
521
|
ORDER BY input_tokens + output_tokens DESC`,
|
|
510
522
|
...params,
|
|
511
523
|
)
|
|
524
|
+
const breakdowns = breakdownByDimension(store, scope, 'u.bot_id', budgetCurrency, prices)
|
|
512
525
|
const used = rows.map(row => {
|
|
513
|
-
const breakdown =
|
|
526
|
+
const breakdown = breakdowns.get(String(row.bot_id)) ?? EMPTY_BREAKDOWN
|
|
514
527
|
return { botId: row.bot_id, name: row.name, ...mapTotals(row, breakdown) }
|
|
515
528
|
})
|
|
516
529
|
return [...used, ...zeroUsageBotRows(store, scope, budgetCurrency)]
|
|
@@ -526,8 +539,9 @@ function byProjectRows(store, scope, budgetCurrency, prices = null) {
|
|
|
526
539
|
ORDER BY input_tokens + output_tokens DESC`,
|
|
527
540
|
...params,
|
|
528
541
|
)
|
|
542
|
+
const breakdowns = breakdownByDimension(store, scope, 'u.project_id', budgetCurrency, prices)
|
|
529
543
|
const used = rows.map(row => {
|
|
530
|
-
const breakdown =
|
|
544
|
+
const breakdown = breakdowns.get(String(row.project_id)) ?? EMPTY_BREAKDOWN
|
|
531
545
|
return { projectId: row.project_id, name: row.name, key: row.key, ...mapTotals(row, breakdown) }
|
|
532
546
|
})
|
|
533
547
|
return [...used, ...zeroUsageProjectRows(store, scope, budgetCurrency)]
|
|
@@ -544,8 +558,9 @@ function byModelRows(store, scope, budgetCurrency, prices = null) {
|
|
|
544
558
|
ORDER BY input_tokens + output_tokens DESC`,
|
|
545
559
|
...params,
|
|
546
560
|
)
|
|
561
|
+
const breakdowns = breakdownByDimension(store, scope, "u.provider || '|' || u.model", budgetCurrency, prices)
|
|
547
562
|
return rows.map(row => {
|
|
548
|
-
const breakdown =
|
|
563
|
+
const breakdown = breakdowns.get(`${row.provider}|${row.model}`) ?? EMPTY_BREAKDOWN
|
|
549
564
|
return { provider: row.provider, model: row.model, ...mapTotals(row, breakdown) }
|
|
550
565
|
})
|
|
551
566
|
}
|
|
@@ -562,13 +577,39 @@ function byDayRows(store, scope, budgetCurrency, daySince = null, prices = null)
|
|
|
562
577
|
GROUP BY day ORDER BY day`,
|
|
563
578
|
...allParams,
|
|
564
579
|
)
|
|
580
|
+
const breakdowns = breakdownByDimension(store, scope, dayExpr, budgetCurrency, prices)
|
|
565
581
|
const used = rows.map(row => {
|
|
566
|
-
const breakdown =
|
|
582
|
+
const breakdown = breakdowns.get(String(row.day)) ?? EMPTY_BREAKDOWN
|
|
567
583
|
return { day: row.day, ...mapTotals(row, breakdown) }
|
|
568
584
|
})
|
|
569
585
|
return [...used, ...zeroUsageDayRows(store, scope, budgetCurrency, daySince)]
|
|
570
586
|
}
|
|
571
587
|
|
|
588
|
+
// 分维度 breakdown 预取:旧口径在每个分组内各调一次 costBreakdown,每次都要扫一遍窗口明细
|
|
589
|
+
// (30 天窗口 × global/project 两套分档 = 上百次全表扫描,实测约 6.5s)。这里按
|
|
590
|
+
// 「维度值 + currency + provider + model」一次聚合,再在内存里归并出各维度值的同一份 breakdown。
|
|
591
|
+
function breakdownByDimension(store, scope, dimensionExpr, budgetCurrency, prices = null) {
|
|
592
|
+
const { filters, params } = scopeFilters(scope)
|
|
593
|
+
const rows = store.all(
|
|
594
|
+
`SELECT ${dimensionExpr} AS dim, u.currency AS currency, u.provider AS provider, u.model AS model,
|
|
595
|
+
${BREAKDOWN_AGGREGATES}
|
|
596
|
+
FROM usage_events u ${filterClause(filters)}
|
|
597
|
+
GROUP BY ${dimensionExpr}, u.currency, u.provider, u.model`,
|
|
598
|
+
...params,
|
|
599
|
+
)
|
|
600
|
+
const priceMap = prices ?? currentPriceMap(store)
|
|
601
|
+
const grouped = new Map()
|
|
602
|
+
for (const row of rows) {
|
|
603
|
+
const key = String(row.dim)
|
|
604
|
+
const bucket = grouped.get(key)
|
|
605
|
+
if (bucket) bucket.push(row)
|
|
606
|
+
else grouped.set(key, [row])
|
|
607
|
+
}
|
|
608
|
+
const out = new Map()
|
|
609
|
+
for (const [key, bucket] of grouped) out.set(key, mergeBreakdownRows(bucket, priceMap, budgetCurrency))
|
|
610
|
+
return out
|
|
611
|
+
}
|
|
612
|
+
|
|
572
613
|
function tierSet(store, scope, budgetCurrency, daySince = null, prices = null) {
|
|
573
614
|
return {
|
|
574
615
|
byBot: byBotRows(store, scope, budgetCurrency, prices),
|
package/ui/i18n/en/settings.js
CHANGED
|
@@ -361,6 +361,7 @@ export default {
|
|
|
361
361
|
"月度预算": "Monthly budget",
|
|
362
362
|
"未启用": "Not enabled",
|
|
363
363
|
"未声明(保守串行)": "Not declared (conservative serial)",
|
|
364
|
+
"命中 .gitignore,不参与并行锁": "Matched by .gitignore, excluded from the parallel lock",
|
|
364
365
|
"未指派": "Unassigned",
|
|
365
366
|
"未绑定": "Not bound",
|
|
366
367
|
"未设置": "Not set",
|
package/ui/i18n/zh/settings.js
CHANGED
package/ui/modules/cards.js
CHANGED
|
@@ -4,7 +4,7 @@ import { icon } from './icons.js'
|
|
|
4
4
|
import { mdChatScope, mdPlainSummary, richText } from './markdown.js'
|
|
5
5
|
import { t } from './i18n.js'
|
|
6
6
|
import { renderMessageImages } from './composer.js'
|
|
7
|
-
import { refresh, panelAttrs, render } from '../app.js'
|
|
7
|
+
import { refresh, panelAttrs, render, beginChatPending, endChatPending, chatContextPending } from '../app.js'
|
|
8
8
|
|
|
9
9
|
// ===== approval-card:start 审批卡片(DSHBOTS-32 UI)=====
|
|
10
10
|
// ===== approval-ux:start 审批交互(DSHBOTS-102)=====
|
|
@@ -341,6 +341,8 @@ function cardScopeLabel(item) {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
// 点通知:聚焦窗口,跳到对应会话(项目群聊或单聊,DSHBOTS-218)并把提问卡滚动到可视区。
|
|
344
|
+
// 乐观切换(与侧栏 select-project 同构,DSHBOTS-167):目标视图的 state 组装在大库上要数秒,
|
|
345
|
+
// 没有骨架时点击像死点(用户报「点了跳不过去」)——先收面板出骨架,数据到位再落卡片并滚动。
|
|
344
346
|
function focusQuestionCard(question) {
|
|
345
347
|
if (!question) return
|
|
346
348
|
if (question.project_id) {
|
|
@@ -353,12 +355,26 @@ function focusQuestionCard(question) {
|
|
|
353
355
|
state.chatMode = 'solo'
|
|
354
356
|
}
|
|
355
357
|
state.view = 'chat'
|
|
358
|
+
state.replyTo = null // 跨上下文跳转,引用条不能带到新会话(与 select-project 同口径)
|
|
359
|
+
const pendingSeq = beginChatPending({ projectId: state.projectId, chatMode: state.chatMode, soloBotId: state.chatMode === 'solo' ? state.soloBotId : null })
|
|
360
|
+
render()
|
|
356
361
|
refresh()
|
|
357
362
|
.then(() => {
|
|
363
|
+
const stuckOnSkeleton = chatContextPending()
|
|
364
|
+
endChatPending(pendingSeq)
|
|
365
|
+
if (stuckOnSkeleton) render()
|
|
358
366
|
const card = document.querySelector(`.question-card[data-question-id="${question.id}"]`)
|
|
359
|
-
card
|
|
367
|
+
if (card) {
|
|
368
|
+
// 定位到卡片即离开底部视角:关掉贴底滚动,防 render 尾帧把卡片再滚出视野。
|
|
369
|
+
state.chatAtBottom = false
|
|
370
|
+
card.scrollIntoView({ block: 'center' })
|
|
371
|
+
}
|
|
372
|
+
})
|
|
373
|
+
.catch(() => {
|
|
374
|
+
// 取数失败也要清骨架并落回可交互视图,否则骨架常驻(与 select-project 的 finally 同口径)。
|
|
375
|
+
endChatPending(pendingSeq)
|
|
376
|
+
render()
|
|
360
377
|
})
|
|
361
|
-
.catch(() => {})
|
|
362
378
|
}
|
|
363
379
|
|
|
364
380
|
// 跨项目待审入口(DSHBOTS-102):工作台顶部一条窄条,只计 pending,99+ 封顶。
|
|
@@ -452,6 +468,7 @@ function approvalNotifyBody(approval) {
|
|
|
452
468
|
}
|
|
453
469
|
|
|
454
470
|
// 点通知:聚焦窗口,跳到对应会话(项目群聊或单聊,DSHBOTS-218)并把审批卡滚动到可视区。
|
|
471
|
+
// 乐观切换与 focusQuestionCard 同构:先出骨架给点击即时反馈,数据到位再滚动定位。
|
|
455
472
|
function focusApprovalCard(approval) {
|
|
456
473
|
if (!approval) return
|
|
457
474
|
if (approval.project_id) {
|
|
@@ -464,12 +481,26 @@ function focusApprovalCard(approval) {
|
|
|
464
481
|
state.chatMode = 'solo'
|
|
465
482
|
}
|
|
466
483
|
state.view = 'chat'
|
|
484
|
+
state.replyTo = null // 跨上下文跳转,引用条不能带到新会话(与 select-project 同口径)
|
|
485
|
+
const pendingSeq = beginChatPending({ projectId: state.projectId, chatMode: state.chatMode, soloBotId: state.chatMode === 'solo' ? state.soloBotId : null })
|
|
486
|
+
render()
|
|
467
487
|
refresh()
|
|
468
488
|
.then(() => {
|
|
489
|
+
const stuckOnSkeleton = chatContextPending()
|
|
490
|
+
endChatPending(pendingSeq)
|
|
491
|
+
if (stuckOnSkeleton) render()
|
|
469
492
|
const card = document.querySelector(`.approval-card[data-approval-id="${approval.id}"]`)
|
|
470
|
-
card
|
|
493
|
+
if (card) {
|
|
494
|
+
// 定位到卡片即离开底部视角:关掉贴底滚动,防 render 尾帧把卡片再滚出视野。
|
|
495
|
+
state.chatAtBottom = false
|
|
496
|
+
card.scrollIntoView({ block: 'center' })
|
|
497
|
+
}
|
|
498
|
+
})
|
|
499
|
+
.catch(() => {
|
|
500
|
+
// 取数失败也要清骨架并落回可交互视图,否则骨架常驻(与 select-project 的 finally 同口径)。
|
|
501
|
+
endChatPending(pendingSeq)
|
|
502
|
+
render()
|
|
471
503
|
})
|
|
472
|
-
.catch(() => {})
|
|
473
504
|
}
|
|
474
505
|
|
|
475
506
|
// 轮询后比较 pending 增量:通知开启且页面不可见或失焦时,对新增 pending 审批各弹一次
|