@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
@@ -1,3 +1,4 @@
1
+ import type { TKBRetrievalSettings } from './xpert.model';
1
2
  import { ICopilotModel } from './copilot-model.model';
2
3
  import { I18nObject, TAvatar } from '../types';
3
4
  import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
@@ -6,6 +7,7 @@ import { IXpert } from './xpert.model';
6
7
  import { IIntegration } from '../integration.model';
7
8
  import { IDocChunkMetadata } from './knowledge-doc-chunk.model';
8
9
  import type { GraphRagConfig, KnowledgeGraphStatus } from './knowledge-graph.model';
10
+ import type { KnowledgebaseWikiConfig, KnowledgeWikiStatus, KnowledgeWikiAvailability } from './knowledge-wiki.model';
9
11
  /**
10
12
  * Non-internal types should remain the same as IntegrationEnum.
11
13
  */
@@ -14,8 +16,30 @@ export declare enum KnowledgeProviderEnum {
14
16
  }
15
17
  export declare enum KnowledgebaseTypeEnum {
16
18
  Standard = "standard",
19
+ FAQ = "faq",
17
20
  External = "external"
18
21
  }
22
+ /**
23
+ * Knowledge bases created before the type discriminator was introduced are document knowledge bases.
24
+ */
25
+ export declare function isDocumentKnowledgebaseType(type: KnowledgebaseTypeEnum | null | undefined): boolean;
26
+ export type KnowledgebaseFAQIndexMode = 'question_only' | 'question_answer';
27
+ export type KnowledgebaseFAQQuestionIndexMode = 'combined' | 'separate';
28
+ export type KnowledgebaseFAQNegativeMatchMode = 'exact' | 'semantic';
29
+ export type KnowledgebaseFAQConfig = {
30
+ indexMode: KnowledgebaseFAQIndexMode;
31
+ questionIndexMode: KnowledgebaseFAQQuestionIndexMode;
32
+ /** Optional for knowledge bases created before negative matching was configurable. */
33
+ negativeMatchMode?: KnowledgebaseFAQNegativeMatchMode;
34
+ };
35
+ export declare const DEFAULT_KNOWLEDGEBASE_FAQ_CONFIG: {
36
+ readonly indexMode: "question_only";
37
+ readonly questionIndexMode: "separate";
38
+ readonly negativeMatchMode: "exact";
39
+ };
40
+ export type KnowledgeRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
41
+ /** Request-local content selection, independent of algorithms and persisted recall settings. */
42
+ export type KnowledgeRetrievalContentScope = 'all' | 'original' | 'wiki';
19
43
  export declare enum KnowledgebaseStatusEnum {
20
44
  READY = "ready",
21
45
  REBUILD_REQUIRED = "rebuild_required",
@@ -33,6 +57,23 @@ export type KnowledgebaseParserConfig = {
33
57
  chunkSize: number | null;
34
58
  chunkOverlap: number | null;
35
59
  delimiter: string | null;
60
+ pdfParser?: {
61
+ transformerType: string;
62
+ transformerIntegration?: string;
63
+ transformer?: {
64
+ [key: string]: unknown;
65
+ };
66
+ };
67
+ textSplitterType?: string;
68
+ textSplitter?: {
69
+ [key: string]: unknown;
70
+ };
71
+ separators?: string[];
72
+ imageUnderstandingEnabled?: boolean;
73
+ imageUnderstandingType?: string;
74
+ imageUnderstanding?: {
75
+ [key: string]: unknown;
76
+ };
36
77
  };
37
78
  /**
38
79
  * Type of rag knowledgebase
@@ -46,6 +87,23 @@ export type TKnowledgebase = {
46
87
  * Type of KB
47
88
  */
48
89
  type: KnowledgebaseTypeEnum;
90
+ /**
91
+ * Creation-time indexing behavior for FAQ knowledge bases.
92
+ */
93
+ faqConfig?: KnowledgebaseFAQConfig | null;
94
+ /** Optional generated Wiki capability for Standard knowledgebases. */
95
+ wikiConfig?: KnowledgebaseWikiConfig | null;
96
+ wikiStatus?: KnowledgeWikiStatus | null;
97
+ wikiAvailability?: KnowledgeWikiAvailability | null;
98
+ wikiRevision?: number | null;
99
+ wikiActiveRevision?: number | null;
100
+ wikiStagedRevision?: number | null;
101
+ wikiBuildError?: string | null;
102
+ wikiRebuildRequiredReason?: 'generator_upgrade' | null;
103
+ wikiGeneratorVersion?: string | null;
104
+ wikiConfigFingerprint?: string | null;
105
+ canManageWiki?: boolean;
106
+ canManageDocumentDeletions?: boolean;
49
107
  /**
50
108
  * English | Chinese
51
109
  */
@@ -78,6 +136,9 @@ export type TKnowledgebase = {
78
136
  */
79
137
  chatModel?: ICopilotModel | null;
80
138
  chatModelId?: string | null;
139
+ /** Optional dedicated LLM for Wiki generation. Falls back to chatModel when unset. */
140
+ wikiModel?: ICopilotModel | null;
141
+ wikiModelId?: string | null;
81
142
  embeddingCollectionName?: string | null;
82
143
  embeddingModelFingerprint?: string | null;
83
144
  embeddingDimensions?: number | null;
@@ -169,19 +230,66 @@ export declare enum KnowledgebasePermission {
169
230
  * Recall parameters
170
231
  */
171
232
  export type TKBRecallParams = {
233
+ /** Default content selection, used only when Wiki is enabled. */
234
+ contentScope?: KnowledgeRetrievalContentScope;
235
+ /**
236
+ * Default retrieval mode for this knowledgebase.
237
+ */
238
+ mode?: KnowledgeRetrievalMode;
172
239
  /**
173
240
  * Top K of result chunks
174
241
  */
175
242
  topK?: number;
176
243
  /**
177
- * At least the similarity threshold
244
+ * Minimum vector similarity. Null disables the threshold.
178
245
  */
179
- score?: number;
246
+ score?: number | null;
247
+ /**
248
+ * Minimum relevance score returned by the rerank model. Null disables the threshold.
249
+ */
250
+ rerankThreshold?: number | null;
180
251
  /**
181
252
  * Weight in EnsembleRetriever
182
253
  */
183
254
  weight?: number;
255
+ /**
256
+ * Candidate fusion strategy. Missing configuration keeps the legacy behavior.
257
+ */
258
+ fusion?: TKBFusionConfig;
259
+ };
260
+ export type KnowledgeFusionMode = 'legacy' | 'weighted_rrf';
261
+ export declare const DEFAULT_KNOWLEDGE_RRF_RANK_CONSTANT = 60;
262
+ export declare const DEFAULT_KNOWLEDGE_RRF_WEIGHTS: {
263
+ readonly vector: 0.65;
264
+ readonly graph: 0.35;
265
+ readonly keyword: 0.3;
184
266
  };
267
+ export type TKBFusionConfig = {
268
+ mode?: KnowledgeFusionMode;
269
+ rankConstant?: number;
270
+ weights?: {
271
+ vector?: number;
272
+ graph?: number;
273
+ keyword?: number;
274
+ };
275
+ };
276
+ export declare const DEFAULT_KNOWLEDGEBASE_FAQ_RECALL: {
277
+ readonly mode: "hybrid";
278
+ readonly fusion: {
279
+ readonly mode: "weighted_rrf";
280
+ readonly rankConstant: 60;
281
+ readonly weights: {
282
+ readonly vector: 0.7;
283
+ readonly keyword: 0.3;
284
+ readonly graph: 0;
285
+ };
286
+ };
287
+ };
288
+ export declare const KNOWLEDGEBASE_FAQ_RETRIEVAL_MODES: readonly ["vector", "keyword", "hybrid"];
289
+ /**
290
+ * FAQ retrieval only uses question vectors and keyword indexes. Graph retrieval is not supported.
291
+ */
292
+ export declare function normalizeKnowledgebaseFAQRecall(recall?: TKBRecallParams | null): TKBRecallParams;
185
293
  export type DocumentMetadata = IDocChunkMetadata & {
186
294
  score?: number;
187
295
  relevanceScore?: number;
@@ -215,3 +323,5 @@ export declare const KNOWLEDGE_PROCESSING_MODE_NAME = "processing_mode";
215
323
  export declare const KNOWLEDGE_DOCUMENTS_NAME = "documents";
216
324
  export declare const KNOWLEDGE_FOLDER_ID_NAME = "folder_id";
217
325
  export declare const KNOWLEDGE_STAGE_NAME = "stage";
326
+ /** Check the sources that can execute within the selected content scope. */
327
+ export declare function hasEnabledKnowledgeRetrievalSource(retrieval: Partial<IKnowledgebase & TKBRetrievalSettings> | null | undefined, allowGraphRetrieval?: boolean, contentScope?: KnowledgeRetrievalContentScope): boolean;
@@ -1,3 +1,4 @@
1
+ import type { McpCapabilityApprovalMode } from './mcp-publication.model';
1
2
  import type { JSONValue } from '../core.model';
2
3
  export declare const MCP_CAPABILITY_DESCRIPTOR_VERSION: 1;
3
4
  export declare const MCP_CAPABILITY_TYPES: readonly ["tool", "resource", "resource_template", "prompt", "app"];
@@ -54,6 +55,8 @@ export interface McpToolCapabilityDescriptor extends McpCapabilityDescriptorBase
54
55
  inputSchema: McpJsonSchema;
55
56
  outputSchema?: McpJsonSchema;
56
57
  behavior: McpToolBehavior;
58
+ /** Plugin default used when a Publication has no explicit approval override. */
59
+ defaultApprovalMode?: McpCapabilityApprovalMode;
57
60
  annotations?: McpToolAnnotations;
58
61
  appResourceKey?: string;
59
62
  taskMode?: 'optional' | 'required';
@@ -99,4 +102,8 @@ type McpCapabilityDeclarationOf<TDescriptor extends McpCapabilityDescriptor> = T
99
102
  } : never;
100
103
  /** Plugin-side declaration before the host binds it to a concrete toolset instance. */
101
104
  export type McpCapabilityDeclaration = McpCapabilityDeclarationOf<McpCapabilityDescriptor>;
105
+ /** Resolve the declaration default; callers must apply explicit Publication policy first. */
106
+ export declare function defaultMcpToolApprovalMode(descriptor: Pick<McpToolCapabilityDescriptor, 'behavior' | 'defaultApprovalMode'>): McpCapabilityApprovalMode;
107
+ /** Dangerous tools may run directly only when their owner explicitly declares that policy. */
108
+ export declare function canAllowMcpToolDirectly(descriptor: Pick<McpToolCapabilityDescriptor, 'behavior' | 'defaultApprovalMode'>): boolean;
102
109
  export {};
@@ -31,6 +31,8 @@ export type TAgentMiddlewareMeta = {
31
31
  description?: I18nObject;
32
32
  configSchema?: JsonSchemaObjectType;
33
33
  features?: Array<TXpertFeatureKey | string>;
34
+ /** Optional display labels keyed by declared Feature identifier; never grants capabilities. */
35
+ featureLabels?: Record<string, I18nObject>;
34
36
  slashCommands?: SkillSlashCommand[];
35
37
  builtin?: boolean;
36
38
  /**
@@ -104,7 +104,7 @@ export type TAgentExecutionMetadata = {
104
104
  * AI Model
105
105
  */
106
106
  model?: string;
107
- /** Opaque Assistant model option used by the Primary Agent. */
107
+ /** Opaque Assistant model option used by the base and Primary models. */
108
108
  primaryModelId?: string;
109
109
  primaryModelSource?: import('./assistant-model.model').TAssistantPrimaryModelSelectionSource;
110
110
  /** Sanitized model snapshot used to keep resume and retry deterministic. */
@@ -94,6 +94,11 @@ export type TTemplate = {
94
94
  startPrompts?: string[];
95
95
  promptWorkflows?: TPromptWorkflow[];
96
96
  releaseNotes?: string;
97
+ availableLocales?: string[];
98
+ defaultLocale?: string;
99
+ locale?: string;
100
+ pluginVersion?: string;
101
+ contentHash?: string;
97
102
  xpertName?: string;
98
103
  dependencies?: XpertTemplatePluginDependencies;
99
104
  /** Trusted plugin App explicitly linked to this Assistant template. */
@@ -104,6 +109,21 @@ export type TXpertTemplate = TTemplate & {
104
109
  type: XpertTypeEnum | 'project';
105
110
  copilotModel?: Partial<TCopilotModel>;
106
111
  };
112
+ export type TXpertTemplateSummary = Omit<TXpertTemplate, 'export_data'>;
113
+ export interface TXpertTemplateCatalogQuery {
114
+ search?: string;
115
+ category?: string;
116
+ pluginName?: string;
117
+ offset?: number;
118
+ limit?: number;
119
+ }
120
+ export interface TXpertTemplateCatalogPage {
121
+ items: TXpertTemplateSummary[];
122
+ total: number;
123
+ offset: number;
124
+ limit: number;
125
+ categories: string[];
126
+ }
107
127
  export interface IXpertMCPTemplate extends TTemplate {
108
128
  /**
109
129
  * string is the backward compatible image file URL format
@@ -5,7 +5,7 @@ import { ITag } from '../tag-entity.model';
5
5
  import { IUser, LanguagesEnum } from '../user.model';
6
6
  import { IUserGroup } from '../user-group.model';
7
7
  import { ICopilotModel, TCopilotModel } from './copilot-model.model';
8
- import { IKnowledgebase, TKBRecallParams } from './knowledgebase.model';
8
+ import { IKnowledgebase, KnowledgeRetrievalMode, TKBFusionConfig, TKBRecallParams } from './knowledgebase.model';
9
9
  import { ChecklistItem, I18nObject, IPoint, ISize, TAvatar } from '../types';
10
10
  import { IXpertAgent } from './xpert-agent.model';
11
11
  import { IXpertToolset } from './xpert-toolset.model';
@@ -278,6 +278,9 @@ export type TXpertTemplateSource = {
278
278
  installedAt?: string;
279
279
  lastSyncedAt?: string;
280
280
  releaseNotes?: string;
281
+ locale?: string;
282
+ pluginVersion?: string;
283
+ contentHash?: string;
281
284
  };
282
285
  export type TXpertTemplateSyncResult = {
283
286
  xpertId: string;
@@ -643,9 +646,9 @@ export type TChatOptions = {
643
646
  * Per-request runtime context forwarded to agent middleware/tools.
644
647
  */
645
648
  context?: Record<string, unknown>;
646
- /** Resolved runtime override for the Assistant Primary Agent only. */
649
+ /** Resolved Primary model; explicit and preference selections also supply Assistant base inheritance. */
647
650
  primaryCopilotModel?: TCopilotModel;
648
- /** Opaque Assistant model option id recorded for audit and retry. */
651
+ /** Trusted Assistant model selection, also recorded for audit and retry. */
649
652
  primaryModelId?: string;
650
653
  /** Published Primary Agent key to which the override is restricted. */
651
654
  primaryAgentKey?: string;
@@ -689,7 +692,9 @@ export type TChatSourceAuditOptions = {
689
692
  * Knowledgebase retrieval settings
690
693
  */
691
694
  export type TKBRetrievalSettings = {
692
- mode?: 'vector' | 'graph' | 'hybrid';
695
+ mode?: KnowledgeRetrievalMode;
696
+ /** Overrides the knowledgebase candidate fusion strategy for this retrieval. */
697
+ fusion?: TKBFusionConfig;
693
698
  neighborHops?: number;
694
699
  entityTopK?: number;
695
700
  communityTopK?: number;
@@ -1,4 +1,5 @@
1
1
  import { IBasePerTenantAndOrganizationEntityModel, IBasePerTenantEntityModel } from './base-entity.model';
2
+ import type { JSONValue } from './core.model';
2
3
  import { IDataSourceType } from './data-source-type.model';
3
4
  import { IUser } from './user.model';
4
5
  export interface IDataSource extends IBasePerTenantAndOrganizationEntityModel {
@@ -18,6 +19,17 @@ export interface IDataSourceAuthentication extends IBasePerTenantEntityModel {
18
19
  dataSource?: IDataSource;
19
20
  user?: IUser;
20
21
  }
22
+ /**
23
+ * Generic, read-only query delegated to the selected data-source adapter.
24
+ *
25
+ * Capability names and payload schemas are owned by adapters and their
26
+ * consumers; the platform intentionally does not model domain protocols.
27
+ */
28
+ export interface IDataSourceCapabilityQuery {
29
+ capability: string;
30
+ operation: string;
31
+ payload?: JSONValue;
32
+ }
21
33
  export declare enum AuthenticationEnum {
22
34
  NONE = "NONE",
23
35
  BASIC = "BASIC"
package/src/plugin.d.ts CHANGED
@@ -147,6 +147,17 @@ export interface PluginMarketplaceAppModelRequirements {
147
147
  embeddingLabel?: string | I18nObject;
148
148
  visionLabel?: string | I18nObject;
149
149
  }
150
+ /** Portable independent Assistant topology owned by a trusted App. Instance IDs are host-managed. */
151
+ export interface PluginMarketplaceAppAssistantSuite {
152
+ version: string;
153
+ coordinatorAgentKey: string;
154
+ roles: Array<{
155
+ key: string;
156
+ templateKey: string;
157
+ primaryAgentKey: string;
158
+ title?: string | I18nObject;
159
+ }>;
160
+ }
150
161
  /**
151
162
  * Declarative, host-owned initialization contract for a trusted plugin App.
152
163
  * The host only executes this contract from a loaded plugin contribution.
@@ -154,6 +165,7 @@ export interface PluginMarketplaceAppModelRequirements {
154
165
  export interface PluginMarketplaceAppConfig {
155
166
  scope: PluginApplicationScope;
156
167
  assistantTemplateKey: string;
168
+ assistantSuite?: PluginMarketplaceAppAssistantSuite;
157
169
  workspace: {
158
170
  mode: 'dedicated';
159
171
  name: string | I18nObject;
@@ -0,0 +1,41 @@
1
+ import type { TAvatar } from '../types';
2
+ export declare const AGENT_PROFILE_TABS_SLOT = "agent.profile.tabs";
3
+ export interface XpertAssistantProfileIndicators {
4
+ skillCount: number | null;
5
+ toolCount: number;
6
+ subAgentCount: number;
7
+ conversationCount30d: number | null;
8
+ }
9
+ /** Display-only projection. Never add prompts, credentials or runtime configuration here. */
10
+ export interface XpertAssistantProfile {
11
+ id: string;
12
+ name: string;
13
+ title?: string | null;
14
+ titleCN?: string | null;
15
+ description?: string | null;
16
+ avatar?: TAvatar | null;
17
+ version?: string | null;
18
+ tags: {
19
+ id: string;
20
+ name: string;
21
+ color?: string | null;
22
+ }[];
23
+ workspace?: {
24
+ id: string;
25
+ name: string;
26
+ } | null;
27
+ creator?: {
28
+ id: string;
29
+ name: string;
30
+ } | null;
31
+ publishedAt?: Date | string | null;
32
+ createdAt?: Date | string | null;
33
+ updatedAt?: Date | string | null;
34
+ indicators: XpertAssistantProfileIndicators;
35
+ }
36
+ /** Backend-only identity, resolved by the host; never accepted from view query/action inputs. */
37
+ export interface XpertViewAssistantIdentity {
38
+ instanceId: string;
39
+ currentId: string;
40
+ versionIds: string[];
41
+ }
@@ -1 +1,2 @@
1
1
  export * from './model';
2
+ export * from './assistant-profile';
@@ -1,5 +1,6 @@
1
1
  import type { I18nObject, IconDefinition } from '../types';
2
2
  import type { JsonSchemaObjectType } from '../ai/types';
3
+ import type { XpertViewAssistantIdentity } from './assistant-profile';
3
4
  export type XpertViewHostType = 'integration' | 'knowledgebase' | 'agent' | 'project' | 'sandbox' | string;
4
5
  export type XpertViewSlotMode = 'tabs' | 'sections' | 'widgets' | 'sidebar';
5
6
  export type XpertViewSchemaType = 'stats' | 'table' | 'list' | 'detail' | 'raw_json' | 'remote_component';
@@ -101,6 +102,7 @@ export interface XpertViewRuntimeScope {
101
102
  }
102
103
  export type XpertViewHostState = Record<string, unknown>;
103
104
  export interface XpertResolvedViewHostContext extends XpertViewHostContext {
105
+ assistant?: XpertViewAssistantIdentity;
104
106
  slots: XpertViewSlot[];
105
107
  hostSnapshot?: unknown;
106
108
  capabilities?: XpertViewHostCapabilities;
@@ -528,6 +530,7 @@ export interface XpertExtensionViewManifest {
528
530
  polling?: XpertViewPolling;
529
531
  activation?: XpertViewActivation;
530
532
  runtime?: {
533
+ /** Host-derived Assistants that satisfy every required Feature. Provider declarations are ignored. */
531
534
  featureProviders?: XpertViewFeatureProvider[];
532
535
  };
533
536
  workbench?: XpertWorkbenchViewOptions;