@icen.ai/ui 0.8.0 → 0.9.0

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 (228) hide show
  1. package/AGENTS.md +63 -14
  2. package/README.md +17 -9
  3. package/dist/base.css +4 -3
  4. package/dist/behaviors/accordion.d.mts +5 -2
  5. package/dist/behaviors/accordion.mjs +36 -11
  6. package/dist/behaviors/ai-branch.d.mts +19 -0
  7. package/dist/behaviors/ai-branch.mjs +217 -0
  8. package/dist/behaviors/ai-chat.d.mts +11 -7
  9. package/dist/behaviors/ai-chat.mjs +134 -51
  10. package/dist/behaviors/ai-composer.d.mts +28 -3
  11. package/dist/behaviors/ai-composer.mjs +399 -229
  12. package/dist/behaviors/ai-core.d.mts +9 -4
  13. package/dist/behaviors/ai-core.mjs +21 -8
  14. package/dist/behaviors/ai-diff.d.mts +2 -2
  15. package/dist/behaviors/ai-diff.mjs +172 -41
  16. package/dist/behaviors/ai-feedback.d.mts +26 -0
  17. package/dist/behaviors/ai-feedback.mjs +303 -0
  18. package/dist/behaviors/ai-panel.d.mts +26 -9
  19. package/dist/behaviors/ai-panel.mjs +211 -110
  20. package/dist/behaviors/ai-provider.mjs +54 -48
  21. package/dist/behaviors/ai-threads.d.mts +38 -0
  22. package/dist/behaviors/ai-threads.mjs +319 -0
  23. package/dist/behaviors/ai-tool.d.mts +12 -4
  24. package/dist/behaviors/ai-tool.mjs +316 -263
  25. package/dist/behaviors/ai-tools.d.mts +9 -6
  26. package/dist/behaviors/ai-tools.mjs +264 -155
  27. package/dist/behaviors/back-top.mjs +16 -1
  28. package/dist/behaviors/carousel.d.mts +5 -2
  29. package/dist/behaviors/carousel.mjs +53 -26
  30. package/dist/behaviors/charts.d.mts +170 -22
  31. package/dist/behaviors/charts.mjs +1016 -150
  32. package/dist/behaviors/command-palette.d.mts +40 -6
  33. package/dist/behaviors/command-palette.mjs +143 -15
  34. package/dist/behaviors/context-menu.d.mts +21 -4
  35. package/dist/behaviors/context-menu.mjs +122 -38
  36. package/dist/behaviors/controls.d.mts +59 -0
  37. package/dist/behaviors/controls.mjs +601 -0
  38. package/dist/behaviors/copy.d.mts +5 -2
  39. package/dist/behaviors/copy.mjs +37 -12
  40. package/dist/behaviors/datatable.d.mts +12 -0
  41. package/dist/behaviors/datatable.mjs +226 -43
  42. package/dist/behaviors/date-picker.d.mts +2 -2
  43. package/dist/behaviors/date-picker.mjs +171 -32
  44. package/dist/behaviors/dropdown.d.mts +6 -2
  45. package/dist/behaviors/dropdown.mjs +164 -25
  46. package/dist/behaviors/events.d.mts +523 -0
  47. package/dist/behaviors/events.mjs +208 -0
  48. package/dist/behaviors/input.mjs +25 -12
  49. package/dist/behaviors/kb-access.d.mts +34 -0
  50. package/dist/behaviors/kb-access.mjs +569 -0
  51. package/dist/behaviors/kb-acl.d.mts +50 -0
  52. package/dist/behaviors/kb-acl.mjs +405 -0
  53. package/dist/behaviors/kb-answer.d.mts +38 -0
  54. package/dist/behaviors/kb-answer.mjs +2055 -0
  55. package/dist/behaviors/kb-audit.d.mts +23 -0
  56. package/dist/behaviors/kb-audit.mjs +375 -0
  57. package/dist/behaviors/kb-canvas.d.mts +44 -0
  58. package/dist/behaviors/kb-canvas.mjs +589 -0
  59. package/dist/behaviors/kb-chain.d.mts +15 -0
  60. package/dist/behaviors/kb-chain.mjs +270 -0
  61. package/dist/behaviors/kb-checkpoint.d.mts +16 -0
  62. package/dist/behaviors/kb-checkpoint.mjs +342 -0
  63. package/dist/behaviors/kb-chunks.d.mts +31 -0
  64. package/dist/behaviors/kb-chunks.mjs +475 -0
  65. package/dist/behaviors/kb-citation.d.mts +38 -0
  66. package/dist/behaviors/kb-citation.mjs +677 -0
  67. package/dist/behaviors/kb-clarify.d.mts +20 -0
  68. package/dist/behaviors/kb-clarify.mjs +248 -0
  69. package/dist/behaviors/kb-conflict.d.mts +22 -0
  70. package/dist/behaviors/kb-conflict.mjs +284 -0
  71. package/dist/behaviors/kb-connector.d.mts +17 -0
  72. package/dist/behaviors/kb-connector.mjs +375 -0
  73. package/dist/behaviors/kb-core.d.mts +529 -0
  74. package/dist/behaviors/kb-core.mjs +890 -0
  75. package/dist/behaviors/kb-eval.d.mts +22 -0
  76. package/dist/behaviors/kb-eval.mjs +408 -0
  77. package/dist/behaviors/kb-explain.d.mts +11 -0
  78. package/dist/behaviors/kb-explain.mjs +243 -0
  79. package/dist/behaviors/kb-filter.d.mts +31 -0
  80. package/dist/behaviors/kb-filter.mjs +587 -0
  81. package/dist/behaviors/kb-gap.d.mts +27 -0
  82. package/dist/behaviors/kb-gap.mjs +273 -0
  83. package/dist/behaviors/kb-hittest.d.mts +34 -0
  84. package/dist/behaviors/kb-hittest.mjs +409 -0
  85. package/dist/behaviors/kb-metadata.d.mts +29 -0
  86. package/dist/behaviors/kb-metadata.mjs +326 -0
  87. package/dist/behaviors/kb-passage.d.mts +41 -0
  88. package/dist/behaviors/kb-passage.mjs +529 -0
  89. package/dist/behaviors/kb-pipeline.d.mts +18 -0
  90. package/dist/behaviors/kb-pipeline.mjs +381 -0
  91. package/dist/behaviors/kb-qa.d.mts +26 -0
  92. package/dist/behaviors/kb-qa.mjs +332 -0
  93. package/dist/behaviors/kb-rerank.d.mts +20 -0
  94. package/dist/behaviors/kb-rerank.mjs +315 -0
  95. package/dist/behaviors/kb-retrieval.d.mts +49 -0
  96. package/dist/behaviors/kb-retrieval.mjs +746 -0
  97. package/dist/behaviors/kb-review.d.mts +44 -0
  98. package/dist/behaviors/kb-review.mjs +451 -0
  99. package/dist/behaviors/kb-sandbox.d.mts +33 -0
  100. package/dist/behaviors/kb-sandbox.mjs +325 -0
  101. package/dist/behaviors/kb-segment.d.mts +32 -0
  102. package/dist/behaviors/kb-segment.mjs +499 -0
  103. package/dist/behaviors/kb-sources.d.mts +27 -0
  104. package/dist/behaviors/kb-sources.mjs +373 -0
  105. package/dist/behaviors/kb-sql.d.mts +43 -0
  106. package/dist/behaviors/kb-sql.mjs +948 -0
  107. package/dist/behaviors/kb-trace.d.mts +16 -0
  108. package/dist/behaviors/kb-trace.mjs +414 -0
  109. package/dist/behaviors/kb-visibility.d.mts +44 -0
  110. package/dist/behaviors/kb-visibility.mjs +403 -0
  111. package/dist/behaviors/kb-who-can.d.mts +32 -0
  112. package/dist/behaviors/kb-who-can.mjs +379 -0
  113. package/dist/behaviors/modal.d.mts +24 -5
  114. package/dist/behaviors/modal.mjs +76 -10
  115. package/dist/behaviors/nav.d.mts +1 -1
  116. package/dist/behaviors/nav.mjs +33 -7
  117. package/dist/behaviors/notification.d.mts +20 -4
  118. package/dist/behaviors/notification.mjs +53 -73
  119. package/dist/behaviors/popover.d.mts +39 -3
  120. package/dist/behaviors/popover.mjs +90 -4
  121. package/dist/behaviors/select.d.mts +4 -2
  122. package/dist/behaviors/select.mjs +161 -24
  123. package/dist/behaviors/sidebar.d.mts +5 -2
  124. package/dist/behaviors/sidebar.mjs +43 -13
  125. package/dist/behaviors/slider.d.mts +5 -2
  126. package/dist/behaviors/slider.mjs +54 -43
  127. package/dist/behaviors/split-pane.d.mts +6 -2
  128. package/dist/behaviors/split-pane.mjs +62 -21
  129. package/dist/behaviors/tabs.d.mts +3 -2
  130. package/dist/behaviors/tabs.mjs +65 -14
  131. package/dist/behaviors/tag-input.d.mts +5 -2
  132. package/dist/behaviors/tag-input.mjs +61 -21
  133. package/dist/behaviors/theme.d.mts +13 -2
  134. package/dist/behaviors/theme.mjs +48 -4
  135. package/dist/behaviors/toast.d.mts +30 -8
  136. package/dist/behaviors/toast.mjs +74 -7
  137. package/dist/behaviors/tree.d.mts +5 -2
  138. package/dist/behaviors/tree.mjs +38 -15
  139. package/dist/behaviors/upload.mjs +21 -23
  140. package/dist/cli.mjs +1 -1
  141. package/dist/components/ai-branch.mjs +3 -0
  142. package/dist/components/ai-chat.css +295 -0
  143. package/dist/components/ai-feedback.mjs +3 -0
  144. package/dist/components/ai-panel.css +218 -1
  145. package/dist/components/ai-threads.mjs +3 -0
  146. package/dist/components/ai-tool-call.mjs +1 -1
  147. package/dist/components/badge.css +1 -1
  148. package/dist/components/breadcrumb.css +0 -32
  149. package/dist/components/chart-calendar.mjs +1 -2
  150. package/dist/components/chart-graph.css +57 -0
  151. package/dist/components/chart-graph.mjs +4 -0
  152. package/dist/components/chart-map.mjs +3 -0
  153. package/dist/components/chart-pie.css +0 -6
  154. package/dist/components/chart-scatter.mjs +1 -1
  155. package/dist/components/charts.css +33 -1
  156. package/dist/components/charts.mjs +1 -0
  157. package/dist/components/content.css +3 -16
  158. package/dist/components/datatable.css +1 -1
  159. package/dist/components/date-picker.css +1 -1
  160. package/dist/components/kb-access.mjs +4 -0
  161. package/dist/components/kb-acl.mjs +4 -0
  162. package/dist/components/kb-agent.css +481 -0
  163. package/dist/components/kb-answer.mjs +4 -0
  164. package/dist/components/kb-audit.mjs +4 -0
  165. package/dist/components/kb-canvas.mjs +4 -0
  166. package/dist/components/kb-chain.mjs +4 -0
  167. package/dist/components/kb-checkpoint.mjs +4 -0
  168. package/dist/components/kb-chunks.mjs +4 -0
  169. package/dist/components/kb-citation.mjs +4 -0
  170. package/dist/components/kb-clarify.mjs +4 -0
  171. package/dist/components/kb-conflict.mjs +4 -0
  172. package/dist/components/kb-connector.mjs +4 -0
  173. package/dist/components/kb-data.css +649 -0
  174. package/dist/components/kb-eval.mjs +4 -0
  175. package/dist/components/kb-explain.mjs +4 -0
  176. package/dist/components/kb-filter.mjs +4 -0
  177. package/dist/components/kb-gap.mjs +4 -0
  178. package/dist/components/kb-ground.css +566 -0
  179. package/dist/components/kb-hittest.mjs +4 -0
  180. package/dist/components/kb-ingest.css +898 -0
  181. package/dist/components/kb-metadata.mjs +4 -0
  182. package/dist/components/kb-ops.css +548 -0
  183. package/dist/components/kb-passage.mjs +4 -0
  184. package/dist/components/kb-perm.css +444 -0
  185. package/dist/components/kb-pipeline.mjs +4 -0
  186. package/dist/components/kb-qa.mjs +4 -0
  187. package/dist/components/kb-rerank.mjs +4 -0
  188. package/dist/components/kb-retrieval.mjs +4 -0
  189. package/dist/components/kb-review.mjs +4 -0
  190. package/dist/components/kb-sandbox.mjs +4 -0
  191. package/dist/components/kb-search.css +940 -0
  192. package/dist/components/kb-segment.mjs +4 -0
  193. package/dist/components/kb-sources.mjs +4 -0
  194. package/dist/components/kb-sql.mjs +4 -0
  195. package/dist/components/kb-trace.mjs +4 -0
  196. package/dist/components/kb-visibility.mjs +4 -0
  197. package/dist/components/kb-who-can.mjs +4 -0
  198. package/dist/components/kb.css +252 -0
  199. package/dist/components/kb.mjs +9 -0
  200. package/dist/components/notification.css +2 -3
  201. package/dist/components/pagination.css +3 -1
  202. package/dist/components/pagination.mjs +1 -0
  203. package/dist/components/rating.mjs +1 -0
  204. package/dist/components/segmented.css +9 -1
  205. package/dist/components/segmented.mjs +1 -1
  206. package/dist/components/select.css +67 -4
  207. package/dist/components/steps.css +13 -3
  208. package/dist/components/steps.mjs +1 -0
  209. package/dist/components/switch.css +3 -1
  210. package/dist/components/switch.mjs +1 -0
  211. package/dist/components/table.mjs +1 -0
  212. package/dist/components/tabs.css +23 -0
  213. package/dist/components/tag-input.css +1 -6
  214. package/dist/components/upload.css +0 -15
  215. package/dist/index.d.mts +48 -11
  216. package/dist/index.mjs +13205 -3615
  217. package/dist/registry.json +366 -15
  218. package/dist/retro-effects.css +3 -16
  219. package/dist/tokens/retro-effects.css +3 -16
  220. package/dist/tokens/style-profiles.css +3 -2
  221. package/dist/tokens/typography.css +2 -0
  222. package/dist/tokens.css +5 -2
  223. package/dist/ui.css +5713 -267
  224. package/docs/research/2026-10-03-ai-kb-components.md +392 -0
  225. package/docs/research/2026-10-03-kb-permissions.md +992 -0
  226. package/docs/spec/ai-native.md +7 -4
  227. package/docs/spec/kb-family.md +443 -0
  228. package/package.json +2 -2
