@xpert-ai/plugin-sdk 3.37.2 → 3.38.1
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/artifact-document.cjs.js +1 -1
- package/artifact-document.esm.js +1 -1
- package/docs/README.md +87 -0
- package/docs/artifact-documents.md +1 -1
- package/index.cjs.js +151 -18
- package/index.esm.js +144 -20
- package/model-provider.cjs.js +3 -0
- package/model-provider.esm.js +3 -1
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/artifact-document/host.d.ts +2 -0
- package/src/lib/core/index.d.ts +2 -0
- package/src/lib/core/named-provider.registry.d.ts +9 -0
- package/src/lib/core/provider-registration.d.ts +9 -0
- package/src/lib/data/analytics/analytics-provider.d.ts +84 -2
- package/src/lib/project-pipeline/adapters.d.ts +3 -2
- package/src/lib/rag/capability/knowledgebase-documents.d.ts +9 -0
- package/src/lib/runtime/capabilities/conversation.d.ts +8 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/project-access.d.ts +10 -1
- package/src/lib/runtime/capabilities/tool-images.d.ts +2 -1
- package/src/lib/strategy.d.ts +8 -2
- package/src/lib/widgets/index.d.ts +2 -0
- package/src/lib/widgets/message-widget-provider/index.d.ts +3 -0
- package/src/lib/widgets/message-widget-provider/provider.decorator.d.ts +2 -0
- package/src/lib/widgets/message-widget-provider/provider.registry.d.ts +7 -0
- package/src/lib/widgets/message-widget-provider/types.d.ts +16 -0
- package/src/lib/widgets/widget-action/action.decorator.d.ts +2 -0
- package/src/lib/widgets/widget-action/action.registry.d.ts +8 -0
- package/src/lib/widgets/widget-action/index.d.ts +3 -0
- package/src/lib/widgets/widget-action/types.d.ts +19 -0
package/artifact-document.cjs.js
CHANGED
|
@@ -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)=>{
|
package/artifact-document.esm.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)=>{
|
|
@@ -5616,7 +5745,6 @@ if (endIndex < allEntries.length) {
|
|
|
5616
5745
|
return value.split(node_path.sep).join('/') || '.';
|
|
5617
5746
|
}
|
|
5618
5747
|
|
|
5619
|
-
const MAX_LINE_LENGTH = 500;
|
|
5620
5748
|
const MAX_GREP_LINE_LENGTH = 2000;
|
|
5621
5749
|
const GREP_RESULT_LIMIT = 100;
|
|
5622
5750
|
const GLOB_RESULT_LIMIT = 100;
|
|
@@ -5771,7 +5899,6 @@ const COMMENT_PREFIXES = [
|
|
|
5771
5899
|
const safeLimit = Number.isFinite(limit) && limit > 0 && limit < Number.MAX_SAFE_INTEGER ? Math.floor(limit) : 2000;
|
|
5772
5900
|
return `node -e "
|
|
5773
5901
|
const fs = require('fs');
|
|
5774
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5775
5902
|
|
|
5776
5903
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5777
5904
|
const offset = ${safeOffset};
|
|
@@ -5800,10 +5927,7 @@ const selected = lines.slice(offset, offset + limit);
|
|
|
5800
5927
|
|
|
5801
5928
|
for (let i = 0; i < selected.length; i++) {
|
|
5802
5929
|
const lineNum = offset + i + 1;
|
|
5803
|
-
|
|
5804
|
-
if (line.length > MAX_LINE_LENGTH) {
|
|
5805
|
-
line = line.substring(0, MAX_LINE_LENGTH);
|
|
5806
|
-
}
|
|
5930
|
+
const line = selected[i];
|
|
5807
5931
|
console.log('L' + lineNum + ': ' + line);
|
|
5808
5932
|
}
|
|
5809
5933
|
"`;
|
|
@@ -5826,9 +5950,8 @@ for (let i = 0; i < selected.length; i++) {
|
|
|
5826
5950
|
const maxLines = (_options_max_lines = options.max_lines) != null ? _options_max_lines : safeLimit;
|
|
5827
5951
|
return `node -e "
|
|
5828
5952
|
const fs = require('fs');
|
|
5829
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5830
5953
|
const TAB_WIDTH = ${TAB_WIDTH};
|
|
5831
|
-
const COMMENT_PREFIXES = ${JSON.stringify(COMMENT_PREFIXES)};
|
|
5954
|
+
const COMMENT_PREFIXES = JSON.parse(Buffer.from('${utf8ToBase64(JSON.stringify(COMMENT_PREFIXES))}', 'base64').toString('utf8'));
|
|
5832
5955
|
|
|
5833
5956
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5834
5957
|
const anchorLine = ${anchorLine};
|
|
@@ -5863,12 +5986,11 @@ function measureIndent(line) {
|
|
|
5863
5986
|
|
|
5864
5987
|
function isBlank(line) { return line.trim() === ''; }
|
|
5865
5988
|
function isComment(line) { return COMMENT_PREFIXES.some(p => line.trim().startsWith(p)); }
|
|
5866
|
-
function formatLine(line) { return line.length > MAX_LINE_LENGTH ? line.substring(0, MAX_LINE_LENGTH) : line; }
|
|
5867
5989
|
|
|
5868
5990
|
const records = rawLines.map((raw, i) => ({
|
|
5869
5991
|
number: i + 1,
|
|
5870
5992
|
raw,
|
|
5871
|
-
display:
|
|
5993
|
+
display: raw,
|
|
5872
5994
|
indent: measureIndent(raw)
|
|
5873
5995
|
}));
|
|
5874
5996
|
|
|
@@ -6173,7 +6295,9 @@ try {
|
|
|
6173
6295
|
if (result.exitCode !== 0) {
|
|
6174
6296
|
return result.output || `Error: File '${filePath}' not found`;
|
|
6175
6297
|
}
|
|
6176
|
-
|
|
6298
|
+
// Exact-text edits require the entire selected line, including long JSON strings.
|
|
6299
|
+
// The backend still enforces the operation output budget; never disguise clipping as a complete read.
|
|
6300
|
+
return result.truncated ? result.output + '\n[Read output truncated by the sandbox output limit. Do not use incomplete lines as exact edit text; read a smaller line range.]' : result.output;
|
|
6177
6301
|
}
|
|
6178
6302
|
/**
|
|
6179
6303
|
* Structured search results or error string for invalid input.
|
|
@@ -11780,6 +11904,7 @@ exports.AssistantMiddlewareAccessRuntimeCapability = modelProvider.AssistantMidd
|
|
|
11780
11904
|
exports.BaseTool = modelProvider.BaseTool;
|
|
11781
11905
|
exports.BaseToolset = modelProvider.BaseToolset;
|
|
11782
11906
|
exports.BuiltinToolset = modelProvider.BuiltinToolset;
|
|
11907
|
+
exports.ConversationRuntimeCapability = modelProvider.ConversationRuntimeCapability;
|
|
11783
11908
|
exports.DefaultAgentMiddlewareRuntimeCapabilityRegistry = modelProvider.DefaultRuntimeCapabilityRegistry;
|
|
11784
11909
|
exports.DefaultRuntimeCapabilityRegistry = modelProvider.DefaultRuntimeCapabilityRegistry;
|
|
11785
11910
|
exports.McpClientRuntimeCapability = modelProvider.McpClientRuntimeCapability;
|
|
@@ -11974,9 +12099,12 @@ exports.MANAGED_CONNECTION_REGISTRY_TOKEN = MANAGED_CONNECTION_REGISTRY_TOKEN;
|
|
|
11974
12099
|
exports.MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN = MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN;
|
|
11975
12100
|
exports.MANAGED_QUEUE_SERVICE_TOKEN = MANAGED_QUEUE_SERVICE_TOKEN;
|
|
11976
12101
|
exports.MCP_CAPABILITY_CHANGE_EVENT_TYPES = MCP_CAPABILITY_CHANGE_EVENT_TYPES;
|
|
12102
|
+
exports.MESSAGE_WIDGET_PROVIDER = MESSAGE_WIDGET_PROVIDER;
|
|
11977
12103
|
exports.MODEL_OUTPUT_VALIDATION_ERROR_CODE = MODEL_OUTPUT_VALIDATION_ERROR_CODE;
|
|
12104
|
+
exports.MessageWidgetProvider = MessageWidgetProvider;
|
|
11978
12105
|
exports.ModelExecutionEnvironmentCapability = ModelExecutionEnvironmentCapability;
|
|
11979
12106
|
exports.ModelOutputValidationError = ModelOutputValidationError;
|
|
12107
|
+
exports.NamedProviderRegistry = NamedProviderRegistry;
|
|
11980
12108
|
exports.ORGANIZATION_METADATA_KEY = ORGANIZATION_METADATA_KEY;
|
|
11981
12109
|
exports.OpenAICompatibleEmbeddings = OpenAICompatibleEmbeddings;
|
|
11982
12110
|
exports.OpenAICompatibleReranker = OpenAICompatibleReranker;
|
|
@@ -12064,8 +12192,10 @@ exports.VectorStoreStrategy = VectorStoreStrategy;
|
|
|
12064
12192
|
exports.VideoGenerationModel = VideoGenerationModel;
|
|
12065
12193
|
exports.ViewExtensionProvider = ViewExtensionProvider;
|
|
12066
12194
|
exports.ViewMiddlewareRuntimeCapability = ViewMiddlewareRuntimeCapability;
|
|
12195
|
+
exports.WIDGET_ACTION_PROVIDER = WIDGET_ACTION_PROVIDER;
|
|
12067
12196
|
exports.WORKFLOW_NODE_STRATEGY = WORKFLOW_NODE_STRATEGY;
|
|
12068
12197
|
exports.WORKFLOW_TRIGGER_STRATEGY = WORKFLOW_TRIGGER_STRATEGY;
|
|
12198
|
+
exports.WidgetActionProvider = WidgetActionProvider;
|
|
12069
12199
|
exports.WorkbenchDecisionCapability = WorkbenchDecisionCapability;
|
|
12070
12200
|
exports.WorkflowNodeStrategy = WorkflowNodeStrategy;
|
|
12071
12201
|
exports.WorkflowTriggerStrategy = WorkflowTriggerStrategy;
|
|
@@ -12099,6 +12229,7 @@ exports.applyModelConfiguration = applyModelConfiguration;
|
|
|
12099
12229
|
exports.applyModelContextSize = applyModelContextSize;
|
|
12100
12230
|
exports.artifactPresentationKey = artifactPresentationKey;
|
|
12101
12231
|
exports.artifactTypeKey = artifactTypeKey;
|
|
12232
|
+
exports.assertPluginRegistrationOwner = assertPluginRegistrationOwner;
|
|
12102
12233
|
exports.assertXpertToolProviderClaims = assertXpertToolProviderClaims;
|
|
12103
12234
|
exports.buildSandboxTimeoutMessage = buildSandboxTimeoutMessage;
|
|
12104
12235
|
exports.calcTokenUsage = calcTokenUsage;
|
|
@@ -12119,6 +12250,7 @@ exports.defineMcpCapabilities = defineMcpCapabilities;
|
|
|
12119
12250
|
exports.defineMcpPrompt = defineMcpPrompt;
|
|
12120
12251
|
exports.defineMcpResource = defineMcpResource;
|
|
12121
12252
|
exports.defineMcpResourceTemplate = defineMcpResourceTemplate;
|
|
12253
|
+
exports.definePluginRegistration = definePluginRegistration;
|
|
12122
12254
|
exports.defineXpertTool = defineXpertTool;
|
|
12123
12255
|
exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
|
|
12124
12256
|
exports.describeXpertToolProvider = describeXpertToolProvider;
|
|
@@ -12170,6 +12302,7 @@ exports.prepareToolResult = prepareToolResult;
|
|
|
12170
12302
|
exports.processAsyncAIGCManagedJob = processAsyncAIGCManagedJob;
|
|
12171
12303
|
exports.projectPipelineInvocationScopeSchema = projectPipelineInvocationScopeSchema;
|
|
12172
12304
|
exports.readAnalyticsProviderDiagnostic = readAnalyticsProviderDiagnostic;
|
|
12305
|
+
exports.readPluginProviderRegistrations = readPluginProviderRegistrations;
|
|
12173
12306
|
exports.renderRemoteModuleIframeHtml = renderRemoteModuleIframeHtml;
|
|
12174
12307
|
exports.renderRemoteReactIframeHtml = renderRemoteReactIframeHtml;
|
|
12175
12308
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)=>{
|
|
@@ -5598,7 +5727,6 @@ if (endIndex < allEntries.length) {
|
|
|
5598
5727
|
return value.split(sep).join('/') || '.';
|
|
5599
5728
|
}
|
|
5600
5729
|
|
|
5601
|
-
const MAX_LINE_LENGTH = 500;
|
|
5602
5730
|
const MAX_GREP_LINE_LENGTH = 2000;
|
|
5603
5731
|
const GREP_RESULT_LIMIT = 100;
|
|
5604
5732
|
const GLOB_RESULT_LIMIT = 100;
|
|
@@ -5753,7 +5881,6 @@ const COMMENT_PREFIXES = [
|
|
|
5753
5881
|
const safeLimit = Number.isFinite(limit) && limit > 0 && limit < Number.MAX_SAFE_INTEGER ? Math.floor(limit) : 2000;
|
|
5754
5882
|
return `node -e "
|
|
5755
5883
|
const fs = require('fs');
|
|
5756
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5757
5884
|
|
|
5758
5885
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5759
5886
|
const offset = ${safeOffset};
|
|
@@ -5782,10 +5909,7 @@ const selected = lines.slice(offset, offset + limit);
|
|
|
5782
5909
|
|
|
5783
5910
|
for (let i = 0; i < selected.length; i++) {
|
|
5784
5911
|
const lineNum = offset + i + 1;
|
|
5785
|
-
|
|
5786
|
-
if (line.length > MAX_LINE_LENGTH) {
|
|
5787
|
-
line = line.substring(0, MAX_LINE_LENGTH);
|
|
5788
|
-
}
|
|
5912
|
+
const line = selected[i];
|
|
5789
5913
|
console.log('L' + lineNum + ': ' + line);
|
|
5790
5914
|
}
|
|
5791
5915
|
"`;
|
|
@@ -5808,9 +5932,8 @@ for (let i = 0; i < selected.length; i++) {
|
|
|
5808
5932
|
const maxLines = (_options_max_lines = options.max_lines) != null ? _options_max_lines : safeLimit;
|
|
5809
5933
|
return `node -e "
|
|
5810
5934
|
const fs = require('fs');
|
|
5811
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5812
5935
|
const TAB_WIDTH = ${TAB_WIDTH};
|
|
5813
|
-
const COMMENT_PREFIXES = ${JSON.stringify(COMMENT_PREFIXES)};
|
|
5936
|
+
const COMMENT_PREFIXES = JSON.parse(Buffer.from('${utf8ToBase64(JSON.stringify(COMMENT_PREFIXES))}', 'base64').toString('utf8'));
|
|
5814
5937
|
|
|
5815
5938
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5816
5939
|
const anchorLine = ${anchorLine};
|
|
@@ -5845,12 +5968,11 @@ function measureIndent(line) {
|
|
|
5845
5968
|
|
|
5846
5969
|
function isBlank(line) { return line.trim() === ''; }
|
|
5847
5970
|
function isComment(line) { return COMMENT_PREFIXES.some(p => line.trim().startsWith(p)); }
|
|
5848
|
-
function formatLine(line) { return line.length > MAX_LINE_LENGTH ? line.substring(0, MAX_LINE_LENGTH) : line; }
|
|
5849
5971
|
|
|
5850
5972
|
const records = rawLines.map((raw, i) => ({
|
|
5851
5973
|
number: i + 1,
|
|
5852
5974
|
raw,
|
|
5853
|
-
display:
|
|
5975
|
+
display: raw,
|
|
5854
5976
|
indent: measureIndent(raw)
|
|
5855
5977
|
}));
|
|
5856
5978
|
|
|
@@ -6155,7 +6277,9 @@ try {
|
|
|
6155
6277
|
if (result.exitCode !== 0) {
|
|
6156
6278
|
return result.output || `Error: File '${filePath}' not found`;
|
|
6157
6279
|
}
|
|
6158
|
-
|
|
6280
|
+
// Exact-text edits require the entire selected line, including long JSON strings.
|
|
6281
|
+
// The backend still enforces the operation output budget; never disguise clipping as a complete read.
|
|
6282
|
+
return result.truncated ? result.output + '\n[Read output truncated by the sandbox output limit. Do not use incomplete lines as exact edit text; read a smaller line range.]' : result.output;
|
|
6159
6283
|
}
|
|
6160
6284
|
/**
|
|
6161
6285
|
* Structured search results or error string for invalid input.
|
|
@@ -11691,4 +11815,4 @@ function agentEventDigest(value) {
|
|
|
11691
11815
|
const AGENT_EVENT_SOURCE = 'XPERT_AGENT_EVENT_SOURCE_V1';
|
|
11692
11816
|
const AgentEventSourceStrategy = (key)=>applyDecorators(SetMetadata(AGENT_EVENT_SOURCE, key), SetMetadata(STRATEGY_META_KEY, AGENT_EVENT_SOURCE));
|
|
11693
11817
|
|
|
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 };
|
|
11818
|
+
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 };
|
package/model-provider.cjs.js
CHANGED
|
@@ -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;
|
package/model-provider.esm.js
CHANGED
|
@@ -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,
|
|
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.
|
|
3
|
+
"version": "3.38.1",
|
|
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.
|
|
83
|
+
"@xpert-ai/contracts": "3.38.1",
|
|
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. */
|
package/src/lib/core/index.d.ts
CHANGED
|
@@ -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[];
|
|
@@ -46,12 +46,94 @@ export interface AnalyticsProviderResult {
|
|
|
46
46
|
/** Only source-verified business approvals; never copy from Binding payload or display metadata. */
|
|
47
47
|
certification?: AnalyticalDataset['provenance']['certification'];
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Host-supplied scope for one model setup operation on an authorized connection.
|
|
51
|
+
* Providers use this actor and connection for source access and propagate the signal and deadline to upstream calls.
|
|
52
|
+
*/
|
|
53
|
+
export interface AnalyticsModelSetupContext {
|
|
54
|
+
/** Include models prepared through application templates when the actor has access to them. */
|
|
55
|
+
includeProvisioned?: boolean;
|
|
56
|
+
/** Only the selected connection. Rechecks the acting organization's configuration grant on every read. */
|
|
57
|
+
readConnectionOptions(): Promise<unknown>;
|
|
58
|
+
actor: DataSourceActor;
|
|
59
|
+
integrationId: string;
|
|
60
|
+
signal: AbortSignal;
|
|
61
|
+
deadlineAt: number;
|
|
62
|
+
}
|
|
63
|
+
/** Choices an administrator reviews before preparing a model from an application template. */
|
|
64
|
+
export interface AnalyticsModelBootstrapSelection {
|
|
65
|
+
workspaceId: string;
|
|
66
|
+
dataSourceId: string;
|
|
67
|
+
/** Stable ID of a preparation mode declared by the application's bootstrap template. */
|
|
68
|
+
mode: string;
|
|
69
|
+
/** Organization members selected to receive read access in this operation. Existing grants are retained. */
|
|
70
|
+
userIds: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Optional provider extension for preparing a model from the application's versioned bundle.
|
|
74
|
+
* Inspect the selected resources before confirmation. Applying the confirmed plan must support retries
|
|
75
|
+
* and preserve existing resources when their configuration conflicts with the plan.
|
|
76
|
+
*/
|
|
77
|
+
export interface AnalyticsModelBootstrap {
|
|
78
|
+
workspaces(context: AnalyticsModelSetupContext): Promise<Array<{
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
}>>;
|
|
82
|
+
sources(context: AnalyticsModelSetupContext, workspaceId: string): Promise<Array<{
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}>>;
|
|
86
|
+
/** Describe the proposed changes without writing. The fingerprint identifies the state reviewed by the administrator. */
|
|
87
|
+
inspect(context: AnalyticsModelSetupContext, bundle: JSONValue, selection: AnalyticsModelBootstrapSelection): Promise<{
|
|
88
|
+
state: 'create' | 'resume' | 'reuse' | 'conflict';
|
|
89
|
+
modelLabel: string;
|
|
90
|
+
fingerprint: string;
|
|
91
|
+
differences: string[];
|
|
92
|
+
}>;
|
|
93
|
+
/** Recheck the fingerprint before making changes. Use the host callbacks for scoped access to the prepared model. */
|
|
94
|
+
apply(context: AnalyticsModelSetupContext, bundle: JSONValue, selection: AnalyticsModelBootstrapSelection, fingerprint: string, access: {
|
|
95
|
+
area(modelKey: string, name: string): Promise<string>;
|
|
96
|
+
prepare(resourceId: string, name: string): Promise<{
|
|
97
|
+
xpertId: string;
|
|
98
|
+
businessAreaId: string;
|
|
99
|
+
}>;
|
|
100
|
+
grant(resourceId: string, xpertId: string): Promise<void>;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
}>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Provider extension for choosing an authorized model and previewing an application's query recipes.
|
|
108
|
+
* The provider returns a sample and a candidate binding for each recipe. On confirmation the host binds
|
|
109
|
+
* the queries to a published definition version. Implement bootstrap to also offer model preparation.
|
|
110
|
+
*/
|
|
111
|
+
export interface AnalyticsModelSetup {
|
|
112
|
+
bootstrap?: AnalyticsModelBootstrap;
|
|
113
|
+
/** Integration provider ID the host uses to find compatible connections. */
|
|
114
|
+
integrationProvider: string;
|
|
115
|
+
models(context: AnalyticsModelSetupContext): Promise<Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
label: string;
|
|
118
|
+
}>>;
|
|
119
|
+
preview(context: AnalyticsModelSetupContext, modelId: string, recipes: Record<string, JSONValue>): Promise<{
|
|
120
|
+
options: Record<string, JSONValue>;
|
|
121
|
+
modelLabel: string;
|
|
122
|
+
queries: Array<{
|
|
123
|
+
key: string;
|
|
124
|
+
binding: Omit<AnalyticsBinding, 'source'>;
|
|
125
|
+
rowCount: number;
|
|
126
|
+
sample: Array<Record<string, AnalyticsValue>>;
|
|
127
|
+
}>;
|
|
128
|
+
}>;
|
|
129
|
+
}
|
|
49
130
|
/**
|
|
50
131
|
* Plugin extension point for SQL, ontology, file or other query formats.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
132
|
+
* Providers validate native payloads, enforce source permissions and execute read-only queries.
|
|
133
|
+
* The host handles scoped lookup, parameter checks, execution limits and result normalization.
|
|
53
134
|
*/
|
|
54
135
|
export interface AnalyticsQueryProvider {
|
|
136
|
+
readonly modelSetup?: AnalyticsModelSetup;
|
|
55
137
|
readonly descriptor: AnalyticsProviderDescriptor;
|
|
56
138
|
readonly configuration?: AnalyticsConfigurationEntry;
|
|
57
139
|
readonly authoring?: AnalyticsDefinitionAuthoring;
|
|
@@ -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
|
-
/**
|
|
71
|
-
|
|
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>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { XpertProjectClassification } from '@xpert-ai/contracts';
|
|
1
|
+
import type { ProjectApplicationBindings, XpertProjectClassification } from '@xpert-ai/contracts';
|
|
2
2
|
import type { RuntimeActor } from '../actor';
|
|
3
3
|
export type ProjectAccessActor = RuntimeActor;
|
|
4
4
|
export interface ProjectHumanAccess extends XpertProjectClassification {
|
|
5
5
|
projectId: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
role: 'owner' | 'manager' | 'editor' | 'member' | 'assistant';
|
|
8
|
+
/** Organization installation metadata resolved on request by {@link ProjectAccessApi.assertManage}. */
|
|
9
|
+
applicationBindings?: ProjectApplicationBindings;
|
|
8
10
|
canManage: boolean;
|
|
9
11
|
archived: boolean;
|
|
10
12
|
/** Explicit Project bindings, for plugins that choose to use assignment as business policy. */
|
|
@@ -20,9 +22,16 @@ export interface ProjectAccessApi {
|
|
|
20
22
|
actor: ProjectAccessActor;
|
|
21
23
|
projectId: string;
|
|
22
24
|
}): Promise<ProjectHumanAccess>;
|
|
25
|
+
/**
|
|
26
|
+
* Require project management access and return the actor's access record for that project.
|
|
27
|
+
* By default this checks project access alone. Request installation bindings when the operation
|
|
28
|
+
* needs the current organization's role assignments or application settings.
|
|
29
|
+
*/
|
|
23
30
|
assertManage(input: {
|
|
24
31
|
actor: ProjectAccessActor;
|
|
25
32
|
projectId: string;
|
|
33
|
+
/** A matching installation must be ready. Without a matching installation, the result omits applicationBindings. */
|
|
34
|
+
includeApplicationBindings?: boolean;
|
|
26
35
|
}): Promise<ProjectHumanAccess>;
|
|
27
36
|
/** Validate an explicit Assistant connection, including published/root identity normalization. */
|
|
28
37
|
assertAssistant(input: {
|
|
@@ -15,7 +15,8 @@ export interface ToolImagesApi {
|
|
|
15
15
|
title: string;
|
|
16
16
|
}): Promise<ToolOutputPresentation>;
|
|
17
17
|
/**
|
|
18
|
-
* Project the current complete
|
|
18
|
+
* Project the current complete image round and up to three recent distinct images from
|
|
19
|
+
* the same user turn into one outbound model request. Names identify tools
|
|
19
20
|
* whose successful result must contain an image presentation; error results remain text.
|
|
20
21
|
* Never persist the returned messages. Merge requirements into the request with mergeModelRequirements.
|
|
21
22
|
*/
|
package/src/lib/strategy.d.ts
CHANGED
|
@@ -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 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,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
|
+
}
|