@xpert-ai/contracts 3.18.2 → 3.18.5

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 (42) hide show
  1. package/index.cjs.js +614 -93
  2. package/index.esm.js +563 -94
  3. package/package.json +2 -2
  4. package/src/ai/context-compression.model.d.ts +2 -1
  5. package/src/ai/evolution/candidate.d.ts +3 -0
  6. package/src/ai/evolution/change.d.ts +221 -0
  7. package/src/ai/evolution/evaluation.d.ts +1 -0
  8. package/src/ai/evolution/governance.d.ts +3 -1
  9. package/src/ai/evolution/index.d.ts +3 -0
  10. package/src/ai/evolution/learning-event.d.ts +2 -0
  11. package/src/ai/evolution/persistence.d.ts +82 -0
  12. package/src/ai/evolution/provider.d.ts +4 -0
  13. package/src/ai/evolution/release.d.ts +2 -0
  14. package/src/ai/evolution/strategy.d.ts +62 -0
  15. package/src/ai/evolution/target.d.ts +8 -5
  16. package/src/ai/index.d.ts +11 -0
  17. package/src/ai/knowledge-chunking.model.d.ts +59 -0
  18. package/src/ai/knowledge-deletion.model.d.ts +25 -0
  19. package/src/ai/knowledge-doc-chunk.model.d.ts +23 -0
  20. package/src/ai/knowledge-doc.model.d.ts +61 -0
  21. package/src/ai/knowledge-filter.model.d.ts +3 -1
  22. package/src/ai/knowledge-graph.model.d.ts +22 -0
  23. package/src/ai/knowledge-identity.model.d.ts +42 -0
  24. package/src/ai/knowledge-parser-selection.d.ts +7 -0
  25. package/src/ai/knowledge-parser.model.d.ts +18 -0
  26. package/src/ai/knowledge-pipeline.d.ts +15 -0
  27. package/src/ai/knowledge-question.model.d.ts +26 -0
  28. package/src/ai/knowledge-table.model.d.ts +72 -0
  29. package/src/ai/knowledge-tag.model.d.ts +32 -0
  30. package/src/ai/knowledge-wiki-identity.model.d.ts +11 -0
  31. package/src/ai/knowledge-wiki-organization.model.d.ts +110 -0
  32. package/src/ai/knowledge-wiki.model.d.ts +202 -0
  33. package/src/ai/knowledgebase-task.model.d.ts +2 -0
  34. package/src/ai/knowledgebase.model.d.ts +65 -3
  35. package/src/ai/mcp-capability.model.d.ts +7 -0
  36. package/src/ai/mcp-publication.model.d.ts +9 -2
  37. package/src/ai/middleware.model.d.ts +2 -0
  38. package/src/ai/xpert-agent-execution.model.d.ts +1 -1
  39. package/src/ai/xpert-template.model.d.ts +20 -0
  40. package/src/ai/xpert.model.d.ts +5 -2
  41. package/src/tag-entity.model.d.ts +22 -0
  42. package/src/view-extension/model.d.ts +20 -0
@@ -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,10 +14,19 @@ 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;
16
27
  textSplitterType?: string;
28
+ /** Ordered literal separators. Unlike the legacy plugin string, commas need no escaping. */
29
+ separators?: string[];
17
30
  textSplitter?: {
18
31
  [key: string]: unknown;
19
32
  };
@@ -23,6 +36,8 @@ export type DocumentParserConfig = {
23
36
  [key: string]: unknown;
24
37
  };
25
38
  imageUnderstandingType?: string;
39
+ /** False is an explicit opt-out; absence retains legacy per-format defaults. */
40
+ imageUnderstandingEnabled?: boolean;
26
41
  imageUnderstandingIntegration?: string;
