@xpert-ai/contracts 3.9.0-beta.3 → 3.9.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/contracts",
3
- "version": "3.9.0-beta.3",
3
+ "version": "3.9.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,13 @@ export interface IAssistantBindingSkillPreference {
30
30
  workspaceId: string;
31
31
  disabledSkillIds: string[];
32
32
  }
33
+ export type AssistantBindingToolPreferenceSourceType = 'toolset' | 'middleware';
34
+ export type AssistantBindingToolPreferenceSourceMetadata = {
35
+ toolsetId?: string | null;
36
+ toolsetName: string;
37
+ } | {
38
+ provider: string;
39
+ };
33
40
  export interface IAssistantBindingConversationPreferences {
34
41
  version: 2;
35
42
  defaultThreadId?: string | null;
@@ -37,11 +44,24 @@ export interface IAssistantBindingConversationPreferences {
37
44
  defaultFollowUpBehavior?: 'queue' | 'steer';
38
45
  }
39
46
  export interface IAssistantBindingToolPreferences {
40
- version: 1;
47
+ version: number;
41
48
  toolsets?: Record<string, IAssistantBindingToolsetPreference>;
42
49
  middlewares?: Record<string, IAssistantBindingMiddlewarePreference>;
43
50
  skills?: Record<string, IAssistantBindingSkillPreference>;
44
51
  }
52
+ export declare function normalizeAssistantBindingToolPreferences(value?: IAssistantBindingToolPreferences | null): IAssistantBindingToolPreferences | null;
53
+ export declare function isAssistantBindingToolPreferencesEmpty(preferences?: IAssistantBindingToolPreferences | null): boolean;
54
+ export declare function getAssistantBindingDisabledTools(preferences: IAssistantBindingToolPreferences | null | undefined, sourceType: AssistantBindingToolPreferenceSourceType, nodeKey: string | null | undefined): string[];
55
+ export declare function getAssistantBindingDisabledSkillIds(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string | null | undefined): string[];
56
+ export declare function isAssistantBindingToolEnabled(preferences: IAssistantBindingToolPreferences | null | undefined, sourceType: AssistantBindingToolPreferenceSourceType, nodeKey: string | null | undefined, toolName: string): boolean;
57
+ export declare function isAssistantBindingSkillEnabled(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string | null | undefined, skillId: string): boolean;
58
+ export declare function filterAssistantBindingDisabledTools<T extends {
59
+ name: string;
60
+ }>(tools: T[], preferences: IAssistantBindingToolPreferences | null | undefined, sourceType: AssistantBindingToolPreferenceSourceType, nodeKey: string | null | undefined): T[];
61
+ export declare function filterAssistantBindingDisabledSkillIds(skillIds: string[], preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string | null | undefined): string[];
62
+ export declare function updateAssistantBindingToolPreferences(preferences: IAssistantBindingToolPreferences | null | undefined, sourceType: AssistantBindingToolPreferenceSourceType, nodeKey: string | null | undefined, metadata: AssistantBindingToolPreferenceSourceMetadata, toolName: string, enabled: boolean): IAssistantBindingToolPreferences | null;
63
+ export declare function updateAssistantBindingSkillPreferences(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string | null | undefined, skillId: string, enabled: boolean): IAssistantBindingToolPreferences | null;
64
+ export declare function ensureAssistantBindingSkillWorkspacePreference(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string): IAssistantBindingToolPreferences;
45
65
  export interface IAssistantBinding extends IBasePerTenantAndOrganizationEntityModel {
46
66
  code: AssistantCode;
47
67
  scope: AssistantBindingScope;
@@ -8,7 +8,7 @@ export type TConversationTitleSummaryEvent = TChatEventMessage & {
8
8
  };
9
9
  export type TFollowUpConsumedEvent = TChatEventMessage & {
10
10
  type: typeof CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED;
11
- mode: 'steer';
11
+ mode: 'queue' | 'steer';
12
12
  messageIds: string[];
13
13
  clientMessageIds?: string[];
14
14
  executionId?: string | null;
@@ -12,6 +12,25 @@ export type TSummaryJob = Record<LongTermMemoryTypeEnum, {
12
12
  progress?: number;
13
13
  memoryKey?: string;
14
14
  }>;
15
+ export type TChatReferenceBase = {
16
+ id?: string;
17
+ label?: string;
18
+ text: string;
19
+ };
20
+ export type TChatCodeReference = TChatReferenceBase & {
21
+ type: 'code';
22
+ path: string;
23
+ startLine: number;
24
+ endLine: number;
25
+ language?: string;
26
+ taskId?: string;
27
+ };
28
+ export type TChatQuoteReference = TChatReferenceBase & {
29
+ type: 'quote';
30
+ messageId?: string;
31
+ source?: string;
32
+ };
33
+ export type TChatReference = TChatCodeReference | TChatQuoteReference;
15
34
  /**
16
35
  * Chat message entity type
17
36
  */
@@ -23,6 +42,10 @@ export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel,
23
42
  * Files
24
43
  */
25
44
  attachments?: IStorageFile[];
45
+ /**
46
+ * Structured references associated with the human input
47
+ */
48
+ references?: TChatReference[];
26
49
  /**
27
50
  * Job of summary
28
51
  */
@@ -0,0 +1,13 @@
1
+ export declare const CONTEXT_COMPRESSION_COMPONENT_TYPE = "context-compression";
2
+ export type TContextCompressionComponentStatus = 'running' | 'success' | 'fail';
3
+ export type TContextCompressionComponentData = {
4
+ category: 'Tool';
5
+ type: typeof CONTEXT_COMPRESSION_COMPONENT_TYPE;
6
+ status: TContextCompressionComponentStatus;
7
+ title?: string;
8
+ message?: string;
9
+ error?: string;
10
+ created_date?: string | Date | null;
11
+ end_date?: string | Date | null;
12
+ };
13
+ export declare function isContextCompressionComponentData(value: unknown): value is TContextCompressionComponentData;
package/src/ai/index.d.ts CHANGED
@@ -58,6 +58,7 @@ export * from './knowledge-doc.model';
58
58
  export * from './knowledge-doc-page.model';
59
59
  export * from './role-permissions';
60
60
  export * from './xpert-agent-execution.model';
61
+ export * from './sandbox-terminal.model';
61
62
  export * from './xpert-agent.model';
62
63
  export * from './xpert-chat.model';
63
64
  export * from './xpert-tool.model';
@@ -80,5 +81,6 @@ export * from './knowledge-retrieval-log.model';
80
81
  export * from './knowledge-doc-chunk.model';
81
82
  export * from './skill.model';
82
83
  export * from './middleware.model';
84
+ export * from './context-compression.model';
83
85
  export * from './sandbox';
84
86
  export * from './message-content.utils';
@@ -2,6 +2,8 @@ import { IWorkflowNode, WorkflowNodeTypeEnum } from "./xpert-workflow.model";
2
2
  import { I18nObject, IconDefinition } from "../types";
3
3
  import { TXpertFeatureKey, TXpertGraph, TXpertTeamNode } from "./xpert.model";
4
4
  import { JsonSchemaObjectType } from "./types";
5
+ export declare const LEGACY_SANDBOX_COMPRESSION_MIDDLEWARE_NAME = "SandboxCompressionMiddleware";
6
+ export declare const CONTEXT_COMPRESSION_MIDDLEWARE_NAME = "ContextCompressionMiddleware";
5
7
  export interface IWFNMiddleware extends IWorkflowNode {
6
8
  type: WorkflowNodeTypeEnum.MIDDLEWARE;
7
9
  provider: string;
@@ -13,6 +15,9 @@ export type TMiddlewareToolConfig = {
13
15
  };
14
16
  export declare function isMiddlewareToolEnabled(config?: TMiddlewareToolConfig | boolean): boolean;
15
17
  export declare function genXpertMiddlewareKey(): string;
18
+ export declare function normalizeMiddlewareProvider(provider?: string | null): string;
19
+ export declare function normalizeMiddlewareNode<T extends TXpertTeamNode>(node: T): T;
20
+ export declare function normalizeMiddlewareNodes<T extends TXpertTeamNode>(nodes?: T[] | null): T[];
16
21
  export type TAgentMiddlewareMeta = {
17
22
  name: string;
18
23
  label: I18nObject;
@@ -0,0 +1,108 @@
1
+ export declare const SANDBOX_TERMINAL_NAMESPACE: "sandbox-terminal";
2
+ export declare enum SandboxTerminalClientEvent {
3
+ Open = "open",
4
+ Input = "input",
5
+ Resize = "resize",
6
+ Close = "close"
7
+ }
8
+ export declare enum SandboxTerminalServerEvent {
9
+ Opened = "opened",
10
+ Output = "output",
11
+ Exit = "exit",
12
+ Error = "error",
13
+ Closed = "closed"
14
+ }
15
+ export declare enum SandboxTerminalClosedReason {
16
+ ClientClosed = "client_closed",
17
+ Error = "error",
18
+ OpenFailed = "open_failed",
19
+ ProcessExited = "process_exited",
20
+ SocketDisconnected = "socket_disconnected",
21
+ UnsupportedProvider = "unsupported_provider"
22
+ }
23
+ export declare enum SandboxTerminalErrorCode {
24
+ CloseFailed = "close_failed",
25
+ ConversationNotFound = "conversation_not_found",
26
+ ConversationRequired = "conversation_required",
27
+ InputFailed = "input_failed",
28
+ OpenFailed = "open_failed",
29
+ ProviderUnavailable = "provider_unavailable",
30
+ ResizeFailed = "resize_failed",
31
+ SandboxDisabled = "sandbox_disabled",
32
+ SessionNotFound = "session_not_found",
33
+ UnsupportedProvider = "unsupported_provider"
34
+ }
35
+ export type SandboxTerminalDimensions = {
36
+ cols: number;
37
+ rows: number;
38
+ };
39
+ export type SandboxTerminalOpenRequest = SandboxTerminalDimensions & {
40
+ conversationId: string;
41
+ projectId?: string | null;
42
+ requestId: string;
43
+ };
44
+ export type SandboxTerminalInputRequest = {
45
+ data: string;
46
+ sessionId: string;
47
+ };
48
+ export type SandboxTerminalResizeRequest = SandboxTerminalDimensions & {
49
+ sessionId: string;
50
+ };
51
+ export type SandboxTerminalCloseRequest = {
52
+ sessionId: string;
53
+ };
54
+ export type SandboxTerminalOpenedEvent = {
55
+ provider: string;
56
+ requestId: string;
57
+ sessionId: string;
58
+ workingDirectory: string;
59
+ };
60
+ export type SandboxTerminalOutputEvent = {
61
+ data: string;
62
+ sessionId: string;
63
+ };
64
+ export type SandboxTerminalExitEvent = {
65
+ exitCode: number | null;
66
+ sessionId: string;
67
+ signal?: number | null;
68
+ };
69
+ export type SandboxTerminalErrorEvent = {
70
+ code: SandboxTerminalErrorCode;
71
+ message: string;
72
+ requestId?: string;
73
+ sessionId?: string;
74
+ };
75
+ export type SandboxTerminalClosedEvent = {
76
+ reason: SandboxTerminalClosedReason;
77
+ requestId?: string;
78
+ sessionId?: string;
79
+ };
80
+ export type SandboxTerminalClientMessage = {
81
+ event: SandboxTerminalClientEvent.Open;
82
+ data: SandboxTerminalOpenRequest;
83
+ } | {
84
+ event: SandboxTerminalClientEvent.Input;
85
+ data: SandboxTerminalInputRequest;
86
+ } | {
87
+ event: SandboxTerminalClientEvent.Resize;
88
+ data: SandboxTerminalResizeRequest;
89
+ } | {
90
+ event: SandboxTerminalClientEvent.Close;
91
+ data: SandboxTerminalCloseRequest;
92
+ };
93
+ export type SandboxTerminalServerMessage = {
94
+ event: SandboxTerminalServerEvent.Opened;
95
+ data: SandboxTerminalOpenedEvent;
96
+ } | {
97
+ event: SandboxTerminalServerEvent.Output;
98
+ data: SandboxTerminalOutputEvent;
99
+ } | {
100
+ event: SandboxTerminalServerEvent.Exit;
101
+ data: SandboxTerminalExitEvent;
102
+ } | {
103
+ event: SandboxTerminalServerEvent.Error;
104
+ data: SandboxTerminalErrorEvent;
105
+ } | {
106
+ event: SandboxTerminalServerEvent.Closed;
107
+ data: SandboxTerminalClosedEvent;
108
+ };
@@ -53,6 +53,7 @@ export interface SkillMetadata {
53
53
  mcp?: {
54
54
  servers?: string[];
55
55
  };
56
+ provenance?: Record<string, unknown>;
56
57
  }
57
58
  export interface SkillResourcesIndex {
58
59
  files: Array<{
@@ -9,6 +9,69 @@ export interface IXpertTemplate extends IBasePerTenantEntityModel {
9
9
  visitCount: number;
10
10
  lastVisitedAt?: Date;
11
11
  }
12
+ export type TemplateSkillSyncMode = 'incremental' | 'full';
13
+ export type TemplateSkillSyncStatus = 'created' | 'updated' | 'unchanged' | 'missing' | 'failed';
14
+ export interface ITemplateSkillSyncItemSummary {
15
+ created: number;
16
+ updated: number;
17
+ unchanged: number;
18
+ missing: number;
19
+ failed: number;
20
+ }
21
+ export interface ITemplateSkillSyncRepositoryResult {
22
+ name: string;
23
+ provider: string;
24
+ repositoryId?: string;
25
+ status: TemplateSkillSyncStatus;
26
+ message?: string;
27
+ }
28
+ export interface ITemplateSkillSyncIndexResult {
29
+ repositoryId?: string;
30
+ repositoryName: string;
31
+ provider: string;
32
+ mode: TemplateSkillSyncMode;
33
+ status: TemplateSkillSyncStatus;
34
+ syncedCount?: number;
35
+ message?: string;
36
+ }
37
+ export interface ITemplateSkillSyncBundleResult {
38
+ sharedSkillId: string;
39
+ provider: string;
40
+ repositoryName: string;
41
+ skillId: string;
42
+ status: TemplateSkillSyncStatus;
43
+ hash?: string;
44
+ repositoryId?: string;
45
+ indexId?: string;
46
+ message?: string;
47
+ }
48
+ export interface ITemplateSkillSyncRefResult {
49
+ provider: string;
50
+ repositoryName: string;
51
+ skillId: string;
52
+ status: TemplateSkillSyncStatus;
53
+ repositoryId?: string;
54
+ indexId?: string;
55
+ message?: string;
56
+ }
57
+ export interface ITemplateSkillSyncSummary {
58
+ repositories: ITemplateSkillSyncItemSummary;
59
+ indexes: ITemplateSkillSyncItemSummary;
60
+ bundles: ITemplateSkillSyncItemSummary;
61
+ featuredRefs: ITemplateSkillSyncItemSummary;
62
+ workspaceDefaults: ITemplateSkillSyncItemSummary;
63
+ }
64
+ export interface ITemplateSkillSyncResult {
65
+ mode: TemplateSkillSyncMode;
66
+ validateOnly: boolean;
67
+ fingerprint: string;
68
+ repositories: ITemplateSkillSyncRepositoryResult[];
69
+ indexes: ITemplateSkillSyncIndexResult[];
70
+ bundles: ITemplateSkillSyncBundleResult[];
71
+ featuredRefs: ITemplateSkillSyncRefResult[];
72
+ workspaceDefaults: ITemplateSkillSyncRefResult[];
73
+ summary: ITemplateSkillSyncSummary;
74
+ }
12
75
  export type TTemplate = {
13
76
  id: string;
14
77
  name: string;
@@ -18,7 +18,7 @@ export interface IXpertWorkspace extends IBasePerTenantAndOrganizationEntityMode
18
18
  }
19
19
  export type TXpertWorkspaceSettings = {
20
20
  system?: {
21
- kind?: 'org-default' | 'user-default';
21
+ kind?: 'org-default' | 'tenant-default' | 'user-default';
22
22
  userId?: string;
23
23
  };
24
24
  };
@@ -33,6 +33,10 @@ export type TXpertSandboxFeature = {
33
33
  enabled: boolean;
34
34
  provider?: string;
35
35
  };
36
+ export type TXpertTitleFeature = {
37
+ enabled: boolean;
38
+ instruction?: string;
39
+ };
36
40
  export type TXpertFeatures = {
37
41
  opener: {
38
42
  enabled: boolean;
@@ -66,6 +70,10 @@ export type TXpertFeatures = {
66
70
  * Sandbox feature
67
71
  */
68
72
  sandbox?: TXpertSandboxFeature;
73
+ /**
74
+ * Conversation title generation feature
75
+ */
76
+ title?: TXpertTitleFeature;
69
77
  };
70
78
  export type TXpertFeatureKey = keyof TXpertFeatures;
71
79
  export type TXpert = {
@@ -258,13 +266,6 @@ export type TXpertAgentConfig = {
258
266
  * Retrieval params for every knowledgebase
259
267
  */
260
268
  retrievals?: Record<string, TKBRetrievalSettings>;
261
- /**
262
- * Summarize the title of the conversation
263
- */
264
- summarizeTitle?: {
265
- disable?: boolean;
266
- instruction?: string;
267
- };
268
269
  tools?: Record<string, {
269
270
  /**
270
271
  * Memory assigner for tool's results. (save result of tool call into state variable)
@@ -477,10 +478,6 @@ export type TChatOptions = {
477
478
  * Call from
478
479
  */
479
480
  from?: TChatFrom;
480
- /**
481
- * Whether to summarize the conversation title
482
- */
483
- summarizeTitle?: boolean;
484
481
  /**
485
482
  * Project ID, identify the project where the xpert invoked
486
483
  */
@@ -13,6 +13,7 @@ export interface IApiKey extends IBasePerTenantAndOrganizationEntityModel {
13
13
  /**
14
14
  * Stable binding target id/code. Examples:
15
15
  * - assistant => xpertId
16
+ * - workspace => workspaceId
16
17
  * - integration => integrationId
17
18
  * - client => clientCode
18
19
  */
@@ -37,6 +38,7 @@ export declare const API_PRINCIPAL_USER_ID_HEADER = "x-principal-user-id";
37
38
  */
38
39
  export declare enum ApiKeyBindingType {
39
40
  ASSISTANT = "assistant",
41
+ WORKSPACE = "workspace",
40
42
  INTEGRATION = "integration",
41
43
  CLIENT = "client",
42
44
  /**
@@ -2,7 +2,7 @@ import { IStorageFile } from './storage-file.model';
2
2
  export type FileAssetStatus = 'success' | 'partial_success' | 'failed';
3
3
  export type FileAssetDestinationKind = 'storage' | 'volume' | 'sandbox';
4
4
  export type FileAssetSourceKind = 'multipart' | 'storage_file' | 'local_file';
5
- export type FileUploadVolumeCatalog = 'projects' | 'users' | 'knowledges' | 'skills';
5
+ export type FileUploadVolumeCatalog = 'projects' | 'users' | 'knowledges' | 'skills' | 'xperts';
6
6
  export type FileUploadSandboxMode = 'mounted_workspace' | 'backend_upload';
7
7
  export interface IFileAssetSource {
8
8
  kind: FileAssetSourceKind;
@@ -49,7 +49,9 @@ export interface IUploadFileVolumeTarget {
49
49
  catalog: FileUploadVolumeCatalog;
50
50
  projectId?: string;
51
51
  knowledgeId?: string;
52
+ xpertId?: string;
52
53
  userId?: string;
54
+ isolateByUser?: boolean;
53
55
  tenantId?: string;
54
56
  folder?: string;
55
57
  fileName?: string;
package/src/plugin.d.ts CHANGED
@@ -107,6 +107,13 @@ export interface IPluginDescriptor {
107
107
  effectiveInCurrentScope: boolean;
108
108
  scopeRelation?: PluginScopeRelation;
109
109
  }
110
+ export interface IPluginLatestVersionStatus {
111
+ organizationId?: string;
112
+ name: PluginName;
113
+ packageName?: string;
114
+ latestVersion?: string;
115
+ hasUpdate: boolean;
116
+ }
110
117
  export interface IPluginConfiguration<TConfig extends Record<string, any> = Record<string, any>> {
111
118
  pluginName: PluginName;
112
119
  config: TConfig;