@xpert-ai/contracts 3.16.0 → 3.17.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/index.cjs.js +48 -12
- package/index.esm.js +38 -10
- package/package.json +1 -1
- package/src/agent/ai-model.d.ts +4 -1
- package/src/agent/graph.d.ts +2 -0
- package/src/ai/ai-model.model.d.ts +2 -1
- package/src/ai/evolution/candidate.d.ts +67 -0
- package/src/ai/evolution/capability-version.d.ts +45 -0
- package/src/ai/evolution/evaluation.d.ts +93 -0
- package/src/ai/evolution/example.d.ts +42 -0
- package/src/ai/evolution/experience.d.ts +21 -0
- package/src/ai/evolution/governance.d.ts +87 -0
- package/src/ai/evolution/index.d.ts +11 -0
- package/src/ai/evolution/learning-event.d.ts +69 -0
- package/src/ai/evolution/provider.d.ts +30 -0
- package/src/ai/evolution/release.d.ts +144 -0
- package/src/ai/evolution/runtime.d.ts +81 -0
- package/src/ai/evolution/target.d.ts +83 -0
- package/src/ai/index.d.ts +3 -0
- package/src/ai/knowledge-doc-chunk.model.d.ts +143 -0
- package/src/ai/knowledge-doc.model.d.ts +53 -4
- package/src/ai/knowledge-filter.model.d.ts +92 -0
- package/src/ai/knowledge-retrieval-log.model.d.ts +16 -0
- package/src/ai/knowledgebase-task.model.d.ts +3 -1
- package/src/ai/knowledgebase.model.d.ts +6 -0
- package/src/ai/membership.model.d.ts +40 -7
- package/src/ai/model-gateway.model.d.ts +5 -0
- package/src/ai/model-usage.model.d.ts +163 -0
- package/src/ai/role-permissions.d.ts +3 -1
- package/src/ai/xpert-agent-execution.model.d.ts +2 -0
- package/src/ai/xpert.model.d.ts +23 -11
- package/src/plugin.d.ts +4 -0
- package/src/tenant.model.d.ts +1 -1
- package/src/view-extension/model.d.ts +12 -1
|
@@ -5,7 +5,7 @@ import { IKnowledgeDocumentPage } from './knowledge-doc-page.model';
|
|
|
5
5
|
import { IKnowledgebaseTask } from './knowledgebase-task.model';
|
|
6
6
|
import { IKnowledgebase, KBMetadataFieldDef } from './knowledgebase.model';
|
|
7
7
|
import { TRagWebOptions } from './rag-web';
|
|
8
|
-
import { IKnowledgeDocumentChunk } from './knowledge-doc-chunk.model';
|
|
8
|
+
import { DocumentAnalysisMetadata, IKnowledgeDocumentChunk } from './knowledge-doc-chunk.model';
|
|
9
9
|
import { DocumentSourceProviderCategoryEnum } from './knowledge-pipeline';
|
|
10
10
|
import { TCopilotModel } from './copilot-model.model';
|
|
11
11
|
import { I18nObject } from '../types';
|
|
@@ -88,6 +88,52 @@ export declare enum KBDocumentStatusEnum {
|
|
|
88
88
|
ERROR = "error"
|
|
89
89
|
}
|
|
90
90
|
export type KnowledgeDocumentIncrementalSyncMode = 'incremental' | 'full' | 'skipped';
|
|
91
|
+
/** `rechunk` reuses the saved pre-split transformer output and never invokes the converter. */
|
|
92
|
+
export type KnowledgeDocumentProcessingMode = 'full' | 'rechunk';
|
|
93
|
+
/** Converter identity included in fingerprints so credentials/config changes invalidate stale snapshots. */
|
|
94
|
+
export type KnowledgeDocumentTransformerIdentity = {
|
|
95
|
+
provider: string;
|
|
96
|
+
integrationId?: string | null;
|
|
97
|
+
config?: {
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
} | null;
|
|
100
|
+
};
|
|
101
|
+
/** Integrity-checked reference to the pre-split converter output used by rechunk processing. */
|
|
102
|
+
export type KnowledgeDocumentTransformSnapshotRef = {
|
|
103
|
+
schemaVersion: 1;
|
|
104
|
+
filePath: string;
|
|
105
|
+
manifestPath: string;
|
|
106
|
+
sha256: string;
|
|
107
|
+
size: number;
|
|
108
|
+
itemCount: number;
|
|
109
|
+
chunkCount: number;
|
|
110
|
+
transformFingerprint: string;
|
|
111
|
+
sourceHash?: string | null;
|
|
112
|
+
transformer: KnowledgeDocumentTransformerIdentity;
|
|
113
|
+
createdAt: string;
|
|
114
|
+
};
|
|
115
|
+
/** Reference to the immutable, paged layout snapshot consumed by the analysis-preview API. */
|
|
116
|
+
export type KnowledgeDocumentAnalysisSnapshotRef = {
|
|
117
|
+
schemaVersion: 1;
|
|
118
|
+
manifestPath: string;
|
|
119
|
+
manifestSha256: string;
|
|
120
|
+
manifestSize: number;
|
|
121
|
+
transformFingerprint: string;
|
|
122
|
+
sourceHash?: string | null;
|
|
123
|
+
provider: string;
|
|
124
|
+
engine?: string;
|
|
125
|
+
pageCount: number;
|
|
126
|
+
createdAt: string;
|
|
127
|
+
};
|
|
128
|
+
/** Server-computed actions available for a document under its current source and converter fingerprint. */
|
|
129
|
+
export type KnowledgeDocumentReprocessCapabilities = {
|
|
130
|
+
full: true;
|
|
131
|
+
rechunk: {
|
|
132
|
+
available: boolean;
|
|
133
|
+
reason?: 'missing' | 'stale' | 'corrupt';
|
|
134
|
+
snapshot?: KnowledgeDocumentTransformSnapshotRef;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
91
137
|
export type KnowledgeDocumentLastIncrementalSync = {
|
|
92
138
|
mode: KnowledgeDocumentIncrementalSyncMode;
|
|
93
139
|
total: number;
|
|
@@ -194,8 +240,8 @@ export type TKnowledgeDocument = {
|
|
|
194
240
|
integrationId?: string;
|
|
195
241
|
integration?: IIntegration;
|
|
196
242
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
* @deprecated use chunks instead
|
|
244
|
+
*/
|
|
199
245
|
pages?: IKnowledgeDocumentPage[];
|
|
200
246
|
chunks?: IKnowledgeDocumentChunk[];
|
|
201
247
|
tasks?: IKnowledgebaseTask[];
|
|
@@ -230,6 +276,9 @@ export interface StandardDocumentMetadata {
|
|
|
230
276
|
lastIncrementalSync?: KnowledgeDocumentLastIncrementalSync;
|
|
231
277
|
}
|
|
232
278
|
export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
|
|
279
|
+
transformSnapshot?: KnowledgeDocumentTransformSnapshotRef;
|
|
280
|
+
analysisSnapshot?: KnowledgeDocumentAnalysisSnapshotRef;
|
|
281
|
+
documentAnalysis?: DocumentAnalysisMetadata;
|
|
233
282
|
[key: string]: any;
|
|
234
283
|
}
|
|
235
284
|
export interface IKnowledgeDocumentCreateInput extends IKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
|
|
@@ -252,4 +301,4 @@ export declare const STANDARD_METADATA_FIELDS: {
|
|
|
252
301
|
group: I18nObject;
|
|
253
302
|
fields: KBMetadataFieldDef[];
|
|
254
303
|
}[];
|
|
255
|
-
export type StandardMetadataFieldKey = typeof STANDARD_METADATA_FIELDS[number]['fields'][number]['key'];
|
|
304
|
+
export type StandardMetadataFieldKey = (typeof STANDARD_METADATA_FIELDS)[number]['fields'][number]['key'];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export declare const KNOWLEDGE_FILTER_VERSION: 2;
|
|
2
|
+
export declare const KNOWLEDGE_FILTER_MAX_DEPTH = 3;
|
|
3
|
+
export declare const KNOWLEDGE_FILTER_MAX_CONDITIONS = 20;
|
|
4
|
+
export declare const KNOWLEDGE_FILTER_MAX_SET_VALUES = 100;
|
|
5
|
+
export declare const KNOWLEDGE_FILTER_MAX_STRING_LENGTH = 512;
|
|
6
|
+
export type KnowledgeFilterOperator = 'eq' | 'neq' | 'in' | 'notIn' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'under' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'exists' | 'containsAny' | 'containsAll' | 'isEmpty' | 'jsonContains';
|
|
7
|
+
type KnowledgeFilterJSONPrimitive = null | string | number | boolean;
|
|
8
|
+
type KnowledgeFilterJSONObjectLevel1 = Record<string, KnowledgeFilterJSONPrimitive | KnowledgeFilterJSONPrimitive[]>;
|
|
9
|
+
/** A finite JSON shape keeps ORM DeepPartial types bounded while covering filter literals and JSON containment. */
|
|
10
|
+
export type KnowledgeFilterJSONValue = KnowledgeFilterJSONPrimitive | KnowledgeFilterJSONPrimitive[] | KnowledgeFilterJSONObjectLevel1 | KnowledgeFilterJSONObjectLevel1[] | Record<string, KnowledgeFilterJSONPrimitive | KnowledgeFilterJSONPrimitive[] | KnowledgeFilterJSONObjectLevel1 | KnowledgeFilterJSONObjectLevel1[]>;
|
|
11
|
+
export type KnowledgeFilterLiteralValue = {
|
|
12
|
+
kind: 'literal';
|
|
13
|
+
value: KnowledgeFilterJSONValue;
|
|
14
|
+
};
|
|
15
|
+
export type KnowledgeFilterVariableValue = {
|
|
16
|
+
kind: 'variable';
|
|
17
|
+
selector: string;
|
|
18
|
+
};
|
|
19
|
+
export type KnowledgeFilterValue = KnowledgeFilterLiteralValue | KnowledgeFilterVariableValue;
|
|
20
|
+
export type KnowledgeFilterCondition = {
|
|
21
|
+
kind: 'condition';
|
|
22
|
+
field: string;
|
|
23
|
+
operator: KnowledgeFilterOperator;
|
|
24
|
+
value?: KnowledgeFilterValue;
|
|
25
|
+
};
|
|
26
|
+
export type KnowledgeFilterGroupLevel1 = {
|
|
27
|
+
kind: 'group';
|
|
28
|
+
operator: 'and' | 'or';
|
|
29
|
+
children: KnowledgeFilterCondition[];
|
|
30
|
+
};
|
|
31
|
+
export type KnowledgeFilterGroupLevel2 = {
|
|
32
|
+
kind: 'group';
|
|
33
|
+
operator: 'and' | 'or';
|
|
34
|
+
children: Array<KnowledgeFilterCondition | KnowledgeFilterGroupLevel1>;
|
|
35
|
+
};
|
|
36
|
+
export type KnowledgeFilterGroupLevel3 = {
|
|
37
|
+
kind: 'group';
|
|
38
|
+
operator: 'and' | 'or';
|
|
39
|
+
children: Array<KnowledgeFilterCondition | KnowledgeFilterGroupLevel1 | KnowledgeFilterGroupLevel2>;
|
|
40
|
+
};
|
|
41
|
+
/** The fourth level is reserved for the server-owned root that merges validated sources. */
|
|
42
|
+
export type KnowledgeFilterGroupLevel4 = {
|
|
43
|
+
kind: 'group';
|
|
44
|
+
operator: 'and' | 'or';
|
|
45
|
+
children: Array<KnowledgeFilterCondition | KnowledgeFilterGroupLevel1 | KnowledgeFilterGroupLevel2 | KnowledgeFilterGroupLevel3>;
|
|
46
|
+
};
|
|
47
|
+
export type KnowledgeFilterGroup = KnowledgeFilterGroupLevel1 | KnowledgeFilterGroupLevel2 | KnowledgeFilterGroupLevel3 | KnowledgeFilterGroupLevel4;
|
|
48
|
+
export type KnowledgeFilterNode = KnowledgeFilterCondition | KnowledgeFilterGroup;
|
|
49
|
+
export type KnowledgeFilterSources = {
|
|
50
|
+
fixed?: KnowledgeFilterNode;
|
|
51
|
+
request?: KnowledgeFilterNode;
|
|
52
|
+
dynamic?: KnowledgeFilterNode;
|
|
53
|
+
};
|
|
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';
|
|
56
|
+
export type KnowledgeFilterDiagnostics = {
|
|
57
|
+
filterVersion: typeof KNOWLEDGE_FILTER_VERSION;
|
|
58
|
+
fixedFilter?: KnowledgeFilterNode;
|
|
59
|
+
requestFilter?: KnowledgeFilterNode;
|
|
60
|
+
dynamicFilter?: KnowledgeFilterNode;
|
|
61
|
+
effectiveFilter?: KnowledgeFilterNode;
|
|
62
|
+
filterHash?: string;
|
|
63
|
+
filterStatus: KnowledgeFilterStatus;
|
|
64
|
+
fallbackReason?: 'invalid_dynamic_filter';
|
|
65
|
+
errorCode?: KnowledgeFilterErrorCode;
|
|
66
|
+
candidateDocumentCount?: number;
|
|
67
|
+
candidateChunkCount?: number;
|
|
68
|
+
hitCount: number;
|
|
69
|
+
vectorBackend?: string;
|
|
70
|
+
filterLatency?: number;
|
|
71
|
+
vectorLatency?: number;
|
|
72
|
+
vectorBranchHitCount?: number;
|
|
73
|
+
graphBranchHitCount?: number;
|
|
74
|
+
graphGlobalCandidateCount?: number;
|
|
75
|
+
graphCandidateScanLimit?: number;
|
|
76
|
+
graphCandidateScanRounds?: number;
|
|
77
|
+
graphCandidateTruncated?: boolean;
|
|
78
|
+
eligibleSeedEntityCount?: number;
|
|
79
|
+
eligibleRelationCount?: number;
|
|
80
|
+
eligibleMentionCount?: number;
|
|
81
|
+
graphCandidateChunkCount?: number;
|
|
82
|
+
graphSeedLatency?: number;
|
|
83
|
+
graphFilterLatency?: number;
|
|
84
|
+
graphExpansionLatency?: number;
|
|
85
|
+
graphChunkLatency?: number;
|
|
86
|
+
hybridGraphFallbackReason?: string;
|
|
87
|
+
retryableWithoutDynamic?: boolean;
|
|
88
|
+
errors?: string[];
|
|
89
|
+
};
|
|
90
|
+
export declare const KNOWLEDGE_SYSTEM_FILTER_FIELDS: readonly ["document.fileName", "document.folderPath", "document.fileExtension", "document.mimeType", "document.category", "document.sourceType", "document.createdAt", "document.updatedAt"];
|
|
91
|
+
export type KnowledgeSystemFilterField = (typeof KNOWLEDGE_SYSTEM_FILTER_FIELDS)[number];
|
|
92
|
+
export {};
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
2
|
import { IKnowledgebase } from './knowledgebase.model';
|
|
3
|
+
import { KnowledgeFilterDiagnostics, KnowledgeFilterNode, KnowledgeFilterStatus } from './knowledge-filter.model';
|
|
3
4
|
export interface IKnowledgeRetrievalLog extends IBasePerTenantAndOrganizationEntityModel {
|
|
4
5
|
query: string;
|
|
5
6
|
source: string;
|
|
6
7
|
hitCount: number;
|
|
7
8
|
requestId: string;
|
|
9
|
+
filterVersion?: number;
|
|
10
|
+
fixedFilter?: KnowledgeFilterNode;
|
|
11
|
+
dynamicFilter?: KnowledgeFilterNode;
|
|
12
|
+
requestFilter?: KnowledgeFilterNode;
|
|
13
|
+
effectiveFilter?: KnowledgeFilterNode;
|
|
14
|
+
filterHash?: string;
|
|
15
|
+
filterStatus?: KnowledgeFilterStatus;
|
|
16
|
+
fallbackReason?: string;
|
|
17
|
+
errorCode?: string;
|
|
18
|
+
candidateDocumentCount?: number;
|
|
19
|
+
candidateChunkCount?: number;
|
|
20
|
+
vectorBackend?: string;
|
|
21
|
+
filterLatency?: number;
|
|
22
|
+
vectorLatency?: number;
|
|
23
|
+
diagnostics?: KnowledgeFilterDiagnostics;
|
|
8
24
|
knowledgebaseId?: string;
|
|
9
25
|
knowledgebase?: IKnowledgebase;
|
|
10
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
2
|
import { IChatConversation } from './chat.model';
|
|
3
|
-
import { IKnowledgeDocument } from './knowledge-doc.model';
|
|
3
|
+
import { IKnowledgeDocument, KnowledgeDocumentProcessingMode } from './knowledge-doc.model';
|
|
4
4
|
import { IKnowledgebase } from './knowledgebase.model';
|
|
5
5
|
import { IXpertAgentExecution } from './xpert-agent-execution.model';
|
|
6
6
|
/**
|
|
@@ -22,6 +22,8 @@ export interface IKnowledgebaseTask extends IBasePerTenantAndOrganizationEntityM
|
|
|
22
22
|
*/
|
|
23
23
|
context?: {
|
|
24
24
|
documents?: Partial<IKnowledgeDocument>[];
|
|
25
|
+
/** Propagates full conversion vs. snapshot-only rechunking through the background task. */
|
|
26
|
+
processingMode?: KnowledgeDocumentProcessingMode;
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* Many to Many of documents in task
|
|
@@ -186,6 +186,10 @@ export type KBMetadataFieldDef = {
|
|
|
186
186
|
key: string;
|
|
187
187
|
label?: I18nObject;
|
|
188
188
|
type: MetadataFieldType;
|
|
189
|
+
/**
|
|
190
|
+
* Storage scope of the metadata value. Existing definitions are migrated to `document`.
|
|
191
|
+
*/
|
|
192
|
+
scope?: 'document' | 'chunk';
|
|
189
193
|
enumValues?: string[];
|
|
190
194
|
description?: string;
|
|
191
195
|
};
|
|
@@ -201,6 +205,8 @@ export declare const KnowledgeTask = "task_id";
|
|
|
201
205
|
* Specify the data source to run
|
|
202
206
|
*/
|
|
203
207
|
export declare const KNOWLEDGE_SOURCES_NAME = "sources";
|
|
208
|
+
/** Workflow-state key carrying the requested document processing resume point. */
|
|
209
|
+
export declare const KNOWLEDGE_PROCESSING_MODE_NAME = "processing_mode";
|
|
204
210
|
export declare const KNOWLEDGE_DOCUMENTS_NAME = "documents";
|
|
205
211
|
export declare const KNOWLEDGE_FOLDER_ID_NAME = "folder_id";
|
|
206
212
|
export declare const KNOWLEDGE_STAGE_NAME = "stage";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IBasePerTenantAndOrganizationEntityModel, IBasePerTenantEntityModel } from '../base-entity.model';
|
|
2
2
|
import { IUser } from '../user.model';
|
|
3
|
+
import { AiModelTypeEnum } from '../agent';
|
|
3
4
|
import { ModelAccessSourceEnum } from './model-access.model';
|
|
4
5
|
import { ModelGatewayUsageChannelEnum } from './model-gateway.model';
|
|
6
|
+
import type { ModelUsageMetric, ModelUsageLedgerModality, ModelUsageLedgerOperation, ModelUsageOriginType, ModelUsagePriceRule, ModelUsagePricingStatus } from './model-usage.model';
|
|
5
7
|
export declare enum MembershipPlanStatusEnum {
|
|
6
8
|
Active = "active",
|
|
7
9
|
Archived = "archived"
|
|
@@ -31,9 +33,8 @@ export declare enum MembershipPeriodStatusEnum {
|
|
|
31
33
|
Completed = "completed",
|
|
32
34
|
Cancelled = "cancelled"
|
|
33
35
|
}
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const MEMBERSHIP_TOKENS_PER_POINT_OPTIONS: readonly [1000, 10000, 100000, 1000000];
|
|
36
|
+
export declare const DEFAULT_MEMBERSHIP_CNY_PER_POINT = 0.1;
|
|
37
|
+
export declare const MEMBERSHIP_CNY_PER_POINT_SETTING = "membershipCnyPerPoint";
|
|
37
38
|
export declare enum MembershipLedgerSourceEnum {
|
|
38
39
|
Assignment = "assignment",
|
|
39
40
|
Grant = "grant",
|
|
@@ -43,7 +44,8 @@ export declare enum MembershipLedgerSourceEnum {
|
|
|
43
44
|
Adjustment = "adjustment",
|
|
44
45
|
StatusChange = "status_change",
|
|
45
46
|
PersonalAdjustment = "personal_adjustment",
|
|
46
|
-
PersonalUsage = "personal_usage"
|
|
47
|
+
PersonalUsage = "personal_usage",
|
|
48
|
+
ModelUsage = "model_usage"
|
|
47
49
|
}
|
|
48
50
|
export declare enum MembershipAdminUserStatusEnum {
|
|
49
51
|
Active = "active",
|
|
@@ -62,6 +64,7 @@ export type TMembershipRateLimitPeriod = 'hour' | 'day' | 'week' | 'cycle';
|
|
|
62
64
|
export interface IMembershipModelMultiplier {
|
|
63
65
|
provider?: string | null;
|
|
64
66
|
model?: string | null;
|
|
67
|
+
/** Applied to the CNY settlement amount before it is converted to membership points. */
|
|
65
68
|
multiplier: number;
|
|
66
69
|
}
|
|
67
70
|
export interface IMembershipAllowedModel {
|
|
@@ -84,8 +87,9 @@ export interface IMembershipPlan extends IBasePerTenantAndOrganizationEntityMode
|
|
|
84
87
|
isDefault?: boolean;
|
|
85
88
|
period: MembershipPeriodEnum;
|
|
86
89
|
includedPoints: number | null;
|
|
87
|
-
|
|
90
|
+
/** @deprecated Sale pricing is owned by the Pro billing product. Retained temporarily for migration only. */
|
|
88
91
|
priceAmount?: number | null;
|
|
92
|
+
/** @deprecated Sale pricing is owned by the Pro billing product. Retained temporarily for migration only. */
|
|
89
93
|
priceCurrency?: string | null;
|
|
90
94
|
allowedModels?: IMembershipAllowedModel[];
|
|
91
95
|
modelMultipliers?: IMembershipModelMultiplier[];
|
|
@@ -100,7 +104,6 @@ export interface IMembershipPlanSnapshot {
|
|
|
100
104
|
catalogSourcePlanId?: string | null;
|
|
101
105
|
period: MembershipPeriodEnum;
|
|
102
106
|
includedPoints: number | null;
|
|
103
|
-
tokensPerPoint: number;
|
|
104
107
|
allowedModels?: IMembershipAllowedModel[];
|
|
105
108
|
modelMultipliers?: IMembershipModelMultiplier[];
|
|
106
109
|
rateLimits?: IMembershipRateLimit[];
|
|
@@ -142,7 +145,7 @@ export interface IUserMembershipPeriod extends IBasePerTenantAndOrganizationEnti
|
|
|
142
145
|
planSnapshot: IMembershipPlanSnapshot;
|
|
143
146
|
}
|
|
144
147
|
export interface IMembershipPointLedger extends IBasePerTenantEntityModel {
|
|
145
|
-
userId
|
|
148
|
+
userId?: string | null;
|
|
146
149
|
user?: IUser;
|
|
147
150
|
actorId?: string | null;
|
|
148
151
|
actor?: IUser;
|
|
@@ -170,6 +173,36 @@ export interface IMembershipPointLedger extends IBasePerTenantEntityModel {
|
|
|
170
173
|
gatewayApiKeyId?: string | null;
|
|
171
174
|
chargedPoints?: number | null;
|
|
172
175
|
excessPoints?: number | null;
|
|
176
|
+
requestId?: string | null;
|
|
177
|
+
revision?: number | null;
|
|
178
|
+
originType?: ModelUsageOriginType | null;
|
|
179
|
+
originId?: string | null;
|
|
180
|
+
originExecutionId?: string | null;
|
|
181
|
+
providerScopeId?: string | null;
|
|
182
|
+
modelType?: AiModelTypeEnum | null;
|
|
183
|
+
toolName?: string | null;
|
|
184
|
+
modality?: ModelUsageLedgerModality | null;
|
|
185
|
+
operation?: ModelUsageLedgerOperation | null;
|
|
186
|
+
unit?: ModelUsageMetric['unit'] | null;
|
|
187
|
+
authority?: ModelUsageMetric['authority'] | null;
|
|
188
|
+
quantity?: number | null;
|
|
189
|
+
promptTokens?: number | null;
|
|
190
|
+
completionTokens?: number | null;
|
|
191
|
+
totalTokens?: number | null;
|
|
192
|
+
recordedAt?: Date | string | null;
|
|
193
|
+
pricingStatus?: ModelUsagePricingStatus | null;
|
|
194
|
+
pricingRuleId?: string | null;
|
|
195
|
+
pricingRuleVersion?: string | null;
|
|
196
|
+
priceQuantity?: number | null;
|
|
197
|
+
unitSize?: number | null;
|
|
198
|
+
unitPrice?: number | null;
|
|
199
|
+
priceCurrency?: string | null;
|
|
200
|
+
priceAmount?: number | null;
|
|
201
|
+
pricingRule?: ModelUsagePriceRule | null;
|
|
202
|
+
chargedAt?: Date | string | null;
|
|
203
|
+
settlementCurrency?: string | null;
|
|
204
|
+
settlementAmount?: number | null;
|
|
205
|
+
exchangeRate?: number | null;
|
|
173
206
|
}
|
|
174
207
|
export interface IMembershipMe {
|
|
175
208
|
membership: IUserMembership;
|
|
@@ -93,6 +93,11 @@ export interface IModelGatewayCall extends IBasePerTenantAndOrganizationEntityMo
|
|
|
93
93
|
inputTokens: number;
|
|
94
94
|
outputTokens: number;
|
|
95
95
|
totalTokens: number;
|
|
96
|
+
priceAmount?: number | null;
|
|
97
|
+
priceCurrency?: string | null;
|
|
98
|
+
settlementAmount?: number | null;
|
|
99
|
+
settlementCurrency?: string | null;
|
|
100
|
+
exchangeRate?: number | null;
|
|
96
101
|
chargedPoints: number;
|
|
97
102
|
excessPoints: number;
|
|
98
103
|
usageSource: ModelGatewayUsageSourceEnum;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
|
+
import type { AiModelTypeEnum } from '../agent';
|
|
3
|
+
export type ModelUsageModality = 'image' | 'video';
|
|
4
|
+
export type ModelUsageLedgerModality = 'text' | ModelUsageModality;
|
|
5
|
+
export type ImageGenerationOperation = 'text_to_image' | 'image_to_image' | 'multi_image_to_image';
|
|
6
|
+
export type VideoGenerationOperation = 'text_to_video' | 'image_to_video' | 'first_last_frame_to_video' | 'reference_to_video';
|
|
7
|
+
export type ModelUsageOperation = ImageGenerationOperation | VideoGenerationOperation;
|
|
8
|
+
export type ModelUsageLedgerOperation = AiModelTypeEnum | ModelUsageOperation;
|
|
9
|
+
export type ModelUsageOriginType = 'execution' | 'tool' | 'model';
|
|
10
|
+
export type ModelUsagePricingDimensions = {
|
|
11
|
+
resolution?: string;
|
|
12
|
+
audio?: boolean;
|
|
13
|
+
videoInput?: boolean;
|
|
14
|
+
durationSeconds?: number;
|
|
15
|
+
mode?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ModelUsagePricingStatus = 'priced' | 'free' | 'unpriced';
|
|
18
|
+
export type ModelUsageChargeType = 'paid' | 'free';
|
|
19
|
+
export type ModelUsageTokenType = 'prompt' | 'completion' | 'total';
|
|
20
|
+
export type ModelUsagePriceRule = {
|
|
21
|
+
id: string;
|
|
22
|
+
version: string;
|
|
23
|
+
effective_from: string;
|
|
24
|
+
effective_to?: string;
|
|
25
|
+
unit: ModelUsageMetric['unit'];
|
|
26
|
+
token_type?: ModelUsageTokenType;
|
|
27
|
+
unit_size: number;
|
|
28
|
+
unit_price?: number;
|
|
29
|
+
currency?: string;
|
|
30
|
+
charge_type: ModelUsageChargeType;
|
|
31
|
+
operations?: ModelUsageOperation[];
|
|
32
|
+
dimensions?: Partial<Omit<ModelUsagePricingDimensions, 'durationSeconds'>>;
|
|
33
|
+
source_url?: string;
|
|
34
|
+
};
|
|
35
|
+
export type ModelUsagePricingConfig = {
|
|
36
|
+
type: 'usage';
|
|
37
|
+
rules: ModelUsagePriceRule[];
|
|
38
|
+
};
|
|
39
|
+
export type ModelUsagePricingContext = {
|
|
40
|
+
model: string;
|
|
41
|
+
operation: ModelUsageOperation;
|
|
42
|
+
modality: ModelUsageModality;
|
|
43
|
+
pricingDimensions?: ModelUsagePricingDimensions;
|
|
44
|
+
startedAt?: Date | string;
|
|
45
|
+
};
|
|
46
|
+
export type ModelUsagePricingSnapshot = {
|
|
47
|
+
capturedAt: string;
|
|
48
|
+
rules: ModelUsagePriceRule[];
|
|
49
|
+
};
|
|
50
|
+
export type ModelUsageMetric = {
|
|
51
|
+
unit: 'token';
|
|
52
|
+
promptTokens?: number;
|
|
53
|
+
completionTokens?: number;
|
|
54
|
+
totalTokens?: number;
|
|
55
|
+
authority: 'provider';
|
|
56
|
+
} | {
|
|
57
|
+
unit: 'generation';
|
|
58
|
+
quantity: number;
|
|
59
|
+
authority: 'provider' | 'contract';
|
|
60
|
+
} | {
|
|
61
|
+
unit: 'second';
|
|
62
|
+
quantity: number;
|
|
63
|
+
authority: 'provider' | 'request';
|
|
64
|
+
};
|
|
65
|
+
/** Final, authoritative usage emitted after a model request has completed. */
|
|
66
|
+
export type ModelUsageReport = {
|
|
67
|
+
requestId: string;
|
|
68
|
+
model?: string;
|
|
69
|
+
modelType: AiModelTypeEnum;
|
|
70
|
+
toolName?: string;
|
|
71
|
+
operation: ModelUsageOperation;
|
|
72
|
+
modality: ModelUsageModality;
|
|
73
|
+
pricingDimensions?: ModelUsagePricingDimensions;
|
|
74
|
+
pricingSnapshot?: ModelUsagePricingSnapshot;
|
|
75
|
+
metrics: ModelUsageMetric[];
|
|
76
|
+
recordedAt?: Date | string;
|
|
77
|
+
};
|
|
78
|
+
export type ModelUsageReportResult = {
|
|
79
|
+
requestId: string;
|
|
80
|
+
recorded: boolean;
|
|
81
|
+
ledgerIds: string[];
|
|
82
|
+
};
|
|
83
|
+
export interface IModelUsageLedger extends IBasePerTenantAndOrganizationEntityModel {
|
|
84
|
+
requestId: string;
|
|
85
|
+
revision: number;
|
|
86
|
+
userId?: string | null;
|
|
87
|
+
userName?: string | null;
|
|
88
|
+
originType: ModelUsageOriginType;
|
|
89
|
+
originId: string;
|
|
90
|
+
originExecutionId?: string | null;
|
|
91
|
+
copilotId: string;
|
|
92
|
+
providerScopeId: string;
|
|
93
|
+
provider: string;
|
|
94
|
+
model?: string | null;
|
|
95
|
+
modelType: AiModelTypeEnum;
|
|
96
|
+
toolName?: string | null;
|
|
97
|
+
modality: ModelUsageLedgerModality;
|
|
98
|
+
operation: ModelUsageLedgerOperation;
|
|
99
|
+
unit: ModelUsageMetric['unit'];
|
|
100
|
+
authority: ModelUsageMetric['authority'];
|
|
101
|
+
quantity?: number | null;
|
|
102
|
+
promptTokens?: number | null;
|
|
103
|
+
completionTokens?: number | null;
|
|
104
|
+
totalTokens?: number | null;
|
|
105
|
+
recordedAt: Date;
|
|
106
|
+
charge?: IModelChargeLedger | null;
|
|
107
|
+
}
|
|
108
|
+
export interface IModelUsageDetails {
|
|
109
|
+
requestId: string;
|
|
110
|
+
providerScopeId: string;
|
|
111
|
+
originExecutionId?: string | null;
|
|
112
|
+
provider: string;
|
|
113
|
+
model?: string | null;
|
|
114
|
+
modelType: AiModelTypeEnum;
|
|
115
|
+
toolName?: string | null;
|
|
116
|
+
modality: ModelUsageModality;
|
|
117
|
+
operation: ModelUsageOperation;
|
|
118
|
+
metrics: ModelUsageMetric[];
|
|
119
|
+
recordedAt: Date;
|
|
120
|
+
}
|
|
121
|
+
export interface IModelChargeLedger extends IBasePerTenantAndOrganizationEntityModel {
|
|
122
|
+
usageLedgerId: string;
|
|
123
|
+
pricingStatus: ModelUsagePricingStatus;
|
|
124
|
+
pricingRuleId?: string | null;
|
|
125
|
+
pricingRuleVersion?: string | null;
|
|
126
|
+
unit: ModelUsageMetric['unit'];
|
|
127
|
+
quantity: number;
|
|
128
|
+
unitSize?: number | null;
|
|
129
|
+
unitPrice?: number | null;
|
|
130
|
+
currency?: string | null;
|
|
131
|
+
amount?: number | null;
|
|
132
|
+
pricingRule?: ModelUsagePriceRule | null;
|
|
133
|
+
chargedAt: Date;
|
|
134
|
+
settlementCurrency?: string | null;
|
|
135
|
+
settlementAmount?: number | null;
|
|
136
|
+
exchangeRate?: number | null;
|
|
137
|
+
}
|
|
138
|
+
export type ModelUsageLedgerQuery = {
|
|
139
|
+
start?: string;
|
|
140
|
+
end?: string;
|
|
141
|
+
provider?: string;
|
|
142
|
+
model?: string;
|
|
143
|
+
userId?: string;
|
|
144
|
+
organizationId?: string;
|
|
145
|
+
unit?: ModelUsageMetric['unit'];
|
|
146
|
+
modality?: ModelUsageLedgerModality;
|
|
147
|
+
currency?: string;
|
|
148
|
+
pricingStatus?: ModelUsagePricingStatus;
|
|
149
|
+
};
|
|
150
|
+
export type ModelUsageLedgerTotals = {
|
|
151
|
+
modality: ModelUsageLedgerModality;
|
|
152
|
+
unit: ModelUsageMetric['unit'];
|
|
153
|
+
currency?: string | null;
|
|
154
|
+
pricingStatus: ModelUsagePricingStatus;
|
|
155
|
+
quantity: number;
|
|
156
|
+
promptTokens: number;
|
|
157
|
+
completionTokens: number;
|
|
158
|
+
totalTokens: number;
|
|
159
|
+
amount?: number | null;
|
|
160
|
+
settlementCurrency?: string | null;
|
|
161
|
+
settlementAmount?: number | null;
|
|
162
|
+
records: number;
|
|
163
|
+
};
|
|
@@ -4,6 +4,7 @@ import { IXpert, TXpertTeamNodeType } from './xpert.model';
|
|
|
4
4
|
import { IXpertAgent } from './xpert-agent.model';
|
|
5
5
|
import { TSensitiveOperation } from './chat.model';
|
|
6
6
|
import { WorkflowNodeTypeEnum } from './xpert-workflow.model';
|
|
7
|
+
import type { IModelUsageDetails } from './model-usage.model';
|
|
7
8
|
export type TXpertExecution = {
|
|
8
9
|
category?: TXpertTeamNodeType;
|
|
9
10
|
type?: WorkflowNodeTypeEnum | string;
|
|
@@ -68,6 +69,7 @@ export type TXpertAgentExecution = TXpertExecution & {
|
|
|
68
69
|
messages?: StoredMessage[];
|
|
69
70
|
agent?: IXpertAgent;
|
|
70
71
|
totalTokens?: number;
|
|
72
|
+
modelUsages?: IModelUsageDetails[];
|
|
71
73
|
/**
|
|
72
74
|
* Summary of conversation
|
|
73
75
|
*/
|
package/src/ai/xpert.model.d.ts
CHANGED
|
@@ -12,10 +12,11 @@ import { IXpertToolset } from './xpert-toolset.model';
|
|
|
12
12
|
import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
|
|
13
13
|
import { IIntegration } from '../integration.model';
|
|
14
14
|
import { TChatFrom } from './chat.model';
|
|
15
|
-
import { IWorkflowNode, TVariableAssigner,
|
|
15
|
+
import { IWorkflowNode, TVariableAssigner, VariableOperationEnum } from './xpert-workflow.model';
|
|
16
16
|
import { IEnvironment } from './environment.model';
|
|
17
17
|
import { TXpertCommandProfile } from './prompt-workflow.model';
|
|
18
18
|
import type { TXpertMarketplaceProfile } from './xpert-marketplace.model';
|
|
19
|
+
import type { KnowledgeFilterNode } from './knowledge-filter.model';
|
|
19
20
|
export type ToolCall = LToolCall;
|
|
20
21
|
export declare enum XpertTypeEnum {
|
|
21
22
|
/**
|
|
@@ -235,12 +236,26 @@ export interface IXpertPrincipalReference {
|
|
|
235
236
|
tenantName?: string | null;
|
|
236
237
|
workspaceName?: string | null;
|
|
237
238
|
}
|
|
239
|
+
export declare enum XpertWorkbenchInitialLayoutEnum {
|
|
240
|
+
TwoColumns = "two-columns",
|
|
241
|
+
ChatkitMaximized = "chatkit-maximized",
|
|
242
|
+
WorkbenchMaximized = "workbench-maximized"
|
|
243
|
+
}
|
|
244
|
+
export type TXpertWorkbenchOptions = {
|
|
245
|
+
/**
|
|
246
|
+
* Initial layout used before this user has a saved Workbench layout preference.
|
|
247
|
+
*/
|
|
248
|
+
initialLayout?: XpertWorkbenchInitialLayoutEnum;
|
|
249
|
+
/** Public extension view key selected when the Workbench first loads. */
|
|
250
|
+
defaultViewKey?: string;
|
|
251
|
+
};
|
|
238
252
|
export type TXpertOptions = {
|
|
239
253
|
bootstrap?: {
|
|
240
254
|
source: 'template';
|
|
241
255
|
templateKey: string;
|
|
242
256
|
workspaceKind: 'org-default';
|
|
243
257
|
};
|
|
258
|
+
workbench?: TXpertWorkbenchOptions;
|
|
244
259
|
knowledge?: Record<string, {
|
|
245
260
|
position?: IPoint;
|
|
246
261
|
size?: ISize;
|
|
@@ -596,16 +611,13 @@ export type TKBRetrievalSettings = {
|
|
|
596
611
|
entityTopK?: number;
|
|
597
612
|
communityTopK?: number;
|
|
598
613
|
graphWeight?: number;
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
* Parameter fields (tool call) when mode is automatic
|
|
607
|
-
*/
|
|
608
|
-
fields?: Record<string, object>;
|
|
614
|
+
filtering?: {
|
|
615
|
+
/** Mandatory filter owned by the Agent/workflow to knowledgebase binding. */
|
|
616
|
+
fixed?: KnowledgeFilterNode;
|
|
617
|
+
/** Agent-authored filters can only narrow `fixed` filters. */
|
|
618
|
+
agent?: {
|
|
619
|
+
enabled: boolean;
|
|
620
|
+
};
|
|
609
621
|
};
|
|
610
622
|
};
|
|
611
623
|
export declare function isXpertNodeType<T extends TXpertTeamNodeType>(type: T): (node: TXpertTeamNode) => node is NodeOf<T>;
|
package/src/plugin.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export declare const PLUGIN_RESOURCE_INSTALLATION_STATUS: {
|
|
|
61
61
|
readonly BLOCKED: "blocked";
|
|
62
62
|
readonly FAILED: "failed";
|
|
63
63
|
};
|
|
64
|
+
export declare const PLUGIN_RESOURCE_ERROR_CODE: {
|
|
65
|
+
readonly NO_MATCHING_COMPONENTS: "PLUGIN_RESOURCE_NO_MATCHING_COMPONENTS";
|
|
66
|
+
};
|
|
64
67
|
/**
|
|
65
68
|
* Classifies plugin scope and governance.
|
|
66
69
|
* - `system`: built-in/platform-managed plugin that users cannot install/uninstall from org APIs.
|
|
@@ -77,6 +80,7 @@ export type PluginMarketplaceAuthenticationPolicy = (typeof PLUGIN_MARKETPLACE_A
|
|
|
77
80
|
export type PluginMcpToolApprovalMode = (typeof PLUGIN_MCP_TOOL_APPROVAL_MODE)[keyof typeof PLUGIN_MCP_TOOL_APPROVAL_MODE];
|
|
78
81
|
export type PluginResourceRuntimeType = (typeof PLUGIN_RESOURCE_RUNTIME_TYPE)[keyof typeof PLUGIN_RESOURCE_RUNTIME_TYPE];
|
|
79
82
|
export type PluginResourceInstallationStatus = (typeof PLUGIN_RESOURCE_INSTALLATION_STATUS)[keyof typeof PLUGIN_RESOURCE_INSTALLATION_STATUS];
|
|
83
|
+
export type PluginResourceErrorCode = (typeof PLUGIN_RESOURCE_ERROR_CODE)[keyof typeof PLUGIN_RESOURCE_ERROR_CODE];
|
|
80
84
|
export type PluginScopeRelation = 'none' | 'overrides-global' | 'shadowed-by-organization';
|
|
81
85
|
export type PluginTargetApp = 'xpert' | 'data-xpert' | (string & {});
|
|
82
86
|
export type PluginSdkCompatibilityWarningCode = 'plugin-sdk-peer-dependency-missing' | 'plugin-sdk-peer-range-invalid' | 'plugin-sdk-peer-range-incompatible' | 'plugin-sdk-peer-range-spans-major';
|
package/src/tenant.model.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ITenantSetting extends S3FileStorageProviderConfig {
|
|
|
35
35
|
copilotCheckpointRetentionDays?: string | null;
|
|
36
36
|
modelGatewayCallRetentionEnabled?: string | null;
|
|
37
37
|
modelGatewayCallRetentionDays?: string | null;
|
|
38
|
-
|
|
38
|
+
membershipCnyPerPoint?: string | null;
|
|
39
39
|
modelGatewayRequestsPerMinute?: string | null;
|
|
40
40
|
modelGatewayMaxConcurrentRequests?: string | null;
|
|
41
41
|
tenant_title?: string;
|