@xpert-ai/plugin-sdk 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @xpert-ai/plugin-sdk
2
2
 
3
+ ## 3.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6f679b8: fix plugin tenant scope & human chat files types
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [6f679b8]
12
+ - @xpert-ai/contracts@3.15.0
13
+
3
14
  ## 3.13.0
4
15
 
5
16
  ### Minor Changes
package/index.cjs.js CHANGED
@@ -91,6 +91,7 @@ var _axios__namespace = /*#__PURE__*/_interopNamespaceDefault(_axios);
91
91
  const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
92
92
  const PLUGIN_METADATA_KEY = 'xpert:pluginName';
93
93
  const GLOBAL_ORGANIZATION_SCOPE = 'global';
94
+ const BUILTIN_GLOBAL_SCOPE = 'builtin:global';
94
95
  const TENANT_GLOBAL_SCOPE_PREFIX = 'tenant:';
95
96
  const TENANT_GLOBAL_SCOPE_SUFFIX = ':global';
96
97
  const STRATEGY_META_KEY = 'XPERT_STRATEGY_META_KEY';
@@ -513,14 +514,14 @@ class BaseStrategyRegistry {
513
514
  if (type) {
514
515
  var _instance_metatype;
515
516
  const target = (_instance_metatype = instance.metatype) != null ? _instance_metatype : instance.constructor;
517
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
516
518
  var _this_reflector_get;
517
- const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : GLOBAL_ORGANIZATION_SCOPE;
519
+ const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
518
520
  var _this_strategies_get;
519
521
  const orgMap = (_this_strategies_get = this.strategies.get(organizationId)) != null ? _this_strategies_get : new Map();
520
522
  orgMap.set(type, instance);
521
523
  this.strategies.set(organizationId, orgMap);
522
- const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
523
- this.logger.debug(`Registered strategy of type ${type} for organization ${organizationId} from plugin ${pluginName}`);
524
+ this.logger.debug(`Registered strategy of type ${type} for scope ${organizationId} from plugin ${pluginName}`);
524
525
  if (pluginName) {
525
526
  var _this_pluginStrategies_get;
526
527
  const pluginStrategies = (_this_pluginStrategies_get = this.pluginStrategies.get(pluginName)) != null ? _this_pluginStrategies_get : new Set();
@@ -530,7 +531,7 @@ class BaseStrategyRegistry {
530
531
  }
531
532
  }
532
533
  /**
533
- * Remove all strategies registered by the given plugin for the given organization.
534
+ * Remove all strategies registered by the given plugin for the given scope.
534
535
  */ remove(organizationId, pluginName) {
535
536
  const strategies = this.pluginStrategies.get(pluginName);
536
537
  const orgMap = this.strategies.get(organizationId);
@@ -539,7 +540,7 @@ class BaseStrategyRegistry {
539
540
  }
540
541
  }
541
542
  /**
542
- * Resolve organization id, falling back to request context org or global scope.
543
+ * Resolve the primary scope key, falling back to request context org or tenant-global scope.
543
544
  */ resolveOrganization(organizationId) {
544
545
  var _RequestContext_getScope;
545
546
  var _RequestContext_getScope_tenantId;
@@ -553,6 +554,20 @@ class BaseStrategyRegistry {
553
554
  const tenantId = (_RequestContext_getScope_tenantId = (_RequestContext_getScope = RequestContext.getScope()) == null ? void 0 : _RequestContext_getScope.tenantId) != null ? _RequestContext_getScope_tenantId : RequestContext.currentTenantId();
554
555
  return resolveTenantGlobalScopeKey(tenantId);
555
556
  }
557
+ resolveStrategyScopeKeys(organizationId) {
558
+ const orgKey = this.resolveOrganization(organizationId);
559
+ const globalKey = this.resolveGlobalFallbackOrganization();
560
+ const scopeKeys = [
561
+ orgKey
562
+ ];
563
+ if (orgKey !== globalKey) {
564
+ scopeKeys.push(globalKey);
565
+ }
566
+ if (!scopeKeys.includes(BUILTIN_GLOBAL_SCOPE)) {
567
+ scopeKeys.push(BUILTIN_GLOBAL_SCOPE);
568
+ }
569
+ return scopeKeys;
570
+ }
556
571
  /**
557
572
  * Get strategy by type from the given organization including global strategies as fallback.
558
573
  *
@@ -560,12 +575,11 @@ class BaseStrategyRegistry {
560
575
  * @param organizationId
561
576
  * @returns
562
577
  */ get(type, organizationId) {
563
- var _this_strategies_get, _this_strategies_get1;
564
578
  organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
565
- const orgKey = this.resolveOrganization(organizationId);
566
- const globalKey = this.resolveGlobalFallbackOrganization();
567
- var _this_strategies_get_get;
568
- const strategy = (_this_strategies_get_get = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.get(type)) != null ? _this_strategies_get_get : orgKey === globalKey ? undefined : (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.get(type);
579
+ const strategy = this.resolveStrategyScopeKeys(organizationId).map((scopeKey)=>{
580
+ var _this_strategies_get;
581
+ return (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
582
+ }).find((item)=>!!item);
569
583
  if (!strategy) {
570
584
  throw new Error(`No strategy found for type '${type}' for strategy '${this.strategyKey}'`);
571
585
  }
@@ -577,19 +591,12 @@ class BaseStrategyRegistry {
577
591
  * @param organizationId
578
592
  * @returns
579
593
  */ list(organizationId) {
580
- var _this_strategies_get;
581
594
  organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
582
- const orgKey = this.resolveOrganization(organizationId);
583
- const globalKey = this.resolveGlobalFallbackOrganization();
584
595
  const effective = new Map();
585
- var _this_strategies_get_entries;
586
- for (const [type, strategy] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
587
- effective.set(type, strategy);
588
- }
589
- if (orgKey !== globalKey) {
590
- var _this_strategies_get1;
591
- var _this_strategies_get_entries1;
592
- for (const [type, strategy] of (_this_strategies_get_entries1 = (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.entries()) != null ? _this_strategies_get_entries1 : []){
596
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
597
+ var _this_strategies_get;
598
+ var _this_strategies_get_entries;
599
+ for (const [type, strategy] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
593
600
  if (!effective.has(type)) {
594
601
  effective.set(type, strategy);
595
602
  }
@@ -599,7 +606,7 @@ class BaseStrategyRegistry {
599
606
  }
600
607
  constructor(strategyKey, discoveryService, reflector){
601
608
  this.logger = new common.Logger(BaseStrategyRegistry.name);
602
- // Map<organizationId, Map<type, strategy>>
609
+ // Map<scopeKey, Map<type, strategy>>
603
610
  this.strategies = new Map();
604
611
  this.pluginStrategies = new Map();
605
612
  this.strategyKey = strategyKey;
@@ -4113,18 +4120,11 @@ const ViewExtensionProvider = (providerKey)=>common.applyDecorators(common.SetMe
4113
4120
 
4114
4121
  exports.ViewExtensionProviderRegistry = class ViewExtensionProviderRegistry extends BaseStrategyRegistry {
4115
4122
  listEntries(organizationId) {
4116
- var _this_strategies_get;
4117
- const orgKey = this.resolveOrganization(organizationId);
4118
- const globalKey = this.resolveGlobalFallbackOrganization();
4119
4123
  const entries = new Map();
4120
- var _this_strategies_get_entries;
4121
- for (const [providerKey, provider] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
4122
- entries.set(providerKey, provider);
4123
- }
4124
- if (orgKey !== globalKey) {
4125
- var _this_strategies_get1;
4126
- var _this_strategies_get_entries1;
4127
- for (const [providerKey, provider] of (_this_strategies_get_entries1 = (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.entries()) != null ? _this_strategies_get_entries1 : []){
4124
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
4125
+ var _this_strategies_get;
4126
+ var _this_strategies_get_entries;
4127
+ for (const [providerKey, provider] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
4128
4128
  if (!entries.has(providerKey)) {
4129
4129
  entries.set(providerKey, provider);
4130
4130
  }
@@ -4583,6 +4583,7 @@ exports.AgentMiddlewareStrategy = AgentMiddlewareStrategy;
4583
4583
  exports.AiModelNotFoundException = AiModelNotFoundException;
4584
4584
  exports.AssistantTaskRuntimeCapability = AssistantTaskRuntimeCapability;
4585
4585
  exports.BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN = BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN;
4586
+ exports.BUILTIN_GLOBAL_SCOPE = BUILTIN_GLOBAL_SCOPE;
4586
4587
  exports.BaseHTTPQueryRunner = BaseHTTPQueryRunner;
4587
4588
  exports.BaseQueryRunner = BaseQueryRunner;
4588
4589
  exports.BaseSQLQueryRunner = BaseSQLQueryRunner;
package/index.esm.js CHANGED
@@ -71,6 +71,7 @@ import { getModelContextSize as getModelContextSize$1 } from '@langchain/core/la
71
71
  const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
72
72
  const PLUGIN_METADATA_KEY = 'xpert:pluginName';
73
73
  const GLOBAL_ORGANIZATION_SCOPE = 'global';
74
+ const BUILTIN_GLOBAL_SCOPE = 'builtin:global';
74
75
  const TENANT_GLOBAL_SCOPE_PREFIX = 'tenant:';
75
76
  const TENANT_GLOBAL_SCOPE_SUFFIX = ':global';
76
77
  const STRATEGY_META_KEY = 'XPERT_STRATEGY_META_KEY';
@@ -493,14 +494,14 @@ class BaseStrategyRegistry {
493
494
  if (type) {
494
495
  var _instance_metatype;
495
496
  const target = (_instance_metatype = instance.metatype) != null ? _instance_metatype : instance.constructor;
497
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
496
498
  var _this_reflector_get;
497
- const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : GLOBAL_ORGANIZATION_SCOPE;
499
+ const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
498
500
  var _this_strategies_get;
499
501
  const orgMap = (_this_strategies_get = this.strategies.get(organizationId)) != null ? _this_strategies_get : new Map();
500
502
  orgMap.set(type, instance);
501
503
  this.strategies.set(organizationId, orgMap);
502
- const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
503
- this.logger.debug(`Registered strategy of type ${type} for organization ${organizationId} from plugin ${pluginName}`);
504
+ this.logger.debug(`Registered strategy of type ${type} for scope ${organizationId} from plugin ${pluginName}`);
504
505
  if (pluginName) {
505
506
  var _this_pluginStrategies_get;
506
507
  const pluginStrategies = (_this_pluginStrategies_get = this.pluginStrategies.get(pluginName)) != null ? _this_pluginStrategies_get : new Set();
@@ -510,7 +511,7 @@ class BaseStrategyRegistry {
510
511
  }
511
512
  }
512
513
  /**
513
- * Remove all strategies registered by the given plugin for the given organization.
514
+ * Remove all strategies registered by the given plugin for the given scope.
514
515
  */ remove(organizationId, pluginName) {
515
516
  const strategies = this.pluginStrategies.get(pluginName);
516
517
  const orgMap = this.strategies.get(organizationId);
@@ -519,7 +520,7 @@ class BaseStrategyRegistry {
519
520
  }
520
521
  }
521
522
  /**
522
- * Resolve organization id, falling back to request context org or global scope.
523
+ * Resolve the primary scope key, falling back to request context org or tenant-global scope.
523
524
  */ resolveOrganization(organizationId) {
524
525
  var _RequestContext_getScope;
525
526
  var _RequestContext_getScope_tenantId;
@@ -533,6 +534,20 @@ class BaseStrategyRegistry {
533
534
  const tenantId = (_RequestContext_getScope_tenantId = (_RequestContext_getScope = RequestContext.getScope()) == null ? void 0 : _RequestContext_getScope.tenantId) != null ? _RequestContext_getScope_tenantId : RequestContext.currentTenantId();
534
535
  return resolveTenantGlobalScopeKey(tenantId);
535
536
  }
537
+ resolveStrategyScopeKeys(organizationId) {
538
+ const orgKey = this.resolveOrganization(organizationId);
539
+ const globalKey = this.resolveGlobalFallbackOrganization();
540
+ const scopeKeys = [
541
+ orgKey
542
+ ];
543
+ if (orgKey !== globalKey) {
544
+ scopeKeys.push(globalKey);
545
+ }
546
+ if (!scopeKeys.includes(BUILTIN_GLOBAL_SCOPE)) {
547
+ scopeKeys.push(BUILTIN_GLOBAL_SCOPE);
548
+ }
549
+ return scopeKeys;
550
+ }
536
551
  /**
537
552
  * Get strategy by type from the given organization including global strategies as fallback.
538
553
  *
@@ -540,12 +555,11 @@ class BaseStrategyRegistry {
540
555
  * @param organizationId
541
556
  * @returns
542
557
  */ get(type, organizationId) {
543
- var _this_strategies_get, _this_strategies_get1;
544
558
  organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
545
- const orgKey = this.resolveOrganization(organizationId);
546
- const globalKey = this.resolveGlobalFallbackOrganization();
547
- var _this_strategies_get_get;
548
- const strategy = (_this_strategies_get_get = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.get(type)) != null ? _this_strategies_get_get : orgKey === globalKey ? undefined : (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.get(type);
559
+ const strategy = this.resolveStrategyScopeKeys(organizationId).map((scopeKey)=>{
560
+ var _this_strategies_get;
561
+ return (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
562
+ }).find((item)=>!!item);
549
563
  if (!strategy) {
550
564
  throw new Error(`No strategy found for type '${type}' for strategy '${this.strategyKey}'`);
551
565
  }
@@ -557,19 +571,12 @@ class BaseStrategyRegistry {
557
571
  * @param organizationId
558
572
  * @returns
559
573
  */ list(organizationId) {
560
- var _this_strategies_get;
561
574
  organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
562
- const orgKey = this.resolveOrganization(organizationId);
563
- const globalKey = this.resolveGlobalFallbackOrganization();
564
575
  const effective = new Map();
565
- var _this_strategies_get_entries;
566
- for (const [type, strategy] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
567
- effective.set(type, strategy);
568
- }
569
- if (orgKey !== globalKey) {
570
- var _this_strategies_get1;
571
- var _this_strategies_get_entries1;
572
- for (const [type, strategy] of (_this_strategies_get_entries1 = (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.entries()) != null ? _this_strategies_get_entries1 : []){
576
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
577
+ var _this_strategies_get;
578
+ var _this_strategies_get_entries;
579
+ for (const [type, strategy] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
573
580
  if (!effective.has(type)) {
574
581
  effective.set(type, strategy);
575
582
  }
@@ -579,7 +586,7 @@ class BaseStrategyRegistry {
579
586
  }
580
587
  constructor(strategyKey, discoveryService, reflector){
581
588
  this.logger = new Logger(BaseStrategyRegistry.name);
582
- // Map<organizationId, Map<type, strategy>>
589
+ // Map<scopeKey, Map<type, strategy>>
583
590
  this.strategies = new Map();
584
591
  this.pluginStrategies = new Map();
585
592
  this.strategyKey = strategyKey;
@@ -4093,18 +4100,11 @@ const ViewExtensionProvider = (providerKey)=>applyDecorators(SetMetadata(VIEW_EX
4093
4100
 
4094
4101
  let ViewExtensionProviderRegistry = class ViewExtensionProviderRegistry extends BaseStrategyRegistry {
4095
4102
  listEntries(organizationId) {
4096
- var _this_strategies_get;
4097
- const orgKey = this.resolveOrganization(organizationId);
4098
- const globalKey = this.resolveGlobalFallbackOrganization();
4099
4103
  const entries = new Map();
4100
- var _this_strategies_get_entries;
4101
- for (const [providerKey, provider] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(orgKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
4102
- entries.set(providerKey, provider);
4103
- }
4104
- if (orgKey !== globalKey) {
4105
- var _this_strategies_get1;
4106
- var _this_strategies_get_entries1;
4107
- for (const [providerKey, provider] of (_this_strategies_get_entries1 = (_this_strategies_get1 = this.strategies.get(globalKey)) == null ? void 0 : _this_strategies_get1.entries()) != null ? _this_strategies_get_entries1 : []){
4104
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
4105
+ var _this_strategies_get;
4106
+ var _this_strategies_get_entries;
4107
+ for (const [providerKey, provider] of (_this_strategies_get_entries = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.entries()) != null ? _this_strategies_get_entries : []){
4108
4108
  if (!entries.has(providerKey)) {
4109
4109
  entries.set(providerKey, provider);
4110
4110
  }
@@ -4543,4 +4543,4 @@ function escapeHtmlAttribute(value) {
4543
4543
 
4544
4544
  const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
4545
4545
 
4546
- 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, 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, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, 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, 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, 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, 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 };
4546
+ 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, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, 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, 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, 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,14 +13,15 @@ export declare class BaseStrategyRegistry<S> implements OnModuleInit {
13
13
  onModuleInit(): void;
14
14
  upsert(instance: any): void;
15
15
  /**
16
- * Remove all strategies registered by the given plugin for the given organization.
16
+ * Remove all strategies registered by the given plugin for the given scope.
17
17
  */
18
18
  remove(organizationId: string, pluginName: string): void;
19
19
  /**
20
- * Resolve organization id, falling back to request context org or global scope.
20
+ * Resolve the primary scope key, falling back to request context org or tenant-global scope.
21
21
  */
22
22
  protected resolveOrganization(organizationId?: string): string;
23
23
  protected resolveGlobalFallbackOrganization(): string;
24
+ protected resolveStrategyScopeKeys(organizationId?: string): string[];
24
25
  /**
25
26
  * Get strategy by type from the given organization including global strategies as fallback.
26
27
  *
@@ -6,6 +6,7 @@ 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
8
  export declare const GLOBAL_ORGANIZATION_SCOPE = "global";
9
+ export declare const BUILTIN_GLOBAL_SCOPE = "builtin:global";
9
10
  export declare const TENANT_GLOBAL_SCOPE_PREFIX = "tenant:";
10
11
  export declare const TENANT_GLOBAL_SCOPE_SUFFIX = ":global";
11
12
  export declare const STRATEGY_META_KEY = "XPERT_STRATEGY_META_KEY";