@metad/contracts 3.8.1 → 3.8.3

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/index.cjs.js CHANGED
@@ -707,9 +707,6 @@ exports.FeatureEnum = void 0;
707
707
  exports.FileStorageProviderEnum = void 0;
708
708
  (function(FileStorageProviderEnum) {
709
709
  FileStorageProviderEnum["LOCAL"] = "LOCAL";
710
- FileStorageProviderEnum["S3"] = "S3";
711
- FileStorageProviderEnum["WASABI"] = "WASABI";
712
- FileStorageProviderEnum["OSS"] = "OSS";
713
710
  })(exports.FileStorageProviderEnum || (exports.FileStorageProviderEnum = {}));
714
711
 
715
712
  exports.HttpStatus = void 0;
package/index.esm.js CHANGED
@@ -705,9 +705,6 @@ var FeatureEnum;
705
705
  var FileStorageProviderEnum;
706
706
  (function(FileStorageProviderEnum) {
707
707
  FileStorageProviderEnum["LOCAL"] = "LOCAL";
708
- FileStorageProviderEnum["S3"] = "S3";
709
- FileStorageProviderEnum["WASABI"] = "WASABI";
710
- FileStorageProviderEnum["OSS"] = "OSS";
711
708
  })(FileStorageProviderEnum || (FileStorageProviderEnum = {}));
712
709
 
713
710
  var HttpStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metad/contracts",
3
- "version": "3.8.1",
3
+ "version": "3.8.3",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -3,6 +3,23 @@ export type TTokenUsage = {
3
3
  completionTokens: number;
4
4
  totalTokens: number;
5
5
  };
