@xpert-ai/plugin-sdk 3.15.5 → 3.15.7
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 +14 -0
- package/index.cjs.js +53 -0
- package/index.esm.js +49 -1
- package/package.json +2 -2
- package/src/index.d.ts +2 -0
- package/src/lib/artifact-namespace.d.ts +10 -0
- package/src/lib/connector/index.d.ts +4 -0
- package/src/lib/connector/runtime-capability.d.ts +2 -0
- package/src/lib/connector/strategy.decorator.d.ts +2 -0
- package/src/lib/connector/strategy.interface.d.ts +207 -0
- package/src/lib/connector/strategy.registry.d.ts +6 -0
- package/src/lib/workflow/node/strategy.interface.d.ts +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.15.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5e553ae: Add connector strategy contracts and runtime capability helpers for workspace connector plugins.
|
|
8
|
+
|
|
9
|
+
## 3.15.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3249145: plugin artifact namespace
|
|
14
|
+
- Updated dependencies [3249145]
|
|
15
|
+
- @xpert-ai/contracts@3.15.7
|
|
16
|
+
|
|
3
17
|
## 3.15.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -88,6 +88,34 @@ var _axios__namespace = /*#__PURE__*/_interopNamespaceDefault(_axios);
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const ARTIFACT_NAMESPACE_PATTERN = /^[a-z0-9_]+$/;
|
|
92
|
+
function normalizeArtifactSegment(value) {
|
|
93
|
+
return value.trim().replace(/^@[^/]+\//, '').replace(/^plugin[-_]/, '').replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/[^A-Za-z0-9]+/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '').toLowerCase();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Derive the v1 default artifact namespace from an npm package name.
|
|
97
|
+
* Explicit `artifactNamespace` should stay stable after publish; this fallback is for compatibility.
|
|
98
|
+
*/ function derivePluginArtifactNamespace(packageName) {
|
|
99
|
+
const namespace = normalizeArtifactSegment(packageName);
|
|
100
|
+
assertPluginArtifactNamePart(namespace, 'artifact namespace');
|
|
101
|
+
return namespace;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Build the physical table name for a plugin-owned database table.
|
|
105
|
+
* Keep table keys stable; the returned name is part of the plugin data contract.
|
|
106
|
+
*/ function pluginArtifactTableName(namespace, tableKey) {
|
|
107
|
+
const normalizedNamespace = namespace.trim();
|
|
108
|
+
const normalizedTableKey = tableKey.trim();
|
|
109
|
+
assertPluginArtifactNamePart(normalizedNamespace, 'artifact namespace');
|
|
110
|
+
assertPluginArtifactNamePart(normalizedTableKey, 'artifact table key');
|
|
111
|
+
return `plugin_${normalizedNamespace}_${normalizedTableKey}`;
|
|
112
|
+
}
|
|
113
|
+
function assertPluginArtifactNamePart(value, label) {
|
|
114
|
+
if (!value || !ARTIFACT_NAMESPACE_PATTERN.test(value)) {
|
|
115
|
+
throw new Error(`${label} must contain only lowercase letters, numbers, and underscores`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
91
119
|
const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
|
|
92
120
|
const PLUGIN_METADATA_KEY = 'xpert:pluginName';
|
|
93
121
|
const GLOBAL_ORGANIZATION_SCOPE = 'global';
|
|
@@ -3092,6 +3120,26 @@ exports.SSOProviderRegistry = __decorate([
|
|
|
3092
3120
|
])
|
|
3093
3121
|
], exports.SSOProviderRegistry);
|
|
3094
3122
|
|
|
3123
|
+
const ConnectorRuntimeCapability = createRuntimeCapability('platform.connector', {
|
|
3124
|
+
description: 'Resolve workspace connector credentials for agent middleware.'
|
|
3125
|
+
});
|
|
3126
|
+
|
|
3127
|
+
const CONNECTOR_STRATEGY = 'CONNECTOR_STRATEGY';
|
|
3128
|
+
const ConnectorStrategyKey = (provider)=>common.applyDecorators(common.SetMetadata(CONNECTOR_STRATEGY, provider), common.SetMetadata(STRATEGY_META_KEY, CONNECTOR_STRATEGY));
|
|
3129
|
+
|
|
3130
|
+
exports.ConnectorStrategyRegistry = class ConnectorStrategyRegistry extends BaseStrategyRegistry {
|
|
3131
|
+
constructor(discoveryService, reflector){
|
|
3132
|
+
super(CONNECTOR_STRATEGY, discoveryService, reflector);
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
exports.ConnectorStrategyRegistry = __decorate([
|
|
3136
|
+
common.Injectable(),
|
|
3137
|
+
__metadata("design:paramtypes", [
|
|
3138
|
+
core.DiscoveryService,
|
|
3139
|
+
core.Reflector
|
|
3140
|
+
])
|
|
3141
|
+
], exports.ConnectorStrategyRegistry);
|
|
3142
|
+
|
|
3095
3143
|
const SANDBOX_SHELL_TIMEOUT_LIMITS_SEC = {
|
|
3096
3144
|
min: 1,
|
|
3097
3145
|
max: 3600
|
|
@@ -4640,10 +4688,13 @@ exports.BuiltinToolset = BuiltinToolset;
|
|
|
4640
4688
|
exports.CHAT_CHANNEL = CHAT_CHANNEL;
|
|
4641
4689
|
exports.CHAT_CHANNEL_TEXT_LIMITS = CHAT_CHANNEL_TEXT_LIMITS;
|
|
4642
4690
|
exports.CONNECTION_COMMAND_ROUTER_TOKEN = CONNECTION_COMMAND_ROUTER_TOKEN;
|
|
4691
|
+
exports.CONNECTOR_STRATEGY = CONNECTOR_STRATEGY;
|
|
4643
4692
|
exports.CancelConversationCommand = CancelConversationCommand;
|
|
4644
4693
|
exports.ChatChannel = ChatChannel;
|
|
4645
4694
|
exports.ChatOAICompatReasoningModel = ChatOAICompatReasoningModel;
|
|
4646
4695
|
exports.CommonParameterRules = CommonParameterRules;
|
|
4696
|
+
exports.ConnectorRuntimeCapability = ConnectorRuntimeCapability;
|
|
4697
|
+
exports.ConnectorStrategyKey = ConnectorStrategyKey;
|
|
4647
4698
|
exports.CreateModelClientCommand = CreateModelClientCommand;
|
|
4648
4699
|
exports.CredentialsValidateFailedError = CredentialsValidateFailedError;
|
|
4649
4700
|
exports.DATASOURCE_STRATEGY = DATASOURCE_STRATEGY;
|
|
@@ -4762,6 +4813,7 @@ exports.createPluginLogger = createPluginLogger;
|
|
|
4762
4813
|
exports.createRuntimeCapability = createRuntimeCapability;
|
|
4763
4814
|
exports.defineAgentMessageType = defineAgentMessageType;
|
|
4764
4815
|
exports.defineChannelMessageType = defineChannelMessageType;
|
|
4816
|
+
exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
|
|
4765
4817
|
exports.downloadRemoteFile = downloadRemoteFile;
|
|
4766
4818
|
exports.formatSandboxTimeout = formatSandboxTimeout;
|
|
4767
4819
|
exports.getDefaultTenantId = getDefaultTenantId;
|
|
@@ -4784,6 +4836,7 @@ exports.loadYamlFile = loadYamlFile;
|
|
|
4784
4836
|
exports.mergeCredentials = mergeCredentials;
|
|
4785
4837
|
exports.mergeParentChildChunks = mergeParentChildChunks;
|
|
4786
4838
|
exports.normalizeContextSize = normalizeContextSize;
|
|
4839
|
+
exports.pluginArtifactTableName = pluginArtifactTableName;
|
|
4787
4840
|
exports.renderRemoteReactIframeHtml = renderRemoteReactIframeHtml;
|
|
4788
4841
|
exports.resolveSandboxBackend = resolveSandboxBackend;
|
|
4789
4842
|
exports.resolveSandboxExecutionOptions = resolveSandboxExecutionOptions;
|
package/index.esm.js
CHANGED
|
@@ -68,6 +68,34 @@ import { getModelContextSize as getModelContextSize$1 } from '@langchain/core/la
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
const ARTIFACT_NAMESPACE_PATTERN = /^[a-z0-9_]+$/;
|
|
72
|
+
function normalizeArtifactSegment(value) {
|
|
73
|
+
return value.trim().replace(/^@[^/]+\//, '').replace(/^plugin[-_]/, '').replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/[^A-Za-z0-9]+/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '').toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Derive the v1 default artifact namespace from an npm package name.
|
|
77
|
+
* Explicit `artifactNamespace` should stay stable after publish; this fallback is for compatibility.
|
|
78
|
+
*/ function derivePluginArtifactNamespace(packageName) {
|
|
79
|
+
const namespace = normalizeArtifactSegment(packageName);
|
|
80
|
+
assertPluginArtifactNamePart(namespace, 'artifact namespace');
|
|
81
|
+
return namespace;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build the physical table name for a plugin-owned database table.
|
|
85
|
+
* Keep table keys stable; the returned name is part of the plugin data contract.
|
|
86
|
+
*/ function pluginArtifactTableName(namespace, tableKey) {
|
|
87
|
+
const normalizedNamespace = namespace.trim();
|
|
88
|
+
const normalizedTableKey = tableKey.trim();
|
|
89
|
+
assertPluginArtifactNamePart(normalizedNamespace, 'artifact namespace');
|
|
90
|
+
assertPluginArtifactNamePart(normalizedTableKey, 'artifact table key');
|
|
91
|
+
return `plugin_${normalizedNamespace}_${normalizedTableKey}`;
|
|
92
|
+
}
|
|
93
|
+
function assertPluginArtifactNamePart(value, label) {
|
|
94
|
+
if (!value || !ARTIFACT_NAMESPACE_PATTERN.test(value)) {
|
|
95
|
+
throw new Error(`${label} must contain only lowercase letters, numbers, and underscores`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
71
99
|
const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
|
|
72
100
|
const PLUGIN_METADATA_KEY = 'xpert:pluginName';
|
|
73
101
|
const GLOBAL_ORGANIZATION_SCOPE = 'global';
|
|
@@ -3072,6 +3100,26 @@ SSOProviderRegistry = __decorate([
|
|
|
3072
3100
|
])
|
|
3073
3101
|
], SSOProviderRegistry);
|
|
3074
3102
|
|
|
3103
|
+
const ConnectorRuntimeCapability = createRuntimeCapability('platform.connector', {
|
|
3104
|
+
description: 'Resolve workspace connector credentials for agent middleware.'
|
|
3105
|
+
});
|
|
3106
|
+
|
|
3107
|
+
const CONNECTOR_STRATEGY = 'CONNECTOR_STRATEGY';
|
|
3108
|
+
const ConnectorStrategyKey = (provider)=>applyDecorators(SetMetadata(CONNECTOR_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, CONNECTOR_STRATEGY));
|
|
3109
|
+
|
|
3110
|
+
let ConnectorStrategyRegistry = class ConnectorStrategyRegistry extends BaseStrategyRegistry {
|
|
3111
|
+
constructor(discoveryService, reflector){
|
|
3112
|
+
super(CONNECTOR_STRATEGY, discoveryService, reflector);
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
ConnectorStrategyRegistry = __decorate([
|
|
3116
|
+
Injectable(),
|
|
3117
|
+
__metadata("design:paramtypes", [
|
|
3118
|
+
DiscoveryService,
|
|
3119
|
+
Reflector
|
|
3120
|
+
])
|
|
3121
|
+
], ConnectorStrategyRegistry);
|
|
3122
|
+
|
|
3075
3123
|
const SANDBOX_SHELL_TIMEOUT_LIMITS_SEC = {
|
|
3076
3124
|
min: 1,
|
|
3077
3125
|
max: 3600
|
|
@@ -4588,4 +4636,4 @@ function escapeHtmlAttribute(value) {
|
|
|
4588
4636
|
|
|
4589
4637
|
const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
|
|
4590
4638
|
|
|
4591
|
-
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PERMISSION_SERVICE_TOKEN, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CONNECTION_COMMAND_ROUTER_TOKEN, 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, DefaultRuntimeCapabilityRegistry as DefaultAgentMiddlewareRuntimeCapabilityRegistry, DefaultRuntimeCapabilityRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, 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, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, 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, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, 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, WORKSPACE_FILES_SOURCE, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_RUNTIME_CAPABILITIES_TOKEN, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, buildSandboxTimeoutMessage, calcTokenUsage, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, renderRemoteReactIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveTenantGlobalScopeKey, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
|
|
4639
|
+
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PERMISSION_SERVICE_TOKEN, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CommonParameterRules, ConnectorRuntimeCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, 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, DefaultRuntimeCapabilityRegistry as DefaultAgentMiddlewareRuntimeCapabilityRegistry, DefaultRuntimeCapabilityRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, 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, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, 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, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, 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, WORKSPACE_FILES_SOURCE, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_RUNTIME_CAPABILITIES_TOKEN, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, buildSandboxTimeoutMessage, calcTokenUsage, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, renderRemoteReactIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveTenantGlobalScopeKey, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.7",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@langchain/openai": "0.6.9",
|
|
20
|
-
"@xpert-ai/contracts": "3.15.
|
|
20
|
+
"@xpert-ai/contracts": "3.15.7",
|
|
21
21
|
"express": "^4.22.1",
|
|
22
22
|
"js-tiktoken": "^1.0.21"
|
|
23
23
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './lib/plugin';
|
|
2
2
|
export * from './lib/plugin.interface';
|
|
3
3
|
export * from './lib/plugin-metadata';
|
|
4
|
+
export * from './lib/artifact-namespace';
|
|
4
5
|
export * from './lib/types';
|
|
5
6
|
export * from './lib/logger';
|
|
6
7
|
export * from './lib/integration/index';
|
|
@@ -17,6 +18,7 @@ export * from './lib/channel/index';
|
|
|
17
18
|
export * from './lib/file/index';
|
|
18
19
|
export * from './lib/strategy';
|
|
19
20
|
export * from './lib/sso/index';
|
|
21
|
+
export * from './lib/connector/index';
|
|
20
22
|
export * from './lib/sandbox/index';
|
|
21
23
|
export * from './lib/managed-connection/index';
|
|
22
24
|
export * from './lib/managed-queue/index';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive the v1 default artifact namespace from an npm package name.
|
|
3
|
+
* Explicit `artifactNamespace` should stay stable after publish; this fallback is for compatibility.
|
|
4
|
+
*/
|
|
5
|
+
export declare function derivePluginArtifactNamespace(packageName: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Build the physical table name for a plugin-owned database table.
|
|
8
|
+
* Keep table keys stable; the returned name is part of the plugin data contract.
|
|
9
|
+
*/
|
|
10
|
+
export declare function pluginArtifactTableName(namespace: string, tableKey: string): string;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { I18nText, IconDefinition } from '@xpert-ai/contracts';
|
|
2
|
+
export type RuntimeI18nText = I18nText;
|
|
3
|
+
export type RuntimeCapabilityIcon = IconDefinition;
|
|
4
|
+
export type ConnectorStatus = 'pending' | 'active' | 'expired' | 'error' | 'disconnected';
|
|
5
|
+
export type ConnectorOAuthConfig = {
|
|
6
|
+
type: 'oauth2';
|
|
7
|
+
authorizationUrl?: string;
|
|
8
|
+
tokenUrl?: string;
|
|
9
|
+
userInfoUrl?: string;
|
|
10
|
+
scopes?: string[];
|
|
11
|
+
redirectPath?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ConnectorAppCredentialField = {
|
|
14
|
+
name: string;
|
|
15
|
+
label: RuntimeI18nText;
|
|
16
|
+
type?: 'text' | 'password';
|
|
17
|
+
required?: boolean;
|
|
18
|
+
placeholder?: RuntimeI18nText;
|
|
19
|
+
description?: RuntimeI18nText;
|
|
20
|
+
secret?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type ConnectorAppCredentialsConfig = {
|
|
23
|
+
integrationLabel?: RuntimeI18nText;
|
|
24
|
+
noIntegrationLabel?: RuntimeI18nText;
|
|
25
|
+
noIntegrationDescription?: RuntimeI18nText;
|
|
26
|
+
fields?: ConnectorAppCredentialField[];
|
|
27
|
+
help?: {
|
|
28
|
+
label: RuntimeI18nText;
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
defaultValues?: Record<string, string | number | boolean | null>;
|
|
32
|
+
integrationName?: RuntimeI18nText;
|
|
33
|
+
};
|
|
34
|
+
export type ConnectorAppIntegration = {
|
|
35
|
+
id?: string;
|
|
36
|
+
provider: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
description?: string | null;
|
|
39
|
+
options?: unknown;
|
|
40
|
+
};
|
|
41
|
+
export type ConnectorAppIntegrationSelectOption = {
|
|
42
|
+
value: string;
|
|
43
|
+
label: string;
|
|
44
|
+
description?: string | null;
|
|
45
|
+
};
|
|
46
|
+
export type ConnectorPermissionDeclaration = {
|
|
47
|
+
key: string;
|
|
48
|
+
label?: RuntimeI18nText;
|
|
49
|
+
description?: RuntimeI18nText;
|
|
50
|
+
identity?: 'user' | 'app' | 'tenant';
|
|
51
|
+
scopes?: string[];
|
|
52
|
+
credential?: 'access_token' | 'refresh_token' | 'app_credential' | 'api_key';
|
|
53
|
+
storage?: 'platform_vault' | 'runtime_only' | 'external';
|
|
54
|
+
required?: boolean;
|
|
55
|
+
};
|
|
56
|
+
export type ConnectorDefinition = {
|
|
57
|
+
provider: string;
|
|
58
|
+
label: RuntimeI18nText;
|
|
59
|
+
description?: RuntimeI18nText;
|
|
60
|
+
icon?: RuntimeCapabilityIcon;
|
|
61
|
+
auth: ConnectorOAuthConfig;
|
|
62
|
+
permissions?: ConnectorPermissionDeclaration[];
|
|
63
|
+
appIntegrationProvider?: string;
|
|
64
|
+
appIntegrationOptional?: boolean;
|
|
65
|
+
appCredentials?: ConnectorAppCredentialsConfig;
|
|
66
|
+
};
|
|
67
|
+
export type ConnectorProfile = {
|
|
68
|
+
openId?: string;
|
|
69
|
+
unionId?: string;
|
|
70
|
+
userId?: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
avatarUrl?: string;
|
|
73
|
+
email?: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
};
|
|
76
|
+
export type ConnectorInstance = {
|
|
77
|
+
id: string;
|
|
78
|
+
workspaceId: string;
|
|
79
|
+
provider: string;
|
|
80
|
+
status: ConnectorStatus;
|
|
81
|
+
appIntegrationId?: string | null;
|
|
82
|
+
profile?: ConnectorProfile | null;
|
|
83
|
+
scopes?: string[];
|
|
84
|
+
expiresAt?: string | null;
|
|
85
|
+
refreshExpiresAt?: string | null;
|
|
86
|
+
connectedAt?: string | null;
|
|
87
|
+
disconnectedAt?: string | null;
|
|
88
|
+
lastError?: string | null;
|
|
89
|
+
createdById?: string | null;
|
|
90
|
+
updatedById?: string | null;
|
|
91
|
+
createdAt?: string;
|
|
92
|
+
updatedAt?: string;
|
|
93
|
+
};
|
|
94
|
+
export type ConnectorOAuthStartRequest = {
|
|
95
|
+
appIntegrationId?: string;
|
|
96
|
+
app?: ConnectorAppCredentialPayload;
|
|
97
|
+
};
|
|
98
|
+
export type ConnectorOAuthStartResponse = {
|
|
99
|
+
connector: ConnectorInstance;
|
|
100
|
+
authorizationUrl: string;
|
|
101
|
+
stateExpiresAt: string;
|
|
102
|
+
pollIntervalSeconds?: number | null;
|
|
103
|
+
};
|
|
104
|
+
export type ConnectorOAuthStatusResponse = {
|
|
105
|
+
connector: ConnectorInstance;
|
|
106
|
+
authorizationUrl?: string | null;
|
|
107
|
+
stateExpiresAt?: string | null;
|
|
108
|
+
pollIntervalSeconds?: number | null;
|
|
109
|
+
message?: string | null;
|
|
110
|
+
};
|
|
111
|
+
export type ConnectorRuntimeCredential = {
|
|
112
|
+
connectorId: string;
|
|
113
|
+
workspaceId: string;
|
|
114
|
+
provider: string;
|
|
115
|
+
appId: string;
|
|
116
|
+
brand?: string;
|
|
117
|
+
accessToken: string;
|
|
118
|
+
expiresAt?: string | null;
|
|
119
|
+
scopes?: string[];
|
|
120
|
+
profile?: ConnectorProfile | null;
|
|
121
|
+
};
|
|
122
|
+
export type ConnectorRuntimeGetInput = {
|
|
123
|
+
workspaceId: string;
|
|
124
|
+
provider: string;
|
|
125
|
+
connectorId?: string;
|
|
126
|
+
};
|
|
127
|
+
export interface ConnectorRuntimeApi {
|
|
128
|
+
getConnector(input: ConnectorRuntimeGetInput): Promise<ConnectorRuntimeCredential>;
|
|
129
|
+
}
|
|
130
|
+
export type ConnectorSelectOption = {
|
|
131
|
+
value: string;
|
|
132
|
+
label: RuntimeI18nText;
|
|
133
|
+
provider: string;
|
|
134
|
+
status: ConnectorStatus;
|
|
135
|
+
description?: RuntimeI18nText;
|
|
136
|
+
avatarUrl?: string;
|
|
137
|
+
};
|
|
138
|
+
export type ConnectorAppCredentialPayload = Record<string, unknown>;
|
|
139
|
+
export type ConnectorAuthorizationUrlInput = {
|
|
140
|
+
app?: ConnectorAppCredentialPayload;
|
|
141
|
+
redirectUri: string;
|
|
142
|
+
state: string;
|
|
143
|
+
scopes?: string[];
|
|
144
|
+
};
|
|
145
|
+
export type ConnectorAuthorizationUrlResult = {
|
|
146
|
+
authorizationUrl: string;
|
|
147
|
+
scopes?: string[];
|
|
148
|
+
metadata?: Record<string, unknown>;
|
|
149
|
+
pollIntervalSeconds?: number | null;
|
|
150
|
+
};
|
|
151
|
+
export type ConnectorOAuthCodeInput = {
|
|
152
|
+
app?: ConnectorAppCredentialPayload;
|
|
153
|
+
code: string;
|
|
154
|
+
redirectUri: string;
|
|
155
|
+
scopes?: string[];
|
|
156
|
+
};
|
|
157
|
+
export type ConnectorRefreshInput = {
|
|
158
|
+
app?: ConnectorAppCredentialPayload;
|
|
159
|
+
refreshToken: string;
|
|
160
|
+
};
|
|
161
|
+
export type ConnectorOAuthCredential = {
|
|
162
|
+
appId: string;
|
|
163
|
+
brand?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Provider app credentials retained only for encrypted platform storage and token refresh.
|
|
166
|
+
* Hosts must not expose this field through public connector or runtime credential APIs.
|
|
167
|
+
*/
|
|
168
|
+
app?: ConnectorAppCredentialPayload;
|
|
169
|
+
accessToken: string;
|
|
170
|
+
refreshToken?: string;
|
|
171
|
+
expiresAt?: string | null;
|
|
172
|
+
refreshExpiresAt?: string | null;
|
|
173
|
+
scopes?: string[];
|
|
174
|
+
profile?: ConnectorProfile | null;
|
|
175
|
+
};
|
|
176
|
+
export type ConnectorOAuthCompleteRequest = {
|
|
177
|
+
state: string;
|
|
178
|
+
code: string;
|
|
179
|
+
};
|
|
180
|
+
export type ConnectorAuthorizationPollInput = {
|
|
181
|
+
metadata?: Record<string, unknown> | null;
|
|
182
|
+
redirectUri: string;
|
|
183
|
+
scopes?: string[];
|
|
184
|
+
};
|
|
185
|
+
export type ConnectorAuthorizationPollResult = {
|
|
186
|
+
status: 'pending';
|
|
187
|
+
authorizationUrl?: string;
|
|
188
|
+
metadata?: Record<string, unknown>;
|
|
189
|
+
pollIntervalSeconds?: number | null;
|
|
190
|
+
message?: string;
|
|
191
|
+
} | {
|
|
192
|
+
status: 'complete';
|
|
193
|
+
credential: ConnectorOAuthCredential;
|
|
194
|
+
metadata?: Record<string, unknown>;
|
|
195
|
+
} | {
|
|
196
|
+
status: 'error';
|
|
197
|
+
error: string;
|
|
198
|
+
metadata?: Record<string, unknown>;
|
|
199
|
+
};
|
|
200
|
+
export interface ConnectorStrategy {
|
|
201
|
+
definition: ConnectorDefinition;
|
|
202
|
+
isSelectableAppIntegration?(integration: ConnectorAppIntegration): boolean | Promise<boolean>;
|
|
203
|
+
buildAuthorizationUrl(input: ConnectorAuthorizationUrlInput): Promise<ConnectorAuthorizationUrlResult>;
|
|
204
|
+
exchangeOAuthCode(input: ConnectorOAuthCodeInput): Promise<ConnectorOAuthCredential>;
|
|
205
|
+
refreshCredential?(input: ConnectorRefreshInput): Promise<ConnectorOAuthCredential>;
|
|
206
|
+
pollAuthorization?(input: ConnectorAuthorizationPollInput): Promise<ConnectorAuthorizationPollResult>;
|
|
207
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
|
+
import { BaseStrategyRegistry } from '../strategy';
|
|
3
|
+
import type { ConnectorStrategy } from './strategy.interface';
|
|
4
|
+
export declare class ConnectorStrategyRegistry extends BaseStrategyRegistry<ConnectorStrategy> {
|
|
5
|
+
constructor(discoveryService: DiscoveryService, reflector: Reflector);
|
|
6
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Runnable, RunnableToolLike } from '@langchain/core/runnables';
|
|
2
|
-
import { DynamicStructuredTool, StructuredToolInterface } from '@langchain/core/tools';
|
|
3
|
-
import { ToolInputSchemaBase } from '@langchain/core/dist/tools/types';
|
|
2
|
+
import { DynamicStructuredTool, StructuredToolInterface, type ToolSchemaBase } from '@langchain/core/tools';
|
|
4
3
|
import { InteropZodType } from '@langchain/core/utils/types';
|
|
5
4
|
import { BaseChannel } from '@langchain/langgraph';
|
|
6
5
|
import { IEnvironment, IWorkflowNode, TWorkflowNodeMeta, TVariableAssigner, TXpertGraph, TWorkflowVarGroup, TXpertParameter, TXpertTeamNode } from '@xpert-ai/contracts';
|
|
@@ -26,7 +25,7 @@ export type TWorkflowNodeResult = {
|
|
|
26
25
|
title: string;
|
|
27
26
|
id?: string;
|
|
28
27
|
};
|
|
29
|
-
tool?: DynamicStructuredTool<
|
|
28
|
+
tool?: DynamicStructuredTool<ToolSchemaBase, any, any> | StructuredToolInterface<ToolSchemaBase, any, any> | RunnableToolLike<InteropZodType, unknown>;
|
|
30
29
|
variables?: TVariableAssigner[];
|
|
31
30
|
};
|
|
32
31
|
/**
|