@xpert-ai/plugin-sdk 3.9.0-beta.0 → 3.9.0-beta.2
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/CHANGELOG.md +19 -0
- package/index.cjs.js +32 -10
- package/index.esm.js +32 -11
- package/package.json +5 -7
- package/src/lib/agent/handoff/agent-chat.contract.d.ts +1 -1
- package/src/lib/agent/middleware/runtime.d.ts +1 -1
- package/src/lib/agent/middleware/strategy.interface.d.ts +2 -1
- package/src/lib/agent/skill/skill-source-provider.interface.d.ts +1 -1
- package/src/lib/ai-model/abstract-provider.d.ts +1 -1
- package/src/lib/ai-model/ai-model-provider.interface.d.ts +1 -1
- package/src/lib/ai-model/ai-model.d.ts +1 -1
- package/src/lib/ai-model/commands/create-model-client.command.d.ts +1 -1
- package/src/lib/ai-model/entities/defaults.d.ts +1 -1
- package/src/lib/ai-model/llm.d.ts +1 -1
- package/src/lib/ai-model/types/model.d.ts +1 -1
- package/src/lib/ai-model/types/rerank.d.ts +1 -1
- package/src/lib/ai-model/types/text-embedding-model.d.ts +1 -1
- package/src/lib/ai-model/types/tts.d.ts +1 -1
- package/src/lib/ai-model/utils/limits.d.ts +1 -1
- package/src/lib/channel/strategy.interface.d.ts +1 -1
- package/src/lib/core/context/request-context.d.ts +4 -2
- package/src/lib/core/context/request-context.middleware.d.ts +1 -1
- package/src/lib/core/file-system.d.ts +2 -0
- package/src/lib/core/permissions/general.d.ts +1 -1
- package/src/lib/core/permissions/user.d.ts +1 -1
- package/src/lib/data/datasource/types.d.ts +2 -2
- package/src/lib/file/file-storage/provider.interface.d.ts +1 -1
- package/src/lib/file/file-upload/strategy.interface.d.ts +1 -1
- package/src/lib/integration/strategy.interface.d.ts +1 -1
- package/src/lib/rag/image/strategy.interface.d.ts +1 -1
- package/src/lib/rag/knowledge/knowledge-strategy.interface.d.ts +1 -1
- package/src/lib/rag/retriever/strategy.interface.d.ts +1 -1
- package/src/lib/rag/source/strategy.interface.d.ts +1 -1
- package/src/lib/rag/textsplitter/strategy.interface.d.ts +1 -1
- package/src/lib/rag/transformer/strategy.interface.d.ts +1 -1
- package/src/lib/rag/types.d.ts +2 -2
- package/src/lib/sandbox/protocol.d.ts +1 -1
- package/src/lib/sandbox/sandbox.interface.d.ts +1 -1
- package/src/lib/toolset/builtin.d.ts +1 -1
- package/src/lib/toolset/strategy.interface.d.ts +1 -1
- package/src/lib/toolset/toolset.d.ts +1 -1
- package/src/lib/types.d.ts +1 -1
- package/src/lib/view-extension/index.d.ts +1 -0
- package/src/lib/view-extension/provider.interface.d.ts +1 -1
- package/src/lib/view-extension/tokens.d.ts +1 -0
- package/src/lib/workflow/commands/wrap-workflow-node-execution.command.d.ts +1 -1
- package/src/lib/workflow/node/strategy.interface.d.ts +1 -1
- package/src/lib/workflow/trigger/strategy.interface.d.ts +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @xpert-ai/plugin-sdk
|
|
2
|
+
|
|
3
|
+
## 3.9.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updates
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @xpert-ai/contracts@3.9.0-beta.2
|
|
10
|
+
- @xpert-ai/ocap-core@3.9.0-beta.2
|
|
11
|
+
|
|
12
|
+
## 3.9.0-beta.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- beta v
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @xpert-ai/contracts@3.9.0-beta.1
|
|
19
|
+
- @xpert-ai/ocap-core@3.9.0-beta.1
|
package/index.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var constants = require('@nestjs/common/constants');
|
|
|
5
5
|
var lodashEs = require('lodash-es');
|
|
6
6
|
var core = require('@nestjs/core');
|
|
7
7
|
var rxjs = require('rxjs');
|
|
8
|
-
var contracts = require('@
|
|
8
|
+
var contracts = require('@xpert-ai/contracts');
|
|
9
9
|
var node_async_hooks = require('node:async_hooks');
|
|
10
10
|
var passportJwt = require('passport-jwt');
|
|
11
11
|
var jsonwebtoken = require('jsonwebtoken');
|
|
@@ -148,6 +148,15 @@ class RequestContext {
|
|
|
148
148
|
const session = getRequestContext();
|
|
149
149
|
return session;
|
|
150
150
|
}
|
|
151
|
+
static currentApiKey() {
|
|
152
|
+
var _RequestContext_currentApiPrincipal;
|
|
153
|
+
var _RequestContext_currentApiPrincipal_apiKey;
|
|
154
|
+
return (_RequestContext_currentApiPrincipal_apiKey = (_RequestContext_currentApiPrincipal = RequestContext.currentApiPrincipal()) == null ? void 0 : _RequestContext_currentApiPrincipal.apiKey) != null ? _RequestContext_currentApiPrincipal_apiKey : null;
|
|
155
|
+
}
|
|
156
|
+
static currentApiPrincipal() {
|
|
157
|
+
const user = RequestContext.currentUser();
|
|
158
|
+
return (user == null ? void 0 : user.apiKey) ? user : null;
|
|
159
|
+
}
|
|
151
160
|
static currentRequest() {
|
|
152
161
|
const requestContext = RequestContext.currentRequestContext();
|
|
153
162
|
if (requestContext) {
|
|
@@ -155,11 +164,6 @@ class RequestContext {
|
|
|
155
164
|
}
|
|
156
165
|
return null;
|
|
157
166
|
}
|
|
158
|
-
static currentApiKey() {
|
|
159
|
-
const user = RequestContext.currentUser();
|
|
160
|
-
var _user_apiKey;
|
|
161
|
-
return (_user_apiKey = user == null ? void 0 : user.apiKey) != null ? _user_apiKey : null;
|
|
162
|
-
}
|
|
163
167
|
static currentTenantId() {
|
|
164
168
|
const user = RequestContext.currentUser();
|
|
165
169
|
if (user) {
|
|
@@ -971,8 +975,7 @@ BuiltinToolset.provider = '';
|
|
|
971
975
|
* @param filePath Relative file path
|
|
972
976
|
* @returns Web URL of file
|
|
973
977
|
*/ fullUrl(filePath) {
|
|
974
|
-
|
|
975
|
-
return url.href;
|
|
978
|
+
return this.buildUrl(filePath);
|
|
976
979
|
}
|
|
977
980
|
/**
|
|
978
981
|
* Read file contents
|
|
@@ -992,8 +995,7 @@ BuiltinToolset.provider = '';
|
|
|
992
995
|
recursive: true
|
|
993
996
|
});
|
|
994
997
|
await fsPromises.writeFile(fullPath, content);
|
|
995
|
-
|
|
996
|
-
return url.href;
|
|
998
|
+
return this.buildUrl(filePath);
|
|
997
999
|
}
|
|
998
1000
|
/**
|
|
999
1001
|
* Delete a file
|
|
@@ -1019,6 +1021,23 @@ BuiltinToolset.provider = '';
|
|
|
1019
1021
|
return false;
|
|
1020
1022
|
}
|
|
1021
1023
|
}
|
|
1024
|
+
// Keep URL generation tolerant of protocol-relative base URLs like "//localhost:3000",
|
|
1025
|
+
// which are used by the current dev config and would otherwise make `new URL()` throw.
|
|
1026
|
+
buildUrl(filePath) {
|
|
1027
|
+
if (/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(filePath) || filePath.startsWith('//')) {
|
|
1028
|
+
return filePath;
|
|
1029
|
+
}
|
|
1030
|
+
const normalizedPath = this.encodePath(`${filePath}`.replace(/^\/+/, ''));
|
|
1031
|
+
const normalizedBaseUrl = `${this.baseUrl}`.replace(/\/+$/, '');
|
|
1032
|
+
if (normalizedBaseUrl.startsWith('//')) {
|
|
1033
|
+
return `${normalizedBaseUrl}/${normalizedPath}`;
|
|
1034
|
+
}
|
|
1035
|
+
const url = new URL(normalizedPath, `${normalizedBaseUrl}/`);
|
|
1036
|
+
return url.href;
|
|
1037
|
+
}
|
|
1038
|
+
encodePath(filePath) {
|
|
1039
|
+
return filePath.split('/').map((segment)=>encodeURIComponent(segment)).join('/');
|
|
1040
|
+
}
|
|
1022
1041
|
constructor(permission, basePath, baseUrl){
|
|
1023
1042
|
this.basePath = basePath;
|
|
1024
1043
|
this.baseUrl = baseUrl;
|
|
@@ -3871,6 +3890,8 @@ exports.ViewExtensionProviderRegistry = __decorate([
|
|
|
3871
3890
|
])
|
|
3872
3891
|
], exports.ViewExtensionProviderRegistry);
|
|
3873
3892
|
|
|
3893
|
+
const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
|
|
3894
|
+
|
|
3874
3895
|
exports.AGENT_CHAT_DISPATCH_MESSAGE_TYPE = AGENT_CHAT_DISPATCH_MESSAGE_TYPE;
|
|
3875
3896
|
exports.AGENT_MIDDLEWARE_STRATEGY = AGENT_MIDDLEWARE_STRATEGY;
|
|
3876
3897
|
exports.AIModelProviderNotFoundException = AIModelProviderNotFoundException;
|
|
@@ -3966,6 +3987,7 @@ exports.TextToSpeechModel = TextToSpeechModel;
|
|
|
3966
3987
|
exports.ToolsetStrategy = ToolsetStrategy;
|
|
3967
3988
|
exports.USER_PERMISSION_SERVICE_TOKEN = USER_PERMISSION_SERVICE_TOKEN;
|
|
3968
3989
|
exports.VECTOR_STORE_STRATEGY = VECTOR_STORE_STRATEGY;
|
|
3990
|
+
exports.VIEW_EXTENSION_CACHE_SERVICE_TOKEN = VIEW_EXTENSION_CACHE_SERVICE_TOKEN;
|
|
3969
3991
|
exports.VIEW_EXTENSION_PROVIDER = VIEW_EXTENSION_PROVIDER;
|
|
3970
3992
|
exports.VectorStoreStrategy = VectorStoreStrategy;
|
|
3971
3993
|
exports.ViewExtensionProvider = ViewExtensionProvider;
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { MODULE_METADATA } from '@nestjs/common/constants';
|
|
|
3
3
|
import { pick } from 'lodash-es';
|
|
4
4
|
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
5
5
|
import { Subject, filter } from 'rxjs';
|
|
6
|
-
import { LanguagesEnum, AiModelTypeEnum, ParameterType, PriceType, FetchFrom, ModelFeature, ModelPropertyKey } from '@
|
|
6
|
+
import { LanguagesEnum, AiModelTypeEnum, ParameterType, PriceType, FetchFrom, ModelFeature, ModelPropertyKey } from '@xpert-ai/contracts';
|
|
7
7
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
8
8
|
import { ExtractJwt } from 'passport-jwt';
|
|
9
9
|
import { verify, JsonWebTokenError } from 'jsonwebtoken';
|
|
@@ -127,6 +127,15 @@ class RequestContext {
|
|
|
127
127
|
const session = getRequestContext();
|
|
128
128
|
return session;
|
|
129
129
|
}
|
|
130
|
+
static currentApiKey() {
|
|
131
|
+
var _RequestContext_currentApiPrincipal;
|
|
132
|
+
var _RequestContext_currentApiPrincipal_apiKey;
|
|
133
|
+
return (_RequestContext_currentApiPrincipal_apiKey = (_RequestContext_currentApiPrincipal = RequestContext.currentApiPrincipal()) == null ? void 0 : _RequestContext_currentApiPrincipal.apiKey) != null ? _RequestContext_currentApiPrincipal_apiKey : null;
|
|
134
|
+
}
|
|
135
|
+
static currentApiPrincipal() {
|
|
136
|
+
const user = RequestContext.currentUser();
|
|
137
|
+
return (user == null ? void 0 : user.apiKey) ? user : null;
|
|
138
|
+
}
|
|
130
139
|
static currentRequest() {
|
|
131
140
|
const requestContext = RequestContext.currentRequestContext();
|
|
132
141
|
if (requestContext) {
|
|
@@ -134,11 +143,6 @@ class RequestContext {
|
|
|
134
143
|
}
|
|
135
144
|
return null;
|
|
136
145
|
}
|
|
137
|
-
static currentApiKey() {
|
|
138
|
-
const user = RequestContext.currentUser();
|
|
139
|
-
var _user_apiKey;
|
|
140
|
-
return (_user_apiKey = user == null ? void 0 : user.apiKey) != null ? _user_apiKey : null;
|
|
141
|
-
}
|
|
142
146
|
static currentTenantId() {
|
|
143
147
|
const user = RequestContext.currentUser();
|
|
144
148
|
if (user) {
|
|
@@ -950,8 +954,7 @@ BuiltinToolset.provider = '';
|
|
|
950
954
|
* @param filePath Relative file path
|
|
951
955
|
* @returns Web URL of file
|
|
952
956
|
*/ fullUrl(filePath) {
|
|
953
|
-
|
|
954
|
-
return url.href;
|
|
957
|
+
return this.buildUrl(filePath);
|
|
955
958
|
}
|
|
956
959
|
/**
|
|
957
960
|
* Read file contents
|
|
@@ -971,8 +974,7 @@ BuiltinToolset.provider = '';
|
|
|
971
974
|
recursive: true
|
|
972
975
|
});
|
|
973
976
|
await fsPromises.writeFile(fullPath, content);
|
|
974
|
-
|
|
975
|
-
return url.href;
|
|
977
|
+
return this.buildUrl(filePath);
|
|
976
978
|
}
|
|
977
979
|
/**
|
|
978
980
|
* Delete a file
|
|
@@ -998,6 +1000,23 @@ BuiltinToolset.provider = '';
|
|
|
998
1000
|
return false;
|
|
999
1001
|
}
|
|
1000
1002
|
}
|
|
1003
|
+
// Keep URL generation tolerant of protocol-relative base URLs like "//localhost:3000",
|
|
1004
|
+
// which are used by the current dev config and would otherwise make `new URL()` throw.
|
|
1005
|
+
buildUrl(filePath) {
|
|
1006
|
+
if (/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(filePath) || filePath.startsWith('//')) {
|
|
1007
|
+
return filePath;
|
|
1008
|
+
}
|
|
1009
|
+
const normalizedPath = this.encodePath(`${filePath}`.replace(/^\/+/, ''));
|
|
1010
|
+
const normalizedBaseUrl = `${this.baseUrl}`.replace(/\/+$/, '');
|
|
1011
|
+
if (normalizedBaseUrl.startsWith('//')) {
|
|
1012
|
+
return `${normalizedBaseUrl}/${normalizedPath}`;
|
|
1013
|
+
}
|
|
1014
|
+
const url = new URL(normalizedPath, `${normalizedBaseUrl}/`);
|
|
1015
|
+
return url.href;
|
|
1016
|
+
}
|
|
1017
|
+
encodePath(filePath) {
|
|
1018
|
+
return filePath.split('/').map((segment)=>encodeURIComponent(segment)).join('/');
|
|
1019
|
+
}
|
|
1001
1020
|
constructor(permission, basePath, baseUrl){
|
|
1002
1021
|
this.basePath = basePath;
|
|
1003
1022
|
this.baseUrl = baseUrl;
|
|
@@ -3850,4 +3869,6 @@ ViewExtensionProviderRegistry = __decorate([
|
|
|
3850
3869
|
])
|
|
3851
3870
|
], ViewExtensionProviderRegistry);
|
|
3852
3871
|
|
|
3853
|
-
|
|
3872
|
+
const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
|
|
3873
|
+
|
|
3874
|
+
export { AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PERMISSION_SERVICE_TOKEN, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CommonParameterRules, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SKILL_SOURCE_PROVIDER, STRATEGY_META_KEY, SandboxProviderRegistry, SandboxProviderStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WrapWorkflowNodeExecutionCommand, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, buildSandboxTimeoutMessage, calcTokenUsage, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, defineAgentMessageType, defineChannelMessageType, downloadRemoteFile, formatSandboxTimeout, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, isRemoteFile, isSandboxBackend, isStructuredMessageType, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, resolveSandboxBackend, resolveSandboxExecutionOptions, runWithRequestContext, secondsToMilliseconds, sumTokenUsage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,15 +12,16 @@
|
|
|
12
12
|
"main": "./index.cjs.js",
|
|
13
13
|
"module": "./index.esm.js",
|
|
14
14
|
"publishConfig": {
|
|
15
|
-
"access": "public"
|
|
15
|
+
"access": "public",
|
|
16
|
+
"directory": "dist"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"js-tiktoken": "^1.0.21"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"@langchain/core": "*",
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
23
|
+
"@xpert-ai/contracts": "workspace:*",
|
|
24
|
+
"@xpert-ai/ocap-core": "workspace:*",
|
|
24
25
|
"@nestjs/common": "*",
|
|
25
26
|
"@nestjs/core": "*",
|
|
26
27
|
"@nestjs/cqrs": "*",
|
|
@@ -30,11 +31,8 @@
|
|
|
30
31
|
"i18next": "*",
|
|
31
32
|
"json-schema": "*",
|
|
32
33
|
"jsonwebtoken": "*",
|
|
33
|
-
"fs": "*",
|
|
34
|
-
"path": "*",
|
|
35
34
|
"passport-jwt": "*",
|
|
36
35
|
"rxjs": "*",
|
|
37
|
-
"stream": "*",
|
|
38
36
|
"yaml": "*",
|
|
39
37
|
"zod": "*"
|
|
40
38
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TChatOptions, TChatRequest } from '@
|
|
1
|
+
import { TChatOptions, TChatRequest } from '@xpert-ai/contracts';
|
|
2
2
|
export declare const AGENT_CHAT_DISPATCH_MESSAGE_TYPE: import("./message-type").StructuredHandoffMessageType;
|
|
3
3
|
export interface AgentChatCallbackTarget {
|
|
4
4
|
messageType: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Runtime as LangGraphRuntime } from "@langchain/langgraph";
|
|
2
2
|
import type { BaseMessage } from "@langchain/core/messages";
|
|
3
|
-
import { TSandboxConfigurable } from "@
|
|
3
|
+
import { TSandboxConfigurable } from "@xpert-ai/contracts";
|
|
4
4
|
/**
|
|
5
5
|
* Type for the agent's built-in state properties.
|
|
6
6
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IWFNMiddleware, TAgentMiddlewareMeta } from '@
|
|
1
|
+
import { IWFNMiddleware, TAgentMiddlewareMeta, TXpertFeatures } from '@xpert-ai/contracts';
|
|
2
2
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
3
3
|
import { RunnableToolLike } from '@langchain/core/runnables';
|
|
4
4
|
import { AgentMiddleware } from './types';
|
|
@@ -10,6 +10,7 @@ export interface IAgentMiddlewareContext {
|
|
|
10
10
|
projectId?: string;
|
|
11
11
|
conversationId?: string;
|
|
12
12
|
xpertId?: string;
|
|
13
|
+
xpertFeatures?: TXpertFeatures | null;
|
|
13
14
|
agentKey?: string;
|
|
14
15
|
node: IWFNMiddleware;
|
|
15
16
|
tools: Map<string, StructuredToolInterface | RunnableToolLike>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISkillRepository, ISkillRepositoryIndex, TSkillSourceMeta } from '@
|
|
1
|
+
import { ISkillRepository, ISkillRepositoryIndex, TSkillSourceMeta } from '@xpert-ai/contracts';
|
|
2
2
|
export interface ISkillSourceProvider {
|
|
3
3
|
type: string;
|
|
4
4
|
meta: TSkillSourceMeta;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
2
2
|
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
3
3
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
4
|
-
import { AIModelEntity, AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel } from '@
|
|
4
|
+
import { AIModelEntity, AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel } from '@xpert-ai/contracts';
|
|
5
5
|
import { Logger } from '@nestjs/common';
|
|
6
6
|
import { AIModel } from './ai-model';
|
|
7
7
|
import { IAIModelProviderStrategy } from './ai-model-provider.interface';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity } from '@
|
|
1
|
+
import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity } from '@xpert-ai/contracts';
|
|
2
2
|
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
3
3
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
4
4
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import { AIModelEntity, AiModelTypeEnum, ICopilotModel, ParameterRule, PriceInfo, PriceType } from '@
|
|
2
|
+
import { AIModelEntity, AiModelTypeEnum, ICopilotModel, ParameterRule, PriceInfo, PriceType } from '@xpert-ai/contracts';
|
|
3
3
|
import { Logger } from '@nestjs/common';
|
|
4
4
|
import { ModelProvider } from './abstract-provider';
|
|
5
5
|
import { IAIModel, TChatModelOptions } from './types/model';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
2
2
|
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
3
3
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
4
|
-
import { ICopilotModel, ILLMUsage } from '@
|
|
4
|
+
import { ICopilotModel, ILLMUsage } from '@xpert-ai/contracts';
|
|
5
5
|
import { Command } from '@nestjs/cqrs';
|
|
6
6
|
import { IRerank } from '../types';
|
|
7
7
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIModelEntity, ICopilot, ILLMUsage, ParameterRule, TTokenUsage } from '@
|
|
1
|
+
import { AIModelEntity, ICopilot, ILLMUsage, ParameterRule, TTokenUsage } from '@xpert-ai/contracts';
|
|
2
2
|
import { Logger } from '@nestjs/common';
|
|
3
3
|
import { LLMResult } from '@langchain/core/outputs';
|
|
4
4
|
import { AIModel } from './ai-model';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
2
|
-
import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ParameterType, PriceInfo, PriceType } from "@
|
|
2
|
+
import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ParameterType, PriceInfo, PriceType } from "@xpert-ai/contracts";
|
|
3
3
|
export type TChatModelOptions = {
|
|
4
4
|
modelProperties: Record<string, any>;
|
|
5
5
|
handleLLMTokens: (input: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from '@langchain/core/documents';
|
|
2
|
-
import { ICopilotModel } from '@
|
|
2
|
+
import { ICopilotModel } from '@xpert-ai/contracts';
|
|
3
3
|
import { AIModel } from '../ai-model';
|
|
4
4
|
import { TChatModelOptions } from './model';
|
|
5
5
|
export type RerankResult = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
2
|
-
import { ICopilotModel } from '@
|
|
2
|
+
import { ICopilotModel } from '@xpert-ai/contracts';
|
|
3
3
|
import { AIModel } from '../ai-model';
|
|
4
4
|
import { TChatModelOptions } from './model';
|
|
5
5
|
export declare abstract class TextEmbeddingModelManager extends AIModel {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParameterRule } from '@
|
|
1
|
+
import { ParameterRule } from '@xpert-ai/contracts';
|
|
2
2
|
import { AIModel } from '../ai-model';
|
|
3
3
|
export declare abstract class TextToSpeechModel extends AIModel {
|
|
4
4
|
getParameterRules(model: string, credentials: Record<string, string>): ParameterRule[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BaseLanguageModel } from "@langchain/core/language_models/base";
|
|
2
|
-
import { ICopilotModel } from "@
|
|
2
|
+
import { ICopilotModel } from "@xpert-ai/contracts";
|
|
3
3
|
export declare function getModelContextSize(input: BaseLanguageModel | ICopilotModel): number | undefined;
|
|
4
4
|
export declare function normalizeContextSize(value: unknown): number | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IApiKey, IRequestScopeContext, IUser, LanguagesEnum, PermissionsEnum, RolesEnum } from '@
|
|
1
|
+
import { IApiKey, IRequestScopeContext, IUser, LanguagesEnum, PermissionsEnum, RolesEnum } from '@xpert-ai/contracts';
|
|
2
|
+
import type { IApiPrincipal } from '@xpert-ai/contracts';
|
|
2
3
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
3
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
5
|
export declare class RequestContext {
|
|
@@ -9,8 +10,9 @@ export declare class RequestContext {
|
|
|
9
10
|
readonly extras: Record<string, any>;
|
|
10
11
|
constructor(request: IncomingMessage, response: ServerResponse, reqId: string, userId?: string, extras?: Record<string, any>);
|
|
11
12
|
static currentRequestContext(): RequestContext;
|
|
12
|
-
static currentRequest(): IncomingMessage;
|
|
13
13
|
static currentApiKey(): IApiKey | null;
|
|
14
|
+
static currentApiPrincipal(): IApiPrincipal | null;
|
|
15
|
+
static currentRequest(): IncomingMessage;
|
|
14
16
|
static currentTenantId(): string;
|
|
15
17
|
static currentUserId(): string;
|
|
16
18
|
static currentRoleId(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUser } from '@
|
|
1
|
+
import { IUser } from '@xpert-ai/contracts';
|
|
2
2
|
import { NestMiddleware } from '@nestjs/common';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
4
|
export declare class RequestContextMiddleware implements NestMiddleware {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _axios from 'axios';
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
|
-
import { IColumnDef, IDSSchema, IDSTable } from '@
|
|
4
|
-
export { IColumnDef, IDSSchema, IDSTable } from '@
|
|
3
|
+
import { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
4
|
+
export { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
5
5
|
/**
|
|
6
6
|
* The base options for DB adapters
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileStorageOption, FileSystem, UploadedFile } from '@
|
|
1
|
+
import { FileStorageOption, FileSystem, UploadedFile } from '@xpert-ai/contracts';
|
|
2
2
|
export interface IFileStorageProvider {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly config?: FileSystem & Record<string, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFileAssetDestination, IFileAssetSource, IStorageFile, IUploadFileTarget } from '@
|
|
1
|
+
import { IFileAssetDestination, IFileAssetSource, IStorageFile, IUploadFileTarget } from '@xpert-ai/contracts';
|
|
2
2
|
export type TFileUploadRequestContext = {
|
|
3
3
|
tenantId?: string;
|
|
4
4
|
organizationId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
2
2
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
3
|
-
import { IDocumentUnderstandingProvider, IKnowledgeDocument } from '@
|
|
3
|
+
import { IDocumentUnderstandingProvider, IKnowledgeDocument } from '@xpert-ai/contracts';
|
|
4
4
|
import { Permissions, XpFileSystem } from '../../core/index';
|
|
5
5
|
import { ChunkMetadata } from '../types';
|
|
6
6
|
export type TImageUnderstandingConfig = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VectorStore } from '@langchain/core/vectorstores';
|
|
2
|
-
import { I18nObject } from '@
|
|
2
|
+
import { I18nObject } from '@xpert-ai/contracts';
|
|
3
3
|
import { Document } from '@langchain/core/documents';
|
|
4
4
|
export type TRetrieverConfig = {
|
|
5
5
|
vectorStore: VectorStore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDocumentSourceProvider, IIntegration } from '@
|
|
1
|
+
import { IDocumentSourceProvider, IIntegration } from '@xpert-ai/contracts';
|
|
2
2
|
import { Document } from '@langchain/core/documents';
|
|
3
3
|
import { Permissions } from '../../core';
|
|
4
4
|
export interface IDocumentSourceStrategy<TConfig = any> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDocumentChunkerProvider, KnowledgeStructureEnum } from '@
|
|
1
|
+
import { IDocumentChunkerProvider, KnowledgeStructureEnum } from '@xpert-ai/contracts';
|
|
2
2
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
3
3
|
import { ChunkMetadata } from '../types';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDocumentProcessorProvider, IIntegration, IKnowledgeDocument } from '@
|
|
1
|
+
import { IDocumentProcessorProvider, IIntegration, IKnowledgeDocument } from '@xpert-ai/contracts';
|
|
2
2
|
import { Permissions, XpFileSystem } from '../../core/index';
|
|
3
3
|
import { ChunkMetadata } from '../types';
|
|
4
4
|
export type TDocumentTransformerConfig = {
|
package/src/lib/rag/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
2
|
-
import { IDocChunkMetadata } from '@
|
|
3
|
-
export { TDocumentAsset } from '@
|
|
2
|
+
import { IDocChunkMetadata } from '@xpert-ai/contracts';
|
|
3
|
+
export { TDocumentAsset } from '@xpert-ai/contracts';
|
|
4
4
|
export interface ChunkMetadata extends IDocChunkMetadata {
|
|
5
5
|
startOffset?: number;
|
|
6
6
|
endOffset?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBackendProtocol, TSandboxConfigurable } from '@
|
|
1
|
+
import { IBackendProtocol, TSandboxConfigurable } from '@xpert-ai/contracts';
|
|
2
2
|
import type { SandboxExecutionOptions } from './execution';
|
|
3
3
|
/**
|
|
4
4
|
* Protocol definition for pluggable memory backends.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructuredToolInterface } from '@langchain/core/tools';
|
|
2
2
|
import { BaseStore } from '@langchain/langgraph';
|
|
3
|
-
import { I18nObject, IXpertToolset, ToolProviderCredentials, TToolCredentials, TToolsetParams, XpertToolsetCategoryEnum } from '@
|
|
3
|
+
import { I18nObject, IXpertToolset, ToolProviderCredentials, TToolCredentials, TToolsetParams, XpertToolsetCategoryEnum } from '@xpert-ai/contracts';
|
|
4
4
|
import { Logger } from '@nestjs/common';
|
|
5
5
|
import { CommandBus, QueryBus } from '@nestjs/cqrs';
|
|
6
6
|
import { BaseToolset } from './toolset';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
|
-
import { I18nObject, IconDefinition } from '@
|
|
2
|
+
import { I18nObject, IconDefinition } from '@xpert-ai/contracts';
|
|
3
3
|
import { ZodSchema } from 'zod';
|
|
4
4
|
import { BuiltinToolset } from './builtin';
|
|
5
5
|
export interface IToolsetStrategy<TConfig = any> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseToolkit, StructuredTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
2
|
-
import { I18nObject, TStateVariable, TToolsetParams } from "@
|
|
2
|
+
import { I18nObject, TStateVariable, TToolsetParams } from "@xpert-ai/contracts";
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
|
5
5
|
/**
|
package/src/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchemaObjectType, PluginMeta } from '@
|
|
1
|
+
import { JsonSchemaObjectType, PluginMeta } from '@xpert-ai/contracts';
|
|
2
2
|
import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
4
|
import type { ZodSchema } from 'zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewActionResult, XpertViewDataResult, XpertViewQuery } from '@
|
|
1
|
+
import { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewActionResult, XpertViewDataResult, XpertViewQuery } from '@xpert-ai/contracts';
|
|
2
2
|
export interface IXpertViewExtensionProvider {
|
|
3
3
|
supports(context: XpertResolvedViewHostContext): Promise<boolean> | boolean;
|
|
4
4
|
getViewManifests(context: XpertResolvedViewHostContext, slot: string): Promise<XpertExtensionViewManifest[]> | XpertExtensionViewManifest[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = "XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Runnable } from '@langchain/core/runnables';
|
|
2
2
|
import { BaseChannel } from '@langchain/langgraph';
|
|
3
|
-
import { IEnvironment, IWorkflowNode, TWorkflowNodeMeta, TXpertGraph, TWorkflowVarGroup, TXpertParameter, TXpertTeamNode } from '@
|
|
3
|
+
import { IEnvironment, IWorkflowNode, TWorkflowNodeMeta, TXpertGraph, TWorkflowVarGroup, TXpertParameter, TXpertTeamNode } from '@xpert-ai/contracts';
|
|
4
4
|
import { PromiseOrValue } from '../../types';
|
|
5
5
|
export type TWorkflowNodeParams<TConfig = any> = {
|
|
6
6
|
xpertId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TWorkflowTriggerMeta, TXpertTeamNode } from '@
|
|
1
|
+
import { TWorkflowTriggerMeta, TXpertTeamNode } from '@xpert-ai/contracts';
|
|
2
2
|
export type TWorkflowTriggerBootstrapMode = 'replay_publish' | 'skip';
|
|
3
3
|
export type TWorkflowTriggerBootstrapConfig = {
|
|
4
4
|
mode: TWorkflowTriggerBootstrapMode;
|