@icen.ai/ui 0.8.1 → 0.10.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.
- package/AGENTS.md +176 -75
- package/README.md +66 -88
- package/dist/base.css +208 -179
- package/dist/behaviors/accordion.mjs +8 -8
- package/dist/behaviors/ai-branch.d.mts +19 -0
- package/dist/behaviors/ai-branch.mjs +1133 -0
- package/dist/behaviors/ai-chat.d.mts +12 -10
- package/dist/behaviors/ai-chat.mjs +1125 -155
- package/dist/behaviors/ai-composer.d.mts +44 -12
- package/dist/behaviors/ai-composer.mjs +2084 -523
- package/dist/behaviors/ai-core.d.mts +1 -1
- package/dist/behaviors/ai-core.mjs +1016 -107
- package/dist/behaviors/ai-diff.mjs +1019 -127
- package/dist/behaviors/ai-feedback.d.mts +26 -0
- package/dist/behaviors/ai-feedback.mjs +1212 -0
- package/dist/behaviors/ai-panel.d.mts +21 -7
- package/dist/behaviors/ai-panel.mjs +1308 -264
- package/dist/behaviors/ai-provider.mjs +1003 -101
- package/dist/behaviors/ai-threads.d.mts +38 -0
- package/dist/behaviors/ai-threads.mjs +1233 -0
- package/dist/behaviors/ai-tool.d.mts +2 -2
- package/dist/behaviors/ai-tool.mjs +2042 -396
- package/dist/behaviors/ai-tools.d.mts +89 -16
- package/dist/behaviors/ai-tools.mjs +4453 -372
- package/dist/behaviors/autocomplete.d.mts +53 -0
- package/dist/behaviors/autocomplete.mjs +1600 -0
- package/dist/behaviors/back-top.d.mts +1 -1
- package/dist/behaviors/back-top.mjs +951 -14
- package/dist/behaviors/carousel.d.mts +1 -1
- package/dist/behaviors/carousel.mjs +906 -11
- package/dist/behaviors/cascader.d.mts +48 -0
- package/dist/behaviors/cascader.mjs +1853 -0
- package/dist/behaviors/charts.d.mts +174 -8
- package/dist/behaviors/charts.mjs +2632 -192
- package/dist/behaviors/code-block.d.mts +36 -0
- package/dist/behaviors/code-block.mjs +1611 -0
- package/dist/behaviors/command-palette.d.mts +9 -6
- package/dist/behaviors/command-palette.mjs +161 -59
- package/dist/behaviors/context-menu.d.mts +9 -8
- package/dist/behaviors/context-menu.mjs +1112 -44
- package/dist/behaviors/controls.d.mts +13 -13
- package/dist/behaviors/controls.mjs +989 -130
- package/dist/behaviors/copy.d.mts +21 -2
- package/dist/behaviors/copy.mjs +1206 -42
- package/dist/behaviors/datatable.d.mts +53 -3
- package/dist/behaviors/datatable.mjs +1963 -207
- package/dist/behaviors/date-picker.d.mts +0 -1
- package/dist/behaviors/date-picker.mjs +1340 -293
- package/dist/behaviors/design.d.mts +54 -0
- package/dist/behaviors/design.mjs +109 -0
- package/dist/behaviors/dropdown.d.mts +5 -6
- package/dist/behaviors/dropdown.mjs +262 -110
- package/dist/behaviors/events.d.mts +313 -3
- package/dist/behaviors/events.mjs +47 -2
- package/dist/behaviors/feedback.d.mts +30 -0
- package/dist/behaviors/feedback.mjs +296 -0
- package/dist/behaviors/focus.d.mts +8 -0
- package/dist/behaviors/focus.mjs +24 -0
- package/dist/behaviors/form-validate.d.mts +102 -0
- package/dist/behaviors/form-validate.mjs +6091 -0
- package/dist/behaviors/i18n.d.mts +789 -0
- package/dist/behaviors/i18n.mjs +1711 -0
- package/dist/behaviors/icons.d.mts +93 -0
- package/dist/behaviors/icons.mjs +113 -0
- package/dist/behaviors/input.d.mts +9 -1
- package/dist/behaviors/input.mjs +1056 -60
- package/dist/behaviors/kb-access.d.mts +34 -0
- package/dist/behaviors/kb-access.mjs +2459 -0
- package/dist/behaviors/kb-acl.d.mts +50 -0
- package/dist/behaviors/kb-acl.mjs +1345 -0
- package/dist/behaviors/kb-answer.d.mts +38 -0
- package/dist/behaviors/kb-answer.mjs +3707 -0
- package/dist/behaviors/kb-audit.d.mts +23 -0
- package/dist/behaviors/kb-audit.mjs +1297 -0
- package/dist/behaviors/kb-canvas.d.mts +44 -0
- package/dist/behaviors/kb-canvas.mjs +1512 -0
- package/dist/behaviors/kb-chain.d.mts +15 -0
- package/dist/behaviors/kb-chain.mjs +1192 -0
- package/dist/behaviors/kb-checkpoint.d.mts +16 -0
- package/dist/behaviors/kb-checkpoint.mjs +1492 -0
- package/dist/behaviors/kb-chunks.d.mts +31 -0
- package/dist/behaviors/kb-chunks.mjs +1414 -0
- package/dist/behaviors/kb-citation.d.mts +38 -0
- package/dist/behaviors/kb-citation.mjs +1699 -0
- package/dist/behaviors/kb-clarify.d.mts +20 -0
- package/dist/behaviors/kb-clarify.mjs +1176 -0
- package/dist/behaviors/kb-conflict.d.mts +22 -0
- package/dist/behaviors/kb-conflict.mjs +1206 -0
- package/dist/behaviors/kb-connector.d.mts +17 -0
- package/dist/behaviors/kb-connector.mjs +1303 -0
- package/dist/behaviors/kb-core.d.mts +534 -0
- package/dist/behaviors/kb-core.mjs +1805 -0
- package/dist/behaviors/kb-eval.d.mts +22 -0
- package/dist/behaviors/kb-eval.mjs +2235 -0
- package/dist/behaviors/kb-explain.d.mts +11 -0
- package/dist/behaviors/kb-explain.mjs +1165 -0
- package/dist/behaviors/kb-filter.d.mts +31 -0
- package/dist/behaviors/kb-filter.mjs +2417 -0
- package/dist/behaviors/kb-gap.d.mts +27 -0
- package/dist/behaviors/kb-gap.mjs +1195 -0
- package/dist/behaviors/kb-hittest.d.mts +34 -0
- package/dist/behaviors/kb-hittest.mjs +1352 -0
- package/dist/behaviors/kb-metadata.d.mts +29 -0
- package/dist/behaviors/kb-metadata.mjs +1248 -0
- package/dist/behaviors/kb-passage.d.mts +41 -0
- package/dist/behaviors/kb-passage.mjs +1469 -0
- package/dist/behaviors/kb-pipeline.d.mts +18 -0
- package/dist/behaviors/kb-pipeline.mjs +1301 -0
- package/dist/behaviors/kb-qa.d.mts +26 -0
- package/dist/behaviors/kb-qa.mjs +1260 -0
- package/dist/behaviors/kb-rerank.d.mts +20 -0
- package/dist/behaviors/kb-rerank.mjs +1248 -0
- package/dist/behaviors/kb-retrieval.d.mts +49 -0
- package/dist/behaviors/kb-retrieval.mjs +2585 -0
- package/dist/behaviors/kb-review.d.mts +44 -0
- package/dist/behaviors/kb-review.mjs +2282 -0
- package/dist/behaviors/kb-sandbox.d.mts +33 -0
- package/dist/behaviors/kb-sandbox.mjs +1247 -0
- package/dist/behaviors/kb-segment.d.mts +32 -0
- package/dist/behaviors/kb-segment.mjs +1431 -0
- package/dist/behaviors/kb-select.d.mts +24 -0
- package/dist/behaviors/kb-select.mjs +1989 -0
- package/dist/behaviors/kb-sources.d.mts +27 -0
- package/dist/behaviors/kb-sources.mjs +1287 -0
- package/dist/behaviors/kb-sql.d.mts +43 -0
- package/dist/behaviors/kb-sql.mjs +1865 -0
- package/dist/behaviors/kb-trace.d.mts +16 -0
- package/dist/behaviors/kb-trace.mjs +1328 -0
- package/dist/behaviors/kb-visibility.d.mts +44 -0
- package/dist/behaviors/kb-visibility.mjs +1331 -0
- package/dist/behaviors/kb-who-can.d.mts +32 -0
- package/dist/behaviors/kb-who-can.mjs +2216 -0
- package/dist/behaviors/mentions.d.mts +93 -0
- package/dist/behaviors/mentions.mjs +2152 -0
- package/dist/behaviors/modal.d.mts +4 -3
- package/dist/behaviors/modal.mjs +1055 -33
- package/dist/behaviors/nav.d.mts +1 -1
- package/dist/behaviors/nav.mjs +6 -6
- package/dist/behaviors/notification.d.mts +16 -8
- package/dist/behaviors/notification.mjs +1615 -265
- package/dist/behaviors/panel.d.mts +4 -0
- package/dist/behaviors/panel.mjs +994 -0
- package/dist/behaviors/popover.d.mts +28 -5
- package/dist/behaviors/popover.mjs +225 -24
- package/dist/behaviors/select.d.mts +5 -2
- package/dist/behaviors/select.mjs +1410 -117
- package/dist/behaviors/sidebar.d.mts +1 -1
- package/dist/behaviors/sidebar.mjs +13 -13
- package/dist/behaviors/slider.d.mts +1 -1
- package/dist/behaviors/slider.mjs +9 -9
- package/dist/behaviors/split-pane.d.mts +1 -1
- package/dist/behaviors/split-pane.mjs +7 -7
- package/dist/behaviors/suggestions.d.mts +27 -0
- package/dist/behaviors/suggestions.mjs +1089 -0
- package/dist/behaviors/svg-parse.d.mts +14 -0
- package/dist/behaviors/svg-parse.mjs +37 -0
- package/dist/behaviors/tabs.d.mts +2 -2
- package/dist/behaviors/tabs.mjs +25 -25
- package/dist/behaviors/tag-input.d.mts +23 -5
- package/dist/behaviors/tag-input.mjs +1359 -104
- package/dist/behaviors/theme-switcher.d.mts +24 -0
- package/dist/behaviors/theme-switcher.mjs +1981 -0
- package/dist/behaviors/theme.d.mts +15 -8
- package/dist/behaviors/theme.mjs +390 -28
- package/dist/behaviors/toast.d.mts +24 -25
- package/dist/behaviors/toast.mjs +1266 -88
- package/dist/behaviors/tooltip.d.mts +4 -0
- package/dist/behaviors/tooltip.mjs +378 -0
- package/dist/behaviors/tree-select.d.mts +69 -0
- package/dist/behaviors/tree-select.mjs +1907 -0
- package/dist/behaviors/tree.d.mts +1 -1
- package/dist/behaviors/tree.mjs +15 -15
- package/dist/behaviors/upload.d.mts +3 -2
- package/dist/behaviors/upload.mjs +1076 -66
- package/dist/cli.mjs +5 -6
- package/dist/components/ai-branch.mjs +3 -0
- package/dist/components/ai-chat.css +846 -458
- package/dist/components/ai-diff.css +153 -132
- package/dist/components/ai-feedback.mjs +3 -0
- package/dist/components/ai-panel.css +495 -270
- package/dist/components/ai-threads.mjs +3 -0
- package/dist/components/ai-tool.css +393 -238
- package/dist/components/autocomplete.css +61 -0
- package/dist/components/autocomplete.mjs +3 -0
- package/dist/components/back-top.css +34 -31
- package/dist/components/badge.css +44 -41
- package/dist/components/breadcrumb.css +67 -46
- package/dist/components/btn.css +80 -74
- package/dist/components/card.css +117 -106
- package/dist/components/cascader.css +311 -0
- package/dist/components/cascader.mjs +3 -0
- package/dist/components/chart-area.css +8 -2
- package/dist/components/chart-bar.css +95 -33
- package/dist/components/chart-gauge.css +14 -11
- package/dist/components/chart-graph.css +60 -0
- package/dist/components/chart-graph.mjs +4 -0
- package/dist/components/chart-heatmap.css +96 -90
- package/dist/components/chart-line.css +8 -3
- package/dist/components/chart-map.mjs +3 -0
- package/dist/components/chart-pie.css +9 -6
- package/dist/components/chart-radar.css +8 -5
- package/dist/components/chart-scatter.css +9 -6
- package/dist/components/chart-scatter.mjs +1 -1
- package/dist/components/chart-sparkline.css +5 -2
- package/dist/components/chart-stack.css +14 -11
- package/dist/components/charts.css +190 -67
- package/dist/components/charts.mjs +1 -0
- package/dist/components/code-block.css +418 -0
- package/dist/components/code-block.mjs +4 -0
- package/dist/components/command-palette.css +138 -117
- package/dist/components/content.css +257 -251
- package/dist/components/copy.css +72 -44
- package/dist/components/datatable.css +423 -181
- package/dist/components/date-picker.css +135 -104
- package/dist/components/empty.css +68 -65
- package/dist/components/feedback.css +201 -183
- package/dist/components/form-validate.css +120 -0
- package/dist/components/form-validate.mjs +3 -0
- package/dist/components/form.css +150 -127
- package/dist/components/icon.css +102 -0
- package/dist/components/icon.mjs +3 -0
- package/dist/components/input.css +159 -104
- package/dist/components/kb-access.mjs +4 -0
- package/dist/components/kb-acl.mjs +4 -0
- package/dist/components/kb-agent.css +496 -0
- package/dist/components/kb-answer.mjs +4 -0
- package/dist/components/kb-audit.mjs +4 -0
- package/dist/components/kb-canvas.mjs +4 -0
- package/dist/components/kb-chain.mjs +4 -0
- package/dist/components/kb-checkpoint.mjs +4 -0
- package/dist/components/kb-chunks.mjs +4 -0
- package/dist/components/kb-citation.mjs +4 -0
- package/dist/components/kb-clarify.mjs +4 -0
- package/dist/components/kb-conflict.mjs +4 -0
- package/dist/components/kb-connector.mjs +4 -0
- package/dist/components/kb-data.css +653 -0
- package/dist/components/kb-eval.mjs +4 -0
- package/dist/components/kb-explain.mjs +4 -0
- package/dist/components/kb-filter.mjs +4 -0
- package/dist/components/kb-gap.mjs +4 -0
- package/dist/components/kb-ground.css +578 -0
- package/dist/components/kb-hittest.mjs +4 -0
- package/dist/components/kb-ingest.css +882 -0
- package/dist/components/kb-metadata.mjs +4 -0
- package/dist/components/kb-ops.css +554 -0
- package/dist/components/kb-passage.mjs +4 -0
- package/dist/components/kb-perm.css +433 -0
- package/dist/components/kb-pipeline.mjs +4 -0
- package/dist/components/kb-qa.mjs +4 -0
- package/dist/components/kb-rerank.mjs +4 -0
- package/dist/components/kb-retrieval.mjs +4 -0
- package/dist/components/kb-review.mjs +4 -0
- package/dist/components/kb-sandbox.mjs +4 -0
- package/dist/components/kb-search.css +897 -0
- package/dist/components/kb-segment.mjs +4 -0
- package/dist/components/kb-sources.mjs +4 -0
- package/dist/components/kb-sql.mjs +4 -0
- package/dist/components/kb-trace.mjs +4 -0
- package/dist/components/kb-visibility.mjs +4 -0
- package/dist/components/kb-who-can.mjs +4 -0
- package/dist/components/kb.css +263 -0
- package/dist/components/kb.mjs +9 -0
- package/dist/components/layout.css +85 -82
- package/dist/components/material-chinese.css +73 -0
- package/dist/components/material-soviet.css +76 -0
- package/dist/components/material.css +275 -0
- package/dist/components/media.css +220 -166
- package/dist/components/mentions.css +189 -0
- package/dist/components/mentions.mjs +3 -0
- package/dist/components/menu.css +113 -105
- package/dist/components/modal.css +107 -112
- package/dist/components/nav.css +118 -115
- package/dist/components/notification.css +238 -174
- package/dist/components/pagination.css +56 -53
- package/dist/components/panel.css +66 -63
- package/dist/components/panel.mjs +1 -0
- package/dist/components/pill.css +81 -71
- package/dist/components/popover.css +67 -53
- package/dist/components/scroll-area.css +113 -110
- package/dist/components/segmented.css +146 -143
- package/dist/components/select.css +206 -186
- package/dist/components/sidebar.css +137 -127
- package/dist/components/slider.css +117 -114
- package/dist/components/split-pane.css +112 -109
- package/dist/components/stat.css +112 -106
- package/dist/components/steps.css +109 -103
- package/dist/components/switch.css +138 -134
- package/dist/components/table.css +131 -107
- package/dist/components/tabs.css +114 -108
- package/dist/components/tag-input.css +48 -133
- package/dist/components/tag.css +81 -71
- package/dist/components/theme-switcher.css +105 -0
- package/dist/components/theme-switcher.mjs +3 -0
- package/dist/components/toast.css +100 -86
- package/dist/components/toolbar.css +45 -42
- package/dist/components/tooltip.css +102 -43
- package/dist/components/tooltip.mjs +1 -0
- package/dist/components/tree-select.css +416 -0
- package/dist/components/tree-select.mjs +3 -0
- package/dist/components/upload.css +135 -92
- package/dist/fonts/LICENSES/ark-pixel/OFL.txt +96 -0
- package/dist/fonts/LICENSES/cubic-11/OFL.txt +108 -0
- package/dist/fonts/LICENSES/galmuri/LICENSE.txt +93 -0
- package/dist/fonts/OFL.txt +96 -0
- package/dist/fonts/README.md +14 -0
- package/dist/fonts/fusion-pixel-12px-zh-hans.woff2 +0 -0
- package/dist/index.d.mts +64 -15
- package/dist/index.mjs +28049 -8595
- package/dist/react.d.mts +91 -0
- package/dist/react.mjs +8208 -0
- package/dist/registry.json +454 -15
- package/dist/tokens/chinese.css +44 -0
- package/dist/tokens/colors.css +365 -1222
- package/dist/tokens/design.css +109 -0
- package/dist/tokens/dtcg.json +11198 -0
- package/dist/tokens/figma.variables.json +7017 -0
- package/dist/tokens/icon-masks.css +78 -0
- package/dist/tokens/pixel.css +50 -0
- package/dist/tokens/soviet.css +44 -0
- package/dist/tokens/style-profiles.css +36 -547
- package/dist/tokens/themes.json +308 -0
- package/dist/tokens/tokens-studio.json +6728 -0
- package/dist/tokens/typography.css +21 -18
- package/dist/tokens.css +1555 -1801
- package/dist/ui.css +16147 -8597
- package/dist/vue.d.mts +344 -0
- package/dist/vue.mjs +7781 -0
- package/docs/spec/ai-input-experience.md +75 -0
- package/docs/spec/ai-native.md +238 -147
- package/docs/spec/design-philosophy.md +189 -0
- package/docs/spec/design-primitives.md +196 -0
- package/docs/spec/kb-family.md +475 -0
- package/package.json +42 -7
- package/dist/retro-effects.css +0 -255
- package/dist/tokens/retro-effects.css +0 -255
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
export { h, svgIcon } from './ai-core.js';
|
|
2
|
+
|
|
3
|
+
/** 来源类型(内置 10 种;registerKbSourceType 开放扩展,镜像 ai-core 的 kind 注册表) */
|
|
4
|
+
type KbSourceKind = 'doc' | 'web' | 'wiki' | 'sheet' | 'db' | 'ticket' | 'code' | 'api' | 'image' | 'mail';
|
|
5
|
+
interface KbSourceTypeDef {
|
|
6
|
+
label: string;
|
|
7
|
+
/** 单色线性 svg(16×16 viewBox 24 的 path 集,经 svgIcon 消毒) */
|
|
8
|
+
icon: string;
|
|
9
|
+
}
|
|
10
|
+
/** 开放注册来源类型(自定义连接器的图标与名称;覆盖同名内置) */
|
|
11
|
+
declare function registerKbSourceType(name: string, def: KbSourceTypeDef): void;
|
|
12
|
+
declare function unregisterKbSourceType(name: string): void;
|
|
13
|
+
declare function getKbSourceType(name: string | undefined): KbSourceTypeDef;
|
|
14
|
+
declare function listKbSourceTypes(): string[];
|
|
15
|
+
/** 引用定位三分型(Anthropic Citations 契约):span 单位在 kind 上写死,防字符/字节错位 */
|
|
16
|
+
interface KbLocation {
|
|
17
|
+
kind: 'char' | 'page' | 'block';
|
|
18
|
+
start: number;
|
|
19
|
+
end: number;
|
|
20
|
+
/** 仅 char 型需要声明(gemini 字节教训):缺省 char */
|
|
21
|
+
unit?: 'char' | 'byte';
|
|
22
|
+
}
|
|
23
|
+
type KbPermission = 'readable' | 'restricted' | 'requestable';
|
|
24
|
+
type KbScoreKind = 'cosine' | 'dot' | 'ip' | 'l2' | 'bm25' | 'rrf' | 'dbsf' | 'rerank' | 'hybrid';
|
|
25
|
+
/** 引用/来源对象(hover 卡、来源列表、passage 查看器的公共数据单元) */
|
|
26
|
+
interface KbCitation {
|
|
27
|
+
id: string;
|
|
28
|
+
/** 展示编号(来源列表中的 [n];渲染端负责与正文角标对齐) */
|
|
29
|
+
index?: number;
|
|
30
|
+
title: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
kind?: string;
|
|
33
|
+
/** 逐字原文引用(≤150 字符为宜;受限时置空) */
|
|
34
|
+
citedText?: string;
|
|
35
|
+
/** 摘录(列表用,可长于 citedText) */
|
|
36
|
+
snippet?: string;
|
|
37
|
+
date?: string;
|
|
38
|
+
score?: number | null;
|
|
39
|
+
scoreKind?: KbScoreKind;
|
|
40
|
+
official?: boolean;
|
|
41
|
+
permission?: KbPermission;
|
|
42
|
+
/** 文档责任人(企业常见:找谁确认口径) */
|
|
43
|
+
owner?: string;
|
|
44
|
+
loc?: KbLocation;
|
|
45
|
+
documentId?: string;
|
|
46
|
+
/** 被引次数(来源列表排序用) */
|
|
47
|
+
useCount?: number;
|
|
48
|
+
}
|
|
49
|
+
declare function normalizeCitation(raw: KbCitation | Record<string, unknown>): KbCitation;
|
|
50
|
+
/** 正文 `[3]` / `[web:3]` 的切段结果:text 段与编号段交替 */
|
|
51
|
+
interface KbCiteSegment {
|
|
52
|
+
text: string;
|
|
53
|
+
/** 编号段的序号(无则纯文本段) */
|
|
54
|
+
n?: number;
|
|
55
|
+
}
|
|
56
|
+
/** 累积文本切段(流式安全:delta 边界处的 `[3` 自然留在文本段,补全后下一次切段生效) */
|
|
57
|
+
declare function parseInlineCitations(text: string): KbCiteSegment[];
|
|
58
|
+
declare function collectCitationNumbers(text: string): number[];
|
|
59
|
+
declare const KB_SCORE_KINDS: readonly KbScoreKind[];
|
|
60
|
+
/** 该分数语义下「越大越好」还是「越小越好」(跨模型不可比,UI 严禁基数解读) */
|
|
61
|
+
declare function scoreHigherIsBetter(kind: KbScoreKind | undefined): boolean;
|
|
62
|
+
/** null / 非有限 → '—'(无分命中是一等状态,不是异常) */
|
|
63
|
+
declare function formatScore(v: number | null | undefined, digits?: number): string;
|
|
64
|
+
/** 分数条宽度占比(0–100;l2 反向归一;无值返回 null 不渲染条) */
|
|
65
|
+
declare function scorePercent(v: number | null | undefined, kind?: KbScoreKind, max?: number): number | null;
|
|
66
|
+
interface KbChunk {
|
|
67
|
+
id: string;
|
|
68
|
+
documentId: string;
|
|
69
|
+
content: string;
|
|
70
|
+
keywords?: string[];
|
|
71
|
+
/** available=false:不删除但排除出检索(RAGFlow 语义) */
|
|
72
|
+
available: boolean;
|
|
73
|
+
page?: number;
|
|
74
|
+
start?: number;
|
|
75
|
+
end?: number;
|
|
76
|
+
imageId?: string;
|
|
77
|
+
meta?: Record<string, string | number>;
|
|
78
|
+
edited?: boolean;
|
|
79
|
+
}
|
|
80
|
+
declare function normalizeChunk(raw: Record<string, unknown>): KbChunk;
|
|
81
|
+
type KbRunStatus = 'unstart' | 'queued' | 'running' | 'cancel' | 'done' | 'fail';
|
|
82
|
+
declare const KB_RUN_STATUSES: readonly KbRunStatus[];
|
|
83
|
+
declare function kbRunStatusLabel(s: KbRunStatus): string;
|
|
84
|
+
interface KbPipelineStep {
|
|
85
|
+
key: string;
|
|
86
|
+
label: string;
|
|
87
|
+
status: KbRunStatus;
|
|
88
|
+
detail?: string;
|
|
89
|
+
elapsedMs?: number;
|
|
90
|
+
count?: number;
|
|
91
|
+
}
|
|
92
|
+
interface KbPipelineRun {
|
|
93
|
+
documentId: string;
|
|
94
|
+
title?: string;
|
|
95
|
+
status: KbRunStatus;
|
|
96
|
+
/** 0–100(可选:无细粒度进度时缺省,用步骤状态表达) */
|
|
97
|
+
progress?: number;
|
|
98
|
+
steps: KbPipelineStep[];
|
|
99
|
+
chunkCount?: number;
|
|
100
|
+
elapsedMs?: number;
|
|
101
|
+
error?: {
|
|
102
|
+
stage?: string;
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
declare function normalizePipelineRun(raw: Record<string, unknown>): KbPipelineRun;
|
|
107
|
+
interface KbSyncMetrics {
|
|
108
|
+
added?: number;
|
|
109
|
+
updated?: number;
|
|
110
|
+
deleted?: number;
|
|
111
|
+
failed?: number;
|
|
112
|
+
lastSyncAt?: string;
|
|
113
|
+
}
|
|
114
|
+
type KbConnectorHealth = 'healthy' | 'stale' | 'failing' | 'off';
|
|
115
|
+
interface KbConnector {
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
kind?: string;
|
|
119
|
+
scope?: string;
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
lastSyncAt?: string;
|
|
122
|
+
lastCrawlStatus?: 'ok' | 'fail' | 'none';
|
|
123
|
+
itemsSynced?: number;
|
|
124
|
+
/** 24h 抓取速率(条/天) */
|
|
125
|
+
crawlRate?: number;
|
|
126
|
+
/** 变更速率(webhook 健康信号:持续 0 = 变更通道失效) */
|
|
127
|
+
changeRate?: number;
|
|
128
|
+
credential?: 'ok' | 'expired' | 'none';
|
|
129
|
+
schedule?: string;
|
|
130
|
+
metrics?: KbSyncMetrics;
|
|
131
|
+
}
|
|
132
|
+
declare function normalizeConnector(raw: Record<string, unknown>): KbConnector;
|
|
133
|
+
/** 健康判定(不可逆优先级:off < failing < stale < healthy;停滞阈值 24h) */
|
|
134
|
+
declare function connectorHealth(c: KbConnector, now?: Date): KbConnectorHealth;
|
|
135
|
+
type KbCleanOption = 'collapse-blank' | 'strip-url' | 'strip-email';
|
|
136
|
+
declare const KB_CLEAN_OPTIONS: readonly KbCleanOption[];
|
|
137
|
+
interface KbSegmentConfig {
|
|
138
|
+
mode: 'auto' | 'custom' | 'parent-child';
|
|
139
|
+
delimiter?: string;
|
|
140
|
+
maxLength: number;
|
|
141
|
+
overlap: number;
|
|
142
|
+
clean: KbCleanOption[];
|
|
143
|
+
/** 模式创建后锁定(Dify 纪律:模式不可改、参数可调) */
|
|
144
|
+
locked?: boolean;
|
|
145
|
+
}
|
|
146
|
+
declare function normalizeSegmentConfig(raw?: Partial<KbSegmentConfig>): KbSegmentConfig;
|
|
147
|
+
/**
|
|
148
|
+
* 纯函数分段预览(真实切分非估算):清洗 → 分隔符切 → 超长块按 maxLength/overlap 二次切。
|
|
149
|
+
* parent-child 模式返回父段(分隔符级),子段由 maxLength 切分交给渲染端二级展示。
|
|
150
|
+
*/
|
|
151
|
+
declare function segmentText(text: string, config: KbSegmentConfig): string[];
|
|
152
|
+
interface KbSegmentStats {
|
|
153
|
+
count: number;
|
|
154
|
+
avgLength: number;
|
|
155
|
+
/** tokens 粗估(≈ 字符/2,中英混排经验值;标注「≈」) */
|
|
156
|
+
tokensEstimate: number;
|
|
157
|
+
}
|
|
158
|
+
declare function segmentStats(chunks: string[]): KbSegmentStats;
|
|
159
|
+
interface KbRetrievalHit {
|
|
160
|
+
chunkId: string;
|
|
161
|
+
documentId?: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
snippet: string;
|
|
164
|
+
score?: number | null;
|
|
165
|
+
scoreKind?: KbScoreKind;
|
|
166
|
+
/** 分数拆解(Weaviate explainScore 纪律):向量分 / 关键词分占比 */
|
|
167
|
+
vectorPart?: number;
|
|
168
|
+
keywordPart?: number;
|
|
169
|
+
explain?: string;
|
|
170
|
+
page?: number;
|
|
171
|
+
meta?: Record<string, string | number>;
|
|
172
|
+
}
|
|
173
|
+
declare function normalizeHit(raw: Record<string, unknown>): KbRetrievalHit;
|
|
174
|
+
interface KbRetrievalParams {
|
|
175
|
+
topK: number;
|
|
176
|
+
mode: 'vector' | 'keyword' | 'hybrid';
|
|
177
|
+
/** hybrid:语义权重 0–1(1=纯语义) */
|
|
178
|
+
alpha?: number;
|
|
179
|
+
rerank?: boolean;
|
|
180
|
+
rerankModel?: string;
|
|
181
|
+
/** null = 不启用阈值(未启用 rerank 时阈值无效 → 渲染端显示 N/A) */
|
|
182
|
+
threshold?: number | null;
|
|
183
|
+
}
|
|
184
|
+
declare function normalizeRetrievalParams(raw?: Partial<KbRetrievalParams>): KbRetrievalParams;
|
|
185
|
+
/** 检索请求的完整形态(playground 与生产共用同一契约,DSL 可复制) */
|
|
186
|
+
interface KbRetrievalQuery {
|
|
187
|
+
query: string;
|
|
188
|
+
params: KbRetrievalParams;
|
|
189
|
+
filter?: KbFilterNode | null;
|
|
190
|
+
}
|
|
191
|
+
type KbFilterOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'exists';
|
|
192
|
+
declare const KB_FILTER_OPS: readonly KbFilterOp[];
|
|
193
|
+
type KbFilterNode = {
|
|
194
|
+
type: 'group';
|
|
195
|
+
op: 'and' | 'or';
|
|
196
|
+
children: KbFilterNode[];
|
|
197
|
+
} | {
|
|
198
|
+
type: 'rule';
|
|
199
|
+
field: string;
|
|
200
|
+
op: KbFilterOp;
|
|
201
|
+
value?: string | number | boolean | Array<string | number>;
|
|
202
|
+
};
|
|
203
|
+
declare function normalizeFilterNode(raw: unknown): KbFilterNode | null;
|
|
204
|
+
declare function filterToMongo(node: KbFilterNode | null | undefined): Record<string, unknown> | null;
|
|
205
|
+
declare function filterToOData(node: KbFilterNode | null | undefined): string;
|
|
206
|
+
interface KbRerankItem {
|
|
207
|
+
/** 稳定 key(chunk id;rerank 响应的 index 不足以跨请求稳定 join) */
|
|
208
|
+
key: string;
|
|
209
|
+
title?: string;
|
|
210
|
+
before?: {
|
|
211
|
+
rank: number;
|
|
212
|
+
score?: number | null;
|
|
213
|
+
};
|
|
214
|
+
after?: {
|
|
215
|
+
rank: number;
|
|
216
|
+
score?: number | null;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/** 排名变化:正 = 下降 n 位,负 = 上升 n 位(箭头语义由渲染端定) */
|
|
220
|
+
declare function rerankDelta(item: KbRerankItem): number | null;
|
|
221
|
+
interface KbHitTestCase {
|
|
222
|
+
id: string;
|
|
223
|
+
question: string;
|
|
224
|
+
expectedChunkIds?: string[];
|
|
225
|
+
lastHits?: Array<{
|
|
226
|
+
chunkId: string;
|
|
227
|
+
score?: number | null;
|
|
228
|
+
rank?: number;
|
|
229
|
+
}>;
|
|
230
|
+
passed?: boolean;
|
|
231
|
+
pinned?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface KbHitStats {
|
|
234
|
+
total: number;
|
|
235
|
+
passed: number;
|
|
236
|
+
/** 无 case 或未跑过 → null(不是 0) */
|
|
237
|
+
hitRate: number | null;
|
|
238
|
+
avgScore: number | null;
|
|
239
|
+
}
|
|
240
|
+
declare function hitTestStats(cases: KbHitTestCase[]): KbHitStats;
|
|
241
|
+
interface KbSqlQuery {
|
|
242
|
+
sql: string;
|
|
243
|
+
dialect?: string;
|
|
244
|
+
tables?: string[];
|
|
245
|
+
/** SQL 可见性是权限问题(Vanna/Genie 纪律),不是展示偏好 */
|
|
246
|
+
visibility: 'all' | 'admin';
|
|
247
|
+
editable: boolean;
|
|
248
|
+
/** 修正循环:上一版 SQL(存在且报错时渲染 diff 修复卡) */
|
|
249
|
+
prevSql?: string;
|
|
250
|
+
reasoning?: string;
|
|
251
|
+
}
|
|
252
|
+
declare function normalizeSqlQuery(raw: Partial<KbSqlQuery>): KbSqlQuery;
|
|
253
|
+
interface KbQueryResult {
|
|
254
|
+
columns: Array<{
|
|
255
|
+
name: string;
|
|
256
|
+
type?: string;
|
|
257
|
+
}>;
|
|
258
|
+
rows: Array<Array<string | number | null>>;
|
|
259
|
+
totalRows?: number;
|
|
260
|
+
/** 截断是契约不是 bug(WrenAI row-limit 纪律):true 必须显示声明 */
|
|
261
|
+
truncated: boolean;
|
|
262
|
+
limit?: number;
|
|
263
|
+
rowCount: number;
|
|
264
|
+
durationMs?: number;
|
|
265
|
+
exportFormats?: string[];
|
|
266
|
+
}
|
|
267
|
+
declare function normalizeQueryResult(raw: Partial<KbQueryResult>): KbQueryResult;
|
|
268
|
+
interface KbClarification {
|
|
269
|
+
id?: string;
|
|
270
|
+
question: string;
|
|
271
|
+
options: Array<{
|
|
272
|
+
label: string;
|
|
273
|
+
value: string;
|
|
274
|
+
}>;
|
|
275
|
+
/** 为什么反问(弱化展示:口径歧义/缺时间范围…) */
|
|
276
|
+
reason?: string;
|
|
277
|
+
}
|
|
278
|
+
type KbAnswerKind = 'generated' | 'verified';
|
|
279
|
+
interface KbVerifiedVia {
|
|
280
|
+
assetId: string;
|
|
281
|
+
assetType: 'parameterized-query' | 'function' | 'curated';
|
|
282
|
+
note?: string;
|
|
283
|
+
}
|
|
284
|
+
interface KbExplainFact {
|
|
285
|
+
tables?: string[];
|
|
286
|
+
columns?: string[];
|
|
287
|
+
filters?: string[];
|
|
288
|
+
aggregates?: string[];
|
|
289
|
+
/** 命中的指标口径(可深链语义层定义) */
|
|
290
|
+
metrics?: Array<{
|
|
291
|
+
name: string;
|
|
292
|
+
ref?: string;
|
|
293
|
+
}>;
|
|
294
|
+
}
|
|
295
|
+
interface KbPermissionNotice {
|
|
296
|
+
rowLevelPolicy?: string;
|
|
297
|
+
maskedColumns?: string[];
|
|
298
|
+
}
|
|
299
|
+
type KbSpanKind = 'retrieval' | 'generation' | 'rerank' | 'embed' | 'tool' | 'guard' | 'chunk' | 'query' | 'agent';
|
|
300
|
+
declare const KB_SPAN_KINDS: readonly KbSpanKind[];
|
|
301
|
+
declare function kbSpanKindLabel(k: KbSpanKind): string;
|
|
302
|
+
type KbSpanStatus = 'running' | 'done' | 'error' | 'cancel';
|
|
303
|
+
declare const KB_SPAN_STATUSES: readonly KbSpanStatus[];
|
|
304
|
+
interface KbSpan {
|
|
305
|
+
id: string;
|
|
306
|
+
parentId?: string;
|
|
307
|
+
kind: KbSpanKind;
|
|
308
|
+
name: string;
|
|
309
|
+
status: KbSpanStatus;
|
|
310
|
+
startedAt?: number | string;
|
|
311
|
+
elapsedMs?: number;
|
|
312
|
+
detail?: string;
|
|
313
|
+
usage?: {
|
|
314
|
+
inputTokens?: number;
|
|
315
|
+
outputTokens?: number;
|
|
316
|
+
costUsd?: number;
|
|
317
|
+
};
|
|
318
|
+
/** retrieval span 内嵌命中(差异化的核心展示) */
|
|
319
|
+
hits?: KbRetrievalHit[];
|
|
320
|
+
error?: string;
|
|
321
|
+
}
|
|
322
|
+
declare function normalizeSpans(raw: Array<Record<string, unknown>>): KbSpan[];
|
|
323
|
+
interface KbScoreConfig {
|
|
324
|
+
name: string;
|
|
325
|
+
type: 'categorical' | 'numeric';
|
|
326
|
+
/** categorical 的选项(键盘 1–9 对应前 9 项) */
|
|
327
|
+
categories?: string[];
|
|
328
|
+
description?: string;
|
|
329
|
+
}
|
|
330
|
+
interface KbReviewTask {
|
|
331
|
+
id: string;
|
|
332
|
+
target: {
|
|
333
|
+
kind: 'trace' | 'message' | 'answer';
|
|
334
|
+
id: string;
|
|
335
|
+
label?: string;
|
|
336
|
+
};
|
|
337
|
+
status: 'open' | 'done';
|
|
338
|
+
assignee?: string;
|
|
339
|
+
scores?: Array<{
|
|
340
|
+
name: string;
|
|
341
|
+
value: string | number;
|
|
342
|
+
}>;
|
|
343
|
+
}
|
|
344
|
+
type KbEvalGrade = 'improvement' | 'regression' | 'tradeoff' | 'tie';
|
|
345
|
+
interface KbEvalRow {
|
|
346
|
+
key: string;
|
|
347
|
+
input: string;
|
|
348
|
+
outputA?: string;
|
|
349
|
+
outputB?: string;
|
|
350
|
+
expected?: string;
|
|
351
|
+
scoresA?: Record<string, number | null>;
|
|
352
|
+
scoresB?: Record<string, number | null>;
|
|
353
|
+
}
|
|
354
|
+
/** Summary 判级(Braintrust 心智):分数提升但成本/时延恶化 → tradeoff */
|
|
355
|
+
declare function evalGrade(scoreDelta: number | null, costDeltaPct?: number | null, latencyDeltaPct?: number | null): KbEvalGrade;
|
|
356
|
+
declare function meanScore(scores: Record<string, number | null> | undefined): number | null;
|
|
357
|
+
declare function deltaLabel(v: number | null | undefined, digits?: number): string;
|
|
358
|
+
interface KbGapQuery {
|
|
359
|
+
text: string;
|
|
360
|
+
count: number;
|
|
361
|
+
shareOfAllQueries?: number;
|
|
362
|
+
zeroClickRate?: number;
|
|
363
|
+
lastSeenAt?: string;
|
|
364
|
+
}
|
|
365
|
+
type KbCheckpointScope = 'content' | 'conversation' | 'both';
|
|
366
|
+
interface KbCheckpoint {
|
|
367
|
+
id: string;
|
|
368
|
+
label?: string;
|
|
369
|
+
at: string | number;
|
|
370
|
+
reason?: string;
|
|
371
|
+
scopeOptions?: KbCheckpointScope[];
|
|
372
|
+
}
|
|
373
|
+
interface KbChainStep {
|
|
374
|
+
key: string;
|
|
375
|
+
label: string;
|
|
376
|
+
status: 'pending' | 'running' | 'done' | 'error';
|
|
377
|
+
detail?: string;
|
|
378
|
+
}
|
|
379
|
+
interface KbCanvasVersion {
|
|
380
|
+
id: string;
|
|
381
|
+
label?: string;
|
|
382
|
+
at: string | number;
|
|
383
|
+
current?: boolean;
|
|
384
|
+
}
|
|
385
|
+
interface KbCanvasSelection {
|
|
386
|
+
text: string;
|
|
387
|
+
}
|
|
388
|
+
interface KbSandboxMessage {
|
|
389
|
+
jsonrpc: '2.0';
|
|
390
|
+
id?: string | number;
|
|
391
|
+
method?: string;
|
|
392
|
+
params?: unknown;
|
|
393
|
+
result?: unknown;
|
|
394
|
+
error?: {
|
|
395
|
+
code: number;
|
|
396
|
+
message: string;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/** 角色四档(Drive 范式,权限序单调:viewer < commenter < editor < owner) */
|
|
400
|
+
type KbRole = 'viewer' | 'commenter' | 'editor' | 'owner';
|
|
401
|
+
declare const KB_ROLES: readonly KbRole[];
|
|
402
|
+
declare function kbRoleLabel(r: KbRole | null): string;
|
|
403
|
+
/** 权限序比较:roleA ⊇ roleB(owner 最大) */
|
|
404
|
+
declare function roleAtLeast(role: KbRole, floor: KbRole): boolean;
|
|
405
|
+
/**
|
|
406
|
+
* 可见性五级(调研结论:四维授权求值后的「输出状态」,非独立开关)。
|
|
407
|
+
* hidden=检索/列表/计数都不出现(security trimming)|metadata=知道存在(锁+标题)|
|
|
408
|
+
* restricted=metadata+申请通道|summary=AI 摘要可见原文受限(新一代层级)|full=内容态
|
|
409
|
+
*/
|
|
410
|
+
type KbVisibility = 'hidden' | 'metadata' | 'restricted' | 'summary' | 'full';
|
|
411
|
+
declare const KB_VISIBILITIES: readonly KbVisibility[];
|
|
412
|
+
declare function kbVisibilityLabel(v: KbVisibility): string;
|
|
413
|
+
/** 授权主体(组是一等主体——部门树不当 ACL 用,业界共识) */
|
|
414
|
+
interface KbSubject {
|
|
415
|
+
kind: 'user' | 'group' | 'org' | 'anyone' | 'link';
|
|
416
|
+
id: string;
|
|
417
|
+
label: string;
|
|
418
|
+
/** 呈现注记:「24 成员 · 由 IT 管理」「系统自动」 */
|
|
419
|
+
note?: string;
|
|
420
|
+
}
|
|
421
|
+
interface KbAclEntry {
|
|
422
|
+
subject: KbSubject;
|
|
423
|
+
role: KbRole;
|
|
424
|
+
/** 继承来源(容器名);缺省 = 直接授权 */
|
|
425
|
+
inheritedFrom?: string;
|
|
426
|
+
/** 到期一等公民:ISO 时间;到期自动回收 */
|
|
427
|
+
expiresAt?: string;
|
|
428
|
+
/** 显式拒绝(一票否决,置顶呈现) */
|
|
429
|
+
deny?: boolean;
|
|
430
|
+
/** 系统自动态(Limited Access 类):不可手工增删 */
|
|
431
|
+
system?: boolean;
|
|
432
|
+
}
|
|
433
|
+
declare function normalizeAclEntry(raw: KbAclEntry | Record<string, unknown>): KbAclEntry;
|
|
434
|
+
/** 请求身份(来自服务端验证 token 的固定身份集——不接受自由输入,Kendra 自报身份教训) */
|
|
435
|
+
interface KbIdentity {
|
|
436
|
+
user: string;
|
|
437
|
+
groups: string[];
|
|
438
|
+
label?: string;
|
|
439
|
+
note?: string;
|
|
440
|
+
}
|
|
441
|
+
declare function normalizeIdentity(raw: KbIdentity | Record<string, unknown>): KbIdentity;
|
|
442
|
+
/** 可见性策略(文档级):discoverable=无权限时是否可发现(Drive allowFileDiscovery;企业内部缺省可见存在) */
|
|
443
|
+
interface KbVisibilityPolicy {
|
|
444
|
+
discoverable?: boolean;
|
|
445
|
+
/** 无权限但 AI 摘要可见(L2.5,摘要权限 ≠ 原文权限) */
|
|
446
|
+
summaryAllowed?: boolean;
|
|
447
|
+
}
|
|
448
|
+
declare function visibilityForRole(role: KbRole | null, policy?: KbVisibilityPolicy): KbVisibility;
|
|
449
|
+
/** 有效权限决策:结论 + 扁平原因链(SharePoint Check Permissions 范式) */
|
|
450
|
+
interface KbAclDecision {
|
|
451
|
+
role: KbRole | null;
|
|
452
|
+
visibility: KbVisibility;
|
|
453
|
+
/** 命中的授权来源(deny 置顶;via: direct|inherit|link) */
|
|
454
|
+
chain: Array<{
|
|
455
|
+
entry: KbAclEntry;
|
|
456
|
+
via: 'direct' | 'inherit' | 'link';
|
|
457
|
+
}>;
|
|
458
|
+
/** 显式 deny 的一票否决来源(最强信号,UI 置顶红) */
|
|
459
|
+
deniedBy?: KbSubject;
|
|
460
|
+
/** 本决策中最近的将来到期(倒计时/续期入口的数据源) */
|
|
461
|
+
expiresAt?: string;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* 有效权限求值(纯函数):先显式 deny(一票否决)→ 再 allow 并集(角色取权限序最大)→ 默认拒绝。
|
|
465
|
+
* 多角色叠加语义 = SharePoint/Azure/Zanzibar 主流范式;first-match 是 NTFS 反教材,禁止。
|
|
466
|
+
*
|
|
467
|
+
* 到期一等公民(spec §9.0-7,到期自动回收):expiresAt 已过的条目整体不计入求值
|
|
468
|
+
* (deny / allow 并集 / 原因链都视同不存在);全部授权过期 = 无授权 → fail-closed。
|
|
469
|
+
* expiresAt 不可解析时视为永不过期(normalize 诚实缺省,不猜)。当前时间经 now 参数
|
|
470
|
+
* 注入(缺省 new Date())——求值必须可测试、可复现,守卫脚本钉死此形态。
|
|
471
|
+
*/
|
|
472
|
+
declare function evaluateAcl(entries: Array<KbAclEntry | Record<string, unknown>>, identity: KbIdentity | Record<string, unknown>, policy?: KbVisibilityPolicy, now?: Date | number): KbAclDecision;
|
|
473
|
+
/** 访问申请状态机(Entra entitlement 收敛到 UI 需要的 9 态) */
|
|
474
|
+
type KbAccessState = 'idle' | 'requested' | 'pending_review' | 'granted' | 'expiring' | 'expired' | 'denied' | 'revoked';
|
|
475
|
+
declare const KB_ACCESS_STATES: readonly KbAccessState[];
|
|
476
|
+
declare function kbAccessStateLabel(s: KbAccessState): string;
|
|
477
|
+
interface KbAccessRequest {
|
|
478
|
+
id: string;
|
|
479
|
+
requester: string;
|
|
480
|
+
resource: string;
|
|
481
|
+
role: KbRole;
|
|
482
|
+
reason?: string;
|
|
483
|
+
state: KbAccessState;
|
|
484
|
+
submittedAt: string;
|
|
485
|
+
/** 路由明示:请求将发送给谁(页面级找 owner / 空间级找 admin——Confluence 十年踩坑) */
|
|
486
|
+
approverNote?: string;
|
|
487
|
+
decidedBy?: string;
|
|
488
|
+
decidedAt?: string;
|
|
489
|
+
/** granted 的到期(一等公民;缺省 = 永不过期) */
|
|
490
|
+
expiresAt?: string;
|
|
491
|
+
}
|
|
492
|
+
declare function normalizeAccessRequest(raw: KbAccessRequest | Record<string, unknown>): KbAccessRequest;
|
|
493
|
+
/** 审计动作(读取与预览分列是 Purview 范式;break_glass 审计粒度 ≥ 常规) */
|
|
494
|
+
type KbAuditAction = 'read' | 'preview' | 'permission_change' | 'grant' | 'revoke' | 'request' | 'approve' | 'deny' | 'delegation' | 'break_glass' | 'sync';
|
|
495
|
+
declare const KB_AUDIT_ACTIONS: readonly KbAuditAction[];
|
|
496
|
+
declare function kbAuditActionLabel(a: KbAuditAction): string;
|
|
497
|
+
/** 审计通道(时间线过滤维度) */
|
|
498
|
+
type KbAuditChannel = 'read' | 'permission' | 'request' | 'system';
|
|
499
|
+
declare const KB_AUDIT_CHANNELS: readonly KbAuditChannel[];
|
|
500
|
+
declare function auditChannelOf(a: KbAuditAction): KbAuditChannel;
|
|
501
|
+
interface KbAuditEntry {
|
|
502
|
+
id: string;
|
|
503
|
+
at: string;
|
|
504
|
+
actor: {
|
|
505
|
+
kind: 'human' | 'app' | 'system';
|
|
506
|
+
name: string;
|
|
507
|
+
};
|
|
508
|
+
action: KbAuditAction;
|
|
509
|
+
resource?: string;
|
|
510
|
+
detail: string;
|
|
511
|
+
/** 应急访问标记:行级警示 + 「实时告警已通知安全团队」 */
|
|
512
|
+
breakGlass?: boolean;
|
|
513
|
+
}
|
|
514
|
+
declare function normalizeAuditEntry(raw: KbAuditEntry | Record<string, unknown>): KbAuditEntry;
|
|
515
|
+
/** 权限异味(治理发现):6 种,均为「源系统权限卫生」问题——RAG 只是放大器 */
|
|
516
|
+
type KbHygieneKind = 'org_wide_link' | 'broad_group' | 'sensitive_mismatch' | 'broken_inheritance' | 'orphaned_owner' | 'overexposed';
|
|
517
|
+
declare const KB_HYGIENE_KINDS: readonly KbHygieneKind[];
|
|
518
|
+
declare function kbHygieneLabel(k: KbHygieneKind): string;
|
|
519
|
+
interface KbHygieneIssue {
|
|
520
|
+
id: string;
|
|
521
|
+
kind: KbHygieneKind;
|
|
522
|
+
resource: string;
|
|
523
|
+
/** 量化数字(不去重暴露面计数等) */
|
|
524
|
+
metric: string;
|
|
525
|
+
hint: string;
|
|
526
|
+
severity: 'high' | 'medium' | 'low';
|
|
527
|
+
}
|
|
528
|
+
declare function normalizeHygieneIssue(raw: KbHygieneIssue | Record<string, unknown>): KbHygieneIssue;
|
|
529
|
+
declare function formatPercent(v: number | null | undefined, digits?: number): string;
|
|
530
|
+
declare function formatCount(n: number | null | undefined): string;
|
|
531
|
+
/** 相对时间(来源日期/同步时间/检查点通用):'刚刚' / 'N 分钟前' / 'N 小时前' / 'N 天前' / 超过 30 天给日期 */
|
|
532
|
+
declare function relativeTime(input: string | number | Date, now?: Date): string;
|
|
533
|
+
|
|
534
|
+
export { KB_ACCESS_STATES, KB_AUDIT_ACTIONS, KB_AUDIT_CHANNELS, KB_CLEAN_OPTIONS, KB_FILTER_OPS, KB_HYGIENE_KINDS, KB_ROLES, KB_RUN_STATUSES, KB_SCORE_KINDS, KB_SPAN_KINDS, KB_SPAN_STATUSES, KB_VISIBILITIES, type KbAccessRequest, type KbAccessState, type KbAclDecision, type KbAclEntry, type KbAnswerKind, type KbAuditAction, type KbAuditChannel, type KbAuditEntry, type KbCanvasSelection, type KbCanvasVersion, type KbChainStep, type KbCheckpoint, type KbCheckpointScope, type KbChunk, type KbCitation, type KbCiteSegment, type KbClarification, type KbCleanOption, type KbConnector, type KbConnectorHealth, type KbEvalGrade, type KbEvalRow, type KbExplainFact, type KbFilterNode, type KbFilterOp, type KbGapQuery, type KbHitStats, type KbHitTestCase, type KbHygieneIssue, type KbHygieneKind, type KbIdentity, type KbLocation, type KbPermission, type KbPermissionNotice, type KbPipelineRun, type KbPipelineStep, type KbQueryResult, type KbRerankItem, type KbRetrievalHit, type KbRetrievalParams, type KbRetrievalQuery, type KbReviewTask, type KbRole, type KbRunStatus, type KbSandboxMessage, type KbScoreConfig, type KbScoreKind, type KbSegmentConfig, type KbSegmentStats, type KbSourceKind, type KbSourceTypeDef, type KbSpan, type KbSpanKind, type KbSpanStatus, type KbSqlQuery, type KbSubject, type KbSyncMetrics, type KbVerifiedVia, type KbVisibility, type KbVisibilityPolicy, auditChannelOf, collectCitationNumbers, connectorHealth, deltaLabel, evalGrade, evaluateAcl, filterToMongo, filterToOData, formatCount, formatPercent, formatScore, getKbSourceType, hitTestStats, kbAccessStateLabel, kbAuditActionLabel, kbHygieneLabel, kbRoleLabel, kbRunStatusLabel, kbSpanKindLabel, kbVisibilityLabel, listKbSourceTypes, meanScore, normalizeAccessRequest, normalizeAclEntry, normalizeAuditEntry, normalizeChunk, normalizeCitation, normalizeConnector, normalizeFilterNode, normalizeHit, normalizeHygieneIssue, normalizeIdentity, normalizePipelineRun, normalizeQueryResult, normalizeRetrievalParams, normalizeSegmentConfig, normalizeSpans, normalizeSqlQuery, parseInlineCitations, registerKbSourceType, relativeTime, rerankDelta, roleAtLeast, scoreHigherIsBetter, scorePercent, segmentStats, segmentText, unregisterKbSourceType, visibilityForRole };
|