@xpert-ai/plugin-sdk 3.15.16 → 3.15.18

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,21 @@
1
1
  # @xpert-ai/plugin-sdk
2
2
 
3
+ ## 3.15.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f6bf18: Support localized plugin display names and descriptions across plugin metadata, the platform registry, and marketplace dialogs.
8
+ - Updated dependencies [2f6bf18]
9
+ - @xpert-ai/contracts@3.15.18
10
+
11
+ ## 3.15.17
12
+
13
+ ### Patch Changes
14
+
15
+ - 0a90701: release 3.15.17
16
+ - Updated dependencies [0a90701]
17
+ - @xpert-ai/contracts@3.15.17
18
+
3
19
  ## 3.15.16
4
20
 
5
21
  ### Patch Changes
package/index.cjs.js CHANGED
@@ -446,7 +446,25 @@ class RequestContext {
446
446
  this.extras = extras;
447
447
  }
448
448
  }
449
- const als = new node_async_hooks.AsyncLocalStorage();
449
+ const REQUEST_CONTEXT_STORAGE_KEY = Symbol.for('xpert.plugin-sdk.request-context.storage.v1');
450
+ function getSharedRequestContextStorage() {
451
+ const existing = Reflect.get(globalThis, REQUEST_CONTEXT_STORAGE_KEY);
452
+ if (existing instanceof node_async_hooks.AsyncLocalStorage) {
453
+ return existing;
454
+ }
455
+ const storage = new node_async_hooks.AsyncLocalStorage();
456
+ Reflect.defineProperty(globalThis, REQUEST_CONTEXT_STORAGE_KEY, {
457
+ value: storage,
458
+ configurable: false,
459
+ enumerable: false,
460
+ writable: false
461
+ });
462
+ return storage;
463
+ }
464
+ /**
465
+ * One process-wide context store shared by source, built, and dynamically loaded
466
+ * copies of the Plugin SDK. Plugin class identity may differ; the async scope must not.
467
+ */ const als = getSharedRequestContextStorage();
450
468
  function getRequestContext() {
451
469
  return als.getStore();
452
470
  }
@@ -536,9 +554,9 @@ class BaseStrategyRegistry {
536
554
  }
537
555
  const type = this.reflector.get(this.strategyKey, target);
538
556
  if (type) {
539
- const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
540
- var _this_reflector_get;
541
- const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
557
+ const source = this.getSource(instance);
558
+ const pluginName = source.kind === 'plugin' ? source.pluginName : undefined;
559
+ const organizationId = source.scopeKey;
542
560
  var _this_strategies_get;
543
561
  const orgMap = (_this_strategies_get = this.strategies.get(organizationId)) != null ? _this_strategies_get : new Map();
544
562
  orgMap.set(type, instance);
@@ -552,6 +570,29 @@ class BaseStrategyRegistry {
552
570
  }
553
571
  }
554
572
  }
573
+ /** Returns the explicit registry provenance attached by the plugin loader. */ getSource(instance) {
574
+ const target = resolveStrategyMetadataTarget(instance);
575
+ if (!target) {
576
+ return {
577
+ kind: 'builtin',
578
+ scopeKey: BUILTIN_GLOBAL_SCOPE
579
+ };
580
+ }
581
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
582
+ if (!pluginName) {
583
+ var _this_reflector_get;
584
+ return {
585
+ kind: 'builtin',
586
+ scopeKey: (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE
587
+ };
588
+ }
589
+ var _this_reflector_get1;
590
+ return {
591
+ kind: 'plugin',
592
+ pluginName,
593
+ scopeKey: (_this_reflector_get1 = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get1 : GLOBAL_ORGANIZATION_SCOPE
594
+ };
595
+ }
555
596
  /**
556
597
  * Remove all strategies registered by the given plugin for the given scope.
557
598
  */ remove(organizationId, pluginName) {
@@ -2816,7 +2857,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
2816
2857
 
2817
2858
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
2818
2859
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
2819
- description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2860
+ description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
2820
2861
  });
2821
2862
 
2822
2863
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -2830,10 +2871,12 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2830
2871
  'BROWSER_LAUNCH_FAILED',
2831
2872
  'EXPORT_TIMEOUT',
2832
2873
  'EXPORT_OOM',
2874
+ 'EXPORT_MEDIA_FAILED',
2833
2875
  'EXPORT_INPUT_INVALID',
2834
2876
  'EXPORT_OUTPUT_INVALID',
2835
2877
  'SANDBOX_CANCELLED'
2836
2878
  ];
