dsh-team-bots 0.3.12 → 0.3.70

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 (76) hide show
  1. package/NOTICE +3 -4
  2. package/README.md +2 -2
  3. package/docs/README.zh.md +2 -2
  4. package/docs/assets/global-config.png +0 -0
  5. package/docs/assets/global-config.zh.png +0 -0
  6. package/docs/assets/tasks.png +0 -0
  7. package/docs/assets/tasks.zh.png +0 -0
  8. package/docs/assets/usage.png +0 -0
  9. package/docs/assets/usage.zh.png +0 -0
  10. package/package.json +8 -2
  11. package/src/api.js +10 -1
  12. package/src/config.js +180 -2
  13. package/src/db-migrations.js +55 -4
  14. package/src/db.js +30 -3
  15. package/src/http.js +21 -1
  16. package/src/runtime.js +16 -1
  17. package/src/seed-bots.js +4 -0
  18. package/src/service.js +21 -2
  19. package/src/services/approvals.js +303 -10
  20. package/src/services/bots.js +12 -3
  21. package/src/services/core.js +31 -2
  22. package/src/services/memory.js +24 -8
  23. package/src/services/projects.js +12 -1
  24. package/src/services/run-finish.js +11 -0
  25. package/src/services/runtime/session.js +116 -32
  26. package/src/services/scheduler.js +20 -0
  27. package/src/services/system.js +164 -10
  28. package/src/services/task-review.js +90 -55
  29. package/src/services/tasks.js +5 -2
  30. package/ui/app.js +7 -10
  31. package/ui/i18n/en/chat.js +2 -0
  32. package/ui/i18n/en/common.js +14 -0
  33. package/ui/i18n/en/settings.js +81 -1
  34. package/ui/i18n/en/tasks.js +3 -0
  35. package/ui/i18n/zh/chat.js +2 -0
  36. package/ui/i18n/zh/common.js +14 -0
  37. package/ui/i18n/zh/settings.js +81 -1
  38. package/ui/i18n/zh/tasks.js +3 -0
  39. package/ui/modules/api.js +9 -1
  40. package/ui/modules/approval-rule-modal.js +31 -0
  41. package/ui/modules/cards.js +6 -3
  42. package/ui/modules/chat.js +3 -2
  43. package/ui/modules/composer.js +6 -1
  44. package/ui/modules/events-board.js +46 -0
  45. package/ui/modules/events-misc.js +43 -0
  46. package/ui/modules/events-submit.js +45 -0
  47. package/ui/modules/form-validation.js +204 -0
  48. package/ui/modules/global-pages.js +8 -5
  49. package/ui/modules/modal-forms.js +3 -2
  50. package/ui/modules/modal-layer.js +6 -1
  51. package/ui/modules/page-shell.js +10 -7
  52. package/ui/modules/permissions.js +56 -0
  53. package/ui/modules/settings.js +103 -21
  54. package/ui/modules/state.js +10 -0
  55. package/ui/modules/task-menu.js +147 -0
  56. package/ui/modules/tasks.js +9 -8
  57. package/ui/modules/util.js +58 -6
  58. package/ui/styles/a11y.css +13 -0
  59. package/ui/styles/base.css +57 -11
  60. package/ui/styles/buttons.css +46 -6
  61. package/ui/styles/cards.css +54 -0
  62. package/ui/styles/chat.css +23 -2
  63. package/ui/styles/global-config.css +7 -4
  64. package/ui/styles/modal.css +28 -0
  65. package/ui/styles/settings.css +23 -1
  66. package/ui/styles/tasks.css +51 -1
  67. package/ui/styles/toast.css +18 -11
  68. package/ui/styles/usage.css +2 -0
  69. package/ui/styles/wide.css +4 -0
  70. package/docs/assets/channel-redesign.png +0 -0
  71. package/docs/assets/global-config-dark.png +0 -0
  72. package/docs/assets/global-config-light.png +0 -0
  73. package/docs/assets/global-config-light.zh.png +0 -0
  74. package/docs/assets/global-config-redesign.png +0 -0
  75. package/docs/assets/secrets-redesign.png +0 -0
  76. package/docs/assets/usage-redesign-global.png +0 -0
