@xpert-ai/plugin-sdk 3.22.0 → 3.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -35,6 +35,7 @@ var env = require('@langchain/core/utils/env');
35
35
  var modelProviderHttpClient = require('./model-provider-http-client.cjs.js');
36
36
  var jsTiktoken = require('js-tiktoken');
37
37
  var base$1 = require('@langchain/core/language_models/base');
38
+ var zod = require('zod');
38
39
  var v3 = require('zod/v3');
39
40
  var results = require('./results.cjs.js');
40
41
  var connector = require('./connector.cjs.js');
@@ -868,6 +869,19 @@ exports.IntegrationStrategyRegistry = __decorate([
868
869
  ])
869
870
  ], exports.IntegrationStrategyRegistry);
870
871
 
872
+ /** Read an app for an authorized connector using its persisted scope, including public OAuth callbacks. */ class ResolveConnectorIntegrationQuery extends cqrs.Query {
873
+ constructor(id, provider, scope){
874
+ super();
875
+ this.id = id;
876
+ this.provider = provider;
877
+ this.scope = scope;
878
+ }
879
+ }
880
+ ResolveConnectorIntegrationQuery.type = '[Integration] Resolve connector application';
881
+ Reflect.defineMetadata('__query__', {
882
+ id: ResolveConnectorIntegrationQuery.type
883
+ }, ResolveConnectorIntegrationQuery);
884
+
871
885
  const WORKFLOW_TRIGGER_STRATEGY = 'WORKFLOW_TRIGGER_STRATEGY';
872
886
  const WorkflowTriggerStrategy = (provider)=>common.applyDecorators(common.SetMetadata(WORKFLOW_TRIGGER_STRATEGY, provider), common.SetMetadata(STRATEGY_META_KEY, WORKFLOW_TRIGGER_STRATEGY));
873
887
 
@@ -2740,6 +2754,46 @@ function normalizeCurrency(currency) {
2740
2754
  return currency.trim().toUpperCase();
2741
2755
  }
2742
2756
 
2757
+ /** Apply an explicit saved configuration without mutating a shared predefined schema. */ function applyModelConfiguration(model, configuration, schema) {
2758
+ var _schema_label, _schema_parameter_rules;
2759
+ const result = _extends._extends({}, schema, {
2760
+ model,
2761
+ label: (_schema_label = schema == null ? void 0 : schema.label) != null ? _schema_label : {
2762
+ en_US: model,
2763
+ zh_Hans: model
2764
+ },
2765
+ model_type: configuration.modelType,
2766
+ fetch_from: contracts.FetchFrom.CUSTOMIZABLE_MODEL,
2767
+ model_properties: _extends._extends({}, schema == null ? void 0 : schema.model_properties, {
2768
+ [contracts.ModelPropertyKey.CONTEXT_SIZE]: configuration.contextSize
2769
+ }),
2770
+ parameter_rules: [
2771
+ ...(_schema_parameter_rules = schema == null ? void 0 : schema.parameter_rules) != null ? _schema_parameter_rules : []
2772
+ ]
2773
+ });
2774
+ if (configuration.modelType === contracts.AiModelTypeEnum.LLM) {
2775
+ result.features = [
2776
+ ...configuration.features
2777
+ ];
2778
+ result.model_properties[contracts.ModelPropertyKey.MODE] = 'chat';
2779
+ result.parameter_rules = [
2780
+ ...result.parameter_rules.filter((rule)=>rule.name !== 'max_tokens'),
2781
+ {
2782
+ name: 'max_tokens',
2783
+ label: {
2784
+ en_US: 'Max output tokens',
2785
+ zh_Hans: '最大输出 Token'
2786
+ },
2787
+ type: contracts.ParameterType.INT,
2788
+ min: 1,
2789
+ max: configuration.maxOutputTokens,
2790
+ default: configuration.defaultMaxTokens
2791
+ }
2792
+ ];
2793
+ }
2794
+ return result;
2795
+ }
2796
+
2743
2797
  var AIModel_1;