2879
+ /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
2837
2880
  /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2838
2881
  constructor(code, message, retryable, jobId){
2839
2882
  super(message);
@@ -2843,8 +2886,14 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2843
2886
  this.name = 'SandboxJobRuntimeError';
2844
2887
  }
2845
2888
  }
2889
+ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
2846
2890
  /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2847
- return error instanceof SandboxJobRuntimeError;
2891
+ if (error instanceof SandboxJobRuntimeError) return true;
2892
+ if (typeof error !== 'object' || error === null) return false;
2893
+ // Dynamically loaded plugins may resolve another Plugin SDK module instance,
2894
+ // so class identity is not a reliable runtime boundary. Validate the stable shape.
2895
+ const candidate = error;
2896
+ return candidate.name === 'SandboxJobRuntimeError' && typeof candidate.message === 'string' && typeof candidate.code === 'string' && SANDBOX_JOB_ERROR_CODE_SET.has(candidate.code) && typeof candidate.retryable === 'boolean' && (candidate.jobId === undefined || typeof candidate.jobId === 'string');
2848
2897
  }
2849
2898
  /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2850
2899
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
@@ -5006,6 +5055,7 @@ exports.RequirePermissionOperation = RequirePermissionOperation;
5006
5055
  exports.RerankModel = RerankModel;
5007
5056
  exports.RetrieverStrategy = RetrieverStrategy;
5008
5057
  exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
5058
+ exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
5009
5059
  exports.SANDBOX_PROVIDER = SANDBOX_PROVIDER;
5010
5060
  exports.SANDBOX_RUNTIME_PROVIDER = SANDBOX_RUNTIME_PROVIDER;
5011
5061
  exports.SANDBOX_SHELL_TIMEOUT_LIMITS_SEC = SANDBOX_SHELL_TIMEOUT_LIMITS_SEC;
package/index.esm.js CHANGED
@@ -428,7 +428,25 @@ class RequestContext {
428
428
  this.extras = extras;
429
429
  }
430
430
  }
431
- const als = new AsyncLocalStorage();
431
+ const REQUEST_CONTEXT_STORAGE_KEY = Symbol.for('xpert.plugin-sdk.request-context.storage.v1');
432
+ function getSharedRequestContextStorage() {
433
+ const existing = Reflect.get(globalThis, REQUEST_CONTEXT_STORAGE_KEY);
434
+ if (existing instanceof AsyncLocalStorage) {
435
+ return existing;
436
+ }
437
+ const storage = new AsyncLocalStorage();
438
+ Reflect.defineProperty(globalThis, REQUEST_CONTEXT_STORAGE_KEY, {
439
+ value: storage,
440
+ configurable: false,
441
+ enumerable: false,
442
+ writable: false
443
+ });
444
+ return storage;
445
+ }
446
+ /**
447
+ * One process-wide context store shared by source, built, and dynamically loaded
448
+ * copies of the Plugin SDK. Plugin class identity may differ; the async scope must not.
449
+ */ const als = getSharedRequestContextStorage();
432
450
  function getRequestContext() {
433
451
  return als.getStore();
434
452
  }
@@ -518,9 +536,9 @@ class BaseStrategyRegistry {
518
536
  }
519
537
  const type = this.reflector.get(this.strategyKey, target);
520
538
  if (type) {
521
- const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
522
- var _this_reflector_get;
523
- const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
539
+ const source = this.getSource(instance);
540
+ const pluginName = source.kind === 'plugin' ? source.pluginName : undefined;
541
+ const organizationId = source.scopeKey;
524
542
  var _this_strategies_get;
525
543
  const orgMap = (_this_strategies_get = this.strategies.get(organizationId)) != null ? _this_strategies_get : new Map();
526
544
  orgMap.set(type, instance);
@@ -534,6 +552,29 @@ class BaseStrategyRegistry {
534
552
  }
535
553
  }
536
554
  }
