@xpert-ai/plugin-sdk 3.21.1 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -124,6 +124,9 @@ function assertPluginArtifactNamePart(value, label) {
124
124
  throw new Error(`${label} must contain only lowercase letters, numbers, and underscores`);
125
125
  }
126
126
  }
127
+ function isPluginArtifactNamespace(value) {
128
+ return typeof value === 'string' && ARTIFACT_NAMESPACE_PATTERN.test(value);
129
+ }
127
130
 
128
131
  /** Call after the business mutation commits. A display failure must not retry that mutation. */ async function emitResourceCard(card, config) {
129
132
  await dispatch.dispatchCustomEvent(contracts.ChatMessageEventTypeEnum.ON_CHAT_EVENT, contracts.createResourceCardContent(card), config);
@@ -347,10 +350,9 @@ class RequestContext {
347
350
  * server RequestContext. Authentication guards resolve JWTs, API keys and
348
351
  * ChatKit client secrets before this check; the bearer is not always a JWT.
349
352
  */ static hasPermissions(findPermissions, throwError) {
350
- const permissions = this.currentPermissions();
351
- if (permissions.length > 0) {
352
- const found = permissions.filter((value)=>findPermissions.indexOf(value) >= 0);
353
- if (found.length === findPermissions.length) return true;
353
+ const permissions = new Set(this.currentPermissions());
354
+ if (permissions.size > 0 && findPermissions.every((permission)=>permissions.has(permission))) {
355
+ return true;
354
356
  }
355
357
  if (throwError) {
356
358
  throw new common.HttpException('Unauthorized', common.HttpStatus.UNAUTHORIZED);
@@ -6264,6 +6266,10 @@ function escapeInlineScript(value) {
6264
6266
 
6265
6267
  const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
6266
6268
 
6269
+ const ViewMiddlewareRuntimeCapability = modelProvider.createRuntimeCapability('platform.view.middleware-runtime', {
6270
+ description: 'Resolve a View capability through its authorized Assistant middleware and scoped runtime.'
6271
+ });
6272
+
6267
6273
  /** Platform-owned real-time collaboration capability available to scoped plugin runtimes. */ const CollaborationRuntimeCapability = modelProvider.createRuntimeCapability('platform.collaboration', {
6268
6274
  description: 'Create, synchronize, persist, authorize, and observe platform-managed real-time collaboration documents.'
6269
6275
  });
@@ -10411,6 +10417,7 @@ exports.VIEW_EXTENSION_PROVIDER = VIEW_EXTENSION_PROVIDER;
10411
10417
  exports.VectorStoreStrategy = VectorStoreStrategy;
10412
10418
  exports.VideoGenerationModel = VideoGenerationModel;
10413
10419
  exports.ViewExtensionProvider = ViewExtensionProvider;
10420
+ exports.ViewMiddlewareRuntimeCapability = ViewMiddlewareRuntimeCapability;
10414
10421
  exports.WORKFLOW_NODE_STRATEGY = WORKFLOW_NODE_STRATEGY;
10415
10422
  exports.WORKFLOW_TRIGGER_STRATEGY = WORKFLOW_TRIGGER_STRATEGY;
10416
10423
  exports.WorkflowNodeStrategy = WorkflowNodeStrategy;
@@ -10475,6 +10482,7 @@ exports.isAgentInvocationTerminal = isAgentInvocationTerminal;
10475
10482
  exports.isDevelopmentSandboxRuntimeEnvironment = isDevelopmentSandboxRuntimeEnvironment;
10476
10483
  exports.isModelOutputValidationError = isModelOutputValidationError;
10477
10484
  exports.isModelUsagePricingConfig = isModelUsagePricingConfig;
10485
+ exports.isPluginArtifactNamespace = isPluginArtifactNamespace;
10478
10486
  exports.isRemoteFile = isRemoteFile;
10479
10487
  exports.isSandboxBackend = isSandboxBackend;
10480
10488
  exports.isSandboxManagedServiceAdapter = isSandboxManagedServiceAdapter;
package/index.esm.js CHANGED
@@ -106,6 +106,9 @@ function assertPluginArtifactNamePart(value, label) {
106
106
  throw new Error(`${label} must contain only lowercase letters, numbers, and underscores`);
107
107
  }
108
108
  }
109
+ function isPluginArtifactNamespace(value) {
110
+ return typeof value === 'string' && ARTIFACT_NAMESPACE_PATTERN.test(value);
111
+ }
109
112
 
110
113
  /** Call after the business mutation commits. A display failure must not retry that mutation. */ async function emitResourceCard(card, config) {
111
114
  await dispatchCustomEvent(ChatMessageEventTypeEnum.ON_CHAT_EVENT, createResourceCardContent(card), config);
@@ -329,10 +332,9 @@ class RequestContext {
329
332
  * server RequestContext. Authentication guards resolve JWTs, API keys and
330
333
  * ChatKit client secrets before this check; the bearer is not always a JWT.
331
334
  */ static hasPermissions(findPermissions, throwError) {
332
- const permissions = this.currentPermissions();
333
- if (permissions.length > 0) {
334
- const found = permissions.filter((value)=>findPermissions.indexOf(value) >= 0);
335
- if (found.length === findPermissions.length) return true;
335
+ const permissions = new Set(this.currentPermissions());
336
+ if (permissions.size > 0 && findPermissions.every((permission)=>permissions.has(permission))) {
337
+ return true;
336
338
  }
337
339
  if (throwError) {
338
340
  throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
@@ -6246,6 +6248,10 @@ function escapeInlineScript(value) {
6246
6248
 
6247
6249
  const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
6248
6250
 
6251
+ const ViewMiddlewareRuntimeCapability = createRuntimeCapability('platform.view.middleware-runtime', {
6252
+ description: 'Resolve a View capability through its authorized Assistant middleware and scoped runtime.'
6253
+ });
6254
+
6249
6255
  /** Platform-owned real-time collaboration capability available to scoped plugin runtimes. */ const CollaborationRuntimeCapability = createRuntimeCapability('platform.collaboration', {
6250
6256
  description: 'Create, synchronize, persist, authorize, and observe platform-managed real-time collaboration documents.'
6251
6257
  });
@@ -10145,4 +10151,4 @@ Reflect.defineMetadata('__command__', {
10145
10151
  id: ImportDefaultAgentPluginsCommand.type
10146
10152
  }, ImportDefaultAgentPluginsCommand);
10147
10153
 
10148
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, 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, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, 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, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, knowledgebaseActions, loadYamlFile, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, taskWaitReason, textTokenBoundaries };
10154
+ export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, 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, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, 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, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, ViewMiddlewareRuntimeCapability, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, knowledgebaseActions, loadYamlFile, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, taskWaitReason, textTokenBoundaries };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.21.1",
3
+ "version": "3.22.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@langchain/openai": "0.6.9",
65
- "@xpert-ai/contracts": "3.21.0",
65
+ "@xpert-ai/contracts": "3.21.1",
66
66
  "express": "^4.22.1",
67
67
  "js-tiktoken": "^1.0.21"
68
68
  },
@@ -8,3 +8,4 @@ export declare function derivePluginArtifactNamespace(packageName: string): stri
8
8
  * Keep table keys stable; the returned name is part of the plugin data contract.
9
9
  */
10
10
  export declare function pluginArtifactTableName(namespace: string, tableKey: string): string;
11
+ export declare function isPluginArtifactNamespace(value: unknown): value is string;
@@ -3,6 +3,11 @@ import type { ConnectorRuntimeApi } from './strategy.interface';
3
3
  export declare const ConnectorRuntimeCapability: import("../core").RuntimeCapabilityKey<ConnectorRuntimeApi>;
4
4
  /** No binding or provider grants means no connector access. */
5
5
  export type ConnectorRuntimeScope = RuntimeIdentityScope & {
6
+ /** Server-owned View host identity, set only after the host authorizes the Assistant and its graph. */
7
+ viewHost?: {
8
+ type: 'agent';
9
+ id: string;
10
+ };
6
11
  /** Host-validated Agent Plugin dependencies may use their workspace binding in an authorized project. */
7
12
  allowWorkspaceBindingsInProject?: boolean;
8
13
  /** Host-selected bindings, including IDs pinned by enabled graph Connector nodes. */
@@ -1,6 +1,7 @@
1
1
  export * from './actor-token';
2
2
  export * from './artifacts';
3
3
  export * from './workspace-files';
4
+ export * from './workspace-storage';
4
5
  export * from './sandbox-jobs';
5
6
  export * from './project-provisioning';
6
7
  export * from './project-access';
@@ -1,3 +1,4 @@
1
+ import type { WorkspaceAppDataOptions, WorkspaceStorage } from './workspace-storage';
1
2
  /** Logical workspace volume catalog supported by plugin-facing file APIs. */
2
3
  export type WorkspaceFileCatalog = 'projects' | 'users' | 'knowledges' | 'skills' | 'xperts' | 'user-xperts';
3
4
  /** Stable source identifier for portable workspace file references. */
@@ -232,6 +233,9 @@ export type WorkspaceSearchUnderstandingChunksInput = WorkspaceFileScope & {
232
233
  * understanding files in Xpert workspace Volumes.
233
234
  */
234
235
  export interface WorkspaceFilesApi {
236
+ /** Managed .apps data in the bound Assistant workspace. Each operation reauthorizes the actor.
237
+ * Ordinary Files/sandbox access cannot access this namespace. Requires a scoped runtime API. */
238
+ appData(options: WorkspaceAppDataOptions): WorkspaceStorage;
235
239
  /** Host-bound storage identity for restoring the same scope in durable jobs. */
236
240
  readonly scope?: Readonly<WorkspaceFileScope>;
237
241
  /** Upload raw bytes into an explicitly scoped workspace Volume. */
@@ -0,0 +1,22 @@
1
+ /** Durable application state inside an authorized Assistant workspace.
2
+ * Paths and lock keys are canonical relative paths: no empty, dot or .locks segments.
3
+ * Handles stay bound to their first authorized volume; recreate them after a workspace policy change. */
4
+ export interface WorkspaceStorage {
5
+ read(path: string): Promise<Buffer>;
6
+ write(path: string, content: string | Uint8Array): Promise<void>;
7
+ mkdir(path: string): Promise<void>;
8
+ list(path: string): Promise<string[]>;
9
+ remove(path: string): Promise<void>;
10
+ /** Shared-filesystem mutex renewed by confirmed heartbeats. Lock loss rejects subsequent
11
+ * app-data and ordinary Volume mutations in the callback, including detached work. */
12
+ withLock<T>(key: string, action: () => Promise<T>, options?: {
13
+ waitMs?: number;
14
+ }): Promise<T>;
15
+ }
16
+ /** Host resolves the namespace from this loaded plugin's metadata, never from a filesystem path.
17
+ * Native plugins are trusted server code; this handle is not a sandbox for malicious plugin code. */
18
+ export interface WorkspaceAppDataOptions {
19
+ pluginName: string;
20
+ /** Opt in for personal data; shared Assistant workspaces otherwise remain supported. */
21
+ requireUserIsolation?: boolean;
22
+ }
@@ -3,4 +3,5 @@ export * from './provider.interface';
3
3
  export * from './provider.registry';
4
4
  export * from './remote-component-html';
5
5
  export * from './tokens';
6
+ export * from './middleware-runtime';
6
7
  export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND } from '@xpert-ai/contracts';
@@ -0,0 +1,20 @@
1
+ import type { IWFNMiddleware, XpertResolvedViewHostContext } from '@xpert-ai/contracts';
2
+ import type { IAgentMiddlewareContext } from '../agent/middleware/strategy.interface';
3
+ /** Server-only input: use the authorized context received by a View provider, never iframe input. */
4
+ export interface ViewMiddlewareRuntimeInput {
5
+ context: XpertResolvedViewHostContext;
6
+ provider: string;
7
+ requiredFeature: string;
8
+ /** Authoring requires the same draft access policy as the Agent View host. Defaults to published. */
9
+ isDraft?: boolean;
10
+ }
11
+ /** Contains trusted configuration and callable capabilities. Never serialize this result to a Remote View. */
12
+ export interface ViewMiddlewareRuntimeResult {
13
+ options: IWFNMiddleware['options'];
14
+ context: IAgentMiddlewareContext;
15
+ }
16
+ export interface ViewMiddlewareRuntimeResolver {
17
+ /** Revalidates identity, host access, the exact connected middleware and its Feature on every call. */
18
+ resolve(input: ViewMiddlewareRuntimeInput): Promise<ViewMiddlewareRuntimeResult>;
19
+ }
20
+ export declare const ViewMiddlewareRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ViewMiddlewareRuntimeResolver>;