27
42
  imageUnderstanding?: {
28
43
  [key: string]: unknown;
@@ -34,6 +49,20 @@ export type DocumentTextParserConfig = DocumentParserConfig & {
34
49
  chunkSize?: number | null;
35
50
  chunkOverlap?: number | null;
36
51
  };
52
+ export type DocumentChunkSplitOptions = {
53
+ /** Ordered splitting priorities. An empty list splits only at maxChars; takes precedence over separator. */
54
+ separators?: string[];
55
+ /** Legacy single separator, used when separators is absent. */
56
+ separator?: string;
57
+ /** Maximum character count; this splitter does not count tokens. */
58
+ maxChars?: number;
59
+ };
60
+ export type DocumentParentChildParserConfig = {
61
+ parent: DocumentChunkSplitOptions & {
62
+ mode?: 'paragraph' | 'full';
63
+ };
64
+ child: DocumentChunkSplitOptions;
65
+ };
37
66
  export type SpreadsheetInterpretation = 'records' | 'form_document';
38
67
  export type SpreadsheetContextUnit = 'row' | 'sheet' | 'workbook';
39
68
  export type SpreadsheetOversizePolicy = 'sheet' | 'reject';
@@ -43,6 +72,8 @@ export type SpreadsheetOutputFormat = 'anchored_markdown';
43
72
  * Custom document transformers take precedence over this configuration.
44
73
  */
45
74
  export type DocumentSpreadsheetParserConfig = {
75
+ /** Native Excel record parsing only. Absence preserves the legacy first-row header behavior. */
76
+ firstRowAsHeader?: boolean;
46
77
  interpretation?: SpreadsheetInterpretation;
47
78
  contextUnit?: SpreadsheetContextUnit;
48
79
  oversizePolicy?: SpreadsheetOversizePolicy;
@@ -170,6 +201,12 @@ export type TDocSourceConfig = {
170
201
  };
171
202
  export type TKnowledgeDocument = {
172
203
  disabled?: boolean;
204
+ /** Soft-delete marker; ordinary read paths exclude these documents. */
205
+ deletedAt?: Date | null;
206
+ /** Hard-delete writer gate. A pending document is never eligible for read or publication. */
207
+ hardDeletePendingAt?: Date | null;
208
+ /** Monotonic fence captured by every document-derived writer. */
209
+ publicationEpoch?: number;
173
210
  knowledgebaseId?: string;
174
211
  /**
175
212
  * @deprecated use fileUrl instead
@@ -256,6 +293,8 @@ export type TKnowledgeDocument = {
256
293
  * The background job id
257
294
  */
258
295
  jobId?: string;
296
+ /** Server-owned pipeline attempt allowed to update this document on dispatch failure. */
297
+ processingExecutionId?: string | null;
259
298
  options?: TDocumentWebOptions;
260
299
  integrationId?: string;
261
300
  integration?: IIntegration;
@@ -272,6 +311,8 @@ export type TKnowledgeDocument = {
272
311
  export interface IKnowledgeDocument<T extends KnowledgeDocumentMetadata = KnowledgeDocumentMetadata> extends TKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
273
312
  parent?: IKnowledgeDocument | null;
274
313
  children?: IKnowledgeDocument[];
314
+ /** Existing manual and automatic associations, included when requested for display. */
315
+ tagAssignments?: IKnowledgeDocumentTag[];
275
316
  knowledgebase?: IKnowledgebase;
276
317
  draft?: TKnowledgeDocument;
277
318
  metadata?: T;
@@ -295,7 +336,27 @@ export interface StandardDocumentMetadata {
295
336
  tokens?: number;
296
337
  lastIncrementalSync?: KnowledgeDocumentLastIncrementalSync;
297
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
+ };
298
348
  export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
349
+ /** Server-owned identity and label of the last completed document conversion. */
350
+ parser?: string;
351
+ parserLabel?: I18nObject;
352
+ parserDiagnostics?: DocumentParserDiagnostics;
353
+ /** Server-owned generated table descriptions and publication state. */
354
+ tableMetadata?: KnowledgeTableMetadata;
355
+ /** Existing source summary, available to optional document classifiers. */
356
+ summary?: string;
357
+ /** Internal index containers are not user-uploaded documents. */
358
+ systemManaged?: boolean;
359
+ systemManagedType?: string;
299
360
  transformSnapshot?: KnowledgeDocumentTransformSnapshotRef;
300
361
  analysisSnapshot?: KnowledgeDocumentAnalysisSnapshotRef;
301
362
  documentAnalysis?: DocumentAnalysisMetadata;
@@ -1,3 +1,4 @@
1
+ import type { KnowledgeRetrievalContentScope } from './knowledgebase.model';
1
2
  export declare const KNOWLEDGE_FILTER_VERSION: 2;
2
3
  export declare const KNOWLEDGE_FILTER_MAX_DEPTH = 3;
3
4
  export declare const KNOWLEDGE_FILTER_MAX_CONDITIONS = 20;
@@ -52,8 +53,9 @@ export type KnowledgeFilterSources = {
52
53
  dynamic?: KnowledgeFilterNode;
53
54
  };
54
55
  export type KnowledgeFilterStatus = 'not_applied' | 'applied' | 'dynamic_fallback' | 'failed';
55
- 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' | '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' | 'unsupported_backend' | 'unsupported_retrieval_mode';
56
57
  export type KnowledgeFilterDiagnostics = {
58
+ contentScope?: KnowledgeRetrievalContentScope;
57
59
  filterVersion: typeof KNOWLEDGE_FILTER_VERSION;
58
60
  fixedFilter?: KnowledgeFilterNode;
59
61
  requestFilter?: KnowledgeFilterNode;
@@ -17,6 +17,22 @@ export declare enum KnowledgeGraphIndexJobStatus {
17
17
  CANCELLED = "cancelled"
18
18
  }
19
19
  export type KnowledgeGraphIndexJobType = 'document' | 'rebuild';
20
+ export type KnowledgeGraphIndexStage = 'extraction' | 'persistence' | 'indexing';
21
+ export type KnowledgeGraphIndexResult = 'indexed' | 'empty' | 'superseded' | 'disabled';
22
+ export type KnowledgeGraphDocumentStageState = 'pending' | 'running' | 'complete' | 'failed';
23
+ export type KnowledgeGraphDocumentState = 'disabled' | 'source_disabled' | 'waiting_source' | 'not_started' | 'outdated' | 'queued' | 'running' | 'ready' | 'failed' | 'cancelled' | 'no_content' | 'completed';
24
+ export declare const KNOWLEDGE_GRAPH_DOCUMENT_STATUS_BATCH_SIZE = 100;
25
+ export type KnowledgeGraphDocumentsProgressResponse = {
26
+ documents: KnowledgeGraphDocumentProgress[];
27
+ };
28
+ export type KnowledgeGraphDocumentProgress = {
29
+ documentId: string;
30
+ state: KnowledgeGraphDocumentState;
31
+ stages?: Record<KnowledgeGraphIndexStage, KnowledgeGraphDocumentStageState>;
32
+ processedChunks?: number | null;
33
+ totalChunks?: number | null;
34
+ error?: string | null;
35
+ };
20
36
  export type GraphRagRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
21
37
  export type KnowledgeGraphItemOrigin = 'extracted' | 'manual' | 'curated';
22
38
  export type KnowledgeGraphVisibility = 'active' | 'hidden';
@@ -36,6 +52,7 @@ export type KnowledgeGraphEvidence = {
36
52
  confidence?: number | null;
37
53
  };
38
54
  export interface IKnowledgeGraphEntity extends IBasePerTenantAndOrganizationEntityModel {
55
+ identityId?: string | null;
39
56
  knowledgebaseId?: string;
40
57
  knowledgebase?: IKnowledgebase;
41
58
  type: string;
@@ -112,6 +129,11 @@ export interface IKnowledgeGraphIndexJob extends IBasePerTenantAndOrganizationEn
112
129
  document?: IKnowledgeDocument | null;
113
130
  type: KnowledgeGraphIndexJobType;
114
131
  status: KnowledgeGraphIndexJobStatus;
132
+ stage?: KnowledgeGraphIndexStage | null;
133
+ result?: KnowledgeGraphIndexResult | null;
134
+ sourceContentHash?: string | null;
135
+ sourcePublicationEpoch?: number | null;
136
+ extractionId?: string | null;
115
137
  revision?: number | null;
116
138
  totalChunks?: number | null;
117
139
  processedChunks?: number | null;
@@ -0,0 +1,42 @@
1
+ /** Identity belongs to the knowledgebase, independently of its Wiki and Graph projections. */
2
+ export type KnowledgeEntityType = 'person' | 'organization' | 'product' | 'project' | 'place' | 'event' | 'other' | 'unknown';
3
+ export type KnowledgeIdentityDescriptor = {
4
+ kind: 'entity';
5
+ entityType: KnowledgeEntityType;
6
+ description: string;
7
+ scope: string | null;
8
+ /** Include the issuing authority and scope in the namespace. */
9
+ identifiers: Array<{
10
+ namespace: string;
11
+ value: string;
12
+ }>;
13
+ } | {
14
+ kind: 'concept';
15
+ definition: string;
16
+ domain: string | null;
17
+ scope: string | null;
18
+ };
19
+ export type KnowledgeIdentityEmbedding = {
20
+ modelFingerprint: string;
21
+ contentFingerprint: string;
22
+ vector: number[];
23
+ };
24
+ export type KnowledgeIdentityProfile = {
25
+ descriptor: KnowledgeIdentityDescriptor;
26
+ aliases: string[];
27
+ embedding: KnowledgeIdentityEmbedding | null;
28
+ };
29
+ export type KnowledgeIdentityDecision = {
30
+ outcome: 'new' | 'same' | 'uncertain';
31
+ reason: string;
32
+ comparedIdentityIds: string[];
33
+ };
34
+ export type KnowledgeIdentityObservationPayload = {
35
+ canonicalName: string;
36
+ descriptor: KnowledgeIdentityDescriptor;
37
+ aliases: string[];
38
+ facts: Array<{
39
+ text: string;
40
+ sourceChunkIds: string[];
41
+ }>;
42
+ };
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,18 @@
1
+ import type { DocumentTextParserConfig, DocumentSheetParserConfig } from './knowledge-doc.model';
2
+ import type { KnowledgebaseParserConfig } from './knowledgebase.model';
3
+ import type { IKnowledgeDocumentChunk, IDocChunkMetadata } from './knowledge-doc-chunk.model';
4
+ import type { KnowledgeChunkingDecision, KnowledgeChunkLanguageDecision } from './knowledge-chunking.model';
5
+ export interface KnowledgeChunkPreviewInput {
6
+ text: string;
7
+ type: 'txt' | 'md';
8
+ parserConfig: KnowledgebaseParserConfig;
9
+ }
10
+ export interface KnowledgeChunkPreviewResult {
11
+ chunks: IKnowledgeDocumentChunk<IDocChunkMetadata>[];
12
+ decisions?: KnowledgeChunkingDecision[];
13
+ languages?: KnowledgeChunkLanguageDecision[];
14
+ }
15
+ /** Only copy configured defaults; do not turn built-in defaults into document overrides. */
16
+ export declare function knowledgebaseDocumentParserDefaults(config?: KnowledgebaseParserConfig | null, documentType?: string): DocumentTextParserConfig & Partial<DocumentSheetParserConfig>;
17
+ /** Arrays are the canonical ordered format; retain the plugin's legacy comma syntax. */
18
+ export declare function decodeKnowledgeSeparators(value?: string | string[]): string[];
@@ -41,8 +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';
46
+ /** Explicit file extensions supported for per-format knowledgebase defaults. */
47
+ supportedFileTypes?: string[];
48
+ /** Converter already extracts image text; run an additional image pass only when explicitly enabled. */
49
+ providesImageText?: boolean;
44
50
  }
45
51
  export interface IDocumentChunkerProvider extends IDocumentNodeProvider {
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
+ };
46
61
  }
47
62
  export interface IDocumentUnderstandingProvider extends IDocumentNodeProvider {
48
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
+ }
@@ -0,0 +1,11 @@
1
+ import { KnowledgeEntityType, KnowledgeIdentityDecision, KnowledgeIdentityDescriptor, KnowledgeIdentityEmbedding } from './knowledge-identity.model';
2
+ export type KnowledgeWikiEntityType = KnowledgeEntityType;
3
+ export type KnowledgeWikiIdentityDescriptor = KnowledgeIdentityDescriptor | {
4
+ kind: 'summary';
5
+ };
6
+ export type KnowledgeWikiIdentityEmbedding = KnowledgeIdentityEmbedding;
7
+ export type KnowledgeWikiIdentityDecision = KnowledgeIdentityDecision | {
8
+ outcome: 'source';
9
+ reason: string;
10
+ comparedIdentityIds: string[];
11
+ };
@@ -0,0 +1,110 @@
1
+ import type { KnowledgeWikiJobStatus, KnowledgeWikiPageListItem, KnowledgeWikiPageListParams, KnowledgeWikiPageType } from './knowledge-wiki.model';
2
+ export type KnowledgeWikiTaxonomyQuery = Pick<KnowledgeWikiPageListParams, 'search' | 'pageType' | 'pageGroup'>;
3
+ export type KnowledgeWikiFolder = {
4
+ id: string;
5
+ parentId: string | null;
6
+ name: string;
7
+ description: string;
8
+ position: number;
9
+ version: number;
10
+ pageCount: number;
11
+ };
12
+ export type KnowledgeWikiFolderInput = Pick<KnowledgeWikiFolder, 'name' | 'description' | 'parentId' | 'position'>;
13
+ export type KnowledgeWikiPlacement = {
14
+ folderId: string | null;
15
+ source: 'automatic' | 'manual';
16
+ version: number;
17
+ };
18
+ export type KnowledgeWikiTaxonomy = {
19
+ enabled: boolean;
20
+ revision: number;
21
+ folders: KnowledgeWikiFolder[];
22
+ unclassifiedCount: number;
23
+ total: number;
24
+ };
25
+ export type KnowledgeWikiClassificationOutput = {
26
+ folderId: string | null;
27
+ reason: string;
28
+ };
29
+ export type KnowledgeWikiPageClassificationInput = {
30
+ mode?: 'page';
31
+ runId: string;
32
+ pageId: string;
33
+ pageVersionId: string;
34
+ taxonomyRevision: number;
35
+ placementVersion: number;
36
+ applyAutomatically: boolean;
37
+ /** Older automatic jobs without a trigger were queued by publication. */
38
+ trigger?: 'publication' | 'backfill';
39
+ result?: KnowledgeWikiClassificationOutput;
40
+ outcome?: 'applied' | 'suggested' | 'unclassified' | 'stale';
41
+ };
42
+ export type KnowledgeWikiTaxonomyOutput = {
43
+ folders: Array<{
44
+ name: string;
45
+ description: string;
46
+ pageIds: string[];
47
+ }>;
48
+ unclassifiedPageIds: string[];
49
+ };
50
+ export type KnowledgeWikiPendingPublication = {
51
+ pageId: string;
52
+ pageVersionId: string;
53
+ runId: string;
54
+ billingPrincipalId: string;
55
+ };
56
+ export type KnowledgeWikiTaxonomyClassificationInput = {
57
+ mode: 'taxonomy';
58
+ /** Publications arriving while this taxonomy is being generated. Drained atomically on completion. */
59
+ pendingPublications?: KnowledgeWikiPendingPublication[];
60
+ runId: string;
61
+ taxonomyRevision: number;
62
+ pages: Array<{
63
+ pageId: string;
64
+ pageVersionId: string;
65
+ placementVersion: number;
66
+ }>;
67
+ appliedTaxonomyRevision?: number;
68
+ results?: Array<{
69
+ pageId: string;
70
+ result: KnowledgeWikiClassificationOutput;
71
+ outcome: 'applied' | 'unclassified' | 'stale';
72
+ }>;
73
+ };
74
+ export type KnowledgeWikiClassificationInput = KnowledgeWikiPageClassificationInput | KnowledgeWikiTaxonomyClassificationInput;
75
+ export type KnowledgeWikiClassificationStatus = {
76
+ activeJobs: number;
77
+ };
78
+ export type KnowledgeWikiClassificationItem = {
79
+ jobId: string;
80
+ runId: string;
81
+ pageId: string;
82
+ title: string;
83
+ status: KnowledgeWikiJobStatus;
84
+ result?: KnowledgeWikiClassificationOutput;
85
+ outcome?: KnowledgeWikiPageClassificationInput['outcome'];
86
+ error?: string;
87
+ requiresAdditionalChargeConfirmation: boolean;
88
+ };
89
+ export type KnowledgeWikiGraphParams = {
90
+ focusPageId?: string;
91
+ depth?: number;
92
+ take?: number;
93
+ pageType?: KnowledgeWikiPageType;
94
+ includeIndex?: boolean;
95
+ };
96
+ export type KnowledgeWikiGraphNode = KnowledgeWikiPageListItem & {
97
+ sourceCount: number;
98
+ };
99
+ export type KnowledgeWikiGraphEdge = {
100
+ id: string;
101
+ source: string;
102
+ target: string;
103
+ label?: string | null;
104
+ sectionAnchor?: string | null;
105
+ };
106
+ export type KnowledgeWikiGraph = {
107
+ nodes: KnowledgeWikiGraphNode[];
108
+ edges: KnowledgeWikiGraphEdge[];
109
+ truncated: boolean;
110
+ };