@@ -0,0 +1,898 @@
1
+ /*
2
+ * @icen.ai/ui — kb-ingest.css(摄取域:kb-pipeline / kb-chunks / kb-segment / kb-connector / kb-metadata / kb-qa)
3
+ *
4
+ * 共享原语在 kb.css(.kb-row/.kb-dot/.kb-fold-head/.kb-chip/.kb-num/.kb-meta/.kb-badge/.kb-empty/.kb-notice…),
5
+ * 本文件只做本域专属结构。DOM 契约见 docs/spec/kb-family.md §5.5–5.10 与各 behavior 头注释。
6
+ *
7
+ * 域内纪律(spec §2):
8
+ * - 摄取域=中性行 + 状态色只给状态点与徽标(连线/边框一律层级色)
9
+ * - 数字 .kb-num;元信息 .kb-meta;材料 bg → bg-soft 两档;圆角 --radius-md(容器)/ --radius-sm(行内)
10
+ * - 动效 ≤240ms ease-out;运行脉冲交给 kb.css .kb-dot.is-live;reduced-motion 全退化为瞬时
11
+ * - 域自持控件基元:.kb-btn(钮)/ .kb-input(输入)/ .kb-seg(mini segmented),不依赖库内其他 css
12
+ * - 只消费 --token-* / --radius-* / --font-mono,附缺省回退,可独立安装
13
+ */
14
+
15
+ /* ══════════════ 域自持控件基元(.kb-btn / .kb-input / .kb-seg) ══════════════ */
16
+
17
+ .kb-btn {
18
+ display: inline-flex;
19
+ align-items: center;
20
+ gap: 5px;
21
+ padding: 3px 10px;
22
+ border: 1px solid var(--token-line-soft);
23
+ border-radius: var(--radius-sm, 6px);
24
+ background: var(--token-bg-soft);
25
+ color: var(--token-text-muted);
26
+ font: inherit;
27
+ font-size: 12px;
28
+ line-height: 1.5;
29
+ white-space: nowrap;
30
+ cursor: pointer;
31
+ transition:
32
+ color 0.16s ease-out,
33
+ border-color 0.16s ease-out,
34
+ background-color 0.16s ease-out;
35
+ }
36
+ .kb-btn:hover {
37
+ color: var(--token-text);
38
+ border-color: var(--token-line);
39
+ }
40
+ .kb-btn:focus-visible {
41
+ outline: 2px solid var(--token-accent);
42
+ outline-offset: 1px;
43
+ }
44
+ .kb-btn:disabled,
45
+ .kb-btn[aria-disabled='true'] {
46
+ opacity: 0.5;
47
+ cursor: not-allowed;
48
+ }
49
+ .kb-btn svg {
50
+ width: 13px;
51
+ height: 13px;
52
+ flex: 0 0 auto;
53
+ }
54
+
55
+ .kb-input {
56
+ box-sizing: border-box;
57
+ min-width: 0;
58
+ padding: 3px 8px;
59
+ border: 1px solid var(--token-line-soft);
60
+ border-radius: var(--radius-sm, 6px);
61
+ background: var(--token-bg);
62
+ color: var(--token-text);
63
+ font: inherit;
64
+ font-size: 12.5px;
65
+ line-height: 1.5;
66
+ transition: border-color 0.16s ease-out;
67
+ }
68
+ .kb-input::placeholder {
69
+ color: var(--token-text-faint);
70
+ }
71
+ .kb-input:focus {
72
+ outline: none;
73
+ border-color: var(--token-accent);
74
+ }
75
+ .kb-input[aria-invalid='true'] {
76
+ border-color: var(--token-danger, var(--token-error));
77
+ }
78
+ .kb-input--mono {
79
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
80
+ font-size: 12px;
81
+ }
82
+
83
+ .kb-seg {
84
+ display: inline-flex;
85
+ gap: 2px;
86
+ padding: 2px;
87
+ border: 1px solid var(--token-line-soft);
88
+ border-radius: var(--radius-sm, 6px);
89
+ background: var(--token-bg-soft);
90
+ }
91
+ .kb-seg-item {
92
+ border: none;
93
+ background: none;
94
+ padding: 2px 10px;
95
+ border-radius: calc(var(--radius-sm, 6px) - 2px);
96
+ font: inherit;
97
+ font-size: 12px;
98
+ line-height: 1.5;
99
+ color: var(--token-text-muted);
100
+ cursor: pointer;
101
+ transition:
102
+ color 0.16s ease-out,
103
+ background-color 0.16s ease-out;
104
+ }
105
+ .kb-seg-item:hover {
106
+ color: var(--token-text);
107
+ }
108
+ .kb-seg-item.is-active {
109
+ background: var(--token-bg);
110
+ color: var(--token-text);
111
+ box-shadow: 0 0 0 1px var(--token-line-soft);
112
+ }
113
+ .kb-seg-item:focus-visible {
114
+ outline: 2px solid var(--token-accent);
115
+ outline-offset: -2px;
116
+ }
117
+ .kb-seg-item:disabled {
118
+ opacity: 0.45;
119
+ cursor: not-allowed;
120
+ }
121
+
122
+ /* ══════════════ kb-pipeline · 解析管线时间线(§5.5) ══════════════ */
123
+
124
+ .kb-pipeline {
125
+ border: 1px solid var(--token-line-soft);
126
+ border-radius: var(--radius-md, 10px);
127
+ background: var(--token-bg-soft);
128
+ padding: 6px 8px;
129
+ min-width: 0;
130
+ }
131
+ .kb-pipeline-list {
132
+ display: flex;
133
+ flex-direction: column;
134
+ gap: 10px;
135
+ min-width: 0;
136
+ }
137
+
138
+ .kb-pipeline-head {
139
+ display: flex;
140
+ align-items: center;
141
+ gap: 6px;
142
+ min-width: 0;
143
+ }
144
+ .kb-pipeline-head > .kb-pipeline-toggle {
145
+ flex: 1 1 auto;
146
+ min-width: 0;
147
+ }
148
+ .kb-pipeline-head > .kb-pipeline-rerun {
149
+ flex: 0 0 auto;
150
+ }
151
+
152
+ /* 头部状态徽章:状态色只落在徽章(点由 .kb-dot 承担) */
153
+ .kb-pipeline-state {
154
+ display: inline-flex;
155
+ align-items: center;
156
+ gap: 5px;
157
+ flex: 0 0 auto;
158
+ font-size: 11.5px;
159
+ color: var(--token-text-faint);
160
+ }
161
+ .kb-pipeline-state.is-running .kb-pipeline-state-label { color: var(--token-accent); }
162
+ .kb-pipeline-state.is-done .kb-pipeline-state-label { color: var(--token-success); }
163
+ .kb-pipeline-state.is-fail .kb-pipeline-state-label { color: var(--token-danger, var(--token-error)); }
164
+ .kb-pipeline-state.is-cancel .kb-pipeline-state-label { color: var(--token-text-muted); }
165
+
166
+ .kb-pipeline-title {
167
+ flex: 1 1 auto;
168
+ min-width: 0;
169
+ color: var(--token-text);
170
+ font-size: 13px;
171
+ overflow: hidden;
172
+ text-overflow: ellipsis;
173
+ white-space: nowrap;
174
+ }
175
+
176
+ /* 可选细粒度进度条(run.progress 定义时出现):3px 细线,与上下内容各留 8px */
177
+ .kb-pipeline-progress {
178
+ height: 3px;
179
+ margin: 8px;
180
+ border-radius: 2px;
181
+ background: var(--token-line-soft);
182
+ overflow: hidden;
183
+ }
184
+ .kb-pipeline-progress > i {
185
+ display: block;
186
+ height: 100%;
187
+ border-radius: 2px;
188
+ background: var(--token-accent);
189
+ opacity: 0.7;
190
+ transition: width 0.24s ease-out;
191
+ }
192
+
193
+ /* 步骤时间线:纵向连线(层级色,不给状态色) */
194
+ .kb-pipeline-steps {
195
+ list-style: none;
196
+ margin: 4px 0 0;
197
+ padding: 0 0 0 6px;
198
+ display: flex;
199
+ flex-direction: column;
200
+ gap: 2px;
201
+ min-width: 0;
202
+ }
203
+ .kb-pipeline-step {
204
+ position: relative;
205
+ display: flex;
206
+ align-items: center;
207
+ gap: 8px;
208
+ min-height: 26px;
209
+ padding: 1px 2px;
210
+ border-radius: var(--radius-sm, 6px);
211
+ }
212
+ .kb-pipeline-step:not(:last-child)::before {
213
+ content: '';
214
+ position: absolute;
215
+ left: 6.5px;
216
+ top: 15px;
217
+ bottom: -5px;
218
+ width: 1px;
219
+ background: var(--token-line-soft);
220
+ }
221
+ .kb-pipeline-step > .kb-dot {
222
+ position: relative;
223
+ z-index: 1;
224
+ flex: 0 0 auto;
225
+ }
226
+ .kb-pipeline-step-label {
227
+ font-size: 12.5px;
228
+ color: var(--token-text);
229
+ white-space: nowrap;
230
+ }
231
+ .kb-step-detail {
232
+ font-size: 11.5px;
233
+ color: var(--token-text-faint);
234
+ overflow: hidden;
235
+ text-overflow: ellipsis;
236
+ white-space: nowrap;
237
+ min-width: 0;
238
+ }
239
+ /* 状态映射:未开始/排队/取消 中性弱化;进行中 accent;完成 muted;失败 danger */
240
+ .kb-pipeline-step.is-unstart .kb-pipeline-step-label,
241
+ .kb-pipeline-step.is-queued .kb-pipeline-step-label { color: var(--token-text-faint); }
242
+ .kb-pipeline-step.is-running .kb-pipeline-step-label { color: var(--token-accent); }
243
+ .kb-pipeline-step.is-done .kb-pipeline-step-label { color: var(--token-text-muted); }
244
+ .kb-pipeline-step.is-cancel .kb-pipeline-step-label {
245
+ color: var(--token-text-faint);
246
+ text-decoration: line-through;
247
+ }
248
+ .kb-pipeline-step.is-fail .kb-pipeline-step-label { color: var(--token-danger, var(--token-error)); }
249
+ .kb-pipeline-step-elapsed {
250
+ margin-left: auto;
251
+ flex: 0 0 auto;
252
+ }
253
+
254
+ /* 失败错误区:阶段定位 + 原因(fail 时随 body 展开) */
255
+ .kb-pipeline-error {
256
+ display: flex;
257
+ align-items: flex-start;
258
+ gap: 8px;
259
+ margin-top: 8px;
260
+ padding: 8px 10px;
261
+ border-radius: var(--radius-sm, 6px);
262
+ background: color-mix(in srgb, var(--token-danger, var(--token-error)) 7%, transparent);
263
+ }
264
+ .kb-pipeline-error > svg {
265
+ width: 13px;
266
+ height: 13px;
267
+ flex: 0 0 auto;
268
+ color: var(--token-danger, var(--token-error));
269
+ margin-top: 2px;
270
+ }
271
+ .kb-pipeline-error-stage {
272
+ flex: 0 0 auto;
273
+ font-family: var(--font-mono, ui-monospace, monospace);
274
+ font-size: 11.5px;
275
+ font-weight: 600;
276
+ color: var(--token-danger, var(--token-error));
277
+ }
278
+ .kb-pipeline-error-msg {
279
+ flex: 1 1 auto;
280
+ min-width: 0;
281
+ font-size: 12px;
282
+ line-height: 1.6;
283
+ color: var(--token-text-muted);
284
+ }
285
+
286
+ /* ══════════════ kb-chunks · chunk 编辑器(§5.6) ══════════════ */
287
+
288
+ .kb-chunks {
289
+ display: flex;
290
+ flex-direction: column;
291
+ gap: 10px;
292
+ min-width: 0;
293
+ }
294
+ .kb-chunks-bar {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 8px;
298
+ flex-wrap: wrap;
299
+ }
300
+ .kb-chunks-bar .kb-chunks-mode {
301
+ flex: 0 0 auto;
302
+ }
303
+ .kb-chunks-bar .kb-chunks-search {
304
+ flex: 1 1 auto;
305
+ min-width: 140px;
306
+ }
307
+ .kb-chunks-bar .kb-chunks-add {
308
+ flex: 0 0 auto;
309
+ }
310
+
311
+ .kb-chunk-list {
312
+ display: flex;
313
+ flex-direction: column;
314
+ gap: 8px;
315
+ min-width: 0;
316
+ }
317
+
318
+ .kb-chunk {
319
+ display: grid;
320
+ grid-template-columns: auto minmax(0, 1fr) auto;
321
+ align-items: start;
322
+ gap: 10px;
323
+ padding: 8px 10px;
324
+ border: 1px solid var(--token-line-soft);
325
+ border-radius: var(--radius-md, 10px);
326
+ background: var(--token-bg-soft);
327
+ transition: opacity 0.16s ease-out;
328
+ }
329
+ /* available=false:不删除但排除出检索 → 整体降透明度 */
330
+ .kb-chunk.is-off {
331
+ opacity: 0.55;
332
+ }
333
+
334
+ /* 启用开关(kb 域自持,无 switch.css 依赖) */
335
+ .kb-chunk-switch {
336
+ display: inline-flex;
337
+ align-items: center;
338
+ gap: 6px;
339
+ margin-top: 2px;
340
+ font-size: 11.5px;
341
+ color: var(--token-text-faint);
342
+ cursor: pointer;
343
+ user-select: none;
344
+ }
345
+ .kb-chunk-switch input {
346
+ position: absolute;
347
+ width: 0;
348
+ height: 0;
349
+ opacity: 0;
350
+ }
351
+ .kb-chunk-switch-track {
352
+ position: relative;
353
+ flex: 0 0 auto;
354
+ width: 26px;
355
+ height: 15px;
356
+ border-radius: 999px;
357
+ background: var(--token-line-soft);
358
+ transition: background-color 0.16s ease-out;
359
+ }
360
+ .kb-chunk-switch-thumb {
361
+ position: absolute;
362
+ top: 2px;
363
+ left: 2px;
364
+ width: 11px;
365
+ height: 11px;
366
+ border-radius: 50%;
367
+ background: var(--token-bg);
368
+ box-shadow: 0 0 0 1px var(--token-line-soft);
369
+ transition: transform 0.16s ease-out;
370
+ }
371
+ .kb-chunk-switch input:checked + .kb-chunk-switch-track {
372
+ background: var(--token-success);
373
+ }
374
+ .kb-chunk-switch input:checked + .kb-chunk-switch-track > .kb-chunk-switch-thumb {
375
+ transform: translateX(11px);
376
+ }
377
+ .kb-chunk-switch input:focus-visible + .kb-chunk-switch-track {
378
+ outline: 2px solid var(--token-accent);
379
+ outline-offset: 1px;
380
+ }
381
+
382
+ .kb-chunk-main {
383
+ display: flex;
384
+ flex-direction: column;
385
+ gap: 5px;
386
+ min-width: 0;
387
+ }
388
+ /* 行内编辑:静默无边,编辑态(focus)边框 accent */
389
+ .kb-chunk-content {
390
+ padding: 2px 6px;
391
+ margin: 0 -6px;
392
+ border: 1px solid transparent;
393
+ border-radius: var(--radius-sm, 6px);
394
+ font-size: 12.5px;
395
+ line-height: 1.7;
396
+ color: var(--token-text);
397
+ white-space: pre-wrap;
398
+ word-break: break-word;
399
+ transition: border-color 0.16s ease-out, background-color 0.16s ease-out;
400
+ }
401
+ .kb-chunk-content:focus {
402
+ outline: none;
403
+ border-color: var(--token-accent);
404
+ background: var(--token-bg);
405
+ }
406
+
407
+ .kb-chunk-keywords {
408
+ display: flex;
409
+ align-items: center;
410
+ flex-wrap: wrap;
411
+ gap: 4px;
412
+ min-width: 0;
413
+ }
414
+ .kb-chunk-keyword-x {
415
+ border: none;
416
+ background: none;
417
+ padding: 0 0 0 3px;
418
+ font: inherit;
419
+ font-size: 12px;
420
+ line-height: 1;
421
+ color: var(--token-text-faint);
422
+ cursor: pointer;
423
+ }
424
+ .kb-chunk-keyword-x:hover {
425
+ color: var(--token-danger, var(--token-error));
426
+ }
427
+ .kb-chunk-keyword-x:focus-visible {
428
+ outline: 2px solid var(--token-accent);
429
+ outline-offset: 1px;
430
+ }
431
+ .kb-chunk-keyword-input {
432
+ border: none;
433
+ background: none;
434
+ outline: none;
435
+ padding: 2px 4px;
436
+ width: 96px;
437
+ font-family: var(--font-mono, ui-monospace, monospace);
438
+ font-size: 11px;
439
+ color: var(--token-text);
440
+ }
441
+ .kb-chunk-keyword-input::placeholder {
442
+ color: var(--token-text-faint);
443
+ }
444
+
445
+ .kb-chunk-meta {
446
+ color: var(--token-text-faint);
447
+ }
448
+ .kb-chunk-edited-flag {
449
+ color: var(--token-warning);
450
+ }
451
+
452
+ /* ══════════════ kb-segment · 分段策略 + 实时预览(§5.7) ══════════════ */
453
+
454
+ .kb-segment-host {
455
+ min-width: 0;
456
+ }
457
+ .kb-segment {
458
+ display: grid;
459
+ grid-template-columns: minmax(260px, 5fr) minmax(0, 7fr);
460
+ gap: 16px;
461
+ min-width: 0;
462
+ }
463
+ @media (max-width: 720px) {
464
+ .kb-segment {
465
+ grid-template-columns: minmax(0, 1fr);
466
+ }
467
+ }
468
+
469
+ .kb-segment-form {
470
+ display: flex;
471
+ flex-direction: column;
472
+ gap: 10px;
473
+ min-width: 0;
474
+ }
475
+ .kb-segment-locked {
476
+ color: var(--token-warning);
477
+ }
478
+ .kb-segment-locked svg {
479
+ color: var(--token-warning);
480
+ }
481
+ .kb-field {
482
+ display: flex;
483
+ flex-direction: column;
484
+ gap: 4px;
485
+ min-width: 0;
486
+ }
487
+ .kb-field > .kb-field-label {
488
+ font-size: 11.5px;
489
+ color: var(--token-text-faint);
490
+ }
491
+ .kb-field > .kb-input {
492
+ width: 100%;
493
+ }
494
+ .kb-segment-overlap-error {
495
+ margin-top: -4px;
496
+ color: var(--token-danger, var(--token-error));
497
+ }
498
+ .kb-segment-clean {
499
+ display: flex;
500
+ flex-wrap: wrap;
501
+ gap: 6px 14px;
502
+ }
503
+ .kb-segment-clean-item {
504
+ display: inline-flex;
505
+ align-items: center;
506
+ gap: 5px;
507
+ font-size: 12px;
508
+ color: var(--token-text-muted);
509
+ cursor: pointer;
510
+ user-select: none;
511
+ }
512
+ .kb-segment-clean-item input {
513
+ accent-color: var(--token-accent);
514
+ margin: 0;
515
+ }
516
+
517
+ .kb-segment-preview {
518
+ display: flex;
519
+ flex-direction: column;
520
+ gap: 8px;
521
+ padding: 10px;
522
+ border: 1px solid var(--token-line-soft);
523
+ border-radius: var(--radius-md, 10px);
524
+ background: var(--token-bg);
525
+ min-width: 0;
526
+ min-height: 0;
527
+ }
528
+ .kb-segment-stats {
529
+ display: flex;
530
+ align-items: baseline;
531
+ gap: 12px;
532
+ flex-wrap: wrap;
533
+ }
534
+ .kb-segment-stat {
535
+ font-size: 12.5px;
536
+ color: var(--token-text);
537
+ }
538
+ .kb-segment-blocks {
539
+ display: flex;
540
+ flex-direction: column;
541
+ gap: 6px;
542
+ min-width: 0;
543
+ min-height: 0;
544
+ max-height: 480px;
545
+ overflow-y: auto;
546
+ }
547
+ .kb-segment-block {
548
+ display: grid;
549
+ grid-template-columns: auto minmax(0, 1fr);
550
+ gap: 8px;
551
+ padding: 6px 8px;
552
+ border: 1px solid var(--token-line-soft);
553
+ border-radius: var(--radius-sm, 6px);
554
+ background: var(--token-bg-soft);
555
+ }
556
+ .kb-segment-block-no {
557
+ color: var(--token-text-faint);
558
+ }
559
+ /* 内容截断 200px,点击展开(渐进披露) */
560
+ .kb-segment-block-text {
561
+ max-height: 200px;
562
+ overflow: hidden;
563
+ font-size: 12.5px;
564
+ line-height: 1.7;
565
+ color: var(--token-text-muted);
566
+ white-space: pre-wrap;
567
+ word-break: break-word;
568
+ cursor: pointer;
569
+ transition: max-height 0.16s ease-out;
570
+ }
571
+ .kb-segment-block-text.is-open {
572
+ max-height: none;
573
+ }
574
+ .kb-segment-block-text:focus-visible {
575
+ outline: 2px solid var(--token-accent);
576
+ outline-offset: 1px;
577
+ }
578
+
579
+ /* ══════════════ kb-connector · 连接器卡(§5.8) ══════════════ */
580
+
581
+ .kb-connector-grid {
582
+ display: grid;
583
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
584
+ gap: 12px;
585
+ min-width: 0;
586
+ }
587
+
588
+ .kb-connector {
589
+ display: flex;
590
+ flex-direction: column;
591
+ gap: 8px;
592
+ padding: 10px 12px 10px 14px;
593
+ border: 1px solid var(--token-line-soft);
594
+ border-left: 2px solid var(--token-line-soft);
595
+ border-radius: var(--radius-md, 10px);
596
+ background: var(--token-bg-soft);
597
+ min-width: 0;
598
+ }
599
+ /* 健康左缘 2px 色条(connectorHealth 判定;色只在此与状态点上) */
600
+ .kb-connector.is-healthy { border-left-color: var(--token-success); }
601
+ .kb-connector.is-stale { border-left-color: var(--token-warning); }
602
+ .kb-connector.is-failing { border-left-color: var(--token-danger, var(--token-error)); }
603
+ .kb-connector.is-off { border-left-color: var(--token-line); }
604
+
605
+ .kb-connector-head {
606
+ display: flex;
607
+ align-items: center;
608
+ gap: 8px;
609
+ min-width: 0;
610
+ }
611
+ /* .kb-source-icon 基元归 kb-ground.css;本域兜底一份最小骨架(同名同义,共存不冲突) */
612
+ .kb-connector-head .kb-source-icon {
613
+ flex: 0 0 auto;
614
+ display: inline-flex;
615
+ color: var(--token-text-muted);
616
+ }
617
+ .kb-connector-head .kb-source-icon svg {
618
+ width: 16px;
619
+ height: 16px;
620
+ }
621
+ .kb-connector-main {
622
+ flex: 1 1 auto;
623
+ min-width: 0;
624
+ display: flex;
625
+ flex-direction: column;
626
+ gap: 1px;
627
+ }
628
+ .kb-connector-name {
629
+ font-size: 13px;
630
+ font-weight: 600;
631
+ color: var(--token-text);
632
+ overflow: hidden;
633
+ text-overflow: ellipsis;
634
+ white-space: nowrap;
635
+ }
636
+ .kb-connector-sub {
637
+ font-size: 11.5px;
638
+ color: var(--token-text-faint);
639
+ overflow: hidden;
640
+ text-overflow: ellipsis;
641
+ white-space: nowrap;
642
+ }
643
+ /* 同步计划:mono 不换行(cron 原值包 .kb-chip;人类可读文本 .kb-meta)——绝不散点裸渲 */
644
+ .kb-connector-schedule {
645
+ flex: 0 0 auto;
646
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
647
+ white-space: nowrap;
648
+ }
649
+
650
+ /* 指标区:CSS grid 两列对齐(label 11px faint 左、value .kb-num 右,同列基线) */
651
+ .kb-connector-metrics {
652
+ display: grid;
653
+ grid-template-columns: repeat(2, minmax(0, 1fr));
654
+ gap: 6px 12px;
655
+ }
656
+ .kb-connector-signal {
657
+ display: flex;
658
+ align-items: baseline;
659
+ gap: 6px;
660
+ min-width: 0;
661
+ min-height: 22px;
662
+ }
663
+ /* 健康状态点与文字基线并排时垂直居中,避免点悬浮 */
664
+ .kb-connector-signal .kb-dot {
665
+ align-self: center;
666
+ }
667
+ .kb-connector-signal-label {
668
+ flex: 0 0 auto;
669
+ font-size: 11px;
670
+ color: var(--token-text-faint);
671
+ }
672
+ .kb-connector-signal-value {
673
+ flex: 1 1 auto;
674
+ min-width: 0;
675
+ margin-left: auto;
676
+ font-size: 12px;
677
+ color: var(--token-text);
678
+ text-align: right;
679
+ overflow: hidden;
680
+ text-overflow: ellipsis;
681
+ white-space: nowrap;
682
+ }
683
+ /* 凭证与指标同排版(文字值右对齐同列),仅以颜色区分:过期 = error 红与 failing 一致,未配置 warning,正常 muted */
684
+ .kb-connector-cred.is-expired {
685
+ color: var(--token-danger, var(--token-error));
686
+ font-weight: 500;
687
+ }
688
+ .kb-connector-cred.is-none {
689
+ color: var(--token-warning);
690
+ }
691
+ .kb-connector-cred.is-ok {
692
+ color: var(--token-text-muted);
693
+ }
694
+
695
+ .kb-connector-foot {
696
+ display: flex;
697
+ align-items: center;
698
+ justify-content: space-between;
699
+ gap: 8px;
700
+ padding-top: 8px;
701
+ border-top: 1px solid var(--token-line-soft);
702
+ flex-wrap: wrap;
703
+ }
704
+ .kb-connector-actions {
705
+ display: inline-flex;
706
+ align-items: center;
707
+ gap: 6px;
708
+ flex-wrap: wrap;
709
+ }
710
+ .kb-connector-actions .kb-btn {
711
+ padding: 2px 8px;
712
+ font-size: 11.5px;
713
+ }
714
+
715
+ /* ══════════════ kb-metadata · 元数据管理(§5.9) ══════════════ */
716
+
717
+ .kb-metadata {
718
+ min-width: 0;
719
+ }
720
+ .kb-metadata-table {
721
+ width: 100%;
722
+ border-collapse: collapse;
723
+ table-layout: fixed;
724
+ }
725
+ .kb-metadata-th {
726
+ padding: 4px 8px;
727
+ border-bottom: 1px solid var(--token-line-soft);
728
+ font-size: 11.5px;
729
+ font-weight: 500;
730
+ color: var(--token-text-faint);
731
+ text-align: left;
732
+ white-space: nowrap;
733
+ }
734
+ .kb-metadata-th:nth-child(1) { width: 32%; }
735
+ .kb-metadata-th:nth-child(2) { width: 84px; }
736
+ .kb-metadata-th:nth-child(4) { width: 60px; }
737
+ .kb-metadata-row > td {
738
+ padding: 4px 8px;
739
+ border-bottom: 1px solid var(--token-line-soft);
740
+ font-size: 12.5px;
741
+ vertical-align: middle;
742
+ overflow: hidden;
743
+ text-overflow: ellipsis;
744
+ white-space: nowrap;
745
+ }
746
+ .kb-metadata-row:hover > td {
747
+ background: var(--token-bg-soft);
748
+ }
749
+ .kb-metadata-key {
750
+ font-family: var(--font-mono, ui-monospace, monospace);
751
+ font-size: 12px;
752
+ color: var(--token-text);
753
+ }
754
+ .kb-metadata-key-label {
755
+ font-size: 11px;
756
+ color: var(--token-text-faint);
757
+ }
758
+ .kb-metadata-builtin-flag {
759
+ margin-left: 6px;
760
+ font-size: 10.5px;
761
+ color: var(--token-text-faint);
762
+ border: 1px solid var(--token-line-soft);
763
+ border-radius: 999px;
764
+ padding: 1px 6px;
765
+ }
766
+ .kb-metadata-type {
767
+ font-family: var(--font-mono, ui-monospace, monospace);
768
+ }
769
+ .kb-metadata-readonly {
770
+ color: var(--token-text-muted);
771
+ }
772
+ .kb-metadata-value .kb-input {
773
+ width: 100%;
774
+ }
775
+ .kb-metadata-ops {
776
+ text-align: right;
777
+ }
778
+ .kb-metadata-ops .kb-btn {
779
+ padding: 1px 8px;
780
+ font-size: 11.5px;
781
+ }
782
+ .kb-metadata-empty {
783
+ padding: 18px 8px !important;
784
+ text-align: center;
785
+ color: var(--token-text-faint);
786
+ white-space: normal !important;
787
+ }
788
+ .kb-metadata-new {
789
+ display: flex;
790
+ align-items: center;
791
+ gap: 8px;
792
+ flex-wrap: wrap;
793
+ margin-top: 10px;
794
+ }
795
+ .kb-metadata-new .kb-metadata-new-key {
796
+ width: 220px;
797
+ }
798
+
799
+ /* ══════════════ kb-qa · 认证问答对编辑器(§5.10) ══════════════ */
800
+
801
+ .kb-qa {
802
+ min-width: 0;
803
+ }
804
+ .kb-qa-bar {
805
+ display: flex;
806
+ align-items: center;
807
+ gap: 8px;
808
+ flex-wrap: wrap;
809
+ margin-bottom: 8px;
810
+ }
811
+ .kb-qa-bar .kb-qa-hint {
812
+ flex: 1 1 auto;
813
+ min-width: 0;
814
+ overflow: hidden;
815
+ text-overflow: ellipsis;
816
+ }
817
+ .kb-qa-table {
818
+ width: 100%;
819
+ border-collapse: collapse;
820
+ table-layout: fixed;
821
+ }
822
+ .kb-qa-th {
823
+ padding: 4px 8px;
824
+ border-bottom: 1px solid var(--token-line-soft);
825
+ font-size: 11.5px;
826
+ font-weight: 500;
827
+ color: var(--token-text-faint);
828
+ text-align: left;
829
+ white-space: nowrap;
830
+ }
831
+ .kb-qa-th:nth-child(1) { width: 44%; }
832
+ .kb-qa-th:nth-child(2) { width: 44%; }
833
+ .kb-qa-th:nth-child(3) { width: 52px; }
834
+ .kb-qa-row > td {
835
+ padding: 4px 8px;
836
+ border-bottom: 1px solid var(--token-line-soft);
837
+ font-size: 12.5px;
838
+ vertical-align: top;
839
+ }
840
+ .kb-qa-row:hover > td {
841
+ background: var(--token-bg-soft);
842
+ }
843
+ /* 行内编辑格:静默,focus 内描边 accent */
844
+ .kb-qa-q,
845
+ .kb-qa-a {
846
+ outline: none;
847
+ border-radius: var(--radius-sm, 6px);
848
+ padding: 2px 4px;
849
+ margin: -2px -4px;
850
+ line-height: 1.7;
851
+ word-break: break-word;
852
+ transition: box-shadow 0.16s ease-out;
853
+ }
854
+ .kb-qa-q:focus,
855
+ .kb-qa-a:focus {
856
+ box-shadow: inset 0 0 0 1px var(--token-accent);
857
+ }
858
+ .kb-qa-q:empty::before,
859
+ .kb-qa-a:empty::before {
860
+ content: '…';
861
+ color: var(--token-text-faint);
862
+ }
863
+ .kb-qa-ops {
864
+ text-align: right;
865
+ vertical-align: middle;
866
+ }
867
+ .kb-qa-ops .kb-btn {
868
+ padding: 1px 8px;
869
+ font-size: 11.5px;
870
+ }
871
+ .kb-qa-empty {
872
+ padding: 18px 8px !important;
873
+ text-align: center;
874
+ color: var(--token-text-faint);
875
+ }
876
+
877
+ /* ══════════════ 密度 / 动效守卫 ══════════════ */
878
+
879
+ [data-density='compact'] .kb-pipeline-step { min-height: 22px; }
880
+ [data-density='compact'] .kb-chunk { padding: 5px 8px; gap: 8px; }
881
+ [data-density='compact'] .kb-metadata-row > td,
882
+ [data-density='compact'] .kb-qa-row > td { padding-top: 2px; padding-bottom: 2px; }
883
+
884
+ @media (prefers-reduced-motion: reduce) {
885
+ .kb-btn,
886
+ .kb-input,
887
+ .kb-seg-item,
888
+ .kb-chunk,
889
+ .kb-chunk-content,
890
+ .kb-chunk-switch-track,
891
+ .kb-chunk-switch-thumb,
892
+ .kb-pipeline-progress > i,
893
+ .kb-segment-block-text,
894
+ .kb-qa-q,
895
+ .kb-qa-a {
896
+ transition: none;
897
+ }
898
+ }