dsh-team-bots 0.2.364 → 0.2.395

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.
Files changed (49) hide show
  1. package/README.md +12 -2
  2. package/docs/README.zh.md +12 -2
  3. package/docs/assets/global-config.png +0 -0
  4. package/docs/assets/global-config.zh.png +0 -0
  5. package/docs/assets/tasks.png +0 -0
  6. package/docs/assets/tasks.zh.png +0 -0
  7. package/docs/assets/usage.png +0 -0
  8. package/docs/assets/usage.zh.png +0 -0
  9. package/index.js +2 -0
  10. package/package.json +1 -1
  11. package/src/config.js +55 -10
  12. package/src/db-migrations.js +144 -9
  13. package/src/paths.js +12 -0
  14. package/src/services/approvals.js +12 -2
  15. package/src/services/core.js +2 -1
  16. package/src/services/notify.js +24 -8
  17. package/src/services/questions.js +16 -3
  18. package/src/services/run-finish.js +18 -3
  19. package/src/services/runs.js +369 -34
  20. package/src/services/runtime/prompt.js +106 -89
  21. package/src/services/runtime/session.js +266 -72
  22. package/src/services/scheduler.js +26 -118
  23. package/src/services/task-dispatch.js +39 -0
  24. package/src/services/task-review.js +37 -0
  25. package/src/services/task-runs.js +46 -14
  26. package/src/services/wechat.js +23 -21
  27. package/src/subagent-ledger.js +165 -0
  28. package/src/wechat/commands.js +3 -1
  29. package/ui/app.js +4 -14
  30. package/ui/i18n/en/chat.js +11 -11
  31. package/ui/i18n/en/common.js +0 -12
  32. package/ui/i18n/en/nav.js +0 -4
  33. package/ui/i18n/en/settings.js +14 -9
  34. package/ui/i18n/en/tasks.js +0 -1
  35. package/ui/i18n/en/usage.js +4 -7
  36. package/ui/i18n/zh/chat.js +11 -11
  37. package/ui/i18n/zh/common.js +0 -12
  38. package/ui/i18n/zh/nav.js +0 -4
  39. package/ui/i18n/zh/settings.js +13 -9
  40. package/ui/i18n/zh/tasks.js +0 -1
  41. package/ui/i18n/zh/usage.js +4 -7
  42. package/ui/modules/cards.js +19 -5
  43. package/ui/modules/composer.js +16 -3
  44. package/ui/modules/i18n.js +10 -0
  45. package/ui/modules/modal-forms.js +15 -8
  46. package/ui/modules/settings.js +9 -0
  47. package/ui/modules/util.js +0 -2
  48. package/ui/styles/frame.css +0 -28
  49. package/ui/styles/wide.css +0 -3
@@ -3,7 +3,7 @@ import { icon } from './icons.js'
3
3
  import { activeBots, activeProject, attr, avatar, botById, duration, esc, filePolicyOptions, formatCost, formatNumber, formatTime, inSoloContext, pageProject, runDot, sandboxPill, timeAgo, toast } from './util.js'
4
4
  import { api } from './api.js'
5
5
  import { mdChatScope, richText } from './markdown.js'
6
- import { t } from './i18n.js'
6
+ import { t, tMaybe } from './i18n.js'
7
7
  import { currentSkillVersion, skillVersions, taskUsageBlock } from './tasks.js'
8
8
  import { ensureComposerImageInput, ensureImageViewer } from './composer.js'
9
9
  import { app, refresh, panelAttrs, render, updateRunClocks } from '../app.js'
@@ -345,15 +345,22 @@ function runArtifacts(state, run) {
345
345
  }
346
346
 
347
347
  // ===== 思考过程:Bot 运行轨迹(run_trajectory)=====
348
-
349
- const TRAJ_LABELS = { thinking: t("思考"), text: t("回复"), tool_call: t("调用工具"), tool_result: t("工具返回"), end: t("运行结束") }
350
-
348
+ // 轨迹标题是后端落库时拼好的中文原文(src/services/runtime/trajectory.ts):剥出主体后按当前语言
349
+ // 重组,英文界面不留中文。全角括号用 \u 转义(ui/modules 不得出现 CJK 字面量,cjk-zero 守门)。
351
350
  function trajectoryLabel(entry) {
352
351
  const kind = String(entry?.kind ?? '')
353
352
  const title = String(entry?.title ?? '').trim()
354
- if (kind === 'tool_call') return title ? (title.startsWith(t("调用工具")) ? title : t("调用工具 ${title}", { title: title })) : TRAJ_LABELS.tool_call
355
- if (kind === 'tool_result') return title ? (title.startsWith(t("工具")) ? title : t("工具 ${title} 返回", { title: title })) : TRAJ_LABELS.tool_result
356
- return title || TRAJ_LABELS[kind] || ''
353
+ const tail = /[\uFF08(]([^\uFF08()\uFF09]*)[\uFF09)]$/.exec(title)
354
+ const head = (tail ? title.slice(0, tail.index) : title).trim()
355
+ const parts = head.split(/\s+/)
356
+ const name = tMaybe(parts[1] ?? '')
357
+ if (kind === 'turn') return t('第 ${n} 轮开始', { n: entry?.turn ?? parts[1] ?? '?' })
358
+ if (kind === 'end') return tail ? t('运行结束(${label})', { label: tMaybe(tail[1]) }) : t('运行结束')
359
+ if (kind === 'thinking') return t('思考')
360
+ if (kind === 'text') return t('回复')
361
+ if (kind === 'tool_call') return t('调用工具 ${name}', { name })
362
+ if (kind === 'tool_result') return t('工具 ${name} 返回', { name }) + (tail ? t('(失败)') : '')
363
+ return title
357
364
  }
358
365
 
