@xpert-ai/plugin-sdk 3.22.0 → 3.22.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/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');
@@ -2740,6 +2741,46 @@ function normalizeCurrency(currency) {
2740
2741
  return currency.trim().toUpperCase();
2741
2742
  }
2742
2743
 
2744
+ /** Apply an explicit saved configuration without mutating a shared predefined schema. */ function applyModelConfiguration(model, configuration, schema) {
2745
+ var _schema_label, _schema_parameter_rules;
2746
+ const result = _extends._extends({}, schema, {
2747
+ model,
2748
+ label: (_schema_label = schema == null ? void 0 : schema.label) != null ? _schema_label : {
2749
+ en_US: model,
2750
+ zh_Hans: model
2751
+ },
2752
+ model_type: configuration.modelType,
2753
+ fetch_from: contracts.FetchFrom.CUSTOMIZABLE_MODEL,
2754
+ model_properties: _extends._extends({}, schema == null ? void 0 : schema.model_properties, {
2755
+ [contracts.ModelPropertyKey.CONTEXT_SIZE]: configuration.contextSize
2756
+ }),
2757
+ parameter_rules: [
2758
+ ...(_schema_parameter_rules = schema == null ? void 0 : schema.parameter_rules) != null ? _schema_parameter_rules : []
2759
+ ]
2760
+ });
2761
+ if (configuration.modelType === contracts.AiModelTypeEnum.LLM) {
2762
+ result.features = [
2763
+ ...configuration.features
2764
+ ];
2765
+ result.model_properties[contracts.ModelPropertyKey.MODE] = 'chat';
2766
+ result.parameter_rules = [
2767
+ ...result.parameter_rules.filter((rule)=>rule.name !== 'max_tokens'),
2768
+ {
2769
+ name: 'max_tokens',
2770
+ label: {
2771
+ en_US: 'Max output tokens',
2772
+ zh_Hans: '最大输出 Token'
2773
+ },
2774
+ type: contracts.ParameterType.INT,
2775
+ min: 1,
2776
+ max: configuration.maxOutputTokens,
2777
+ default: configuration.defaultMaxTokens
2778
+ }
2779
+ ];
2780
+ }
2781
+ return result;
2782
+ }
2783
+
2743
2784
  var AIModel_1;