2744
2798
  exports.AIModel = AIModel_1 = class AIModel {
2745
2799
  getRealtimeModel(_copilotModel) {
@@ -2801,6 +2855,13 @@ exports.AIModel = AIModel_1 = class AIModel {
2801
2855
  getModelSchema(model, credentials) {
2802
2856
  const models = this.predefinedModels();
2803
2857
  const schema = models.find((_)=>_.model === model);
2858
+ const configuration = contracts.readModelConfiguration(credentials);
2859
+ if (configuration) {
2860
+ if (configuration.modelType !== this.modelType) {
2861
+ throw new Error('Saved model configuration does not match its model type');
2862
+ }
2863
+ return applyModelConfiguration(model, configuration, schema != null ? schema : this.getCustomizableModelSchemaFromCredentials(model, credentials));
2864
+ }
2804
2865
  if (schema) {
2805
2866
  return schema;
2806
2867
  }
@@ -4013,6 +4074,62 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
4013
4074
  };
4014
4075
  }
4015
4076
 
4077
+ const modelListSchema = zod.z.object({
4078
+ data: zod.z.array(zod.z.object({
4079
+ id: zod.z.string().trim().min(1).max(512),
4080
+ active: zod.z.boolean().optional(),
4081
+ name: zod.z.string().optional(),
4082
+ model_type: zod.z.string().optional()
4083
+ }))
4084
+ });
4085
+ /** OpenAI-compatible discovery transport and import suggestions, never runtime routing. */ async function discoverOpenAIModels(options) {
4086
+ var _options_fetchImpl, _options_path;
4087
+ const response = await ((_options_fetchImpl = options.fetchImpl) != null ? _options_fetchImpl : fetch)(`${options.baseUrl.replace(/\/+$/, '')}/${((_options_path = options.path) != null ? _options_path : 'models').replace(/^\/+/, '')}`, {
4088
+ method: 'GET',
4089
+ headers: {
4090
+ Authorization: options.authorization,
4091
+ Accept: 'application/json'
4092
+ },
4093
+ signal: AbortSignal.timeout(15000)
4094
+ });
4095
+ if (!response.ok) throw new Error(`Model discovery returned HTTP ${response.status}`);
4096
+ const payload = modelListSchema.parse(await response.json());
4097
+ const models = new Map();
4098
+ for (const entry of payload.data){
4099
+ var _options_predefinedModels;
4100
+ if (entry.active === false || models.has(entry.id)) continue;
4101
+ const known = (_options_predefinedModels = options.predefinedModels) == null ? void 0 : _options_predefinedModels.find((model)=>model.model === entry.id);
4102
+ // Explicit unsupported types must not fall through to name-based guesses.
4103
+ if (entry.model_type && !contracts.isDiscoverableModelType(entry.model_type)) continue;
4104
+ if (known && !contracts.isDiscoverableModelType(known.model_type)) continue;
4105
+ var _entry_model_type, _ref;
4106
+ const modelType = (_ref = (_entry_model_type = entry.model_type) != null ? _entry_model_type : known == null ? void 0 : known.model_type) != null ? _ref : suggestModelType(entry.id);
4107
+ const typeSource = entry.model_type ? 'provider' : known ? 'catalog' : modelType ? 'name' : 'unknown';
4108
+ const supportedType = contracts.isDiscoverableModelType(modelType) ? modelType : null;
4109
+ models.set(entry.id, _extends._extends({
4110
+ model: entry.id,
4111
+ label: entry.name || entry.id,
4112
+ modelType: supportedType,
4113
+ typeSource
4114
+ }, supportedType ? {
4115
+ configuration: contracts.configurationFromModel(supportedType, known)
4116
+ } : {}));
4117
+ }
4118
+ return [
4119
+ ...models.values()
4120
+ ];
4121
+ }
4122
+ function suggestModelType(name) {
4123
+ if (/(?:rerank|reranker)/i.test(name)) return contracts.AiModelTypeEnum.RERANK;
4124
+ if (/(?:embedding|embed)/i.test(name)) return contracts.AiModelTypeEnum.TEXT_EMBEDDING;
4125
+ // Unknown and opaque IDs stay unclassified, including unsupported image/audio/video models.
4126
+ if (/(?:image|vision-exp|video|tts|whisper|speech|audio|wan\d|seedance|seedream)/i.test(name)) return null;
4127
+ if (/(?:^|[\/_-])(?:gpt|qwen|deepseek|glm|kimi|llama|mistral|claude|minimax|gemini|chat|doubao)(?:[\d._/-]|$)/i.test(name)) {
4128
+ return contracts.AiModelTypeEnum.LLM;
4129
+ }
4130
+ return null;
4131
+ }
4132
+
4016
4133
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
4017
4134
  const SkillSourceProviderStrategy = (provider)=>common.applyDecorators(common.SetMetadata(SKILL_SOURCE_PROVIDER, provider), common.SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
4018
4135
 
@@ -10185,6 +10302,10 @@ Object.defineProperty(exports, "agentResultPathSchema", {
10185
10302
  enumerable: true,
10186
10303
  get: function () { return contracts.agentResultPathSchema; }
10187
10304
  });
10305
+ Object.defineProperty(exports, "configurationFromModel", {
10306
+ enumerable: true,
10307
+ get: function () { return contracts.configurationFromModel; }
10308
+ });
10188
10309
  Object.defineProperty(exports, "createResourceCardContent", {
10189
10310
  enumerable: true,
10190
10311
  get: function () { return contracts.createResourceCardContent; }
@@ -10378,6 +10499,7 @@ exports.RETRIEVER_STRATEGY = RETRIEVER_STRATEGY;
10378
10499
  exports.RequestContext = RequestContext;
10379
10500
  exports.RequirePermissionOperation = RequirePermissionOperation;
10380
10501
  exports.RerankModel = RerankModel;
10502
+ exports.ResolveConnectorIntegrationQuery = ResolveConnectorIntegrationQuery;
10381
10503
  exports.ResourceCardProvider = ResourceCardProvider;
10382
10504
  exports.RetrieverStrategy = RetrieverStrategy;
10383
10505
  exports.SANDBOX_PROVIDER = SANDBOX_PROVIDER;
@@ -10445,6 +10567,7 @@ exports.agentRuntimeResultClaimSchema = agentRuntimeResultClaimSchema;
10445
10567
  exports.agentRuntimeResultConsumptionKey = agentRuntimeResultConsumptionKey;
10446
10568
  exports.als = als;
10447
10569
  exports.appendSandboxMessage = appendSandboxMessage;
10570
+ exports.applyModelConfiguration = applyModelConfiguration;
10448
10571
  exports.buildSandboxTimeoutMessage = buildSandboxTimeoutMessage;
10449
10572
  exports.calcTokenUsage = calcTokenUsage;
10450
10573
  exports.calculateLLMUsagePrice = calculateLLMUsagePrice;
@@ -10465,6 +10588,7 @@ exports.defineMcpResourceTemplate = defineMcpResourceTemplate;
10465
10588
  exports.defineXpertTool = defineXpertTool;
10466
10589
  exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
10467
10590
  exports.describeXpertToolProvider = describeXpertToolProvider;
10591
+ exports.discoverOpenAIModels = discoverOpenAIModels;
10468
10592
  exports.downloadRemoteFile = downloadRemoteFile;
10469
10593
  exports.emitResourceCard = emitResourceCard;
10470
10594
  exports.formatSandboxTimeout = formatSandboxTimeout;
package/index.esm.js CHANGED
@@ -2,15 +2,15 @@ import { Module, applyDecorators, SetMetadata, HttpException, HttpStatus, BadReq
2
2
  import { MODULE_METADATA } from '@nestjs/common/constants';
3
3
  import { pick } from 'lodash-es';
4
4
  import { dispatchCustomEvent } from '@langchain/core/callbacks/dispatch';
5
- import { ChatMessageEventTypeEnum, createResourceCardContent, LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelFeature, ModelPropertyKey, projectTaskExecutionContextSchema, projectTaskExecutionReferenceSchema, agentRuntimeProgressSchema, agentInvocationTerminalStatusSchema, MCP_REQUIRED_CONTEXTS, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY, MCP_CAPABILITY_VISIBILITIES, PLUGIN_COMPONENT_TYPE } from '@xpert-ai/contracts';
6
- export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND, agentOutputDeliverySchema, agentResultPathSchema, createResourceCardContent, parseResourceCard, resourceCardId } from '@xpert-ai/contracts';
5
+ import { ChatMessageEventTypeEnum, createResourceCardContent, LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelPropertyKey, readModelConfiguration, ModelFeature, isDiscoverableModelType, configurationFromModel, projectTaskExecutionContextSchema, projectTaskExecutionReferenceSchema, agentRuntimeProgressSchema, agentInvocationTerminalStatusSchema, MCP_REQUIRED_CONTEXTS, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY, MCP_CAPABILITY_VISIBILITIES, PLUGIN_COMPONENT_TYPE } from '@xpert-ai/contracts';
6
+ export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND, agentOutputDeliverySchema, agentResultPathSchema, configurationFromModel, createResourceCardContent, parseResourceCard, resourceCardId } from '@xpert-ai/contracts';
7
7
  import { DiscoveryService, Reflector } from '@nestjs/core';
8
8
  import { Subject, filter } from 'rxjs';
9
9
  import { _ as _extends } from './_extends.esm.js';
10
10
  import { AsyncLocalStorage } from 'node:async_hooks';
11
11
  import { ExtractJwt } from 'passport-jwt';
12
12
  import { randomUUID, createHash } from 'node:crypto';
13
- import { Command } from '@nestjs/cqrs';
13
+ import { Query, Command } from '@nestjs/cqrs';
14
14
  import * as fs from 'fs';
15
15
  import fs__default from 'fs';
16
16
  import http from 'http';
@@ -38,7 +38,8 @@ import { getEnvironmentVariable } from '@langchain/core/utils/env';
38
38
  export { ModelProviderHttpClient, ModelProviderHttpError } from './model-provider-http-client.esm.js';
39
39
  import { getEncodingNameForModel, encodingForModel, getEncoding } from 'js-tiktoken';
40
40
  import { getModelContextSize as getModelContextSize$1 } from '@langchain/core/language_models/base';
41
- import { z, ZodError, ZodFirstPartyTypeKind } from 'zod/v3';
41
+ import { z } from 'zod';
42
+ import { z as z$1, ZodError, ZodFirstPartyTypeKind } from 'zod/v3';
42
43
  export { A as AGENT_TASK_RESULTS_FEATURE, a as agentResultItemSchema, b as agentTaskResultSchema } from './results.esm.js';
43
44
  import { assertConnectorDefinition } from './connector.esm.js';
44
45
  export { CONNECTOR_AUTHORIZATION_MODES, CONNECTOR_SCOPE_TYPES, getConnectorAuthMethods, getConnectorAuthorizationModes } from './connector.esm.js';
@@ -850,6 +851,19 @@ IntegrationStrategyRegistry = __decorate([
850
851
  ])
851
852
  ], IntegrationStrategyRegistry);
852
853
 
854
+ /** Read an app for an authorized connector using its persisted scope, including public OAuth callbacks. */ class ResolveConnectorIntegrationQuery extends Query {
855
+ constructor(id, provider, scope){
856
+ super();
857
+ this.id = id;
858
+ this.provider = provider;
859
+ this.scope = scope;
860
+ }
861
+ }
862
+ ResolveConnectorIntegrationQuery.type = '[Integration] Resolve connector application';
863
+ Reflect.defineMetadata('__query__', {
864
+ id: ResolveConnectorIntegrationQuery.type
865
+ }, ResolveConnectorIntegrationQuery);
866
+
853
867
  const WORKFLOW_TRIGGER_STRATEGY = 'WORKFLOW_TRIGGER_STRATEGY';
854
868
  const WorkflowTriggerStrategy = (provider)=>applyDecorators(SetMetadata(WORKFLOW_TRIGGER_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, WORKFLOW_TRIGGER_STRATEGY));
855
869
 
@@ -2722,6 +2736,46 @@ function normalizeCurrency(currency) {
2722
2736
  return currency.trim().toUpperCase();
2723
2737
  }
2724
2738
 
2739
+ /** Apply an explicit saved configuration without mutating a shared predefined schema. */ function applyModelConfiguration(model, configuration, schema) {
2740
+ var _schema_label, _schema_parameter_rules;
2741
+ const result = _extends({}, schema, {
2742
+ model,
2743
+ label: (_schema_label = schema == null ? void 0 : schema.label) != null ? _schema_label : {
2744
+ en_US: model,
2745
+ zh_Hans: model
2746
+ },
2747
+ model_type: configuration.modelType,
2748
+ fetch_from: FetchFrom.CUSTOMIZABLE_MODEL,
2749
+ model_properties: _extends({}, schema == null ? void 0 : schema.model_properties, {
2750
+ [ModelPropertyKey.CONTEXT_SIZE]: configuration.contextSize
2751
+ }),
2752
+ parameter_rules: [
2753
+ ...(_schema_parameter_rules = schema == null ? void 0 : schema.parameter_rules) != null ? _schema_parameter_rules : []
2754
+ ]
2755
+ });
2756
+ if (configuration.modelType === AiModelTypeEnum.LLM) {
2757
+ result.features = [
2758
+ ...configuration.features
2759
+ ];
2760
+ result.model_properties[ModelPropertyKey.MODE] = 'chat';
2761
+ result.parameter_rules = [
2762
+ ...result.parameter_rules.filter((rule)=>rule.name !== 'max_tokens'),
2763
+ {
2764
+ name: 'max_tokens',
2765
+ label: {
2766
+ en_US: 'Max output tokens',
2767
+ zh_Hans: '最大输出 Token'
2768
+ },
2769
+ type: ParameterType.INT,
2770
+ min: 1,
2771
+ max: configuration.maxOutputTokens,
2772
+ default: configuration.defaultMaxTokens
2773
+ }
2774
+ ];
2775
+ }
2776
+ return result;
2777
+ }
2778
+
2725
2779
  var AIModel_1;
2726
2780
  let AIModel = AIModel_1 = class AIModel {
2727
2781
  getRealtimeModel(_copilotModel) {
@@ -2783,6 +2837,13 @@ let AIModel = AIModel_1 = class AIModel {
2783
2837
  getModelSchema(model, credentials) {
2784
2838
  const models = this.predefinedModels();
2785
2839
  const schema = models.find((_)=>_.model === model);
2840
+ const configuration = readModelConfiguration(credentials);
2841
+ if (configuration) {
2842
+ if (configuration.modelType !== this.modelType) {
2843
+ throw new Error('Saved model configuration does not match its model type');
2844
+ }
2845
+ return applyModelConfiguration(model, configuration, schema != null ? schema : this.getCustomizableModelSchemaFromCredentials(model, credentials));
2846
+ }
2786
2847
  if (schema) {
2787
2848
  return schema;
2788
2849
  }
@@ -3995,6 +4056,62 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
3995
4056
  };
3996
4057
  }
3997
4058
 
4059
+ const modelListSchema = z.object({
4060
+ data: z.array(z.object({
4061
+ id: z.string().trim().min(1).max(512),
4062
+ active: z.boolean().optional(),
4063
+ name: z.string().optional(),
4064
+ model_type: z.string().optional()
4065
+ }))
4066
+ });
4067
+ /** OpenAI-compatible discovery transport and import suggestions, never runtime routing. */ async function discoverOpenAIModels(options) {
4068
+ var _options_fetchImpl, _options_path;
4069
+ const response = await ((_options_fetchImpl = options.fetchImpl) != null ? _options_fetchImpl : fetch)(`${options.baseUrl.replace(/\/+$/, '')}/${((_options_path = options.path) != null ? _options_path : 'models').replace(/^\/+/, '')}`, {
4070
+ method: 'GET',
4071
+ headers: {
4072
+ Authorization: options.authorization,
4073
+ Accept: 'application/json'
4074
+ },
4075
+ signal: AbortSignal.timeout(15000)
4076
+ });
4077
+ if (!response.ok) throw new Error(`Model discovery returned HTTP ${response.status}`);
4078
+ const payload = modelListSchema.parse(await response.json());
4079
+ const models = new Map();
4080
+ for (const entry of payload.data){
4081
+ var _options_predefinedModels;
4082
+ if (entry.active === false || models.has(entry.id)) continue;
4083
+ const known = (_options_predefinedModels = options.predefinedModels) == null ? void 0 : _options_predefinedModels.find((model)=>model.model === entry.id);
4084
+ // Explicit unsupported types must not fall through to name-based guesses.
4085
+ if (entry.model_type && !isDiscoverableModelType(entry.model_type)) continue;
4086
+ if (known && !isDiscoverableModelType(known.model_type)) continue;
4087
+ var _entry_model_type, _ref;
4088
+ const modelType = (_ref = (_entry_model_type = entry.model_type) != null ? _entry_model_type : known == null ? void 0 : known.model_type) != null ? _ref : suggestModelType(entry.id);
4089
+ const typeSource = entry.model_type ? 'provider' : known ? 'catalog' : modelType ? 'name' : 'unknown';
4090
+ const supportedType = isDiscoverableModelType(modelType) ? modelType : null;
4091
+ models.set(entry.id, _extends({
4092
+ model: entry.id,
4093
+ label: entry.name || entry.id,
4094
+ modelType: supportedType,
4095
+ typeSource
4096
+ }, supportedType ? {
4097
+ configuration: configurationFromModel(supportedType, known)
4098
+ } : {}));
4099
+ }
4100
+ return [
4101
+ ...models.values()
4102
+ ];
4103
+ }
4104
+ function suggestModelType(name) {
4105
+ if (/(?:rerank|reranker)/i.test(name)) return AiModelTypeEnum.RERANK;
4106
+ if (/(?:embedding|embed)/i.test(name)) return AiModelTypeEnum.TEXT_EMBEDDING;
4107
+ // Unknown and opaque IDs stay unclassified, including unsupported image/audio/video models.
4108
+ if (/(?:image|vision-exp|video|tts|whisper|speech|audio|wan\d|seedance|seedream)/i.test(name)) return null;
4109
+ if (/(?:^|[\/_-])(?:gpt|qwen|deepseek|glm|kimi|llama|mistral|claude|minimax|gemini|chat|doubao)(?:[\d._/-]|$)/i.test(name)) {
4110
+ return AiModelTypeEnum.LLM;
4111
+ }
4112
+ return null;
4113
+ }
4114
+
3998
4115
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
3999
4116
  const SkillSourceProviderStrategy = (provider)=>applyDecorators(SetMetadata(SKILL_SOURCE_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
4000
4117
 
@@ -4127,79 +4244,79 @@ const AGENT_CHAT_DISPATCH_MESSAGE_TYPE = defineAgentMessageType('chat_dispatch',
4127
4244
  const AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING = 'steer_target_not_running';
4128
4245
 
4129
4246
  /** Captured by an authorized host command. Describing a recipient never authorizes delivery. */ const replyConversation = {
4130
- conversationId: z.string().uuid(),
4131
- threadId: z.string().trim().min(1).max(256)
4247
+ conversationId: z$1.string().uuid(),
4248
+ threadId: z$1.string().trim().min(1).max(256)
4132
4249
  };
4133
- const agentRuntimeReplyTargetSchema = z.discriminatedUnion('type', [
4134
- z.object(_extends({}, replyConversation, {
4135
- type: z.literal('xpert').optional(),
4136
- xpertId: z.string().uuid(),
4137
- agentKey: z.string().trim().min(1).max(256)
4250
+ const agentRuntimeReplyTargetSchema = z$1.discriminatedUnion('type', [
4251
+ z$1.object(_extends({}, replyConversation, {
4252
+ type: z$1.literal('xpert').optional(),
4253
+ xpertId: z$1.string().uuid(),
4254
+ agentKey: z$1.string().trim().min(1).max(256)
4138
4255
  })).strict(),
4139
- z.object(_extends({}, replyConversation, {
4140
- type: z.literal('project_agent'),
4141
- projectId: z.string().uuid(),
4142
- agentKey: z.literal('general_agent')
4256
+ z$1.object(_extends({}, replyConversation, {
4257
+ type: z$1.literal('project_agent'),
4258
+ projectId: z$1.string().uuid(),
4259
+ agentKey: z$1.literal('general_agent')
4143
4260
  })).strict()
4144
4261
  ]);
4145
- /** Persist with the immutable invocation request before launch. No credentials or arbitrary routing headers. */ const agentInvocationDispatchContextSchema = z.object({
4146
- version: z.literal(1),
4147
- requestId: z.string().uuid(),
4148
- sourceMessageId: z.string().trim().min(1).max(256),
4262
+ /** Persist with the immutable invocation request before launch. No credentials or arbitrary routing headers. */ const agentInvocationDispatchContextSchema = z$1.object({
4263
+ version: z$1.literal(1),
4264
+ requestId: z$1.string().uuid(),
4265
+ sourceMessageId: z$1.string().trim().min(1).max(256),
4149
4266
  replyTo: agentRuntimeReplyTargetSchema,
4150
4267
  projectTask: projectTaskExecutionContextSchema.optional()
4151
4268
  }).strict();
4152
4269
 
4153
4270
  const AGENT_RUNTIME_EVENT_MESSAGE_TYPE = defineAgentMessageType('runtime_event', 1);
4154
4271
  const reference = {
4155
- version: z.literal(1),
4156
- invocationId: z.string().uuid(),
4157
- /** Revision of the persisted observation, never a queue delivery attempt. */ revision: z.number().int().nonnegative(),
4272
+ version: z$1.literal(1),
4273
+ invocationId: z$1.string().uuid(),
4274
+ /** Revision of the persisted observation, never a queue delivery attempt. */ revision: z$1.number().int().nonnegative(),
4158
4275
  projectTask: projectTaskExecutionReferenceSchema.optional()
4159
4276
  };
4160
- /** Host-produced references. Consumers reload and authorize the invocation and its pinned observation. */ const agentRuntimeEventSchema = z.discriminatedUnion('kind', [
4161
- z.object(_extends({}, reference, {
4162
- kind: z.literal('progress'),
4277
+ /** Host-produced references. Consumers reload and authorize the invocation and its pinned observation. */ const agentRuntimeEventSchema = z$1.discriminatedUnion('kind', [
4278
+ z$1.object(_extends({}, reference, {
4279
+ kind: z$1.literal('progress'),
4163
4280
  progress: agentRuntimeProgressSchema
4164
4281
  })).strict(),
4165
- z.object(_extends({}, reference, {
4166
- kind: z.literal('result'),
4282
+ z$1.object(_extends({}, reference, {
4283
+ kind: z$1.literal('result'),
4167
4284
  status: agentInvocationTerminalStatusSchema
4168
4285
  })).strict(),
4169
- z.object(_extends({}, reference, {
4170
- kind: z.literal('input_request'),
4171
- interactionId: z.string().trim().min(1).max(256)
4286
+ z$1.object(_extends({}, reference, {
4287
+ kind: z$1.literal('input_request'),
4288
+ interactionId: z$1.string().trim().min(1).max(256)
4172
4289
  })).strict()
4173
4290
  ]);
4174
4291
  /** Same observation always has the same HandoffMessage.id across retries and process restarts. */ function agentRuntimeEventMessageId(event) {
4175
4292
  return `runtime-${event.invocationId}-${event.kind}-${event.revision}`;
4176
4293
  }
4177
- /** Transport states are deliberately separate from Task and Invocation status. */ const agentRuntimeDeliveryStateSchema = z.enum([
4294
+ /** Transport states are deliberately separate from Task and Invocation status. */ const agentRuntimeDeliveryStateSchema = z$1.enum([
4178
4295
  'pending',
4179
4296
  'received',
4180
4297
  'blocked',
4181
4298
  'failed'
4182
4299
  ]);
4183
- const agentRuntimeConsumptionStateSchema = z.enum([
4300
+ const agentRuntimeConsumptionStateSchema = z$1.enum([
4184
4301
  'pending',
4185
4302
  'processing',
4186
4303
  'processed',
4187
4304
  'blocked',
4188
4305
  'failed'
4189
4306
  ]);
4190
- /** Store under a unique scoped key in the same transaction as the continuation reservation. */ const agentRuntimeResultClaimSchema = z.object({
4191
- invocationId: z.string().uuid(),
4192
- resultRevision: z.number().int().nonnegative(),
4307
+ /** Store under a unique scoped key in the same transaction as the continuation reservation. */ const agentRuntimeResultClaimSchema = z$1.object({
4308
+ invocationId: z$1.string().uuid(),
4309
+ resultRevision: z$1.number().int().nonnegative(),
4193
4310
  recipient: agentRuntimeReplyTargetSchema,
4194
- consumer: z.discriminatedUnion('type', [
4195
- z.object({
4196
- type: z.literal('follow_up'),
4197
- executionId: z.string().uuid()
4311
+ consumer: z$1.discriminatedUnion('type', [
4312
+ z$1.object({
4313
+ type: z$1.literal('follow_up'),
4314
+ executionId: z$1.string().uuid()
4198
4315
  }).strict(),
4199
- z.object({
4200
- type: z.literal('wait'),
4201
- executionId: z.string().uuid(),
4202
- callId: z.string().trim().min(1).max(1024)
4316
+ z$1.object({
4317
+ type: z$1.literal('wait'),
4318
+ executionId: z$1.string().uuid(),
4319
+ callId: z$1.string().trim().min(1).max(1024)
4203
4320
  }).strict()
4204
4321
  ])
4205
4322
  }).strict();
@@ -6795,38 +6912,38 @@ async function resolveToolResult(value, validate) {
6795
6912
  // Validate metadata with the declared output schema, preserve bounded media blocks,
6796
6913
  // and include the same DTO in text for clients that hide structuredContent.
6797
6914
  const XPERT_TOOL_RESULT_FORMAT_VERSION = 1;
6798
- const contentSchema = z.discriminatedUnion('type', [
6799
- z.object({
6800
- type: z.literal('text'),
6801
- text: z.string().max(2 * 1024 * 1024)
6915
+ const contentSchema = z$1.discriminatedUnion('type', [
6916
+ z$1.object({
6917
+ type: z$1.literal('text'),
6918
+ text: z$1.string().max(2 * 1024 * 1024)
6802
6919
  }).strict(),
6803
- z.object({
6804
- type: z.literal('image'),
6805
- data: z.string().min(1).max(8 * 1024 * 1024),
6806
- mimeType: z.enum([
6920
+ z$1.object({
6921
+ type: z$1.literal('image'),
6922
+ data: z$1.string().min(1).max(8 * 1024 * 1024),
6923
+ mimeType: z$1.enum([
6807
6924
  'image/png',
6808
6925
  'image/jpeg',
6809
6926
  'image/webp',
6810
6927
  'image/gif'
6811
6928
  ])
6812
6929
  }).strict(),
6813
- z.object({
6814
- type: z.literal('audio'),
6815
- data: z.string().min(1).max(8 * 1024 * 1024),
6816
- mimeType: z.string().min(1).max(100)
6930
+ z$1.object({
6931
+ type: z$1.literal('audio'),
6932
+ data: z$1.string().min(1).max(8 * 1024 * 1024),
6933
+ mimeType: z$1.string().min(1).max(100)
6817
6934
  }).strict(),
6818
- z.object({
6819
- type: z.literal('resource_link'),
6820
- uri: z.string().min(1).max(4096),
6821
- name: z.string().max(240).optional()
6935
+ z$1.object({
6936
+ type: z$1.literal('resource_link'),
6937
+ uri: z$1.string().min(1).max(4096),
6938
+ name: z$1.string().max(240).optional()
6822
6939
  }).strict()
6823
6940
  ]);
6824
6941
  /** Validate the envelope separately so binary content never enters the business DTO. */ async function parseDecoratedToolResult(value, outputSchema) {
6825
6942
  var _result_content;
6826
- const envelope = z.object({
6827
- content: z.array(contentSchema).max(32).optional(),
6828
- structuredContent: outputSchema != null ? outputSchema : z.unknown().optional(),
6829
- isError: z.boolean().optional()
6943
+ const envelope = z$1.object({
6944
+ content: z$1.array(contentSchema).max(32).optional(),
6945
+ structuredContent: outputSchema != null ? outputSchema : z$1.unknown().optional(),
6946
+ isError: z$1.boolean().optional()
6830
6947
  }).strict();
6831
6948
  const result = await envelope.parseAsync(value);
6832
6949
  var _result_content_map;
@@ -10151,4 +10268,4 @@ Reflect.defineMetadata('__command__', {
10151
10268
  id: ImportDefaultAgentPluginsCommand.type
10152
10269
  }, ImportDefaultAgentPluginsCommand);
10153
10270
 
10154
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, ViewMiddlewareRuntimeCapability, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, knowledgebaseActions, loadYamlFile, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, taskWaitReason, textTokenBoundaries };
10271
+ export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, 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, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, applyModelConfiguration, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, 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, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, knowledgebaseActions, loadYamlFile, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, taskWaitReason, textTokenBoundaries };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@langchain/openai": "0.6.9",
65
- "@xpert-ai/contracts": "3.21.1",
65
+ "@xpert-ai/contracts": "3.21.3",
66
66
  "express": "^4.22.1",
67
67
  "js-tiktoken": "^1.0.21"
68
68
  },
@@ -1,2 +1,3 @@
1
1
  /** Browser-safe connector contracts and helpers without server-side SDK dependencies. */
2
2
  export * from './lib/connector/strategy.interface';
3
+ export * from './lib/connector/integration.interface';
@@ -250,21 +250,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
250
250
  }>]>;
251
251
  }, "strict", z.ZodTypeAny, {
252
252
  projectId?: string;
253
- specification?: {
254
- digest?: string;
255
- specification?: {
256
- description?: string;
257
- version?: 1;
258
- title?: string;
259
- steps?: {
260
- description?: string;
261
- stepIndex?: number;
262
- }[];
263
- requirements?: string[];
264
- };
265
- };
266
- projectTaskId?: string;
267
- taskExecutionId?: string;
268
253
  purpose?: {
269
254
  type?: "implementation";
270
255
  } | {
@@ -286,8 +271,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
286
271
  snapshotId?: string;
287
272
  })[];
288
273
  };
289
- }, {
290
- projectId?: string;
291
274
  specification?: {
292
275
  digest?: string;
293
276
  specification?: {
@@ -303,6 +286,8 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
303
286
  };
304
287
  projectTaskId?: string;
305
288
  taskExecutionId?: string;
289
+ }, {
290
+ projectId?: string;
306
291
  purpose?: {
307
292
  type?: "implementation";
308
293
  } | {
@@ -324,8 +309,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
324
309
  snapshotId?: string;
325
310
  })[];
326
311
  };
327
- }>, {
328
- projectId?: string;
329
312
  specification?: {
330
313
  digest?: string;
331
314
  specification?: {
@@ -341,6 +324,8 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
341
324
  };
342
325
  projectTaskId?: string;
343
326
  taskExecutionId?: string;
327
+ }>, {
328
+ projectId?: string;
344
329
  purpose?: {
345
330
  type?: "implementation";
346
331
  } | {
@@ -362,8 +347,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
362
347
  snapshotId?: string;
363
348
  })[];
364
349
  };
365
- }, {
366
- projectId?: string;
367
350
  specification?: {
368
351
  digest?: string;
369
352
  specification?: {
@@ -379,6 +362,8 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
379
362
  };
380
363
  projectTaskId?: string;
381
364
  taskExecutionId?: string;
365
+ }, {
366
+ projectId?: string;
382
367
  purpose?: {
383
368
  type?: "implementation";
384
369
  } | {
@@ -400,6 +385,21 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
400
385
  snapshotId?: string;
401
386
  })[];
402
387
  };
388
+ specification?: {
389
+ digest?: string;
390
+ specification?: {
391
+ description?: string;
392
+ version?: 1;
393
+ title?: string;
394
+ steps?: {
395
+ description?: string;
396
+ stepIndex?: number;
397
+ }[];
398
+ requirements?: string[];
399
+ };
400
+ };
401
+ projectTaskId?: string;
402
+ taskExecutionId?: string;
403
403
  }>>;
404
404
  }, "strict", z.ZodTypeAny, {
405
405
  version?: 1;
@@ -420,21 +420,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
420
420
  };
421
421
  projectTask?: {
422
422
  projectId?: string;
423
- specification?: {
424
- digest?: string;
425
- specification?: {
426
- description?: string;
427
- version?: 1;
428
- title?: string;
429
- steps?: {
430
- description?: string;
431
- stepIndex?: number;
432
- }[];
433
- requirements?: string[];
434
- };
435
- };
436
- projectTaskId?: string;
437
- taskExecutionId?: string;
438
423
  purpose?: {
439
424
  type?: "implementation";
440
425
  } | {
@@ -456,6 +441,21 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
456
441
  snapshotId?: string;
457
442
  })[];
458
443
  };
444
+ specification?: {
445
+ digest?: string;
446
+ specification?: {
447
+ description?: string;
448
+ version?: 1;
449
+ title?: string;
450
+ steps?: {
451
+ description?: string;
452
+ stepIndex?: number;
453
+ }[];
454
+ requirements?: string[];
455
+ };
456
+ };
457
+ projectTaskId?: string;
458
+ taskExecutionId?: string;
459
459
  };
460
460
  }, {
461
461
  version?: 1;
@@ -476,21 +476,6 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
476
476
  };
477
477
  projectTask?: {
478
478
  projectId?: string;
479
- specification?: {
480
- digest?: string;
481
- specification?: {
482
- description?: string;
483
- version?: 1;
484
- title?: string;
485
- steps?: {
486
- description?: string;
487
- stepIndex?: number;
488
- }[];
489
- requirements?: string[];
490
- };
491
- };
492
- projectTaskId?: string;
493
- taskExecutionId?: string;
494
479
  purpose?: {
495
480
  type?: "implementation";
496
481
  } | {
@@ -512,6 +497,21 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
512
497
  snapshotId?: string;
513
498
  })[];
514
499
  };
500
+ specification?: {
501
+ digest?: string;
502
+ specification?: {
503
+ description?: string;
504
+ version?: 1;
505
+ title?: string;
506
+ steps?: {
507
+ description?: string;
508
+ stepIndex?: number;
509
+ }[];
510
+ requirements?: string[];
511
+ };
512
+ };
513
+ projectTaskId?: string;
514
+ taskExecutionId?: string;
515
515
  };
516
516
  }>;
517
517
  export type AgentInvocationDispatchContext = z.output<typeof agentInvocationDispatchContextSchema>;
@@ -1,4 +1,4 @@
1
- import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity } from '@xpert-ai/contracts';
1
+ import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity, DiscoveredModel } from '@xpert-ai/contracts';
2
2
  import { BaseLanguageModel } from '@langchain/core/language_models/base';
3
3
  import { Embeddings } from '@langchain/core/embeddings';
4
4
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
@@ -6,6 +6,8 @@ import { AIGCModelClient, AsyncAIGCModelClient, IRerank } from './types';
6
6
  import { AIModel } from './ai-model';
7
7
  import type { NativeModelClientFactory } from './native-model';
8
8
  export interface IAIModelProviderStrategy {
9
+ /** Fetch account-visible models without persisting them or invoking model inference. */
10
+ discoverModels?(credentials: Record<string, unknown>): Promise<DiscoveredModel[]>;
9
11
  getNativeModelClient?: NativeModelClientFactory;
10
12
  /**
11
13
  * Provider metadata
@@ -15,3 +15,5 @@ export * from './commands/index';
15
15
  export * from './token-usage';
16
16
  export * from './native-model';
17
17
  export * from './realtime';
18
+ export * from './model-discovery';
19
+ export * from './model-configuration';
@@ -0,0 +1,3 @@
1
+ import { AIModelEntity, ModelConfiguration } from '@xpert-ai/contracts';
2
+ /** Apply an explicit saved configuration without mutating a shared predefined schema. */
3
+ export declare function applyModelConfiguration(model: string, configuration: ModelConfiguration, schema?: AIModelEntity | null): AIModelEntity;
@@ -0,0 +1,11 @@
1
+ import { AIModelEntity, DiscoveredModel } from '@xpert-ai/contracts';
2
+ export type OpenAIModelDiscoveryOptions = {
3
+ baseUrl: string;
4
+ authorization: string;
5
+ path?: string;
6
+ predefinedModels?: readonly AIModelEntity[];
7
+ fetchImpl?: typeof fetch;
8
+ };
9
+ /** OpenAI-compatible discovery transport and import suggestions, never runtime routing. */
10
+ export declare function discoverOpenAIModels(options: OpenAIModelDiscoveryOptions): Promise<DiscoveredModel[]>;
11
+ export { configurationFromModel } from '@xpert-ai/contracts';
@@ -2,3 +2,4 @@ export * from './runtime-capability';
2
2
  export * from './strategy.decorator';
3
3
  export * from './strategy.interface';
4
4
  export * from './strategy.registry';
5
+ export * from './integration.interface';
@@ -0,0 +1,20 @@
1
+ export type ConnectorIntegrationOption = {
2
+ id: string;
3
+ name: string;
4
+ organizationId: string | null;
5
+ };
6
+ export type ConnectorIntegrationSelection = {
7
+ type: 'existing';
8
+ integrationId: string;
9
+ } | {
10
+ type: 'new';
11
+ requestId: string;
12
+ name: string;
13
+ values: {
14
+ [field: string]: string;
15
+ };
16
+ };
17
+ export type ConnectorIntegrationRequest = {
18
+ authMethodId: string;
19
+ selection: ConnectorIntegrationSelection;
20
+ };
@@ -32,6 +32,11 @@ export type ConnectorAppCredentialField = {
32
32
  };
33
33
  export type ConnectorAppCredentialsConfig = {
34
34
  fields?: ConnectorAppCredentialField[];
35
+ /** Persist application credentials in a system integration; connections only retain its ID. */
36
+ integration?: {
37
+ provider: string;
38
+ fields: ConnectorAppCredentialField[];
39
+ };
35
40
  help?: {
36
41
  label: RuntimeI18nText;
37
42
  url: string;
@@ -52,6 +57,8 @@ export type ConnectorAuthorizationPresentation = {
52
57
  type ConnectorAuthMethodBase = {
53
58
  id: string;
54
59
  label: RuntimeI18nText;
60
+ /** Retained for stored credentials and in-flight callbacks, not new authorizations. */
61
+ deprecated?: boolean;
55
62
  authorizationPresentation?: ConnectorAuthorizationPresentation;
56
63
  };
57
64
  export type ConnectorAuthMethodDefinition = ConnectorAuthMethodBase & ({
@@ -72,6 +79,12 @@ export type ConnectorPermissionDeclaration = {
72
79
  required?: boolean;
73
80
  };
74
81
  export type ConnectorDefinitionBase = {
82
+ /** Explicit MCP resources whose old generic OAuth connections this provider can replace. */
83
+ mcpOAuthResources?: string[];
84
+ /** Native provider used by a compatibility definition that retains its old provider ID. */
85
+ canonicalProvider?: string;
86
+ /** Imported dependency is visible but its provider is not installed in this scope. */
87
+ unavailable?: string;
75
88
  runtimeUsage?: 'middleware' | 'credential';
76
89
  provider: string;
77
90
  label: RuntimeI18nText;
@@ -116,6 +129,8 @@ export type ConnectorInstance = {
116
129
  authorizationMode?: ConnectorAuthorizationMode;
117
130
  provider: string;
118
131
  authMethodId?: string | null;
132
+ /** Selected application configuration, never its secrets. */
133
+ appIntegrationId?: string | null;
119
134
  status: ConnectorStatus;
120
135
  profile?: ConnectorProfile | null;
121
136
  scopes?: string[];
@@ -140,6 +155,7 @@ export type ConnectorBindingCreateRequest = {
140
155
  authorizationMode: ConnectorAuthorizationMode;
141
156
  };
142
157
  export type ConnectorRuntimeOption = {
158
+ canonicalProvider?: string;
143
159
  scope?: ConnectorScope;
144
160
  canManage?: boolean;
145
161
  managementUrl?: string;
@@ -303,7 +319,12 @@ export type ConnectorCredential = {
303
319
  scopes?: string[];
304
320
  profile?: ConnectorProfile | null;
305
321
  };
322
+ export type ConnectorProviderScope = {
323
+ tenantId: string;
324
+ organizationId: string | null;
325
+ };
306
326
  export type ConnectorConnectInput = {
327
+ scope?: ConnectorProviderScope;
307
328
  authMethodId: string;
308
329
  values?: ConnectorAppCredentialPayload;
309
330
  redirectUri: string;
@@ -321,6 +342,7 @@ export type ConnectorConnectResult = {
321
342
  credential: ConnectorCredential;
322
343
  };
323
344
  export type ConnectorAuthorizationCodeInput = {
345
+ scope?: ConnectorProviderScope;
324
346
  authMethodId: string;
325
347
  values?: ConnectorAppCredentialPayload;
326
348
  metadata?: Record<string, unknown> | null;
@@ -351,6 +373,7 @@ export type ConnectorConnectionPollResult = {
351
373
  metadata?: Record<string, unknown>;
352
374
  };
353
375
  export type ConnectorCredentialRefreshInput = {
376
+ scope?: ConnectorProviderScope;
354
377
  authMethodId: string;
355
378
  credential: ConnectorCredential;
356
379
  };
@@ -361,6 +384,7 @@ export type ConnectorCredentialRevokeInput = {
361
384
  reason: ConnectorCredentialRevokeReason;
362
385
  };
363
386
  export type ConnectorRuntimeCredentialResolveInput = {
387
+ scope?: ConnectorProviderScope;
364
388
  authMethodId: string;
365
389
  credential: ConnectorCredential;
366
390
  };
@@ -68,6 +68,11 @@ export declare const INTEGRATION_PERMISSION_SERVICE_TOKEN = "XPERT_PLUGIN_INTEGR
68
68
  * Read-only integration permission service exposed to plugins.
69
69
  */
70
70
  export interface IntegrationPermissionService {
71
+ /** Exact lookup for a connector whose actor and persisted scope have been authorized by the host. */
72
+ readForConnector?(id: string, provider: string, scope: {
73
+ tenantId: string;
74
+ organizationId: string | null;
75
+ }): Promise<IIntegration | null>;
71
76
  read<TIntegration = IIntegration>(id: string, options?: Record<string, any>): Promise<TIntegration | null>;
72
77
  findAll<TIntegration = IIntegration>(options?: Record<string, any>): Promise<IPagination<TIntegration>>;
73
78
  findAllWithInheritance?<TIntegration = IIntegration>(options?: Record<string, any>): Promise<IPagination<TIntegration>>;
@@ -1,3 +1,4 @@
1
1
  export * from './strategy.decorator';
2
2
  export * from './strategy.interface';
3
3
  export * from './strategy.registry';
4
+ export * from './resolve-connector-integration.query';
@@ -0,0 +1,16 @@
1
+ import { Query } from '@nestjs/cqrs';
2
+ import type { IIntegration } from '@xpert-ai/contracts';
3
+ /** Read an app for an authorized connector using its persisted scope, including public OAuth callbacks. */
4
+ export declare class ResolveConnectorIntegrationQuery extends Query<IIntegration | null> {
5
+ readonly id: string;
6
+ readonly provider: string;
7
+ readonly scope: {
8
+ tenantId: string;
9
+ organizationId: string | null;
10
+ };
11
+ static readonly type = "[Integration] Resolve connector application";
12
+ constructor(id: string, provider: string, scope: {
13
+ tenantId: string;
14
+ organizationId: string | null;
15
+ });
16
+ }
@@ -1,7 +1,7 @@
1
1
  import type { XpertProjectTypeRef } from '@xpert-ai/contracts';
2
2
  /** Lifecycle states that plugin-managed Projects may synchronize to the platform. */
3
3
  export type ProjectProvisioningStatus = 'active' | 'archived';
4
- /** Portable identity of one required, direct External Assistant binding. */
4
+ /** Portable identity of one expected direct External Assistant binding. */
5
5
  export type ProjectExternalAssistantExpectation = {
6
6
  pluginName: string;
7
7
  templateKey: string;
@@ -15,7 +15,7 @@ export type ProjectEnsureInput = {
15
15
  projectId: string;
16
16
  /** @deprecated Projects no longer belong to a Workspace. Accepted only for legacy callers. */
17
17
  workspaceId?: string;
18
- /** Assistant that must be connected to the Project. */
18
+ /** Creation seed: this Assistant and all recursive External Assistants join a new Project. Existing membership is preserved. */
19
19
  xpertId: string;
20
20
  /** Primary requester Agent used as the trust anchor for direct External Assistants. */
21
21
  requesterAgentKey?: string;
@@ -31,7 +31,7 @@ export type ProjectEnsureResult = {
31
31
  projectId: string;
32
32
  /** @deprecated Echoed only when supplied by a legacy caller. */
33
33
  workspaceId?: string;
34
- /** Complete set of Assistants connected after synchronization. */
34
+ /** Persisted Assistant members; ensure never restores removed members or adds new graph dependencies to an existing Project. */
35
35
  xpertIds: string[];
36
36
  /** Whether this call inserted the Project or reconciled an existing one. */
37
37
  operation: 'created' | 'updated';
@@ -1,4 +1,4 @@
1
- import { AssistantCapabilityDeclaration, IconDefinition, I18nObject, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
1
+ import { AssistantCapabilityDeclaration, IconDefinition, I18nObject, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTypeEnum } from '@xpert-ai/contracts';
2
2
  import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
3
3
  import { ModuleRef } from '@nestjs/core';
4
4
  import type { ZodSchema } from 'zod/v3';
@@ -58,6 +58,7 @@ export interface XpertPlugin<TConfig extends object = any> extends PluginLifecyc
58
58
  register(ctx: PluginContext<TConfig>): DynamicModule;
59
59
  }
60
60
  export interface XpertTemplateContribution {
61
+ manifest?: import('@xpert-ai/contracts').TemplateManifest;
61
62
  key: string;
62
63
  id?: string;
63
64
  name?: string;
@@ -85,7 +86,7 @@ export interface XpertTemplateContribution {
85
86
  contentHash?: string;
86
87
  xpertName?: string;
87
88
  capabilities?: AssistantCapabilityDeclaration[];
88
- dependencies?: XpertTemplatePluginDependencies;
89
+ dependencies?: import('@xpert-ai/contracts').AssistantTemplateDependencies;
89
90
  [key: string]: unknown;
90
91
  }
91
92
  export interface XpertTemplateProvider {