555
+ /** Returns the explicit registry provenance attached by the plugin loader. */ getSource(instance) {
556
+ const target = resolveStrategyMetadataTarget(instance);
557
+ if (!target) {
558
+ return {
559
+ kind: 'builtin',
560
+ scopeKey: BUILTIN_GLOBAL_SCOPE
561
+ };
562
+ }
563
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
564
+ if (!pluginName) {
565
+ var _this_reflector_get;
566
+ return {
567
+ kind: 'builtin',
568
+ scopeKey: (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE
569
+ };
570
+ }
571
+ var _this_reflector_get1;
572
+ return {
573
+ kind: 'plugin',
574
+ pluginName,
575
+ scopeKey: (_this_reflector_get1 = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get1 : GLOBAL_ORGANIZATION_SCOPE
576
+ };
577
+ }
537
578
  /**
538
579
  * Remove all strategies registered by the given plugin for the given scope.
539
580
  */ remove(organizationId, pluginName) {
@@ -2798,7 +2839,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
2798
2839
 
2799
2840
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
2800
2841
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
2801
- description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2842
+ description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
2802
2843
  });
2803
2844
 
2804
2845
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -2812,10 +2853,12 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2812
2853
  'BROWSER_LAUNCH_FAILED',
2813
2854
  'EXPORT_TIMEOUT',
2814
2855
  'EXPORT_OOM',
2856
+ 'EXPORT_MEDIA_FAILED',
2815
2857
  'EXPORT_INPUT_INVALID',
2816
2858
  'EXPORT_OUTPUT_INVALID',
2817
2859
  'SANDBOX_CANCELLED'
2818
2860
  ];
2861
+ /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
2819
2862
  /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2820
2863
  constructor(code, message, retryable, jobId){
2821
2864
  super(message);
@@ -2825,8 +2868,14 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2825
2868
  this.name = 'SandboxJobRuntimeError';
2826
2869
  }
2827
2870
  }
2871
+ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
2828
2872
  /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2829
- return error instanceof SandboxJobRuntimeError;
2873
+ if (error instanceof SandboxJobRuntimeError) return true;
2874
+ if (typeof error !== 'object' || error === null) return false;
2875
+ // Dynamically loaded plugins may resolve another Plugin SDK module instance,
2876
+ // so class identity is not a reliable runtime boundary. Validate the stable shape.
2877
+ const candidate = error;
2878
+ return candidate.name === 'SandboxJobRuntimeError' && typeof candidate.message === 'string' && typeof candidate.code === 'string' && SANDBOX_JOB_ERROR_CODE_SET.has(candidate.code) && typeof candidate.retryable === 'boolean' && (candidate.jobId === undefined || typeof candidate.jobId === 'string');
2830
2879
  }
2831
2880
  /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2832
2881
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
@@ -4866,4 +4915,4 @@ CollaborationDocumentProviderRegistry = __decorate([
4866
4915
  ])
4867
4916
  ], CollaborationDocumentProviderRegistry);
4868
4917
 
4869
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PERMISSION_SERVICE_TOKEN, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, ArtifactsRuntimeCapability, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, 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, 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_JOB_ERROR_CODES, 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, SandboxJobRuntimeError, SandboxJobsRuntimeCapability, 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, 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, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateModelPrice, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isDevelopmentSandboxRuntimeEnvironment, isRemoteFile, isSandboxBackend, isSandboxJobRuntimeError, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
4918
+ export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PERMISSION_SERVICE_TOKEN, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, ArtifactsRuntimeCapability, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, 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, 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_JOB_ERROR_CODES, SANDBOX_JOB_PROGRESS_PREFIX, 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, SandboxJobRuntimeError, SandboxJobsRuntimeCapability, 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, 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, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateModelPrice, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isDevelopmentSandboxRuntimeEnvironment, isRemoteFile, isSandboxBackend, isSandboxJobRuntimeError, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, 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.16",
3
+ "version": "3.15.18",
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.16",
20
+ "@xpert-ai/contracts": "3.15.18",
21
21
  "express": "^4.22.1",
22
22
  "js-tiktoken": "^1.0.21"
23
23
  },
@@ -39,8 +39,12 @@ export type AgentMiddlewareAssistantTaskStatusInput = {
39
39
  clientMessageId?: string;
40
40
  xpertId?: string;
41
41
  };
