@xpert-ai/plugin-sdk 3.15.15 → 3.15.17

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.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 0a90701: release 3.15.17
8
+ - Updated dependencies [0a90701]
9
+ - @xpert-ai/contracts@3.15.17
10
+
11
+ ## 3.15.16
12
+
13
+ ### Patch Changes
14
+
15
+ - 90a268b: Initialize assistant template prompt workflows as reusable workspace commands.
16
+ - Updated dependencies [90a268b]
17
+ - @xpert-ai/contracts@3.15.16
18
+
3
19
  ## 3.15.15
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
  }
@@ -2816,7 +2834,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
2816
2834
 
2817
2835
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
2818
2836
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
2819
- description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2837
+ description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
2820
2838
  });
2821
2839
 
2822
2840
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -2830,10 +2848,12 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2830
2848
  'BROWSER_LAUNCH_FAILED',
2831
2849
  'EXPORT_TIMEOUT',
2832
2850
  'EXPORT_OOM',
2851
+ 'EXPORT_MEDIA_FAILED',
2833
2852
  'EXPORT_INPUT_INVALID',
2834
2853
  'EXPORT_OUTPUT_INVALID',
2835
2854
  'SANDBOX_CANCELLED'
2836
2855
  ];
2856
+ /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
2837
2857
  /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2838
2858
  constructor(code, message, retryable, jobId){
2839
2859
  super(message);
@@ -2843,8 +2863,14 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2843
2863
  this.name = 'SandboxJobRuntimeError';
2844
2864
  }
2845
2865
  }
2866
+ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
2846
2867
  /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2847
- return error instanceof SandboxJobRuntimeError;
2868
+ if (error instanceof SandboxJobRuntimeError) return true;
2869
+ if (typeof error !== 'object' || error === null) return false;
2870
+ // Dynamically loaded plugins may resolve another Plugin SDK module instance,
2871
+ // so class identity is not a reliable runtime boundary. Validate the stable shape.
2872
+ const candidate = error;
2873
+ 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
2874
  }
2849
2875
  /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2850
2876
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
@@ -5006,6 +5032,7 @@ exports.RequirePermissionOperation = RequirePermissionOperation;
5006
5032
  exports.RerankModel = RerankModel;
5007
5033
  exports.RetrieverStrategy = RetrieverStrategy;
5008
5034
  exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
5035
+ exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
5009
5036
  exports.SANDBOX_PROVIDER = SANDBOX_PROVIDER;
5010
5037
  exports.SANDBOX_RUNTIME_PROVIDER = SANDBOX_RUNTIME_PROVIDER;
5011
5038
  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
  }
@@ -2798,7 +2816,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
2798
2816
 
2799
2817
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
2800
2818
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
2801
- description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
2819
+ description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
2802
2820
  });
2803
2821
 
2804
2822
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -2812,10 +2830,12 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2812
2830
  'BROWSER_LAUNCH_FAILED',
2813
2831
  'EXPORT_TIMEOUT',
2814
2832
  'EXPORT_OOM',
2833
+ 'EXPORT_MEDIA_FAILED',
2815
2834
  'EXPORT_INPUT_INVALID',
2816
2835
  'EXPORT_OUTPUT_INVALID',
2817
2836
  'SANDBOX_CANCELLED'
2818
2837
  ];
2838
+ /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
2819
2839
  /** Error carrying retry policy and Job identity across plugin queue handlers. */ class SandboxJobRuntimeError extends Error {
2820
2840
  constructor(code, message, retryable, jobId){
2821
2841
  super(message);
@@ -2825,8 +2845,14 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
2825
2845
  this.name = 'SandboxJobRuntimeError';
2826
2846
  }
2827
2847
  }
2848
+ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
2828
2849
  /** Narrows an unknown failure to the structured Sandbox Jobs runtime error contract. */ function isSandboxJobRuntimeError(error) {
2829
- return error instanceof SandboxJobRuntimeError;
2850
+ if (error instanceof SandboxJobRuntimeError) return true;
2851
+ if (typeof error !== 'object' || error === null) return false;
2852
+ // Dynamically loaded plugins may resolve another Plugin SDK module instance,
2853
+ // so class identity is not a reliable runtime boundary. Validate the stable shape.
2854
+ const candidate = error;
2855
+ 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
2856
  }
2831
2857
  /** Runtime capability key used to resolve SandboxJobsApi from the platform registry. */ const SandboxJobsRuntimeCapability = createRuntimeCapability('platform.sandbox.jobs', {
2832
2858
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
@@ -4866,4 +4892,4 @@ CollaborationDocumentProviderRegistry = __decorate([
4866
4892
  ])
4867
4893
  ], CollaborationDocumentProviderRegistry);
4868
4894
 
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 };
4895
+ 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.15",
3
+ "version": "3.15.17",
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.15",
20
+ "@xpert-ai/contracts": "3.15.17",
21
21
  "express": "^4.22.1",
22
22
  "js-tiktoken": "^1.0.21"
23
23
  },
@@ -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,4 +1,4 @@
1
- import { IconDefinition, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
1
+ import { IconDefinition, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
2
2
  import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
3
3
  import { ModuleRef } from '@nestjs/core';
4
4
  import type { ZodSchema } from 'zod';
@@ -75,6 +75,7 @@ export interface XpertTemplateContribution {
75
75
  order?: number;
76
76
  default?: boolean;
77
77
  startPrompts?: string[];
78
+ promptWorkflows?: TPromptWorkflow[];
78
79
  releaseNotes?: string;
79
80
  xpertName?: string;
80
81
  dependencies?: XpertTemplatePluginDependencies;