@xpert-ai/contracts 3.18.4 → 3.18.6
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/index.cjs.js +328 -127
- package/index.esm.js +312 -128
- package/package.json +1 -1
- package/src/ai/index.d.ts +5 -0
- package/src/ai/knowledge-chunking.model.d.ts +59 -0
- package/src/ai/knowledge-doc-chunk.model.d.ts +23 -0
- package/src/ai/knowledge-doc.model.d.ts +50 -1
- package/src/ai/knowledge-filter.model.d.ts +26 -1
- package/src/ai/knowledge-graph.model.d.ts +18 -1
- package/src/ai/knowledge-parser-selection.d.ts +13 -0
- package/src/ai/knowledge-parser.model.d.ts +5 -2
- package/src/ai/knowledge-pipeline.d.ts +12 -0
- package/src/ai/knowledge-question.model.d.ts +26 -0
- package/src/ai/knowledge-table.model.d.ts +72 -0
- package/src/ai/knowledge-tag.model.d.ts +32 -0
- package/src/ai/knowledgebase.model.d.ts +38 -8
- package/src/ai/mcp-publication.model.d.ts +9 -2
- package/src/tag-entity.model.d.ts +22 -0
- package/src/view-extension/model.d.ts +20 -0
package/package.json
CHANGED
package/src/ai/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export * from './rag';
|
|
|
33
33
|
export * from './rag-web';
|
|
34
34
|
export * from './knowledgebase.model';
|
|
35
35
|
export * from './knowledge-parser.model';
|
|
36
|
+
export * from './knowledge-table.model';
|
|
37
|
+
export * from './knowledge-chunking.model';
|
|
36
38
|
export * from './knowledge-faq.model';
|
|
37
39
|
export * from './knowledge-wiki.model';
|
|
38
40
|
export * from './knowledge-deletion.model';
|
|
@@ -81,3 +83,6 @@ export * from './mcp-publication.model';
|
|
|
81
83
|
export * from './mcp-auth.model';
|
|
82
84
|
export * from './mcp-audit.model';
|
|
83
85
|
export * from './knowledge-wiki-organization.model';
|
|
86
|
+
export * from './knowledge-question.model';
|
|
87
|
+
export * from './knowledge-tag.model';
|
|
88
|
+
export * from './knowledge-parser-selection';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Shared fallback for ordinary documents without an explicitly configured strategy. */
|
|
2
|
+
export declare const DEFAULT_KNOWLEDGE_TEXT_SPLITTER = "auto";
|
|
3
|
+
/** Shared revision for structured execution diagnostics and cache invalidation. */
|
|
4
|
+
export declare const KNOWLEDGE_CHUNKING_ALGORITHM_VERSION = 5;
|
|
5
|
+
export type KnowledgeChunkingAlgorithmVersion = 1 | 2 | 3 | 4 | typeof KNOWLEDGE_CHUNKING_ALGORITHM_VERSION;
|
|
6
|
+
/** Built-in strategies that auto routing may select. External providers remain manually selectable. */
|
|
7
|
+
export type KnowledgeChunkingStrategy = 'recursive-character' | 'markdown-recursive' | 'structure-aware';
|
|
8
|
+
export type KnowledgeChunkingRequest = KnowledgeChunkingStrategy | 'auto';
|
|
9
|
+
export type KnowledgeChunkBlockType = 'heading' | 'paragraph' | 'table' | 'list' | 'code' | 'formula' | 'other';
|
|
10
|
+
export type KnowledgeChunkingReason = 'structured-blocks' | 'markdown-headings' | 'layout-headings' | 'plain-text' | 'missing-structure' | 'explicit-structure';
|
|
11
|
+
export type KnowledgeChunkingWarning = 'structure-split' | 'context-reduced' | 'coarse-provenance' | 'unsupported-structure' | 'missing-format';
|
|
12
|
+
/** Offsets are UTF-16 positions in the pre-split source fragment, never in an added heading prefix. */
|
|
13
|
+
export interface KnowledgeChunkSourceRange {
|
|
14
|
+
sourceIndex: number;
|
|
15
|
+
startOffset: number;
|
|
16
|
+
endOffset: number;
|
|
17
|
+
}
|
|
18
|
+
export interface KnowledgeChunkingDecision {
|
|
19
|
+
inputHash: string;
|
|
20
|
+
sourceIndexes: number[];
|
|
21
|
+
requestedStrategy: KnowledgeChunkingRequest;
|
|
22
|
+
resolvedStrategy: KnowledgeChunkingStrategy;
|
|
23
|
+
reason: KnowledgeChunkingReason;
|
|
24
|
+
algorithmVersion: KnowledgeChunkingAlgorithmVersion;
|
|
25
|
+
blockCounts: Partial<Record<KnowledgeChunkBlockType, number>>;
|
|
26
|
+
warnings: KnowledgeChunkingWarning[];
|
|
27
|
+
}
|
|
28
|
+
export interface KnowledgeChunkingMetadata {
|
|
29
|
+
inputHash: string;
|
|
30
|
+
requestedStrategy: KnowledgeChunkingRequest;
|
|
31
|
+
resolvedStrategy: KnowledgeChunkingStrategy;
|
|
32
|
+
reason: KnowledgeChunkingReason;
|
|
33
|
+
algorithmVersion: KnowledgeChunkingAlgorithmVersion;
|
|
34
|
+
headingPath: string[];
|
|
35
|
+
sourceRanges: KnowledgeChunkSourceRange[];
|
|
36
|
+
contextRanges?: KnowledgeChunkSourceRange[];
|
|
37
|
+
warnings: KnowledgeChunkingWarning[];
|
|
38
|
+
continued?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Common options accepted by the new built-in strategies; the token budget has a single execution owner. */
|
|
41
|
+
export interface KnowledgeStructuredChunkOptions {
|
|
42
|
+
chunkSize?: number;
|
|
43
|
+
chunkOverlap?: number;
|
|
44
|
+
separators?: string | string[];
|
|
45
|
+
}
|
|
46
|
+
/** Language affects natural text boundaries, never strategy selection. */
|
|
47
|
+
export type KnowledgeChunkLanguage = 'Chinese' | 'English' | 'Mixed';
|
|
48
|
+
export type KnowledgeChunkLanguageHint = 'auto' | Exclude<KnowledgeChunkLanguage, 'Mixed'>;
|
|
49
|
+
export interface KnowledgeChunkLanguageDetection {
|
|
50
|
+
/** Absent when the bounded sample contains no identifiable natural text. */
|
|
51
|
+
detectedLanguage?: KnowledgeChunkLanguage;
|
|
52
|
+
sampledCodeUnits: number;
|
|
53
|
+
naturalUnits: number;
|
|
54
|
+
}
|
|
55
|
+
export interface KnowledgeChunkLanguageDecision extends KnowledgeChunkLanguageDetection {
|
|
56
|
+
sourceIndexes: number[];
|
|
57
|
+
languageHint: KnowledgeChunkLanguageHint;
|
|
58
|
+
resolvedLanguage: KnowledgeChunkLanguage;
|
|
59
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { KnowledgeChunkQuestions } from './knowledge-question.model';
|
|
2
|
+
import type { KnowledgeTableContext } from './knowledge-table.model';
|
|
3
|
+
import type { KnowledgeChunkingMetadata } from './knowledge-chunking.model';
|
|
1
4
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
2
5
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
3
6
|
import { IKnowledgeDocument } from './knowledge-doc.model';
|
|
@@ -40,6 +43,8 @@ export type DocumentLayoutMetadata = {
|
|
|
40
43
|
blockId: string;
|
|
41
44
|
order: number;
|
|
42
45
|
type: DocumentAnalysisBlockType;
|
|
46
|
+
/** Explicit semantic heading level, when the converter provides it. */
|
|
47
|
+
headingLevel?: number;
|
|
43
48
|
providerType?: string;
|
|
44
49
|
providerSubType?: string;
|
|
45
50
|
bounds?: DocumentAnalysisBounds;
|
|
@@ -140,7 +145,20 @@ export type KnowledgeDocumentAnalysisPreview = {
|
|
|
140
145
|
views: Array<'markdown' | 'structure' | 'tables' | 'images' | 'json'>;
|
|
141
146
|
};
|
|
142
147
|
export interface IDocChunkMetadata {
|
|
148
|
+
tableSource?: {
|
|
149
|
+
tableId: string;
|
|
150
|
+
rowNumber: number;
|
|
151
|
+
range?: string;
|
|
152
|
+
};
|
|
153
|
+
tableMetadataResultHash?: string;
|
|
154
|
+
tableContext?: KnowledgeTableContext;
|
|
143
155
|
chunkId: string;
|
|
156
|
+
documentId?: string;
|
|
157
|
+
chunking?: KnowledgeChunkingMetadata;
|
|
158
|
+
/** Preprocessing or a legacy splitter cannot provide exact offsets into the saved converter output. */
|
|
159
|
+
sourceMapping?: 'coarse';
|
|
160
|
+
/** Optional text used only for embedding; pageContent remains the source evidence. */
|
|
161
|
+
searchContent?: string;
|
|
144
162
|
parentId?: string | null;
|
|
145
163
|
children?: DocumentInterface<IDocChunkMetadata>[];
|
|
146
164
|
knowledgeId?: string;
|
|
@@ -173,6 +191,11 @@ export interface IDocChunkMetadata {
|
|
|
173
191
|
/**
|
|
174
192
|
* Whether the chunk is represented as a vector in the vector store
|
|
175
193
|
*/
|
|
194
|
+
questionGeneration?: KnowledgeChunkQuestions;
|
|
195
|
+
/** Only present on question vector projections; the source chunk remains authoritative. */
|
|
196
|
+
questionGenerationId?: string;
|
|
197
|
+
questionSourceChunkId?: string;
|
|
198
|
+
generatedQuestionId?: string;
|
|
176
199
|
isVector?: boolean;
|
|
177
200
|
score?: number;
|
|
178
201
|
relevanceScore?: number;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { IKnowledgeDocumentTag } from './knowledge-tag.model';
|
|
2
|
+
import type { KnowledgeChunkLanguageHint } from './knowledge-chunking.model';
|
|
3
|
+
import type { KnowledgeQuestionGenerationConfig } from './knowledge-question.model';
|
|
4
|
+
import type { KnowledgeTableMetadata } from './knowledge-table.model';
|
|
1
5
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
6
|
import { IIntegration } from '../integration.model';
|
|
3
7
|
import { IStorageFile } from '../storage-file.model';
|
|
@@ -10,6 +14,13 @@ import { DocumentSourceProviderCategoryEnum } from './knowledge-pipeline';
|
|
|
10
14
|
import { TCopilotModel } from './copilot-model.model';
|
|
11
15
|
import { I18nObject } from '../types';
|
|
12
16
|
export type DocumentParserConfig = {
|
|
17
|
+
/** Optional business guidance; an empty value uses the default table metadata prompt. */
|
|
18
|
+
tableMetadataRequirements?: string;
|
|
19
|
+
/** Additional cl100k_base token cap for text retrieval chunks; 0 disables it. Context parents are retained. */
|
|
20
|
+
maxChunkTokens?: number;
|
|
21
|
+
/** Public natural-language boundary hint; absence means auto. */
|
|
22
|
+
chunkLanguageHint?: KnowledgeChunkLanguageHint;
|
|
23
|
+
questionGeneration?: KnowledgeQuestionGenerationConfig;
|
|
13
24
|
pages?: number[][];
|
|
14
25
|
replaceWhitespace?: boolean;
|
|
15
26
|
removeSensitive?: boolean;
|
|
@@ -61,6 +72,8 @@ export type SpreadsheetOutputFormat = 'anchored_markdown';
|
|
|
61
72
|
* Custom document transformers take precedence over this configuration.
|
|
62
73
|
*/
|
|
63
74
|
export type DocumentSpreadsheetParserConfig = {
|
|
75
|
+
/** Native Excel record parsing only. Absence preserves the legacy first-row header behavior. */
|
|
76
|
+
firstRowAsHeader?: boolean;
|
|
64
77
|
interpretation?: SpreadsheetInterpretation;
|
|
65
78
|
contextUnit?: SpreadsheetContextUnit;
|
|
66
79
|
oversizePolicy?: SpreadsheetOversizePolicy;
|
|
@@ -298,6 +311,8 @@ export type TKnowledgeDocument = {
|
|
|
298
311
|
export interface IKnowledgeDocument<T extends KnowledgeDocumentMetadata = KnowledgeDocumentMetadata> extends TKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
|
|
299
312
|
parent?: IKnowledgeDocument | null;
|
|
300
313
|
children?: IKnowledgeDocument[];
|
|
314
|
+
/** Existing manual and automatic associations, included when requested for display. */
|
|
315
|
+
tagAssignments?: IKnowledgeDocumentTag[];
|
|
301
316
|
knowledgebase?: IKnowledgebase;
|
|
302
317
|
draft?: TKnowledgeDocument;
|
|
303
318
|
metadata?: T;
|
|
@@ -321,8 +336,34 @@ export interface StandardDocumentMetadata {
|
|
|
321
336
|
tokens?: number;
|
|
322
337
|
lastIncrementalSync?: KnowledgeDocumentLastIncrementalSync;
|
|
323
338
|
}
|
|
339
|
+
/** Page coverage reported by the parser and completed by the shared image-understanding stage. */
|
|
340
|
+
export type DocumentParserDiagnostics = {
|
|
341
|
+
schemaVersion: 1;
|
|
342
|
+
pages: {
|
|
343
|
+
page: number;
|
|
344
|
+
status: 'text' | 'blank' | 'needs-ocr' | 'recognized';
|
|
345
|
+
imagePaths: string[];
|
|
346
|
+
}[];
|
|
347
|
+
};
|
|
348
|
+
export type KnowledgeImageUnderstandingWarning = {
|
|
349
|
+
type: 'image_understanding_skipped' | 'image_understanding_failed';
|
|
350
|
+
message: string;
|
|
351
|
+
assetCount?: number;
|
|
352
|
+
imagePath?: string;
|
|
353
|
+
imageUrl?: string;
|
|
354
|
+
parentChunkId?: string;
|
|
355
|
+
};
|
|
324
356
|
export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
|
|
325
|
-
/**
|
|
357
|
+
/** Server-owned identity and label of the last completed document conversion. */
|
|
358
|
+
parser?: string;
|
|
359
|
+
parserLabel?: I18nObject;
|
|
360
|
+
parserDiagnostics?: DocumentParserDiagnostics;
|
|
361
|
+
imageUnderstandingWarnings?: KnowledgeImageUnderstandingWarning[];
|
|
362
|
+
/** Server-owned generated table descriptions and publication state. */
|
|
363
|
+
tableMetadata?: KnowledgeTableMetadata;
|
|
364
|
+
/** Existing source summary, available to optional document classifiers. */
|
|
365
|
+
summary?: string;
|
|
366
|
+
/** Ownership is independent of visibility in the document browser. */
|
|
326
367
|
systemManaged?: boolean;
|
|
327
368
|
systemManagedType?: string;
|
|
328
369
|
transformSnapshot?: KnowledgeDocumentTransformSnapshotRef;
|
|
@@ -330,6 +371,9 @@ export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
|
|
|
330
371
|
documentAnalysis?: DocumentAnalysisMetadata;
|
|
331
372
|
[key: string]: any;
|
|
332
373
|
}
|
|
374
|
+
export declare const KNOWLEDGE_DOCUMENT_AGENT_WRITER_TYPE = "agent-writer";
|
|
375
|
+
/** Agent publications are inspectable; internal Wiki/FAQ backing indexes stay hidden. */
|
|
376
|
+
export declare function isKnowledgeDocumentVisible(metadata?: KnowledgeDocumentMetadata | null): boolean;
|
|
333
377
|
export interface IKnowledgeDocumentCreateInput extends IKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
|
|
334
378
|
}
|
|
335
379
|
export interface IKnowledgeDocumentUpdateInput extends Partial<IKnowledgeDocumentCreateInput> {
|
|
@@ -351,3 +395,8 @@ export declare const STANDARD_METADATA_FIELDS: {
|
|
|
351
395
|
fields: KBMetadataFieldDef[];
|
|
352
396
|
}[];
|
|
353
397
|
export type StandardMetadataFieldKey = (typeof STANDARD_METADATA_FIELDS)[number]['fields'][number]['key'];
|
|
398
|
+
/** Bulk import keeps the legacy document array valid; tags apply to the whole batch. */
|
|
399
|
+
export type KnowledgeDocumentBulkCreateInput = Partial<IKnowledgeDocument>[] | {
|
|
400
|
+
documents: Partial<IKnowledgeDocument>[];
|
|
401
|
+
tagIds: string[];
|
|
402
|
+
};
|
|
@@ -53,8 +53,33 @@ export type KnowledgeFilterSources = {
|
|
|
53
53
|
dynamic?: KnowledgeFilterNode;
|
|
54
54
|
};
|
|
55
55
|
export type KnowledgeFilterStatus = 'not_applied' | 'applied' | 'dynamic_fallback' | 'failed';
|
|
56
|
-
export type KnowledgeFilterErrorCode = 'invalid_filter' | 'unknown_field' | 'invalid_operator' | 'invalid_value' | 'missing_fixed_variable' | 'filter_too_complex' | 'graph_search_failed' | 'keyword_index_missing' | 'keyword_query_failed' | 'rerank_failed' | 'unsupported_backend' | 'unsupported_retrieval_mode';
|
|
56
|
+
export type KnowledgeFilterErrorCode = 'invalid_filter' | 'unknown_field' | 'invalid_operator' | 'invalid_value' | 'missing_fixed_variable' | 'filter_too_complex' | 'graph_search_failed' | 'keyword_index_missing' | 'keyword_query_failed' | 'rerank_failed' | 'faq_semantic_failed' | 'unsupported_backend' | 'unsupported_retrieval_mode';
|
|
57
57
|
export type KnowledgeFilterDiagnostics = {
|
|
58
|
+
faqExclusion?: {
|
|
59
|
+
mode: 'semantic';
|
|
60
|
+
threshold: number;
|
|
61
|
+
margin: number;
|
|
62
|
+
modelFingerprint?: string;
|
|
63
|
+
compared: number;
|
|
64
|
+
reused: number;
|
|
65
|
+
excluded: number;
|
|
66
|
+
cacheHits: number;
|
|
67
|
+
encodedTexts: number;
|
|
68
|
+
cacheErrors: number;
|
|
69
|
+
coalescedTexts: number;
|
|
70
|
+
rounds: number;
|
|
71
|
+
candidateSlots: number;
|
|
72
|
+
retrievalCalls: number;
|
|
73
|
+
stopReason?: 'target_reached' | 'exhausted' | 'budget_exhausted';
|
|
74
|
+
failureReason?: string;
|
|
75
|
+
decisions: Array<{
|
|
76
|
+
faqId: string;
|
|
77
|
+
action: 'keep' | 'exclude';
|
|
78
|
+
reason: string;
|
|
79
|
+
positiveScore?: number;
|
|
80
|
+
negativeScore?: number;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
58
83
|
contentScope?: KnowledgeRetrievalContentScope;
|
|
59
84
|
filterVersion: typeof KNOWLEDGE_FILTER_VERSION;
|
|
60
85
|
fixedFilter?: KnowledgeFilterNode;
|
|
@@ -34,7 +34,7 @@ export type KnowledgeGraphDocumentProgress = {
|
|
|
34
34
|
error?: string | null;
|
|
35
35
|
};
|
|
36
36
|
export type GraphRagRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
|
|
37
|
-
export type KnowledgeGraphItemOrigin = 'extracted' | 'manual' | 'curated';
|
|
37
|
+
export type KnowledgeGraphItemOrigin = 'extracted' | 'structured' | 'manual' | 'curated';
|
|
38
38
|
export type KnowledgeGraphVisibility = 'active' | 'hidden';
|
|
39
39
|
export type GraphRagConfig = {
|
|
40
40
|
enabled?: boolean;
|
|
@@ -164,6 +164,7 @@ export type KnowledgeGraphViewNode = {
|
|
|
164
164
|
confidence?: number | null;
|
|
165
165
|
symbolSize?: number;
|
|
166
166
|
value?: number;
|
|
167
|
+
unloadedNeighborCount?: number;
|
|
167
168
|
};
|
|
168
169
|
export type KnowledgeGraphViewEdge = {
|
|
169
170
|
id: string;
|
|
@@ -182,6 +183,17 @@ export type KnowledgeGraphViewResponse = {
|
|
|
182
183
|
relationTypes: string[];
|
|
183
184
|
totalNodes: number;
|
|
184
185
|
totalEdges: number;
|
|
186
|
+
remainingNodes?: number;
|
|
187
|
+
relations?: IKnowledgeGraphRelation[];
|
|
188
|
+
};
|
|
189
|
+
export type KnowledgeGraphCatalog = {
|
|
190
|
+
sources: Array<{
|
|
191
|
+
id: string;
|
|
192
|
+
name: string;
|
|
193
|
+
}>;
|
|
194
|
+
entities: Array<Pick<IKnowledgeGraphEntity, 'id' | 'name' | 'type'>>;
|
|
195
|
+
hiddenNodes: number;
|
|
196
|
+
hiddenRelations: number;
|
|
185
197
|
};
|
|
186
198
|
export type KnowledgeGraphVisualizationQuery = {
|
|
187
199
|
search?: string | null;
|
|
@@ -192,6 +204,11 @@ export type KnowledgeGraphVisualizationQuery = {
|
|
|
192
204
|
focusEntityId?: string | null;
|
|
193
205
|
depth?: number | null;
|
|
194
206
|
take?: number | null;
|
|
207
|
+
sourceDocumentId?: string | null;
|
|
208
|
+
loadAll?: boolean;
|
|
209
|
+
expandedEntityIds?: string[];
|
|
210
|
+
visibleEntityIds?: string[];
|
|
211
|
+
includeHidden?: boolean;
|
|
195
212
|
};
|
|
196
213
|
export type KnowledgeGraphMentionListQuery = {
|
|
197
214
|
entityId?: string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IKnowledgeDocument } from './knowledge-doc.model';
|
|
2
|
+
import type { KnowledgebaseParserConfig, KnowledgeParserSelection } from './knowledgebase.model';
|
|
3
|
+
export declare const BUILTIN_KNOWLEDGE_PARSER = "builtin";
|
|
4
|
+
/** Only formats with a real builtin reader; unknown binary formats are not advertised as text. */
|
|
5
|
+
export declare const BUILTIN_KNOWLEDGE_FILE_TYPES: string[];
|
|
6
|
+
export declare function knowledgeDocumentFileType(document: Partial<Pick<IKnowledgeDocument, 'type' | 'mimeType'>>): string;
|
|
7
|
+
export declare function knowledgebaseParserSelection(config: Partial<KnowledgebaseParserConfig> | null | undefined, documentType: string): KnowledgeParserSelection | undefined;
|
|
8
|
+
/** Existing uploader/importer defaults plus capabilities advertised by installed document parsers.
|
|
9
|
+
* Explicit caller restrictions remain authoritative; this does not grant builtin parsing support.
|
|
10
|
+
*/
|
|
11
|
+
export declare function knowledgeUploadFileTypes(defaults: readonly string[], providers: readonly {
|
|
12
|
+
supportedFileTypes?: string[];
|
|
13
|
+
}[], accepts?: readonly string[] | null): string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { DocumentTextParserConfig } from './knowledge-doc.model';
|
|
1
|
+
import type { DocumentTextParserConfig, DocumentSheetParserConfig } from './knowledge-doc.model';
|
|
2
2
|
import type { KnowledgebaseParserConfig } from './knowledgebase.model';
|
|
3
3
|
import type { IKnowledgeDocumentChunk, IDocChunkMetadata } from './knowledge-doc-chunk.model';
|
|
4
|
+
import type { KnowledgeChunkingDecision, KnowledgeChunkLanguageDecision } from './knowledge-chunking.model';
|
|
4
5
|
export interface KnowledgeChunkPreviewInput {
|
|
5
6
|
text: string;
|
|
6
7
|
type: 'txt' | 'md';
|
|
@@ -8,8 +9,10 @@ export interface KnowledgeChunkPreviewInput {
|
|
|
8
9
|
}
|
|
9
10
|
export interface KnowledgeChunkPreviewResult {
|
|
10
11
|
chunks: IKnowledgeDocumentChunk<IDocChunkMetadata>[];
|
|
12
|
+
decisions?: KnowledgeChunkingDecision[];
|
|
13
|
+
languages?: KnowledgeChunkLanguageDecision[];
|
|
11
14
|
}
|
|
12
15
|
/** Only copy configured defaults; do not turn built-in defaults into document overrides. */
|
|
13
|
-
export declare function knowledgebaseDocumentParserDefaults(config?: KnowledgebaseParserConfig | null, documentType?: string): DocumentTextParserConfig
|
|
16
|
+
export declare function knowledgebaseDocumentParserDefaults(config?: KnowledgebaseParserConfig | null, documentType?: string): DocumentTextParserConfig & Partial<DocumentSheetParserConfig>;
|
|
14
17
|
/** Arrays are the canonical ordered format; retain the plugin's legacy comma syntax. */
|
|
15
18
|
export declare function decodeKnowledgeSeparators(value?: string | string[]): string[];
|
|
@@ -41,11 +41,23 @@ export interface IDocumentSourceProvider extends IDocumentNodeProvider {
|
|
|
41
41
|
category: DocumentSourceProviderCategoryEnum;
|
|
42
42
|
}
|
|
43
43
|
export interface IDocumentProcessorProvider extends IDocumentNodeProvider {
|
|
44
|
+
/** Where new parser options are configured; omitted keeps legacy document-level forms. */
|
|
45
|
+
configScope?: 'document' | 'integration';
|
|
44
46
|
/** Explicit file extensions supported for per-format knowledgebase defaults. */
|
|
45
47
|
supportedFileTypes?: string[];
|
|
48
|
+
/** Converter already extracts image text; run an additional image pass only when explicitly enabled. */
|
|
49
|
+
providesImageText?: boolean;
|
|
46
50
|
}
|
|
47
51
|
export interface IDocumentChunkerProvider extends IDocumentNodeProvider {
|
|
48
52
|
structure?: KnowledgeStructureEnum;
|
|
53
|
+
/** Opt into the public language context without changing legacy token/structure capabilities. */
|
|
54
|
+
supportsLanguageHint?: boolean;
|
|
55
|
+
/** Optional capabilities; absence keeps the legacy provider form and execution behavior. */
|
|
56
|
+
chunkingCapabilities?: {
|
|
57
|
+
size: 'target' | 'strategy-dependent' | 'maximum';
|
|
58
|
+
separators: boolean;
|
|
59
|
+
tokenBudget: boolean;
|
|
60
|
+
};
|
|
49
61
|
}
|
|
50
62
|
export interface IDocumentUnderstandingProvider extends IDocumentNodeProvider {
|
|
51
63
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TCopilotModel } from './copilot-model.model';
|
|
2
|
+
/** Optional Doc2Query enrichment. Questions are retrieval projections of a source chunk. */
|
|
3
|
+
export interface KnowledgeQuestionGenerationConfig {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
model?: TCopilotModel;
|
|
6
|
+
questionCount?: number;
|
|
7
|
+
customInstructions?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface KnowledgeGeneratedQuestion {
|
|
10
|
+
id: string;
|
|
11
|
+
question: string;
|
|
12
|
+
/** Physical projection ids, including an embedding rebuild awaiting promotion. */
|
|
13
|
+
vectorIds?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface KnowledgeChunkQuestions {
|
|
16
|
+
status: 'generating' | 'ready' | 'failed';
|
|
17
|
+
generationId: string;
|
|
18
|
+
inputHash: string;
|
|
19
|
+
sourceHash: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
questions: KnowledgeGeneratedQuestion[];
|
|
22
|
+
vectorIds: string[];
|
|
23
|
+
error?: string;
|
|
24
|
+
/** The model found no meaningful source-grounded search questions. */
|
|
25
|
+
emptyReason?: 'insufficient_content';
|
|
26
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type IKnowledgeDocument } from './knowledge-doc.model';
|
|
2
|
+
import type { IDocChunkMetadata, IKnowledgeDocumentChunk } from './knowledge-doc-chunk.model';
|
|
3
|
+
/** Parser-owned identities and coordinates; generated descriptions never redefine these fields. */
|
|
4
|
+
export interface KnowledgeTableColumn {
|
|
5
|
+
columnId: string;
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
column: number;
|
|
9
|
+
/** Certified from all nonempty source cells by the parser, never inferred by the model. */
|
|
10
|
+
valueType?: 'boolean';
|
|
11
|
+
}
|
|
12
|
+
export interface KnowledgeTableDefinition {
|
|
13
|
+
tableId: string;
|
|
14
|
+
sheetName: string;
|
|
15
|
+
range: string;
|
|
16
|
+
headerRow?: number;
|
|
17
|
+
rowCount: number;
|
|
18
|
+
columns: KnowledgeTableColumn[];
|
|
19
|
+
}
|
|
20
|
+
export interface KnowledgeTableSource extends KnowledgeTableDefinition {
|
|
21
|
+
/** Bounded parser samples. Keys are columnId values, not generated labels. */
|
|
22
|
+
samples: Array<{
|
|
23
|
+
rowNumber: number;
|
|
24
|
+
values: {
|
|
25
|
+
[columnId: string]: string | number | boolean | null;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface KnowledgeTableColumnDescription extends KnowledgeTableColumn {
|
|
30
|
+
description: string;
|
|
31
|
+
unit?: string;
|
|
32
|
+
valueMeanings?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface KnowledgeTableResult extends Omit<KnowledgeTableDefinition, 'columns'> {
|
|
35
|
+
summary: string;
|
|
36
|
+
columns: KnowledgeTableColumnDescription[];
|
|
37
|
+
}
|
|
38
|
+
export interface KnowledgeTableMetadata {
|
|
39
|
+
schemaVersion: 1;
|
|
40
|
+
status: 'generating' | 'generated' | 'ready' | 'failed' | 'skipped';
|
|
41
|
+
reason?: 'missing_model' | 'no_data' | 'unsupported';
|
|
42
|
+
inputHash: string;
|
|
43
|
+
/** Full parsed source fingerprint, independent of the bounded model samples. */
|
|
44
|
+
sourceFingerprint?: string;
|
|
45
|
+
/** Successful column batches can be resumed independently of the displayed structure. */
|
|
46
|
+
completedColumns?: {
|
|
47
|
+
[tableId: string]: string[];
|
|
48
|
+
};
|
|
49
|
+
/** Model-selected ISO 639 language, reused across batches and retries. */
|
|
50
|
+
language?: string;
|
|
51
|
+
generationId: string;
|
|
52
|
+
resultHash?: string;
|
|
53
|
+
appliedResultHash?: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
tables: KnowledgeTableResult[];
|
|
57
|
+
}
|
|
58
|
+
/** Compact retrieval-only view of the published generation. Source row content stays unchanged. */
|
|
59
|
+
export interface KnowledgeTableContext {
|
|
60
|
+
tableId: string;
|
|
61
|
+
resultHash: string;
|
|
62
|
+
sheetName: string;
|
|
63
|
+
summary: string;
|
|
64
|
+
columns: Array<Pick<KnowledgeTableColumnDescription, 'columnId' | 'key' | 'description' | 'unit' | 'valueMeanings'>>;
|
|
65
|
+
}
|
|
66
|
+
export interface KnowledgeTablePreview {
|
|
67
|
+
tables: KnowledgeTableDefinition[];
|
|
68
|
+
chunks: IKnowledgeDocumentChunk<IDocChunkMetadata>[];
|
|
69
|
+
}
|
|
70
|
+
export declare function isNativeKnowledgeTableDocument(document: Pick<Partial<IKnowledgeDocument>, 'category' | 'type' | 'parserConfig' | 'sourceConfig'>): boolean;
|
|
71
|
+
/** Parse persisted JSON at the read boundary before using the shared result contract. */
|
|
72
|
+
export declare function isKnowledgeTableMetadata(value: unknown): value is KnowledgeTableMetadata;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ITag } from '../tag-entity.model';
|
|
2
|
+
import type { TCopilotModel } from './copilot-model.model';
|
|
3
|
+
export interface KnowledgeAutomaticTaggingConfig {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
/** When absent, use the knowledgebase general LLM. */
|
|
6
|
+
model?: TCopilotModel | null;
|
|
7
|
+
maxTags?: number;
|
|
8
|
+
confidenceThreshold?: number;
|
|
9
|
+
allowWithManualTags?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Existing organization/tenant tags selected for one knowledgebase. */
|
|
12
|
+
export interface KnowledgeTagCatalog {
|
|
13
|
+
tags: ITag[];
|
|
14
|
+
available: ITag[];
|
|
15
|
+
canEdit: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface IKnowledgeDocumentTag {
|
|
18
|
+
tagId: string;
|
|
19
|
+
documentId: string;
|
|
20
|
+
source: 'manual' | 'automatic';
|
|
21
|
+
confidence?: number | null;
|
|
22
|
+
tag: ITag;
|
|
23
|
+
}
|
|
24
|
+
export declare const KNOWLEDGE_AUTOMATIC_TAG_CANDIDATES = 50;
|
|
25
|
+
export declare const KNOWLEDGE_AUTOMATIC_TAG_MAXIMUM = 10;
|
|
26
|
+
export declare const KNOWLEDGE_AUTOMATIC_TAG_TEXT_BUDGET = 12000;
|
|
27
|
+
export interface ITagKnowledgebaseUsage {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
candidate: boolean;
|
|
31
|
+
documentCount: number;
|
|
32
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { KnowledgeAutomaticTaggingConfig } from './knowledge-tag.model';
|
|
2
|
+
import type { KnowledgeChunkLanguageHint } from './knowledge-chunking.model';
|
|
3
|
+
import type { KnowledgeQuestionGenerationConfig } from './knowledge-question.model';
|
|
1
4
|
import type { TKBRetrievalSettings } from './xpert.model';
|
|
5
|
+
import { VectorTypeEnum } from './rag';
|
|
2
6
|
import { ICopilotModel } from './copilot-model.model';
|
|
3
7
|
import { I18nObject, TAvatar } from '../types';
|
|
4
8
|
import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
|
|
5
|
-
import { IKnowledgeDocument } from './knowledge-doc.model';
|
|
9
|
+
import { IKnowledgeDocument, type DocumentSpreadsheetParserConfig } from './knowledge-doc.model';
|
|
6
10
|
import { IXpert } from './xpert.model';
|
|
7
11
|
import { IIntegration } from '../integration.model';
|
|
8
12
|
import { IDocChunkMetadata } from './knowledge-doc-chunk.model';
|
|
@@ -31,6 +35,10 @@ export type KnowledgebaseFAQConfig = {
|
|
|
31
35
|
questionIndexMode: KnowledgebaseFAQQuestionIndexMode;
|
|
32
36
|
/** Optional for knowledge bases created before negative matching was configurable. */
|
|
33
37
|
negativeMatchMode?: KnowledgebaseFAQNegativeMatchMode;
|
|
38
|
+
/** Required for semantic mode; cosine similarity in [0, 1]. Immutable after creation. */
|
|
39
|
+
semanticThreshold?: number;
|
|
40
|
+
/** Required for semantic mode; negative minus positive similarity in (0, 2]. */
|
|
41
|
+
semanticMargin?: number;
|
|
34
42
|
};
|
|
35
43
|
export declare const DEFAULT_KNOWLEDGEBASE_FAQ_CONFIG: {
|
|
36
44
|
readonly indexMode: "question_only";
|
|
@@ -51,19 +59,32 @@ export declare enum KnowledgeStructureEnum {
|
|
|
51
59
|
ParentChild = "parent-child",
|
|
52
60
|
QA = "qa"
|
|
53
61
|
}
|
|
62
|
+
export type KnowledgeParserSelection = {
|
|
63
|
+
transformerType: string;
|
|
64
|
+
transformerIntegration?: string;
|
|
65
|
+
transformer?: {
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
54
69
|
export type KnowledgebaseParserConfig = {
|
|
70
|
+
/** Canonical extension -> parser. Null explicitly restores system defaults, including legacy PDF settings. */
|
|
71
|
+
parsers?: {
|
|
72
|
+
[format: string]: KnowledgeParserSelection | null;
|
|
73
|
+
};
|
|
74
|
+
spreadsheet?: Pick<DocumentSpreadsheetParserConfig, 'firstRowAsHeader'>;
|
|
75
|
+
tableMetadataRequirements?: string;
|
|
76
|
+
/** Additional cl100k_base token cap for text retrieval chunks; 0 disables it. Context parents are retained. */
|
|
77
|
+
maxChunkTokens?: number;
|
|
78
|
+
/** Public natural-language boundary hint; absence means auto. */
|
|
79
|
+
chunkLanguageHint?: KnowledgeChunkLanguageHint;
|
|
80
|
+
questionGeneration?: KnowledgeQuestionGenerationConfig;
|
|
55
81
|
pages?: number[][];
|
|
56
82
|
embeddingBatchSize?: number;
|
|
57
83
|
chunkSize: number | null;
|
|
58
84
|
chunkOverlap: number | null;
|
|
59
85
|
delimiter: string | null;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
transformerIntegration?: string;
|
|
63
|
-
transformer?: {
|
|
64
|
-
[key: string]: unknown;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
86
|
+
/** Legacy PDF selection; parsers.pdf takes precedence when present. */
|
|
87
|
+
pdfParser?: KnowledgeParserSelection;
|
|
67
88
|
textSplitterType?: string;
|
|
68
89
|
textSplitter?: {
|
|
69
90
|
[key: string]: unknown;
|
|
@@ -78,7 +99,15 @@ export type KnowledgebaseParserConfig = {
|
|
|
78
99
|
/**
|
|
79
100
|
* Type of rag knowledgebase
|
|
80
101
|
*/
|
|
102
|
+
export interface KnowledgeVectorStoreOptions {
|
|
103
|
+
default: VectorTypeEnum;
|
|
104
|
+
stores: {
|
|
105
|
+
type: VectorTypeEnum;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
81
108
|
export type TKnowledgebase = {
|
|
109
|
+
/** Null on legacy knowledgebases: use the deployment default. */
|
|
110
|
+
vectorStore?: VectorTypeEnum | null;
|
|
82
111
|
/**
|
|
83
112
|
* KB name
|
|
84
113
|
*/
|
|
@@ -121,6 +150,7 @@ export type TKnowledgebase = {
|
|
|
121
150
|
* These are machine-readable identifiers, not user-facing search tags.
|
|
122
151
|
*/
|
|
123
152
|
applicationTags?: string[];
|
|
153
|
+
automaticTagging?: KnowledgeAutomaticTaggingConfig | null;
|
|
124
154
|
/**
|
|
125
155
|
* Public in tenant or in organization or private
|
|
126
156
|
* @default private
|
|
@@ -4,8 +4,8 @@ import type { McpApiKeySubjectType } from './mcp-auth.model';
|
|
|
4
4
|
import type { McpCapabilityDescriptor, McpCapabilityType } from './mcp-capability.model';
|
|
5
5
|
export declare const MCP_PROTOCOL_VERSION: "2026-07-28";
|
|
6
6
|
export declare const MCP_TASK_EXTENSION_ID: "io.modelcontextprotocol/tasks";
|
|
7
|
-
export declare const MCP_HTTP_CORS_REQUEST_HEADERS: readonly ["MCP-Protocol-Version", "Mcp-Method", "Mcp-Name", "Traceparent", "Tracestate", "Baggage", "X-Request-Id"];
|
|
8
|
-
export declare const MCP_HTTP_CORS_EXPOSED_HEADERS: readonly ["WWW-Authenticate", "MCP-Protocol-Version", "X-Request-Id"];
|
|
7
|
+
export declare const MCP_HTTP_CORS_REQUEST_HEADERS: readonly ["MCP-Protocol-Version", "Mcp-Session-Id", "Mcp-Method", "Mcp-Name", "Traceparent", "Tracestate", "Baggage", "X-Request-Id"];
|
|
8
|
+
export declare const MCP_HTTP_CORS_EXPOSED_HEADERS: readonly ["WWW-Authenticate", "MCP-Protocol-Version", "Mcp-Session-Id", "X-Request-Id"];
|
|
9
9
|
export declare const MCP_PUBLICATION_STATUSES: readonly ["draft", "active", "disabled"];
|
|
10
10
|
export type McpPublicationStatus = (typeof MCP_PUBLICATION_STATUSES)[number];
|
|
11
11
|
export declare const MCP_PUBLICATION_REVIEW_STATUSES: readonly ["current", "required"];
|
|
@@ -22,12 +22,19 @@ export interface McpCapabilityPolicy {
|
|
|
22
22
|
windowSeconds: number;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
/** Host-owned execution configuration. Tool arguments cannot override these bindings. */
|
|
26
|
+
export interface McpPublicationRuntimeConfiguration {
|
|
27
|
+
files?: {
|
|
28
|
+
type: 'user';
|
|
29
|
+
};
|
|
30
|
+
}
|
|
25
31
|
export interface IMcpPublication extends IBasePerTenantAndOrganizationEntityModel {
|
|
26
32
|
name: string;
|
|
27
33
|
slug: string;
|
|
28
34
|
status: McpPublicationStatus;
|
|
29
35
|
authMethods: McpAuthMethod[];
|
|
30
36
|
instructions?: string | null;
|
|
37
|
+
runtime?: McpPublicationRuntimeConfiguration | null;
|
|
31
38
|
protocolVersion: typeof MCP_PROTOCOL_VERSION;
|
|
32
39
|
reviewStatus: McpPublicationReviewStatus;
|
|
33
40
|
reviewReason?: string | null;
|
|
@@ -8,6 +8,27 @@ export interface ITag extends IBasePerTenantAndOrganizationEntityModel {
|
|
|
8
8
|
color?: string;
|
|
9
9
|
isSelected?: boolean;
|
|
10
10
|
icon?: string;
|
|
11
|
+
targets?: TagTarget[];
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
isSystem?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type TagTarget = TagCategoryEnum | 'knowledgebase' | 'people' | 'integration';
|
|
16
|
+
export declare function getTagTargets(tag: ITag): TagTarget[];
|
|
17
|
+
export interface ITagUsage {
|
|
18
|
+
target: TagTarget;
|
|
19
|
+
count: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ITagDirectoryItem extends ITag {
|
|
22
|
+
editable: boolean;
|
|
23
|
+
usage: ITagUsage[];
|
|
24
|
+
}
|
|
25
|
+
/** A visible expert version associated with a tag; excludes private expert configuration. */
|
|
26
|
+
export interface ITagXpertUsage {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
version: string | null;
|
|
30
|
+
latest: boolean;
|
|
31
|
+
deleted: boolean;
|
|
11
32
|
}
|
|
12
33
|
export interface ITagName {
|
|
13
34
|
name?: string;
|
|
@@ -18,3 +39,4 @@ export declare enum TagCategoryEnum {
|
|
|
18
39
|
TOOLSET = "toolset",
|
|
19
40
|
XPERT = "xpert"
|
|
20
41
|
}
|
|
42
|
+
export declare const TAG_TARGETS: TagTarget[];
|