42
+ export type AgentMiddlewareAssistantTaskCancelResult = {
43
+ canceledExecutionIds: string[];
44
+ };
42
45
  export interface AgentMiddlewareAssistantTaskApi {
43
46
  startTask(input: AgentMiddlewareAssistantTaskInput): Promise<AgentMiddlewareAssistantTaskResult>;
44
47
  getTaskStatus?(input: AgentMiddlewareAssistantTaskStatusInput): Promise<AgentMiddlewareAssistantTaskResult | null>;
48
+ cancelTask?(input: AgentMiddlewareAssistantTaskStatusInput): Promise<AgentMiddlewareAssistantTaskCancelResult>;
45
49
  }
46
50
  export declare const AssistantTaskRuntimeCapability: import("../../../core/runtime-capability").RuntimeCapabilityKey<AgentMiddlewareAssistantTaskApi>;
@@ -47,5 +47,9 @@ export declare class RequestContext {
47
47
  */
48
48
  static hasRoles(roles: RolesEnum[], throwError?: boolean): boolean;
49
49
  }
50
+ /**
51
+ * One process-wide context store shared by source, built, and dynamically loaded
52
+ * copies of the Plugin SDK. Plugin class identity may differ; the async scope must not.
53
+ */
50
54
  export declare const als: AsyncLocalStorage<RequestContext>;
51
55
  export declare function getRequestContext(): RequestContext;
@@ -86,6 +86,11 @@ export type ManagedQueueJobContext = {
86
86
  queueName: string;
87
87
  jobName: string;
88
88
  scopeKey?: string | null;
89
+ /** Persisted queue ownership restored independently of ambient request context. */
90
+ tenantId?: string | null;
91
+ organizationId?: string | null;
92
+ /** Business actor captured when the logical job was enqueued. */
93
+ userId?: string | null;
89
94
  };
90
95
  export type ManagedQueueJobSnapshot<TPayload = unknown> = ManagedQueueJob<TPayload> & {
91
96
  state?: string;
@@ -95,7 +100,7 @@ export type ManagedQueueJobSnapshot<TPayload = unknown> = ManagedQueueJob<TPaylo
95
100
  processedOn?: number;
96
101
  finishedOn?: number;
97
102
  };
98
- export type ManagedQueueJobHandler<TPayload = unknown> = (job: ManagedQueueJob<TPayload>) => Promise<void> | void;
103
+ export type ManagedQueueJobHandler<TPayload = unknown> = (job: ManagedQueueJob<TPayload>, context: ManagedQueueJobContext) => Promise<void> | void;
99
104
  export interface ManagedQueueJobProcessor<TPayload = unknown> {
100
105
  handle(job: ManagedQueueJob<TPayload>, context: ManagedQueueJobContext): Promise<void> | void;
101
106
  }
@@ -1,10 +1,27 @@
1
1
  import type { JSONValue } from '@xpert-ai/contracts';
2
2
  import type { WorkspaceFileScope, WorkspacePortableFileReference } from './workspace-files';
