@xpert-ai/contracts 3.18.1 → 3.18.4

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 (41) hide show
  1. package/index.cjs.js +570 -73
  2. package/index.esm.js +517 -74
  3. package/package.json +2 -2
  4. package/src/ai/assistant-user-preference.model.d.ts +2 -0
  5. package/src/ai/chat.model.d.ts +13 -0
  6. package/src/ai/context-compression.model.d.ts +2 -1
  7. package/src/ai/evolution/candidate.d.ts +3 -0
  8. package/src/ai/evolution/change.d.ts +221 -0
  9. package/src/ai/evolution/evaluation.d.ts +1 -0
  10. package/src/ai/evolution/governance.d.ts +3 -1
  11. package/src/ai/evolution/index.d.ts +3 -0
  12. package/src/ai/evolution/learning-event.d.ts +2 -0
  13. package/src/ai/evolution/persistence.d.ts +82 -0
  14. package/src/ai/evolution/provider.d.ts +4 -0
  15. package/src/ai/evolution/release.d.ts +2 -0
  16. package/src/ai/evolution/strategy.d.ts +62 -0
  17. package/src/ai/evolution/target.d.ts +8 -5
  18. package/src/ai/index.d.ts +7 -0
  19. package/src/ai/knowledge-deletion.model.d.ts +25 -0
  20. package/src/ai/knowledge-doc.model.d.ts +29 -0
  21. package/src/ai/knowledge-faq.model.d.ts +72 -0
  22. package/src/ai/knowledge-filter.model.d.ts +9 -1
  23. package/src/ai/knowledge-graph.model.d.ts +23 -1
  24. package/src/ai/knowledge-identity.model.d.ts +42 -0
  25. package/src/ai/knowledge-parser.model.d.ts +15 -0
  26. package/src/ai/knowledge-pipeline.d.ts +3 -0
  27. package/src/ai/knowledge-wiki-identity.model.d.ts +11 -0
  28. package/src/ai/knowledge-wiki-organization.model.d.ts +110 -0
  29. package/src/ai/knowledge-wiki.model.d.ts +202 -0
  30. package/src/ai/knowledgebase-task.model.d.ts +2 -0
  31. package/src/ai/knowledgebase.model.d.ts +112 -2
  32. package/src/ai/mcp-capability.model.d.ts +7 -0
  33. package/src/ai/middleware.model.d.ts +2 -0
  34. package/src/ai/xpert-agent-execution.model.d.ts +1 -1
  35. package/src/ai/xpert-template.model.d.ts +20 -0
  36. package/src/ai/xpert.model.d.ts +9 -4
  37. package/src/data-source.model.d.ts +12 -0
  38. package/src/plugin.d.ts +12 -0
  39. package/src/view-extension/assistant-profile.d.ts +41 -0
  40. package/src/view-extension/index.d.ts +1 -0
  41. package/src/view-extension/model.d.ts +3 -0
