@xpert-ai/plugin-sdk 3.15.11 → 3.15.12

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,14 @@
1
1
  # @xpert-ai/plugin-sdk
2
2
 
3
+ ## 3.15.12
4
+
5
+ ### Patch Changes
6
+
7
+ - b8bac1f: Add system-plugin Sandbox Actions, the action-oriented Sandbox Jobs Core, provider-neutral Runtime Definitions, the minimal Runtime Provider/workspace mapper SPI, Worker heartbeat health, and Browser execution-pool capability discovery.
8
+ - Updated dependencies [b8bac1f]
9
+ - Updated dependencies [b905a58]
10
+ - @xpert-ai/contracts@3.15.12
11
+
3
12
  ## 3.15.11
4
13
 
5
14
  ### Patch Changes
package/index.cjs.js CHANGED
@@ -529,10 +529,12 @@ class BaseStrategyRegistry {
529
529
  }
530
530
  }
531
531
  upsert(instance) {
532
- const type = this.reflector.get(this.strategyKey, instance.constructor);
532
+ const target = resolveStrategyMetadataTarget(instance);
533
+ if (!target) {
534
+ return;
535
+ }
536
+ const type = this.reflector.get(this.strategyKey, target);
533
537
  if (type) {
534
- var _instance_metatype;
535
- const target = (_instance_metatype = instance.metatype) != null ? _instance_metatype : instance.constructor;
536
538
  const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
537
539
  var _this_reflector_get;
538
540
  const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
@@ -640,6 +642,23 @@ __decorate([
640
642
  common.Inject(exports.StrategyBus),
641
643
  __metadata("design:type", exports.StrategyBus)
642
644
  ], BaseStrategyRegistry.prototype, "bus", void 0);
645
+ /** Returns whether a discovered provider can carry decorator metadata. */ function isStrategyInstance(instance) {
646
+ return typeof instance === 'object' && instance !== null || typeof instance === 'function';
647
+ }
648
+ /** Resolves the class used for plugin and organization metadata without reflecting over primitive provider values. */ function resolveStrategyMetadataTarget(instance) {
649
+ if (!isStrategyInstance(instance)) {
650
+ return null;
651
+ }
652
+ if (typeof instance === 'function') {
653
+ return instance;
654
+ }
655
+ const metatype = instance.metatype;
656
+ if (typeof metatype === 'function') {
657
+ return metatype;
658
+ }
659
+ const constructor = instance.constructor;
660
+ return typeof constructor === 'function' ? constructor : null;
661
+ }
643
662
 
644
663
  exports.IntegrationStrategyRegistry = class IntegrationStrategyRegistry extends BaseStrategyRegistry {
645
664
  constructor(discoveryService, reflector){
@@ -2794,6 +2813,37 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2794
2813
  description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2795
2814
  });
2796
2815
 
2816
+ /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
2817
+ 'SANDBOX_ACTION_UNAVAILABLE',
2818
+ 'SANDBOX_ACTION_INVALID',
2819
+ 'SANDBOX_PROFILE_UNAVAILABLE',
2820
+ 'SANDBOX_RUNTIME_UNAVAILABLE',
2821
+ 'SANDBOX_VERSION_MISMATCH',
2822
+ 'SANDBOX_CAPACITY_UNAVAILABLE',
2823
+ 'SANDBOX_START_FAILED',
2824
+ 'BROWSER_LAUNCH_FAILED',
2825
+ 'EXPORT_TIMEOUT',
2826
+ 'EXPORT_OOM',
2827
+ 'EXPORT_INPUT_INVALID',
2828
+ 'EXPORT_OUTPUT_INVALID',
2829
+ 'SANDBOX_CANCELLED'
2830
+ ];
2831
+ /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2832
+ constructor(code, message, retryable, jobId){
2833
+ super(message);
2834
+ this.code = code;
2835
+ this.retryable = retryable;
2836
+ this.jobId = jobId;
2837
+ this.name = 'SandboxJobRuntimeError';
2838
+ }
2839
+ }
2840
+ /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2841
+ return error instanceof SandboxJobRuntimeError;
2842
+ }
2843
+ /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2844
+ description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
2845
+ });
2846
+
2797
2847
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
2798
2848
  const SkillSourceProviderStrategy = (provider)=>common.applyDecorators(common.SetMetadata(SKILL_SOURCE_PROVIDER, provider), common.SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
2799
2849
 
@@ -4159,6 +4209,76 @@ function resolveSandboxTerminalAdapter(sandbox) {
4159
4209
  return isSandboxTerminalAdapter(candidate) ? candidate : null;
4160
4210
  }
4161
4211
 
4212
+ const SANDBOX_RUNTIME_PROVIDER = 'SANDBOX_RUNTIME_PROVIDER';
4213
+ /** Marks a built-in or system-plugin class as a named Sandbox Runtime Provider strategy. */ const SandboxRuntimeProviderStrategy = (provider)=>common.applyDecorators(common.SetMetadata(SANDBOX_RUNTIME_PROVIDER, provider), common.SetMetadata(STRATEGY_META_KEY, SANDBOX_RUNTIME_PROVIDER));
4214
+
4215
+ var SandboxRuntimeProviderRegistry_1;
4216
+ /** Discovers Runtime Provider strategies and rejects organization-scoped executable infrastructure. */ exports.SandboxRuntimeProviderRegistry = SandboxRuntimeProviderRegistry_1 = class SandboxRuntimeProviderRegistry extends BaseStrategyRegistry {
4217
+ upsert(instance) {
4218
+ const target = resolveStrategyMetadataTarget(instance);
4219
+ if (!target) {
4220
+ return;
4221
+ }
4222
+ if (!this.reflector.get(SANDBOX_RUNTIME_PROVIDER, target)) {
4223
+ return;
4224
+ }
4225
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
4226
+ var _this_reflector_get;
4227
+ const scope = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE;
4228
+ if (pluginName && scope !== SYSTEM_GLOBAL_SCOPE) {
4229
+ this.runtimeLogger.warn(`Ignored Sandbox Runtime Provider from non-system plugin ${pluginName} in scope ${scope}.`);
4230
+ return;
4231
+ }
4232
+ super.upsert(instance);
4233
+ }
4234
+ constructor(discoveryService, reflector){
4235
+ super(SANDBOX_RUNTIME_PROVIDER, discoveryService, reflector);
4236
+ this.runtimeLogger = new common.Logger(SandboxRuntimeProviderRegistry_1.name);
4237
+ }
4238
+ };
4239
+ exports.SandboxRuntimeProviderRegistry = SandboxRuntimeProviderRegistry_1 = __decorate([
4240
+ common.Injectable(),
4241
+ __metadata("design:paramtypes", [
4242
+ core.DiscoveryService,
4243
+ core.Reflector
4244
+ ])
4245
+ ], exports.SandboxRuntimeProviderRegistry);
4246
+
4247
+ const SANDBOX_WORKSPACE_MAPPER = 'SANDBOX_WORKSPACE_MAPPER';
4248
+ /** Associates a workspace path mapper with a named Runtime Provider strategy. */ const SandboxWorkspaceMapperStrategy = (provider)=>common.applyDecorators(common.SetMetadata(SANDBOX_WORKSPACE_MAPPER, provider), common.SetMetadata(STRATEGY_META_KEY, SANDBOX_WORKSPACE_MAPPER));
4249
+
4250
+ var SandboxWorkspaceMapperRegistry_1;
4251
+ /** Discovers Provider path mappers while enforcing the same system-level trust boundary as Providers. */ exports.SandboxWorkspaceMapperRegistry = SandboxWorkspaceMapperRegistry_1 = class SandboxWorkspaceMapperRegistry extends BaseStrategyRegistry {
4252
+ upsert(instance) {
4253
+ const target = resolveStrategyMetadataTarget(instance);
4254
+ if (!target) {
4255
+ return;
4256
+ }
4257
+ if (!this.reflector.get(SANDBOX_WORKSPACE_MAPPER, target)) {
4258
+ return;
4259
+ }
4260
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
4261
+ var _this_reflector_get;
4262
+ const scope = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE;
4263
+ if (pluginName && scope !== SYSTEM_GLOBAL_SCOPE) {
4264
+ this.mapperLogger.warn(`Ignored Sandbox Workspace Mapper from non-system plugin ${pluginName} in scope ${scope}.`);
4265
+ return;
4266
+ }
4267
+ super.upsert(instance);
4268
+ }
4269
+ constructor(discoveryService, reflector){
4270
+ super(SANDBOX_WORKSPACE_MAPPER, discoveryService, reflector);
4271
+ this.mapperLogger = new common.Logger(SandboxWorkspaceMapperRegistry_1.name);
4272
+ }
4273
+ };
4274
+ exports.SandboxWorkspaceMapperRegistry = SandboxWorkspaceMapperRegistry_1 = __decorate([
4275
+ common.Injectable(),
4276
+ __metadata("design:paramtypes", [
4277
+ core.DiscoveryService,
4278
+ core.Reflector
4279
+ ])
4280
+ ], exports.SandboxWorkspaceMapperRegistry);
4281
+
4162
4282
  const MANAGED_CONNECTION_REGISTRY_TOKEN = 'XPERT_MANAGED_CONNECTION_REGISTRY';
4163
4283
  const CONNECTION_COMMAND_ROUTER_TOKEN = 'XPERT_CONNECTION_COMMAND_ROUTER';
4164
4284
 
@@ -4818,8 +4938,11 @@ exports.RequestContext = RequestContext;
4818
4938
  exports.RequirePermissionOperation = RequirePermissionOperation;
4819
4939
  exports.RerankModel = RerankModel;
4820
4940
  exports.RetrieverStrategy = RetrieverStrategy;
4941
+ exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
4821
4942
  exports.SANDBOX_PROVIDER = SANDBOX_PROVIDER;
4943
+ exports.SANDBOX_RUNTIME_PROVIDER = SANDBOX_RUNTIME_PROVIDER;
4822
4944
  exports.SANDBOX_SHELL_TIMEOUT_LIMITS_SEC = SANDBOX_SHELL_TIMEOUT_LIMITS_SEC;
4945
+ exports.SANDBOX_WORKSPACE_MAPPER = SANDBOX_WORKSPACE_MAPPER;
4823
4946
  exports.SKILL_SOURCE_PROVIDER = SKILL_SOURCE_PROVIDER;
4824
4947
  exports.SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN = SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN;
4825
4948
  exports.SPEECH_TO_TEXT_SERVICE_TOKEN = SPEECH_TO_TEXT_SERVICE_TOKEN;
@@ -4828,7 +4951,11 @@ exports.SSO_BINDING_PERMISSION_SERVICE_TOKEN = SSO_BINDING_PERMISSION_SERVICE_TO
4828
4951
  exports.SSO_PROVIDER = SSO_PROVIDER;
4829
4952
  exports.STRATEGY_META_KEY = STRATEGY_META_KEY;
4830
4953
  exports.SYSTEM_GLOBAL_SCOPE = SYSTEM_GLOBAL_SCOPE;
4954
+ exports.SandboxJobRuntimeError = SandboxJobRuntimeError;
4955
+ exports.SandboxJobsRuntimeCapability = SandboxJobsRuntimeCapability;
4831
4956
  exports.SandboxProviderStrategy = SandboxProviderStrategy;
4957
+ exports.SandboxRuntimeProviderStrategy = SandboxRuntimeProviderStrategy;
4958
+ exports.SandboxWorkspaceMapperStrategy = SandboxWorkspaceMapperStrategy;
4832
4959
  exports.SkillSourceProviderStrategy = SkillSourceProviderStrategy;
4833
4960
  exports.Speech2TextChatModel = Speech2TextChatModel;
4834
4961
  exports.SpeechToTextModel = SpeechToTextModel;
@@ -4881,9 +5008,11 @@ exports.getRequiredPermissionOperation = getRequiredPermissionOperation;
4881
5008
  exports.getTenantGlobalScopeKey = getTenantGlobalScopeKey;
4882
5009
  exports.isRemoteFile = isRemoteFile;
4883
5010
  exports.isSandboxBackend = isSandboxBackend;
5011
+ exports.isSandboxJobRuntimeError = isSandboxJobRuntimeError;
4884
5012
  exports.isSandboxManagedServiceAdapter = isSandboxManagedServiceAdapter;
4885
5013
  exports.isSandboxServiceProxyAdapter = isSandboxServiceProxyAdapter;
4886
5014
  exports.isSandboxTerminalAdapter = isSandboxTerminalAdapter;
5015
+ exports.isStrategyInstance = isStrategyInstance;
4887
5016
  exports.isStructuredMessageType = isStructuredMessageType;
4888
5017
  exports.isTenantGlobalScopeKey = isTenantGlobalScopeKey;
4889
5018
  exports.loadYamlFile = loadYamlFile;
@@ -4899,6 +5028,7 @@ exports.resolveSandboxExecutionOptions = resolveSandboxExecutionOptions;
4899
5028
  exports.resolveSandboxManagedServiceAdapter = resolveSandboxManagedServiceAdapter;
4900
5029
  exports.resolveSandboxServiceProxyAdapter = resolveSandboxServiceProxyAdapter;
4901
5030
  exports.resolveSandboxTerminalAdapter = resolveSandboxTerminalAdapter;
5031
+ exports.resolveStrategyMetadataTarget = resolveStrategyMetadataTarget;
4902
5032
  exports.resolveTenantGlobalScopeKey = resolveTenantGlobalScopeKey;
4903
5033
  exports.runWithRequestContext = runWithRequestContext;
4904
5034
  exports.secondsToMilliseconds = secondsToMilliseconds;
package/index.esm.js CHANGED
@@ -510,10 +510,12 @@ class BaseStrategyRegistry {
510
510
  }
511
511
  }
