@xpert-ai/contracts 3.18.4 → 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.
@@ -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,7 +336,24 @@ 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
+ };
324
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;
325
357
  /** Internal index containers are not user-uploaded documents. */
326
358
  systemManaged?: boolean;
327
359
  systemManagedType?: string;
@@ -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;
@@ -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,11 @@
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';
2
5
  import { ICopilotModel } from './copilot-model.model';
3
6
  import { I18nObject, TAvatar } from '../types';
4
7
  import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
5
- import { IKnowledgeDocument } from './knowledge-doc.model';
8
+ import { IKnowledgeDocument, type DocumentSpreadsheetParserConfig } from './knowledge-doc.model';
6
9
  import { IXpert } from './xpert.model';
7
10
  import { IIntegration } from '../integration.model';
8
11
  import { IDocChunkMetadata } from './knowledge-doc-chunk.model';
@@ -51,19 +54,32 @@ export declare enum KnowledgeStructureEnum {
51
54
  ParentChild = "parent-child",
52
55
  QA = "qa"
53
56
  }
57
+ export type KnowledgeParserSelection = {
58
+ transformerType: string;
59
+ transformerIntegration?: string;
60
+ transformer?: {
61
+ [key: string]: unknown;
62
+ };
63
+ };
54
64
  export type KnowledgebaseParserConfig = {
65
+ /** Canonical extension -> parser. Null explicitly restores system defaults, including legacy PDF settings. */
66
+ parsers?: {
67
+ [format: string]: KnowledgeParserSelection | null;
68
+ };
69
+ spreadsheet?: Pick<DocumentSpreadsheetParserConfig, 'firstRowAsHeader'>;
70
+ tableMetadataRequirements?: string;
71
+ /** Additional cl100k_base token cap for text retrieval chunks; 0 disables it. Context parents are retained. */
72
+ maxChunkTokens?: number;
73
+ /** Public natural-language boundary hint; absence means auto. */
74
+ chunkLanguageHint?: KnowledgeChunkLanguageHint;
75
+ questionGeneration?: KnowledgeQuestionGenerationConfig;
55
76
  pages?: number[][];
56
77
  embeddingBatchSize?: number;
57
78
  chunkSize: number | null;
58
79
  chunkOverlap: number | null;
59
80
  delimiter: string | null;
60
- pdfParser?: {
61
- transformerType: string;
62
- transformerIntegration?: string;
63
- transformer?: {
64
- [key: string]: unknown;
65
- };
66
- };
81
+ /** Legacy PDF selection; parsers.pdf takes precedence when present. */
82
+ pdfParser?: KnowledgeParserSelection;
67
83
  textSplitterType?: string;
68
84
  textSplitter?: {
69
85
  [key: string]: unknown;
@@ -121,6 +137,7 @@ export type TKnowledgebase = {
121
137
  * These are machine-readable identifiers, not user-facing search tags.
122
138
  */
123
139
  applicationTags?: string[];
140
+ automaticTagging?: KnowledgeAutomaticTaggingConfig | null;
124
141
  /**
125
142
  * Public in tenant or in organization or private
126
143
  * @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[];
@@ -561,3 +561,23 @@ export interface XpertViewActionResult<TData = unknown> {
561
561
  data?: TData;
562
562
  refresh?: boolean;
563
563
  }
564
+ /** Append text selections to the current draft without sending or replacing it. */
565
+ export declare const ASSISTANT_COMPOSER_APPEND_REFERENCES_COMMAND = "assistant.composer.append_references";
566
+ export type AssistantComposerReference = {
567
+ id?: string;
568
+ label?: string;
569
+ text: string;
570
+ } & ({
571
+ type: 'code';
572
+ path: string;
573
+ startLine: number;
574
+ endLine: number;
575
+ language?: string;
576
+ } | {
577
+ type: 'quote';
578
+ source?: string;
579
+ messageId?: string;
580
+ });
581
+ export type AssistantComposerAppendReferencesPayload = {
582
+ references: AssistantComposerReference[];
583
+ };