@xpert-ai/plugin-sdk 3.19.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +55 -0
  3. package/RESOURCE-CARDS-VALIDATION.md +51 -0
  4. package/RESOURCE-CARDS.md +361 -0
  5. package/TOOL-IMAGES.md +85 -0
  6. package/agent-results.cjs.default.js +1 -0
  7. package/agent-results.cjs.js +20 -0
  8. package/agent-results.cjs.mjs +2 -0
  9. package/agent-results.d.ts +1 -0
  10. package/agent-results.esm.js +4 -0
  11. package/index.cjs.js +455 -107
  12. package/index.esm.js +412 -112
  13. package/model-provider.cjs.js +5 -0
  14. package/model-provider.esm.js +5 -1
  15. package/package.json +8 -2
  16. package/results.cjs.js +50 -0
  17. package/results.esm.js +46 -0
  18. package/src/agent-results.d.ts +2 -0
  19. package/src/index.d.ts +2 -0
  20. package/src/lib/agent/handoff/agent-chat.contract.d.ts +6 -1
  21. package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +319 -0
  22. package/src/lib/agent/handoff/index.d.ts +1 -0
  23. package/src/lib/agent/index.d.ts +1 -0
  24. package/src/lib/agent/middleware/index.d.ts +1 -0
  25. package/src/lib/agent/middleware/model-requirements.d.ts +9 -0
  26. package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
  27. package/src/lib/agent/middleware/types.d.ts +7 -0
  28. package/src/lib/agent/resource-card.d.ts +3 -0
  29. package/src/lib/agent/runtime/activity.d.ts +6 -0
  30. package/src/lib/agent/runtime/capability.d.ts +13 -5
  31. package/src/lib/agent/runtime/cli-model-profile.d.ts +62 -0
  32. package/src/lib/agent/runtime/dispatch.d.ts +517 -0
  33. package/src/lib/agent/runtime/execution-runner.d.ts +66 -0
  34. package/src/lib/agent/runtime/index.d.ts +7 -0
  35. package/src/lib/agent/runtime/model-execution.d.ts +15 -0
  36. package/src/lib/agent/runtime/results.d.ts +335 -0
  37. package/src/lib/agent/runtime/strategy.d.ts +3 -0
  38. package/src/lib/agent/runtime/task-wait.d.ts +35 -0
  39. package/src/lib/agent/runtime/types.d.ts +35 -11
  40. package/src/lib/ai-model/ai-model-provider.interface.d.ts +2 -0
  41. package/src/lib/ai-model/ai-model.d.ts +2 -0
  42. package/src/lib/ai-model/index.d.ts +3 -0
  43. package/src/lib/ai-model/llm.d.ts +4 -2
  44. package/src/lib/ai-model/native-model.d.ts +22 -0
  45. package/src/lib/ai-model/realtime.d.ts +36 -0
  46. package/src/lib/ai-model/token-usage.d.ts +13 -0
  47. package/src/lib/mcp/app.d.ts +4 -1
  48. package/src/lib/project-task/index.d.ts +8 -1
  49. package/src/lib/project-type/index.d.ts +8 -1
  50. package/src/lib/resource-card-provider/index.d.ts +3 -0
  51. package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
  52. package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
  53. package/src/lib/resource-card-provider/types.d.ts +36 -0
  54. package/src/lib/resource-card.d.ts +6 -0
  55. package/src/lib/runtime/capabilities/index.d.ts +1 -0
  56. package/src/lib/runtime/capabilities/project-provisioning.d.ts +10 -0
  57. package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
  58. package/src/lib/sandbox/execution-environment.d.ts +2 -0
  59. package/src/lib/sandbox/execution.d.ts +10 -0
  60. package/src/lib/sandbox/managed-service.d.ts +1 -0
package/index.esm.js CHANGED
@@ -1,11 +1,12 @@
1
- import { Module, Logger, applyDecorators, SetMetadata, HttpException, HttpStatus, BadRequestException, Injectable, Inject, Optional, UnauthorizedException, NotFoundException, ForbiddenException } from '@nestjs/common';
1
+ import { Module, applyDecorators, SetMetadata, HttpException, HttpStatus, BadRequestException, Injectable, Inject, Logger, Optional, UnauthorizedException, NotFoundException, ForbiddenException } from '@nestjs/common';
2
2
  import { MODULE_METADATA } from '@nestjs/common/constants';
3
3
  import { pick } from 'lodash-es';
4
- import { _ as _extends } from './_extends.esm.js';
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
7
  import { DiscoveryService, Reflector } from '@nestjs/core';
6
8
  import { Subject, filter } from 'rxjs';
7
- import { LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelFeature, ModelPropertyKey, 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';
8
- export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND } from '@xpert-ai/contracts';
9
+ import { _ as _extends } from './_extends.esm.js';
9
10
  import { AsyncLocalStorage } from 'node:async_hooks';
10
11
  import { ExtractJwt } from 'passport-jwt';
11
12
  import { randomUUID, createHash } from 'node:crypto';
@@ -15,7 +16,7 @@ import fs__default from 'fs';
15
16
  import http from 'http';
16
17
  import https from 'https';
17
18
  import { c as createRuntimeCapability, B as BuiltinToolset, W as WorkspaceFilesRuntimeCapability } from './model-provider.esm.js';
