@xpert-ai/plugin-sdk 3.18.7 → 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 (80) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/MIDDLEWARE_APPS.md +71 -0
  3. package/README.md +57 -0
  4. package/RESOURCE-CARDS-VALIDATION.md +51 -0
  5. package/RESOURCE-CARDS.md +361 -0
  6. package/TOOL-IMAGES.md +85 -0
  7. package/agent-results.cjs.default.js +1 -0
  8. package/agent-results.cjs.js +20 -0
  9. package/agent-results.cjs.mjs +2 -0
  10. package/agent-results.d.ts +1 -0
  11. package/agent-results.esm.js +4 -0
  12. package/index.cjs.js +586 -162
  13. package/index.esm.js +530 -167
  14. package/model-provider.cjs.js +5 -0
  15. package/model-provider.esm.js +5 -1
  16. package/package.json +8 -2
  17. package/results.cjs.js +50 -0
  18. package/results.esm.js +46 -0
  19. package/runtime-capabilities.md +35 -0
  20. package/src/agent-results.d.ts +2 -0
  21. package/src/index.d.ts +5 -0
  22. package/src/lib/agent/handoff/agent-chat.contract.d.ts +6 -1
  23. package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +319 -0
  24. package/src/lib/agent/handoff/index.d.ts +1 -0
  25. package/src/lib/agent/index.d.ts +2 -0
  26. package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +55 -20
  27. package/src/lib/agent/middleware/index.d.ts +1 -0
  28. package/src/lib/agent/middleware/model-requirements.d.ts +9 -0
  29. package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
  30. package/src/lib/agent/middleware/types.d.ts +20 -3
  31. package/src/lib/agent/resource-card.d.ts +3 -0
  32. package/src/lib/agent/runtime/activity.d.ts +6 -0
  33. package/src/lib/agent/runtime/capability.d.ts +37 -0
  34. package/src/lib/agent/runtime/cli-model-profile.d.ts +62 -0
  35. package/src/lib/agent/runtime/dispatch.d.ts +517 -0
  36. package/src/lib/agent/runtime/execution-runner.d.ts +66 -0
  37. package/src/lib/agent/runtime/index.d.ts +10 -0
  38. package/src/lib/agent/runtime/model-execution.d.ts +15 -0
  39. package/src/lib/agent/runtime/results.d.ts +335 -0
  40. package/src/lib/agent/runtime/strategy.d.ts +53 -0
  41. package/src/lib/agent/runtime/task-wait.d.ts +35 -0
  42. package/src/lib/agent/runtime/types.d.ts +156 -0
  43. package/src/lib/ai-model/ai-model-provider.interface.d.ts +2 -0
  44. package/src/lib/ai-model/ai-model.d.ts +2 -0
  45. package/src/lib/ai-model/index.d.ts +3 -0
  46. package/src/lib/ai-model/llm.d.ts +4 -2
  47. package/src/lib/ai-model/native-model.d.ts +22 -0
  48. package/src/lib/ai-model/realtime.d.ts +36 -0
  49. package/src/lib/ai-model/token-usage.d.ts +13 -0
  50. package/src/lib/assistant-capability/index.d.ts +42 -0
  51. package/src/lib/connector/runtime-capability.d.ts +2 -0
  52. package/src/lib/connector/strategy.interface.d.ts +8 -0
  53. package/src/lib/core/context/request-context.d.ts +6 -0
  54. package/src/lib/core/strategy-bus.d.ts +0 -3
  55. package/src/lib/evolution/runtime-capability.d.ts +2 -1
  56. package/src/lib/integration/strategy.interface.d.ts +22 -0
  57. package/src/lib/mcp/app.d.ts +14 -1
  58. package/src/lib/project-task/index.d.ts +66 -0
  59. package/src/lib/project-type/index.d.ts +71 -0
  60. package/src/lib/resource-card-provider/index.d.ts +3 -0
  61. package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
  62. package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
  63. package/src/lib/resource-card-provider/types.d.ts +36 -0
  64. package/src/lib/resource-card.d.ts +6 -0
  65. package/src/lib/runtime/capabilities/index.d.ts +1 -0
  66. package/src/lib/runtime/capabilities/knowledge-graph.d.ts +59 -0
  67. package/src/lib/runtime/capabilities/knowledgebase-documents.d.ts +21 -0
  68. package/src/lib/runtime/capabilities/knowledgebase.d.ts +8 -3
  69. package/src/lib/runtime/capabilities/project-access.d.ts +2 -1
  70. package/src/lib/runtime/capabilities/project-provisioning.d.ts +13 -0
  71. package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
  72. package/src/lib/runtime/runtime-scope.d.ts +7 -1
  73. package/src/lib/sandbox/execution-environment.d.ts +12 -0
  74. package/src/lib/sandbox/execution.d.ts +13 -0
  75. package/src/lib/sandbox/index.d.ts +1 -0
  76. package/src/lib/sandbox/managed-service.d.ts +1 -0
  77. package/src/lib/sandbox/protocol.d.ts +2 -0
  78. package/src/lib/tool-provider/types.d.ts +6 -0
  79. package/src/lib/types.d.ts +2 -1
  80. package/src/lib/workflow/trigger/strategy.interface.d.ts +2 -1