512
512
  upsert(instance) {
513
- const type = this.reflector.get(this.strategyKey, instance.constructor);
513
+ const target = resolveStrategyMetadataTarget(instance);
514
+ if (!target) {
515
+ return;
516
+ }
517
+ const type = this.reflector.get(this.strategyKey, target);
514
518
  if (type) {
515
- var _instance_metatype;
516
- const target = (_instance_metatype = instance.metatype) != null ? _instance_metatype : instance.constructor;
517
519
  const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
518
520
  var _this_reflector_get;
519
521
  const organizationId = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : pluginName ? GLOBAL_ORGANIZATION_SCOPE : BUILTIN_GLOBAL_SCOPE;
@@ -621,6 +623,23 @@ __decorate([
621
623
  Inject(StrategyBus),
622
624
  __metadata("design:type", StrategyBus)
623
625
  ], BaseStrategyRegistry.prototype, "bus", void 0);
626
+ /** Returns whether a discovered provider can carry decorator metadata. */ function isStrategyInstance(instance) {
627
+ return typeof instance === 'object' && instance !== null || typeof instance === 'function';
628
+ }
629
+ /** Resolves the class used for plugin and organization metadata without reflecting over primitive provider values. */ function resolveStrategyMetadataTarget(instance) {
630
+ if (!isStrategyInstance(instance)) {
631
+ return null;
632
+ }
633
+ if (typeof instance === 'function') {
634
+ return instance;
635
+ }
636
+ const metatype = instance.metatype;
637
+ if (typeof metatype === 'function') {
638
+ return metatype;
639
+ }
640
+ const constructor = instance.constructor;
641
+ return typeof constructor === 'function' ? constructor : null;
642
+ }
624
643
 
625
644
  let IntegrationStrategyRegistry = class IntegrationStrategyRegistry extends BaseStrategyRegistry {
626
645
  constructor(discoveryService, reflector){
@@ -2775,6 +2794,37 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2775
2794
  description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2776
2795
  });
2777
2796
 
2797
+ /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
2798
+ 'SANDBOX_ACTION_UNAVAILABLE',
2799
+ 'SANDBOX_ACTION_INVALID',
2800
+ 'SANDBOX_PROFILE_UNAVAILABLE',
2801
+ 'SANDBOX_RUNTIME_UNAVAILABLE',
2802
+ 'SANDBOX_VERSION_MISMATCH',
2803
+ 'SANDBOX_CAPACITY_UNAVAILABLE',
2804
+ 'SANDBOX_START_FAILED',
2805
+ 'BROWSER_LAUNCH_FAILED',
2806
+ 'EXPORT_TIMEOUT',
2807
+ 'EXPORT_OOM',
2808
+ 'EXPORT_INPUT_INVALID',
2809
+ 'EXPORT_OUTPUT_INVALID',
2810
+ 'SANDBOX_CANCELLED'
2811
+ ];
2812
+ /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2813
+ constructor(code, message, retryable, jobId){
2814
+ super(message);
2815
+ this.code = code;
2816
+ this.retryable = retryable;
2817
+ this.jobId = jobId;
2818
+ this.name = 'SandboxJobRuntimeError';
2819
+ }
2820
+ }
2821
+ /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2822
+ return error instanceof SandboxJobRuntimeError;
2823
+ }
2824
+ /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2825
+ description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
2826
+ });
2827
+
2778
2828
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
2779
2829
  const SkillSourceProviderStrategy = (provider)=>applyDecorators(SetMetadata(SKILL_SOURCE_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
2780
2830
 
@@ -4140,6 +4190,76 @@ function resolveSandboxTerminalAdapter(sandbox) {
4140
4190
  return isSandboxTerminalAdapter(candidate) ? candidate : null;
4141
4191
  }
4142
4192
 
4193
+ const SANDBOX_RUNTIME_PROVIDER = 'SANDBOX_RUNTIME_PROVIDER';
4194
+ /** Marks a built-in or system-plugin class as a named Sandbox Runtime Provider strategy. */ const SandboxRuntimeProviderStrategy = (provider)=>applyDecorators(SetMetadata(SANDBOX_RUNTIME_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SANDBOX_RUNTIME_PROVIDER));
4195
+
4196
+ var SandboxRuntimeProviderRegistry_1;
4197
+ /** Discovers Runtime Provider strategies and rejects organization-scoped executable infrastructure. */ let SandboxRuntimeProviderRegistry = SandboxRuntimeProviderRegistry_1 = class SandboxRuntimeProviderRegistry extends BaseStrategyRegistry {
4198
+ upsert(instance) {
4199
+ const target = resolveStrategyMetadataTarget(instance);
4200
+ if (!target) {
4201
+ return;
4202
+ }
4203
+ if (!this.reflector.get(SANDBOX_RUNTIME_PROVIDER, target)) {
4204
+ return;
4205
+ }
4206
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
4207
+ var _this_reflector_get;
4208
+ const scope = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE;
4209
+ if (pluginName && scope !== SYSTEM_GLOBAL_SCOPE) {
4210
+ this.runtimeLogger.warn(`Ignored Sandbox Runtime Provider from non-system plugin ${pluginName} in scope ${scope}.`);
4211
+ return;
4212
+ }
4213
+ super.upsert(instance);
4214
+ }
4215
+ constructor(discoveryService, reflector){
4216
+ super(SANDBOX_RUNTIME_PROVIDER, discoveryService, reflector);
4217
+ this.runtimeLogger = new Logger(SandboxRuntimeProviderRegistry_1.name);
4218
+ }
4219
+ };
4220
+ SandboxRuntimeProviderRegistry = SandboxRuntimeProviderRegistry_1 = __decorate([
4221
+ Injectable(),
4222
+ __metadata("design:paramtypes", [
4223
+ DiscoveryService,
4224
+ Reflector
4225
+ ])
4226
+ ], SandboxRuntimeProviderRegistry);
4227
+
4228
+ const SANDBOX_WORKSPACE_MAPPER = 'SANDBOX_WORKSPACE_MAPPER';
4229
+ /** Associates a workspace path mapper with a named Runtime Provider strategy. */ const SandboxWorkspaceMapperStrategy = (provider)=>applyDecorators(SetMetadata(SANDBOX_WORKSPACE_MAPPER, provider), SetMetadata(STRATEGY_META_KEY, SANDBOX_WORKSPACE_MAPPER));
4230
+
4231
+ var SandboxWorkspaceMapperRegistry_1;
4232
+ /** Discovers Provider path mappers while enforcing the same system-level trust boundary as Providers. */ let SandboxWorkspaceMapperRegistry = SandboxWorkspaceMapperRegistry_1 = class SandboxWorkspaceMapperRegistry extends BaseStrategyRegistry {
4233
+ upsert(instance) {
4234
+ const target = resolveStrategyMetadataTarget(instance);
4235
+ if (!target) {
4236
+ return;
4237
+ }
4238
+ if (!this.reflector.get(SANDBOX_WORKSPACE_MAPPER, target)) {
4239
+ return;
4240
+ }
4241
+ const pluginName = this.reflector.get(PLUGIN_METADATA_KEY, target);
4242
+ var _this_reflector_get;
4243
+ const scope = (_this_reflector_get = this.reflector.get(ORGANIZATION_METADATA_KEY, target)) != null ? _this_reflector_get : BUILTIN_GLOBAL_SCOPE;
4244
+ if (pluginName && scope !== SYSTEM_GLOBAL_SCOPE) {
4245
+ this.mapperLogger.warn(`Ignored Sandbox Workspace Mapper from non-system plugin ${pluginName} in scope ${scope}.`);
4246
+ return;
4247
+ }
4248
+ super.upsert(instance);
4249
+ }
4250
+ constructor(discoveryService, reflector){
4251
+ super(SANDBOX_WORKSPACE_MAPPER, discoveryService, reflector);
4252
+ this.mapperLogger = new Logger(SandboxWorkspaceMapperRegistry_1.name);
4253
+ }
4254
+ };
4255
+ SandboxWorkspaceMapperRegistry = SandboxWorkspaceMapperRegistry_1 = __decorate([
4256
+ Injectable(),
4257
+ __metadata("design:paramtypes", [
4258
+ DiscoveryService,
4259
+ Reflector
4260
+ ])
4261
+ ], SandboxWorkspaceMapperRegistry);
4262
+
4143
4263
  const MANAGED_CONNECTION_REGISTRY_TOKEN = 'XPERT_MANAGED_CONNECTION_REGISTRY';
4144
4264
  const CONNECTION_COMMAND_ROUTER_TOKEN = 'XPERT_CONNECTION_COMMAND_ROUTER';
4145
4265
 
@@ -4681,4 +4801,4 @@ CollaborationDocumentProviderRegistry = __decorate([
4681
4801
  ])
4682
4802
  ], CollaborationDocumentProviderRegistry);