18
- export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactsRuntimeCapability, d as BaseTool, e as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, f as KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, g as KnowledgeGraphRuntimeCapability, h as KnowledgebaseDocumentsRuntimeCapability, i as KnowledgebaseProvisioningRuntimeCapability, j as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, P as ProjectAccessRuntimeCapability, k as ProjectProvisioningRuntimeCapability, R as RUNTIME_CAPABILITY_PROVIDER, l as RuntimeCapabilityProvider, S as SANDBOX_JOB_ERROR_CODES, m as SANDBOX_JOB_PROGRESS_PREFIX, n as SandboxJobRuntimeError, o as SandboxJobsRuntimeCapability, p as WORKSPACE_FILES_SOURCE, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, q as isSandboxJobRuntimeError } from './model-provider.esm.js';
19
+ export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactsRuntimeCapability, d as BaseTool, e as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, f as KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, g as KnowledgeGraphRuntimeCapability, h as KnowledgebaseDocumentsRuntimeCapability, i as KnowledgebaseProvisioningRuntimeCapability, j as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, P as ProjectAccessRuntimeCapability, k as ProjectProvisioningRuntimeCapability, R as RUNTIME_CAPABILITY_PROVIDER, l as RuntimeCapabilityProvider, S as SANDBOX_JOB_ERROR_CODES, m as SANDBOX_JOB_PROGRESS_PREFIX, n as SandboxJobRuntimeError, o as SandboxJobsRuntimeCapability, T as ToolImagesRuntimeCapability, p as WORKSPACE_FILES_SOURCE, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, q as isSandboxJobRuntimeError } from './model-provider.esm.js';
19
20
  import fsPromises from 'fs/promises';
20
21
  import * as path from 'path';
21
22
  import path__default, { join } from 'path';
@@ -29,7 +30,7 @@ import * as _axios from 'axios';
29
30
  export { DataSourceRuntimeCapability, SqlDatabaseWorkbenchAdapter, quoteDatabaseIdentifier, requireReadStatement, splitWorkbenchSql } from './data-workbench.esm.js';
30
31
  import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
31
32
  import { ChatGenerationChunk } from '@langchain/core/outputs';
32
- import { isAIMessageChunk, AIMessage } from '@langchain/core/messages';
33
+ import { isBaseMessage, isAIMessage, isAIMessageChunk, AIMessage } from '@langchain/core/messages';
33
34
  import { ChatOpenAICompletions } from '@langchain/openai';
34
35
  import { Document } from '@langchain/core/documents';
35
36
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
@@ -37,11 +38,12 @@ import { getEnvironmentVariable } from '@langchain/core/utils/env';
37
38
  export { ModelProviderHttpClient, ModelProviderHttpError } from './model-provider-http-client.esm.js';
38
39
  import { getEncodingNameForModel, encodingForModel, getEncoding } from 'js-tiktoken';
39
40
  import { getModelContextSize as getModelContextSize$1 } from '@langchain/core/language_models/base';
41
+ import { z, ZodError, ZodFirstPartyTypeKind } from 'zod/v3';
42
+ export { A as AGENT_TASK_RESULTS_FEATURE, a as agentResultItemSchema, b as agentTaskResultSchema } from './results.esm.js';
40
43
  import { assertConnectorDefinition } from './connector.esm.js';
41
44
  export { CONNECTOR_AUTHORIZATION_MODES, CONNECTOR_SCOPE_TYPES, getConnectorAuthMethods, getConnectorAuthorizationModes } from './connector.esm.js';
42
45
  export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
43
46
  import { tool } from '@langchain/core/tools';
44
- import { ZodError, z, ZodFirstPartyTypeKind } from 'zod/v3';
45
47
 
46
48
  /**
47
49
  * Metadata keys used in plugins for defining various aspects like entities, subscribers, and configurations.
@@ -105,6 +107,10 @@ function assertPluginArtifactNamePart(value, label) {
105
107
  }
106
108
  }
107
109
 
110
+ /** Call after the business mutation commits. A display failure must not retry that mutation. */ async function emitResourceCard(card, config) {
111
+ await dispatchCustomEvent(ChatMessageEventTypeEnum.ON_CHAT_EVENT, createResourceCardContent(card), config);
112
+ }
113
+
108
114
  const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
109
115
  const PLUGIN_METADATA_KEY = 'xpert:pluginName';
110
116
  const PLUGIN_VERSION_METADATA_KEY = 'xpert:pluginVersion';
@@ -141,27 +147,13 @@ function resolveTenantGlobalScopeKey(tenantId) {
141
147
  return GLOBAL_ORGANIZATION_SCOPE;
142
148
  }
143
149
 
144
- function createPluginLogger(scope, baseMeta = {}) {
145
- const nestLogger = new Logger(scope);
146
- const wrap = (level, msg, meta)=>{
147
- var // Maintain alignment with the Nest Logger interface
148
- _nestLogger_level;
149
- const payload = meta ? _extends({}, baseMeta, meta) : baseMeta;
150
- (_nestLogger_level = nestLogger[level]) == null ? void 0 : _nestLogger_level.call(nestLogger, msg + (Object.keys(payload).length ? ` ${JSON.stringify(payload)}` : ''));
151
- };
152
- return {
153
- child (meta) {
154
- return createPluginLogger(scope, _extends({}, baseMeta, meta));
155
- },
156
- debug: (msg, meta)=>wrap('debug', msg, meta),
157
- log: (msg, meta)=>wrap('log', msg, meta),
158
- warn: (msg, meta)=>wrap('warn', msg, meta),
159
- error: (msg, meta)=>wrap('error', msg, meta)
160
- };
161
- }
162
-
163
- const INTEGRATION_STRATEGY = 'INTEGRATION_STRATEGY';
164
- const IntegrationStrategyKey = (provider)=>applyDecorators(SetMetadata(INTEGRATION_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, INTEGRATION_STRATEGY));
150
+ const RESOURCE_CARD_PROVIDER = 'RESOURCE_CARD_PROVIDER';
151
+ /** Register exact resource types whose message cards opt in to live refresh. */ const ResourceCardProvider = (...resources)=>{
152
+ if (!resources.length || resources.some(({ namespace, type })=>!(namespace == null ? void 0 : namespace.trim()) || !(type == null ? void 0 : type.trim()))) {
153
+ throw new Error('ResourceCardProvider requires explicit resource namespaces and types');
154
+ }
155
+ return applyDecorators(SetMetadata(RESOURCE_CARD_PROVIDER, resources), SetMetadata(STRATEGY_META_KEY, RESOURCE_CARD_PROVIDER));
156
+ };
165
157
 
