@xpert-ai/contracts 3.18.0 → 3.18.2

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.
@@ -52,7 +52,7 @@ export type KnowledgeFilterSources = {
52
52
  dynamic?: KnowledgeFilterNode;
53
53
  };
54
54
  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';
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
56
  export type KnowledgeFilterDiagnostics = {
57
57
  filterVersion: typeof KNOWLEDGE_FILTER_VERSION;
58
58
  fixedFilter?: KnowledgeFilterNode;
@@ -70,7 +70,13 @@ export type KnowledgeFilterDiagnostics = {
70
70
  filterLatency?: number;
71
71
  vectorLatency?: number;
72
72
  vectorBranchHitCount?: number;
73
+ keywordLatency?: number;
74
+ keywordCandidateCount?: number;
75
+ keywordBranchHitCount?: number;
76
+ keywordIndexStatus?: 'ready' | 'missing';
77
+ keywordFailureReason?: string;
73
78
  graphBranchHitCount?: number;
79
+ fusionMode?: 'legacy' | 'weighted_rrf';
74
80
  graphGlobalCandidateCount?: number;
75
81
  graphCandidateScanLimit?: number;
76
82
  graphCandidateScanRounds?: number;
@@ -17,7 +17,7 @@ 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 GraphRagRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
21
21
  export type KnowledgeGraphItemOrigin = 'extracted' | 'manual' | 'curated';
22
22
  export type KnowledgeGraphVisibility = 'active' | 'hidden';
23
23
  export type GraphRagConfig = {
@@ -14,8 +14,28 @@ export declare enum KnowledgeProviderEnum {
14
14
  }
15
15
  export declare enum KnowledgebaseTypeEnum {
16
16
  Standard = "standard",
17
+ FAQ = "faq",
17
18
  External = "external"
18
19
  }
20
+ /**
21
+ * Knowledge bases created before the type discriminator was introduced are document knowledge bases.
22
+ */
23
+ export declare function isDocumentKnowledgebaseType(type: KnowledgebaseTypeEnum | null | undefined): boolean;
24
+ export type KnowledgebaseFAQIndexMode = 'question_only' | 'question_answer';
25
+ export type KnowledgebaseFAQQuestionIndexMode = 'combined' | 'separate';
26
+ export type KnowledgebaseFAQNegativeMatchMode = 'exact' | 'semantic';
27
+ export type KnowledgebaseFAQConfig = {
28
+ indexMode: KnowledgebaseFAQIndexMode;
29
+ questionIndexMode: KnowledgebaseFAQQuestionIndexMode;
30
+ /** Optional for knowledge bases created before negative matching was configurable. */
31
+ negativeMatchMode?: KnowledgebaseFAQNegativeMatchMode;
32
+ };
33
+ export declare const DEFAULT_KNOWLEDGEBASE_FAQ_CONFIG: {
34
+ readonly indexMode: "question_only";
35
+ readonly questionIndexMode: "separate";
36
+ readonly negativeMatchMode: "exact";
37
+ };
38
+ export type KnowledgeRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
19
39
  export declare enum KnowledgebaseStatusEnum {
20
40
  READY = "ready",
21
41
  REBUILD_REQUIRED = "rebuild_required",
@@ -46,6 +66,10 @@ export type TKnowledgebase = {
46
66
  * Type of KB
47
67
  */
48
68
  type: KnowledgebaseTypeEnum;
69
+ /**
70
+ * Creation-time indexing behavior for FAQ knowledge bases.
71
+ */
72
+ faqConfig?: KnowledgebaseFAQConfig | null;
49
73
  /**
50
74
  * English | Chinese
51
75
  */
@@ -169,6 +193,10 @@ export declare enum KnowledgebasePermission {
169
193
  * Recall parameters
170
194
  */
171
195
  export type TKBRecallParams = {
196
+ /**
197
+ * Default retrieval mode for this knowledgebase.
198
+ */
199
+ mode?: KnowledgeRetrievalMode;
172
200
  /**
173
201
  * Top K of result chunks
174
202
  */
@@ -181,7 +209,44 @@ export type TKBRecallParams = {
181
209
  * Weight in EnsembleRetriever
182
210
  */
183
211
  weight?: number;
212
+ /**
213
+ * Candidate fusion strategy. Missing configuration keeps the legacy behavior.
214
+ */
215
+ fusion?: TKBFusionConfig;
216
+ };
217
+ export type KnowledgeFusionMode = 'legacy' | 'weighted_rrf';
218
+ export declare const DEFAULT_KNOWLEDGE_RRF_RANK_CONSTANT = 60;
219
+ export declare const DEFAULT_KNOWLEDGE_RRF_WEIGHTS: {
220
+ readonly vector: 0.65;
221
+ readonly graph: 0.35;
222
+ readonly keyword: 0.3;
223
+ };
224
+ export type TKBFusionConfig = {
225
+ mode?: KnowledgeFusionMode;
226
+ rankConstant?: number;
227
+ weights?: {
228
+ vector?: number;
229
+ graph?: number;
230
+ keyword?: number;
231
+ };
184
232
  };
233
+ export declare const DEFAULT_KNOWLEDGEBASE_FAQ_RECALL: {
234
+ readonly mode: "hybrid";
235
+ readonly fusion: {
236
+ readonly mode: "weighted_rrf";
237
+ readonly rankConstant: 60;
238
+ readonly weights: {
239
+ readonly vector: 0.7;
240
+ readonly keyword: 0.3;
241
+ readonly graph: 0;
242
+ };
243
+ };
244
+ };
245
+ export declare const KNOWLEDGEBASE_FAQ_RETRIEVAL_MODES: readonly ["vector", "keyword", "hybrid"];
246
+ /**
247
+ * FAQ retrieval only uses question vectors and keyword indexes. Graph retrieval is not supported.
248
+ */
249
+ export declare function normalizeKnowledgebaseFAQRecall(recall?: TKBRecallParams | null): TKBRecallParams;
185
250
  export type DocumentMetadata = IDocChunkMetadata & {
186
251
  score?: number;
187
252
  relevanceScore?: number;
@@ -34,11 +34,23 @@ export interface IMcpPublication extends IBasePerTenantAndOrganizationEntityMode
34
34
  reviewedAt?: Date | null;
35
35
  reviewedById?: string | null;
36
36
  }
37
+ /** Organization admission to a tenant-scoped MCP Publication. */
38
+ export interface IMcpPublicationAccess extends IBasePerTenantAndOrganizationEntityModel {
39
+ publicationId: string;
40
+ enabled: boolean;
41
+ enabledById?: string | null;
42
+ disabledAt?: Date | null;
43
+ disabledById?: string | null;
44
+ }
37
45
  /** Management-list projection used to render publication health without per-card follow-up requests. */
38
46
  export interface IMcpPublicationSummary extends IMcpPublication {
39
47
  capabilityCount: number;
40
48
  apiKeyCount: number;
41
49
  oauthEnabled: boolean;
50
+ /** Scope that owns the underlying Publication. Shared tenant Publications may be managed from an admitted organization. */
51
+ publicationScope?: 'tenant' | 'organization';
52
+ /** Effective access state for the current organization when managing a shared tenant Publication. */
53
+ organizationAccessEnabled?: boolean;
42
54
  recentInvocationAt?: Date | null;
43
55
  recentErrorAt?: Date | null;
44
56
  }
@@ -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';
@@ -689,7 +689,9 @@ export type TChatSourceAuditOptions = {
689
689
  * Knowledgebase retrieval settings
690
690
  */
691
691
  export type TKBRetrievalSettings = {
692
- mode?: 'vector' | 'graph' | 'hybrid';
692
+ mode?: KnowledgeRetrievalMode;
693
+ /** Overrides the knowledgebase candidate fusion strategy for this retrieval. */
694
+ fusion?: TKBFusionConfig;
693
695
  neighborHops?: number;
694
696
  entityTopK?: number;
695
697
  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
@@ -3,6 +3,8 @@ import type { AiModelTypeEnum } from './agent';
3
3
  import { JsonSchemaObjectType } from './ai/types';
4
4
  import type { IXpert, XpertWorkspaceDataScope } from './ai/xpert.model';
5
5
  import type { TMcpStdioRuntimePolicy } from './ai/xpert-tool-mcp.model';
6
+ import type { IMcpApiKey } from './ai/mcp-auth.model';
7
+ import type { IMcpPublication, McpPublicationStatus } from './ai/mcp-publication.model';
6
8
  import type { JSONValue } from './core.model';
7
9
  import type { IPluginRuntimeConvergence, IRuntimePluginRequirement } from './runtime-control';
8
10
  import { IconDefinition, I18nObject } from './types';
@@ -145,6 +147,17 @@ export interface PluginMarketplaceAppModelRequirements {
145
147
  embeddingLabel?: string | I18nObject;
146
148
  visionLabel?: string | I18nObject;
147
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
+ }
148
161
  /**
149
162
  * Declarative, host-owned initialization contract for a trusted plugin App.
150
163
  * The host only executes this contract from a loaded plugin contribution.
@@ -152,6 +165,7 @@ export interface PluginMarketplaceAppModelRequirements {
152
165
  export interface PluginMarketplaceAppConfig {
153
166
  scope: PluginApplicationScope;
154
167
  assistantTemplateKey: string;
168
+ assistantSuite?: PluginMarketplaceAppAssistantSuite;
155
169
  workspace: {
156
170
  mode: 'dedicated';
157
171
  name: string | I18nObject;
@@ -233,6 +247,20 @@ export interface PluginApplicationStatusSummary {
233
247
  errorCode?: string | null;
234
248
  errorMessage?: string | null;
235
249
  }
250
+ /** Marketplace metadata paired with a trusted plugin App contribution. */
251
+ export interface PluginApplicationCatalogMetadata {
252
+ category?: PluginMarketplaceCategory;
253
+ subcategory?: string;
254
+ featured?: boolean;
255
+ tags: string[];
256
+ updatedAt?: string;
257
+ }
258
+ /** Card-sized App definition and scoped runtime status for marketplace discovery. */
259
+ export interface PluginApplicationCatalogItem {
260
+ application: PluginTemplateApplicationSummary;
261
+ status: PluginApplicationStatusSummary;
262
+ marketplace: PluginApplicationCatalogMetadata;
263
+ }
236
264
  /**
237
265
  * Server-computed initialization readiness. Clients may select only model IDs
238
266
  * returned here and cannot provide tenant, organization, or workspace scope.
@@ -804,6 +832,43 @@ export interface IPluginResourceComponentState {
804
832
  runtimeId?: string | null;
805
833
  status?: PluginResourceInstallationStatus | null;
806
834
  installation?: IPluginResourceInstallation | null;
835
+ mcpServer?: IPluginMcpServerState | null;
836
+ }
837
+ export interface IPluginMcpServerState {
838
+ publicationId?: string | null;
839
+ /** Publication ownership follows the contributing plugin level. */
840
+ publicationScope?: 'tenant' | 'organization' | null;
841
+ /** Organization admission state for a tenant-scoped Publication. */
842
+ accessEnabled?: boolean | null;
843
+ status?: McpPublicationStatus | null;
844
+ endpoint?: string | null;
845
+ protocolVersion?: string | null;
846
+ transport?: 'streamable-http' | null;
847
+ apiKeyCount?: number;
848
+ syncError?: string | null;
849
+ syncFailedAt?: string | null;
850
+ }
851
+ export interface IPluginMcpServerConnectionInfo {
852
+ protocolVersion: string;
853
+ transport: 'streamable-http';
854
+ endpoint: string;
855
+ authorization: 'Bearer';
856
+ serverInstructions?: string;
857
+ }
858
+ export interface IPluginMcpServerActivationResult {
859
+ installation: IPluginResourceInstallation;
860
+ publication: IMcpPublication;
861
+ connectionInfo: IPluginMcpServerConnectionInfo;
862
+ createdApiKey?: {
863
+ apiKey: Omit<IMcpApiKey, 'keyHash'>;
864
+ secret: string;
865
+ };
866
+ }
867
+ /** A retrievable MCP client credential scoped to the requesting administrator and organization. */
868
+ export interface IPluginMcpServerCredentialResult {
869
+ connectionInfo: IPluginMcpServerConnectionInfo;
870
+ apiKey: Omit<IMcpApiKey, 'keyHash'>;
871
+ secret: string;
807
872
  }
808
873
  export interface PluginResourceComponentSelector {
809
874
  componentType?: PluginComponentType;
@@ -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;