@xpert-ai/plugin-sdk 3.17.3 → 3.17.5
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 +61 -4
- package/index.esm.js +54 -5
- package/model-provider-toolset.cjs.js +1 -1
- package/model-provider-toolset.esm.js +1 -1
- package/model-provider.cjs.js +15 -3
- package/model-provider.esm.js +13 -1
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +13 -0
- package/src/lib/mcp/app.d.ts +19 -0
- package/src/lib/mcp/completion.d.ts +11 -0
- package/src/lib/mcp/events.d.ts +10 -0
- package/src/lib/mcp/index.d.ts +8 -0
- package/src/lib/mcp/prompt.d.ts +45 -0
- package/src/lib/mcp/resource-template.d.ts +21 -0
- package/src/lib/mcp/resource.d.ts +23 -0
- package/src/lib/mcp/runtime.d.ts +23 -0
- package/src/lib/mcp/task.d.ts +24 -0
- package/src/lib/strategy.d.ts +1 -0
- package/src/lib/toolset/builtin.d.ts +11 -1
- package/src/lib/toolset/define-tool.d.ts +33 -0
- package/src/lib/toolset/index.d.ts +3 -0
- package/src/lib/toolset/strategy.interface.d.ts +1 -1
- package/src/lib/toolset/tool-execution-context.d.ts +56 -0
- package/src/lib/toolset/tool-result.d.ts +23 -0
- package/src/lib/toolset/toolset.d.ts +1 -1
- package/src/lib/types.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.17.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9e59e41: Add stable tenant- and organization-scoped MCP publication, capability, authentication, execution context, tool result, resource, prompt, app, task, and change-event contracts for the Xpert MCP publishing platform.
|
|
8
|
+
|
|
9
|
+
Keep plugin schema contracts on the Zod v3 compatibility API while allowing consumers to install Zod 3.25 or Zod 4.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [9e59e41]
|
|
12
|
+
- @xpert-ai/contracts@3.17.5
|
|
13
|
+
|
|
14
|
+
## 3.17.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 7b6954a: project
|
|
19
|
+
- Updated dependencies [7b6954a]
|
|
20
|
+
- @xpert-ai/contracts@3.17.4
|
|
21
|
+
|
|
3
22
|
## 3.17.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -37,7 +37,7 @@ var base$1 = require('@langchain/core/language_models/base');
|
|
|
37
37
|
var connector = require('./connector.cjs.js');
|
|
38
38
|
var collaborationClient = require('./collaboration-client.cjs.js');
|
|
39
39
|
require('@langchain/core/tools');
|
|
40
|
-
require('zod');
|
|
40
|
+
require('zod/v3');
|
|
41
41
|
|
|
42
42
|
function _interopNamespaceDefault(e) {
|
|
43
43
|
var n = Object.create(null);
|
|
@@ -125,6 +125,7 @@ function assertPluginArtifactNamePart(value, label) {
|
|
|
125
125
|
|
|
126
126
|
const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
|
|
127
127
|
const PLUGIN_METADATA_KEY = 'xpert:pluginName';
|
|
128
|
+
const PLUGIN_VERSION_METADATA_KEY = 'xpert:pluginVersion';
|
|
128
129
|
const GLOBAL_ORGANIZATION_SCOPE = 'global';
|
|
129
130
|
const SYSTEM_GLOBAL_SCOPE = 'system:global';
|
|
130
131
|
const BUILTIN_GLOBAL_SCOPE = 'builtin:global';
|
|
@@ -591,12 +592,16 @@ class BaseStrategyRegistry {
|
|
|
591
592
|
scopeKey: (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE
|
|
592
593
|
};
|
|
593
594
|
}
|
|
595
|
+
const pluginVersion = this.reflector.get(PLUGIN_VERSION_METADATA_KEY, target);
|
|
594
596
|
var _this_reflector_get1;
|
|
595
|
-
return {
|
|
597
|
+
return _extends._extends({
|
|
596
598
|
kind: 'plugin',
|
|
597
|
-
pluginName
|
|
599
|
+
pluginName
|
|
600
|
+
}, pluginVersion ? {
|
|
601
|
+
pluginVersion
|
|
602
|
+
} : {}, {
|
|
598
603
|
scopeKey: (_this_reflector_get1 = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get1 : GLOBAL_ORGANIZATION_SCOPE
|
|
599
|
-
};
|
|
604
|
+
});
|
|
600
605
|
}
|
|
601
606
|
/**
|
|
602
607
|
* Remove all strategies registered by the given plugin for the given scope.
|
|
@@ -967,6 +972,10 @@ exports.ToolsetRegistry = __decorate([
|
|
|
967
972
|
])
|
|
968
973
|
], exports.ToolsetRegistry);
|
|
969
974
|
|
|
975
|
+
function defineXpertTool(definition) {
|
|
976
|
+
return Object.freeze(definition);
|
|
977
|
+
}
|
|
978
|
+
|
|
970
979
|
/**
|
|
971
980
|
* Restricted FileSystem based on granted permissions
|
|
972
981
|
*/ class XpFileSystem {
|
|
@@ -5752,6 +5761,46 @@ const EvolutionRuntimeCapability = modelProvider.createRuntimeCapability('platfo
|
|
|
5752
5761
|
description: 'Ingest learning signals and resolve immutable capability versions for domain runtimes.'
|
|
5753
5762
|
});
|
|
5754
5763
|
|
|
5764
|
+
function defineMcpApp(definition) {
|
|
5765
|
+
return Object.freeze(definition);
|
|
5766
|
+
}
|
|
5767
|
+
|
|
5768
|
+
const MCP_CAPABILITY_CHANGE_EVENT_TYPES = [
|
|
5769
|
+
'tools.changed',
|
|
5770
|
+
'resources.changed',
|
|
5771
|
+
'resource.updated',
|
|
5772
|
+
'prompts.changed',
|
|
5773
|
+
'task.updated'
|
|
5774
|
+
];
|
|
5775
|
+
|
|
5776
|
+
function defineMcpPrompt(definition) {
|
|
5777
|
+
return Object.freeze(definition);
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
function defineMcpResource(definition) {
|
|
5781
|
+
return Object.freeze(definition);
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
function defineMcpResourceTemplate(definition) {
|
|
5785
|
+
return Object.freeze(definition);
|
|
5786
|
+
}
|
|
5787
|
+
|
|
5788
|
+
function defineMcpCapabilities(definitions) {
|
|
5789
|
+
return Object.freeze({
|
|
5790
|
+
instructions: definitions.instructions,
|
|
5791
|
+
tools: freezeItems(definitions.tools),
|
|
5792
|
+
resources: freezeItems(definitions.resources),
|
|
5793
|
+
resourceTemplates: freezeItems(definitions.resourceTemplates),
|
|
5794
|
+
prompts: freezeItems(definitions.prompts),
|
|
5795
|
+
apps: freezeItems(definitions.apps)
|
|
5796
|
+
});
|
|
5797
|
+
}
|
|
5798
|
+
function freezeItems(items) {
|
|
5799
|
+
return items ? Object.freeze([
|
|
5800
|
+
...items
|
|
5801
|
+
]) : undefined;
|
|
5802
|
+
}
|
|
5803
|
+
|
|
5755
5804
|
Object.defineProperty(exports, "ASSISTANT_CHAT_SEND_MESSAGE_COMMAND", {
|
|
5756
5805
|
enumerable: true,
|
|
5757
5806
|
get: function () { return contracts.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND; }
|
|
@@ -5871,6 +5920,7 @@ exports.LargeLanguageModel = LargeLanguageModel;
|
|
|
5871
5920
|
exports.MANAGED_CONNECTION_REGISTRY_TOKEN = MANAGED_CONNECTION_REGISTRY_TOKEN;
|
|
5872
5921
|
exports.MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN = MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN;
|
|
5873
5922
|
exports.MANAGED_QUEUE_SERVICE_TOKEN = MANAGED_QUEUE_SERVICE_TOKEN;
|
|
5923
|
+
exports.MCP_CAPABILITY_CHANGE_EVENT_TYPES = MCP_CAPABILITY_CHANGE_EVENT_TYPES;
|
|
5874
5924
|
exports.MODEL_OUTPUT_VALIDATION_ERROR_CODE = MODEL_OUTPUT_VALIDATION_ERROR_CODE;
|
|
5875
5925
|
exports.ModelOutputValidationError = ModelOutputValidationError;
|
|
5876
5926
|
exports.ORGANIZATION_METADATA_KEY = ORGANIZATION_METADATA_KEY;
|
|
@@ -5880,6 +5930,7 @@ exports.PLUGIN_CONFIG_RESOLVER_TOKEN = PLUGIN_CONFIG_RESOLVER_TOKEN;
|
|
|
5880
5930
|
exports.PLUGIN_JOB_PROCESSOR_METADATA = PLUGIN_JOB_PROCESSOR_METADATA;
|
|
5881
5931
|
exports.PLUGIN_METADATA = PLUGIN_METADATA;
|
|
5882
5932
|
exports.PLUGIN_METADATA_KEY = PLUGIN_METADATA_KEY;
|
|
5933
|
+
exports.PLUGIN_VERSION_METADATA_KEY = PLUGIN_VERSION_METADATA_KEY;
|
|
5883
5934
|
exports.PLUGIN_WEBHOOK_AUTH_METADATA_KEY = PLUGIN_WEBHOOK_AUTH_METADATA_KEY;
|
|
5884
5935
|
exports.PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN = PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN;
|
|
5885
5936
|
exports.PROVIDE_AI_MODEL_LLM = PROVIDE_AI_MODEL_LLM;
|
|
@@ -5952,6 +6003,12 @@ exports.createI18nInstance = createI18nInstance;
|
|
|
5952
6003
|
exports.createPluginLogger = createPluginLogger;
|
|
5953
6004
|
exports.defineAgentMessageType = defineAgentMessageType;
|
|
5954
6005
|
exports.defineChannelMessageType = defineChannelMessageType;
|
|
6006
|
+
exports.defineMcpApp = defineMcpApp;
|
|
6007
|
+
exports.defineMcpCapabilities = defineMcpCapabilities;
|
|
6008
|
+
exports.defineMcpPrompt = defineMcpPrompt;
|
|
6009
|
+
exports.defineMcpResource = defineMcpResource;
|
|
6010
|
+
exports.defineMcpResourceTemplate = defineMcpResourceTemplate;
|
|
6011
|
+
exports.defineXpertTool = defineXpertTool;
|
|
5955
6012
|
exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
|
|
5956
6013
|
exports.downloadRemoteFile = downloadRemoteFile;
|
|
5957
6014
|
exports.formatSandboxTimeout = formatSandboxTimeout;
|
package/index.esm.js
CHANGED
|
@@ -41,7 +41,7 @@ import { assertConnectorDefinition } from './connector.esm.js';
|
|
|
41
41
|
export { getConnectorAuthMethods } from './connector.esm.js';
|
|
42
42
|
export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
|
|
43
43
|
import '@langchain/core/tools';
|
|
44
|
-
import 'zod';
|
|
44
|
+
import 'zod/v3';
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Metadata keys used in plugins for defining various aspects like entities, subscribers, and configurations.
|
|
@@ -107,6 +107,7 @@ function assertPluginArtifactNamePart(value, label) {
|
|
|
107
107
|
|
|
108
108
|
const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
|
|
109
109
|
const PLUGIN_METADATA_KEY = 'xpert:pluginName';
|
|
110
|
+
const PLUGIN_VERSION_METADATA_KEY = 'xpert:pluginVersion';
|
|
110
111
|
const GLOBAL_ORGANIZATION_SCOPE = 'global';
|
|
111
112
|
const SYSTEM_GLOBAL_SCOPE = 'system:global';
|
|
112
113
|
const BUILTIN_GLOBAL_SCOPE = 'builtin:global';
|
|
@@ -573,12 +574,16 @@ class BaseStrategyRegistry {
|
|
|
573
574
|
scopeKey: (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE
|
|
574
575
|
};
|
|
575
576
|
}
|
|
577
|
+
const pluginVersion = this.reflector.get(PLUGIN_VERSION_METADATA_KEY, target);
|
|
576
578
|
var _this_reflector_get1;
|
|
577
|
-
return {
|
|
579
|
+
return _extends({
|
|
578
580
|
kind: 'plugin',
|
|
579
|
-
pluginName
|
|
581
|
+
pluginName
|
|
582
|
+
}, pluginVersion ? {
|
|
583
|
+
pluginVersion
|
|
584
|
+
} : {}, {
|
|
580
585
|
scopeKey: (_this_reflector_get1 = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get1 : GLOBAL_ORGANIZATION_SCOPE
|
|
581
|
-
};
|
|
586
|
+
});
|
|
582
587
|
}
|
|
583
588
|
/**
|
|
584
589
|
* Remove all strategies registered by the given plugin for the given scope.
|
|
@@ -949,6 +954,10 @@ ToolsetRegistry = __decorate([
|
|
|
949
954
|
])
|
|
950
955
|
], ToolsetRegistry);
|
|
951
956
|
|
|
957
|
+
function defineXpertTool(definition) {
|
|
958
|
+
return Object.freeze(definition);
|
|
959
|
+
}
|
|
960
|
+
|
|
952
961
|
/**
|
|
953
962
|
* Restricted FileSystem based on granted permissions
|
|
954
963
|
*/ class XpFileSystem {
|
|
@@ -5734,4 +5743,44 @@ const EvolutionRuntimeCapability = createRuntimeCapability('platform.agent-evolu
|
|
|
5734
5743
|
description: 'Ingest learning signals and resolve immutable capability versions for domain runtimes.'
|
|
5735
5744
|
});
|
|
5736
5745
|
|
|
5737
|
-
|
|
5746
|
+
function defineMcpApp(definition) {
|
|
5747
|
+
return Object.freeze(definition);
|
|
5748
|
+
}
|
|
5749
|
+
|
|
5750
|
+
const MCP_CAPABILITY_CHANGE_EVENT_TYPES = [
|
|
5751
|
+
'tools.changed',
|
|
5752
|
+
'resources.changed',
|
|
5753
|
+
'resource.updated',
|
|
5754
|
+
'prompts.changed',
|
|
5755
|
+
'task.updated'
|
|
5756
|
+
];
|
|
5757
|
+
|
|
5758
|
+
function defineMcpPrompt(definition) {
|
|
5759
|
+
return Object.freeze(definition);
|
|
5760
|
+
}
|
|
5761
|
+
|
|
5762
|
+
function defineMcpResource(definition) {
|
|
5763
|
+
return Object.freeze(definition);
|
|
5764
|
+
}
|
|
5765
|
+
|
|
5766
|
+
function defineMcpResourceTemplate(definition) {
|
|
5767
|
+
return Object.freeze(definition);
|
|
5768
|
+
}
|
|
5769
|
+
|
|
5770
|
+
function defineMcpCapabilities(definitions) {
|
|
5771
|
+
return Object.freeze({
|
|
5772
|
+
instructions: definitions.instructions,
|
|
5773
|
+
tools: freezeItems(definitions.tools),
|
|
5774
|
+
resources: freezeItems(definitions.resources),
|
|
5775
|
+
resourceTemplates: freezeItems(definitions.resourceTemplates),
|
|
5776
|
+
prompts: freezeItems(definitions.prompts),
|
|
5777
|
+
apps: freezeItems(definitions.apps)
|
|
5778
|
+
});
|
|
5779
|
+
}
|
|
5780
|
+
function freezeItems(items) {
|
|
5781
|
+
return items ? Object.freeze([
|
|
5782
|
+
...items
|
|
5783
|
+
]) : undefined;
|
|
5784
|
+
}
|
|
5785
|
+
|
|
5786
|
+
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, 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, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, 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, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_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_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, 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, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, 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, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
|
package/model-provider.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ var contracts = require('@xpert-ai/contracts');
|
|
|
4
4
|
var _extends = require('./_extends.cjs.js');
|
|
5
5
|
var common = require('@nestjs/common');
|
|
6
6
|
var tools = require('@langchain/core/tools');
|
|
7
|
-
var
|
|
7
|
+
var v3 = require('zod/v3');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Base ability for all toolsets
|
|
@@ -45,8 +45,8 @@ var zod = require('zod');
|
|
|
45
45
|
class BaseTool extends tools.StructuredTool {
|
|
46
46
|
constructor(...args){
|
|
47
47
|
super(...args);
|
|
48
|
-
this.schema =
|
|
49
|
-
input:
|
|
48
|
+
this.schema = v3.z.object({
|
|
49
|
+
input: v3.z.string().optional()
|
|
50
50
|
}).transform((obj)=>obj.input);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -98,6 +98,17 @@ class BuiltinToolset extends BaseToolset {
|
|
|
98
98
|
var _this_toolset;
|
|
99
99
|
return (_this_toolset = this.toolset) == null ? void 0 : _this_toolset.credentials;
|
|
100
100
|
}
|
|
101
|
+
getMcpCapabilityDefinitions() {
|
|
102
|
+
return this.mcpCapabilities;
|
|
103
|
+
}
|
|
104
|
+
getMcpCapabilitySource() {
|
|
105
|
+
var _this_params, _this_params1;
|
|
106
|
+
return _extends._extends({}, ((_this_params = this.params) == null ? void 0 : _this_params.pluginName) ? {
|
|
107
|
+
pluginName: this.params.pluginName
|
|
108
|
+
} : {}, ((_this_params1 = this.params) == null ? void 0 : _this_params1.pluginVersion) ? {
|
|
109
|
+
pluginVersion: this.params.pluginVersion
|
|
110
|
+
} : {});
|
|
111
|
+
}
|
|
101
112
|
getToolTitle(name) {
|
|
102
113
|
var _this_toolset_tools, _this_toolset, _tool_schema;
|
|
103
114
|
const tool = (_this_toolset = this.toolset) == null ? void 0 : (_this_toolset_tools = _this_toolset.tools) == null ? void 0 : _this_toolset_tools.find((tool)=>tool.name === name);
|
|
@@ -128,6 +139,7 @@ class BuiltinToolset extends BaseToolset {
|
|
|
128
139
|
constructor(providerName, toolset, params){
|
|
129
140
|
super(params);
|
|
130
141
|
this.logger = new common.Logger(this.constructor.name);
|
|
142
|
+
this.mcpCapabilities = {};
|
|
131
143
|
this.providerName = providerName;
|
|
132
144
|
this.toolset = toolset;
|
|
133
145
|
this.params = params;
|
package/model-provider.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AiModelTypeEnum } from '@xpert-ai/contracts';
|
|
|
2
2
|
import { _ as _extends } from './_extends.esm.js';
|
|
3
3
|
import { Logger } from '@nestjs/common';
|
|
4
4
|
import { BaseToolkit, StructuredTool } from '@langchain/core/tools';
|
|
5
|
-
import { z } from 'zod';
|
|
5
|
+
import { z } from 'zod/v3';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Base ability for all toolsets
|
|
@@ -96,6 +96,17 @@ class BuiltinToolset extends BaseToolset {
|
|
|
96
96
|
var _this_toolset;
|
|
97
97
|
return (_this_toolset = this.toolset) == null ? void 0 : _this_toolset.credentials;
|
|
98
98
|
}
|
|
99
|
+
getMcpCapabilityDefinitions() {
|
|
100
|
+
return this.mcpCapabilities;
|
|
101
|
+
}
|
|
102
|
+
getMcpCapabilitySource() {
|
|
103
|
+
var _this_params, _this_params1;
|
|
104
|
+
return _extends({}, ((_this_params = this.params) == null ? void 0 : _this_params.pluginName) ? {
|
|
105
|
+
pluginName: this.params.pluginName
|
|
106
|
+
} : {}, ((_this_params1 = this.params) == null ? void 0 : _this_params1.pluginVersion) ? {
|
|
107
|
+
pluginVersion: this.params.pluginVersion
|
|
108
|
+
} : {});
|
|
109
|
+
}
|
|
99
110
|
getToolTitle(name) {
|
|
100
111
|
var _this_toolset_tools, _this_toolset, _tool_schema;
|
|
101
112
|
const tool = (_this_toolset = this.toolset) == null ? void 0 : (_this_toolset_tools = _this_toolset.tools) == null ? void 0 : _this_toolset_tools.find((tool)=>tool.name === name);
|
|
@@ -126,6 +137,7 @@ class BuiltinToolset extends BaseToolset {
|
|
|
126
137
|
constructor(providerName, toolset, params){
|
|
127
138
|
super(params);
|
|
128
139
|
this.logger = new Logger(this.constructor.name);
|
|
140
|
+
this.mcpCapabilities = {};
|
|
129
141
|
this.providerName = providerName;
|
|
130
142
|
this.toolset = toolset;
|
|
131
143
|
this.params = params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.5",
|
|
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.17.
|
|
20
|
+
"@xpert-ai/contracts": "3.17.5",
|
|
21
21
|
"express": "^4.22.1",
|
|
22
22
|
"js-tiktoken": "^1.0.21"
|
|
23
23
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"passport-jwt": "*",
|
|
36
36
|
"rxjs": "*",
|
|
37
37
|
"yaml": "*",
|
|
38
|
-
"zod": "
|
|
38
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
41
41
|
"./package.json": "./package.json",
|
package/src/index.d.ts
CHANGED
|
@@ -12,6 +12,17 @@ export type AgentMiddlewareAssistantTaskFile = {
|
|
|
12
12
|
size?: number;
|
|
13
13
|
role?: string;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Stable plugin skill reference used by Assistant Tasks.
|
|
17
|
+
*
|
|
18
|
+
* Plugin-owned callers must not persist workspace-local SkillPackage UUIDs.
|
|
19
|
+
* The host resolves this portable identity to the installed package and verifies
|
|
20
|
+
* that the target Agent is directly connected to the owning Skills Middleware.
|
|
21
|
+
*/
|
|
22
|
+
export type AgentMiddlewareAssistantTaskSkillRef = {
|
|
23
|
+
pluginName: string;
|
|
24
|
+
componentKey: string;
|
|
25
|
+
};
|
|
15
26
|
export type AgentMiddlewareAssistantTaskInput = {
|
|
16
27
|
xpertId: string;
|
|
17
28
|
agentKey?: string;
|
|
@@ -22,6 +33,8 @@ export type AgentMiddlewareAssistantTaskInput = {
|
|
|
22
33
|
clientMessageId?: string;
|
|
23
34
|
prompt: string;
|
|
24
35
|
files?: AgentMiddlewareAssistantTaskFile[];
|
|
36
|
+
/** Skills that this task is expected to load through its target Agent's Skills Middleware. */
|
|
37
|
+
selectedSkillRefs?: AgentMiddlewareAssistantTaskSkillRef[];
|
|
25
38
|
/** Additional bounded human-input fields exposed to runtime-state fixed filters. */
|
|
26
39
|
humanInput?: Record<string, JSONValue>;
|
|
27
40
|
context?: Record<string, unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface McpAppCsp {
|
|
2
|
+
connectDomains?: string[];
|
|
3
|
+
resourceDomains?: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface McpAppPermissions {
|
|
6
|
+
clipboardWrite?: boolean;
|
|
7
|
+
camera?: boolean;
|
|
8
|
+
microphone?: boolean;
|
|
9
|
+
geolocation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface McpAppDefinition {
|
|
12
|
+
key: string;
|
|
13
|
+
entry: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
csp?: McpAppCsp;
|
|
17
|
+
permissions?: McpAppPermissions;
|
|
18
|
+
}
|
|
19
|
+
export declare function defineMcpApp(definition: McpAppDefinition): Readonly<McpAppDefinition>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolExecutionContext } from '../toolset/tool-execution-context';
|
|
2
|
+
export interface McpCompletionRequest {
|
|
3
|
+
argument: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface McpCompletionResult {
|
|
7
|
+
values: string[];
|
|
8
|
+
total?: number;
|
|
9
|
+
hasMore?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type McpCompletionHandler = (request: McpCompletionRequest, context: ToolExecutionContext) => McpCompletionResult | Promise<McpCompletionResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const MCP_CAPABILITY_CHANGE_EVENT_TYPES: readonly ["tools.changed", "resources.changed", "resource.updated", "prompts.changed", "task.updated"];
|
|
2
|
+
export type CapabilityChangeEventType = (typeof MCP_CAPABILITY_CHANGE_EVENT_TYPES)[number];
|
|
3
|
+
export interface CapabilityChangeEvent {
|
|
4
|
+
type: CapabilityChangeEventType;
|
|
5
|
+
key?: string;
|
|
6
|
+
taskId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolEventsApi {
|
|
9
|
+
emit(event: CapabilityChangeEvent): Promise<void> | void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { McpRequiredContext } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ToolExecutionContext } from '../toolset/tool-execution-context';
|
|
3
|
+
import type { McpCompletionHandler } from './completion';
|
|
4
|
+
export interface McpPromptArgument {
|
|
5
|
+
required: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export type McpPromptContent = {
|
|
9
|
+
type: 'text';
|
|
10
|
+
text: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'image';
|
|
13
|
+
data: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'audio';
|
|
17
|
+
data: string;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'resource';
|
|
21
|
+
uri: string;
|
|
22
|
+
mimeType?: string;
|
|
23
|
+
text?: string;
|
|
24
|
+
blob?: string;
|
|
25
|
+
};
|
|
26
|
+
export interface McpPromptMessage {
|
|
27
|
+
role: 'user' | 'assistant';
|
|
28
|
+
content: McpPromptContent;
|
|
29
|
+
}
|
|
30
|
+
export interface McpPromptResult {
|
|
31
|
+
description?: string;
|
|
32
|
+
messages: McpPromptMessage[];
|
|
33
|
+
}
|
|
34
|
+
export interface McpPromptDefinition {
|
|
35
|
+
key: string;
|
|
36
|
+
name: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
arguments?: Record<string, McpPromptArgument>;
|
|
40
|
+
requiredContext?: McpRequiredContext[];
|
|
41
|
+
supportsCompletion?: boolean;
|
|
42
|
+
get(arguments_: Record<string, string>, context: ToolExecutionContext): McpPromptResult | Promise<McpPromptResult>;
|
|
43
|
+
complete?: McpCompletionHandler;
|
|
44
|
+
}
|
|
45
|
+
export declare function defineMcpPrompt(definition: McpPromptDefinition): Readonly<McpPromptDefinition>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { McpRequiredContext } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ToolExecutionContext } from '../toolset/tool-execution-context';
|
|
3
|
+
import type { McpCompletionHandler } from './completion';
|
|
4
|
+
import type { McpResourceReadResult } from './resource';
|
|
5
|
+
export interface McpResourceTemplateArgument {
|
|
6
|
+
required: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface McpResourceTemplateDefinition {
|
|
10
|
+
key: string;
|
|
11
|
+
uriTemplate: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
mimeType?: string;
|
|
15
|
+
arguments: Record<string, McpResourceTemplateArgument>;
|
|
16
|
+
requiredContext?: McpRequiredContext[];
|
|
17
|
+
cacheTtlMs?: number;
|
|
18
|
+
read(arguments_: Record<string, string>, context: ToolExecutionContext): McpResourceReadResult | Promise<McpResourceReadResult>;
|
|
19
|
+
complete?: McpCompletionHandler;
|
|
20
|
+
}
|
|
21
|
+
export declare function defineMcpResourceTemplate(definition: McpResourceTemplateDefinition): Readonly<McpResourceTemplateDefinition>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSONValue, McpRequiredContext } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ToolExecutionContext } from '../toolset/tool-execution-context';
|
|
3
|
+
export interface McpResourceContent {
|
|
4
|
+
uri: string;
|
|
5
|
+
mimeType?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
blob?: string;
|
|
8
|
+
meta?: Record<string, JSONValue>;
|
|
9
|
+
}
|
|
10
|
+
export interface McpResourceReadResult {
|
|
11
|
+
contents: McpResourceContent[];
|
|
12
|
+
}
|
|
13
|
+
export interface McpResourceDefinition {
|
|
14
|
+
key: string;
|
|
15
|
+
uri: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
requiredContext?: McpRequiredContext[];
|
|
20
|
+
cacheTtlMs?: number;
|
|
21
|
+
read(context: ToolExecutionContext): McpResourceReadResult | Promise<McpResourceReadResult>;
|
|
22
|
+
}
|
|
23
|
+
export declare function defineMcpResource(definition: McpResourceDefinition): Readonly<McpResourceDefinition>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { McpAppDefinition } from './app';
|
|
2
|
+
import type { McpPromptDefinition } from './prompt';
|
|
3
|
+
import type { McpResourceDefinition } from './resource';
|
|
4
|
+
import type { McpResourceTemplateDefinition } from './resource-template';
|
|
5
|
+
import type { AnyXpertToolDefinition } from '../toolset/define-tool';
|
|
6
|
+
export interface McpCapabilityDefinitions {
|
|
7
|
+
/** Lower-priority server guidance merged after platform and Publication instructions. */
|
|
8
|
+
instructions?: string;
|
|
9
|
+
tools?: readonly AnyXpertToolDefinition[];
|
|
10
|
+
resources?: readonly McpResourceDefinition[];
|
|
11
|
+
resourceTemplates?: readonly McpResourceTemplateDefinition[];
|
|
12
|
+
prompts?: readonly McpPromptDefinition[];
|
|
13
|
+
apps?: readonly McpAppDefinition[];
|
|
14
|
+
}
|
|
15
|
+
/** Implemented by toolsets that provide host-executed MCP capabilities in addition to tools. */
|
|
16
|
+
export interface McpCapabilityRuntimeProvider {
|
|
17
|
+
getMcpCapabilityDefinitions(): Readonly<McpCapabilityDefinitions>;
|
|
18
|
+
getMcpCapabilitySource?(): {
|
|
19
|
+
pluginName?: string;
|
|
20
|
+
pluginVersion?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function defineMcpCapabilities(definitions: McpCapabilityDefinitions): Readonly<McpCapabilityDefinitions>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
|
+
export interface McpTaskExecutionPolicy {
|
|
3
|
+
mode: 'optional' | 'required';
|
|
4
|
+
maxLifetimeMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolTaskCreateRequest {
|
|
7
|
+
capabilityKey: string;
|
|
8
|
+
requestId: string;
|
|
9
|
+
idempotencyKey: string;
|
|
10
|
+
input?: JSONValue;
|
|
11
|
+
expiresAt?: Date | string;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolTaskHandle {
|
|
14
|
+
taskId: string;
|
|
15
|
+
status: 'working' | 'input_required' | 'completed' | 'failed' | 'cancelled';
|
|
16
|
+
}
|
|
17
|
+
export interface ToolTasksApi {
|
|
18
|
+
create(request: ToolTaskCreateRequest): Promise<ToolTaskHandle>;
|
|
19
|
+
update(taskId: string, patch: {
|
|
20
|
+
progress?: number;
|
|
21
|
+
status?: ToolTaskHandle['status'];
|
|
22
|
+
}): Promise<ToolTaskHandle>;
|
|
23
|
+
cancel(taskId: string): Promise<ToolTaskHandle>;
|
|
24
|
+
}
|
package/src/lib/strategy.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { CommandBus, QueryBus } from '@nestjs/cqrs';
|
|
|
6
6
|
import { BaseToolset } from './toolset';
|
|
7
7
|
import type { AgentMiddlewareModelProviderConnection, AgentMiddlewareRuntimeApi } from '../agent/middleware/runtime';
|
|
8
8
|
import type { ManagedQueueService } from '../managed-queue';
|
|
9
|
+
import type { McpCapabilityDefinitions, McpCapabilityRuntimeProvider } from '../mcp';
|
|
9
10
|
/**
|
|
10
11
|
* The context params of creating toolset
|
|
11
12
|
*/
|
|
@@ -36,11 +37,14 @@ export type TBuiltinToolsetParams = TToolsetParams & {
|
|
|
36
37
|
managedQueue?: ManagedQueueService;
|
|
37
38
|
/** Installation scope used to route jobs back to this plugin instance. */
|
|
38
39
|
pluginScopeKey?: string;
|
|
40
|
+
/** Package provenance used to resolve plugin-owned MCP App bundles. */
|
|
41
|
+
pluginName?: string;
|
|
42
|
+
pluginVersion?: string;
|
|
39
43
|
};
|
|
40
44
|
export interface IBuiltinToolset {
|
|
41
45
|
validateCredentials(credentials: TToolCredentials): Promise<void>;
|
|
42
46
|
}
|
|
43
|
-
export declare abstract class BuiltinToolset<T extends StructuredToolInterface = StructuredToolInterface, C = TToolCredentials> extends BaseToolset<T> implements IBuiltinToolset {
|
|
47
|
+
export declare abstract class BuiltinToolset<T extends StructuredToolInterface = StructuredToolInterface, C = TToolCredentials> extends BaseToolset<T> implements IBuiltinToolset, McpCapabilityRuntimeProvider {
|
|
44
48
|
providerName: string;
|
|
45
49
|
protected toolset?: IXpertToolset;
|
|
46
50
|
protected params?: TBuiltinToolsetParams;
|
|
@@ -50,6 +54,7 @@ export declare abstract class BuiltinToolset<T extends StructuredToolInterface =
|
|
|
50
54
|
credentialsSchema?: {
|
|
51
55
|
[key: string]: ToolProviderCredentials;
|
|
52
56
|
};
|
|
57
|
+
protected mcpCapabilities: McpCapabilityDefinitions;
|
|
53
58
|
get tenantId(): string;
|
|
54
59
|
get organizationId(): string;
|
|
55
60
|
get commandBus(): CommandBus<import("@nestjs/cqrs").ICommand>;
|
|
@@ -63,6 +68,11 @@ export declare abstract class BuiltinToolset<T extends StructuredToolInterface =
|
|
|
63
68
|
_validateCredentials(credentials: C): Promise<void>;
|
|
64
69
|
getId(): string;
|
|
65
70
|
getCredentials(): C;
|
|
71
|
+
getMcpCapabilityDefinitions(): Readonly<McpCapabilityDefinitions>;
|
|
72
|
+
getMcpCapabilitySource(): {
|
|
73
|
+
pluginVersion?: string;
|
|
74
|
+
pluginName?: string;
|
|
75
|
+
};
|
|
66
76
|
getToolTitle(name: string): string | I18nObject;
|
|
67
77
|
/**
|
|
68
78
|
* Get credentials schema
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { McpRequiredContext, McpToolBehavior } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ZodTypeAny, infer as ZodInfer } from 'zod/v3';
|
|
3
|
+
import type { McpTaskExecutionPolicy } from '../mcp/task';
|
|
4
|
+
import type { ToolExecutionContext } from './tool-execution-context';
|
|
5
|
+
import type { XpertToolResult } from './tool-result';
|
|
6
|
+
export type XpertToolVisibility = 'model' | 'app';
|
|
7
|
+
export interface XpertToolExposure {
|
|
8
|
+
mcp: {
|
|
9
|
+
eligible: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface XpertToolAppBinding {
|
|
13
|
+
resourceKey: string;
|
|
14
|
+
}
|
|
15
|
+
type StructuredOutput<TSchema extends ZodTypeAny | undefined> = TSchema extends ZodTypeAny ? ZodInfer<TSchema> : unknown;
|
|
16
|
+
export interface XpertToolDefinition<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny | undefined = undefined> {
|
|
17
|
+
name: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: TInputSchema;
|
|
21
|
+
outputSchema?: TOutputSchema;
|
|
22
|
+
exposure: XpertToolExposure;
|
|
23
|
+
behavior: McpToolBehavior;
|
|
24
|
+
requiredContext: McpRequiredContext[];
|
|
25
|
+
visibility?: XpertToolVisibility[];
|
|
26
|
+
app?: XpertToolAppBinding;
|
|
27
|
+
task?: McpTaskExecutionPolicy;
|
|
28
|
+
execute(input: ZodInfer<TInputSchema>, context: ToolExecutionContext): XpertToolResult<StructuredOutput<TOutputSchema>> | Promise<XpertToolResult<StructuredOutput<TOutputSchema>>>;
|
|
29
|
+
}
|
|
30
|
+
/** Runtime-erased form used when a toolset exposes heterogeneous declared tools. */
|
|
31
|
+
export type AnyXpertToolDefinition = XpertToolDefinition<ZodTypeAny, ZodTypeAny | undefined>;
|
|
32
|
+
export declare function defineXpertTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny | undefined = undefined>(definition: XpertToolDefinition<TInputSchema, TOutputSchema>): Readonly<XpertToolDefinition<TInputSchema, TOutputSchema>>;
|
|
33
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
2
|
import { I18nObject, IconDefinition } from '@xpert-ai/contracts';
|
|
3
|
-
import { ZodSchema } from 'zod';
|
|
3
|
+
import type { ZodSchema } from 'zod/v3';
|
|
4
4
|
import { BuiltinToolset, TBuiltinToolsetParams } from './builtin';
|
|
5
5
|
import type { VideoGenerationToolsetCapability } from '../core/permissions/video-generation';
|
|
6
6
|
export interface IToolsetStrategy<TConfig = any> {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { JSONValue, McpJsonSchema } from '@xpert-ai/contracts';
|
|
2
|
+
import type { AgentMiddlewareRuntimeApi } from '../agent/middleware/runtime';
|
|
3
|
+
import type { WorkspaceFilesApi } from '../runtime/capabilities/workspace-files';
|
|
4
|
+
import type { CapabilityChangeEvent, ToolEventsApi } from '../mcp/events';
|
|
5
|
+
import type { ToolTasksApi } from '../mcp/task';
|
|
6
|
+
export type ToolExecutionSource = 'agent' | 'mcp' | 'workflow' | 'api';
|
|
7
|
+
export interface ToolPrincipal {
|
|
8
|
+
type: 'user' | 'service_account';
|
|
9
|
+
id: string;
|
|
10
|
+
userId?: string;
|
|
11
|
+
clientId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolCredentialsApi {
|
|
14
|
+
get<TValue extends JSONValue = JSONValue>(key: string): Promise<TValue | null>;
|
|
15
|
+
}
|
|
16
|
+
export type ToolModelsApi = Pick<AgentMiddlewareRuntimeApi, 'createModelClient' | 'getModelProvider'>;
|
|
17
|
+
export interface ToolInputFormRequest {
|
|
18
|
+
type: 'form';
|
|
19
|
+
title: string;
|
|
20
|
+
schema: McpJsonSchema;
|
|
21
|
+
}
|
|
22
|
+
export interface ToolInputUrlRequest {
|
|
23
|
+
type: 'url';
|
|
24
|
+
url: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
}
|
|
27
|
+
export type ToolInputRequest = ToolInputFormRequest | ToolInputUrlRequest;
|
|
28
|
+
export interface ToolInputApi {
|
|
29
|
+
request<TValue extends JSONValue = JSONValue>(request: ToolInputRequest): Promise<TValue>;
|
|
30
|
+
}
|
|
31
|
+
export interface ToolHostApi {
|
|
32
|
+
files?: WorkspaceFilesApi;
|
|
33
|
+
credentials?: ToolCredentialsApi;
|
|
34
|
+
models?: ToolModelsApi;
|
|
35
|
+
tasks?: ToolTasksApi;
|
|
36
|
+
events?: ToolEventsApi;
|
|
37
|
+
input?: ToolInputApi;
|
|
38
|
+
}
|
|
39
|
+
export interface ToolExecutionContext {
|
|
40
|
+
source: ToolExecutionSource;
|
|
41
|
+
tenantId: string;
|
|
42
|
+
organizationId?: string;
|
|
43
|
+
/** Present only when the caller deliberately supplied a workspace-scoped execution boundary. */
|
|
44
|
+
workspaceId?: string;
|
|
45
|
+
projectId?: string;
|
|
46
|
+
principal: ToolPrincipal;
|
|
47
|
+
executionId: string;
|
|
48
|
+
requestId: string;
|
|
49
|
+
traceId?: string;
|
|
50
|
+
conversationId?: string;
|
|
51
|
+
xpertId?: string;
|
|
52
|
+
agentKey?: string;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
host: ToolHostApi;
|
|
55
|
+
}
|
|
56
|
+
export type { CapabilityChangeEvent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
|
+
export type XpertToolContent = {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'image';
|
|
7
|
+
data: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'audio';
|
|
11
|
+
data: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'resource_link';
|
|
15
|
+
uri: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
};
|
|
18
|
+
export interface XpertToolResult<TStructuredContent = unknown> {
|
|
19
|
+
content?: XpertToolContent[];
|
|
20
|
+
structuredContent?: TStructuredContent;
|
|
21
|
+
meta?: Record<string, JSONValue>;
|
|
22
|
+
isError?: boolean;
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseToolkit, StructuredTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
2
2
|
import { I18nObject, TStateVariable, TToolsetParams } from "@xpert-ai/contracts";
|
|
3
|
-
import { z } from 'zod';
|
|
3
|
+
import { z } from 'zod/v3';
|
|
4
4
|
type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
|
5
5
|
/**
|
|
6
6
|
* Base ability for all toolsets
|
package/src/lib/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IconDefinition, I18nObject, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
|
|
2
2
|
import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
|
-
import type { ZodSchema } from 'zod';
|
|
4
|
+
import type { ZodSchema } from 'zod/v3';
|
|
5
5
|
import type { Permissions } from './core/permissions';
|
|
6
6
|
export declare const ORGANIZATION_METADATA_KEY = "xpert:organizationId";
|
|
7
7
|
export declare const PLUGIN_METADATA_KEY = "xpert:pluginName";
|
|
8
|
+
export declare const PLUGIN_VERSION_METADATA_KEY = "xpert:pluginVersion";
|
|
8
9
|
export declare const GLOBAL_ORGANIZATION_SCOPE = "global";
|
|
9
10
|
export declare const SYSTEM_GLOBAL_SCOPE = "system:global";
|
|
10
11
|
export declare const BUILTIN_GLOBAL_SCOPE = "builtin:global";
|