dsh-team-bots 0.3.79 → 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/package.json +1 -1
- package/src/db-migrations.js +3 -0
- package/src/db.js +1 -0
- 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/ui/i18n/en/settings.js +1 -0
- package/ui/i18n/zh/settings.js +1 -0
- package/ui/modules/modal-forms.js +8 -8
- package/ui/styles/modal.css +2 -0
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,
|
|
@@ -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/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
|
@@ -419,20 +419,20 @@ function modalTask(task) {
|
|
|
419
419
|
// 任务关系(DSHBOTS-58):父任务取本项目任务表里的那条,依赖只列未满足项(blockedByNames)。
|
|
420
420
|
const parentTask = (state.data?.tasks ?? []).find(item => item.id === (task.parent_task_id ?? task.parentTaskId ?? null)) ?? null
|
|
421
421
|
const blockedNames = Array.isArray(task.blockedByNames) ? task.blockedByNames : []
|
|
422
|
-
// 写范围(DSHBOTS-124
|
|
423
|
-
//
|
|
422
|
+
// 写范围(DSHBOTS-124)+染色条目(命中 .gitignore):前者是并行调度依据(互不重叠才并行),
|
|
423
|
+
// 后者进卡展示但不参与并行锁(同文件也并行);未声明(两者皆空)保守串行。
|
|
424
424
|
const writeScopes = Array.isArray(task.writeScopes) ? task.writeScopes.filter(item => typeof item === 'string' && item) : []
|
|
425
|
-
|
|
426
|
-
//
|
|
425
|
+
const ignoredScopes = Array.isArray(task.ignoredWriteScopes) ? task.ignoredWriteScopes.filter(item => typeof item === 'string' && item) : []
|
|
426
|
+
// 编辑态(DSHBOTS-155)只读/编辑两态切换;终态卡不进编辑态(与 taskUpdateScopes 终态拒改同口径)。
|
|
427
427
|
const editingScopes = state.modal?.type === 'task' && state.modal?.detail?.id === task.id && state.modal.editingScopes === true
|
|
428
|
-
// 终态卡不进编辑态——与后端 taskUpdateScopes 的终态拒改(任务已结束)同口径。
|
|
429
428
|
const scopesEditable = !['done', 'canceled'].includes(task.status)
|
|
430
|
-
const
|
|
431
|
-
|
|
429
|
+
const chip = (scope , ignored ) => `<span class="approval-chip mono${ignored ? ' scope-chip-ignored' : ''}" title="${attr(ignored ? `${t("命中 .gitignore,不参与并行锁")}: ${scope}` : scope)}">${esc(scope)}</span>`
|
|
430
|
+
const scopesView = (writeScopes.length || ignoredScopes.length)
|
|
431
|
+
? `<div class="scope-chips">${writeScopes.map(s => chip(s, false)).join('')}${ignoredScopes.map(s => chip(s, true)).join('')}</div>`
|
|
432
432
|
: `<div class="scope-empty">${t("未声明(保守串行)")}</div>`
|
|
433
433
|
const scopesEdit = `<div class="field">
|
|
434
434
|
<label id="task-write-scopes-label" for="task-write-scopes">${t("写范围路径")}</label>
|
|
435
|
-
<input class="input mono" style="width:100%" id="task-write-scopes" placeholder="${t("逗号或空格分隔路径")}" value="${attr(writeScopes.join(', '))}">
|
|
435
|
+
<input class="input mono" style="width:100%" id="task-write-scopes" placeholder="${t("逗号或空格分隔路径")}" value="${attr([...writeScopes, ...ignoredScopes].join(', '))}">
|
|
436
436
|
<div class="btn-row" style="margin-top:7px"><button class="btn small primary" type="button" data-action="update-scopes" data-task-id="${attr(task.id)}">${icon('check')}${t("保存")}</button><button class="btn small" type="button" data-action="cancel-scopes-edit">${t("取消")}</button></div>
|
|
437
437
|
<div class="hint" style="margin-top:6px">${t("保存后立即生效于排队中的运行;运行中的运行不受影响")}</div>
|
|
438
438
|
</div>`
|
package/ui/styles/modal.css
CHANGED
|
@@ -143,6 +143,8 @@ body:has(#modal-root .modal-backdrop) #app *::after {
|
|
|
143
143
|
/* 写范围(DSHBOTS-124):路径 chip 行(沿用审批卡片的等宽小字 chip)+ 未声明兜底灰字 */
|
|
144
144
|
.scope-block { margin-top: 12px; }
|
|
145
145
|
.scope-chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
146
|
+
/* 染色写范围(命中 .gitignore):进卡展示但不参与并行锁,虚线边框 + 淡墨色与生效条目区分 */
|
|
147
|
+
.scope-chip-ignored { border-style: dashed; color: var(--ink-3); opacity: .85; }
|
|
146
148
|
.scope-empty { color: var(--ink-3); font-size: var(--fs-small); }
|
|
147
149
|
.config-card {
|
|
148
150
|
padding: 20px 22px;
|