4683
4803
 
4684
- 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, 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_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WORKSPACE_FILES_SOURCE, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_RUNTIME_CAPABILITIES_TOKEN, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, buildSandboxTimeoutMessage, calcTokenUsage, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveTenantGlobalScopeKey, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
4804
+ 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, 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, buildSandboxTimeoutMessage, calcTokenUsage, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, 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.11",
3
+ "version": "3.15.12",
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.11",
20
+ "@xpert-ai/contracts": "3.15.12",
21
21
  "express": "^4.22.1",
22
22
  "js-tiktoken": "^1.0.21"
23
23
  },
@@ -7,6 +7,7 @@ export declare function createRuntimeCapability<T>(id: string, options?: {
7
7
  description?: string;
8
8
  }): RuntimeCapabilityKey<T>;
9
9
  export interface RuntimeCapabilityRegistry {
10
+ register<T>(key: RuntimeCapabilityKey<T> | string, implementation: T): this;
10
11
  has<T>(key: RuntimeCapabilityKey<T> | string): boolean;
11
12
  get<T>(key: RuntimeCapabilityKey<T> | string): T | undefined;
12
13
  require<T>(key: RuntimeCapabilityKey<T> | string): T;
@@ -15,6 +15,15 @@ export type PluginJobProcessorMetadata = {
15
15
  jobName: string;
16
16
  concurrency?: number;
17
17
  };
18
+ /** Physical worker pool chosen independently from a plugin's logical queue name. */
19
+ export type ManagedQueueExecutionPool = 'default' | 'sandbox-browser';
20
+ /** Readiness signal used to reject work before it is stranded in an unconsumed pool. */
21
+ export type ManagedQueueExecutionPoolHealth = {
22
+ executionPool: ManagedQueueExecutionPool;
23
+ available: boolean;
24
+ workerCount: number;
25
+ warning?: string;
26
+ };
18
27
  export type ManagedQueueRemoveOption = boolean | number | {
19
28
  age?: number;
20
29
  count?: number;
@@ -47,12 +56,15 @@ export type ManagedQueueEnqueueInput<TPayload = unknown> = {
47
56
  backoffMs?: ManagedQueueBackoffInput;
48
57
  removeOnComplete?: ManagedQueueRemoveOption;
49
58
  removeOnFail?: ManagedQueueRemoveOption;
59
+ /** Defaults to `default`; browser-heavy jobs must explicitly select the isolated pool. */
60
+ executionPool?: ManagedQueueExecutionPool;
50
61
  };
51
62
  export type ManagedQueueEnqueueResult = {
52
63
  jobId: string;
53
64
  };
54
65
  export type ManagedQueueCancelInput = {
55
66
  jobId: string;
67
+ executionPool?: ManagedQueueExecutionPool;
56
68
  };
57
69
  export type ManagedQueueCancelResult = {
58
70
  success: boolean;
@@ -100,7 +112,12 @@ export interface ManagedQueueService {
100
112
  cancel(input: ManagedQueueCancelInput): Promise<ManagedQueueCancelResult>;
101
113
  getJob<TPayload = unknown>(input: {
102
114
  jobId: string;
115
+ executionPool?: ManagedQueueExecutionPool;
103
116
  }): Promise<ManagedQueueJobSnapshot<TPayload> | null>;
117
+ /** Reports active BullMQ consumers for a physical execution pool. */
118
+ getExecutionPoolHealth(input: {
119
+ executionPool: ManagedQueueExecutionPool;
120
+ }): Promise<ManagedQueueExecutionPoolHealth>;
104
121
  getRedis(): Promise<ManagedQueueRedis>;
105
122
  }
106
123
  export declare function PluginJobProcessor(options: PluginJobProcessorOptions): ClassDecorator;
@@ -43,6 +43,10 @@ export type ArtifactVersionInput = {
43
43
  export type CreateArtifactVersionInput = ArtifactVersionInput & {
44
44
  artifactId: string;
45
45
  };
46
+ /** Idempotently creates or reuses one immutable Artifact content version. */
47
+ export type EnsureArtifactVersionInput = CreateArtifactVersionInput & {
48
+ idempotencyKey: string;
49
+ };
46
50
  /** Access policy requested for an Artifact link. */
47
51
  export type ArtifactLinkAccessInput = {
48
52
  mode: ArtifactAccessMode;
@@ -66,6 +70,10 @@ export type CreateArtifactLinkInput = {
66
70
  presentation?: ArtifactLinkPresentationInput | null;
67
71
  metadata?: Record<string, unknown> | null;
68
72
  };
73
+ /** Stable plugin-owned slot for one active durable share policy. */
74
+ export type ArtifactShareInput = CreateArtifactLinkInput & {
75
+ shareKey: string;
76
+ };
69
77
  /** Creates a short-lived signed preview link; never use this as a durable share URL. */
70
78
  export type CreateSignedArtifactPreviewLinkInput = Omit<CreateArtifactLinkInput, 'access'> & {
71
79
  ttlSeconds?: number | null;
@@ -76,6 +84,7 @@ export type ArtifactVersionRecord = {
76
84
  artifactId: string;
77
85
  versionNumber: number;
78
86
  status: ArtifactVersionStatus;
87
+ idempotencyKey?: string | null;
79
88
  sourceVersionId?: string | null;
80
89
  checksum?: string | null;
81
90
  mimeType: string;
@@ -84,6 +93,8 @@ export type ArtifactVersionRecord = {
84
93
  description?: string | null;
85
94
  size?: number | null;
86
95
  sha256?: string | null;
96
+ workspaceFileRef?: WorkspacePortableFileReference | null;
97
+ metadata?: Record<string, unknown> | null;
87
98
  createdAt?: string | Date;
88
99
  };
89
100
  /** Durable Artifact container returned to plugins. */
@@ -99,6 +110,7 @@ export type ArtifactRecord = ArtifactScopeInput & {
99
110
  description?: string | null;
100
111
  currentVersionId?: string | null;
101
112
  currentVersion?: ArtifactVersionRecord | null;
113
+ metadata?: Record<string, unknown> | null;
102
114
  createdAt?: string | Date;
103
115
  updatedAt?: string | Date;
104
116
  };
@@ -107,6 +119,7 @@ export type ArtifactLinkRecord = ArtifactScopeInput & {
107
119
  id: string;
108
120
  artifactId: string;
109
121
  artifactVersionId?: string | null;
122
+ shareKey?: string | null;
110
123
  versionMode: ArtifactLinkVersionMode;
111
124
  slug: string;
112
125
  publicUrl: string;
@@ -120,6 +133,7 @@ export type ArtifactLinkRecord = ArtifactScopeInput & {
120
133
  disposition: ArtifactLinkDisposition;
121
134
  allowDownload: boolean;
122
135
  safeHtmlProfile?: ArtifactSafeHtmlProfile | null;
136
+ metadata?: Record<string, unknown> | null;
123
137
  createdAt?: string | Date;
124
138
  updatedAt?: string | Date;
125
139
  artifact?: ArtifactRecord;
@@ -140,6 +154,27 @@ export type ListArtifactsResult = {
140
154
  page: number;
141
155
  pageSize: number;
142
156
  };
157
+ export type FindArtifactBySourceInput = Pick<ArtifactSourceInput, 'pluginName' | 'resourceType' | 'resourceId'> & {
158
+ includeDeleted?: boolean | null;
159
+ };
160
+ export type ListArtifactVersionsInput = {
161
+ artifactId: string;
162
+ idempotencyKey?: string | null;
163
+ status?: ArtifactVersionStatus | 'all' | null;
164
+ };
165
+ export type EnsureArtifactVersionResult = {
166
+ version: ArtifactVersionRecord;
167
+ outcome: 'created' | 'reused';
168
+ };
169
+ export type ArtifactShareKeyInput = {
170
+ artifactId: string;
171
+ shareKey: string;
172
+ };
173
+ export type EnsureArtifactShareResult = {
174
+ link: ArtifactLinkRecord;
175
+ outcome: 'created' | 'reused' | 'replaced';
176
+ replacedLinkId?: string | null;
177
+ };
143
178
  /** Mutable parts of an Artifact link; content versions remain immutable. */
144
179
  export type UpdateArtifactLinkAccessInput = {
145
180
  access?: ArtifactLinkAccessInput | null;
@@ -150,12 +185,18 @@ export type UpdateArtifactLinkAccessInput = {
150
185
  /** Platform runtime capability exposed to plugins for managing generated Artifacts. */
151
186
  export interface ArtifactsApi {
152
187
  createArtifact(input: CreateArtifactInput): Promise<ArtifactRecord>;
188
+ findArtifactBySource(input: FindArtifactBySourceInput): Promise<ArtifactRecord | null>;
153
189
  createArtifactVersion(input: CreateArtifactVersionInput): Promise<ArtifactVersionRecord>;
190
+ listArtifactVersions(input: ListArtifactVersionsInput): Promise<ArtifactVersionRecord[]>;
191
+ ensureArtifactVersion(input: EnsureArtifactVersionInput): Promise<EnsureArtifactVersionResult>;
154
192
  getArtifact(idOrSlug: string): Promise<ArtifactRecord>;
155
193
  listArtifacts(input?: ListArtifactsInput): Promise<ListArtifactsResult>;
156
194
  archiveArtifact(idOrSlug: string): Promise<ArtifactRecord>;
157
195
  deleteArtifact(idOrSlug: string): Promise<ArtifactRecord>;
158
196
  createArtifactLink(input: CreateArtifactLinkInput): Promise<ArtifactLinkRecord>;
197
+ getArtifactShare(input: ArtifactShareKeyInput): Promise<ArtifactLinkRecord | null>;
198
+ ensureArtifactShare(input: ArtifactShareInput): Promise<EnsureArtifactShareResult>;
199
+ revokeArtifactShare(input: ArtifactShareKeyInput): Promise<ArtifactLinkRecord | null>;
159
200
  createSignedPreviewLink(input: CreateSignedArtifactPreviewLinkInput): Promise<ArtifactLinkRecord>;
160
201
  updateArtifactLinkAccess(idOrSlug: string, patch: UpdateArtifactLinkAccessInput): Promise<ArtifactLinkRecord>;
161
202
  revokeArtifactLink(idOrSlug: string): Promise<ArtifactLinkRecord>;
@@ -2,3 +2,4 @@ export * from './knowledgebase';
2
2
  export * from './knowledgebase-documents';
3
3
  export * from './artifacts';
4
4
  export * from './workspace-files';
5
+ export * from './sandbox-jobs';
@@ -0,0 +1,142 @@
1
+ import type { JSONValue } from '@xpert-ai/contracts';
2
+ import type { WorkspaceFileScope, WorkspacePortableFileReference } from './workspace-files';
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"];
5
+ export type SandboxJobErrorCode = (typeof SANDBOX_JOB_ERROR_CODES)[number];
6
+ /** Persisted lifecycle states for a generic isolated background execution. */
7
+ export type SandboxJobStatus = 'waiting' | 'starting' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'lost';
8
+ /** Portable Workspace Files input materialized under `/workspace/input`. */
9
+ export type SandboxJobFileInput = {
10
+ /** Tenant-scoped portable reference; raw bytes never enter queue state. */
11
+ reference: WorkspacePortableFileReference;
12
+ /** Safe relative path below `/workspace/input`. */
13
+ targetPath: string;
14
+ /** Expected immutable byte length checked during materialization. */
15
+ size: number;
16
+ /** Expected lowercase SHA-256 checked during materialization. */
17
+ sha256: string;
18
+ };
19
+ /** Declares one output to validate and persist back into Workspace Files. */
20
+ export type SandboxJobOutputRequest = {
21
+ path: string;
22
+ originalName: string;
23
+ mimeType: string;
24
+ destination: WorkspaceFileScope & {
25
+ folder: string;
26
+ };
27
+ };
28
+ /** Tenant and business ownership recorded for authorization, audit, and cleanup. */
29
+ export type SandboxJobScope = {
30
+ tenantId: string;
31
+ organizationId?: string | null;
32
+ userId?: string | null;
33
+ pluginName: string;
34
+ businessResourceType: string;
35
+ businessResourceId: string;
36
+ };
37
+ /** Action-oriented request accepted from a plugin background handler. */
38
+ export type SandboxJobRunInput = {
39
+ /** Optional caller-known UUID used when cancellation must be possible while run() is awaiting completion. */
40
+ jobId?: string;
41
+ action: string;
42
+ actionVersion: string;
43
+ /** Stable tenant-scoped key combining business identity and immutable input checksum. */
44
+ idempotencyKey: string;
45
+ scope: SandboxJobScope;
46
+ /** Small structured request; file bytes must be supplied through `files`. */
47
+ payload: JSONValue;
48
+ files?: SandboxJobFileInput[];
49
+ outputs: SandboxJobOutputRequest[];
50
+ /** Soft execution limit capped by the Runtime Definition's hard deadline. */
51
+ timeoutMs?: number;
52
+ };
53
+ /** Validated output evidence returned as a portable Workspace Files reference. */
54
+ export type SandboxJobOutput = {
55
+ path: string;
56
+ originalName: string;
57
+ mimeType: string;
58
+ size: number;
59
+ sha256: string;
60
+ reference: WorkspacePortableFileReference;
61
+ fileUrl?: string;
62
+ workspacePath?: string;
63
+ };
64
+ /** Provider-neutral persisted view of a Sandbox Job and its runtime evidence. */
65
+ export type SandboxJobSnapshot = {
66
+ id: string;
67
+ runtimeProfile: string;
68
+ sandboxRuntimeVersion: string;
69
+ action: string;
70
+ actionVersion: string;
71
+ status: SandboxJobStatus;
72
+ /** Attempt number; a new failed-job attempt may select a newly healthy Binding. */
73
+ attempt: number;
74
+ /** Provider and Binding are persisted so cleanup never depends on current selection. */
75
+ provider?: string | null;
76
+ runtimeBindingId?: string | null;
77
+ /** Opaque Provider identity used for reattachment and idempotent destruction. */
78
+ runtimeRef?: string | null;
79
+ artifactDigest?: string | null;
80
+ /** @deprecated Use runtimeRef. Kept for one compatibility cycle. */
81
+ containerRef?: string | null;
82
+ outputs: SandboxJobOutput[];
83
+ errorCode?: SandboxJobErrorCode | null;
84
+ errorMessage?: string | null;
85
+ createdAt?: Date | string | null;
86
+ startedAt?: Date | string | null;
87
+ finishedAt?: Date | string | null;
88
+ };
89
+ /** Successful `run()` result; failed executions reject with SandboxJobRuntimeError. */
90
+ export type SandboxJobRunResult = SandboxJobSnapshot & {
91
+ status: 'succeeded';
92
+ };
93
+ /** Aggregated readiness of an Action, Runtime Definition, Worker, Binding, and Provider. */
94
+ export type SandboxJobActionHealth = {
95
+ pluginName: string;
96
+ action: string;
97
+ actionVersion: string;
98
+ runtimeProfile?: string;
99
+ sandboxRuntimeVersion?: string;
100
+ provider?: string;
101
+ runtimeBindingId?: string;
102
+ artifactDigest?: string;
103
+ available: boolean;
104
+ reason?: 'ACTION_MISSING' | 'ACTION_INVALID' | 'PROFILE_MISSING' | 'VERSION_MISMATCH' | 'RUNTIME_UNBOUND' | 'PROVIDER_UNAVAILABLE' | 'PROFILE_UNHEALTHY';
105
+ message?: string;
106
+ manifest?: Record<string, string>;
107
+ };
108
+ /**
109
+ * Plugin-facing API for registered, structured Sandbox Actions.
110
+ *
111
+ * Callers choose only an Action and its version; images, commands, entrypoints,
112
+ * environment variables, and Provider options are resolved and enforced by Core.
113
+ */
114
+ export interface SandboxJobsApi {
115
+ /** Starts, reattaches, or reuses a successful execution by tenant-scoped idempotency key. */
116
+ run(input: SandboxJobRunInput): Promise<SandboxJobRunResult>;
117
+ /** Cancels the logical Job and terminates its active Runtime when one exists. */
118
+ cancel(input: {
119
+ jobId: string;
120
+ }): Promise<SandboxJobSnapshot>;
121
+ /** Returns the active tenant's persisted Job snapshot, or null when inaccessible or absent. */
122
+ getJob(input: {
123
+ jobId: string;
124
+ }): Promise<SandboxJobSnapshot | null>;
125
+ /** Checks readiness before a product exposes or enqueues a browser-backed operation. */
126
+ getActionHealth(input: {
127
+ pluginName: string;
128
+ action: string;
129
+ actionVersion: string;
130
+ }): Promise<SandboxJobActionHealth>;
131
+ }
132
+ /** Error carrying retry policy and Job identity across plugin queue handlers. */
133
+ export declare class SandboxJobRuntimeError extends Error {
134
+ readonly code: SandboxJobErrorCode;
135
+ readonly retryable: boolean;
136
+ readonly jobId?: string;
137
+ constructor(code: SandboxJobErrorCode, message: string, retryable: boolean, jobId?: string);
138
+ }
139
+ /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */
140
+ export declare function isSandboxJobRuntimeError(error: unknown): error is SandboxJobRuntimeError;
141
+ /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */
142
+ export declare const SandboxJobsRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<SandboxJobsApi>;
@@ -6,6 +6,12 @@ export * from './sandbox.decorator';
6
6
  export * from './sandbox.interface';
7
7
  export * from './sandbox.registry';
8
8
  export * from './terminal';
9
+ export * from './runtime-provider';
10
+ export * from './runtime-provider.decorator';
11
+ export * from './runtime-provider.registry';
12
+ export * from './workspace-mapper';
13
+ export * from './workspace-mapper.decorator';
14
+ export * from './workspace-mapper.registry';
9
15
  export * from './sandbox.interface';
10
16
  export * from './sandbox.decorator';
11
17
  export * from './sandbox.registry';
@@ -155,6 +155,8 @@ export interface ExecuteResponse {
155
155
  truncated: boolean;
156
156
  /** Whether the command exceeded its timeout and was terminated */
157
157
  timedOut?: boolean;
158
+ /** Provider-observed container/process termination reason. */
159
+ terminationReason?: 'oom' | 'deadline' | 'cancelled' | 'container-died';
158
160
  }
159
161
  /**
160
162
  * Standardized error codes for file upload/download operations.
@@ -346,6 +348,8 @@ export interface SandboxBackendProtocol extends BackendProtocol {
346
348
  readonly id: string;
347
349
  /** Canonical sandbox environment identifier bound to this backend */
348
350
  readonly environmentId?: string | null;
351
+ /** Best-effort immediate termination for an ephemeral job sandbox. */
352
+ terminate?(): MaybePromise<void>;
349
353
  }
350
354
  export declare function isSandboxBackend(backend: unknown): backend is SandboxBackendProtocol;
351
355
  export declare function resolveSandboxBackend(sandbox: TSandboxConfigurable | SandboxBackendProtocol | null | undefined | unknown): SandboxBackendProtocol | null;
@@ -0,0 +1,181 @@
1
+ /** Per-execution limits applied to the Runtime Definition's fixed Runner command. */
2
+ export type SandboxRuntimeExecutionOptions = {
3
+ timeoutMs?: number;
4
+ maxOutputBytes?: number;
5
+ };
6
+ /** Provider-observed reason why a Runtime execution stopped without a normal exit. */
7
+ export type SandboxRuntimeTerminationReason = 'oom' | 'deadline' | 'cancelled' | 'runtime-died';
8
+ /** Normalized process result returned by every Sandbox Runtime implementation. */
9
+ export type SandboxRuntimeExecuteResponse = {
10
+ output: string;
11
+ exitCode: number | null;
12
+ truncated: boolean;
13
+ timedOut?: boolean;
14
+ terminationReason?: SandboxRuntimeTerminationReason;
15
+ };
16
+ /** Portable failure categories for Runtime workspace file operations. */
17
+ export type SandboxRuntimeFileOperationError = 'file_not_found' | 'permission_denied' | 'is_directory' | 'invalid_path';
18
+ export type SandboxRuntimeFileUploadResponse = {
19
+ path: string;
20
+ error: SandboxRuntimeFileOperationError | null;
21
+ };
22
+ export type SandboxRuntimeFileDownloadResponse = {
23
+ path: string;
24
+ content: Uint8Array | null;
25
+ error: SandboxRuntimeFileOperationError | null;
26
+ };
27
+ /** Resource policy requested by a provider-neutral Runtime Definition. */
28
+ export type SandboxRuntimeResources = {
29
+ memoryMb: number;
30
+ cpu: number;
31
+ shmSizeMb: number;
32
+ tempDiskMb: number;
33
+ };
34
+ /** Network access that a Provider must enforce for the Runtime instance. */
35
+ export type SandboxRuntimeNetworkPolicy = {
36
+ mode: 'none' | 'internal-only';
37
+ allowedHosts?: string[];
38
+ };
39
+ /** Mandatory process and filesystem hardening for a Runtime instance. */
40
+ export type SandboxRuntimeSecurity = {
41
+ runAsNonRoot: boolean;
42
+ readOnlyRootFilesystem: boolean;
43
+ noNewPrivileges: boolean;
44
+ dropCapabilities: 'all';
45
+ };
46
+ /** Isolation guarantees a Provider advertises before it can be selected. */
47
+ export type SandboxRuntimeProviderCapabilities = {
48
+ isolation: 'process' | 'hardened';
49
+ ephemeral: boolean;
50
+ resourceLimits: boolean;
51
+ networkPolicy: boolean;
52
+ readOnlyRootFilesystem: boolean;
53
+ };
54
+ /** Minimum Provider guarantees required by a Runtime Definition. */
55
+ export type SandboxRuntimeRequirements = SandboxRuntimeProviderCapabilities;
56
+ /**
57
+ * Provider-neutral execution profile published by the Sandbox Runtime Suite.
58
+ *
59
+ * Definitions select no image, engine, plugin, or host path. The platform owns
60
+ * the fixed Runner command and matches it to a compatible Provider Binding.
61
+ */
62
+ export type SandboxRuntimeDefinition = {
63
+ /** Stable profile identity referenced by Action manifests. */
64
+ name: string;
65
+ /** Trusted Runner Host argv. Plugin callers cannot override this value. */
66
+ command: readonly string[];
67
+ /** Runner Host protocol version shared with compatible Action Bundles. */
68
+ contractVersion: string;
69
+ /** Version of the Runtime Suite contents, independent of Provider version. */
70
+ sandboxRuntimeVersion: string;
71
+ timeoutMs: number;
72
+ hardDeadlineMs: number;
73
+ resources: SandboxRuntimeResources;
74
+ networkPolicy: SandboxRuntimeNetworkPolicy;
75
+ security: SandboxRuntimeSecurity;
76
+ requirements: SandboxRuntimeRequirements;
77
+ expectedManifest: Record<string, string>;
78
+ };
79
+ /** Immutable or provider-addressable runtime artifact selected by a Binding. */
80
+ export type SandboxRuntimeArtifact = {
81
+ kind: 'oci-image' | 'filesystem' | 'remote-runtime';
82
+ /** Provider-native immutable address; OCI production references must include a digest. */
83
+ reference: string;
84
+ /** Normalized digest retained separately as runtime evidence when available. */
85
+ digest?: string;
86
+ };
87
+ /** Provider-owned mapping from one Runtime Definition to an executable artifact. */
88
+ export type SandboxRuntimeBinding = {
89
+ /** Stable Provider-owned Binding identity persisted on every attempt. */
90
+ id: string;
91
+ runtimeProfile: string;
92
+ /** Must match the registered Provider strategy type. */
93
+ provider: string;
94
+ /** Lower values are preferred. Ties are resolved by provider and binding id. */
95
+ priority: number;
96
+ providerVersion: string;
97
+ artifact: SandboxRuntimeArtifact;
98
+ };
99
+ /** Result of verifying an engine, artifact, security guarantees, and Runtime manifest. */
100
+ export type SandboxRuntimeBindingHealth = {
101
+ available: boolean;
102
+ reason?: string;
103
+ manifest?: Record<string, string>;
104
+ };
105
+ /** Job-isolated storage roots passed to a Provider without exposing them to plugins. */
106
+ export type SandboxRuntimeVolume = {
107
+ /** Path visible to the Xpert process. */
108
+ serverRoot: string;
109
+ /** Path suitable for a provider-side bind mount. */
110
+ hostRoot: string;
111
+ };
112
+ /** Fully resolved policy used to create or reattach one ephemeral Job Runtime. */
113
+ export type SandboxRuntimeCreateOptions = {
114
+ tenantId: string;
115
+ workFor: {
116
+ type: 'job';
117
+ id: string;
118
+ };
119
+ definition: SandboxRuntimeDefinition;
120
+ binding: SandboxRuntimeBinding;
121
+ volume: SandboxRuntimeVolume;
122
+ ephemeral: true;
123
+ resources: SandboxRuntimeResources;
124
+ networkPolicy: SandboxRuntimeNetworkPolicy;
125
+ security: SandboxRuntimeSecurity;
126
+ hardDeadlineMs: number;
127
+ };
128
+ /** Persisted evidence required to destroy a Runtime even after Provider reload. */
129
+ export type SandboxRuntimeDestroyOptions = {
130
+ tenantId: string;
131
+ workFor: {
132
+ type: 'job';
133
+ id: string;
134
+ };
135
+ runtimeProfile: string;
136
+ runtimeBindingId: string;
137
+ artifact: SandboxRuntimeArtifact;
138
+ runtimeRef?: string | null;
139
+ };
140
+ /**
141
+ * Minimal execution surface required by Sandbox Jobs.
142
+ *
143
+ * Implementations must constrain `execute()` to the Definition's trusted Runner
144
+ * argv and must confine all file operations to `workspaceRoot`.
145
+ */
146
+ export interface SandboxRuntimeInstance {
147
+ readonly id: string;
148
+ /** Absolute path visible inside the isolated Runtime, normally `/workspace`. */
149
+ readonly workspaceRoot: string;
150
+ /** Executes Core-supplied argv after the Provider verifies the trusted Runner prefix. */
151
+ execute(argv: readonly string[], options?: SandboxRuntimeExecutionOptions): Promise<SandboxRuntimeExecuteResponse>;
152
+ /** Writes files only inside the instance workspace and returns per-path failures. */
153
+ uploadFiles(files: Array<[string, Uint8Array]>): Promise<SandboxRuntimeFileUploadResponse[]>;
154
+ /** Reads files only inside the instance workspace and returns per-path failures. */
155
+ downloadFiles(paths: string[]): Promise<SandboxRuntimeFileDownloadResponse[]>;
156
+ /** Best-effort immediate termination used by cancellation and deadline handling. */
157
+ terminate?(): Promise<void> | void;
158
+ }
159
+ /**
160
+ * Small Provider SPI for background Sandbox Jobs.
161
+ *
162
+ * This interface is intentionally independent from the interactive Agent Sandbox
163
+ * backend protocol. Providers are registered only by built-ins or system plugins,
164
+ * are selected from declared Bindings, and must make `destroy()` idempotent.
165
+ */
166
+ export interface ISandboxRuntimeProvider {
167
+ readonly type: string;
168
+ readonly version: string;
169
+ readonly capabilities: SandboxRuntimeProviderCapabilities;
170
+ /** Lists immutable artifacts this Provider can bind to Runtime Definitions. */
171
+ listBindings(): Promise<readonly SandboxRuntimeBinding[]> | readonly SandboxRuntimeBinding[];
172
+ /** Probes the engine and artifact without creating a business Job instance. */
173
+ getBindingHealth(input: {
174
+ definition: SandboxRuntimeDefinition;
175
+ binding: SandboxRuntimeBinding;
176
+ }): Promise<SandboxRuntimeBindingHealth>;
177
+ /** Creates or reattaches the unique Runtime instance for the supplied Job scope. */
178
+ create(options: SandboxRuntimeCreateOptions): Promise<SandboxRuntimeInstance>;
179
+ /** Idempotently reclaims a Runtime by persisted scope, Binding, and runtimeRef evidence. */
180
+ destroy(options: SandboxRuntimeDestroyOptions): Promise<void>;
181
+ }
@@ -0,0 +1,3 @@
1
+ export declare const SANDBOX_RUNTIME_PROVIDER = "SANDBOX_RUNTIME_PROVIDER";
2
+ /** Marks a built-in or system-plugin class as a named Sandbox Runtime Provider strategy. */
3
+ export declare const SandboxRuntimeProviderStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,9 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import { BaseStrategyRegistry } from '../strategy';
3
+ import type { ISandboxRuntimeProvider } from './runtime-provider';
4
+ /** Discovers Runtime Provider strategies and rejects organization-scoped executable infrastructure. */
5
+ export declare class SandboxRuntimeProviderRegistry extends BaseStrategyRegistry<ISandboxRuntimeProvider> {
6
+ private readonly runtimeLogger;
7
+ constructor(discoveryService: DiscoveryService, reflector: Reflector);
8
+ upsert(instance: unknown): void;
9
+ }
@@ -39,6 +39,30 @@ export type SandboxProviderCreateOptions = {
39
39
  * Tenant identifier
40
40
  */
41
41
  tenantId?: string;
42
+ /** Registered runtime profile. Providers resolve this to an immutable image. */
43
+ profile?: string;
44
+ /** Immutable image reference selected by the profile registry. */
45
+ image?: string;
46
+ /** Job sandboxes are never reused after the action completes. */
47
+ ephemeral?: boolean;
48
+ resources?: {
49
+ memoryMb?: number;
50
+ cpu?: number;
51
+ shmSizeMb?: number;
52
+ tempDiskMb?: number;
53
+ };
54
+ networkPolicy?: {
55
+ mode: 'none' | 'internal-only';
56
+ allowedHosts?: string[];
57
+ };
58
+ security?: {
59
+ runAsNonRoot: boolean;
60
+ readOnlyRootFilesystem: boolean;
61
+ noNewPrivileges: boolean;
62
+ dropCapabilities: 'all';
63
+ };
64
+ /** Provider-enforced absolute lifetime for the sandbox. */
65
+ hardDeadlineMs?: number;
42
66
  workFor: {
43
67
  type: TSandboxWorkForType;
44
68
  id: string;
@@ -53,6 +77,22 @@ export interface ISandboxProvider<T extends SandboxBackendProtocol = SandboxBack
53
77
  * @param options
54
78
  */
55
79
  create(options?: SandboxProviderCreateOptions): Promise<T>;
80
+ /** Destroy an ephemeral sandbox by its stable work identity after process loss or cancellation. */
81
+ destroy?(options: SandboxProviderCreateOptions & {
82
+ containerRef?: string | null;
83
+ }): Promise<void>;
84
+ /** Provider-side image/runner readiness check used by profile health. */
85
+ getProfileHealth?(input: {
86
+ profile: string;
87
+ image?: string;
88
+ /** Exact trusted command used to read the runner manifest. */
89
+ manifestCommand?: readonly string[];
90
+ expectedManifest?: Record<string, string>;
91
+ }): Promise<{
92
+ available: boolean;
93
+ reason?: string;
94
+ manifest?: Record<string, string>;
95
+ }>;
56
96
  /**
57
97
  * Get default working directory for the sandbox instances
58
98
  */
@@ -0,0 +1,20 @@
1
+ import type { SandboxWorkspaceBinding } from './sandbox.interface';
2
+ /** Server-visible and Provider-visible roots for the same isolated volume. */
3
+ export type SandboxWorkspaceVolume = {
4
+ serverRoot: string;
5
+ hostRoot: string;
6
+ };
7
+ /** Optional server path to translate within a mapped volume. */
8
+ export type SandboxWorkspaceMappingOptions = {
9
+ serverPath?: string;
10
+ };
11
+ /**
12
+ * Translates paths between platform volumes and Provider-visible workspaces.
13
+ * Engine-specific path logic belongs here instead of in OSS Volume services.
14
+ */
15
+ export interface SandboxWorkspaceMapper {
16
+ /** Produces a Provider-visible binding for one path inside the isolated platform volume. */
17
+ mapVolumeToWorkspace(volume: SandboxWorkspaceVolume, options?: SandboxWorkspaceMappingOptions): SandboxWorkspaceBinding;
18
+ /** Converts a Provider-visible path back to its server path, rejecting escapes. */
19
+ mapWorkspaceToVolume(binding: SandboxWorkspaceBinding, workspacePath: string): string;
20
+ }
@@ -0,0 +1,3 @@
1
+ export declare const SANDBOX_WORKSPACE_MAPPER = "SANDBOX_WORKSPACE_MAPPER";
2
+ /** Associates a workspace path mapper with a named Runtime Provider strategy. */
3
+ export declare const SandboxWorkspaceMapperStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,9 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import { BaseStrategyRegistry } from '../strategy';
3
+ import type { SandboxWorkspaceMapper } from './workspace-mapper';
4
+ /** Discovers Provider path mappers while enforcing the same system-level trust boundary as Providers. */
5
+ export declare class SandboxWorkspaceMapperRegistry extends BaseStrategyRegistry<SandboxWorkspaceMapper> {
6
+ private readonly mapperLogger;
7
+ constructor(discoveryService: DiscoveryService, reflector: Reflector);
8
+ upsert(instance: unknown): void;
9
+ }
@@ -1,4 +1,4 @@
1
- import { OnModuleInit } from '@nestjs/common';
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
4
  export declare class BaseStrategyRegistry<S> implements OnModuleInit {
@@ -11,7 +11,7 @@ export declare class BaseStrategyRegistry<S> implements OnModuleInit {
11
11
  protected pluginStrategies: Map<string, Set<string>>;
12
12
  constructor(strategyKey: string, discoveryService: DiscoveryService, reflector: Reflector);
13
13
  onModuleInit(): void;
14
- upsert(instance: any): void;
14
+ upsert(instance: unknown): void;
15
15
  /**
16
16
  * Remove all strategies registered by the given plugin for the given scope.
17
17
  */
@@ -38,3 +38,7 @@ export declare class BaseStrategyRegistry<S> implements OnModuleInit {
38
38
  */
39
39
  list(organizationId?: string): S[];
40
40
  }
41
+ /** Returns whether a discovered provider can carry decorator metadata. */
42
+ export declare function isStrategyInstance(instance: unknown): instance is object;
43
+ /** Resolves the class used for plugin and organization metadata without reflecting over primitive provider values. */
44
+ export declare function resolveStrategyMetadataTarget(instance: unknown): Type<unknown> | null;