3
3
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */
4
- export declare const SANDBOX_JOB_ERROR_CODES: readonly ["SANDBOX_ACTION_UNAVAILABLE", "SANDBOX_ACTION_INVALID", "SANDBOX_PROFILE_UNAVAILABLE", "SANDBOX_RUNTIME_UNAVAILABLE", "SANDBOX_VERSION_MISMATCH", "SANDBOX_CAPACITY_UNAVAILABLE", "SANDBOX_START_FAILED", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED"];
4
+ export declare const SANDBOX_JOB_ERROR_CODES: readonly ["SANDBOX_ACTION_UNAVAILABLE", "SANDBOX_ACTION_INVALID", "SANDBOX_PROFILE_UNAVAILABLE", "SANDBOX_RUNTIME_UNAVAILABLE", "SANDBOX_VERSION_MISMATCH", "SANDBOX_CAPACITY_UNAVAILABLE", "SANDBOX_START_FAILED", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_MEDIA_FAILED", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED"];
5
5
  export type SandboxJobErrorCode = (typeof SANDBOX_JOB_ERROR_CODES)[number];
6
6
  /** Persisted lifecycle states for a generic isolated background execution. */
7
7
  export type SandboxJobStatus = 'waiting' | 'starting' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'lost';
8
+ /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */
9
+ export declare const SANDBOX_JOB_PROGRESS_PREFIX = "XPERT_SANDBOX_PROGRESS ";
10
+ /** Latest structured progress reported by a Sandbox Action or Core lifecycle stage. */
11
+ export type SandboxJobProgress = {
12
+ /** Normalized completion ratio from 0 through 1. */
13
+ progress: number;
14
+ /** Stable machine-readable stage such as `rendering`, `packaging`, or `complete`. */
15
+ stage?: string;
16
+ /** Optional bounded diagnostic intended for operational UIs and logs. */
17
+ message?: string;
18
+ /** Optional current work unit, for example the rendered frame number. */
19
+ current?: number;
20
+ /** Optional total work units corresponding to `current`. */
21
+ total?: number;
22
+ /** Platform timestamp of the latest accepted update. */
23
+ updatedAt?: Date | string | null;
24
+ };
8
25
  /** Portable Workspace Files input materialized under `/workspace/input`. */
9
26
  export type SandboxJobFileInput = {
10
27
  /** Tenant-scoped portable reference; raw bytes never enter queue state. */
@@ -78,6 +95,8 @@ export type SandboxJobSnapshot = {
78
95
  action: string;
79
96
  actionVersion: string;
80
97
  status: SandboxJobStatus;
98
+ /** Latest persisted Action/Core progress, available while a Job is running and after reload. */
99
+ progress?: SandboxJobProgress | null;
81
100
  /** Attempt number; a new failed-job attempt may select a newly healthy Binding. */
82
101
  attempt: number;
83
102
  /** Provider and Binding are persisted so cleanup never depends on current selection. */
@@ -160,6 +160,11 @@ export interface WorkspaceFilesApi {
160
160
  uploadBuffer(input: WorkspaceUploadBufferInput): Promise<WorkspaceFile>;
161
161
  /** Register an existing workspace file with the platform understanding pipeline. */
162
162
  understandFile(input: WorkspaceUnderstandFileInput): Promise<WorkspaceUnderstoodFile>;
163
+ /**
164
+ * Resolve metadata and an openable URL for an explicitly scoped workspace
165
+ * file without reading its bytes into the API process.
166
+ */
167
+ resolveFile(input: WorkspaceFileReference): Promise<WorkspaceFile>;
163
168
  /** Read raw bytes from an explicitly scoped workspace file reference. */
164
169
  readBuffer(input: WorkspaceFileReference): Promise<WorkspaceFileBuffer>;
165
170
  /** Delete an explicitly scoped workspace file. */
@@ -2,6 +2,16 @@
2
2
  export type SandboxRuntimeExecutionOptions = {
3
3
  timeoutMs?: number;
4
4
  maxOutputBytes?: number;
5
+ /**
6
+ * Streams normalized process output to Core while execution is active.
7
+ * Providers must treat observers as best-effort and must not let them fail the Runtime.
8
+ */
9
+ onOutput?: (output: SandboxRuntimeOutputChunk) => void;
10
+ };
11
+ /** One provider-neutral stdout/stderr chunk observed during Runtime execution. */
12
+ export type SandboxRuntimeOutputChunk = {
13
+ stream: 'stdout' | 'stderr';
14
+ text: string;
5
15
  };
6
16
  /** Provider-observed reason why a Runtime execution stopped without a normal exit. */
7
17
  export type SandboxRuntimeTerminationReason = 'oom' | 'deadline' | 'cancelled' | 'runtime-died';
@@ -1,6 +1,14 @@
1
1
  import { OnModuleInit, type Type } from '@nestjs/common';
2
2
  import { DiscoveryService, Reflector } from '@nestjs/core';
3
3
  import { StrategyBus } from './core/strategy-bus';
4
+ export type StrategySource = {
5
+ kind: 'builtin';
6
+ scopeKey: string;
7
+ } | {
8
+ kind: 'plugin';
9
+ pluginName: string;
10
+ scopeKey: string;
11
+ };
4
12
  export declare class BaseStrategyRegistry<S> implements OnModuleInit {
5
13
  protected readonly strategyKey: string;
6
14
  protected discoveryService: DiscoveryService;
@@ -12,6 +20,8 @@ export declare class BaseStrategyRegistry<S> implements OnModuleInit {
12
20
  constructor(strategyKey: string, discoveryService: DiscoveryService, reflector: Reflector);
13
21
  onModuleInit(): void;
14
22
  upsert(instance: unknown): void;
23
+ /** Returns the explicit registry provenance attached by the plugin loader. */
24
+ getSource(instance: S): StrategySource;
15
25
  /**
16
26
  * Remove all strategies registered by the given plugin for the given scope.
17
27
  */