@metad/contracts 3.7.0 → 3.8.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.
@@ -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,3 +1,4 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
1
2
  import { IconDefinition } from './types';
2
3
  export type PluginName = string;
3
4
  export interface PluginMeta {
@@ -11,3 +12,10 @@ export interface PluginMeta {
11
12
  author: string;
12
13
  homepage?: string;
13
14
  }
15
+ export interface IPlugin extends IBasePerTenantAndOrganizationEntityModel {
16
+ pluginName: string;
17
+ packageName: string;
18
+ version?: string;
19
+ source?: "marketplace" | "local" | "git" | "url" | "npm" | "code";
20
+ config: Record<string, any>;
21
+ }
@@ -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;