2744
2785
  exports.AIModel = AIModel_1 = class AIModel {
2745
2786
  getRealtimeModel(_copilotModel) {
@@ -2801,6 +2842,13 @@ exports.AIModel = AIModel_1 = class AIModel {
2801
2842
  getModelSchema(model, credentials) {
2802
2843
  const models = this.predefinedModels();
2803
2844
  const schema = models.find((_)=>_.model === model);
2845
+ const configuration = contracts.readModelConfiguration(credentials);
2846
+ if (configuration) {
2847
+ if (configuration.modelType !== this.modelType) {
2848
+ throw new Error('Saved model configuration does not match its model type');
2849
+ }
2850
+ return applyModelConfiguration(model, configuration, schema != null ? schema : this.getCustomizableModelSchemaFromCredentials(model, credentials));
2851
+ }
2804
2852
  if (schema) {
2805
2853
  return schema;
2806
2854
  }
@@ -4013,6 +4061,62 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
4013
4061
  };
4014
4062
  }
4015
4063
 
4064
+ const modelListSchema = zod.z.object({
4065
+ data: zod.z.array(zod.z.object({
4066
+ id: zod.z.string().trim().min(1).max(512),
4067
+ active: zod.z.boolean().optional(),
4068
+ name: zod.z.string().optional(),
4069
+ model_type: zod.z.string().optional()
4070
+ }))
4071
+ });
4072
+ /** OpenAI-compatible discovery transport and import suggestions, never runtime routing. */ async function discoverOpenAIModels(options) {
4073
+ var _options_fetchImpl, _options_path;
4074
+ const response = await ((_options_fetchImpl = options.fetchImpl) != null ? _options_fetchImpl : fetch)(`${options.baseUrl.replace(/\/+$/, '')}/${((_options_path = options.path) != null ? _options_path : 'models').replace(/^\/+/, '')}`, {
4075
+ method: 'GET',
4076
+ headers: {
4077
+ Authorization: options.authorization,
4078
+ Accept: 'application/json'
4079
+ },
4080
+ signal: AbortSignal.timeout(15000)
4081
+ });
4082
+ if (!response.ok) throw new Error(`Model discovery returned HTTP ${response.status}`);
4083
+ const payload = modelListSchema.parse(await response.json());
4084
+ const models = new Map();
4085
+ for (const entry of payload.data){
4086
+ var _options_predefinedModels;
4087
+ if (entry.active === false || models.has(entry.id)) continue;
4088
+ const known = (_options_predefinedModels = options.predefinedModels) == null ? void 0 : _options_predefinedModels.find((model)=>model.model === entry.id);
4089
+ // Explicit unsupported types must not fall through to name-based guesses.
4090
+ if (entry.model_type && !contracts.isDiscoverableModelType(entry.model_type)) continue;
4091
+ if (known && !contracts.isDiscoverableModelType(known.model_type)) continue;
4092
+ var _entry_model_type, _ref;
4093
+ 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);
4094
+ const typeSource = entry.model_type ? 'provider' : known ? 'catalog' : modelType ? 'name' : 'unknown';
4095
+ const supportedType = contracts.isDiscoverableModelType(modelType) ? modelType : null;
4096
+ models.set(entry.id, _extends._extends({
4097
+ model: entry.id,
4098
+ label: entry.name || entry.id,
4099
+ modelType: supportedType,
4100
+ typeSource
4101
+ }, supportedType ? {
4102
+ configuration: contracts.configurationFromModel(supportedType, known)
4103
+ } : {}));
4104
+ }
4105
+ return [
4106
+ ...models.values()
4107
+ ];
4108
+ }
4109
+ function suggestModelType(name) {
4110
+ if (/(?:rerank|reranker)/i.test(name)) return contracts.AiModelTypeEnum.RERANK;
4111
+ if (/(?:embedding|embed)/i.test(name)) return contracts.AiModelTypeEnum.TEXT_EMBEDDING;
4112
+ // Unknown and opaque IDs stay unclassified, including unsupported image/audio/video models.
4113
+ if (/(?:image|vision-exp|video|tts|whisper|speech|audio|wan\d|seedance|seedream)/i.test(name)) return null;
4114
+ if (/(?:^|[\/_-])(?:gpt|qwen|deepseek|glm|kimi|llama|mistral|claude|minimax|gemini|chat|doubao)(?:[\d._/-]|$)/i.test(name)) {
4115
+ return contracts.AiModelTypeEnum.LLM;
4116
+ }
4117
+ return null;
4118
+ }
4119
+
4016
4120
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
4017
4121
  const SkillSourceProviderStrategy = (provider)=>common.applyDecorators(common.SetMetadata(SKILL_SOURCE_PROVIDER, provider), common.SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
4018
4122
 
@@ -10185,6 +10289,10 @@ Object.defineProperty(exports, "agentResultPathSchema", {
10185
10289
  enumerable: true,
10186
10290
  get: function () { return contracts.agentResultPathSchema; }
10187
10291
  });
10292
+ Object.defineProperty(exports, "configurationFromModel", {
10293
+ enumerable: true,
10294
+ get: function () { return contracts.configurationFromModel; }
10295
+ });
10188
10296
  Object.defineProperty(exports, "createResourceCardContent", {
10189
10297
  enumerable: true,
10190
10298
  get: function () { return contracts.createResourceCardContent; }
@@ -10445,6 +10553,7 @@ exports.agentRuntimeResultClaimSchema = agentRuntimeResultClaimSchema;
10445
10553
  exports.agentRuntimeResultConsumptionKey = agentRuntimeResultConsumptionKey;
10446
10554
  exports.als = als;
10447
10555
  exports.appendSandboxMessage = appendSandboxMessage;
10556
+ exports.applyModelConfiguration = applyModelConfiguration;
10448
10557
  exports.buildSandboxTimeoutMessage = buildSandboxTimeoutMessage;
10449
10558
  exports.calcTokenUsage = calcTokenUsage;
10450
10559
  exports.calculateLLMUsagePrice = calculateLLMUsagePrice;
@@ -10465,6 +10574,7 @@ exports.defineMcpResourceTemplate = defineMcpResourceTemplate;
10465
10574
  exports.defineXpertTool = defineXpertTool;
10466
10575
  exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
10467
10576
  exports.describeXpertToolProvider = describeXpertToolProvider;
10577
+ exports.discoverOpenAIModels = discoverOpenAIModels;
10468
10578
  exports.downloadRemoteFile = downloadRemoteFile;
10469
10579
  exports.emitResourceCard = emitResourceCard;
10470
10580
  exports.formatSandboxTimeout = formatSandboxTimeout;
package/index.esm.js CHANGED
@@ -2,8 +2,8 @@ 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';
@@ -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';
@@ -2722,6 +2723,46 @@ function normalizeCurrency(currency) {
2722
2723
  return currency.trim().toUpperCase();
2723
2724
  }
2724
2725
 
2726
+ /** Apply an explicit saved configuration without mutating a shared predefined schema. */ function applyModelConfiguration(model, configuration, schema) {
2727
+ var _schema_label, _schema_parameter_rules;
2728
+ const result = _extends({}, schema, {
2729
+ model,
2730
+ label: (_schema_label = schema == null ? void 0 : schema.label) != null ? _schema_label : {
2731
+ en_US: model,
2732
+ zh_Hans: model
2733
+ },
2734
+ model_type: configuration.modelType,
2735
+ fetch_from: FetchFrom.CUSTOMIZABLE_MODEL,
2736
+ model_properties: _extends({}, schema == null ? void 0 : schema.model_properties, {
2737
+ [ModelPropertyKey.CONTEXT_SIZE]: configuration.contextSize
2738
+ }),
2739
+ parameter_rules: [
2740
+ ...(_schema_parameter_rules = schema == null ? void 0 : schema.parameter_rules) != null ? _schema_parameter_rules : []
2741
+ ]
2742
+ });
2743
+ if (configuration.modelType === AiModelTypeEnum.LLM) {
2744
+ result.features = [
2745
+ ...configuration.features
2746
+ ];
2747
+ result.model_properties[ModelPropertyKey.MODE] = 'chat';
2748
+ result.parameter_rules = [
2749
+ ...result.parameter_rules.filter((rule)=>rule.name !== 'max_tokens'),
2750
+ {
2751
+ name: 'max_tokens',
2752
+ label: {
2753
+ en_US: 'Max output tokens',
2754
+ zh_Hans: '最大输出 Token'
2755
+ },
2756
+ type: ParameterType.INT,
2757
+ min: 1,
2758
+ max: configuration.maxOutputTokens,
2759
+ default: configuration.defaultMaxTokens
2760
+ }
2761
+ ];
2762
+ }
2763
+ return result;
2764
+ }
2765
+
2725
2766
  var AIModel_1;
2726
2767
  let AIModel = AIModel_1 = class AIModel {
2727
2768
  getRealtimeModel(_copilotModel) {
@@ -2783,6 +2824,13 @@ let AIModel = AIModel_1 = class AIModel {
2783
2824
  getModelSchema(model, credentials) {
2784
2825
  const models = this.predefinedModels();
2785
2826
  const schema = models.find((_)=>_.model === model);
2827
+ const configuration = readModelConfiguration(credentials);
2828
+ if (configuration) {
2829
+ if (configuration.modelType !== this.modelType) {
2830
+ throw new Error('Saved model configuration does not match its model type');
2831
+ }
2832
+ return applyModelConfiguration(model, configuration, schema != null ? schema : this.getCustomizableModelSchemaFromCredentials(model, credentials));
2833
+ }
2786
2834
  if (schema) {
2787
2835
  return schema;
2788
2836
  }
@@ -3995,6 +4043,62 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
3995
4043
  };
3996
4044
  }
3997
4045
 
4046
+ const modelListSchema = z.object({
4047
+ data: z.array(z.object({
4048
+ id: z.string().trim().min(1).max(512),
4049
+ active: z.boolean().optional(),
4050
+ name: z.string().optional(),
4051
+ model_type: z.string().optional()
4052
+ }))
4053
+ });
4054
+ /** OpenAI-compatible discovery transport and import suggestions, never runtime routing. */ async function discoverOpenAIModels(options) {
4055
+ var _options_fetchImpl, _options_path;
4056
+ const response = await ((_options_fetchImpl = options.fetchImpl) != null ? _options_fetchImpl : fetch)(`${options.baseUrl.replace(/\/+$/, '')}/${((_options_path = options.path) != null ? _options_path : 'models').replace(/^\/+/, '')}`, {
4057
+ method: 'GET',
4058
+ headers: {
4059
+ Authorization: options.authorization,
4060
+ Accept: 'application/json'
4061
+ },
4062
+ signal: AbortSignal.timeout(15000)
4063
+ });
4064
+ if (!response.ok) throw new Error(`Model discovery returned HTTP ${response.status}`);
4065
+ const payload = modelListSchema.parse(await response.json());
4066
+ const models = new Map();
4067
+ for (const entry of payload.data){
4068
+ var _options_predefinedModels;
4069
+ if (entry.active === false || models.has(entry.id)) continue;
4070
+ const known = (_options_predefinedModels = options.predefinedModels) == null ? void 0 : _options_predefinedModels.find((model)=>model.model === entry.id);
4071
+ // Explicit unsupported types must not fall through to name-based guesses.
4072
+ if (entry.model_type && !isDiscoverableModelType(entry.model_type)) continue;
4073
+ if (known && !isDiscoverableModelType(known.model_type)) continue;
4074
+ var _entry_model_type, _ref;
4075
+ 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);
4076
+ const typeSource = entry.model_type ? 'provider' : known ? 'catalog' : modelType ? 'name' : 'unknown';
4077
+ const supportedType = isDiscoverableModelType(modelType) ? modelType : null;
4078
+ models.set(entry.id, _extends({
4079
+ model: entry.id,
4080
+ label: entry.name || entry.id,
4081
+ modelType: supportedType,
4082
+ typeSource
4083
+ }, supportedType ? {
4084
+ configuration: configurationFromModel(supportedType, known)
4085
+ } : {}));
4086
+ }
4087
+ return [
4088
+ ...models.values()
4089
+ ];
4090
+ }
4091
+ function suggestModelType(name) {
4092
+ if (/(?:rerank|reranker)/i.test(name)) return AiModelTypeEnum.RERANK;
4093
+ if (/(?:embedding|embed)/i.test(name)) return AiModelTypeEnum.TEXT_EMBEDDING;
4094
+ // Unknown and opaque IDs stay unclassified, including unsupported image/audio/video models.
4095
+ if (/(?:image|vision-exp|video|tts|whisper|speech|audio|wan\d|seedance|seedream)/i.test(name)) return null;
4096
+ if (/(?:^|[\/_-])(?:gpt|qwen|deepseek|glm|kimi|llama|mistral|claude|minimax|gemini|chat|doubao)(?:[\d._/-]|$)/i.test(name)) {
4097
+ return AiModelTypeEnum.LLM;
4098
+ }
4099
+ return null;
4100
+ }
4101
+
3998
4102
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
3999
4103
  const SkillSourceProviderStrategy = (provider)=>applyDecorators(SetMetadata(SKILL_SOURCE_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
4000
4104
 
@@ -4127,79 +4231,79 @@ const AGENT_CHAT_DISPATCH_MESSAGE_TYPE = defineAgentMessageType('chat_dispatch',
4127
4231
  const AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING = 'steer_target_not_running';
4128
4232
 
4129
4233
  /** 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)
4234
+ conversationId: z$1.string().uuid(),
4235
+ threadId: z$1.string().trim().min(1).max(256)
4132
4236
  };
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)
4237
+ const agentRuntimeReplyTargetSchema = z$1.discriminatedUnion('type', [
4238
+ z$1.object(_extends({}, replyConversation, {
4239
+ type: z$1.literal('xpert').optional(),
4240
+ xpertId: z$1.string().uuid(),
4241
+ agentKey: z$1.string().trim().min(1).max(256)
4138
4242
  })).strict(),
4139
- z.object(_extends({}, replyConversation, {
4140
- type: z.literal('project_agent'),
4141
- projectId: z.string().uuid(),
4142
- agentKey: z.literal('general_agent')
4243
+ z$1.object(_extends({}, replyConversation, {
4244
+ type: z$1.literal('project_agent'),
4245
+ projectId: z$1.string().uuid(),
4246
+ agentKey: z$1.literal('general_agent')
4143
4247
  })).strict()
4144
4248
  ]);
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),
4249
+ /** Persist with the immutable invocation request before launch. No credentials or arbitrary routing headers. */ const agentInvocationDispatchContextSchema = z$1.object({
4250
+ version: z$1.literal(1),
4251
+ requestId: z$1.string().uuid(),
4252
+ sourceMessageId: z$1.string().trim().min(1).max(256),
4149
4253
  replyTo: agentRuntimeReplyTargetSchema,
4150
4254
  projectTask: projectTaskExecutionContextSchema.optional()
4151
4255
  }).strict();
4152
4256
 
4153
4257
  const AGENT_RUNTIME_EVENT_MESSAGE_TYPE = defineAgentMessageType('runtime_event', 1);
4154
4258
  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(),
4259
+ version: z$1.literal(1),
4260
+ invocationId: z$1.string().uuid(),
4261
+ /** Revision of the persisted observation, never a queue delivery attempt. */ revision: z$1.number().int().nonnegative(),
4158
4262
  projectTask: projectTaskExecutionReferenceSchema.optional()
4159
4263
  };
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'),
4264
+ /** Host-produced references. Consumers reload and authorize the invocation and its pinned observation. */ const agentRuntimeEventSchema = z$1.discriminatedUnion('kind', [
4265
+ z$1.object(_extends({}, reference, {
4266
+ kind: z$1.literal('progress'),
4163
4267
  progress: agentRuntimeProgressSchema
4164
4268
  })).strict(),
4165
- z.object(_extends({}, reference, {
4166
- kind: z.literal('result'),
4269
+ z$1.object(_extends({}, reference, {
4270
+ kind: z$1.literal('result'),
4167
4271
  status: agentInvocationTerminalStatusSchema
4168
4272
  })).strict(),
4169
- z.object(_extends({}, reference, {
4170
- kind: z.literal('input_request'),
4171
- interactionId: z.string().trim().min(1).max(256)
4273
+ z$1.object(_extends({}, reference, {
4274
+ kind: z$1.literal('input_request'),
4275
+ interactionId: z$1.string().trim().min(1).max(256)
4172
4276
  })).strict()
4173
4277
  ]);
4174
4278
  /** Same observation always has the same HandoffMessage.id across retries and process restarts. */ function agentRuntimeEventMessageId(event) {
4175
4279
  return `runtime-${event.invocationId}-${event.kind}-${event.revision}`;
4176
4280
  }
4177
- /** Transport states are deliberately separate from Task and Invocation status. */ const agentRuntimeDeliveryStateSchema = z.enum([
4281
+ /** Transport states are deliberately separate from Task and Invocation status. */ const agentRuntimeDeliveryStateSchema = z$1.enum([
4178
4282
  'pending',
4179
4283
  'received',
4180
4284
  'blocked',
4181
4285
  'failed'
4182
4286
  ]);
4183
- const agentRuntimeConsumptionStateSchema = z.enum([
4287
+ const agentRuntimeConsumptionStateSchema = z$1.enum([
4184
4288
  'pending',
4185
4289
  'processing',
4186
4290
  'processed',
4187
4291
  'blocked',
4188
4292
  'failed'
4189
4293
  ]);
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(),
4294
+ /** Store under a unique scoped key in the same transaction as the continuation reservation. */ const agentRuntimeResultClaimSchema = z$1.object({
4295
+ invocationId: z$1.string().uuid(),
4296
+ resultRevision: z$1.number().int().nonnegative(),
4193
4297
  recipient: agentRuntimeReplyTargetSchema,
4194
- consumer: z.discriminatedUnion('type', [
4195
- z.object({
4196
- type: z.literal('follow_up'),
4197
- executionId: z.string().uuid()
4298
+ consumer: z$1.discriminatedUnion('type', [
4299
+ z$1.object({
4300
+ type: z$1.literal('follow_up'),
4301
+ executionId: z$1.string().uuid()
4198
4302
  }).strict(),
4199
- z.object({
4200
- type: z.literal('wait'),
4201
- executionId: z.string().uuid(),
4202
- callId: z.string().trim().min(1).max(1024)
4303
+ z$1.object({
4304
+ type: z$1.literal('wait'),
4305
+ executionId: z$1.string().uuid(),
4306
+ callId: z$1.string().trim().min(1).max(1024)
4203
4307
  }).strict()
4204
4308
  ])
4205
4309
  }).strict();
@@ -6795,38 +6899,38 @@ async function resolveToolResult(value, validate) {
6795
6899
  // Validate metadata with the declared output schema, preserve bounded media blocks,
6796
6900
  // and include the same DTO in text for clients that hide structuredContent.
6797
6901
  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)
6902
+ const contentSchema = z$1.discriminatedUnion('type', [
6903
+ z$1.object({
6904
+ type: z$1.literal('text'),
6905
+ text: z$1.string().max(2 * 1024 * 1024)
6802
6906
  }).strict(),
6803
- z.object({
6804
- type: z.literal('image'),
6805
- data: z.string().min(1).max(8 * 1024 * 1024),
6806
- mimeType: z.enum([
6907
+ z$1.object({
6908
+ type: z$1.literal('image'),
6909
+ data: z$1.string().min(1).max(8 * 1024 * 1024),
6910
+ mimeType: z$1.enum([
6807
6911
  'image/png',
6808
6912
  'image/jpeg',
6809
6913
  'image/webp',
6810
6914
  'image/gif'
6811
6915
  ])
6812
6916
  }).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)
6917
+ z$1.object({
6918
+ type: z$1.literal('audio'),
6919
+ data: z$1.string().min(1).max(8 * 1024 * 1024),
6920
+ mimeType: z$1.string().min(1).max(100)
6817
6921
  }).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()
6922
+ z$1.object({
6923
+ type: z$1.literal('resource_link'),
6924
+ uri: z$1.string().min(1).max(4096),
6925
+ name: z$1.string().max(240).optional()
6822
6926
  }).strict()
6823
6927
  ]);
6824
6928
  /** Validate the envelope separately so binary content never enters the business DTO. */ async function parseDecoratedToolResult(value, outputSchema) {
6825
6929
  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()
6930
+ const envelope = z$1.object({
6931
+ content: z$1.array(contentSchema).max(32).optional(),
6932
+ structuredContent: outputSchema != null ? outputSchema : z$1.unknown().optional(),
6933
+ isError: z$1.boolean().optional()
6830
6934
  }).strict();
6831
6935
  const result = await envelope.parseAsync(value);
6832
6936
  var _result_content_map;
@@ -10151,4 +10255,4 @@ Reflect.defineMetadata('__command__', {
10151
10255
  id: ImportDefaultAgentPluginsCommand.type
10152
10256
  }, ImportDefaultAgentPluginsCommand);
10153
10257
 
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 };
10258
+ 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, 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.1",
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.2",
66
66
  "express": "^4.22.1",
67
67
  "js-tiktoken": "^1.0.21"
68
68
  },
@@ -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';