package/index.esm.js CHANGED
@@ -1,14 +1,14 @@
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
- import { verify, JsonWebTokenError } from 'jsonwebtoken';
12
12
  import { randomUUID, createHash } from 'node:crypto';
13
13
  import { Command } from '@nestjs/cqrs';
14
14
  import * as fs from 'fs';
@@ -16,7 +16,7 @@ import fs__default from 'fs';
16
16
  import http from 'http';
17
17
  import https from 'https';
18
18
  import { c as createRuntimeCapability, B as BuiltinToolset, W as WorkspaceFilesRuntimeCapability } from './model-provider.esm.js';
19
- export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as 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';
20
20
  import fsPromises from 'fs/promises';
21
21
  import * as path from 'path';
22
22
  import path__default, { join } from 'path';
@@ -30,7 +30,7 @@ import * as _axios from 'axios';
30
30
  export { DataSourceRuntimeCapability, SqlDatabaseWorkbenchAdapter, quoteDatabaseIdentifier, requireReadStatement, splitWorkbenchSql } from './data-workbench.esm.js';
31
31
  import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
32
32
  import { ChatGenerationChunk } from '@langchain/core/outputs';
33
- import { isAIMessageChunk, AIMessage } from '@langchain/core/messages';
33
+ import { isBaseMessage, isAIMessage, isAIMessageChunk, AIMessage } from '@langchain/core/messages';
34
34
  import { ChatOpenAICompletions } from '@langchain/openai';
35
35
  import { Document } from '@langchain/core/documents';
36
36
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
@@ -38,11 +38,12 @@ 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';
42
+ export { A as AGENT_TASK_RESULTS_FEATURE, a as agentResultItemSchema, b as agentTaskResultSchema } from './results.esm.js';
41
43
  import { assertConnectorDefinition } from './connector.esm.js';
42
44
  export { CONNECTOR_AUTHORIZATION_MODES, CONNECTOR_SCOPE_TYPES, getConnectorAuthMethods, getConnectorAuthorizationModes } from './connector.esm.js';
43
45
  export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
44
46
  import { tool } from '@langchain/core/tools';
45
- import { ZodError, z, ZodFirstPartyTypeKind } from 'zod/v3';
46
47
 