166
158
  function __decorate(decorators, target, key, desc) {
167
159
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -746,6 +738,102 @@ __decorate([
746
738
  return typeof constructor === 'function' ? constructor : null;
747
739
  }
748
740
 
741
+ var ResourceCardProviderRegistry_1;
742
+ const resourceTypeKey = ({ namespace, type })=>JSON.stringify([
743
+ namespace,
744
+ type
745
+ ]);
746
+ function isProvider(value) {
747
+ return !!value && typeof value === 'object' && 'resolveMany' in value && typeof value.resolveMany === 'function';
748
+ }
749
+ let ResourceCardProviderRegistry = ResourceCardProviderRegistry_1 = class ResourceCardProviderRegistry extends BaseStrategyRegistry {
750
+ onModuleInit() {
751
+ this.subscription = this.bus.events$.pipe(filter((event)=>!event.strategyType || event.strategyType === RESOURCE_CARD_PROVIDER)).subscribe((event)=>{
752
+ try {
753
+ if (event.type === 'UPSERT') this.upsert(event.entry.instance);
754
+ else this.remove(event.orgId, event.pluginName);
755
+ } catch (e) {
756
+ // Reject the conflicting provider without terminating the lifecycle subscription.
757
+ this.resourceLogger.warn('Rejected invalid or conflicting resource card provider registration');
758
+ }
759
+ });
760
+ for (const { instance } of this.discoveryService.getProviders())if (instance) this.upsert(instance);
761
+ }
762
+ onModuleDestroy() {
763
+ var _this_subscription;
764
+ (_this_subscription = this.subscription) == null ? void 0 : _this_subscription.unsubscribe();
765
+ }
766
+ remove(scopeKey, pluginName) {
767
+ for (const entry of this.listAllRegistrations()){
768
+ if (entry.source.kind === 'plugin' && entry.source.pluginName === pluginName && entry.source.scopeKey === scopeKey) {
769
+ this.unregister(entry.type, entry.source, entry.strategy);
770
+ }
771
+ }
772
+ }
773
+ upsert(instance) {
774
+ const target = resolveStrategyMetadataTarget(instance);
775
+ const resources = target && this.reflector.get(RESOURCE_CARD_PROVIDER, target);
776
+ if (!resources) return;
777
+ if (!isProvider(instance)) throw new Error('ResourceCardProvider must implement resolveMany');
778
+ const source = this.getSource(instance);
779
+ const keys = resources.map(resourceTypeKey);
780
+ // A route belongs to one plugin across scopes; a different plugin cannot shadow it.
781
+ // Preflight the whole batch so a conflicting multi-type provider is never partly installed.
782
+ for (const key of keys){
783
+ for (const existing of this.listAllRegistrations().filter((entry)=>entry.type === key)){
784
+ const samePlugin = source.kind === 'plugin' && existing.source.kind === 'plugin' && source.pluginName === existing.source.pluginName;
785
+ if (existing.strategy !== instance && !samePlugin) {
786
+ throw new Error(`Resource card type ${key} is already registered`);
787
+ }
788
+ }
789
+ this.assertCanRegister(key, instance, source);
790
+ }
791
+ for (const key of keys)this.register(key, instance, source);
792
+ }
793
+ find(resource, organizationId) {
794
+ const key = resourceTypeKey(resource);
795
+ for (const scopeKey of this.resolveStrategyScopeKeys(organizationId)){
796
+ var _this_strategies_get;
797
+ const provider = (_this_strategies_get = this.strategies.get(scopeKey)) == null ? void 0 : _this_strategies_get.get(key);
798
+ if (provider) return provider;
799
+ }
800
+ return undefined;
801
+ }
802
+ constructor(discovery, reflector){
803
+ super(RESOURCE_CARD_PROVIDER, discovery, reflector);
804
+ this.resourceLogger = new Logger(ResourceCardProviderRegistry_1.name);
805
+ }
806
+ };
807
+ ResourceCardProviderRegistry = ResourceCardProviderRegistry_1 = __decorate([
808
+ Injectable(),
809
+ __metadata("design:paramtypes", [
810
+ DiscoveryService,
811
+ Reflector
812
+ ])
813
+ ], ResourceCardProviderRegistry);
814
+
815
+ function createPluginLogger(scope, baseMeta = {}) {
816
+ const nestLogger = new Logger(scope);
817
+ const wrap = (level, msg, meta)=>{
818
+ var // Maintain alignment with the Nest Logger interface
819
+ _nestLogger_level;
820
+ const payload = meta ? _extends({}, baseMeta, meta) : baseMeta;
821
+ (_nestLogger_level = nestLogger[level]) == null ? void 0 : _nestLogger_level.call(nestLogger, msg + (Object.keys(payload).length ? ` ${JSON.stringify(payload)}` : ''));
822
+ };
823
+ return {
824
+ child (meta) {
825
+ return createPluginLogger(scope, _extends({}, baseMeta, meta));
826
+ },
827
+ debug: (msg, meta)=>wrap('debug', msg, meta),
828
+ log: (msg, meta)=>wrap('log', msg, meta),
829
+ warn: (msg, meta)=>wrap('warn', msg, meta),
830
+ error: (msg, meta)=>wrap('error', msg, meta)
831
+ };
832
+ }
833
+
834
+ const INTEGRATION_STRATEGY = 'INTEGRATION_STRATEGY';
835
+ const IntegrationStrategyKey = (provider)=>applyDecorators(SetMetadata(INTEGRATION_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, INTEGRATION_STRATEGY));
836
+
749
837
  let IntegrationStrategyRegistry = class IntegrationStrategyRegistry extends BaseStrategyRegistry {
750
838
  constructor(discoveryService, reflector){
751
839
  super(INTEGRATION_STRATEGY, discoveryService, reflector);
@@ -2598,6 +2686,9 @@ function normalizeCurrency(currency) {
2598
2686
 
2599
2687
  var AIModel_1;
2600
2688
  let AIModel = AIModel_1 = class AIModel {
2689
+ getRealtimeModel(_copilotModel) {
2690
+ throw new Error('Unsupported realtime model');
2691
+ }
2601
2692
  getChatModel(copilotModel, options) {
2602
2693
  throw new Error(`Unsupport chat model!`);
2603
2694
  }
@@ -2841,6 +2932,75 @@ function _class_private_field_loose_key(name) {
2841
2932
  return "__private_" + id++ + "_" + name;
2842
2933
  }
2843
2934
 
2935
+ function resolveTokenUsageCandidates(input) {
2936
+ const candidates = [
2937
+ {
2938
+ value: input.canonical,
2939
+ source: 'provider'
2940
+ },
2941
+ {
2942
+ value: input.actual,
2943
+ source: 'provider'
2944
+ },
2945
+ {
2946
+ value: input.estimated,
2947
+ source: 'estimated'
2948
+ },
2949
+ {
2950
+ value: {
2951
+ totalTokens: input.legacyTotal
2952
+ },
2953
+ source: 'legacy'
2954
+ }
2955
+ ];
2956
+ for (const candidate of candidates){
2957
+ const usage = normalizeTokenUsage(candidate.value);
2958
+ if (usage) return {
2959
+ usage,
2960
+ source: candidate.source
2961
+ };
2962
+ }
2963
+ return {
2964
+ usage: {
2965
+ promptTokens: 0,
2966
+ completionTokens: 0,
2967
+ totalTokens: 0
2968
+ },
2969
+ source: 'unavailable'
2970
+ };
2971
+ }
2972
+ function normalizeTokenUsage(candidate) {
2973
+ if (!candidate) return null;
2974
+ const counts = [
2975
+ candidate.promptTokens,
2976
+ candidate.completionTokens,
2977
+ candidate.totalTokens,
2978
+ candidate.cacheReadInputTokens,
2979
+ candidate.cacheWriteInputTokens,
2980
+ candidate.reasoningTokens
2981
+ ];
2982
+ if (counts.some((count)=>count !== undefined && (!Number.isSafeInteger(count) || count < 0))) return null;
2983
+ var _candidate_promptTokens;
2984
+ const promptTokens = (_candidate_promptTokens = candidate.promptTokens) != null ? _candidate_promptTokens : 0;
2985
+ var _candidate_completionTokens;
2986
+ const completionTokens = (_candidate_completionTokens = candidate.completionTokens) != null ? _candidate_completionTokens : 0;
2987
+ const totalTokens = candidate.totalTokens || promptTokens + completionTokens;
2988
+ if (!Number.isSafeInteger(totalTokens) || totalTokens <= 0 || totalTokens < promptTokens + completionTokens) return null;
2989
+ var _candidate_cacheReadInputTokens, _candidate_cacheWriteInputTokens, _candidate_reasoningTokens;
2990
+ if (((_candidate_cacheReadInputTokens = candidate.cacheReadInputTokens) != null ? _candidate_cacheReadInputTokens : 0) + ((_candidate_cacheWriteInputTokens = candidate.cacheWriteInputTokens) != null ? _candidate_cacheWriteInputTokens : 0) > promptTokens || ((_candidate_reasoningTokens = candidate.reasoningTokens) != null ? _candidate_reasoningTokens : 0) > completionTokens) return null;
2991
+ return _extends({
2992
+ promptTokens,
2993
+ completionTokens,
2994
+ totalTokens
2995
+ }, candidate.cacheReadInputTokens ? {
2996
+ cacheReadInputTokens: candidate.cacheReadInputTokens
2997
+ } : {}, candidate.cacheWriteInputTokens ? {
2998
+ cacheWriteInputTokens: candidate.cacheWriteInputTokens
2999
+ } : {}, candidate.reasoningTokens ? {
3000
+ reasoningTokens: candidate.reasoningTokens
3001
+ } : {});
3002
+ }
3003
+
2844
3004
  var _a;
2845
3005
  class LLMUsage {
2846
3006
  static emptyUsage() {
@@ -2886,6 +3046,18 @@ class LargeLanguageModel extends AIModel {
2886
3046
  _commonParameterRules(model) {
2887
3047
  return CommonParameterRules;
2888
3048
  }
3049
+ /** Price already normalized provider facts without starting another inference or writing a ledger. */ priceActualTokenUsage(model, tokenUsage, context = {}) {
3050
+ var _this_getModelSchema;
3051
+ const usage = normalizeTokenUsage(tokenUsage);
3052
+ if (!usage) throw new Error('Actual token usage is required');
3053
+ const priced = this.calcResponseUsage(model, {}, usage.promptTokens, usage.completionTokens, performance.now(), usage, _extends({}, context, {
3054
+ inputTokensIncludeCache: true
3055
+ }));
3056
+ return _extends({}, priced, usage, !((_this_getModelSchema = this.getModelSchema(model, {})) == null ? void 0 : _this_getModelSchema.pricing) ? {
3057
+ pricingStatus: 'unpriced',
3058
+ totalPrice: undefined
3059
+ } : {});
3060
+ }
2889
3061
  calcResponseUsage(model, credentials, promptTokens, completionTokens, startedAt = this.startedAt, tokenUsage, pricingContext = {}) {
2890
3062
  var _this_getModelSchema;
2891
3063
  const resolvedTokenUsage = tokenUsage != null ? tokenUsage : {
@@ -3033,12 +3205,15 @@ class LargeLanguageModel extends AIModel {
3033
3205
  callback
3034
3206
  ];
3035
3207
  }
3036
- createHandleLLMErrorCallbacks(fields, logger) {
3208
+ createHandleLLMErrorCallbacks(_fields, logger) {
3037
3209
  return {
3038
- handleLLMError: (err)=>{
3039
- var _err_cause;
3040
- var _err_cause_stack;
3041
- (logger != null ? logger : _class_private_field_loose_base(this, _logger)[_logger]).error(err, (_err_cause_stack = (_err_cause = err.cause) == null ? void 0 : _err_cause.stack) != null ? _err_cause_stack : err.stack, `Error attemptNumber: ${err.attemptNumber}, retriesLeft: ${err.retriesLeft}, ChatDeepSeek params are:\n${JSON.stringify(fields, null, 2)}`);
3210
+ handleLLMError: (error)=>{
3211
+ // Provider errors and constructor fields can contain credentials or request bodies.
3212
+ const errorType = error instanceof Error && /^[A-Za-z]{1,60}$/.test(error.name) ? error.name : 'Error';
3213
+ (logger != null ? logger : _class_private_field_loose_base(this, _logger)[_logger]).error({
3214
+ event: 'model_provider_request_failed',
3215
+ errorType
3216
+ });
3042
3217
  }
3043
3218
  };
3044
3219
  }
@@ -3248,97 +3423,59 @@ function isAbortError(error) {
3248
3423
  return error.name === 'AbortError' || /\babort(?:ed)?\b/i.test(error.message);
3249
3424
  }
3250
3425
  function calcTokenUsage(output) {
3251
- var _output_generations;
3252
- const tokenUsage = {
3426
+ const result = {
3253
3427
  promptTokens: 0,
3254
3428
  completionTokens: 0,
3255
3429
  totalTokens: 0
3256
3430
  };
3257
- let cacheReadInputTokens = 0;
3258
- let cacheWriteInputTokens = 0;
3259
- (_output_generations = output.generations) == null ? void 0 : _output_generations.forEach((generation)=>{
3260
- generation.forEach((item)=>{
3261
- const message = item.message;
3262
- if (message.usage_metadata) {
3263
- var _message_usage_metadata_input_token_details, _message_usage_metadata_input_token_details1;
3264
- tokenUsage.promptTokens += message.usage_metadata.input_tokens;
3265
- tokenUsage.completionTokens += message.usage_metadata.output_tokens;
3266
- tokenUsage.totalTokens += message.usage_metadata.total_tokens;
3267
- var _message_usage_metadata_input_token_details_cache_read;
3268
- cacheReadInputTokens += (_message_usage_metadata_input_token_details_cache_read = (_message_usage_metadata_input_token_details = message.usage_metadata.input_token_details) == null ? void 0 : _message_usage_metadata_input_token_details.cache_read) != null ? _message_usage_metadata_input_token_details_cache_read : 0;
3269
- var _message_usage_metadata_input_token_details_cache_creation;
3270
- cacheWriteInputTokens += (_message_usage_metadata_input_token_details_cache_creation = (_message_usage_metadata_input_token_details1 = message.usage_metadata.input_token_details) == null ? void 0 : _message_usage_metadata_input_token_details1.cache_creation) != null ? _message_usage_metadata_input_token_details_cache_creation : 0;
3271
- }
3272
- });
3273
- });
3274
- if (cacheReadInputTokens > 0) tokenUsage.cacheReadInputTokens = cacheReadInputTokens;
3275
- if (cacheWriteInputTokens > 0) tokenUsage.cacheWriteInputTokens = cacheWriteInputTokens;
3276
- return tokenUsage;
3431
+ var _output_generations;
3432
+ for (const choices of (_output_generations = output.generations) != null ? _output_generations : []){
3433
+ // Each inner array contains choices from one request, not independent provider attempts.
3434
+ const usage = choices.map((choice)=>{
3435
+ var _metadata_input_token_details, _metadata_input_token_details1, _metadata_output_token_details;
3436
+ if (!('message' in choice) || !isBaseMessage(choice.message) || !isAIMessage(choice.message)) return null;
3437
+ const metadata = choice.message.usage_metadata;
3438
+ return metadata ? normalizeTokenUsage({
3439
+ promptTokens: metadata.input_tokens,
3440
+ completionTokens: metadata.output_tokens,
3441
+ totalTokens: metadata.total_tokens,
3442
+ cacheReadInputTokens: (_metadata_input_token_details = metadata.input_token_details) == null ? void 0 : _metadata_input_token_details.cache_read,
3443
+ cacheWriteInputTokens: (_metadata_input_token_details1 = metadata.input_token_details) == null ? void 0 : _metadata_input_token_details1.cache_creation,
3444
+ reasoningTokens: (_metadata_output_token_details = metadata.output_token_details) == null ? void 0 : _metadata_output_token_details.reasoning
3445
+ }) : null;
3446
+ }).find((candidate)=>candidate !== null);
3447
+ if (!usage) continue;
3448
+ result.promptTokens += usage.promptTokens;
3449
+ result.completionTokens += usage.completionTokens;
3450
+ result.totalTokens += usage.totalTokens;
3451
+ for (const key of [
3452
+ 'cacheReadInputTokens',
3453
+ 'cacheWriteInputTokens',
3454
+ 'reasoningTokens'
3455
+ ]){
3456
+ var _result_key;
3457
+ if (usage[key] !== undefined) result[key] = ((_result_key = result[key]) != null ? _result_key : 0) + usage[key];
3458
+ }
3459
+ }
3460
+ return result;
3277
3461
  }
3278
3462
  function resolveTokenUsage(output) {
3279
3463
  return resolveTokenUsageWithAuthority(output).usage;
3280
3464
  }
3281
3465
  function resolveTokenUsageWithAuthority(output) {
3282
3466
  var _output_llmOutput, _output_llmOutput1, _output_llmOutput2;
3283
- var _normalizeTokenUsage, _ref;
3284
- const actualUsage = (_ref = (_normalizeTokenUsage = normalizeTokenUsage(calcTokenUsage(output))) != null ? _normalizeTokenUsage : normalizeTokenUsage((_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput['tokenUsage'])) != null ? _ref : normalizeTokenUsage({
3285
- totalTokens: (_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1['totalTokens']
3467
+ const resolved = resolveTokenUsageCandidates({
3468
+ canonical: calcTokenUsage(output),
3469
+ actual: (_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput['tokenUsage'],
3470
+ estimated: (_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1['estimatedTokenUsage'],
3471
+ legacyTotal: (_output_llmOutput2 = output.llmOutput) == null ? void 0 : _output_llmOutput2['totalTokens']
3286
3472
  });
3287
- if (actualUsage) {
3288
- return {
3289
- usage: actualUsage
3290
- };
3291
- }
3292
- const estimatedUsage = normalizeTokenUsage((_output_llmOutput2 = output.llmOutput) == null ? void 0 : _output_llmOutput2['estimatedTokenUsage']);
3293
- if (estimatedUsage) {
3294
- return {
3295
- usage: estimatedUsage,
3296
- type: 'estimated'
3297
- };
3298
- }
3299
- return {
3300
- usage: {
3301
- promptTokens: 0,
3302
- completionTokens: 0,
3303
- totalTokens: 0
3304
- }
3305
- };
3306
- }
3307
- function normalizeTokenUsage(candidate) {
3308
- if (!candidate) {
3309
- return null;
3310
- }
3311
- if (!isValidTokenCount(candidate.promptTokens) || !isValidTokenCount(candidate.completionTokens) || !isValidTokenCount(candidate.totalTokens)) {
3312
- return null;
3313
- }
3314
- var _candidate_promptTokens;
3315
- const promptTokens = (_candidate_promptTokens = candidate.promptTokens) != null ? _candidate_promptTokens : 0;
3316
- var _candidate_completionTokens;
3317
- const completionTokens = (_candidate_completionTokens = candidate.completionTokens) != null ? _candidate_completionTokens : 0;
3318
- const totalTokens = candidate.totalTokens || promptTokens + completionTokens;
3319
- if (promptTokens === 0 && completionTokens === 0 && totalTokens === 0) {
3320
- return null;
3321
- }
3322
- var _candidate_cacheReadInputTokens;
3323
- const cacheReadInputTokens = (_candidate_cacheReadInputTokens = candidate.cacheReadInputTokens) != null ? _candidate_cacheReadInputTokens : 0;
3324
- var _candidate_cacheWriteInputTokens;
3325
- const cacheWriteInputTokens = (_candidate_cacheWriteInputTokens = candidate.cacheWriteInputTokens) != null ? _candidate_cacheWriteInputTokens : 0;
3326
- if (!isValidTokenCount(cacheReadInputTokens) || !isValidTokenCount(cacheWriteInputTokens)) {
3327
- return null;
3328
- }
3329
3473
  return _extends({
3330
- promptTokens,
3331
- completionTokens,
3332
- totalTokens
3333
- }, cacheReadInputTokens > 0 ? {
3334
- cacheReadInputTokens
3335
- } : {}, cacheWriteInputTokens > 0 ? {
3336
- cacheWriteInputTokens
3474
+ usage: resolved.usage
3475
+ }, resolved.source === 'estimated' ? {
3476
+ type: 'estimated'
3337
3477
  } : {});
3338
3478
  }
3339
- function isValidTokenCount(value) {
3340
- return value === undefined || Number.isFinite(value) && value >= 0;
3341
- }
3342
3479
  function normalizeCacheTokenAccounting(tokenUsage, context) {
3343
3480
  if (context.inputTokensIncludeCache !== false) return tokenUsage;
3344
3481
  var _tokenUsage_cacheReadInputTokens, _tokenUsage_cacheWriteInputTokens;
@@ -3789,6 +3926,37 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
3789
3926
  id: CreateModelClientCommand.type
3790
3927
  }, CreateModelClientCommand);
3791
3928
 
3929
+ /** A single fetch is one billable attempt. No SDK retries or redirects to another credential origin. */ function nativeModelTransport(input) {
3930
+ const base = new URL(input.baseUrl);
3931
+ if (![
3932
+ 'http:',
3933
+ 'https:'
3934
+ ].includes(base.protocol) || base.username || base.password || base.search || base.hash) throw new Error('Invalid native model endpoint');
3935
+ const suffix = input.protocol === 'openai_responses' ? '/responses' : '/v1/messages';
3936
+ const url = `${base.href.replace(/\/$/, '')}${suffix}`;
3937
+ return (body, forwarded, signal)=>{
3938
+ const headers = new Headers({
3939
+ 'content-type': 'application/json'
3940
+ });
3941
+ if (input.protocol === 'anthropic_messages') {
3942
+ headers.set('anthropic-version', '2023-06-01');
3943
+ for (const [name, value] of Object.entries(forwarded)){
3944
+ // Native Anthropic feature/version headers must survive protocol evolution.
3945
+ if (/^anthropic-[a-z0-9-]+$/.test(name)) headers.set(name, value);
3946
+ }
3947
+ headers.set('x-api-key', input.authorization);
3948
+ } else headers.set('authorization', input.authorization);
3949
+ var _input_fetch;
3950
+ return ((_input_fetch = input.fetch) != null ? _input_fetch : fetch)(url, {
3951
+ method: 'POST',
3952
+ headers,
3953
+ body: JSON.stringify(body),
3954
+ signal,
3955
+ redirect: 'error'
3956
+ });
3957
+ };
3958
+ }
3959
+
3792
3960
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
3793
3961
  const SkillSourceProviderStrategy = (provider)=>applyDecorators(SetMetadata(SKILL_SOURCE_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
3794
3962
 
@@ -3863,6 +4031,18 @@ function isModelOutputValidationError(error) {
3863
4031
  return candidate.code === MODEL_OUTPUT_VALIDATION_ERROR_CODE && candidate.retryable === true && ((_candidate_repairContext = candidate.repairContext) == null ? void 0 : _candidate_repairContext.kind) === 'invalid_tool_calls' && Array.isArray(candidate.repairContext.issues);
3864
4032
  }
3865
4033
 
4034
+ /** Combine middleware contributions without mutating or weakening existing requirements. */ function mergeModelRequirements(...requirements) {
4035
+ const features = [
4036
+ ...new Set(requirements.flatMap((item)=>{
4037
+ var _item_features;
4038
+ return (_item_features = item == null ? void 0 : item.features) != null ? _item_features : [];
4039
+ }))
4040
+ ];
4041
+ return features.length ? {
4042
+ features
4043
+ } : undefined;
4044
+ }
4045
+
3866
4046
  const SEGMENT_PATTERN = /^[a-z][a-z0-9_-]*$/i;
3867
4047
  const VERSION_PATTERN = /^v[1-9][0-9]*$/;
3868
4048
  function assertSegment(input, name) {
@@ -3908,6 +4088,96 @@ function assertSegment(input, name) {
3908
4088
  const AGENT_CHAT_DISPATCH_MESSAGE_TYPE = defineAgentMessageType('chat_dispatch', 1);
3909
4089
  const AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING = 'steer_target_not_running';
3910
4090
 
4091
+ /** Captured by an authorized host command. Describing a recipient never authorizes delivery. */ const replyConversation = {
4092
+ conversationId: z.string().uuid(),
4093
+ threadId: z.string().trim().min(1).max(256)
4094
+ };
4095
+ const agentRuntimeReplyTargetSchema = z.discriminatedUnion('type', [
4096
+ z.object(_extends({}, replyConversation, {
4097
+ type: z.literal('xpert').optional(),
4098
+ xpertId: z.string().uuid(),
4099
+ agentKey: z.string().trim().min(1).max(256)
4100
+ })).strict(),
4101
+ z.object(_extends({}, replyConversation, {
4102
+ type: z.literal('project_agent'),
4103
+ projectId: z.string().uuid(),
4104
+ agentKey: z.literal('general_agent')
4105
+ })).strict()
4106
+ ]);
4107
+ /** Persist with the immutable invocation request before launch. No credentials or arbitrary routing headers. */ const agentInvocationDispatchContextSchema = z.object({
4108
+ version: z.literal(1),
4109
+ requestId: z.string().uuid(),
4110
+ sourceMessageId: z.string().trim().min(1).max(256),
4111
+ replyTo: agentRuntimeReplyTargetSchema,
4112
+ projectTask: projectTaskExecutionContextSchema.optional()
4113
+ }).strict();
4114
+
4115
+ const AGENT_RUNTIME_EVENT_MESSAGE_TYPE = defineAgentMessageType('runtime_event', 1);
4116
+ const reference = {
4117
+ version: z.literal(1),
4118
+ invocationId: z.string().uuid(),
4119
+ /** Revision of the persisted observation, never a queue delivery attempt. */ revision: z.number().int().nonnegative(),
4120
+ projectTask: projectTaskExecutionReferenceSchema.optional()
4121
+ };
4122
+ /** Host-produced references. Consumers reload and authorize the invocation and its pinned observation. */ const agentRuntimeEventSchema = z.discriminatedUnion('kind', [
4123
+ z.object(_extends({}, reference, {
4124
+ kind: z.literal('progress'),
4125
+ progress: agentRuntimeProgressSchema
4126
+ })).strict(),
4127
+ z.object(_extends({}, reference, {
4128
+ kind: z.literal('result'),
4129
+ status: agentInvocationTerminalStatusSchema
4130
+ })).strict(),
4131
+ z.object(_extends({}, reference, {
4132
+ kind: z.literal('input_request'),
4133
+ interactionId: z.string().trim().min(1).max(256)
4134
+ })).strict()
4135
+ ]);
4136
+ /** Same observation always has the same HandoffMessage.id across retries and process restarts. */ function agentRuntimeEventMessageId(event) {
4137
+ return `runtime-${event.invocationId}-${event.kind}-${event.revision}`;
4138
+ }
4139
+ /** Transport states are deliberately separate from Task and Invocation status. */ const agentRuntimeDeliveryStateSchema = z.enum([
4140
+ 'pending',
4141
+ 'received',
4142
+ 'blocked',
4143
+ 'failed'
4144
+ ]);
4145
+ const agentRuntimeConsumptionStateSchema = z.enum([
4146
+ 'pending',
4147
+ 'processing',
4148
+ 'processed',
4149
+ 'blocked',
4150
+ 'failed'
4151
+ ]);
4152
+ /** Store under a unique scoped key in the same transaction as the continuation reservation. */ const agentRuntimeResultClaimSchema = z.object({
4153
+ invocationId: z.string().uuid(),
4154
+ resultRevision: z.number().int().nonnegative(),
4155
+ recipient: agentRuntimeReplyTargetSchema,
4156
+ consumer: z.discriminatedUnion('type', [
4157
+ z.object({
4158
+ type: z.literal('follow_up'),
4159
+ executionId: z.string().uuid()
4160
+ }).strict(),
4161
+ z.object({
4162
+ type: z.literal('wait'),
4163
+ executionId: z.string().uuid(),
4164
+ callId: z.string().trim().min(1).max(1024)
4165
+ }).strict()
4166
+ ])
4167
+ }).strict();
4168
+ /**
4169
+ * Wait and asynchronous reply compete for this same key, regardless of delivery revision.
4170
+ * The storage key must additionally include tenant, organization and owner from trusted scope.
4171
+ */ function agentRuntimeResultConsumptionKey(invocationId, recipient) {
4172
+ return JSON.stringify([
4173
+ invocationId,
4174
+ recipient.conversationId,
4175
+ recipient.threadId,
4176
+ recipient.type === 'project_agent' ? `project:${recipient.projectId}` : recipient.xpertId,
4177
+ recipient.agentKey
4178
+ ]);
4179
+ }
4180
+
3911
4181
  /**
3912
4182
  * Handoff Processor meta key。
3913
4183
  */ const HANDOFF_PROCESSOR_STRATEGY = 'HANDOFF_PROCESSOR_STRATEGY';
@@ -3983,6 +4253,30 @@ AgentRuntimeRegistry = __decorate([
3983
4253
  });
3984
4254
  /** Platform factory capability. The wire key is stable across SDK naming changes. */ const AgentRuntimeFactoryCapability = createRuntimeCapability('platform.agent_invocation.factory');
3985
4255
 
4256
+ /**
4257
+ * Keeps shared OS model authorization independent of Pro Computer/Docker lifecycle details.
4258
+ * Grant issuance, authentication, revalidation and renewal delegate environment checks to this host adapter.
4259
+ * Implementations validate ownership and instance identity so a replaced runtime cannot keep its old grant.
4260
+ * Execution validity is independent of desktop viewing sessions; managed runners may also require an operation lease.
4261
+ * Other environments can supply their own checks without changing the grant service.
4262
+ * This capability validates the bound environment; model selection and usage accounting remain separate concerns.
4263
+ */ const ModelExecutionEnvironmentCapability = createRuntimeCapability('platform.model_execution.environment');
4264
+
4265
+ /** Configuration adapters describe secrets by reference; only the host materializes credentials. */ const CLI_MODEL_TOKEN_REFERENCE = '${XPERT_EXECUTION_TOKEN}';
4266
+ const CliModelProfilesCapability = createRuntimeCapability('platform.cli_model_profiles');
4267
+ /** Additional execution sources can validate lifecycle without making OS depend on Pro entities. */ const ShellModelExecutionSourceCapability = createRuntimeCapability('platform.model_execution.shell_source');
4268
+
4269
+ function taskWaitReason(states, mode) {
4270
+ if (states.length && (mode === 'all' ? states.every((state)=>state === 'completed') : states.includes('completed'))) return 'completed';
4271
+ if (states.includes('attention')) return 'attention';
4272
+ return undefined;
4273
+ }
4274
+
4275
+ const AgentExecutionRunnerCapability = createRuntimeCapability('platform.agent_execution.runner');
4276
+ const AgentExecutionRunnerFactoryCapability = createRuntimeCapability('platform.agent_execution.runner.factory');
4277
+
4278
+ /** Older runtime plugins can still send this event; new emissions use ON_CHAT_EVENT. */ const RESOURCE_CARD_EVENT = 'xpert.resource_card';
4279
+
3986
4280
  const ASSISTANT_CAPABILITY_PROVIDER = 'ASSISTANT_CAPABILITY_PROVIDER';
3987
4281
  const AssistantCapabilityProvider = (key)=>applyDecorators(SetMetadata(ASSISTANT_CAPABILITY_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, ASSISTANT_CAPABILITY_PROVIDER));
3988
4282
  let AssistantCapabilityProviderRegistry = class AssistantCapabilityProviderRegistry extends BaseStrategyRegistry {
@@ -4295,7 +4589,9 @@ function resolveSandboxExecutionOptions(options, defaults = DEFAULT_SANDBOX_SHEL
4295
4589
  return _extends({
4296
4590
  timeoutMs,
4297
4591
  maxOutputBytes
4298
- }, (options == null ? void 0 : options.signal) ? {
4592
+ }, (options == null ? void 0 : options.executionScope) ? {
4593
+ executionScope: options.executionScope
4594
+ } : {}, (options == null ? void 0 : options.signal) ? {
4299
4595
  signal: options.signal
4300
4596
  } : {});
4301
4597
  }
@@ -5436,6 +5732,7 @@ ViewExtensionProviderRegistry = __decorate([
5436
5732
 
5437
5733
  const XPERT_REMOTE_UI_CSS = `
5438
5734
  :root {
5735
+ font-size: var(--xui-density-root-font-size, 16px);
5439
5736
  color-scheme: light;
5440
5737
  --xui-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
5441
5738
  --xui-color-background: #fff;
@@ -5470,6 +5767,7 @@ const XPERT_REMOTE_UI_CSS = `
5470
5767
  --xui-radius-sm: 6px;
5471
5768
  --xui-radius-md: 8px;
5472
5769
  --xui-radius-lg: 10px;
5770
+ --xui-font-size: 14px;
5473
5771
  --xui-font-size-xs: 0.75rem;
5474
5772
  --xui-font-size-sm: 0.8125rem;
5475
5773
  --xui-font-size-md: 0.875rem;
@@ -5757,6 +6055,7 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
5757
6055
  var VERSION = 1
5758
6056
  var TOKEN_MAP = {
5759
6057
  fontFamily: '--xui-font-family',
6058
+ densityRootFontSize: '--xui-density-root-font-size',
5760
6059
  colorBackground: '--xui-color-background',
5761
6060
  colorForeground: '--xui-color-foreground',
5762
6061
  colorCard: '--xui-color-card',
@@ -5789,6 +6088,7 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
5789
6088
  radiusSm: '--xui-radius-sm',
5790
6089
  radiusMd: '--xui-radius-md',
5791
6090
  radiusLg: '--xui-radius-lg',
6091
+ fontSize: '--xui-font-size',
5792
6092
  fontSizeXs: '--xui-font-size-xs',
5793
6093
  fontSizeSm: '--xui-font-size-sm',
5794
6094
  fontSizeMd: '--xui-font-size-md',
@@ -9802,4 +10102,4 @@ const ProjectTasksRuntimeCapability = createRuntimeCapability('platform.project.
9802
10102
  description: 'Read project task graphs, manage schedules, and resolve exact execution conversations.'
9803
10103
  });
9804
10104
 
9805
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, 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, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, 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, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeStrategyKey, KnowledgeStrategyRegistry, 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, 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, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, 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, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, 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, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, textTokenBoundaries };
10105
+ 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, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, 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 };