6
+ export type TThreadContextUsageMetrics = {
7
+ contextTokens: number;
8
+ inputTokens: number;
9
+ outputTokens: number;
10
+ totalTokens: number;
11
+ embedTokens: number;
12
+ totalPrice: number;
13
+ currency: string | null;
14
+ };
15
+ export type TThreadContextUsageEvent = {
16
+ type: 'thread_context_usage';
17
+ threadId: string;
18
+ runId: string | null;
19
+ agentKey: string;
20
+ updatedAt: string;
21
+ usage: TThreadContextUsageMetrics;
22
+ };
6
23
  export interface IModelUsage {
7
24
  totalTokens: number;
8
25
  totalPrice: number;
@@ -2,7 +2,7 @@ import { MessageType } from '@langchain/core/messages';
2
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { IChatConversation } from './chat.model';
4
4
  import { LongTermMemoryTypeEnum } from './xpert.model';
5
- import { XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
5
+ import { IXpertAgentExecution, XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
6
6
  import { JSONValue } from '../core.model';
7
7
  import { IStorageFile } from '../storage-file.model';
8
8
  import { TChatMessageStep, TMessageContent, TMessageContentReasoning } from '@xpert-ai/chatkit-types';
@@ -41,6 +41,7 @@ export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel,
41
41
  conversation?: IChatConversation;
42
42
  conversationId?: string | null;
43
43
  executionId?: string;
44
+ execution?: IXpertAgentExecution;
44
45
  }
45
46
  /**
46
47
  * @deprecated
@@ -1,5 +1,4 @@
1
1
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
2
- import { FileStorageProviderEnum } from '../file-provider';
3
2
  export interface IScreenshot extends IBasePerTenantAndOrganizationEntityModel {
4
3
  file: string;
5
4
  url?: string;
@@ -11,7 +10,7 @@ export interface IScreenshot extends IBasePerTenantAndOrganizationEntityModel {
11
10
  thumbUrl?: string;
12
11
  recordedAt?: Date;
13
12
  size?: number;
14
- storageProvider?: FileStorageProviderEnum;
13
+ storageProvider?: string;
15
14
  }
16
15
  export interface IUpdateScreenshotInput extends ICreateScreenshotInput {
17
16
  id: string;
@@ -0,0 +1,77 @@
1
+ import { IStorageFile } from './storage-file.model';
2
+ export type FileAssetStatus = 'success' | 'partial_success' | 'failed';
3
+ export type FileAssetDestinationKind = 'storage' | 'volume' | 'sandbox';
4
+ export type FileAssetSourceKind = 'multipart' | 'storage_file' | 'local_file';
5
+ export type FileUploadVolumeCatalog = 'projects' | 'users' | 'knowledges' | 'skills';
6
+ export type FileUploadSandboxMode = 'mounted_workspace' | 'backend_upload';
7
+ export interface IFileAssetSource {
8
+ kind: FileAssetSourceKind;
9
+ name?: string;
10
+ originalName?: string;
11
+ mimeType?: string;
12
+ size?: number;
13
+ storageFileId?: string;
14
+ filePath?: string;
15
+ metadata?: Record<string, any>;
16
+ }
17
+ export interface IFileAssetDestination {
18
+ kind: FileAssetDestinationKind;
19
+ status: 'success' | 'failed';
20
+ path?: string;
21
+ url?: string;
22
+ referenceId?: string;
23
+ metadata?: Record<string, any>;
24
+ error?: string;
25
+ }
26
+ export interface IFileAsset {
27
+ name?: string;
28
+ originalName?: string;
29
+ mimeType?: string;
30
+ size?: number;
31
+ status: FileAssetStatus;
32
+ metadata?: Record<string, any>;
33
+ source?: IFileAssetSource;
34
+ destinations: IFileAssetDestination[];
35
+ }
36
+ export interface IUploadFileStorageTarget {
37
+ kind: 'storage';
38
+ strategy?: string;
39
+ provider?: string;
40
+ providerOptions?: Record<string, any>;
41
+ directory?: string;
42
+ fileName?: string;
43
+ prefix?: string;
44
+ metadata?: Record<string, any>;
45
+ }
46
+ export interface IUploadFileVolumeTarget {
47
+ kind: 'volume';
48
+ strategy?: string;
49
+ catalog: FileUploadVolumeCatalog;
50
+ projectId?: string;
51
+ knowledgeId?: string;
52
+ userId?: string;
53
+ tenantId?: string;
54
+ folder?: string;
55
+ fileName?: string;
56
+ metadata?: Record<string, any>;
57
+ }
58
+ export interface IUploadFileSandboxTarget {
59
+ kind: 'sandbox';
60
+ strategy?: string;
61
+ mode: FileUploadSandboxMode;
62
+ workspacePath?: string;
63
+ workspaceUrl?: string;
64
+ workspaceId?: string;
65
+ sandboxUrl?: string;
66
+ folder?: string;
67
+ fileName?: string;
68
+ metadata?: Record<string, any>;
69
+ }
70
+ export type IUploadFileTarget = IUploadFileStorageTarget | IUploadFileVolumeTarget | IUploadFileSandboxTarget;
71
+ export type TStorageFileAssetDestination = IFileAssetDestination & {
72
+ kind: 'storage';
73
+ referenceId?: IStorageFile['id'];
74
+ metadata?: Record<string, any> & {
75
+ storageFile?: IStorageFile;
76
+ };
77
+ };
@@ -1,6 +1,6 @@
1
1
  export interface FileStorageOption {
2
2
  dest: string | CallableFunction;
3
- provider?: FileStorageProviderEnum;
3
+ provider?: string;
4
4
  prefix?: string;
5
5
  filename?: string | CallableFunction;
6
6
  }
@@ -9,10 +9,7 @@ export interface FileSystem {
9
9
  baseUrl?: string;
10
10
  }
11
11
  export declare enum FileStorageProviderEnum {
12
- LOCAL = "LOCAL",
13
- S3 = "S3",
14
- WASABI = "WASABI",
15
- OSS = "OSS"
12
+ LOCAL = "LOCAL"
16
13
  }
17
14
  export interface UploadedFile {
18
15
  fieldname: string;
@@ -30,4 +27,5 @@ export interface S3FileStorageProviderConfig {
30
27
  aws_secret_access_key?: string;
31
28
  aws_default_region?: string;
32
29
  aws_bucket?: string;
30
+ aws_endpoint?: string;
33
31
  }
package/src/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './employee.model';
9
9
  export * from './entity-with-members.model';
10
10
  export * from './feature.model';
11
11
  export * from './file-provider';
12
+ export * from './file-asset.model';
12
13
  export * from './http-status.enum';
13
14
  export * from './import-export.model';
14
15
  export * from './language.model';
package/src/plugin.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
+ import { JsonSchemaObjectType } from './ai/types';
2
3
  import { IconDefinition } from './types';
3
4
  export type PluginName = string;
4
5
  export declare const PLUGIN_LEVEL: {
@@ -34,3 +35,17 @@ export interface IPlugin extends IBasePerTenantAndOrganizationEntityModel {
34
35
  level?: PluginLevel;
35
36
  config: Record<string, any>;
36
37
  }
38
+ export interface IPluginDescriptor {
39
+ organizationId?: string;
40
+ name: PluginName;
41
+ meta: PluginMeta;
42
+ isGlobal: boolean;
43
+ level: PluginLevel;
44
+ canConfigure?: boolean;
45
+ configSchema?: JsonSchemaObjectType;
46
+ }
47
+ export interface IPluginConfiguration<TConfig extends Record<string, any> = Record<string, any>> {
48
+ pluginName: PluginName;
49
+ config: TConfig;
50
+ configSchema?: JsonSchemaObjectType;
51
+ }
@@ -1,5 +1,4 @@
1
1
  import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
- import { FileStorageProviderEnum } from './file-provider';
3
2
  import { _TFile } from './types';
4
3
  export type TFile = _TFile & {
5
4
  fileType?: string;
@@ -20,7 +19,7 @@ export interface IStorageFile extends IBasePerTenantAndOrganizationEntityModel {
20
19
  size?: number;
21
20
  mimetype?: string;
22
21
  recordedAt?: Date;
23
- storageProvider?: FileStorageProviderEnum;
22
+ storageProvider?: string;
24
23
  }
25
24
  export interface ICreateStorageFileInput extends IBasePerTenantAndOrganizationEntityModel {
26
25
  activityTimestamp: string;
@@ -1,6 +1,6 @@
1
1
  import { IImportRecord } from './import-export.model';
2
2
  import { IFeatureOrganization } from './feature.model';
3
- import { FileStorageProviderEnum, S3FileStorageProviderConfig } from './file-provider';
3
+ import { S3FileStorageProviderConfig } from './file-provider';
4
4
  import { IOrganization, IOrganizationCreateInput } from './organization.model';
5
5
  import { IRolePermission } from './role-permission.model';
6
6
  import { IUserCreateInput } from './user.model';
@@ -28,7 +28,7 @@ export interface ISetting {
28
28
  value: string;
29
29
  }
30
30
  export interface ITenantSetting extends S3FileStorageProviderConfig {
31
- fileStorageProvider?: FileStorageProviderEnum;
31
+ fileStorageProvider?: string;
32
32
  tenant_title?: string;
33
33
  tenant_title_en?: string;
34
34
  tenant_enable_feishu?: boolean;