@@ -105,6 +105,13 @@
105
105
  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
106
106
  "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
107
107
 
108
+ /* 动效阶梯:按压 80 / 悬停与配色 140 / 展开与入场 220,全站共用一条缓动曲线。
109
+ 散落的 0.12s、0.13s、0.2s 各写各的,同一屏里手感会不一致。 */
110
+ --motion-instant: 80ms;
111
+ --motion-fast: 140ms;
112
+ --motion-base: 220ms;
113
+ --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
114
+
108
115
  /* legacy aliases used by inline styles in app.js */
109
116
  }
110
117
 
@@ -308,19 +315,58 @@ a {
308
315
  top: 0;
309
316
  }
310
317
 
311
- ::-webkit-scrollbar {
312
- width: 8px;
313
- height: 8px;
318
+ /* 标准滚动条属性是唯一跨引擎口径:Firefox 只认 scrollbar-color/width,厂商伪元素
319
+ 在那里完全不生效,滚动条会退回系统灰。两个属性都继承,声明在 html 上即可覆盖所有
320
+ 滚动容器;要隐藏的地方(.tree-list)照旧用 scrollbar-width: none。 */
321
+ html {
322
+ scrollbar-color: color-mix(in srgb, var(--ink) 26%, transparent) transparent;
323
+ scrollbar-width: thin;
314
324
  }
315
- ::-webkit-scrollbar-track,
316
- ::-webkit-scrollbar-corner {
317
- background: transparent;
325
+ /* 旧引擎兜底:只有不支持标准属性时才启用厂商伪元素,避免两套同时生效导致宽度打架。 */
326
+ @supports not (scrollbar-color: auto) {
327
+ ::-webkit-scrollbar {
328
+ width: 8px;
329
+ height: 8px;
330
+ }
331
+ ::-webkit-scrollbar-track,
332
+ ::-webkit-scrollbar-corner {
333
+ background: transparent;
334
+ }
335
+ ::-webkit-scrollbar-thumb {
336
+ border-radius: 8px;
337
+ background: color-mix(in srgb, var(--ink) 14%, transparent);
338
+ }
339
+ ::-webkit-scrollbar-thumb:hover {
340
+ background: color-mix(in srgb, var(--ink) 26%, transparent);
341
+ }
342
+ }
343
+
344
+ /* 折叠面板展开/收起(全站 <details>:提案、技能版本、免审规则、运行输出、思考轨迹、
345
+ 私信子面板)。收起态用 content-visibility 而非 display:none,内容仍可被页内查找命中,
346
+ 高度也才有得可动画。interpolate-size 目前只有 Chromium 支持,不支持的浏览器直接
347
+ 瞬间开合——纯增量增强,无需兜底代码。
348
+ contain: layout 让两态的布局 containment 保持一致:否则 content-visibility 翻转时
349
+ containment 跟着变,内容带外边距就会让过渡抖动。 */
350
+ details::details-content {
351
+ interpolate-size: allow-keywords;
352
+ overflow: clip;
353
+ contain: layout;
354
+ transition:
355
+ block-size var(--motion-base) var(--ease-out),
356
+ content-visibility var(--motion-base) var(--ease-out);
357
+ /* 离散属性单列一行:写进 shorthand 会让旧引擎整条 transition 失效。
358
+ 它把 content-visibility: hidden 推迟到收起动画结束,否则内容一开始就没了、
359
+ 高度动画收起的是一块空白。 */
360
+ transition-behavior: allow-discrete;
318
361
  }
319
- ::-webkit-scrollbar-thumb {
320
- border-radius: 8px;
321
- background: color-mix(in srgb, var(--ink) 14%, transparent);
362
+ details:not([open])::details-content {
363
+ block-size: 0;
322
364
  }
323
- ::-webkit-scrollbar-thumb:hover {
324
- background: color-mix(in srgb, var(--ink) 26%, transparent);
365
+ /* wide.css 的全局降级只覆盖 * / *::before / *::after,够不到 ::details-content,
366
+ 所以这里必须自带减弱动效分支。 */
367
+ @media (prefers-reduced-motion: reduce) {
368
+ details::details-content {
369
+ transition: none;
370
+ }
325
371
  }
326
372
 
@@ -23,15 +23,55 @@
23
23
  white-space: nowrap;
24
24
  cursor: pointer;
25
25
  transition:
26
- background-color 0.13s ease,
27
- border-color 0.13s ease,
28
- color 0.13s ease;
26
+ background-color var(--motion-fast) var(--ease-out),
27
+ border-color var(--motion-fast) var(--ease-out),
28
+ color var(--motion-fast) var(--ease-out),
29
+ box-shadow var(--motion-fast) var(--ease-out),
30
+ transform var(--motion-instant) var(--ease-out);
29
31
  }
30
32
  .btn:hover {
31
33
  background: var(--surface-3);
32
34
  border-color: var(--line);
33
35
  color: var(--ink);
34
36
  }
37
+ /* 按下要有触觉级回应:80ms 内轻微下沉,松开即回弹。只动 transform,不引发重排。 */
38
+ .btn:active {
39
+ transform: scale(0.97);
40
+ }
41
+ .btn:disabled:active {
42
+ transform: none;
43
+ }
44
+ /* 进行中:spinner 走伪元素,不改任何模板;aria-busy 同时是选择器与无障碍口径,
45
+ 读屏据此播报「忙」,动效关掉后状态信息不丢。 */
46
+ .btn[data-state="loading"],
47
+ .btn.is-loading,
48
+ .btn[aria-busy="true"] {
49
+ pointer-events: none;
50
+ }
51
+ .btn[data-state="loading"]::before,
52
+ .btn.is-loading::before,
53
+ .btn[aria-busy="true"]::before {
54
+ content: "";
55
+ width: 14px;
56
+ height: 14px;
57
+ border: 2px solid currentColor;
58
+ border-right-color: transparent;
59
+ border-radius: 50%;
60
+ flex: 0 0 auto;
61
+ animation: btn-spin 0.8s linear infinite;
62
+ }
63
+ @keyframes btn-spin {
64
+ to {
65
+ transform: rotate(360deg);
66
+ }
67
+ }
68
+ /* 忙态不是禁用态:disabled 只用来挡重复提交,按钮此刻仍在工作,不能被
69
+ .btn:disabled 的 opacity .4 压暗成「不可用」。 */
70
+ .btn[aria-busy="true"]:disabled,
71
+ .btn[aria-busy="true"]:disabled:hover {
72
+ opacity: 1;
73
+ transform: none;
74
+ }
35
75
  .btn svg {
36
76
  width: 14px;
37
77
  height: 14px;
@@ -139,8 +179,8 @@
139
179
  padding: 0 10px;
140
180
  border-radius: 7px;
141
181
  transition:
142
- background-color 0.13s ease,
143
- color 0.13s ease;
182
+ background-color var(--motion-fast) var(--ease-out),
183
+ color var(--motion-fast) var(--ease-out);
144
184
  }
145
185
  .seg button:hover {
146
186
  color: var(--ink-2);
@@ -178,7 +218,7 @@
178
218
  place-items: center;
179
219
  background: var(--accent);
180
220
  color: var(--accent-ink);
181
- transition: opacity 0.13s ease;
221
+ transition: opacity var(--motion-fast) var(--ease-out);
182
222
  }
183
223
  .send-btn:hover {
184
224
  opacity: 0.88;
@@ -329,3 +329,57 @@
329
329
  margin-top: 10px;
330
330
  }
331
331
 
332
+ /* 免审权限卡(总览 bots 页「全部 Bots」下方):每条规则一张独立只读卡片(chip 摘要 +
333
+ 编辑/删除),新增与编辑都拉起 modal,卡内不再内联编辑。 */
334
+ .perm-section {
335
+ margin-top: 26px;
336
+ }
337
+ .perm-card {
338
+ padding: 14px 16px;
339
+ }
340
+ .perm-empty {
341
+ padding: 4px 0 10px;
342
+ }
343
+ .perm-rule-grid {
344
+ display: grid;
345
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
346
+ gap: 10px;
347
+ }
348
+ .perm-rule-card {
349
+ display: flex;
350
+ flex-direction: column;
351
+ gap: 10px;
352
+ border: 1px solid var(--line);
353
+ border-radius: 10px;
354
+ padding: 12px;
355
+ background: var(--bg-2, transparent);
356
+ }
357
+ .perm-rule-card-main {
358
+ flex: 1;
359
+ }
360
+ .perm-rule-chips {
361
+ display: flex;
362
+ align-items: center;
363
+ gap: 6px;
364
+ flex-wrap: wrap;
365
+ }
366
+ .perm-rule-chips .approval-chip {
367
+ max-width: 100%;
368
+ }
369
+ .perm-rule-actions {
370
+ display: flex;
371
+ justify-content: flex-end;
372
+ gap: 8px;
373
+ }
374
+ .perm-note {
375
+ margin-top: 8px;
376
+ color: var(--ink-3);
377
+ font-size: var(--fs-small);
378
+ overflow: hidden;
379
+ text-overflow: ellipsis;
380
+ white-space: nowrap;
381
+ }
382
+ .perm-add-row {
383
+ margin-top: 12px;
384
+ }
385
+
@@ -114,6 +114,12 @@
114
114
  .message-meta strong {
115
115
  color: var(--ink-2);
116
116
  font-weight: 600;
117
+ /* 长名字截断而不是把整行撑宽(DSHBOTS-367:操作按钮 22→24px 后 meta 行余量更紧,
118
+ 窄屏 360px 下长 bot 名会把两个操作按钮顶出气泡)。 */
119
+ min-width: 0;
120
+ overflow: hidden;
121
+ text-overflow: ellipsis;
122
+ white-space: nowrap;
117
123
  }
118
124
  .message-bubble {
119
125
  color: var(--ink);
@@ -328,8 +334,9 @@
328
334
  display: inline-flex;
329
335
  align-items: center;
330
336
  justify-content: center;
331
- width: 22px;
332
- height: 22px;
337
+ /* 消息操作按钮 22 → 24px(DSHBOTS-367):键盘可达后按钮成为可点目标,尺寸跟着抬到 24px。 */
338
+ width: 24px;
339
+ height: 24px;
333
340
  margin-left: 2px;
334
341
  padding: 0;
335
342
  border: 0;
@@ -368,3 +375,17 @@
368
375
  color: var(--ink-3);
369
376
  font-size: var(--fs-caption);
370
377
  }
378
+
379
+ /* 新消息入场。@starting-style 只在节点首次插入时触发一次:dom-morph 按
380
+ data-bubble-key 复用既有气泡,2.8s 轮询的原位补丁不会让整屏历史反复重播。 */
381
+ .message-row {
382
+ transition:
383
+ opacity var(--motion-base) var(--ease-out),
384
+ translate var(--motion-base) var(--ease-out);
385
+ }
386
+ @starting-style {
387
+ .message-row {
388
+ opacity: 0;
389
+ translate: 0 6px;
390
+ }
391
+ }
@@ -72,11 +72,15 @@
72
72
  }
73
73
  .global-nav-item {
74
74
  padding: 6px 12px;
75
+ border: 0;
75
76
  border-radius: 8px;
77
+ background: transparent;
76
78
  color: var(--ink-2);
79
+ font: inherit;
77
80
  font-size: var(--fs-small);
78
81
  font-weight: 500;
79
82
  text-decoration: none;
83
+ cursor: pointer;
80
84
  }
81
85
  .global-nav-item:hover {
82
86
  background: var(--surface-2);
@@ -86,10 +90,9 @@
86
90
  outline: 2px solid var(--accent);
87
91
  outline-offset: 2px;
88
92
  }
89
- /* 锚点命中时高亮对应分组条目 */
90
- .global-page:has(#g-pref:target) .global-nav-item[href="#g-pref"],
91
- .global-page:has(#g-runtime:target) .global-nav-item[href="#g-runtime"],
92
- .global-page:has(#g-about:target) .global-nav-item[href="#g-about"] {
93
+ /* 激活 tab:分组一次只渲染一个(tab 分页容器,长页拆分) */
94
+ .global-nav-item.active,
95
+ .global-nav-item[aria-selected='true'] {
93
96
  background: var(--accent-wash);
94
97
  color: var(--accent-text);
95
98
  }
@@ -2,6 +2,11 @@
2
2
  .modal-backdrop {
3
3
  position: fixed;
4
4
  inset: 0;
5
+ /* 背景滚动锁定(DSHBOTS-367):遮罩自身成为不可滚动的滚动容器并 contain 滚动链——
6
+ 滚轮停在遮罩上时不再把底页滚下去。不改 html/body 的 overflow:那会顶掉页面滚动条,
7
+ 造成横向布局抖动并可能跳变滚动位置。 */
8
+ overflow: hidden;
9
+ overscroll-behavior: contain;
5
10
  background: color-mix(in srgb, var(--ink) 24%, transparent);
6
11
  backdrop-filter: blur(2px);
7
12
  display: flex;
@@ -299,3 +304,26 @@ body:has(#modal-root .modal-backdrop) #app *::after {
299
304
  margin-left: auto;
300
305
  }
301
306
 
307
+ /* 入场:遮罩淡入、面板从上方 8px 落到位置。@starting-style 只在节点首次插入时触发
308
+ 一次——modal-layer 的原位补丁复用 .modal 容器与 .modal-body,同一弹窗刷新内容
309
+ (loading→详情、保存后重载)不会重播入场。
310
+ 只动 opacity/translate:不新增 filter,也不给遮罩加 will-change(D-166 口径,
311
+ 提升 filter 元素自身会让 Paint 面积暴涨)。 */
312
+ .modal-backdrop {
313
+ transition: opacity var(--motion-base) var(--ease-out);
314
+ }
315
+ .modal {
316
+ transition:
317
+ opacity var(--motion-base) var(--ease-out),
318
+ translate var(--motion-base) var(--ease-out);
319
+ }
320
+ @starting-style {
321
+ .modal-backdrop {
322
+ opacity: 0;
323
+ }
324
+ .modal {
325
+ opacity: 0;
326
+ translate: 0 -8px;
327
+ }
328
+ }
329
+
@@ -68,7 +68,8 @@
68
68
  }
69
69
  .field-row {
70
70
  display: grid;
71
- grid-template-columns: 1fr 1fr;
71
+ /* minmax(0,1fr):去掉轨道 auto-min,窄窗口下输入框跟着缩而不是把并排字段挤出卡片右边框 */
72
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
72
73
  gap: 10px;
73
74
  }
74
75
  .check-list {
@@ -231,3 +232,24 @@
231
232
  font-variant-numeric: tabular-nums;
232
233
  }
233
234
 
235
+
236
+ /* 表单内联错误(DSHBOTS-367):错误节点常驻 DOM(隐藏),非法时才显示——
237
+ 视觉态(is-visible)与程序化态(aria-invalid)同一时刻切换。 */
238
+ .field-error {
239
+ display: none;
240
+ margin-top: 6px;
241
+ color: var(--danger);
242
+ font-size: var(--fs-caption);
243
+ line-height: 1.4;
244
+ }
245
+ .field-error.is-visible {
246
+ display: block;
247
+ }
248
+ .field .input[aria-invalid='true'],
249
+ .field .select[aria-invalid='true'],
250
+ .field textarea[aria-invalid='true'],
251
+ .input[aria-invalid='true'],
252
+ .select[aria-invalid='true'],
253
+ textarea[aria-invalid='true'] {
254
+ border-color: var(--danger);
255
+ }
@@ -229,7 +229,10 @@
229
229
  min-width: 0;
230
230
  overflow: hidden;
231
231
  cursor: pointer;
232
- transition: background-color 0.12s ease;
232
+ transition:
233
+ background-color var(--motion-fast) var(--ease-out),
234
+ opacity var(--motion-base) var(--ease-out),
235
+ translate var(--motion-base) var(--ease-out);
233
236
  }
234
237
  .task-card:hover {
235
238
  background: var(--surface-2);
@@ -578,3 +581,50 @@
578
581
  --av: var(--c-gray);
579
582
  }
580
583
 
584
+ /* 新任务行入场(新建、以及拖到别的分组后在新组里重新插入)。dom-morph 按
585
+ data-task-id 复用行节点,轮询原位补丁不会让整块看板反复重播。 */
586
+ @starting-style {
587
+ .task-card {
588
+ opacity: 0;
589
+ translate: 0 -4px;
590
+ }
591
+ }
592
+
593
+
594
+ /* 任务卡上下文菜单(DSHBOTS-367):键盘跨列移动的载体,与遮罩同层但不吃遮罩点击。 */
595
+ #task-menu-root {
596
+ position: fixed;
597
+ inset: 0;
598
+ z-index: 90;
599
+ pointer-events: none;
600
+ }
601
+ .task-menu {
602
+ position: absolute;
603
+ min-width: 168px;
604
+ padding: 6px;
605
+ background: var(--surface);
606
+ border: 1px solid var(--line-2);
607
+ border-radius: 10px;
608
+ box-shadow: var(--shadow-3);
609
+ pointer-events: auto;
610
+ }
611
+ .task-menu-title {
612
+ padding: 4px 8px 6px;
613
+ color: var(--ink-3);
614
+ font-size: var(--fs-caption);
615
+ }
616
+ .task-menu-item {
617
+ display: block;
618
+ width: 100%;
619
+ padding: 8px 10px;
620
+ border: 0;
621
+ border-radius: 8px;
622
+ background: transparent;
623
+ color: var(--ink);
624
+ font-size: var(--fs-small);
625
+ text-align: left;
626
+ cursor: pointer;
627
+ }
628
+ .task-menu-item:hover {
629
+ background: var(--surface-2);
630
+ }
@@ -18,8 +18,25 @@
18
18
  font-size: var(--fs-small);
19
19
  box-shadow: var(--shadow-2);
20
20
  max-width: 380px;
21
- animation: toast-in 0.2s ease-out;
22
21
  pointer-events: auto;
22
+ /* 入场与退场都归 CSS,时长统一走 220ms 档;JS 只决定何时收起,不再写行内样式。
23
+ @starting-style 负责插入即淡入,[data-closing] 负责淡出——节点移除由 JS 等
24
+ 动画跑完再做,退场不会被 remove() 直接切掉。 */
25
+ transition:
26
+ opacity var(--motion-base) var(--ease-out),
27
+ translate var(--motion-base) var(--ease-out);
28
+ }
29
+ @starting-style {
30
+ .toast {
31
+ opacity: 0;
32
+ translate: 0 7px;
33
+ }
34
+ }
35
+ /* 正在收起的提示不再接收点击,避免点到一条马上要消失的通知。 */
36
+ .toast[data-closing] {
37
+ opacity: 0;
38
+ translate: 0 5px;
39
+ pointer-events: none;
23
40
  }
24
41
  .toast.error {
25
42
  color: var(--danger);
@@ -27,14 +44,4 @@
27
44
  .toast.success {
28
45
  color: var(--green);
29
46
  }
30
- @keyframes toast-in {
31
- from {
32
- opacity: 0;
33
- transform: translateY(7px);
34
- }
35
- to {
36
- opacity: 1;
37
- transform: translateY(0);
38
- }
39
- }
40
47
 
@@ -39,6 +39,8 @@
39
39
  /* 卡内纵向 flex:图例与说明贴到卡片底部,等高时不再悬空。 */
40
40
  display: flex;
41
41
  flex-direction: column;
42
+ /* narrow 窗口下列表/表格最小宽度超过半宽槽位时卡内横向滚动,不顶破卡片与页面(1000px 实测溢出 53–69px) */
43
+ overflow-x: auto;
42
44
  }
43
45
  .usage-panel > .usage-legend,
44
46
  .usage-panel > .usage-note {
@@ -181,6 +181,10 @@
181
181
  .field-row {
182
182
  grid-template-columns: 1fr;
183
183
  }
184
+ /* 免审规则卡片栅格窄屏单列 */
185
+ .perm-rule-grid {
186
+ grid-template-columns: 1fr;
187
+ }
184
188
  .metric-grid {
185
189
  grid-template-columns: 1fr;
186
190
  }
Binary file
Binary file
Binary file
Binary file