@metad/contracts 3.7.0 → 3.8.1

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,7 +1,8 @@
1
1
  export declare enum MCPServerType {
2
2
  SSE = "sse",
3
3
  STDIO = "stdio",
4
- CODE = "code"
4
+ CODE = "code",
5
+ HTTP = "http"
5
6
  }
6
7
  /**
7
8
  * Configuration for stdio transport connection
@@ -23,6 +24,19 @@ export interface SSEConnection {
23
24
  headers?: Record<string, string>;
24
25
  useNodeEventSource?: boolean;
25
26
  }
27
+ /**
28
+ * Configuration for Streamable HTTP transport connection
29
+ */
30
+ export interface HttpConnection {
31
+ transport: "http";
32
+ url: string;
33
+ headers?: Record<string, string>;
34
+ /**
35
+ * Whether to automatically fallback to SSE if Streamable HTTP is not available.
36
+ * Defaults to true.
37
+ */
38
+ automaticSSEFallback?: boolean;
39
+ }
26
40
  export type TMCPServerReconnect = {
27
41
  /**
28
42
  * Whether to automatically restart the process if it exits
@@ -51,6 +65,11 @@ export type TMCPServer = {
51
65
  url?: string;
52
66
  headers?: Record<string, string>;
53
67
  useNodeEventSource?: boolean;
68
+ /**
69
+ * Whether to automatically fallback to SSE if Streamable HTTP is not available.
70
+ * Defaults to true. Only applicable for HTTP transport.
71
+ */
72
+ automaticSSEFallback?: boolean;
54
73
  /**
55
74
  * Default timeout in milliseconds for tool execution. Must be greater than 0.
56
75
  * If not specified, tools will use their own configured timeout values.
@@ -1,16 +1,18 @@
1
1
  import { I18nObject, IconDefinition } from "../types";
2
2
  import { ICopilotModel } from "./copilot-model.model";
3
3
  import { TKBRecallParams } from "./knowledgebase.model";
4
- import { ApiAuthType, TErrorHandling, TXpertRefParameter } from "./types";
4
+ import { ApiAuthType, JsonSchemaObjectType, TErrorHandling, TXpertRefParameter } from "./types";
5
5
  import { TKBRetrievalSettings, TStateVariable, TXpertParameter } from "./xpert.model";
6
6
  export type TWorkflowNodeMeta = {
7
7
  name: string;
8
8
  label: I18nObject;
9
9
  icon: IconDefinition;
10
- configSchema: any;
10
+ configSchema: JsonSchemaObjectType;
11
11
  };
12
12
  export type TWorkflowTriggerMeta = TWorkflowNodeMeta;
13
13
  export declare enum WorkflowNodeTypeEnum {
14
+ START = "start",
15
+ END = "end",
14
16
  /**
15
17
  * Trigger
16
18
  */
@@ -25,7 +27,11 @@ export declare enum WorkflowNodeTypeEnum {
25
27
  IF_ELSE = "if-else",
26
28
  LIST_OPERATOR = "list-operator",
27
29
  VARIABLE_AGGREGATOR = "variable-aggregator",
30
+ /**
31
+ * @deprecated use ITERATOR instead
32
+ */
28
33
  ITERATING = "iterating",
34
+ ITERATOR = "iterator",
29
35
  HTTP = "http",
30
36
  SUBFLOW = "subflow",
31
37
  TOOL = "tool",
@@ -149,6 +155,31 @@ export interface IWFNVariableAggregator extends IWorkflowNode {
149
155
  inputs: string[];
150
156
  outputType: string;
151
157
  }
158
+ export interface IWFNIterator extends IWorkflowNode {
159
+ type: WorkflowNodeTypeEnum.ITERATOR;
160
+ /**
161
+ * Variable name of input array in state
162
+ */
163
+ inputVariable: string;
164
+ outputParams?: TXpertRefParameter[];
165
+ /**
166
+ * Execute in parallel, otherwise execute sequentially
167
+ */
168
+ parallel?: boolean;
169
+ /**
170
+ * Maximum number of parallel task
171
+ */
172
+ maximum?: number;
173
+ /**
174
+ * - terminate: terminate on error
175
+ * - ignore: ignore error and continue
176
+ * - remove: remove error output
177
+ */
178
+ errorMode?: 'terminate' | 'ignore' | 'remove';
179
+ }
180
+ /**
181
+ * @deprecated use IWFNIterator instead
182
+ */
152
183
  export interface IWFNIterating extends IWorkflowNode {
153
184
  type: WorkflowNodeTypeEnum.ITERATING;
154
185
  /**
@@ -173,10 +204,18 @@ export interface IWFNIterating extends IWorkflowNode {
173
204
  errorMode?: 'terminate' | 'ignore' | 'remove';
174
205
  }
175
206
  /**
176
- * The parameter name that represents the entire current element in array
207
+ * @deprecated use `IteratorItemParameterName` instead
177
208
  */
178
209
  export declare const IteratingItemParameterName = "$item";
210
+ /**
211
+ * @deprecated use `IteratorIndexParameterName` instead
212
+ */
179
213
  export declare const IteratingIndexParameterName = "$index";
214
+ /**
215
+ * The parameter name that represents the entire current element in array
216
+ */
217
+ export declare const IteratorItemParameterName = "$item";
218
+ export declare const IteratorIndexParameterName = "$index";
180
219
  export interface IWFNAnswer extends IWorkflowNode {
181
220
  type: WorkflowNodeTypeEnum.ANSWER;
182
221
  promptTemplate: string;
@@ -393,9 +432,14 @@ export declare function genListOperatorKey(): string;
393
432
  export declare function genVariableAggregatorKey(): string;
394
433
  export declare function genJSONStringifyKey(): string;
395
434
  export declare function genJSONParseKey(): string;
435
+ export declare function genXpertIteratorKey(): string;
436
+ export declare function genXpertStartKey(key: string): string;
396
437
  export declare function isAgentKey(key: string): boolean;
397
438
  export declare function isRouterKey(key: string): boolean;
439
+ /**
440
+ * @deprecated use `isIteratorKey` instead
441
+ */
398
442
  export declare function isIteratingKey(key: string): boolean;
399
- export declare function isWorkflowKey(key: string): boolean;
443
+ export declare function isIteratorKey(key: string): boolean;
400
444
  export declare function workflowNodeIdentifier(node: IWorkflowNode): string;
401
445
  export {};
@@ -1,4 +1,4 @@
1
- import { ToolCall as LToolCall } from '@langchain/core/dist/messages/tool';
1
+ import { ToolCall as LToolCall } from '@langchain/core/messages/tool';
2
2
  import { RunnableToolLike } from '@langchain/core/runnables';
3
3
  import { StructuredToolInterface } from '@langchain/core/tools';
4
4
  import { ITag } from '../tag-entity.model';
@@ -10,11 +10,9 @@ import { IXpertAgent } from './xpert-agent.model';
10
10
  import { IXpertToolset } from './xpert-toolset.model';
11
11
  import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
12
12
  import { IIntegration } from '../integration.model';
13
- import { TChatFrom, TSensitiveOperation } from './chat.model';
13
+ import { TChatFrom } from './chat.model';
14
14
  import { IWorkflowNode, TVariableAssigner, TWFCase, VariableOperationEnum } from './xpert-workflow.model';
15
15
  import { IEnvironment } from './environment.model';
16
- import { IStorageFile } from '../storage-file.model';
17
- import { STATE_VARIABLE_HUMAN, TInterruptCommand } from '../agent/graph';
18
16
  export type ToolCall = LToolCall;
19
17
  export declare enum XpertTypeEnum {
20
18
  /**
@@ -30,6 +28,10 @@ export declare enum XpertTypeEnum {
30
28
  */
31
29
  Knowledge = "knowledge"
32
30
  }
31
+ export type TXpertSandboxFeature = {
32
+ enabled: boolean;
33
+ provider?: string;
34
+ };
33
35
  export type TXpertFeatures = {
34
36
  opener: {
35
37
  enabled: boolean;
@@ -59,6 +61,10 @@ export type TXpertFeatures = {
59
61
  enabled: boolean;
60
62
  scoreThreshold?: number;
61
63
  };
64
+ /**
65
+ * Sandbox feature
66
+ */
67
+ sandbox?: TXpertSandboxFeature;
62
68
  };
63
69
  export type TXpert = {
64
70
  /**
@@ -261,6 +267,7 @@ export type TXpertAgentConfig = {
261
267
  * Custom description for the tool
262
268
  */
263
269
  description?: string;
270
+ parameters?: Record<string, any>;
264
271
  }>;
265
272
  };
266
273
  export type TStateVariableType = XpertParameterTypeEnum | 'object' | 'array[string]' | 'array[number]' | 'array[object]';
@@ -373,33 +380,43 @@ export type TXpertTeamDraft = TXpertGraph & {
373
380
  checklist?: ChecklistItem[];
374
381
  };
375
382
  export type TXpertTeamNodeType = 'agent' | 'knowledge' | 'toolset' | 'xpert' | 'workflow';
376
- export type TXpertTeamNode = {
383
+ export type TXpertTeamNodeBase = {
377
384
  key: string;
378
- type: TXpertTeamNodeType;
379
385
  position: IRect;
380
386
  size?: ISize;
381
387
  hash?: string;
382
388
  parentId?: string;
383
389
  readonly?: boolean;
384
- } & ({
385
- type: 'agent';
386
- entity: IXpertAgent;
387
- } | {
388
- type: 'knowledge';
389
- entity: IKnowledgebase;
390
- } | {
391
- type: 'toolset';
392
- entity: IXpertToolset;
393
- } | {
394
- type: 'xpert';
395
- entity: IXpert;
396
- nodes?: TXpertTeamNode[];
397
- connections?: TXpertTeamConnection[];
398
- expanded?: boolean;
399
- } | {
400
- type: 'workflow';
401
- entity: IWorkflowNode;
402
- });
390
+ };
391
+ /** type -> entity + extra props */
392
+ export type TXpertTeamNodeSpec = {
393
+ agent: {
394
+ entity: IXpertAgent;
395
+ };
396
+ knowledge: {
397
+ entity: IKnowledgebase;
398
+ };
399
+ toolset: {
400
+ entity: IXpertToolset;
401
+ };
402
+ xpert: {
403
+ entity: IXpert;
404
+ nodes?: TXpertTeamNode[];
405
+ connections?: TXpertTeamConnection[];
406
+ expanded?: boolean;
407
+ };
408
+ workflow: {
409
+ entity: IWorkflowNode;
410
+ };
411
+ };
412
+ /** If you want TXpertTeamNodeType always match spec keys */
413
+ export type TXpertTeamNodeType2 = keyof TXpertTeamNodeSpec;
414
+ export type TXpertTeamNode<T extends TXpertTeamNodeType = TXpertTeamNodeType> = T extends TXpertTeamNodeType ? TXpertTeamNodeBase & {
415
+ type: T;
416
+ } & TXpertTeamNodeSpec[T] : never;
417
+ export type NodeOf<T extends keyof TXpertTeamNodeSpec> = TXpertTeamNode<T>;
418
+ export type NodeEntity<T extends keyof TXpertTeamNodeSpec> = TXpertTeamNodeSpec[T]['entity'];
419
+ export type AnyNodeEntity = NodeEntity<keyof TXpertTeamNodeSpec>;
403
420
  export interface IRect extends IPoint, Partial<ISize> {
404
421
  gravityCenter?: IPoint;
405
422
  }
@@ -423,83 +440,12 @@ export interface TXpertTeamConnection {
423
440
  type: 'edge' | TXpertTeamNodeType;
424
441
  readonly?: boolean;
425
442
  }
426
- export declare enum ChatMessageTypeEnum {
427
- MESSAGE = "message",
428
- EVENT = "event"
429
- }
430
- /**
431
- * https://js.langchain.com/docs/how_to/streaming/#event-reference
432
- */
433
- export declare enum ChatMessageEventTypeEnum {
434
- ON_CONVERSATION_START = "on_conversation_start",
435
- ON_CONVERSATION_END = "on_conversation_end",
436
- ON_MESSAGE_START = "on_message_start",
437
- ON_MESSAGE_END = "on_message_end",
438
- ON_TOOL_START = "on_tool_start",
439
- ON_TOOL_END = "on_tool_end",
440
- ON_TOOL_ERROR = "on_tool_error",
441
- /**
442
- * Step message in tool call
443
- */
444
- ON_TOOL_MESSAGE = "on_tool_message",
445
- ON_AGENT_START = "on_agent_start",
446
- ON_AGENT_END = "on_agent_end",
447
- ON_RETRIEVER_START = "on_retriever_start",
448
- ON_RETRIEVER_END = "on_retriever_end",
449
- ON_RETRIEVER_ERROR = "on_retriever_error",
450
- ON_INTERRUPT = "on_interrupt",
451
- ON_ERROR = "on_error",
452
- ON_CHAT_EVENT = "on_chat_event"
453
- }
454
- /**
455
- * Human input message, include parameters and attachments
456
- */
457
- export type TChatRequestHuman = {
458
- input?: string;
459
- files?: Partial<IStorageFile>[];
460
- [key: string]: unknown;
461
- };
462
- export type TChatRequest = {
463
- /**
464
- * The human input, include parameters
465
- */
466
- input: TChatRequestHuman;
467
- /**
468
- * Custom graph state
469
- */
470
- state?: {
471
- [STATE_VARIABLE_HUMAN]: TChatRequestHuman;
472
- } & Record<string, any>;
473
- xpertId: string;
474
- agentKey?: string;
475
- projectId?: string;
476
- conversationId?: string;
477
- environmentId?: string;
478
- id?: string;
479
- executionId?: string;
480
- confirm?: boolean;
481
- /**
482
- * Reject the sensitive tool calls
483
- */
484
- reject?: boolean;
485
- /**
486
- * Message to update parameters of last tool call message
487
- * @deprecated use `command` instead
488
- */
489
- operation?: TSensitiveOperation;
490
- command?: TInterruptCommand;
491
- retry?: boolean;
492
- };
493
443
  export type TChatOptions = {
444
+ xpertId?: string;
494
445
  conversationId?: string;
495
- /**
496
- * @deprecated
497
- */
498
- knowledgebases?: string[];
499
- /**
500
- * @deprecated
501
- */
502
- toolsets?: string[];
446
+ messageId?: string;
447
+ thread_id?: string;
448
+ checkpointId?: string;
503
449
  /**
504
450
  * The language used by the current browser page
505
451
  */
@@ -528,6 +474,10 @@ export type TChatOptions = {
528
474
  * Specify environment with variables to run
529
475
  */
530
476
  environment?: IEnvironment;
477
+ /**
478
+ * PRO: Specify a sandbox environment container to run in
479
+ */
480
+ sandboxEnvironmentId?: string;
531
481
  /**
532
482
  * Specify additional tools
533
483
  */
@@ -549,3 +499,4 @@ export type TKBRetrievalSettings = {
549
499
  fields: Record<string, object>;
550
500
  };
551
501
  };
502
+ export declare function isXpertNodeType<T extends TXpertTeamNodeType>(type: T): (node: TXpertTeamNode) => node is NodeOf<T>;
@@ -44,6 +44,13 @@ export declare function omitXpertRelations(xpert: Partial<IXpert>): {
44
44
  copilotModelId?: string;
45
45
  tags?: import("..").ITag[];
46
46
  };
47
+ /**
48
+ * Figure out latest xpert or draft xpert.
49
+ *
50
+ * @param xpert
51
+ * @param isDraft Is draft
52
+ * @returns
53
+ */
47
54
  export declare function figureOutXpert(xpert: IXpert, isDraft: boolean): Partial<IXpert>;
48
55
  export declare function xpertLabel(agent: Partial<IXpert>): string;
49
56
  export declare function createXpertGraph(xpert: IXpert, position: IPoint): {
@@ -1,11 +1,5 @@
1
1
  import { TIntegrationProvider } from '../integration.model';
2
- export type TIntegrationLarkOptions = {
3
- isLark?: boolean;
4
- appId: string;
5
- appSecret: string;
6
- verificationToken: string;
7
- encryptKey: string;
8
- xpertId: string;
9
- preferLanguage: string;
10
- };
2
+ /**
3
+ * @deprecated use plugin
4
+ */
11
5
  export declare const IntegrationLarkProvider: TIntegrationProvider;
@@ -81,10 +81,5 @@ export type TIntegrationProvider = {
81
81
  schema?: TParameterSchema;
82
82
  features?: IntegrationFeatureEnum[];
83
83
  helpUrl?: string;
84
- /**
85
- * Webhook URL generator, for example:
86
- * `{{apiBaseUrl}}/api/integration/webhook/{{integrationId}}`
87
- */
88
- webhookUrl?: string;
89
84
  pro?: boolean;
90
85
  };
@@ -17,7 +17,6 @@ export interface IOrganizationContact extends IBaseEntityWithMembers {
17
17
  imageUrl?: string;
18
18
  inviteStatus?: string;
19
19
  tags: ITag[];
20
- contact: IContact;
21
20
  budget?: number;
22
21
  budgetType?: OrganizationContactBudgetTypeEnum;
23
22
  }
@@ -70,7 +70,6 @@ export interface IOrganization extends IBasePerTenantEntityModel {
70
70
  defaultStartTime?: string;
71
71
  defaultEndTime?: string;
72
72
  registrationDate?: Date;
73
- contact: IContact;
74
73
  separateInvoiceItemTaxAndDiscount?: boolean;
75
74
  minimumProjectSize?: string;
76
75
  show_clients?: boolean;
package/src/plugin.d.ts CHANGED
@@ -1,8 +1,23 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
1
2
  import { IconDefinition } from './types';
2
3
  export type PluginName = string;
4
+ export declare const PLUGIN_LEVEL: {
5
+ readonly SYSTEM: "system";
6
+ readonly ORGANIZATION: "organization";
7
+ };
8
+ /**
9
+ * Classifies plugin scope and governance.
10
+ * - `system`: built-in/platform-managed plugin that users cannot install/uninstall from org APIs.
11
+ * - `organization`: tenant/org-managed plugin that can be installed and removed per organization.
12
+ */
13
+ export type PluginLevel = (typeof PLUGIN_LEVEL)[keyof typeof PLUGIN_LEVEL];
3
14
  export interface PluginMeta {
4
15
  name: PluginName;
5
16
  version: string;
17
+ /**
18
+ * Declares the plugin's operational level used for visibility and install/uninstall guardrails.
19
+ */
20
+ level?: PluginLevel;
6
21
  icon?: IconDefinition;
7
22
  category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration' | 'datasource' | 'database' | 'middleware';
8
23
  displayName: string;
@@ -11,3 +26,11 @@ export interface PluginMeta {
11
26
  author: string;
12
27
  homepage?: string;
13
28
  }
29
+ export interface IPlugin extends IBasePerTenantAndOrganizationEntityModel {
30
+ pluginName: string;
31
+ packageName: string;
32
+ version?: string;
33
+ source?: 'marketplace' | 'local' | 'git' | 'url' | 'npm' | 'code' | 'env';
34
+ level?: PluginLevel;
35
+ config: Record<string, any>;
36
+ }
@@ -2,7 +2,7 @@ import { IRole } from './role.model';
2
2
  import { IBasePerTenantEntityModel } from './base-entity.model';
3
3
  import { ITag } from './tag-entity.model';
4
4
  import { IEmployee } from './employee.model';
5
- import { IOrganization } from './organization.model';
5
+ import { IUserOrganization } from './user-organization.model';
6
6
  export declare enum UserType {
7
7
  USER = "user",// Regular user
8
8
  COMMUNICATION = "communication"
@@ -27,7 +27,7 @@ export interface IUser extends IBasePerTenantEntityModel {
27
27
  preferredLanguage?: string;
28
28
  paymentsId?: string;
29
29
  fullName?: string;
30
- organizations?: IOrganization[];
30
+ organizations?: IUserOrganization[];
31
31
  isImporting?: boolean;
32
32
  sourceId?: string;
33
33
  emailVerified?: boolean;