47
48
  /**
48
49
  * Metadata keys used in plugins for defining various aspects like entities, subscribers, and configurations.
@@ -106,6 +107,10 @@ function assertPluginArtifactNamePart(value, label) {
106
107
  }
107
108
  }
108
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
+
109
114
  const ORGANIZATION_METADATA_KEY = 'xpert:organizationId';
110
115
  const PLUGIN_METADATA_KEY = 'xpert:pluginName';
111
116
  const PLUGIN_VERSION_METADATA_KEY = 'xpert:pluginVersion';
@@ -142,27 +147,13 @@ function resolveTenantGlobalScopeKey(tenantId) {
142
147
  return GLOBAL_ORGANIZATION_SCOPE;
143
148
  }
144
149
 
145
- function createPluginLogger(scope, baseMeta = {}) {
146
- const nestLogger = new Logger(scope);
147
- const wrap = (level, msg, meta)=>{
148
- var // Maintain alignment with the Nest Logger interface
149
- _nestLogger_level;
150
- const payload = meta ? _extends({}, baseMeta, meta) : baseMeta;
151
- (_nestLogger_level = nestLogger[level]) == null ? void 0 : _nestLogger_level.call(nestLogger, msg + (Object.keys(payload).length ? ` ${JSON.stringify(payload)}` : ''));
152
- };
153
- return {
154
- child (meta) {
155
- return createPluginLogger(scope, _extends({}, baseMeta, meta));
156
- },
157
- debug: (msg, meta)=>wrap('debug', msg, meta),
158
- log: (msg, meta)=>wrap('log', msg, meta),
159
- warn: (msg, meta)=>wrap('warn', msg, meta),
160
- error: (msg, meta)=>wrap('error', msg, meta)
161
- };
162
- }
163
-
164
- const INTEGRATION_STRATEGY = 'INTEGRATION_STRATEGY';
165
- 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
+ };
166
157
 
167
158
  function __decorate(decorators, target, key, desc) {
168
159
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -332,22 +323,15 @@ class RequestContext {
332
323
  }
333
324
  return scope.organizationId;
334
325
  }
335
- static hasPermissions(findPermissions, throwError) {
336
- const requestContext = RequestContext.currentRequestContext();
337
- if (requestContext) {
338
- // tslint:disable-next-line
339
- const token = ExtractJwt.fromAuthHeaderAsBearerToken()(requestContext.request);
340
- if (token) {
341
- const { permissions } = verify(token, process.env['JWT_SECRET']);
342
- if (permissions) {
343
- const found = permissions.filter((value)=>findPermissions.indexOf(value) >= 0);
344
- if (found.length === findPermissions.length) {
345
- return true;
346
- }
347
- } else {
348
- return false;
349
- }
350
- }
326
+ /**
327
+ * Check the authenticated principal's enabled role permissions, matching the
328
+ * server RequestContext. Authentication guards resolve JWTs, API keys and
329
+ * ChatKit client secrets before this check; the bearer is not always a JWT.
330
+ */ static hasPermissions(findPermissions, throwError) {
331
+ const permissions = this.currentPermissions();
332
+ if (permissions.length > 0) {
333
+ const found = permissions.filter((value)=>findPermissions.indexOf(value) >= 0);
334
+ if (found.length === findPermissions.length) return true;
351
335
  }
352
336
  if (throwError) {
353
337
  throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
@@ -355,17 +339,9 @@ class RequestContext {
355
339
  return false;
356
340
  }
357
341
  static hasAnyPermission(findPermissions, throwError) {
358
- const requestContext = RequestContext.currentRequestContext();
359
- if (requestContext) {
360
- // tslint:disable-next-line
361
- const token = ExtractJwt.fromAuthHeaderAsBearerToken()(requestContext.request);
362
- if (token) {
363
- const { permissions } = verify(token, process.env['JWT_SECRET']);
364
- const found = permissions.filter((value)=>findPermissions.indexOf(value) >= 0);
365
- if (found.length > 0) {
366
- return true;
367
- }
368
- }
342
+ const permissions = this.currentPermissions();
343
+ if (permissions.some((value)=>findPermissions.includes(value))) {
344
+ return true;
369
345
  }
370
346
  if (throwError) {
371
347
  throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
@@ -403,20 +379,6 @@ class RequestContext {
403
379
  const context = RequestContext.currentRequestContext();
404
380
  if (context) {
405
381
  var _this_currentUser_role, _this_currentUser;
406
- // tslint:disable-next-line
407
- const token = this.currentToken();
408
- if (token) {
409
- try {
410
- const { role } = verify(token, process.env['JWT_SECRET']);
411
- if (role) {
412
- return roles.includes(role);
413
- }
414
- } catch (error) {
415
- if (!(error instanceof JsonWebTokenError)) {
416
- throw error;
417
- }
418
- }
419
- }
420
382
  const role = (_this_currentUser = this.currentUser()) == null ? void 0 : (_this_currentUser_role = _this_currentUser.role) == null ? void 0 : _this_currentUser_role.name;
421
383
  if (role) {
422
384
  return roles.includes(role);
@@ -427,6 +389,11 @@ class RequestContext {
427
389
  }
428
390
  return false;
429
391
  }
392
+ static currentPermissions() {
393
+ var _this_currentUser_role, _this_currentUser;
394
+ var _this_currentUser_role_rolePermissions;
395
+ return ((_this_currentUser_role_rolePermissions = (_this_currentUser = this.currentUser()) == null ? void 0 : (_this_currentUser_role = _this_currentUser.role) == null ? void 0 : _this_currentUser_role.rolePermissions) != null ? _this_currentUser_role_rolePermissions : []).filter((rolePermission)=>rolePermission == null ? void 0 : rolePermission.enabled).map((rolePermission)=>rolePermission == null ? void 0 : rolePermission.permission).filter((permission)=>!!permission);
396
+ }
430
397
  constructor(request, response, reqId, userId, extras = {}){
431
398
  this.request = request;
432
399
  this.response = response;
@@ -497,15 +464,6 @@ function runWithRequestContext(req, res, next) {
497
464
  }
498
465
 
499
466
  let StrategyBus = class StrategyBus {
500
- registerRemovalGuard(guard) {
501
- this.removalGuards.add(guard);
502
- return ()=>{
503
- this.removalGuards.delete(guard);
504
- };
505
- }
506
- async assertCanRemove(scopeKey, pluginNames) {
507
- for (const guard of this.removalGuards)await guard(scopeKey, pluginNames);
508
- }
509
467
  upsert(strategyType, entry) {
510
468
  this.subject.next({
511
469
  type: 'UPSERT',
@@ -523,7 +481,6 @@ let StrategyBus = class StrategyBus {
523
481
  } : {}));
524
482
  }
525
483
  constructor(){
526
- this.removalGuards = new Set();
527
484
  this.subject = new Subject();
528
485
  this.events$ = this.subject.asObservable();
529
486
  }
@@ -781,6 +738,102 @@ __decorate([
781
738
  return typeof constructor === 'function' ? constructor : null;
782
739
  }
783
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
+
784
837
  let IntegrationStrategyRegistry = class IntegrationStrategyRegistry extends BaseStrategyRegistry {
785
838
  constructor(discoveryService, reflector){
786
839
  super(INTEGRATION_STRATEGY, discoveryService, reflector);
@@ -2633,6 +2686,9 @@ function normalizeCurrency(currency) {
2633
2686
 
2634
2687
  var AIModel_1;
2635
2688
  let AIModel = AIModel_1 = class AIModel {
2689
+ getRealtimeModel(_copilotModel) {
2690
+ throw new Error('Unsupported realtime model');
2691
+ }
2636
2692
  getChatModel(copilotModel, options) {
2637
2693
  throw new Error(`Unsupport chat model!`);
2638
2694
  }
@@ -2876,6 +2932,75 @@ function _class_private_field_loose_key(name) {
2876
2932
  return "__private_" + id++ + "_" + name;
2877
2933
  }
2878
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
+
2879
3004
  var _a;
2880
3005
  class LLMUsage {
2881
3006
  static emptyUsage() {
@@ -2921,6 +3046,18 @@ class LargeLanguageModel extends AIModel {
2921
3046
  _commonParameterRules(model) {
2922
3047
  return CommonParameterRules;
2923
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
+ }
2924
3061
  calcResponseUsage(model, credentials, promptTokens, completionTokens, startedAt = this.startedAt, tokenUsage, pricingContext = {}) {
2925
3062
  var _this_getModelSchema;
2926
3063
  const resolvedTokenUsage = tokenUsage != null ? tokenUsage : {
@@ -3068,12 +3205,15 @@ class LargeLanguageModel extends AIModel {
3068
3205
  callback
3069
3206
  ];
3070
3207
  }
3071
- createHandleLLMErrorCallbacks(fields, logger) {
3208
+ createHandleLLMErrorCallbacks(_fields, logger) {
3072
3209
  return {
3073
- handleLLMError: (err)=>{
3074
- var _err_cause;
3075
- var _err_cause_stack;
3076
- (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
+ });
3077
3217
  }
3078
3218
  };
3079
3219
  }
@@ -3283,97 +3423,59 @@ function isAbortError(error) {
3283
3423
  return error.name === 'AbortError' || /\babort(?:ed)?\b/i.test(error.message);
3284
3424
  }
3285
3425
  function calcTokenUsage(output) {
3286
- var _output_generations;
3287
- const tokenUsage = {
3426
+ const result = {
3288
3427
  promptTokens: 0,
3289
3428
  completionTokens: 0,
3290
3429
  totalTokens: 0
3291
3430
  };
3292
- let cacheReadInputTokens = 0;
3293
- let cacheWriteInputTokens = 0;
3294
- (_output_generations = output.generations) == null ? void 0 : _output_generations.forEach((generation)=>{
3295
- generation.forEach((item)=>{
3296
- const message = item.message;
3297
- if (message.usage_metadata) {
3298
- var _message_usage_metadata_input_token_details, _message_usage_metadata_input_token_details1;
3299
- tokenUsage.promptTokens += message.usage_metadata.input_tokens;
3300
- tokenUsage.completionTokens += message.usage_metadata.output_tokens;
3301
- tokenUsage.totalTokens += message.usage_metadata.total_tokens;
3302
- var _message_usage_metadata_input_token_details_cache_read;
3303
- 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;
3304
- var _message_usage_metadata_input_token_details_cache_creation;
3305
- 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;
3306
- }
3307
- });
3308
- });
3309
- if (cacheReadInputTokens > 0) tokenUsage.cacheReadInputTokens = cacheReadInputTokens;
3310
- if (cacheWriteInputTokens > 0) tokenUsage.cacheWriteInputTokens = cacheWriteInputTokens;
3311
- 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;
3312
3461
  }
3313
3462
  function resolveTokenUsage(output) {
3314
3463
  return resolveTokenUsageWithAuthority(output).usage;
3315
3464
  }
3316
3465
  function resolveTokenUsageWithAuthority(output) {
3317
3466
  var _output_llmOutput, _output_llmOutput1, _output_llmOutput2;
3318
- var _normalizeTokenUsage, _ref;
3319
- const actualUsage = (_ref = (_normalizeTokenUsage = normalizeTokenUsage(calcTokenUsage(output))) != null ? _normalizeTokenUsage : normalizeTokenUsage((_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput['tokenUsage'])) != null ? _ref : normalizeTokenUsage({
3320
- 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']
3321
3472
  });
3322
- if (actualUsage) {
3323
- return {
3324
- usage: actualUsage
3325
- };
3326
- }
3327
- const estimatedUsage = normalizeTokenUsage((_output_llmOutput2 = output.llmOutput) == null ? void 0 : _output_llmOutput2['estimatedTokenUsage']);
3328
- if (estimatedUsage) {
3329
- return {
3330
- usage: estimatedUsage,
3331
- type: 'estimated'
3332
- };
3333
- }
3334
- return {
3335
- usage: {
3336
- promptTokens: 0,
3337
- completionTokens: 0,
3338
- totalTokens: 0
3339
- }
3340
- };
3341
- }
3342
- function normalizeTokenUsage(candidate) {
3343
- if (!candidate) {
3344
- return null;
3345
- }
3346
- if (!isValidTokenCount(candidate.promptTokens) || !isValidTokenCount(candidate.completionTokens) || !isValidTokenCount(candidate.totalTokens)) {
3347
- return null;
3348
- }
3349
- var _candidate_promptTokens;
3350
- const promptTokens = (_candidate_promptTokens = candidate.promptTokens) != null ? _candidate_promptTokens : 0;
3351
- var _candidate_completionTokens;
3352
- const completionTokens = (_candidate_completionTokens = candidate.completionTokens) != null ? _candidate_completionTokens : 0;
3353
- const totalTokens = candidate.totalTokens || promptTokens + completionTokens;
3354
- if (promptTokens === 0 && completionTokens === 0 && totalTokens === 0) {
3355
- return null;
3356
- }
3357
- var _candidate_cacheReadInputTokens;
3358
- const cacheReadInputTokens = (_candidate_cacheReadInputTokens = candidate.cacheReadInputTokens) != null ? _candidate_cacheReadInputTokens : 0;
3359
- var _candidate_cacheWriteInputTokens;
3360
- const cacheWriteInputTokens = (_candidate_cacheWriteInputTokens = candidate.cacheWriteInputTokens) != null ? _candidate_cacheWriteInputTokens : 0;
3361
- if (!isValidTokenCount(cacheReadInputTokens) || !isValidTokenCount(cacheWriteInputTokens)) {
3362
- return null;
3363
- }
3364
3473
  return _extends({
3365
- promptTokens,
3366
- completionTokens,
3367
- totalTokens
3368
- }, cacheReadInputTokens > 0 ? {
3369
- cacheReadInputTokens
3370
- } : {}, cacheWriteInputTokens > 0 ? {
3371
- cacheWriteInputTokens
3474
+ usage: resolved.usage
3475
+ }, resolved.source === 'estimated' ? {
3476
+ type: 'estimated'
3372
3477
  } : {});
3373
3478
  }
3374
- function isValidTokenCount(value) {
3375
- return value === undefined || Number.isFinite(value) && value >= 0;
3376
- }
3377
3479
  function normalizeCacheTokenAccounting(tokenUsage, context) {
3378
3480
  if (context.inputTokensIncludeCache !== false) return tokenUsage;
3379
3481
  var _tokenUsage_cacheReadInputTokens, _tokenUsage_cacheWriteInputTokens;
@@ -3824,6 +3926,37 @@ Reflect.defineMetadata(COMMAND_METADATA$1, {
3824
3926
  id: CreateModelClientCommand.type
3825
3927
  }, CreateModelClientCommand);
3826
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
+
3827
3960
  const SKILL_SOURCE_PROVIDER = 'SKILL_SOURCE_PROVIDER';
3828
3961
  const SkillSourceProviderStrategy = (provider)=>applyDecorators(SetMetadata(SKILL_SOURCE_PROVIDER, provider), SetMetadata(STRATEGY_META_KEY, SKILL_SOURCE_PROVIDER));
3829
3962
 
@@ -3864,7 +3997,7 @@ AgentMiddlewareRegistry = __decorate([
3864
3997
  'end'
3865
3998
  ];
3866
3999
 
3867
- const AssistantTaskRuntimeCapability = createRuntimeCapability('platform.assistant_task', {
4000
+ /** Scoped runtime capability for platform Assistant tasks. */ const AssistantTaskRuntimeCapability = createRuntimeCapability('platform.assistant_task', {
3868
4001
  description: 'Start asynchronous tasks on the current platform assistant.'
3869
4002
  });
3870
4003
 
@@ -3898,6 +4031,18 @@ function isModelOutputValidationError(error) {
3898
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);
3899
4032
  }
3900
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
+
3901
4046
  const SEGMENT_PATTERN = /^[a-z][a-z0-9_-]*$/i;
3902
4047
  const VERSION_PATTERN = /^v[1-9][0-9]*$/;
3903
4048
  function assertSegment(input, name) {
@@ -3943,6 +4088,96 @@ function assertSegment(input, name) {
3943
4088
  const AGENT_CHAT_DISPATCH_MESSAGE_TYPE = defineAgentMessageType('chat_dispatch', 1);
3944
4089
  const AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING = 'steer_target_not_running';
3945
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
+
3946
4181
  /**
3947
4182
  * Handoff Processor meta key。
3948
4183
  */ const HANDOFF_PROCESSOR_STRATEGY = 'HANDOFF_PROCESSOR_STRATEGY';
@@ -3987,6 +4222,76 @@ HandoffProcessorRegistry = __decorate([
3987
4222
  runTtlMs: 10 * 60 * 1000
3988
4223
  };
3989
4224
 
4225
+ /** Checks confirmed completion; unknown remains non-terminal. */ function isAgentInvocationTerminal(status) {
4226
+ return status === 'succeeded' || status === 'failed' || status === 'cancelled';
4227
+ }
4228
+
4229
+ /** Nest discovery metadata key for runtime strategies. */ const AGENT_RUNTIME_STRATEGY = 'AGENT_RUNTIME_STRATEGY';
4230
+ /** Associate a stable provider key with an adapter. Also declare @Injectable() and register the provider. */ const AgentRuntimeStrategy = (provider)=>applyDecorators(SetMetadata(AGENT_RUNTIME_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, AGENT_RUNTIME_STRATEGY));
4231
+ /** Scoped strategy registry with pinned provider/version lookup for continuation. */ let AgentRuntimeRegistry = class AgentRuntimeRegistry extends BaseStrategyRegistry {
4232
+ /** Find the exact original scope/plugin/version, without fallback. Returns undefined if unavailable. */ getPinned(provider, source) {
4233
+ var _this_strategies_get;
4234
+ const strategy = (_this_strategies_get = this.strategies.get(source.scopeKey)) == null ? void 0 : _this_strategies_get.get(provider);
4235
+ if (!strategy) return undefined;
4236
+ const actual = this.getSource(strategy);
4237
+ return actual.kind === source.kind && actual.scopeKey === source.scopeKey && (actual.kind !== 'plugin' || source.kind !== 'plugin' || actual.pluginName === source.pluginName && actual.pluginVersion === source.pluginVersion) ? strategy : undefined;
4238
+ }
4239
+ constructor(discoveryService, reflector){
4240
+ super(AGENT_RUNTIME_STRATEGY, discoveryService, reflector);
4241
+ }
4242
+ };
4243
+ AgentRuntimeRegistry = __decorate([
4244
+ Injectable(),
4245
+ __metadata("design:paramtypes", [
4246
+ DiscoveryService,
4247
+ Reflector
4248
+ ])
4249
+ ], AgentRuntimeRegistry);
4250
+
4251
+ /** Caller-scoped API obtained through runtime.capabilities.require(...). */ const AgentInvocationRuntimeCapability = createRuntimeCapability('platform.agent_invocation', {
4252
+ description: 'Scoped, versioned Agent invocation and lifecycle control'
4253
+ });
4254
+ /** Platform factory capability. The wire key is stable across SDK naming changes. */ const AgentRuntimeFactoryCapability = createRuntimeCapability('platform.agent_invocation.factory');
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
+
4280
+ const ASSISTANT_CAPABILITY_PROVIDER = 'ASSISTANT_CAPABILITY_PROVIDER';
4281
+ const AssistantCapabilityProvider = (key)=>applyDecorators(SetMetadata(ASSISTANT_CAPABILITY_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, ASSISTANT_CAPABILITY_PROVIDER));
4282
+ let AssistantCapabilityProviderRegistry = class AssistantCapabilityProviderRegistry extends BaseStrategyRegistry {
4283
+ constructor(discovery, reflector){
4284
+ super(ASSISTANT_CAPABILITY_PROVIDER, discovery, reflector);
4285
+ }
4286
+ };
4287
+ AssistantCapabilityProviderRegistry = __decorate([
4288
+ Injectable(),
4289
+ __metadata("design:paramtypes", [
4290
+ DiscoveryService,
4291
+ Reflector
4292
+ ])
4293
+ ], AssistantCapabilityProviderRegistry);
4294
+
3990
4295
  /**
3991
4296
  * Common platform message length limits
3992
4297
  */ const CHAT_CHANNEL_TEXT_LIMITS = {
@@ -4281,10 +4586,14 @@ function appendSandboxMessage(output, message) {
4281
4586
  function resolveSandboxExecutionOptions(options, defaults = DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS) {
4282
4587
  const timeoutMs = typeof (options == null ? void 0 : options.timeoutMs) === 'number' && Number.isFinite(options.timeoutMs) && options.timeoutMs > 0 ? Math.trunc(options.timeoutMs) : typeof defaults.timeoutMs === 'number' && Number.isFinite(defaults.timeoutMs) && defaults.timeoutMs > 0 ? Math.trunc(defaults.timeoutMs) : DEFAULT_SANDBOX_SHELL_TIMEOUT_MS;
4283
4588
  const maxOutputBytes = typeof (options == null ? void 0 : options.maxOutputBytes) === 'number' && Number.isFinite(options.maxOutputBytes) && options.maxOutputBytes > 0 ? Math.trunc(options.maxOutputBytes) : typeof defaults.maxOutputBytes === 'number' && Number.isFinite(defaults.maxOutputBytes) && defaults.maxOutputBytes > 0 ? Math.trunc(defaults.maxOutputBytes) : DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES;
4284
- return {
4589
+ return _extends({
4285
4590
  timeoutMs,
4286
4591
  maxOutputBytes
4287
- };
4592
+ }, (options == null ? void 0 : options.executionScope) ? {
4593
+ executionScope: options.executionScope
4594
+ } : {}, (options == null ? void 0 : options.signal) ? {
4595
+ signal: options.signal
4596
+ } : {});
4288
4597
  }
4289
4598
 
4290
4599
  function isObjectLike$2(value) {
@@ -5423,6 +5732,7 @@ ViewExtensionProviderRegistry = __decorate([
5423
5732
 
5424
5733
  const XPERT_REMOTE_UI_CSS = `
5425
5734
  :root {
5735
+ font-size: var(--xui-density-root-font-size, 16px);
5426
5736
  color-scheme: light;
5427
5737
  --xui-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
5428
5738
  --xui-color-background: #fff;
@@ -5457,6 +5767,7 @@ const XPERT_REMOTE_UI_CSS = `
5457
5767
  --xui-radius-sm: 6px;
5458
5768
  --xui-radius-md: 8px;
5459
5769
  --xui-radius-lg: 10px;
5770
+ --xui-font-size: 14px;
5460
5771
  --xui-font-size-xs: 0.75rem;
5461
5772
  --xui-font-size-sm: 0.8125rem;
5462
5773
  --xui-font-size-md: 0.875rem;
@@ -5744,6 +6055,7 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
5744
6055
  var VERSION = 1
5745
6056
  var TOKEN_MAP = {
5746
6057
  fontFamily: '--xui-font-family',
6058
+ densityRootFontSize: '--xui-density-root-font-size',
5747
6059
  colorBackground: '--xui-color-background',
5748
6060
  colorForeground: '--xui-color-foreground',
5749
6061
  colorCard: '--xui-color-card',
@@ -5776,6 +6088,7 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
5776
6088
  radiusSm: '--xui-radius-sm',
5777
6089
  radiusMd: '--xui-radius-md',
5778
6090
  radiusLg: '--xui-radius-lg',
6091
+ fontSize: '--xui-font-size',
5779
6092
  fontSizeXs: '--xui-font-size-xs',
5780
6093
  fontSizeSm: '--xui-font-size-sm',
5781
6094
  fontSizeMd: '--xui-font-size-md',
@@ -5937,6 +6250,9 @@ EvolutionTargetProviderRegistry = __decorate([
5937
6250
  ], EvolutionTargetProviderRegistry);
5938
6251
 
5939
6252
  const EVOLUTION_RUNTIME_SERVICE_TOKEN = 'XPERT_EVOLUTION_RUNTIME_SERVICE';
6253
+ const EvolutionBaselineRuntimeCapability = createRuntimeCapability('platform.agent-evolution.baselines', {
6254
+ description: 'Inspect and initialize organization rule baselines with administrator authorization and revision checks.'
6255
+ });
5940
6256
  const EvolutionRuntimeCapability = createRuntimeCapability('platform.agent-evolution', {
5941
6257
  description: 'Ingest learning signals and resolve immutable capability versions for domain runtimes.'
5942
6258
  });
@@ -6177,6 +6493,11 @@ function describeXpertToolProvider(instance) {
6177
6493
  if (middlewareProvider && !middlewareProviders.has(middlewareProvider)) {
6178
6494
  throw new Error(`Tool '${toolOptions.name}' references undeclared Middleware provider '${middlewareProvider}'.`);
6179
6495
  }
6496
+ if (toolOptions.app) {
6497
+ if (!middlewareProvider || !toolOptions.app.visibility.length || toolOptions.app.visibility.some((item)=>item !== 'model' && item !== 'app') || toolOptions.app.resourceKey && (!appKeys.has(toolOptions.app.resourceKey) || !toolOptions.app.visibility.includes('app'))) {
6498
+ throw new Error(`Tool '${toolOptions.name}' has an invalid middleware App binding.`);
6499
+ }
6500
+ }
6180
6501
  const appKey = toolOptions.mcp && ((_toolOptions_mcp_app = toolOptions.mcp.app) == null ? void 0 : _toolOptions_mcp_app.resourceKey);
6181
6502
  if (appKey && !appKeys.has(appKey)) {
6182
6503
  throw new Error(`MCP Tool '${toolOptions.name}' references undeclared App '${appKey}'.`);
@@ -6574,12 +6895,21 @@ class DecoratedAgentMiddlewareStrategy {
6574
6895
  return this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>item.options.name);
6575
6896
  }
6576
6897
  async createMiddleware(options, context) {
6898
+ var _this_descriptor_options_apps;
6577
6899
  const tools = this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>createAgentTool(this.instance, item, context, options));
6578
6900
  const extensions = await (this.instance.getMiddlewareExtensions == null ? void 0 : this.instance.getMiddlewareExtensions.call(this.instance, this.provider, options, context));
6579
6901
  return _extends({}, extensions != null ? extensions : {}, {
6580
6902
  name: this.provider,
6581
6903
  tools
6582
- });
6904
+ }, ((_this_descriptor_options_apps = this.descriptor.options.apps) == null ? void 0 : _this_descriptor_options_apps.length) ? {
6905
+ apps: {
6906
+ definitions: this.descriptor.options.apps,
6907
+ tools: Object.fromEntries(this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider && item.options.app).map((item)=>[
6908
+ item.options.name,
6909
+ item.options.app
6910
+ ]))
6911
+ }
6912
+ } : {});
6583
6913
  }
6584
6914
  constructor(instance, descriptor, provider){
6585
6915
  var _descriptor_options_middlewares;
@@ -9739,4 +10069,37 @@ function stableJson(value) {
9739
10069
  return `{${entries.map(([key, item])=>`${JSON.stringify(key)}:${stableJson(item)}`).join(',')}}`;
9740
10070
  }
9741
10071
 
9742
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, 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, 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, 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, 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, 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 };
10072
+ const PROJECT_TYPE_PROVIDER = 'PROJECT_TYPE_PROVIDER';
10073
+ /** Register the stable provider key used by entity-backed App project type declarations. */ const ProjectTypeProvider = (key)=>applyDecorators(SetMetadata(PROJECT_TYPE_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, PROJECT_TYPE_PROVIDER));
10074
+ let ProjectTypeProviderRegistry = class ProjectTypeProviderRegistry extends BaseStrategyRegistry {
10075
+ constructor(discovery, reflector){
10076
+ super(PROJECT_TYPE_PROVIDER, discovery, reflector);
10077
+ }
10078
+ };
10079
+ ProjectTypeProviderRegistry = __decorate([
10080
+ Injectable(),
10081
+ __metadata("design:paramtypes", [
10082
+ DiscoveryService,
10083
+ Reflector
10084
+ ])
10085
+ ], ProjectTypeProviderRegistry);
10086
+
10087
+ const PROJECT_TASK_PROVIDER = 'PROJECT_TASK_PROVIDER';
10088
+ const ProjectTaskProvider = (key)=>applyDecorators(SetMetadata(PROJECT_TASK_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, PROJECT_TASK_PROVIDER));
10089
+ let ProjectTaskProviderRegistry = class ProjectTaskProviderRegistry extends BaseStrategyRegistry {
10090
+ constructor(discovery, reflector){
10091
+ super(PROJECT_TASK_PROVIDER, discovery, reflector);
10092
+ }
10093
+ };
10094
+ ProjectTaskProviderRegistry = __decorate([
10095
+ Injectable(),
10096
+ __metadata("design:paramtypes", [
10097
+ DiscoveryService,
10098
+ Reflector
10099
+ ])
10100
+ ], ProjectTaskProviderRegistry);
10101
+ const ProjectTasksRuntimeCapability = createRuntimeCapability('platform.project.tasks', {
10102
+ description: 'Read project task graphs, manage schedules, and resolve exact execution conversations.'
10103
+ });
10104
+
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 };