@xpert-ai/plugin-sdk 3.37.2 → 3.38.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.
@@ -701,7 +701,7 @@ const diagnosticSchema = v3.z.object({
701
701
  const latest = new Map();
702
702
  const hostWindow = frame.ownerDocument.defaultView;
703
703
  let connected = false, disposed = false, requests = 0, started = Date.now();
704
- frame.setAttribute('sandbox', 'allow-scripts');
704
+ frame.setAttribute('sandbox', options.allowDownloads === true ? 'allow-scripts allow-downloads' : 'allow-scripts');
705
705
  frame.referrerPolicy = 'no-referrer';
706
706
  // Host UI observers cannot leave query accounting stuck or alter protocol completion.
707
707
  const observe = (callback, value)=>{
@@ -699,7 +699,7 @@ const diagnosticSchema = z.object({
699
699
  const latest = new Map();
700
700
  const hostWindow = frame.ownerDocument.defaultView;
701
701
  let connected = false, disposed = false, requests = 0, started = Date.now();
702
- frame.setAttribute('sandbox', 'allow-scripts');
702
+ frame.setAttribute('sandbox', options.allowDownloads === true ? 'allow-scripts allow-downloads' : 'allow-scripts');
703
703
  frame.referrerPolicy = 'no-referrer';
704
704
  // Host UI observers cannot leave query accounting stuck or alter protocol completion.
705
705
  const observe = (callback, value)=>{
package/docs/README.md CHANGED
@@ -26,6 +26,93 @@ Run `nx test plugin-sdk` to execute the unit tests via [Jest](https://jestjs.io)
26
26
 
27
27
  [Plugin Permission Design Guide](./en/PERMISSIONS.md)
28
28
 
29
+ ## Provider registries
30
+
31
+ Use `BaseStrategyRegistry` for discovery, plugin lifecycle events, scope precedence and lookup. `findByName(name, organizationId?)` returns `undefined` for an unavailable registration; `get` requires a match. The base class cancels its bus subscription when the module is destroyed. Existing registry naming and replacement policies remain unchanged.
32
+
33
+ Opt into `NamedProviderRegistry<T>` when a provider category requires plugin-qualified names, implementation validation and rejection of a different live instance with the same name in the same scope. Pair it with `definePluginRegistration` so ownership and duplicate declarations are also checked before module initialization. An existing instance may be registered again; replacement requires removing the previous registration first. Rejected dynamic registrations are logged without replacing the existing instance or preventing later lifecycle events. Initial discovery errors still fail module initialization.
34
+
35
+ ```ts
36
+ const REPORT_RENDERER = 'EXAMPLE_REPORT_RENDERER'
37
+ export const ReportRenderer = definePluginRegistration(REPORT_RENDERER, 'report renderer')
38
+
39
+ interface ReportRendererApi {
40
+ render(input: string): string
41
+ }
42
+
43
+ @Injectable()
44
+ export class ReportRendererRegistry extends NamedProviderRegistry<ReportRendererApi> {
45
+ constructor(discovery: DiscoveryService, reflector: Reflector) {
46
+ super(REPORT_RENDERER, discovery, reflector)
47
+ }
48
+
49
+ protected isProvider(instance: object): instance is ReportRendererApi {
50
+ return 'render' in instance && typeof instance.render === 'function'
51
+ }
52
+ }
53
+ ```
54
+
55
+ Import `NamedProviderRegistry` and `definePluginRegistration` from `@xpert-ai/plugin-sdk`, `Injectable` from `@nestjs/common`, and `DiscoveryService` / `Reflector` from `@nestjs/core`. Register the registry in a module with the host's discovery and strategy bus providers. A plugin implementation can use `@ReportRenderer('@example/reports:preview')`; its name belongs to that installing plugin. `findByName(name, organizationId?)` uses the base class's scoped lookup. The two Widget registries use this same opt-in layer and provide only their own interface validation and action resolution.
56
+
57
+ ## A2UI Widget actions
58
+
59
+ Declare one action provider per Widget type in your plugin's Nest module. Its `actions` map contains named handlers that share the provider's dependencies. For `@example/dashboard:review`, the local action `publish` has the full name `@example/dashboard:review.publish`. Use that full name in both the A2UI button action and the containing surface's `serverActions`.
60
+
61
+ ```ts
62
+ @WidgetActionProvider('@example/dashboard:review')
63
+ export class DashboardReviewActions implements IWidgetActionProvider {
64
+ constructor(private readonly dashboards: DashboardService) {}
65
+
66
+ readonly actions = {
67
+ publish: {
68
+ execute: async (context: WidgetActionContext) => {
69
+ await this.dashboards.publishFromWidget(context)
70
+ return { refresh: 'thread' as const }
71
+ }
72
+ },
73
+ cancel: {
74
+ execute: async (context: WidgetActionContext) => {
75
+ await this.dashboards.cancelReviewFromWidget(context)
76
+ return { refresh: 'thread' as const }
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ @Module({ providers: [DashboardService, DashboardReviewActions] })
83
+ export class DashboardPluginModule {}
84
+ ```
85
+
86
+ Import `WidgetActionProvider`, `IWidgetActionProvider` and `WidgetActionContext` from `@xpert-ai/plugin-sdk`. Each map entry implements `IWidgetActionHandler`; local names contain only letters, digits, underscores or hyphens. The host resolves the exact provider namespace and an explicitly declared own action. It does not invoke arbitrary provider methods or inherited object properties. Registration and unloading apply to the whole action set.
87
+
88
+ The host checks thread access, the assistant message and the current action declaration restored from a server-issued Widget reference. Client-editable message content cannot authorize an action. The domain service validates the form, authorizes the caller for the target resource and handles repeated submissions. An action entry for a dynamically reconstructed card can set `widgetSource: 'receipt'`. Its `execute` handler must then verify the thread, assistant message, Widget ID and allowed operation against its own server record before changing state. Message rendering and action handling remain separate contracts; register both providers in the same business module.
89
+
90
+ Both decorators declare a registration category and name. Before Nest constructs providers, the host checks the name against the installing plugin and rejects duplicate names within a category and installation scope. New plugin-owned named strategies can use `definePluginRegistration(metadataKey, kind)` for the same preflight.
91
+
92
+ ### Publish and restore a dynamic card
93
+
94
+ Register a `@MessageWidgetProvider` alongside the action provider in the plugin module. Calling `publishWidget()` during an active reply emits a Widget block at that point in the message stream, after its reference is persisted. The host binds the calling execution and thread, saves the block's position in the reply, and starts a separate text block for subsequent text. A producer that already knows the persisted assistant message may specify `messageId` in that thread. Both forms use a stable Widget ID from the domain record. Reissuing the same binding updates the original block without moving it. References without a streamed position remain recoverable at the end of the reply.
95
+
96
+ ```ts
97
+ @MessageWidgetProvider('@example/dashboard:review')
98
+ export class DashboardReviewCards implements IMessageWidgetProvider {
99
+ constructor(private readonly dashboards: DashboardService) {}
100
+
101
+ issue(capabilities: RuntimeCapabilityRegistry, widgetId: string) {
102
+ return capabilities.require(ConversationRuntimeCapability).publishWidget(this, {
103
+ widgetId,
104
+ provider: '@example/dashboard:review'
105
+ })
106
+ }
107
+
108
+ resolve(references: readonly MessageWidgetReference[]) {
109
+ return this.dashboards.reviewWidgetsForCurrentViewer(references)
110
+ }
111
+ }
112
+ ```
113
+
114
+ Import the capability, provider and types from `@xpert-ai/plugin-sdk`. Pass the registry from the current middleware invocation. Add `DashboardReviewCards` and the action provider to the same module's providers. Live publication, message completion, history reads and reconnect snapshots call `resolve` with the issued references for that provider and restore each card at its original position. Return authorized `{ messageId, widget }` pairs with the original Widget IDs and current `serverActions`. To show a card in restricted sessions, explicitly set `visibleInRestrictedSessions = true` and return only fields safe for that viewer. Provider resolution is bounded to two seconds; unavailable cards are omitted without blocking the reply indefinitely. Unloading the provider hides its cards. Reinstalling the owning provider can restore them from the same references.
115
+
29
116
  ## Decorator-driven business Tools
30
117
 
31
118
  Use `@XpertToolProvider()` on one injectable business class and `@XpertTool()` on its methods when the same domain operation should be available as an Agent Middleware Tool, a host-native MCP Tool, or both. Register only the decorated class in the plugin Nest module; the host expands it into one native Toolset and the declared Middleware groups.
@@ -80,7 +80,7 @@ renderUnavailable(round.failures)
80
80
 
81
81
  ## 隔离边界
82
82
 
83
- HTML 在 `sandbox="allow-scripts"` 内执行,无同源权限、表单、弹窗和下载授权。内容前缀首先安装 CSP,允许内联 JS/CSS 和 data/blob 图片。默认拒绝外部资源;可信宿主可显式开启上述 HTTPS 资源白名单。数据网络请求、子 iframe、worker、eval、对象和表单始终拒绝。宿主页额外的 frame-src 策略拒绝文档自身导航。
83
+ HTML 默认在 `sandbox="allow-scripts"` 内执行。可信宿主可以在挂载时指定 `allowDownloads: true`,允许该文档发起文件下载;同源、表单和弹窗仍受沙箱限制。内容前缀首先安装 CSP,允许内联 JS/CSS 和 data/blob 图片。默认拒绝外部资源;可信宿主可显式开启上述 HTTPS 资源白名单。数据网络请求、子 iframe、worker、eval、对象和表单始终拒绝。宿主页额外的 frame-src 策略拒绝文档自身导航。
84
84
 
85
85
  HTML 格式验证不是 sanitizer,也不证明业务正确性。Agent 代码仍可画出错误图形或阻塞自己的文档;业务口径、数值与实际页面都需要验收。该能力不提供后端写操作、任意网络代理或自动推送。
86
86
 
package/index.cjs.js CHANGED
@@ -516,9 +516,15 @@ exports.StrategyBus = __decorate([
516
516
 
517
517
  class BaseStrategyRegistry {
518
518
  onModuleInit() {
519
- this.bus.events$.pipe(rxjs.filter((event)=>!event.strategyType || event.strategyType === this.strategyKey)).subscribe((evt)=>{
519
+ var _this_strategySubscription;
520
+ (_this_strategySubscription = this.strategySubscription) == null ? void 0 : _this_strategySubscription.unsubscribe();
521
+ this.strategySubscription = this.bus.events$.pipe(rxjs.filter((event)=>!event.strategyType || event.strategyType === this.strategyKey)).subscribe((evt)=>{
520
522
  if (evt.type === 'UPSERT') {
521
- this.upsert(evt.entry.instance);
523
+ try {
524
+ this.upsert(evt.entry.instance);
525
+ } catch (error) {
526
+ this.onRegistrationError(error);
527
+ }
522
528
  } else if (evt.type === 'REMOVE') {
523
529
  this.remove(evt.orgId, evt.pluginName);
524
530
  }
@@ -530,6 +536,14 @@ class BaseStrategyRegistry {
530
536
  this.upsert(instance);
531
537
  }
532
538
  }
539
+ onModuleDestroy() {
540
+ var _this_strategySubscription;
541
+ (_this_strategySubscription = this.strategySubscription) == null ? void 0 : _this_strategySubscription.unsubscribe();
542
+ this.strategySubscription = undefined;
543
+ }
544
+ /** Policy for rejected registrations delivered by the lifecycle bus. */ onRegistrationError(error) {
545
+ throw error;
546
+ }
533
547
  upsert(instance) {
534
548
  const target = resolveStrategyMetadataTarget(instance);
535
549
  if (!target) {
@@ -638,6 +652,14 @@ class BaseStrategyRegistry {
638
652
  }
639
653
  return scopeKeys;
640
654
  }
655
+ /** Resolves a registered name in the effective scope, without requiring a match. */ findByName(type, organizationId) {
656
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
657
+ var _this_strategies_get;
658
+ const strategy = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
659
+ if (strategy) return strategy;
660
+ }
661
+ return undefined;
662
+ }
641
663
  /**
642
664
  * Get strategy by type from the given organization including global strategies as fallback.
643
665
  *
@@ -645,11 +667,7 @@ class BaseStrategyRegistry {
645
667
  * @param organizationId
646
668
  * @returns
647
669
  */ get(type, organizationId) {
648
- organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
649
- const strategy = this.resolveStrategyScopeKeys(organizationId).map((scopeKey)=>{
650
- var _this_strategies_get;
651
- return (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
652
- }).find((item)=>!!item);
670
+ const strategy = this.findByName(type, organizationId);
653
671
  if (!strategy) {
654
672
  throw new Error(`No strategy found for type '${type}' for strategy '${this.strategyKey}'`);
655
673
  }
@@ -837,6 +855,117 @@ exports.ResourceCardProviderRegistry = ResourceCardProviderRegistry_1 = __decora
837
855
  ])
838
856
  ], exports.ResourceCardProviderRegistry);
839
857
 
858
+ const kindPrefix = 'xpert:provider-registration:';
859
+ /** Declares a plugin-owned strategy category with a stable metadata key across SDK copies. */ function definePluginRegistration(metadataKey, kind = metadataKey) {
860
+ if (!metadataKey || metadataKey.trim() !== metadataKey || metadataKey === STRATEGY_META_KEY || metadataKey.startsWith(kindPrefix)) throw new Error('Invalid provider registration metadata key');
861
+ if (!kind || kind.trim() !== kind) throw new Error('A provider registration requires an exact category');
862
+ return (name)=>{
863
+ if (!name || name.trim() !== name) throw new Error('A provider registration requires an exact name');
864
+ return common.applyDecorators(common.Injectable(), common.SetMetadata(STRATEGY_META_KEY, metadataKey), common.SetMetadata(metadataKey, name), common.SetMetadata(kindPrefix + metadataKey, kind));
865
+ };
866
+ }
867
+ function assertPluginRegistrationOwner(name, pluginName) {
868
+ const separator = name.indexOf(':');
869
+ const owner = separator < 0 ? undefined : name.slice(0, separator);
870
+ const localName = name.slice(separator + 1);
871
+ if (owner !== pluginName || name.trim() !== name || !/^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*$/.test(localName)) throw new Error(`Registration '${name}' does not belong to ${pluginName != null ? pluginName : 'the platform'}`);
872
+ }
873
+ function readPluginProviderRegistrations(target, pluginName) {
874
+ const claims = [];
875
+ for (const key of Reflect.getMetadataKeys(target)){
876
+ if (typeof key !== 'string' || !key.startsWith(kindPrefix)) continue;
877
+ const metadataKey = key.slice(kindPrefix.length);
878
+ const kind = Reflect.getMetadata(key, target);
879
+ if (typeof kind !== 'string' || !kind.trim() || kind.trim() !== kind) throw new Error(`Invalid provider registration category for '${metadataKey}'`);
880
+ const name = Reflect.getMetadata(metadataKey, target);
881
+ if (typeof name !== 'string') throw new Error(`Invalid ${kind} registration name`);
882
+ assertPluginRegistrationOwner(name, pluginName);
883
+ claims.push({
884
+ kind,
885
+ key: name
886
+ });
887
+ }
888
+ return claims;
889
+ }
890
+
891
+ const MESSAGE_WIDGET_PROVIDER = 'XPERT_MESSAGE_WIDGET_PROVIDER';
892
+ const MessageWidgetProvider = definePluginRegistration(MESSAGE_WIDGET_PROVIDER, 'widget provider');
893
+
894
+ /** Opt-in registry for validated, owner-qualified providers that cannot replace a different live instance. */ class NamedProviderRegistry extends BaseStrategyRegistry {
895
+ upsert(instance) {
896
+ const target = resolveStrategyMetadataTarget(instance);
897
+ const name = target && this.reflector.get(this.strategyKey, target);
898
+ if (name == null) return;
899
+ if (typeof name !== 'string' || !name) throw new Error(`Invalid ${this.strategyKey} registration name`);
900
+ if (!instance || typeof instance !== 'object' || !this.isProvider(instance)) throw new Error(`Invalid ${this.strategyKey} provider '${name}'`);
901
+ this.register(name, instance, this.getSource(instance));
902
+ }
903
+ assertCanRegister(name, instance, source) {
904
+ var _this_strategies_get;
905
+ assertPluginRegistrationOwner(name, source.kind === 'plugin' ? source.pluginName : undefined);
906
+ const current = (_this_strategies_get = this.strategies.get(source.scopeKey)) == null ? void 0 : _this_strategies_get.get(name);
907
+ if (current && current !== instance) throw new Error(`Provider '${name}' is already registered in this scope`);
908
+ super.assertCanRegister(name, instance, source);
909
+ }
910
+ onRegistrationError(error) {
911
+ this.providerLogger.warn(error instanceof Error ? error.message : 'Invalid provider registration');
912
+ }
913
+ constructor(...args){
914
+ super(...args);
915
+ this.providerLogger = new common.Logger(this.constructor.name);
916
+ }
917
+ }
918
+
919
+ exports.MessageWidgetProviderRegistry = class MessageWidgetProviderRegistry extends NamedProviderRegistry {
920
+ isProvider(instance) {
921
+ return 'resolve' in instance && typeof instance.resolve === 'function';
922
+ }
923
+ constructor(discovery, reflector){
924
+ super(MESSAGE_WIDGET_PROVIDER, discovery, reflector);
925
+ }
926
+ };
927
+ exports.MessageWidgetProviderRegistry = __decorate([
928
+ common.Injectable(),
929
+ __metadata("design:paramtypes", [
930
+ core.DiscoveryService,
931
+ core.Reflector
932
+ ])
933
+ ], exports.MessageWidgetProviderRegistry);
934
+
935
+ const WIDGET_ACTION_PROVIDER = 'XPERT_WIDGET_ACTION_PROVIDER';
936
+ const WidgetActionProvider = definePluginRegistration(WIDGET_ACTION_PROVIDER, 'widget action provider');
937
+
938
+ const localActionName = /^[a-zA-Z0-9_-]+$/;
939
+ exports.WidgetActionProviderRegistry = class WidgetActionProviderRegistry extends NamedProviderRegistry {
940
+ isProvider(instance) {
941
+ if (!('actions' in instance) || !instance.actions || typeof instance.actions !== 'object' || Array.isArray(instance.actions)) return false;
942
+ const entries = Object.entries(instance.actions);
943
+ return entries.length > 0 && entries.every(([name, handler])=>localActionName.test(name) && isActionHandler(handler));
944
+ }
945
+ resolve(action) {
946
+ const separator = action.lastIndexOf('.');
947
+ if (separator < 1) return undefined;
948
+ const name = action.slice(separator + 1);
949
+ if (!localActionName.test(name)) return undefined;
950
+ const provider = this.findByName(action.slice(0, separator));
951
+ if (!provider || !Object.prototype.hasOwnProperty.call(provider.actions, name)) return undefined;
952
+ return provider.actions[name];
953
+ }
954
+ constructor(discovery, reflector){
955
+ super(WIDGET_ACTION_PROVIDER, discovery, reflector);
956
+ }
957
+ };
958
+ exports.WidgetActionProviderRegistry = __decorate([
959
+ common.Injectable(),
960
+ __metadata("design:paramtypes", [
961
+ core.DiscoveryService,
962
+ core.Reflector
963
+ ])
964
+ ], exports.WidgetActionProviderRegistry);
965
+ function isActionHandler(value) {
966
+ return !!value && typeof value === 'object' && 'execute' in value && typeof value.execute === 'function' && (!('widgetSource' in value) || value.widgetSource === undefined || value.widgetSource === 'message' || value.widgetSource === 'receipt');
967
+ }
968
+
840
969
  function createPluginLogger(scope, baseMeta = {}) {
841
970
  const nestLogger = new common.Logger(scope);
842
971
  const wrap = (level, msg, meta)=>{
@@ -11780,6 +11909,7 @@ exports.AssistantMiddlewareAccessRuntimeCapability = modelProvider.AssistantMidd
11780
11909
  exports.BaseTool = modelProvider.BaseTool;
11781
11910
  exports.BaseToolset = modelProvider.BaseToolset;
11782
11911
  exports.BuiltinToolset = modelProvider.BuiltinToolset;
11912
+ exports.ConversationRuntimeCapability = modelProvider.ConversationRuntimeCapability;
11783
11913
  exports.DefaultAgentMiddlewareRuntimeCapabilityRegistry = modelProvider.DefaultRuntimeCapabilityRegistry;
11784
11914
  exports.DefaultRuntimeCapabilityRegistry = modelProvider.DefaultRuntimeCapabilityRegistry;
11785
11915
  exports.McpClientRuntimeCapability = modelProvider.McpClientRuntimeCapability;
@@ -11974,9 +12104,12 @@ exports.MANAGED_CONNECTION_REGISTRY_TOKEN = MANAGED_CONNECTION_REGISTRY_TOKEN;
11974
12104
  exports.MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN = MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN;
11975
12105
  exports.MANAGED_QUEUE_SERVICE_TOKEN = MANAGED_QUEUE_SERVICE_TOKEN;
11976
12106
  exports.MCP_CAPABILITY_CHANGE_EVENT_TYPES = MCP_CAPABILITY_CHANGE_EVENT_TYPES;
12107
+ exports.MESSAGE_WIDGET_PROVIDER = MESSAGE_WIDGET_PROVIDER;
11977
12108
  exports.MODEL_OUTPUT_VALIDATION_ERROR_CODE = MODEL_OUTPUT_VALIDATION_ERROR_CODE;
12109
+ exports.MessageWidgetProvider = MessageWidgetProvider;
11978
12110
  exports.ModelExecutionEnvironmentCapability = ModelExecutionEnvironmentCapability;
11979
12111
  exports.ModelOutputValidationError = ModelOutputValidationError;
12112
+ exports.NamedProviderRegistry = NamedProviderRegistry;
11980
12113
  exports.ORGANIZATION_METADATA_KEY = ORGANIZATION_METADATA_KEY;
11981
12114
  exports.OpenAICompatibleEmbeddings = OpenAICompatibleEmbeddings;
11982
12115
  exports.OpenAICompatibleReranker = OpenAICompatibleReranker;
@@ -12064,8 +12197,10 @@ exports.VectorStoreStrategy = VectorStoreStrategy;
12064
12197
  exports.VideoGenerationModel = VideoGenerationModel;
12065
12198
  exports.ViewExtensionProvider = ViewExtensionProvider;
12066
12199
  exports.ViewMiddlewareRuntimeCapability = ViewMiddlewareRuntimeCapability;
12200
+ exports.WIDGET_ACTION_PROVIDER = WIDGET_ACTION_PROVIDER;
12067
12201
  exports.WORKFLOW_NODE_STRATEGY = WORKFLOW_NODE_STRATEGY;
12068
12202
  exports.WORKFLOW_TRIGGER_STRATEGY = WORKFLOW_TRIGGER_STRATEGY;
12203
+ exports.WidgetActionProvider = WidgetActionProvider;
12069
12204
  exports.WorkbenchDecisionCapability = WorkbenchDecisionCapability;
12070
12205
  exports.WorkflowNodeStrategy = WorkflowNodeStrategy;
12071
12206
  exports.WorkflowTriggerStrategy = WorkflowTriggerStrategy;
@@ -12099,6 +12234,7 @@ exports.applyModelConfiguration = applyModelConfiguration;
12099
12234
  exports.applyModelContextSize = applyModelContextSize;
12100
12235
  exports.artifactPresentationKey = artifactPresentationKey;
12101
12236
  exports.artifactTypeKey = artifactTypeKey;
12237
+ exports.assertPluginRegistrationOwner = assertPluginRegistrationOwner;
12102
12238
  exports.assertXpertToolProviderClaims = assertXpertToolProviderClaims;
12103
12239
  exports.buildSandboxTimeoutMessage = buildSandboxTimeoutMessage;
12104
12240
  exports.calcTokenUsage = calcTokenUsage;
@@ -12119,6 +12255,7 @@ exports.defineMcpCapabilities = defineMcpCapabilities;
12119
12255
  exports.defineMcpPrompt = defineMcpPrompt;
12120
12256
  exports.defineMcpResource = defineMcpResource;
12121
12257
  exports.defineMcpResourceTemplate = defineMcpResourceTemplate;
12258
+ exports.definePluginRegistration = definePluginRegistration;
12122
12259
  exports.defineXpertTool = defineXpertTool;
12123
12260
  exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
12124
12261
  exports.describeXpertToolProvider = describeXpertToolProvider;
@@ -12170,6 +12307,7 @@ exports.prepareToolResult = prepareToolResult;
12170
12307
  exports.processAsyncAIGCManagedJob = processAsyncAIGCManagedJob;
12171
12308
  exports.projectPipelineInvocationScopeSchema = projectPipelineInvocationScopeSchema;
12172
12309
  exports.readAnalyticsProviderDiagnostic = readAnalyticsProviderDiagnostic;
12310
+ exports.readPluginProviderRegistrations = readPluginProviderRegistrations;
12173
12311
  exports.renderRemoteModuleIframeHtml = renderRemoteModuleIframeHtml;
12174
12312
  exports.renderRemoteReactIframeHtml = renderRemoteReactIframeHtml;
12175
12313
  exports.renderRemoteVueIframeHtml = renderRemoteVueIframeHtml;
package/index.esm.js CHANGED
@@ -16,7 +16,7 @@ import fs__default from 'fs';
16
16
  import http from 'http';
17
17
  import https from 'https';
18
18
  import { c as createRuntimeCapability, B as BuiltinToolset, W as WorkspaceFilesRuntimeCapability } from './model-provider.esm.js';
19
- export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactContentRuntimeCapability, d as ArtifactDraftsRuntimeCapability, e as ArtifactLibraryRuntimeCapability, f as ArtifactUseGrantsRuntimeCapability, g as ArtifactsRuntimeCapability, h as AssistantMiddlewareAccessRuntimeCapability, i as BaseTool, j as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, k as McpClientRuntimeCapability, M as ModelProviderBuiltinToolset, P as PluginTestAccessCapability, l as ProjectAccessRuntimeCapability, m as ProjectConfigurationRuntimeCapability, n as ProjectFilesRuntimeCapability, o as ProjectKnowledgeRuntimeCapability, p as ProjectProvisioningRuntimeCapability, R as RUNTIME_CAPABILITY_PROVIDER, q as RestClientRuntimeCapability, r as RuntimeCapabilityProvider, S as SANDBOX_JOB_ERROR_CODES, s as SANDBOX_JOB_INVOCATION_PREFIX, t as SANDBOX_JOB_PROGRESS_PREFIX, u as SandboxJobRuntimeError, v as SandboxJobsRuntimeCapability, T as ToolImagesRuntimeCapability, w as WORKSPACE_FILES_SOURCE, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, x as isSandboxJobRuntimeError, y as workspaceFileMutationMetadata, z as workspaceFileMutationPath, C as workspaceRelativeDirectoryPathSchema, E as workspaceRelativeFilePathSchema } from './model-provider.esm.js';
19
+ export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactContentRuntimeCapability, d as ArtifactDraftsRuntimeCapability, e as ArtifactLibraryRuntimeCapability, f as ArtifactUseGrantsRuntimeCapability, g as ArtifactsRuntimeCapability, h as AssistantMiddlewareAccessRuntimeCapability, i as BaseTool, j as BaseToolset, C as ConversationRuntimeCapability, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, k as McpClientRuntimeCapability, M as ModelProviderBuiltinToolset, P as PluginTestAccessCapability, l as ProjectAccessRuntimeCapability, m as ProjectConfigurationRuntimeCapability, n as ProjectFilesRuntimeCapability, o as ProjectKnowledgeRuntimeCapability, p as ProjectProvisioningRuntimeCapability, R as RUNTIME_CAPABILITY_PROVIDER, q as RestClientRuntimeCapability, r as RuntimeCapabilityProvider, S as SANDBOX_JOB_ERROR_CODES, s as SANDBOX_JOB_INVOCATION_PREFIX, t as SANDBOX_JOB_PROGRESS_PREFIX, u as SandboxJobRuntimeError, v as SandboxJobsRuntimeCapability, T as ToolImagesRuntimeCapability, w as WORKSPACE_FILES_SOURCE, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, x as isSandboxJobRuntimeError, y as workspaceFileMutationMetadata, z as workspaceFileMutationPath, E as workspaceRelativeDirectoryPathSchema, F as workspaceRelativeFilePathSchema } from './model-provider.esm.js';
20
20
  import fsPromises from 'fs/promises';
21
21
  import * as path from 'path';
22
22
  import path__default, { join } from 'path';
@@ -498,9 +498,15 @@ StrategyBus = __decorate([
498
498
 
499
499
  class BaseStrategyRegistry {
500
500
  onModuleInit() {
501
- this.bus.events$.pipe(filter((event)=>!event.strategyType || event.strategyType === this.strategyKey)).subscribe((evt)=>{
501
+ var _this_strategySubscription;
502
+ (_this_strategySubscription = this.strategySubscription) == null ? void 0 : _this_strategySubscription.unsubscribe();
503
+ this.strategySubscription = this.bus.events$.pipe(filter((event)=>!event.strategyType || event.strategyType === this.strategyKey)).subscribe((evt)=>{
502
504
  if (evt.type === 'UPSERT') {
503
- this.upsert(evt.entry.instance);
505
+ try {
506
+ this.upsert(evt.entry.instance);
507
+ } catch (error) {
508
+ this.onRegistrationError(error);
509
+ }
504
510
  } else if (evt.type === 'REMOVE') {
505
511
  this.remove(evt.orgId, evt.pluginName);
506
512
  }
@@ -512,6 +518,14 @@ class BaseStrategyRegistry {
512
518
  this.upsert(instance);
513
519
  }
514
520
  }
521
+ onModuleDestroy() {
522
+ var _this_strategySubscription;
523
+ (_this_strategySubscription = this.strategySubscription) == null ? void 0 : _this_strategySubscription.unsubscribe();
524
+ this.strategySubscription = undefined;
525
+ }
526
+ /** Policy for rejected registrations delivered by the lifecycle bus. */ onRegistrationError(error) {
527
+ throw error;
528
+ }
515
529
  upsert(instance) {
516
530
  const target = resolveStrategyMetadataTarget(instance);
517
531
  if (!target) {
@@ -620,6 +634,14 @@ class BaseStrategyRegistry {
620
634
  }
621
635
  return scopeKeys;
622
636
  }
637
+ /** Resolves a registered name in the effective scope, without requiring a match. */ findByName(type, organizationId) {
638
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
639
+ var _this_strategies_get;
640
+ const strategy = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
641
+ if (strategy) return strategy;
642
+ }
643
+ return undefined;
644
+ }
623
645
  /**
624
646
  * Get strategy by type from the given organization including global strategies as fallback.
625
647
  *
@@ -627,11 +649,7 @@ class BaseStrategyRegistry {
627
649
  * @param organizationId
628
650
  * @returns
629
651
  */ get(type, organizationId) {
630
- organizationId != null ? organizationId : organizationId = RequestContext.getOrganizationId();
631
- const strategy = this.resolveStrategyScopeKeys(organizationId).map((scopeKey)=>{
632
- var _this_strategies_get;
633
- return (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(type);
634
- }).find((item)=>!!item);
652
+ const strategy = this.findByName(type, organizationId);
635
653
  if (!strategy) {
636
654
  throw new Error(`No strategy found for type '${type}' for strategy '${this.strategyKey}'`);
637
655
  }
@@ -819,6 +837,117 @@ ResourceCardProviderRegistry = ResourceCardProviderRegistry_1 = __decorate([
819
837
  ])
820
838
  ], ResourceCardProviderRegistry);
821
839
 
840
+ const kindPrefix = 'xpert:provider-registration:';
841
+ /** Declares a plugin-owned strategy category with a stable metadata key across SDK copies. */ function definePluginRegistration(metadataKey, kind = metadataKey) {
842
+ if (!metadataKey || metadataKey.trim() !== metadataKey || metadataKey === STRATEGY_META_KEY || metadataKey.startsWith(kindPrefix)) throw new Error('Invalid provider registration metadata key');
843
+ if (!kind || kind.trim() !== kind) throw new Error('A provider registration requires an exact category');
844
+ return (name)=>{
845
+ if (!name || name.trim() !== name) throw new Error('A provider registration requires an exact name');
846
+ return applyDecorators(Injectable(), SetMetadata(STRATEGY_META_KEY, metadataKey), SetMetadata(metadataKey, name), SetMetadata(kindPrefix + metadataKey, kind));
847
+ };
848
+ }
849
+ function assertPluginRegistrationOwner(name, pluginName) {
850
+ const separator = name.indexOf(':');
851
+ const owner = separator < 0 ? undefined : name.slice(0, separator);
852
+ const localName = name.slice(separator + 1);
853
+ if (owner !== pluginName || name.trim() !== name || !/^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*$/.test(localName)) throw new Error(`Registration '${name}' does not belong to ${pluginName != null ? pluginName : 'the platform'}`);
854
+ }
855
+ function readPluginProviderRegistrations(target, pluginName) {
856
+ const claims = [];
857
+ for (const key of Reflect.getMetadataKeys(target)){
858
+ if (typeof key !== 'string' || !key.startsWith(kindPrefix)) continue;
859
+ const metadataKey = key.slice(kindPrefix.length);
860
+ const kind = Reflect.getMetadata(key, target);
861
+ if (typeof kind !== 'string' || !kind.trim() || kind.trim() !== kind) throw new Error(`Invalid provider registration category for '${metadataKey}'`);
862
+ const name = Reflect.getMetadata(metadataKey, target);
863
+ if (typeof name !== 'string') throw new Error(`Invalid ${kind} registration name`);
864
+ assertPluginRegistrationOwner(name, pluginName);
865
+ claims.push({
866
+ kind,
867
+ key: name
868
+ });
869
+ }
870
+ return claims;
871
+ }
872
+
873
+ const MESSAGE_WIDGET_PROVIDER = 'XPERT_MESSAGE_WIDGET_PROVIDER';
874
+ const MessageWidgetProvider = definePluginRegistration(MESSAGE_WIDGET_PROVIDER, 'widget provider');
875
+
876
+ /** Opt-in registry for validated, owner-qualified providers that cannot replace a different live instance. */ class NamedProviderRegistry extends BaseStrategyRegistry {
877
+ upsert(instance) {
878
+ const target = resolveStrategyMetadataTarget(instance);
879
+ const name = target && this.reflector.get(this.strategyKey, target);
880
+ if (name == null) return;
881
+ if (typeof name !== 'string' || !name) throw new Error(`Invalid ${this.strategyKey} registration name`);
882
+ if (!instance || typeof instance !== 'object' || !this.isProvider(instance)) throw new Error(`Invalid ${this.strategyKey} provider '${name}'`);
883
+ this.register(name, instance, this.getSource(instance));
884
+ }
885
+ assertCanRegister(name, instance, source) {
886
+ var _this_strategies_get;
887
+ assertPluginRegistrationOwner(name, source.kind === 'plugin' ? source.pluginName : undefined);
888
+ const current = (_this_strategies_get = this.strategies.get(source.scopeKey)) == null ? void 0 : _this_strategies_get.get(name);
889
+ if (current && current !== instance) throw new Error(`Provider '${name}' is already registered in this scope`);
890
+ super.assertCanRegister(name, instance, source);
891
+ }
892
+ onRegistrationError(error) {
893
+ this.providerLogger.warn(error instanceof Error ? error.message : 'Invalid provider registration');
894
+ }
895
+ constructor(...args){
896
+ super(...args);
897
+ this.providerLogger = new Logger(this.constructor.name);
898
+ }
899
+ }
900
+
901
+ let MessageWidgetProviderRegistry = class MessageWidgetProviderRegistry extends NamedProviderRegistry {
902
+ isProvider(instance) {
903
+ return 'resolve' in instance && typeof instance.resolve === 'function';
904
+ }
905
+ constructor(discovery, reflector){
906
+ super(MESSAGE_WIDGET_PROVIDER, discovery, reflector);
907
+ }
908
+ };
909
+ MessageWidgetProviderRegistry = __decorate([
910
+ Injectable(),
911
+ __metadata("design:paramtypes", [
912
+ DiscoveryService,
913
+ Reflector
914
+ ])
915
+ ], MessageWidgetProviderRegistry);
916
+
917
+ const WIDGET_ACTION_PROVIDER = 'XPERT_WIDGET_ACTION_PROVIDER';
918
+ const WidgetActionProvider = definePluginRegistration(WIDGET_ACTION_PROVIDER, 'widget action provider');
919
+
920
+ const localActionName = /^[a-zA-Z0-9_-]+$/;
921
+ let WidgetActionProviderRegistry = class WidgetActionProviderRegistry extends NamedProviderRegistry {
922
+ isProvider(instance) {
923
+ if (!('actions' in instance) || !instance.actions || typeof instance.actions !== 'object' || Array.isArray(instance.actions)) return false;
924
+ const entries = Object.entries(instance.actions);
925
+ return entries.length > 0 && entries.every(([name, handler])=>localActionName.test(name) && isActionHandler(handler));
926
+ }
927
+ resolve(action) {
928
+ const separator = action.lastIndexOf('.');
929
+ if (separator < 1) return undefined;
930
+ const name = action.slice(separator + 1);
931
+ if (!localActionName.test(name)) return undefined;
932
+ const provider = this.findByName(action.slice(0, separator));
933
+ if (!provider || !Object.prototype.hasOwnProperty.call(provider.actions, name)) return undefined;
934
+ return provider.actions[name];
935
+ }
936
+ constructor(discovery, reflector){
937
+ super(WIDGET_ACTION_PROVIDER, discovery, reflector);
938
+ }
939
+ };
940
+ WidgetActionProviderRegistry = __decorate([
941
+ Injectable(),
942
+ __metadata("design:paramtypes", [
943
+ DiscoveryService,
944
+ Reflector
945
+ ])
946
+ ], WidgetActionProviderRegistry);
947
+ function isActionHandler(value) {
948
+ return !!value && typeof value === 'object' && 'execute' in value && typeof value.execute === 'function' && (!('widgetSource' in value) || value.widgetSource === undefined || value.widgetSource === 'message' || value.widgetSource === 'receipt');
949
+ }
950
+
822
951
  function createPluginLogger(scope, baseMeta = {}) {
823
952
  const nestLogger = new Logger(scope);
824
953
  const wrap = (level, msg, meta)=>{
@@ -11691,4 +11820,4 @@ function agentEventDigest(value) {
11691
11820
  const AGENT_EVENT_SOURCE = 'XPERT_AGENT_EVENT_SOURCE_V1';
11692
11821
  const AgentEventSourceStrategy = (key)=>applyDecorators(SetMetadata(AGENT_EVENT_SOURCE, key), SetMetadata(STRATEGY_META_KEY, AGENT_EVENT_SOURCE));
11693
11822
 
11694
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_EVENT_SOURCE, AGENT_MIDDLEWARE_STRATEGY, AGENT_PROCESS_SUPERVISOR, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PROVIDER, ARTIFACT_PRESENTATION_PROVIDER, ARTIFACT_TYPE_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentEventSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeDeploymentCapability, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AnalyticsDefinitionAuthoringCapability, AnalyticsProvider, AnalyticsProviderError, AnalyticsProviderRegistry, AnalyticsRuntimeCapability, ArtifactPresentationProvider, ArtifactPresentationRegistry, ArtifactTypeProvider, ArtifactTypeRegistry, 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, CONTENT_RESOURCE_PROVIDER, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorDocumentsRuntimeCapability, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, ContentDocumentsRuntimeCapability, ContentEditorProvider, ContentEditorRegistry, ContentEditorsRuntimeCapability, ContentReferencesRuntimeCapability, ContentResourceProvider, ContentResourceProviderRegistry, ContentResourcesRuntimeCapability, 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, ExecutionObservabilityRuntimeCapability, ExecutionReviewRuntimeCapability, FILE_ARTIFACT_TYPE, 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, ListAnalyticsSourcesCommand, 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, OpenAICompatibleEmbeddings, 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_PIPELINE_CONTRIBUTION, PROJECT_PIPELINE_PROJECTION_PROVIDER, PROJECT_PIPELINE_RUNTIME_ADAPTER, 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, PluginEventJournal, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectPipelineAnalyticsRuntimeCapability, ProjectPipelineCatalogRuntimeCapability, ProjectPipelineCommandsRuntimeCapability, ProjectPipelineConfigurationRuntimeCapability, ProjectPipelineContributionRegistry, ProjectPipelineContributor, ProjectPipelineEvidenceRuntimeCapability, ProjectPipelinePortfolioRuntimeCapability, ProjectPipelineProjectionProvider, ProjectPipelineProjectionProviderRegistry, ProjectPipelineProviderActionsRuntimeCapability, ProjectPipelineRuntimeAdapterProvider, ProjectPipelineRuntimeAdapterRegistry, ProjectPipelinesRuntimeCapability, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResolveAnalyticsSourceCommand, ResolveConnectorIntegrationQuery, 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, WorkbenchDecisionCapability, 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, agentEventDigest, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeDeploymentSpecSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, applyAssistantMiddleware, applyModelConfiguration, applyModelContextSize, artifactPresentationKey, artifactTypeKey, assertConnectorDefinition, assertXpertToolProviderClaims, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, canonicalEvolutionJson, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createMutationEvidence, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, discoverOpenAIModels, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, hasAssistantMiddleware, hashEvolutionValue, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isExecutionObservationSession, isFileContentEditor, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isResourceContentEditor, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, isTextContentEditor, jsonEncodedSchema, knowledgebaseActions, loadYamlFile, managedAgentRuntimeSchema, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, projectPipelineInvocationScopeSchema, readAnalyticsProviderDiagnostic, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, supportsContentModel, taskWaitReason, textTokenBoundaries, validateAnalyticsPayload };
11823
+ export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_EVENT_SOURCE, AGENT_MIDDLEWARE_STRATEGY, AGENT_PROCESS_SUPERVISOR, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PROVIDER, ARTIFACT_PRESENTATION_PROVIDER, ARTIFACT_TYPE_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentEventSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeDeploymentCapability, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AnalyticsDefinitionAuthoringCapability, AnalyticsProvider, AnalyticsProviderError, AnalyticsProviderRegistry, AnalyticsRuntimeCapability, ArtifactPresentationProvider, ArtifactPresentationRegistry, ArtifactTypeProvider, ArtifactTypeRegistry, 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, CONTENT_RESOURCE_PROVIDER, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorDocumentsRuntimeCapability, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, ContentDocumentsRuntimeCapability, ContentEditorProvider, ContentEditorRegistry, ContentEditorsRuntimeCapability, ContentReferencesRuntimeCapability, ContentResourceProvider, ContentResourceProviderRegistry, ContentResourcesRuntimeCapability, 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, ExecutionObservabilityRuntimeCapability, ExecutionReviewRuntimeCapability, FILE_ARTIFACT_TYPE, 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, ListAnalyticsSourcesCommand, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MESSAGE_WIDGET_PROVIDER, MODEL_OUTPUT_VALIDATION_ERROR_CODE, MessageWidgetProvider, MessageWidgetProviderRegistry, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, NamedProviderRegistry, ORGANIZATION_METADATA_KEY, OpenAICompatibleEmbeddings, 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_PIPELINE_CONTRIBUTION, PROJECT_PIPELINE_PROJECTION_PROVIDER, PROJECT_PIPELINE_RUNTIME_ADAPTER, 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, PluginEventJournal, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectPipelineAnalyticsRuntimeCapability, ProjectPipelineCatalogRuntimeCapability, ProjectPipelineCommandsRuntimeCapability, ProjectPipelineConfigurationRuntimeCapability, ProjectPipelineContributionRegistry, ProjectPipelineContributor, ProjectPipelineEvidenceRuntimeCapability, ProjectPipelinePortfolioRuntimeCapability, ProjectPipelineProjectionProvider, ProjectPipelineProjectionProviderRegistry, ProjectPipelineProviderActionsRuntimeCapability, ProjectPipelineRuntimeAdapterProvider, ProjectPipelineRuntimeAdapterRegistry, ProjectPipelinesRuntimeCapability, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResolveAnalyticsSourceCommand, ResolveConnectorIntegrationQuery, 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, WIDGET_ACTION_PROVIDER, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WidgetActionProvider, WidgetActionProviderRegistry, WorkbenchDecisionCapability, 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, agentEventDigest, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeDeploymentSpecSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, applyAssistantMiddleware, applyModelConfiguration, applyModelContextSize, artifactPresentationKey, artifactTypeKey, assertConnectorDefinition, assertPluginRegistrationOwner, assertXpertToolProviderClaims, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, canonicalEvolutionJson, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createMutationEvidence, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, definePluginRegistration, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, discoverOpenAIModels, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, hasAssistantMiddleware, hashEvolutionValue, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isExecutionObservationSession, isFileContentEditor, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isResourceContentEditor, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, isTextContentEditor, jsonEncodedSchema, knowledgebaseActions, loadYamlFile, managedAgentRuntimeSchema, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, projectPipelineInvocationScopeSchema, readAnalyticsProviderDiagnostic, readPluginProviderRegistrations, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, supportsContentModel, taskWaitReason, textTokenBoundaries, validateAnalyticsPayload };
@@ -307,6 +307,8 @@ const ProjectConfigurationRuntimeCapability = createRuntimeCapability('platform.
307
307
  description: 'Authorized Project configuration, membership, skills, connectors and automation operations.'
308
308
  });
309
309
 
310
+ const ConversationRuntimeCapability = createRuntimeCapability('platform.conversation');
311
+
310
312
  /** Portable Agent input; filesystem containment and authorization remain with the host. */ const workspaceRelativeFilePathSchema = v3.z.string().min(1).max(1024).refine((value)=>!/[\\\x00-\x1f\x7f]/.test(value) && !/^[A-Za-z]:/.test(value) && value.split('/').every((part)=>part.length > 0 && part === part.trim() && part !== '.' && part !== '..'), 'Use a workspace-relative file path with non-empty segments; no absolute paths, traversal or surrounding whitespace.');
311
313
  /** Directory discovery also accepts the workspace root and a trailing directory slash. */ const workspaceRelativeDirectoryPathSchema = v3.z.string().transform((value)=>value.endsWith('/') ? value.slice(0, -1) : value).pipe(v3.z.union([
312
314
  v3.z.literal('.'),
@@ -456,6 +458,7 @@ exports.AssistantMiddlewareAccessRuntimeCapability = AssistantMiddlewareAccessRu
456
458
  exports.BaseTool = BaseTool;
457
459
  exports.BaseToolset = BaseToolset;
458
460
  exports.BuiltinToolset = BuiltinToolset;
461
+ exports.ConversationRuntimeCapability = ConversationRuntimeCapability;
459
462
  exports.DefaultRuntimeCapabilityRegistry = DefaultRuntimeCapabilityRegistry;
460
463
  exports.McpClientRuntimeCapability = McpClientRuntimeCapability;
461
464
  exports.ModelProviderBuiltinToolset = ModelProviderBuiltinToolset;
@@ -305,6 +305,8 @@ const ProjectConfigurationRuntimeCapability = createRuntimeCapability('platform.
305
305
  description: 'Authorized Project configuration, membership, skills, connectors and automation operations.'
306
306
  });
307
307
 
308
+ const ConversationRuntimeCapability = createRuntimeCapability('platform.conversation');
309
+
308
310
  /** Portable Agent input; filesystem containment and authorization remain with the host. */ const workspaceRelativeFilePathSchema = z.string().min(1).max(1024).refine((value)=>!/[\\\x00-\x1f\x7f]/.test(value) && !/^[A-Za-z]:/.test(value) && value.split('/').every((part)=>part.length > 0 && part === part.trim() && part !== '.' && part !== '..'), 'Use a workspace-relative file path with non-empty segments; no absolute paths, traversal or surrounding whitespace.');
309
311
  /** Directory discovery also accepts the workspace root and a trailing directory slash. */ const workspaceRelativeDirectoryPathSchema = z.string().transform((value)=>value.endsWith('/') ? value.slice(0, -1) : value).pipe(z.union([
310
312
  z.literal('.'),
@@ -443,4 +445,4 @@ function normalizeWorkspaceScope(scope) {
443
445
  } : {});
444
446
  }
445
447
 
446
- export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, workspaceRelativeDirectoryPathSchema as C, DefaultRuntimeCapabilityRegistry as D, workspaceRelativeFilePathSchema as E, ModelProviderBuiltinToolset as M, PluginTestAccessCapability as P, RUNTIME_CAPABILITY_PROVIDER as R, SANDBOX_JOB_ERROR_CODES as S, ToolImagesRuntimeCapability as T, WorkspaceFilesRuntimeCapability as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ActorTokenRuntimeFactoryCapability as a, ArtifactContentRuntimeCapability as b, createRuntimeCapability as c, ArtifactDraftsRuntimeCapability as d, ArtifactLibraryRuntimeCapability as e, ArtifactUseGrantsRuntimeCapability as f, ArtifactsRuntimeCapability as g, AssistantMiddlewareAccessRuntimeCapability as h, BaseTool as i, BaseToolset as j, McpClientRuntimeCapability as k, ProjectAccessRuntimeCapability as l, ProjectConfigurationRuntimeCapability as m, ProjectFilesRuntimeCapability as n, ProjectKnowledgeRuntimeCapability as o, ProjectProvisioningRuntimeCapability as p, RestClientRuntimeCapability as q, RuntimeCapabilityProvider as r, SANDBOX_JOB_INVOCATION_PREFIX as s, SANDBOX_JOB_PROGRESS_PREFIX as t, SandboxJobRuntimeError as u, SandboxJobsRuntimeCapability as v, WORKSPACE_FILES_SOURCE as w, isSandboxJobRuntimeError as x, workspaceFileMutationMetadata as y, workspaceFileMutationPath as z };
448
+ export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, ConversationRuntimeCapability as C, DefaultRuntimeCapabilityRegistry as D, workspaceRelativeDirectoryPathSchema as E, workspaceRelativeFilePathSchema as F, ModelProviderBuiltinToolset as M, PluginTestAccessCapability as P, RUNTIME_CAPABILITY_PROVIDER as R, SANDBOX_JOB_ERROR_CODES as S, ToolImagesRuntimeCapability as T, WorkspaceFilesRuntimeCapability as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ActorTokenRuntimeFactoryCapability as a, ArtifactContentRuntimeCapability as b, createRuntimeCapability as c, ArtifactDraftsRuntimeCapability as d, ArtifactLibraryRuntimeCapability as e, ArtifactUseGrantsRuntimeCapability as f, ArtifactsRuntimeCapability as g, AssistantMiddlewareAccessRuntimeCapability as h, BaseTool as i, BaseToolset as j, McpClientRuntimeCapability as k, ProjectAccessRuntimeCapability as l, ProjectConfigurationRuntimeCapability as m, ProjectFilesRuntimeCapability as n, ProjectKnowledgeRuntimeCapability as o, ProjectProvisioningRuntimeCapability as p, RestClientRuntimeCapability as q, RuntimeCapabilityProvider as r, SANDBOX_JOB_INVOCATION_PREFIX as s, SANDBOX_JOB_PROGRESS_PREFIX as t, SandboxJobRuntimeError as u, SandboxJobsRuntimeCapability as v, WORKSPACE_FILES_SOURCE as w, isSandboxJobRuntimeError as x, workspaceFileMutationMetadata as y, workspaceFileMutationPath as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.37.2",
3
+ "version": "3.38.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@langchain/openai": "0.6.9",
83
- "@xpert-ai/contracts": "3.37.2",
83
+ "@xpert-ai/contracts": "3.38.0",
84
84
  "express": "^4.22.1",
85
85
  "js-tiktoken": "^1.0.21"
86
86
  },
package/src/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './lib/plugin-metadata';
4
4
  export * from './lib/artifact-namespace';
5
5
  export * from './lib/resource-card';
6
6
  export * from './lib/resource-card-provider';
7
+ export * from './lib/widgets';
7
8
  export * from './lib/types';
8
9
  export * from './lib/logger';
9
10
  export * from './lib/integration/index';
@@ -10,6 +10,8 @@ export interface ArtifactDocumentHostOptions<T> {
10
10
  dependencies?: ArtifactDocumentDependencyAsset[];
11
11
  /** Trusted resource policy; unrestricted mode permits networking. Omit to block external resources. */
12
12
  networkPolicy?: ArtifactDocumentNetworkPolicy;
13
+ /** Allow this document to initiate file downloads. Only a trusted host may opt in. */
14
+ allowDownloads?: boolean;
13
15
  /** Public binding IDs and presentation defaults for this document generation. */
14
16
  context: ArtifactDocumentContext;
15
17
  /** Resolve against saved Bindings on the server with the current user's access; never execute a query definition from HTML. */
@@ -10,3 +10,5 @@ export * from './types';
10
10
  export * from './strategy-bus';
11
11
  export * from './webhook';
12
12
  export * from './runtime-capability';
13
+ export * from './named-provider.registry';
14
+ export { assertPluginRegistrationOwner, definePluginRegistration, readPluginProviderRegistrations, type PluginProviderRegistration } from './provider-registration';
@@ -0,0 +1,9 @@
1
+ import { BaseStrategyRegistry, type StrategySource } from '../strategy';
2
+ /** Opt-in registry for validated, owner-qualified providers that cannot replace a different live instance. */
3
+ export declare abstract class NamedProviderRegistry<T extends object> extends BaseStrategyRegistry<T> {
4
+ private readonly providerLogger;
5
+ protected abstract isProvider(instance: object): instance is T;
6
+ upsert(instance: unknown): void;
7
+ assertCanRegister(name: string, instance: T, source: StrategySource): void;
8
+ protected onRegistrationError(error: unknown): void;
9
+ }
@@ -0,0 +1,9 @@
1
+ /** A name is unique within its registration category and installation scope. */
2
+ export interface PluginProviderRegistration {
3
+ kind: string;
4
+ key: string;
5
+ }
6
+ /** Declares a plugin-owned strategy category with a stable metadata key across SDK copies. */
7
+ export declare function definePluginRegistration(metadataKey: string, kind?: string): (name: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
8
+ export declare function assertPluginRegistrationOwner(name: string, pluginName?: string): void;
9
+ export declare function readPluginProviderRegistrations(target: object, pluginName: string): PluginProviderRegistration[];
@@ -67,8 +67,9 @@ export interface ProjectPipelineAssistantContext extends ProjectPipelineOperatio
67
67
  export interface ProjectPipelineAssistantOperation {
68
68
  /** Bounded domain prompt/context only; no actor, Project, model or executor overrides. */
69
69
  prepare(context: ProjectPipelineAssistantContext): Promise<ProjectPipelineAssistantInput>;
70
- /** Read the domain outputs after the native Runtime confirms success. Must be idempotent. */
71
- collect(context: ProjectPipelineAssistantContext): Promise<Record<string, ProjectPipelineEvidenceRef>>;
70
+ /** Called after native execution and delegated result delivery settle. Return null only when the
71
+ * assigned assistant definitively ended without the required outputs. Throw on an uncertain read. */
72
+ collect(context: ProjectPipelineAssistantContext): Promise<Record<string, ProjectPipelineEvidenceRef> | null>;
72
73
  }
73
74
  export interface ProjectPipelineRuntimeContext extends ProjectPipelineOperationContext {
74
75
  executor: {
@@ -58,6 +58,10 @@ export type KnowledgebaseDocumentRecord = {
58
58
  };
59
59
  export type KnowledgebaseListDocumentsInput = {
60
60
  knowledgebaseId: string;
61
+ /** Exact source fingerprint; null selects legacy documents without a fingerprint. */
62
+ sourceHash?: string | null;
63
+ /** Exact original byte size, optionally narrowing a legacy fingerprint lookup. */
64
+ size?: number;
61
65
  page?: number;
62
66
  pageSize?: number;
63
67
  search?: string;
@@ -77,6 +81,11 @@ export type KnowledgebaseListDocumentsResult = {
77
81
  total: number;
78
82
  page: number;
79
83
  pageSize: number;
84
+ /** Echo validated exact filters so clients never mistake an older host's unfiltered result for a match. */
85
+ appliedFilters?: {
86
+ sourceHash?: string | null;
87
+ size?: number;
88
+ };
80
89
  };
81
90
  export type KnowledgebaseCreateFolderInput = {
82
91
  knowledgebaseId: string;
@@ -0,0 +1,8 @@
1
+ import type { IMessageWidgetProvider, MessageWidgetReference } from '../../widgets/message-widget-provider/types';
2
+ export interface ConversationRuntimeApi {
3
+ /** Binds a provider-owned Widget to an assistant reply in the current thread. */
4
+ publishWidget(issuer: IMessageWidgetProvider, widget: Pick<MessageWidgetReference, 'provider' | 'widgetId'> & {
5
+ messageId?: string;
6
+ }): Promise<void>;
7
+ }
8
+ export declare const ConversationRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ConversationRuntimeApi>;
@@ -18,3 +18,4 @@ export * from './project-knowledge';
18
18
  export * from './mcp-client-runtime';
19
19
  export * from './rest-client-runtime';
20
20
  export * from './project-configuration';
21
+ export * from './conversation';
@@ -1,4 +1,4 @@
1
- import { OnModuleInit, type Type } from '@nestjs/common';
1
+ import { OnModuleInit, type OnModuleDestroy, type Type } from '@nestjs/common';
2
2
  import { DiscoveryService, Reflector } from '@nestjs/core';
3
3
  import { StrategyBus } from './core/strategy-bus';
4
4
  export type StrategySource = {
@@ -10,17 +10,21 @@ export type StrategySource = {
10
10
  pluginVersion?: string;
11
11
  scopeKey: string;
12
12
  };
13
- export declare class BaseStrategyRegistry<S> implements OnModuleInit {
13
+ export declare class BaseStrategyRegistry<S> implements OnModuleInit, OnModuleDestroy {
14
14
  protected readonly strategyKey: string;
15
15
  protected discoveryService: DiscoveryService;
16
16
  protected reflector: Reflector;
17
17
  private readonly logger;
18
+ private strategySubscription?;
18
19
  protected readonly bus: StrategyBus;
19
20
  protected strategies: Map<string, Map<string, S>>;
20
21
  protected pluginStrategies: Map<string, Set<string>>;
21
22
  private readonly explicitSources;
22
23
  constructor(strategyKey: string, discoveryService: DiscoveryService, reflector: Reflector);
23
24
  onModuleInit(): void;
25
+ onModuleDestroy(): void;
26
+ /** Policy for rejected registrations delivered by the lifecycle bus. */
27
+ protected onRegistrationError(error: unknown): void;
24
28
  upsert(instance: unknown): void;
25
29
  /** Registers a host-generated adapter without mutating shared class metadata. */
26
30
  register(type: string, instance: S, source: StrategySource): S;
@@ -40,6 +44,8 @@ export declare class BaseStrategyRegistry<S> implements OnModuleInit {
40
44
  protected resolveOrganization(organizationId?: string): string;
41
45
  protected resolveGlobalFallbackOrganization(): string;
42
46
  protected resolveStrategyScopeKeys(organizationId?: string): string[];
47
+ /** Resolves a registered name in the effective scope, without requiring a match. */
48
+ findByName(type: string, organizationId?: string): S | undefined;
43
49
  /**
44
50
  * Get strategy by type from the given organization including global strategies as fallback.
45
51
  *
@@ -0,0 +1,2 @@
1
+ export * from './message-widget-provider';
2
+ export * from './widget-action';
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './provider.decorator';
3
+ export * from './provider.registry';
@@ -0,0 +1,2 @@
1
+ export declare const MESSAGE_WIDGET_PROVIDER = "XPERT_MESSAGE_WIDGET_PROVIDER";
2
+ export declare const MessageWidgetProvider: (name: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,7 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import { NamedProviderRegistry } from '../../core/named-provider.registry';
3
+ import type { IMessageWidgetProvider } from './types';
4
+ export declare class MessageWidgetProviderRegistry extends NamedProviderRegistry<IMessageWidgetProvider> {
5
+ constructor(discovery: DiscoveryService, reflector: Reflector);
6
+ protected isProvider(instance: object): instance is IMessageWidgetProvider;
7
+ }
@@ -0,0 +1,16 @@
1
+ import type { TMessageContentWidget } from '@xpert-ai/contracts';
2
+ export interface MessageWidgetReference {
3
+ threadId: string;
4
+ messageId: string;
5
+ widgetId: string;
6
+ provider: string;
7
+ }
8
+ export interface IMessageWidgetProvider {
9
+ /** Explicit opt-in to producing audience-safe content for restricted runtime sessions. */
10
+ readonly visibleInRestrictedSessions?: boolean;
11
+ /** Only currently authorized cards may be returned. Omitted references remain hidden. */
12
+ resolve(references: readonly MessageWidgetReference[]): Promise<Array<{
13
+ messageId: string;
14
+ widget: TMessageContentWidget;
15
+ }>>;
16
+ }
@@ -0,0 +1,2 @@
1
+ export declare const WIDGET_ACTION_PROVIDER = "XPERT_WIDGET_ACTION_PROVIDER";
2
+ export declare const WidgetActionProvider: (name: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,8 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import { NamedProviderRegistry } from '../../core/named-provider.registry';
3
+ import type { IWidgetActionHandler, IWidgetActionProvider } from './types';
4
+ export declare class WidgetActionProviderRegistry extends NamedProviderRegistry<IWidgetActionProvider> {
5
+ constructor(discovery: DiscoveryService, reflector: Reflector);
6
+ protected isProvider(instance: object): instance is IWidgetActionProvider;
7
+ resolve(action: string): IWidgetActionHandler | undefined;
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './action.decorator';
3
+ export * from './action.registry';
@@ -0,0 +1,19 @@
1
+ export interface WidgetActionContext {
2
+ threadId: string;
3
+ messageId: string;
4
+ widgetId: string;
5
+ /** Untrusted form values supplied by the caller. */
6
+ fields: Record<string, unknown>;
7
+ }
8
+ export interface IWidgetActionHandler {
9
+ /** Receipt-backed widgets require the handler to verify the authoritative offer before performing any mutation. */
10
+ readonly widgetSource?: 'message' | 'receipt';
11
+ /** The handler enforces business permissions and validates the submitted fields. */
12
+ execute(context: WidgetActionContext): Promise<{
13
+ refresh?: 'thread';
14
+ }>;
15
+ }
16
+ export interface IWidgetActionProvider {
17
+ /** Local names contain only letters, digits, underscores or hyphens and are scoped to this provider. */
18
+ readonly actions: Readonly<Record<string, IWidgetActionHandler>>;
19
+ }