@@ -14,6 +14,8 @@ export type DocumentParserConfig = {
14
14
  replaceWhitespace?: boolean;
15
15
  removeSensitive?: boolean;
16
16
  textSplitterType?: string;
17
+ /** Ordered literal separators. Unlike the legacy plugin string, commas need no escaping. */
18
+ separators?: string[];
17
19
  textSplitter?: {
18
20
  [key: string]: unknown;
19
21
  };
@@ -23,6 +25,8 @@ export type DocumentParserConfig = {
23
25
  [key: string]: unknown;
24
26
  };
25
27
  imageUnderstandingType?: string;
28
+ /** False is an explicit opt-out; absence retains legacy per-format defaults. */
29
+ imageUnderstandingEnabled?: boolean;
26
30
  imageUnderstandingIntegration?: string;
27
31
  imageUnderstanding?: {
28
32
  [key: string]: unknown;
@@ -34,6 +38,20 @@ export type DocumentTextParserConfig = DocumentParserConfig & {
34
38
  chunkSize?: number | null;
35
39
  chunkOverlap?: number | null;
36
40
  };
41
+ export type DocumentChunkSplitOptions = {
42
+ /** Ordered splitting priorities. An empty list splits only at maxChars; takes precedence over separator. */
43
+ separators?: string[];
44
+ /** Legacy single separator, used when separators is absent. */
45
+ separator?: string;
46
+ /** Maximum character count; this splitter does not count tokens. */
47
+ maxChars?: number;
48
+ };
49
+ export type DocumentParentChildParserConfig = {
50
+ parent: DocumentChunkSplitOptions & {
51
+ mode?: 'paragraph' | 'full';
52
+ };
53
+ child: DocumentChunkSplitOptions;
54
+ };
37
55
  export type SpreadsheetInterpretation = 'records' | 'form_document';
38
56
  export type SpreadsheetContextUnit = 'row' | 'sheet' | 'workbook';
39
57
  export type SpreadsheetOversizePolicy = 'sheet' | 'reject';
@@ -170,6 +188,12 @@ export type TDocSourceConfig = {
170
188
  };
171
189
  export type TKnowledgeDocument = {
172
190
  disabled?: boolean;
191
+ /** Soft-delete marker; ordinary read paths exclude these documents. */
192
+ deletedAt?: Date | null;
193
+ /** Hard-delete writer gate. A pending document is never eligible for read or publication. */
194
+ hardDeletePendingAt?: Date | null;
195
+ /** Monotonic fence captured by every document-derived writer. */
196
+ publicationEpoch?: number;
173
197
  knowledgebaseId?: string;
174
198
  /**
175
199
  * @deprecated use fileUrl instead
@@ -256,6 +280,8 @@ export type TKnowledgeDocument = {
256
280
  * The background job id
257
281
  */
258
282
  jobId?: string;
283
+ /** Server-owned pipeline attempt allowed to update this document on dispatch failure. */
284
+ processingExecutionId?: string | null;
259
285
  options?: TDocumentWebOptions;
260
286
  integrationId?: string;
261
287
  integration?: IIntegration;
@@ -296,6 +322,9 @@ export interface StandardDocumentMetadata {
296
322
  lastIncrementalSync?: KnowledgeDocumentLastIncrementalSync;
297
323
  }
298
324
  export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
325
+ /** Internal index containers are not user-uploaded documents. */
326
+ systemManaged?: boolean;
327
+ systemManagedType?: string;
299
328
  transformSnapshot?: KnowledgeDocumentTransformSnapshotRef;
300
329
  analysisSnapshot?: KnowledgeDocumentAnalysisSnapshotRef;
301
330
  documentAnalysis?: DocumentAnalysisMetadata;
@@ -0,0 +1,72 @@
1
+ import type { IDocChunkMetadata } from './knowledge-doc-chunk.model';
2
+ export declare const KNOWLEDGE_FAQ_STANDARD_QUESTION_MAX_LENGTH = 500;
3
+ export declare const KNOWLEDGE_FAQ_SIMILAR_QUESTION_MAX_COUNT = 10;
4
+ export declare const KNOWLEDGE_FAQ_SIMILAR_QUESTION_MAX_LENGTH = 500;
5
+ export declare const KNOWLEDGE_FAQ_NEGATIVE_QUESTION_MAX_COUNT = 10;
6
+ export declare const KNOWLEDGE_FAQ_NEGATIVE_QUESTION_MAX_LENGTH = 500;
7
+ export declare const KNOWLEDGE_FAQ_ANSWER_BLOCK_MAX_COUNT = 5;
8
+ export declare const KNOWLEDGE_FAQ_ANSWER_TOTAL_MAX_LENGTH = 10000;
9
+ export declare const KNOWLEDGE_FAQ_MAX_LOGICAL_VECTOR_COUNT: number;
10
+ export type KnowledgeFAQWriteInput = {
11
+ standardQuestion: string;
12
+ similarQuestions?: string[];
13
+ negativeQuestions?: string[];
14
+ answerBlocks: string[];
15
+ enabled?: boolean;
16
+ };
17
+ export type KnowledgeFAQUpdateInput = KnowledgeFAQWriteInput & {
18
+ version: number;
19
+ };
20
+ export type KnowledgeFAQListParams = {
21
+ search?: string;
22
+ enabled?: boolean;
23
+ skip?: number;
24
+ take?: number;
25
+ };
26
+ export type KnowledgeFAQExportFormat = 'csv' | 'json';
27
+ export type KnowledgeFAQImportMode = 'append' | 'replace';
28
+ export type KnowledgeFAQImportPreviewItem = {
29
+ row: number;
30
+ standardQuestion: string;
31
+ };
32
+ export type KnowledgeFAQImportPreview = {
33
+ total: number;
34
+ items: KnowledgeFAQImportPreviewItem[];
35
+ truncated: boolean;
36
+ };
37
+ export type KnowledgeFAQImportFailure = {
38
+ row: number;
39
+ standardQuestion?: string;
40
+ message: string;
41
+ };
42
+ export type KnowledgeFAQImportResult = {
43
+ total: number;
44
+ imported: number;
45
+ failed: KnowledgeFAQImportFailure[];
46
+ };
47
+ export interface IKnowledgeFAQEntry {
48
+ id: string;
49
+ knowledgebaseId: string;
50
+ standardQuestion: string;
51
+ similarQuestions: string[];
52
+ negativeQuestions: string[];
53
+ answerBlocks: string[];
54
+ enabled: boolean;
55
+ version: number;
56
+ createdAt?: Date;
57
+ updatedAt?: Date;
58
+ }
59
+ export type KnowledgeFAQVectorKey = 'combined' | `question:${number}` | `answer:${number}`;
60
+ export interface IKnowledgeFAQChunkMetadata extends IDocChunkMetadata {
61
+ contentKind: 'faq';
62
+ standardQuestion: string;
63
+ similarQuestions: string[];
64
+ negativeQuestions?: string[];
65
+ answerBlocks: string[];
66
+ enabled: boolean;
67
+ faqVectorIds: string[];
68
+ faqVectorId?: string;
69
+ faqVectorKey?: KnowledgeFAQVectorKey;
70
+ sourceChunkId?: string;
71
+ vectorSyncStatus?: 'pending' | 'ready' | 'failed';
72
+ }
@@ -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' | '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;
@@ -70,7 +72,13 @@ export type KnowledgeFilterDiagnostics = {
70
72
  filterLatency?: number;
71
73
  vectorLatency?: number;
72
74
  vectorBranchHitCount?: number;
75
+ keywordLatency?: number;
76
+ keywordCandidateCount?: number;
77
+ keywordBranchHitCount?: number;
78
+ keywordIndexStatus?: 'ready' | 'missing';
79
+ keywordFailureReason?: string;
73
80
  graphBranchHitCount?: number;
81
+ fusionMode?: 'legacy' | 'weighted_rrf';
74
82
  graphGlobalCandidateCount?: number;
75
83
  graphCandidateScanLimit?: number;
76
84
  graphCandidateScanRounds?: number;
@@ -17,7 +17,23 @@ export declare enum KnowledgeGraphIndexJobStatus {
17
17
  CANCELLED = "cancelled"
18
18
  }
19
19
  export type KnowledgeGraphIndexJobType = 'document' | 'rebuild';
20
- export type GraphRagRetrievalMode = 'vector' | 'graph' | 'hybrid';
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
+ };
36
+ export type GraphRagRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
21
37
  export type KnowledgeGraphItemOrigin = 'extracted' | 'manual' | 'curated';
22
38
  export type KnowledgeGraphVisibility = 'active' | 'hidden';
23
39
  export type GraphRagConfig = {
@@ -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,15 @@
1
+ import type { DocumentTextParserConfig } from './knowledge-doc.model';
2
+ import type { KnowledgebaseParserConfig } from './knowledgebase.model';
3
+ import type { IKnowledgeDocumentChunk, IDocChunkMetadata } from './knowledge-doc-chunk.model';
4
+ export interface KnowledgeChunkPreviewInput {
5
+ text: string;
6
+ type: 'txt' | 'md';
7
+ parserConfig: KnowledgebaseParserConfig;
8
+ }
9
+ export interface KnowledgeChunkPreviewResult {
10
+ chunks: IKnowledgeDocumentChunk<IDocChunkMetadata>[];
11
+ }
12
+ /** Only copy configured defaults; do not turn built-in defaults into document overrides. */
13
+ export declare function knowledgebaseDocumentParserDefaults(config?: KnowledgebaseParserConfig | null, documentType?: string): DocumentTextParserConfig;
14
+ /** Arrays are the canonical ordered format; retain the plugin's legacy comma syntax. */
15
+ export declare function decodeKnowledgeSeparators(value?: string | string[]): string[];
@@ -41,8 +41,11 @@ export interface IDocumentSourceProvider extends IDocumentNodeProvider {
41
41
  category: DocumentSourceProviderCategoryEnum;
42
42
  }
43
43
  export interface IDocumentProcessorProvider extends IDocumentNodeProvider {
44
+ /** Explicit file extensions supported for per-format knowledgebase defaults. */
45
+ supportedFileTypes?: string[];
44
46
  }
45
47
  export interface IDocumentChunkerProvider extends IDocumentNodeProvider {
48
+ structure?: KnowledgeStructureEnum;
46
49
  }
47
50
  export interface IDocumentUnderstandingProvider extends IDocumentNodeProvider {
48
51
  }
@@ -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
+ };
@@ -0,0 +1,202 @@
1
+ import type { IDocChunkMetadata } from './knowledge-doc-chunk.model';
2
+ export declare const KNOWLEDGE_WIKI_SCHEMA_VERSION = 1;
3
+ export type KnowledgeWikiExtractionGranularity = 'focused' | 'standard' | 'exhaustive';
4
+ export type KnowledgebaseWikiConfig = {
5
+ enabled: boolean;
6
+ extractionGranularity: KnowledgeWikiExtractionGranularity;
7
+ contentGenerationRequirements?: string;
8
+ extractionFocus?: string;
9
+ };
10
+ export type ResolvedKnowledgebaseWikiConfig = KnowledgebaseWikiConfig & {
11
+ contentGenerationRequirements: string;
12
+ extractionFocus: string;
13
+ };
14
+ export declare const KNOWLEDGE_WIKI_MAX_CUSTOM_INSTRUCTION_LENGTH = 4000;
15
+ export declare const DEFAULT_KNOWLEDGEBASE_WIKI_CONFIG: {
16
+ readonly enabled: false;
17
+ readonly extractionGranularity: "standard";
18
+ readonly contentGenerationRequirements: "";
19
+ readonly extractionFocus: "";
20
+ };
21
+ export declare function normalizeKnowledgebaseWikiConfig(config?: Partial<KnowledgebaseWikiConfig> | null): ResolvedKnowledgebaseWikiConfig;
22
+ export type KnowledgeWikiStatus = 'disabled' | 'indexing' | 'ready' | 'failed' | 'rebuild_required';
23
+ export type KnowledgeWikiAvailability = 'unavailable' | 'ready' | 'degraded';
24
+ export type KnowledgeWikiPageType = 'summary' | 'entity' | 'concept' | 'index';
25
+ export type KnowledgeWikiMappedPageType = Exclude<KnowledgeWikiPageType, 'index'>;
26
+ export type KnowledgeWikiPageStatus = 'building' | 'ready' | 'stale' | 'failed' | 'archived';
27
+ export type KnowledgeWikiProjectionStatus = 'pending' | 'ready' | 'failed' | 'disabled';
28
+ export type KnowledgeWikiJobType = 'classify' | 'source_map' | 'identity_resolve' | 'page_reduce' | 'retract' | 'rebuild' | 'finalize';
29
+ export type KnowledgeWikiJobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'stale' | 'cancelled';
30
+ export type KnowledgeWikiInvocationStatus = 'prepared' | 'running' | 'reconciling' | 'succeeded' | 'failed' | 'indeterminate';
31
+ export type KnowledgeWikiRecoveryAction = {
32
+ jobId: string;
33
+ invocationId: string;
34
+ reconciliationStatus: 'not_available' | 'pending' | 'recovered' | 'not_executed' | 'indeterminate';
35
+ failureReason?: 'preparation_failed' | 'request_rejected';
36
+ canRetry: boolean;
37
+ requiresAdditionalChargeConfirmation: boolean;
38
+ inputCurrent: boolean;
39
+ recommendedAction: 'wait' | 'retry_job' | 'full_rebuild';
40
+ };
41
+ export type KnowledgeWikiReaderStatus = {
42
+ canManage: false;
43
+ enabled: boolean;
44
+ status: KnowledgeWikiStatus;
45
+ availability: KnowledgeWikiAvailability;
46
+ readyPageCount: number;
47
+ requiresManagement: boolean;
48
+ errorCode?: string | null;
49
+ };
50
+ export type KnowledgeWikiJobCounts = {
51
+ queued: number;
52
+ running: number;
53
+ failed: number;
54
+ };
55
+ export type KnowledgeWikiPageCounts = {
56
+ ready: number;
57
+ stale: number;
58
+ failed: number;
59
+ archived: number;
60
+ projectionFailed: number;
61
+ };
62
+ export type KnowledgeWikiManagementStatus = Omit<KnowledgeWikiReaderStatus, 'canManage'> & {
63
+ canManage: true;
64
+ activeRevision?: number | null;
65
+ stagedRevision?: number | null;
66
+ activeConfigFingerprint?: string | null;
67
+ targetConfigFingerprint?: string | null;
68
+ rebuildRequiredReason?: 'generator_upgrade' | null;
69
+ generationJobs: KnowledgeWikiJobCounts;
70
+ pages: KnowledgeWikiPageCounts;
71
+ indeterminateInvocationCount: number;
72
+ billingRecoveryCount: number;
73
+ cleanupPendingCount: number;
74
+ cleanupFailedCount: number;
75
+ recoveryActions: KnowledgeWikiRecoveryAction[];
76
+ };
77
+ export type KnowledgeWikiStatusResponse = KnowledgeWikiReaderStatus | KnowledgeWikiManagementStatus;
78
+ export declare const KNOWLEDGE_WIKI_DOCUMENT_STATUS_BATCH_SIZE = 100;
79
+ export type KnowledgeWikiDocumentStatusResponse = {
80
+ /** Sources of currently published, usable Wiki pages, not merely completed parsing jobs. */
81
+ indexedDocumentIds: string[];
82
+ documents?: KnowledgeWikiDocumentProgress[];
83
+ };
84
+ export type KnowledgeWikiDocumentProgressState = 'not_started' | 'queued' | 'generating' | 'indexing' | 'publishing' | 'ready' | 'failed' | 'outdated' | 'no_content';
85
+ export type KnowledgeWikiDocumentStageState = 'pending' | 'running' | 'complete' | 'failed' | 'skipped';
86
+ export type KnowledgeWikiDocumentProgress = {
87
+ documentId: string;
88
+ state: KnowledgeWikiDocumentProgressState;
89
+ stages: {
90
+ generation: KnowledgeWikiDocumentStageState;
91
+ indexing: KnowledgeWikiDocumentStageState;
92
+ publication: KnowledgeWikiDocumentStageState;
93
+ };
94
+ /** A full rebuild publishes as a batch; another source can block publication. */
95
+ waitingForBatch?: boolean;
96
+ error?: string;
97
+ errorCode?: string;
98
+ retry?: {
99
+ jobId: string;
100
+ requiresAdditionalChargeConfirmation: boolean;
101
+ };
102
+ canView: boolean;
103
+ };
104
+ export type KnowledgeWikiPageContributionPayload = {
105
+ schemaVersion: typeof KNOWLEDGE_WIKI_SCHEMA_VERSION;
106
+ pageType: KnowledgeWikiMappedPageType;
107
+ canonicalName: string;
108
+ aliases: string[];
109
+ summary: string;
110
+ facts: Array<{
111
+ text: string;
112
+ sourceChunkIds: string[];
113
+ }>;
114
+ suggestedLinks: Array<{
115
+ targetType: KnowledgeWikiPageType;
116
+ targetCanonicalName: string;
117
+ label?: string;
118
+ }>;
119
+ };
120
+ /** One source's contributions after identity resolution. Aggregate counts may exceed Map output limits. */
121
+ export type KnowledgeWikiPageSourcePayload = KnowledgeWikiPageContributionPayload;
122
+ export declare const KNOWLEDGE_WIKI_MAX_ALIASES = 20;
123
+ export declare const KNOWLEDGE_WIKI_MAX_FACTS = 100;
124
+ export declare const KNOWLEDGE_WIKI_MAX_SUGGESTED_LINKS = 50;
125
+ export declare const KNOWLEDGE_WIKI_MAX_SOURCE_CHUNKS_PER_FACT = 50;
126
+ export declare const KNOWLEDGE_WIKI_MAX_CANONICAL_NAME_LENGTH = 512;
127
+ export declare const KNOWLEDGE_WIKI_MAX_SUMMARY_LENGTH = 8000;
128
+ export declare const KNOWLEDGE_WIKI_MAX_FACT_LENGTH = 4000;
129
+ export declare function isKnowledgeWikiPageContributionPayload(value: unknown): value is KnowledgeWikiPageContributionPayload;
130
+ export declare function isKnowledgeWikiPageSourcePayload(value: unknown): value is KnowledgeWikiPageSourcePayload;
131
+ export type KnowledgeWikiPageGroup = 'knowledge' | 'summary';
132
+ export type KnowledgeWikiPageListParams = {
133
+ pageGroup?: KnowledgeWikiPageGroup;
134
+ folderId?: string;
135
+ unclassified?: boolean;
136
+ search?: string;
137
+ pageType?: KnowledgeWikiPageType;
138
+ status?: KnowledgeWikiPageStatus;
139
+ skip?: number;
140
+ take?: number;
141
+ };
142
+ export type KnowledgeWikiPageListItem = {
143
+ identityId?: string | null;
144
+ placement?: import('./knowledge-wiki-organization.model').KnowledgeWikiPlacement;
145
+ id: string;
146
+ pageKey: string;
147
+ pageType: KnowledgeWikiPageType;
148
+ canonicalName: string;
149
+ title: string;
150
+ slug: string;
151
+ summary: string;
152
+ aliases: string[];
153
+ status: KnowledgeWikiPageStatus;
154
+ projectionStatus: KnowledgeWikiProjectionStatus;
155
+ updatedAt?: Date;
156
+ };
157
+ export type KnowledgeWikiPageListResult = {
158
+ items: KnowledgeWikiPageListItem[];
159
+ total: number;
160
+ };
161
+ export type KnowledgeWikiPageEvidence = {
162
+ id: string;
163
+ sourceDocumentId: string;
164
+ sourceChunkId: string;
165
+ quote: string;
166
+ ordinal: number;
167
+ sectionAnchor?: string | null;
168
+ sourceAvailable: boolean;
169
+ };
170
+ export type KnowledgeWikiPageLink = {
171
+ pageId: string;
172
+ pageType: KnowledgeWikiPageType;
173
+ title: string;
174
+ slug: string;
175
+ sectionAnchor?: string | null;
176
+ label?: string | null;
177
+ };
178
+ export type KnowledgeWikiPageDetail = KnowledgeWikiPageListItem & {
179
+ markdown: string;
180
+ revision: number;
181
+ links: KnowledgeWikiPageLink[];
182
+ backlinks: KnowledgeWikiPageLink[];
183
+ evidence: KnowledgeWikiPageEvidence[];
184
+ };
185
+ export interface IKnowledgeWikiChunkMetadata extends IDocChunkMetadata {
186
+ contentKind: 'wiki';
187
+ wikiPageId: string;
188
+ wikiPageVersionId: string;
189
+ wikiPageKey: string;
190
+ wikiPageType: KnowledgeWikiPageType;
191
+ wikiRevision: number;
192
+ sectionAnchor: string;
193
+ projectionStatus: KnowledgeWikiProjectionStatus;
194
+ }
195
+ export declare function isKnowledgeWikiChunkMetadata(value: unknown): value is IKnowledgeWikiChunkMetadata;
196
+ export declare const KNOWLEDGE_WIKI_DEFAULT_PAGE_SIZE = 50;
197
+ export declare const KNOWLEDGE_WIKI_MAX_PAGE_SIZE = 100;
198
+ export declare const KNOWLEDGE_WIKI_MAX_SEARCH_LENGTH = 200;
199
+ export declare const KNOWLEDGE_WIKI_FAILED_CONTENT_RETENTION_DAYS = 7;
200
+ export declare const KNOWLEDGE_WIKI_OPERATION_RETENTION_DAYS = 30;
201
+ export declare const KNOWLEDGE_WIKI_DELETION_RECEIPT_RETENTION_DAYS = 90;
202
+ export declare const KNOWLEDGE_WIKI_STALE_VECTOR_CLEANUP_SLO_HOURS = 24;
@@ -24,6 +24,8 @@ export interface IKnowledgebaseTask extends IBasePerTenantAndOrganizationEntityM
24
24
  documents?: Partial<IKnowledgeDocument>[];
25
25
  /** Propagates full conversion vs. snapshot-only rechunking through the background task. */
26
26
  processingMode?: KnowledgeDocumentProcessingMode;
27
+ /** Server-created preview ID -> saved document ID bindings, grouped by source node. */
28
+ materializedSources?: Record<string, Record<string, string>>;
27
29
  };
28
30
  /**
29
31
  * Many to Many of documents in task