dsh-team-bots 0.2.465 → 0.3.12
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/NOTICE +6 -0
- package/README.md +7 -1
- package/docs/README.zh.md +7 -1
- package/package.json +1 -1
- package/src/api.js +6 -1
- package/src/config.js +13 -6
- package/src/db.js +9 -0
- package/src/services/bot-quota.js +54 -0
- package/src/services/bots.js +8 -0
- package/src/services/chat.js +54 -5
- package/src/services/memory.js +91 -20
- package/src/services/model-fallback.js +55 -15
- package/src/services/projects.js +1 -1
- package/src/services/run-finish.js +33 -11
- package/src/services/runs.js +15 -7
- package/src/services/runtime/prompt.js +31 -6
- package/src/services/scheduler.js +6 -5
- package/src/services/task-dispatch.js +24 -0
- package/src/services/task-notify.js +18 -0
- package/src/services/task-review.js +47 -3
- package/src/services/task-runs.js +31 -3
- package/src/services/tasks.js +86 -1
- package/src/tools.js +20 -14
- package/ui/i18n/en/settings.js +1 -0
- package/ui/i18n/zh/settings.js +1 -0
- package/ui/modules/modal-forms.js +3 -3
- package/ui/modules/settings.js +5 -5
- package/ui/modules/tasks.js +2 -2
package/src/services/tasks.js
CHANGED
|
@@ -238,6 +238,91 @@ export const tasksMethods = {
|
|
|
238
238
|
id('tevt'), taskId, type, actor.type, actor.id, JSON.stringify(data), nowIso(),
|
|
239
239
|
)
|
|
240
240
|
},
|
|
241
|
+
// 统一状态迁移落点(吸收 dsh-agent-team「账本为权威、投影可重放」理念):所有直接改
|
|
242
|
+
// tasks.status 的路径都经此走——同一事务内 UPDATE + 权威 'status' 事件(from/to),
|
|
243
|
+
// 事件流因此能完整重放任务状态机(见 taskProjectionDrift)。守卫防终态覆盖/非法源态;
|
|
244
|
+
// 返回是否实际迁移(未命中守卫为 no-op,调用方保持原语义)。
|
|
245
|
+
setTaskStatus(taskId, to, actor, guard = {}) {
|
|
246
|
+
const task = this.taskRow(taskId)
|
|
247
|
+
if (task.status === to) return false
|
|
248
|
+
const guardSql = guard.ifIs
|
|
249
|
+
? 'status = ?'
|
|
250
|
+
: `status NOT IN (${(guard.notIn ?? ['done', 'canceled']).map(() => '?').join(',')})`
|
|
251
|
+
const guardParams = guard.ifIs ? [guard.ifIs] : (guard.notIn ?? ['done', 'canceled'])
|
|
252
|
+
let applied = false
|
|
253
|
+
this.store.transaction(() => {
|
|
254
|
+
const result = this.store.run(
|
|
255
|
+
`UPDATE tasks SET status = ?, version = version + 1, updated_at = ? WHERE id = ? AND ${guardSql}`,
|
|
256
|
+
to, nowIso(), taskId, ...guardParams,
|
|
257
|
+
)
|
|
258
|
+
applied = Number(result?.changes ?? 0) > 0
|
|
259
|
+
if (applied) this.addTaskEvent(taskId, 'status', actor, { field: 'status', from: task.status, to })
|
|
260
|
+
})
|
|
261
|
+
return applied
|
|
262
|
+
},
|
|
263
|
+
// 投影漂移巡检:按权威事件流(created 初始态 + 'status' 事件序列)重放每个任务的状态,
|
|
264
|
+
// 与 tasks 表对照。漂移即投影与账本脱节(崩溃半事务/手工改库),报告不修复。
|
|
265
|
+
taskProjectionDrift() {
|
|
266
|
+
const drifted = []
|
|
267
|
+
for (const task of this.store.all('SELECT id, number, project_id, status FROM tasks')) {
|
|
268
|
+
const events = this.store.all(
|
|
269
|
+
`SELECT type, data_json FROM task_events WHERE task_id = ?
|
|
270
|
+
AND (type = 'created' OR (type = 'status' AND json_extract(data_json, '$.field') = 'status'))
|
|
271
|
+
ORDER BY created_at, rowid`,
|
|
272
|
+
task.id,
|
|
273
|
+
)
|
|
274
|
+
if (!events.length) continue
|
|
275
|
+
let replayed = null
|
|
276
|
+
for (const event of events) {
|
|
277
|
+
const data = JSON.parse(event.data_json ?? '{}')
|
|
278
|
+
if (event.type === 'created') replayed = data.status ?? 'backlog'
|
|
279
|
+
else if (data.to) replayed = data.to
|
|
280
|
+
}
|
|
281
|
+
if (replayed !== null && replayed !== task.status) {
|
|
282
|
+
const project = this.store.get('SELECT key FROM projects WHERE id = ?', task.project_id)
|
|
283
|
+
drifted.push({ taskId: task.id, identifier: `${project?.key ?? 'T'}-${task.number}`, recorded: task.status, replayed })
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return drifted
|
|
287
|
+
},
|
|
288
|
+
// 变更栅栏的事实面(吸收 dsh-agent-team mutation-fence 理念):版本冲突的拒绝不只说
|
|
289
|
+
// 「请刷新」,还附最近变更事实,让写者就地重新裁决,不必整卡重读。事件与 version
|
|
290
|
+
// 增量非一一对应(交付是一事件一增量,updateTask 是一增量多事件),故按时间取最近
|
|
291
|
+
// N 条而非按版本切割。
|
|
292
|
+
taskChangesSince(taskId, limit = 5) {
|
|
293
|
+
const rows = this.store.all(
|
|
294
|
+
'SELECT type, actor_type, actor_id, data_json, created_at FROM task_events WHERE task_id = ? ORDER BY created_at DESC, rowid DESC LIMIT ?',
|
|
295
|
+
taskId, limit,
|
|
296
|
+
)
|
|
297
|
+
return rows.reverse().map(row => {
|
|
298
|
+
let data = {}
|
|
299
|
+
try { data = JSON.parse(row.data_json ?? '{}') } catch { /* 旧格式事件按原始类型渲染 */ }
|
|
300
|
+
const who = row.actor_type === 'bot'
|
|
301
|
+
? (this.store.get('SELECT name FROM bots WHERE id = ?', row.actor_id)?.name ?? row.actor_id)
|
|
302
|
+
: row.actor_type
|
|
303
|
+
if (data.field !== undefined) {
|
|
304
|
+
return `${who} 改 ${data.field}:${JSON.stringify(data.from ?? null)}→${JSON.stringify(data.to ?? null)}`
|
|
305
|
+
}
|
|
306
|
+
if (row.type === 'assigned') {
|
|
307
|
+
const name = this.store.get('SELECT name FROM bots WHERE id = ?', data.botId)?.name ?? data.botId
|
|
308
|
+
return `${who} 派单给 ${name ?? '?'}`
|
|
309
|
+
}
|
|
310
|
+
if (row.type === 'run_succeeded') return `${who} 交付(${data.identifier ?? row.task_id ?? ''})`
|
|
311
|
+
if (row.type === 'created') return `${who} 建卡`
|
|
312
|
+
return `${who} ${row.type}`
|
|
313
|
+
})
|
|
314
|
+
},
|
|
315
|
+
// 版本冲突拒绝(原因 + 错过的事实 + 正确下一步):updateTask 的 CAS 与
|
|
316
|
+
// team_assign_task 改卡的 expected_version 共用同一文案面。
|
|
317
|
+
staleTaskConflict(task, seenVersion) {
|
|
318
|
+
const project = this.store.get('SELECT key FROM projects WHERE id = ?', task.project_id)
|
|
319
|
+
const changes = this.taskChangesSince(task.id)
|
|
320
|
+
return conflict(
|
|
321
|
+
`任务 ${project?.key ?? 'T'}-${task.number} 已被更新(你基于 version ${Number(seenVersion)},当前 version ${task.version})。`
|
|
322
|
+
+ `自那之后的最近变更:${changes.join(';') || '(无事件记录,以卡面为准'})。`
|
|
323
|
+
+ '可基于以上事实重新裁决后带 expected_version 重试,或先 team_recall 刷新卡面再改。',
|
|
324
|
+
)
|
|
325
|
+
},
|
|
241
326
|
taskView(task) {
|
|
242
327
|
// attention_json 列由 attention 域自管迁移(db.js 不加行),读视图前懒迁移一次。
|
|
243
328
|
// parent_task_id/blocked_by 同款:task-relations 域自管迁移 + 依赖派生字段。
|
|
@@ -320,7 +405,7 @@ export const tasksMethods = {
|
|
|
320
405
|
async updateTask(taskId, patch, actor = this.actor(), options = {} ) {
|
|
321
406
|
const task = this.taskRow(taskId)
|
|
322
407
|
if (patch.version !== undefined && Number(patch.version) !== Number(task.version)) {
|
|
323
|
-
throw
|
|
408
|
+
throw this.staleTaskConflict(task, patch.version)
|
|
324
409
|
}
|
|
325
410
|
const updates = {}
|
|
326
411
|
if (patch.title !== undefined) {
|
package/src/tools.js
CHANGED
|
@@ -35,8 +35,9 @@ export const SUBAGENT_GENERATION_TOOLS = [
|
|
|
35
35
|
// team_block_task(DSHBOTS-232)与派单/验收同款总监专属:强制受阻停运行是不可逆控制面操作。
|
|
36
36
|
// team_list_bots / team_add_member / team_create_bot(DSHBOTS-229)是团队编制入口:
|
|
37
37
|
// 池查询含未入群 bot,加人与建 bot 会改动项目成员或全局 bot 档案。
|
|
38
|
-
// team_memory_list / team_memory_write / team_memory_cleanup(DSHBOTS-239
|
|
39
|
-
//
|
|
38
|
+
// team_memory_list / team_memory_write / team_memory_cleanup(DSHBOTS-239)是记忆管理面:
|
|
39
|
+
// bot 域记忆由 Bot 自己管理(成员触顶后的合法自救通道),项目/团队域归项目总监,
|
|
40
|
+
// 总监可经 bot 点名代管任意 Bot——权限判定在服务层 resolveMemoryScopeFor。
|
|
40
41
|
export const DIRECTOR_ONLY_TOOLS = [
|
|
41
42
|
'team_assign_task',
|
|
42
43
|
'team_review_task',
|
|
@@ -44,9 +45,6 @@ export const DIRECTOR_ONLY_TOOLS = [
|
|
|
44
45
|
'team_list_bots',
|
|
45
46
|
'team_add_member',
|
|
46
47
|
'team_create_bot',
|
|
47
|
-
'team_memory_list',
|
|
48
|
-
'team_memory_write',
|
|
49
|
-
'team_memory_cleanup',
|
|
50
48
|
'team_release_bot_quota',
|
|
51
49
|
]
|
|
52
50
|
|
|
@@ -59,14 +57,18 @@ export function subagentCapabilityEnabledFor(bot, config) {
|
|
|
59
57
|
// 子代理生成工具由 preset 全局注册,成员 bot 默认可见,无需额外放行。
|
|
60
58
|
// DSHBOTS-247:调用点形状不一——session.ts 的结转/复用路径传 resolveAgent 的
|
|
61
59
|
// `{ agent }` 包装,新建会话路径传裸 agent。这里归一为句柄后取 restrict,两种形状都生效;
|
|
62
|
-
//
|
|
60
|
+
// 旧实现只认包装形状时,裸形状会静默跳过(策略从未生效)。
|
|
61
|
+
// DSHBOTS-359:restrict 必须以方法调用发出——宿主 ToolsService.restrict 首行读 this.ctx,
|
|
62
|
+
// 摘下函数裸调用会让 this===undefined,抛 "reading 'ctx'" 被吞成 warn,策略自 DSHBOTS-238
|
|
63
|
+
// 起从未真正生效(成员 bot 一直可见总监专权工具)。
|
|
63
64
|
export function applyBotToolPolicy(resolved, { isOwner, logger } ) {
|
|
64
65
|
if (isOwner) return
|
|
65
66
|
const handle = resolved?.agent ?? resolved
|
|
66
|
-
const
|
|
67
|
-
if (typeof restrict !== 'function') return
|
|
67
|
+
const tools = handle?.ctx?.tools
|
|
68
|
+
if (typeof tools?.restrict !== 'function') return
|
|
68
69
|
try {
|
|
69
|
-
|
|
70
|
+
// 方法调用保留接收者(this === tools),与宿主 dsh-subagent 的 childCtx.tools.restrict 同形。
|
|
71
|
+
tools.restrict({ deny: [...DIRECTOR_ONLY_TOOLS] })
|
|
70
72
|
} catch (error ) {
|
|
71
73
|
// 工具层兜底失败不阻断会话:服务层 ownerContextFor 仍是权威闸门。
|
|
72
74
|
logger?.warn?.(`dsh-team: 应用成员 bot 工具策略失败:${error?.message ?? error}`)
|
|
@@ -86,12 +88,13 @@ export function installTeamTools(ctx, service) {
|
|
|
86
88
|
title: { type: 'string', description: 'Short actionable task title (new tasks; on re-dispatch it amends the card)' },
|
|
87
89
|
description: { type: 'string', description: 'Self-contained instructions, constraints and acceptance criteria (new tasks; on re-dispatch it amends the card and the assignee is notified to correct course). Name the expected deliverable file paths inside the write scopes, and never instruct the bot to paste file contents into its delivery report — the report references paths, reviewers read the files' },
|
|
88
90
|
priority: { type: 'string', enum: ['urgent', 'high', 'medium', 'low', 'none'], description: 'Task priority (new tasks and card amendment on re-dispatch)' },
|
|
89
|
-
write_scopes: { type: 'array', items: { type: 'string' }, description: 'Workspace-relative paths this task will modify (new tasks only); the scheduler runs tasks with disjoint scopes in parallel. Omit to parse a `写范围:`/`write_scopes:` line from the description instead' },
|
|
91
|
+
write_scopes: { type: 'array', items: { type: 'string' }, description: 'Workspace-relative paths this task will modify (new tasks only); the scheduler runs tasks with disjoint scopes in parallel. Keep it small: a task declaring more than maxWriteScopesPerTask (default 8) paths is rejected — split into subtask cards with parent_task_id and disjoint scopes instead. Omit to parse a `写范围:`/`write_scopes:` line from the description instead' },
|
|
90
92
|
deliverables: { type: 'array', items: { type: 'string' }, description: 'Expected deliverable file paths, workspace-relative and inside the write scopes (new tasks; on re-dispatch it amends the card). The assignee references these paths in its delivery report instead of pasting file contents; reviewers read the files at these paths' },
|
|
91
93
|
force_duplicate: { type: 'boolean', description: 'Escape hatch (new tasks only): skip the same-write-scope duplicate check when an unfinished task in this project already declares identical write scopes. Use only when a second task on the same paths is intentional; every use is audited as dispatch_force_duplicate' },
|
|
92
|
-
time_budget_minutes: { type: 'integer', description: 'Required delivery time limit in minutes (new tasks only, 1-10080): injected into the task prompt, and the run is aborted when the budget expires. The effective timeout is the smaller of this budget and the global run timeout. Omit to take the priority-tier budget (urgent/high
|
|
94
|
+
time_budget_minutes: { type: 'integer', description: 'Required delivery time limit in minutes (new tasks only, 1-10080): injected into the task prompt, and the run is aborted when the budget expires. The effective timeout is the smaller of this budget and the global run timeout. Omit to take the priority-tier budget (urgent/high 90, medium 60, low/none 30 minutes); non-dispatch task creation falls back to env DSH_TEAM_TASK_TIME_BUDGET_MINUTES > stall-watchdog minutes > 40 minutes' },
|
|
93
95
|
parent_task_id: { type: 'string', description: 'Nest the new task as a subtask under this main task id (new tasks only): pass it when the main item cannot be finished in this run or a new closing condition emerged, so follow-up work lands as a product-grade card instead of a verbal note; also pass it to split a large task into parallel subtask cards for speed (independent parts, disjoint write_scopes, so the cards run concurrently). Must reference an existing task in the same project; self-reference is rejected. The backend validates' },
|
|
94
96
|
task: { type: 'string', description: 'Existing task to re-dispatch, as KEY-N (for example DEMO-3). Omit to create a new task' },
|
|
97
|
+
expected_version: { type: 'integer', description: 'Mutation fence (re-dispatch/amend only): the task card version you last saw (the `version` field of any card view). When the card has changed since (delivery, status transition, another edit), the write is refused and the refusal lists the most recent changes so you can re-decide in place; retry with the new expected_version, or omit to keep last-write-wins behavior' },
|
|
95
98
|
sandbox: { type: 'string', enum: ['inherit', 'workspace-write', 'read-only'], default: 'inherit', description: 'Sandbox tier for this task\'s runs (new tasks and re-dispatch); default inherit = follow the assignee bot\'s configured file policy, so a development task is never tightened to read-only unless the card says so. inherit also clears any stored override on re-dispatch. workspace-write/read-only must not be wider than that configuration (tighten-only; every run of the task starts under the effective tier, recorded as a sandbox_mode run event). Use read-only to run a development task in review mode' },
|
|
96
99
|
},
|
|
97
100
|
required: ['assignee'],
|
|
@@ -266,11 +269,12 @@ export function installTeamTools(ctx, service) {
|
|
|
266
269
|
|
|
267
270
|
ctx.tools.register({
|
|
268
271
|
name: 'team_memory_list',
|
|
269
|
-
description: 'List existing long-term memories in one scope (bot / project / team) for hygiene inspection: entries with short id, topic, updated time and a content preview, optionally filtered by topic substring.
|
|
272
|
+
description: 'List existing long-term memories in one scope (bot / project / team) for hygiene inspection: entries with short id, topic, updated time and a content preview, optionally filtered by topic substring. Every bot manages its own bot scope; project and team scopes are director-only.',
|
|
270
273
|
parameters: {
|
|
271
274
|
type: 'object',
|
|
272
275
|
properties: {
|
|
273
276
|
scope: { type: 'string', enum: ['bot', 'project', 'team'], description: 'Which memory scope to enumerate: bot = your own memories, project = this project, team = whole team. Default project' },
|
|
277
|
+
bot: { type: 'string', description: 'With scope=bot, target that bot (exact bot name or id) instead of yourself — use it to inspect a member bot\'s memories when its scope hits the cap' },
|
|
274
278
|
topic: { type: 'string', description: 'Optional substring filter on the topic label' },
|
|
275
279
|
limit: { type: 'integer', description: 'Max entries to return (1-200, default 50)' },
|
|
276
280
|
},
|
|
@@ -289,11 +293,12 @@ export function installTeamTools(ctx, service) {
|
|
|
289
293
|
|
|
290
294
|
ctx.tools.register({
|
|
291
295
|
name: 'team_memory_write',
|
|
292
|
-
description: 'Write a durable memory with same-name overwrite: an active memory with the same scope+topic is updated in place (revision bumps, event trail kept) instead of appending a duplicate entry; otherwise a new memory is created. Use it to refresh a wording to the latest final state instead of piling up near-duplicates. Scope rules: bot = your own, project = this project, team = whole team. Never store secrets or credentials.
|
|
296
|
+
description: 'Write a durable memory with same-name overwrite: an active memory with the same scope+topic is updated in place (revision bumps, event trail kept) instead of appending a duplicate entry; otherwise a new memory is created. Use it to refresh a wording to the latest final state instead of piling up near-duplicates. Scope rules: bot = your own (every bot), project = this project (director), team = whole team (director). Never store secrets or credentials.',
|
|
293
297
|
parameters: {
|
|
294
298
|
type: 'object',
|
|
295
299
|
properties: {
|
|
296
300
|
scope: { type: 'string', enum: ['bot', 'project', 'team'], description: 'bot: only you remember it; project: every project bot can use it; team: shared by the whole team (owner bots only)' },
|
|
301
|
+
bot: { type: 'string', description: 'With scope=bot, write into that bot\'s memories (exact bot name or id) instead of your own — use it for same-name-overwrite dedupe in a member bot\'s scope' },
|
|
297
302
|
topic: { type: 'string', description: 'Short topic label; same topic in the same scope is overwritten in place' },
|
|
298
303
|
content: { type: 'string', description: 'The durable memory, with enough context to be useful later' },
|
|
299
304
|
},
|
|
@@ -310,11 +315,12 @@ export function installTeamTools(ctx, service) {
|
|
|
310
315
|
|
|
311
316
|
ctx.tools.register({
|
|
312
317
|
name: 'team_memory_cleanup',
|
|
313
|
-
description: 'Batch-deprecate stale memories in one scope: matched entries are archived (terminal — excluded from recall), each keeps its memory_events trail, and the batch is audited as memory.cleanup with the cleaned entries listed. Criteria (at least one required): `task` archives a closed card\'s process records (its 任务 KEY-N / KEY-N 交付记录 topics; the task must already be done or canceled); `topics` archives the explicitly listed topics — use it for older wordings that conflict with a newer final decision; `before` archives every active entry whose updated_at is strictly older than the given ISO timestamp — the one-shot bulk criterion for legacy backlog convergence. `before` combines with `topics`/`task` as an AND filter. Do not archive entries recording the user\'s explicit decisions.
|
|
318
|
+
description: 'Batch-deprecate stale memories in one scope: matched entries are archived (terminal — excluded from recall), each keeps its memory_events trail, and the batch is audited as memory.cleanup with the cleaned entries listed. Criteria (at least one required): `task` archives a closed card\'s process records (its 任务 KEY-N / KEY-N 交付记录 topics; the task must already be done or canceled); `topics` archives the explicitly listed topics — use it for older wordings that conflict with a newer final decision; `before` archives every active entry whose updated_at is strictly older than the given ISO timestamp — the one-shot bulk criterion for legacy backlog convergence. `before` combines with `topics`/`task` as an AND filter. Do not archive entries recording the user\'s explicit decisions. Every bot manages its own bot scope; project and team scopes are director-only.',
|
|
314
319
|
parameters: {
|
|
315
320
|
type: 'object',
|
|
316
321
|
properties: {
|
|
317
322
|
scope: { type: 'string', enum: ['bot', 'project', 'team'], description: 'Which memory scope to clean: bot = your own, project = this project, team = whole team' },
|
|
323
|
+
bot: { type: 'string', description: 'With scope=bot, clean that bot\'s memories (exact bot name or id) instead of your own — the sanctioned path when a member bot\'s scope hits the cap and it cannot clean itself' },
|
|
318
324
|
topics: { type: 'array', items: { type: 'string' }, description: 'Exact topic labels to archive in this scope' },
|
|
319
325
|
task: { type: 'string', description: 'Closed card (KEY-N) whose process-record memories should be archived; rejected unless the task is done or canceled' },
|
|
320
326
|
before: { type: 'string', description: 'ISO timestamp cutoff (e.g. 2026-01-01T00:00:00.000Z): archive every active entry in this scope with updated_at strictly before it. Required when neither topics nor task is given; combining with topics/task intersects the criteria' },
|
package/ui/i18n/en/settings.js
CHANGED
|
@@ -177,6 +177,7 @@ export default {
|
|
|
177
177
|
"停止运行": "Stop run",
|
|
178
178
|
"先新建一个 Bot,再回来邀请它加入。": "Create a Bot first, then come back to invite it.",
|
|
179
179
|
"全员响应": "Everyone responds",
|
|
180
|
+
"仅被点名": "Mentioned only",
|
|
180
181
|
"全文": "Full text",
|
|
181
182
|
"全部保留": "All kept",
|
|
182
183
|
"共享技能": "Shared skills",
|
package/ui/i18n/zh/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { state, STATUS, STATUS_ORDER, PRIORITY, BOT_STATUS, SKILL_STATUS, RUN_STATUS, CREATOR_TYPE, EFFORT, COLORS, COLOR_NAMES, stageLabelText } from './state.js'
|
|
2
2
|
import { icon } from './icons.js'
|
|
3
|
-
import { activeBots, activeProject, attr, avatar, botById, duration, esc, filePolicyOptions, formatCost, formatNumber, formatTime, inSoloContext, pageProject, runDot, sandboxPill, timeAgo, toast } from './util.js'
|
|
3
|
+
import { activeBots, activeProject, attr, avatar, botById, duration, esc, filePolicyOptions, formatCost, formatNumber, formatTime, inSoloContext, pageProject, runDot, sandboxPill, timeAgo, tildePath, toast } from './util.js'
|
|
4
4
|
import { api } from './api.js'
|
|
5
5
|
import { mdChatScope, richText } from './markdown.js'
|
|
6
6
|
import { t, tMaybe } from './i18n.js'
|
|
@@ -147,7 +147,7 @@ async function renderDirPicker(inputId, path) {
|
|
|
147
147
|
error = err?.message || String(err)
|
|
148
148
|
}
|
|
149
149
|
const current = data?.path ?? path ?? ''
|
|
150
|
-
const head = `\n <div style="display:flex;gap:6px;align-items:center;margin-bottom:6px">\n <button class="btn small" type="button" data-action="pick-dir-up" data-picker-for="${attr(inputId)}" data-path="${attr(current)}" title="${t("上一级")}">↑</button>\n <button class="btn small" type="button" data-action="pick-dir-home" data-picker-for="${attr(inputId)}">${t("主目录")}</button>\n <span class="mono" style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="${attr(current)}">${esc(current)}</span>\n <button class="btn primary small" type="button" data-action="pick-dir-choose" data-picker-for="${attr(inputId)}" data-path="${attr(current)}">${t("选定此目录")}</button>\n <button class="btn small" type="button" data-action="pick-dir-close" data-picker-for="${attr(inputId)}" title="${t("关闭")}">✕</button>\n </div>`
|
|
150
|
+
const head = `\n <div style="display:flex;gap:6px;align-items:center;margin-bottom:6px">\n <button class="btn small" type="button" data-action="pick-dir-up" data-picker-for="${attr(inputId)}" data-path="${attr(current)}" title="${t("上一级")}">↑</button>\n <button class="btn small" type="button" data-action="pick-dir-home" data-picker-for="${attr(inputId)}">${t("主目录")}</button>\n <span class="mono" style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="${attr(current)}">${esc(tildePath(current))}</span>\n <button class="btn primary small" type="button" data-action="pick-dir-choose" data-picker-for="${attr(inputId)}" data-path="${attr(current)}">${t("选定此目录")}</button>\n <button class="btn small" type="button" data-action="pick-dir-close" data-picker-for="${attr(inputId)}" title="${t("关闭")}">✕</button>\n </div>`
|
|
151
151
|
if (error) {
|
|
152
152
|
box.innerHTML = `${head}<div class="hint" style="color:#c0392b">${esc(error)}</div>`
|
|
153
153
|
return
|
|
@@ -311,7 +311,7 @@ function modalSkill(detail) {
|
|
|
311
311
|
<div><div class="eyebrow">${t("本项目")}</div><div>${off ? `<span class="pill">${t("已停用")}</span>` : `<span class="pill green">${t("可用")}</span>`}</div></div>
|
|
312
312
|
</div>
|
|
313
313
|
<div class="detail-block"><div class="eyebrow">${t("描述")}</div><div>${esc(detail.description || t("无描述"))}</div></div>
|
|
314
|
-
<div class="detail-block"><div class="eyebrow">${t("文件")}</div><code class="mono detail-path">${esc(detail.path || detail.sharedPath || '')}</code></div>
|
|
314
|
+
<div class="detail-block"><div class="eyebrow">${t("文件")}</div><code class="mono detail-path">${esc(tildePath(detail.path || detail.sharedPath || ''))}</code></div>
|
|
315
315
|
<div class="divider"></div>
|
|
316
316
|
<div class="eyebrow">SKILL.md ${t("全文")}</div>
|
|
317
317
|
${detail.readable ? `<pre class="detail-pre">${esc(detail.content)}</pre>` : `<div class="note">${t("技能文件当前不可读(可能已被移动或删除),可尝试重新扫描。")}</div>`}
|
package/ui/modules/settings.js
CHANGED
|
@@ -307,10 +307,10 @@ function dshPathsCard() {
|
|
|
307
307
|
return `
|
|
308
308
|
<div class="card form-card g-card">
|
|
309
309
|
<div class="card-head"><h3>${t('global.cardDshPaths')}</h3><span class="meta">${t('global.readonly')}</span></div>
|
|
310
|
-
<div class="path-row"><span>${t('global.pathDshHome')}</span>${pathCode(paths.dshHome ?? '~/.dsh')}${copyPath(paths.dshHome ?? '')}</div>
|
|
310
|
+
<div class="path-row"><span>${t('global.pathDshHome')}</span>${pathCode(tildePath(paths.dshHome ?? '~/.dsh'))}${copyPath(paths.dshHome ?? '')}</div>
|
|
311
311
|
<div class="path-row"><span>${t('global.pathWorkspace')}</span>${pathCode(tildePath(paths.workspace))}${copyPath(paths.workspace)}</div>
|
|
312
|
-
<div class="path-row"><span>${t('global.pathSkills')}</span>${pathCode(paths.skillRoot)}${copyPath(paths.skillRoot)}</div>
|
|
313
|
-
<div class="path-row"><span>${t('global.pathData')}</span>${pathCode(paths.dataDir)}${copyPath(paths.dataDir)}</div>
|
|
312
|
+
<div class="path-row"><span>${t('global.pathSkills')}</span>${pathCode(tildePath(paths.skillRoot))}${copyPath(paths.skillRoot)}</div>
|
|
313
|
+
<div class="path-row"><span>${t('global.pathData')}</span>${pathCode(tildePath(paths.dataDir))}${copyPath(paths.dataDir)}</div>
|
|
314
314
|
</div>`
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -363,7 +363,7 @@ function renderSettings() {
|
|
|
363
363
|
<div class="field"><label id="settings-description-label" for="settings-description">${t("项目描述")}</label><textarea class="textarea" id="settings-description" name="description">${esc(project.description || '')}</textarea></div>
|
|
364
364
|
<div class="field-row">
|
|
365
365
|
<div class="field"><label id="settings-owner-label" for="settings-owner">${t("总监")} Bot</label><select class="select" id="settings-owner" name="ownerBotId">${members.map(bot => `<option value="${attr(bot.id)}" ${bot.id === project.owner_bot_id ? 'selected' : ''}>${esc(bot.name)}</option>`).join('')}</select></div>
|
|
366
|
-
<div class="field"><label id="settings-reply-mode-label" for="settings-reply-mode">${t("群聊回复模式")}</label><select class="select" id="settings-reply-mode" name="replyMode"><option value="owner_first" ${project.group?.reply_mode !== 'everyone' ? 'selected' : ''}>${t("总监优先")}</option><option value="everyone" ${project.group?.reply_mode === 'everyone' ? 'selected' : ''}>${t("全员响应")}</option></select></div>
|
|
366
|
+
<div class="field"><label id="settings-reply-mode-label" for="settings-reply-mode">${t("群聊回复模式")}</label><select class="select" id="settings-reply-mode" name="replyMode"><option value="owner_first" ${project.group?.reply_mode !== 'everyone' && project.group?.reply_mode !== 'mentioned_only' ? 'selected' : ''}>${t("总监优先")}</option><option value="everyone" ${project.group?.reply_mode === 'everyone' ? 'selected' : ''}>${t("全员响应")}</option><option value="mentioned_only" ${project.group?.reply_mode === 'mentioned_only' ? 'selected' : ''}>${t("仅被点名")}</option></select></div>
|
|
367
367
|
</div>
|
|
368
368
|
</div>
|
|
369
369
|
<div class="card form-card" style="margin-top:12px">
|
|
@@ -393,7 +393,7 @@ function renderSettings() {
|
|
|
393
393
|
<div class="dir-picker" id="dir-picker-settings-production" hidden></div>
|
|
394
394
|
</div>
|
|
395
395
|
<div class="path-row"><span>${t("当前生效")}</span>${pathCode(tildePath(project.workspace_path))}${copyPath(project.workspace_path)}</div>
|
|
396
|
-
<div class="path-row"><span>${t("管理数据")}</span>${pathCode(project.data_path ?? '')}${copyPath(project.data_path ?? '')}</div>
|
|
396
|
+
<div class="path-row"><span>${t("管理数据")}</span>${pathCode(tildePath(project.data_path ?? ''))}${copyPath(project.data_path ?? '')}</div>
|
|
397
397
|
</div>
|
|
398
398
|
<div class="card form-card" style="margin-top:12px">
|
|
399
399
|
<div class="card-head"><h3>${t("项目状态")}</h3>${project.status === 'active' ? `<span class="pill green">${t("运行中")}</span>` : `<span class="pill amber">${t("已归档")}</span>`}</div>
|
package/ui/modules/tasks.js
CHANGED
|
@@ -524,7 +524,7 @@ function renderSkills() {
|
|
|
524
524
|
</div>
|
|
525
525
|
</div>
|
|
526
526
|
<div class="card-head" style="margin-bottom:10px"><h3>${t("共享技能池")}</h3></div>
|
|
527
|
-
<div class="path-row plain" style="margin-bottom:14px"><span>${t("技能根目录")}</span><code>${esc(state.data.paths.skillRoot)}/skills</code><button class="btn icon small" data-action="copy" data-copy="${attr(state.data.paths.skillRoot + '/skills')}">${icon('copy')}</button></div>
|
|
527
|
+
<div class="path-row plain" style="margin-bottom:14px"><span>${t("技能根目录")}</span><code>${esc(tildePath(state.data.paths.skillRoot))}/skills</code><button class="btn icon small" data-action="copy" data-copy="${attr(state.data.paths.skillRoot + '/skills')}">${icon('copy')}</button></div>
|
|
528
528
|
<div class="card list-card">
|
|
529
529
|
${skills.length === 0 ? `<div class="empty-state" style="border:0"><div class="empty-symbol">${icon('spark')}</div><h3>${t("技能池为空")}</h3><p>${t("在技能根目录放置技能文件,或提交一个技能提案并审批。")}</p></div>` : skills.map(skill => {
|
|
530
530
|
const off = disabledSet.has(skill.slug)
|
|
@@ -546,7 +546,7 @@ function renderSkills() {
|
|
|
546
546
|
</div>
|
|
547
547
|
${project ? `<div class="card-head" style="margin-top:24px"><h3>${t("当前项目技能")}</h3></div>
|
|
548
548
|
<div class="section-head"><p>${t("从项目目录(设了生产目录以生产目录为准,见下方实际路径)的")} <code>.agents</code>${t("、")}<code>.claude</code>${t("、")}<code>.codex</code> ${t("三个根扫描发现;同名技能按")} .agents > .claude > .codex ${t("去重。这些技能只在当前项目可用,且优先于同名共享技能。")}</p></div>
|
|
549
|
-
${(state.data.paths.projectSkillRoots ?? []).map(root => `<div class="path-row plain" style="margin-bottom:6px"><span style="text-transform:none">${esc(root.root)}</span><code>${esc(root.path)}/skills</code><button class="btn icon small" data-action="copy" data-copy="${attr(root.path + '/skills')}">${icon('copy')}</button></div>`).join('')}
|
|
549
|
+
${(state.data.paths.projectSkillRoots ?? []).map(root => `<div class="path-row plain" style="margin-bottom:6px"><span style="text-transform:none">${esc(root.root)}</span><code>${esc(tildePath(root.path))}/skills</code><button class="btn icon small" data-action="copy" data-copy="${attr(root.path + '/skills')}">${icon('copy')}</button></div>`).join('')}
|
|
550
550
|
<div class="card list-card">
|
|
551
551
|
${projectSkills.length === 0 ? `<div class="empty-state" style="border:0"><div class="empty-symbol">${icon('spark')}</div><h3>${t("项目内没有技能")}</h3><p>${t("在项目目录的 .agents、.claude 或 .codex 下放置")} skills/<${t("技能名")}>/SKILL.md ${t("即可。")}</p></div>` : projectSkills.map(skill => {
|
|
552
552
|
const off = disabledSet.has(skill.name)
|