359
366
  function trajectoryEntry(entry, index = 0, runId = '') {
@@ -362,7 +369,7 @@ function trajectoryEntry(entry, index = 0, runId = '') {
362
369
  const detail = String(entry?.detail ?? '')
363
370
  const label = trajectoryLabel(entry)
364
371
  if (kind === 'turn') {
365
- return `<div class="traj-turn"><span>${esc(title || `${t("第")} ${entry?.turn ?? ''} ${t("轮")}`)}</span></div>`
372
+ return `<div class="traj-turn"><span>${esc(label)}</span></div>`
366
373
  }
367
374
  if (kind === 'note') {
368
375
  return `<div class="traj-note">${esc([title, detail].filter(Boolean).join(' · '))}</div>`
@@ -187,6 +187,11 @@ function renderRunLimitsCard() {
187
187
  const stallText = limits.stallTimeoutMinutes === 0
188
188
  ? t('global.stallOff')
189
189
  : t('global.stallMinutes', { minutes: limits.stallTimeoutMinutes ?? 30 })
190
+ // 审批/提问等待(DSHBOTS-309):默认 10 分钟,settings 可调 [1,60];未保存回填默认。
191
+ const savedApproval = settings.approval_timeout_minutes ?? ''
192
+ const savedQuestion = settings.question_timeout_minutes ?? ''
193
+ const approvalValue = savedApproval !== '' ? savedApproval : '10'
194
+ const questionValue = savedQuestion !== '' ? savedQuestion : '10'
190
195
  return `
191
196
  <div class="card form-card g-card">
192
197
  <div class="card-head"><h3>${t('global.cardRunLimits')}</h3><span class="meta">${t('global.runLimitsCurrent', { timeout: limits.runTimeoutMinutes ?? 120, stall: stallText })}</span></div>
@@ -194,6 +199,10 @@ function renderRunLimitsCard() {
194
199
  <div class="field"><label id="settings-run-timeout-label" for="settings-run-timeout">${t('global.runTimeoutLabel')}</label><input class="input mono" style="text-align:right" type="number" min="1" max="360" id="settings-run-timeout" name="run_timeout_minutes" value="${attr(runValue)}"></div>
195
200
  <div class="field"><label id="settings-stall-watchdog-label" for="settings-stall-watchdog">${t('global.stallWatchdogLabel')}</label><input class="input mono" style="text-align:right" type="number" min="0" max="360" id="settings-stall-watchdog" name="stall_watchdog_minutes" value="${attr(stallValue)}"></div>
196
201
  </div>
202
+ <div class="field-row">
203
+ <div class="field"><label id="settings-approval-timeout-label" for="settings-approval-timeout">${t('global.approvalTimeoutLabel')}</label><input class="input mono" style="text-align:right" type="number" min="1" max="60" id="settings-approval-timeout" name="approval_timeout_minutes" value="${attr(approvalValue)}"></div>
204
+ <div class="field"><label id="settings-question-timeout-label" for="settings-question-timeout">${t('global.questionTimeoutLabel')}</label><input class="input mono" style="text-align:right" type="number" min="1" max="60" id="settings-question-timeout" name="question_timeout_minutes" value="${attr(questionValue)}"></div>
205
+ </div>
197
206
  <div class="field-row">
198
207
  <div class="field"><label id="settings-review-idle-label" for="settings-review-idle">${t('global.reviewIdleLabel')}</label><input class="input mono" style="text-align:right" type="number" min="0" max="1440" id="settings-review-idle" name="review_idle_minutes" value="${attr(reviewIdleValue)}"></div>
199
208
  <div class="field"><label id="settings-review-auto-close-label" for="settings-review-auto-close">${t('global.reviewAutoCloseLabel')}</label>
@@ -176,8 +176,6 @@ export function memberRunDot(member) {
176
176
  export function runDotHtml(dot) {
177
177
  return `<span class="run-dot ${dot.cls}" data-status="${dot.status}" title="${esc(dot.text)}" aria-label="${esc(dot.text)}"></span>`
178
178
  }
179
- // 卡片底部的状态短标签(完整说明仍在 run-dot 的 title 里)。
180
- export const MEMBER_STATUS_TEXT = { idle: t("空闲"), running: t("运行中"), queued: t("排队中"), plan_wait: t("限流等待"), failed: t("运行失败") }
181
179
  export function memorySource(source) {
182
180
  const value = String(source ?? '')
183
181
  if (!value) return t("手动写入")
@@ -316,32 +316,4 @@ a.global-config.dsh-official-link {
316
316
  a.global-config.dsh-official-link:hover {
317
317
  color: var(--ink);
318
318
  }
319
- .sidebar-meta {
320
- display: flex;
321
- align-items: center;
322
- gap: 6px;
323
- padding: 4px 8px 0;
324
- color: var(--ink-3);
325
- font-size: var(--fs-caption);
326
- white-space: nowrap;
327
- overflow: hidden;
328
- min-width: 0;
329
- }
330
- .sidebar-meta span {
331
- overflow: hidden;
332
- text-overflow: ellipsis;
333
- }
334
- .sidebar-meta .dot {
335
- width: 5px;
336
- height: 5px;
337
- border-radius: 50%;
338
- background: var(--green);
339
- flex: 0 0 auto;
340
- }
341
- .sidebar-meta .dot.amber {
342
- background: var(--star);
343
- }
344
- .sidebar-meta-sep {
345
- opacity: 0.55;
346
- }
347
319
 
@@ -65,9 +65,6 @@
65
65
  min-height: 44px;
66
66
  padding: 0 12px;
67
67
  }
68
- .sidebar-meta {
69
- padding: 0;
70
- }
71
68
  .topbar {
72
69
  padding: 10px 16px;
73
70
  min-height: 60px;