@xpert-ai/plugin-sdk 3.18.3 → 3.18.5

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 (32) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +26 -1
  3. package/index.cjs.js +249 -27
  4. package/index.esm.js +244 -30
  5. package/model-provider.cjs.js +8 -0
  6. package/model-provider.esm.js +7 -1
  7. package/package.json +2 -2
  8. package/runtime-capabilities.md +49 -0
  9. package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +3 -0
  10. package/src/lib/agent/middleware/runtime.d.ts +2 -14
  11. package/src/lib/ai-model/types/rerank.d.ts +2 -0
  12. package/src/lib/ai-model/utils/tokenizer.d.ts +6 -0
  13. package/src/lib/connector/runtime-capability.d.ts +19 -0
  14. package/src/lib/evolution/runtime-capability.d.ts +2 -1
  15. package/src/lib/mcp/resource-template.d.ts +2 -3
  16. package/src/lib/mcp/resource.d.ts +5 -1
  17. package/src/lib/rag/textsplitter/strategy.interface.d.ts +15 -4
  18. package/src/lib/rag/transformer/strategy.interface.d.ts +3 -0
  19. package/src/lib/runtime/capabilities/actor-token.d.ts +12 -0
  20. package/src/lib/runtime/capabilities/artifacts.d.ts +2 -0
  21. package/src/lib/runtime/capabilities/knowledge-document-visual-assets.d.ts +16 -5
  22. package/src/lib/runtime/capabilities/knowledgebase-documents.d.ts +50 -1
  23. package/src/lib/runtime/capabilities/knowledgebase.d.ts +1 -0
  24. package/src/lib/runtime/capabilities/workspace-files.d.ts +2 -0
  25. package/src/lib/runtime/index.d.ts +1 -0
  26. package/src/lib/runtime/runtime-scope.d.ts +14 -0
  27. package/src/lib/tool-provider/index.d.ts +2 -0
  28. package/src/lib/tool-provider/prepared-result.d.ts +18 -0
  29. package/src/lib/tool-provider/tool-result.d.ts +16 -0
  30. package/src/lib/tool-provider/types.d.ts +8 -2
  31. package/src/lib/toolset/define-tool.d.ts +2 -1
  32. package/src/lib/types.d.ts +12 -1
@@ -1,2 +1,21 @@
1
+ import type { RuntimeIdentityScope } from '../runtime/runtime-scope';
1
2
  import type { ConnectorRuntimeApi } from './strategy.interface';
2
3
  export declare const ConnectorRuntimeCapability: import("../core").RuntimeCapabilityKey<ConnectorRuntimeApi>;
4
+ /** No binding or provider grants means no connector access. */
5
+ export type ConnectorRuntimeScope = RuntimeIdentityScope & {
6
+ /** Host-selected bindings, including IDs pinned by enabled graph Connector nodes. */
7
+ connectorBindingIds?: string[] | null;
8
+ /** Providers configured by enabled graph Connector nodes without a pinned ID. */
9
+ connectorProviders?: string[] | null;
10
+ };
11
+ export type SelectedRuntimeConnectorBinding = {
12
+ bindingId: string;
13
+ provider: string;
14
+ };
15
+ export interface ConnectorRuntimeFactory {
16
+ /** Snapshot the authorized identity and connector grants for this runtime. */
17
+ createScopedApi(scope: ConnectorRuntimeScope): ConnectorRuntimeApi;
18
+ /** Preflight selected bindings through the same identity, project and credential checks. */
19
+ resolveSelectedRuntimeBindings(bindingIds: string[] | null | undefined, scope: ConnectorRuntimeScope): Promise<SelectedRuntimeConnectorBinding[]>;
20
+ }
21
+ export declare const ConnectorRuntimeFactoryCapability: import("../core").RuntimeCapabilityKey<ConnectorRuntimeFactory>;
@@ -1,3 +1,4 @@
1
- import type { EvolutionRuntimeApi } from '@xpert-ai/contracts';
1
+ import type { EvolutionRuntimeApi, EvolutionChangeRuntimeApi } from '@xpert-ai/contracts';
2
2
  export declare const EVOLUTION_RUNTIME_SERVICE_TOKEN = "XPERT_EVOLUTION_RUNTIME_SERVICE";
3
3
  export declare const EvolutionRuntimeCapability: import("../core").RuntimeCapabilityKey<EvolutionRuntimeApi>;
4
+ export declare const EvolutionChangeRuntimeCapability: import("../core").RuntimeCapabilityKey<EvolutionChangeRuntimeApi>;
@@ -1,7 +1,6 @@
1
1
  import type { McpRequiredContext } from '@xpert-ai/contracts';
2
- import type { ToolExecutionContext } from '../toolset/tool-execution-context';
3
2
  import type { McpCompletionHandler } from './completion';
4
- import type { McpResourceReadResult } from './resource';
3
+ import type { McpResourceReadResult, ResourceReadContext } from './resource';
5
4
  export interface McpResourceTemplateArgument {
6
5
  required: boolean;
7
6
  description?: string;
@@ -15,7 +14,7 @@ export interface McpResourceTemplateDefinition {
15
14
  arguments: Record<string, McpResourceTemplateArgument>;
16
15
  requiredContext?: McpRequiredContext[];
17
16
  cacheTtlMs?: number;
18
- read(arguments_: Record<string, string>, context: ToolExecutionContext): McpResourceReadResult | Promise<McpResourceReadResult>;
17
+ read(arguments_: Record<string, string>, context: ResourceReadContext): McpResourceReadResult | Promise<McpResourceReadResult>;
19
18
  complete?: McpCompletionHandler;
20
19
  }
21
20
  export declare function defineMcpResourceTemplate(definition: McpResourceTemplateDefinition): Readonly<McpResourceTemplateDefinition>;
@@ -1,5 +1,9 @@
1
1
  import type { JSONValue, McpRequiredContext } from '@xpert-ai/contracts';
2
2
  import type { ToolExecutionContext } from '../toolset/tool-execution-context';
3
+ export interface ResourceReadContext extends ToolExecutionContext {
4
+ /** Exact URI requested by resources/read, including query parameters. */
5
+ resourceUri: string;
6
+ }
3
7
  export interface McpResourceContent {
4
8
  uri: string;
5
9
  mimeType?: string;
@@ -18,6 +22,6 @@ export interface McpResourceDefinition {
18
22
  mimeType?: string;
19
23
  requiredContext?: McpRequiredContext[];
20
24
  cacheTtlMs?: number;
21
- read(context: ToolExecutionContext): McpResourceReadResult | Promise<McpResourceReadResult>;
25
+ read(context: ResourceReadContext): McpResourceReadResult | Promise<McpResourceReadResult>;
22
26
  }
23
27
  export declare function defineMcpResource(definition: McpResourceDefinition): Readonly<McpResourceDefinition>;
@@ -1,6 +1,19 @@
1
- import { IDocumentChunkerProvider, KnowledgeStructureEnum } from '@xpert-ai/contracts';
1
+ import { IDocumentChunkerProvider, KnowledgeChunkingDecision, KnowledgeChunkLanguage, KnowledgeChunkLanguageHint, KnowledgeChunkLanguageDecision, KnowledgeStructureEnum } from '@xpert-ai/contracts';
2
2
  import { DocumentInterface } from '@langchain/core/documents';
3
3
  import { ChunkMetadata } from '../types';
4
+ export interface TextSplitterExecutionContext {
5
+ /** Public parser-level token cap. Providers must not persist a second copy in their own options. */
6
+ maxChunkTokens?: number;
7
+ languageHint?: KnowledgeChunkLanguageHint;
8
+ /** Resolved once at the execution boundary, shared by all fragments of a document. */
9
+ resolvedLanguage?: KnowledgeChunkLanguage;
10
+ resolvedLanguages?: ReadonlyMap<DocumentInterface, KnowledgeChunkLanguage>;
11
+ }
12
+ export interface TextSplitterResult {
13
+ chunks: DocumentInterface<ChunkMetadata>[];
14
+ decisions?: KnowledgeChunkingDecision[];
15
+ languages?: KnowledgeChunkLanguageDecision[];
16
+ }
4
17
  /**
5
18
  * Split text content into chunks for embedding and retrieval
6
19
  */
@@ -17,7 +30,5 @@ export interface ITextSplitterStrategy<TConfig = any> {
17
30
  /**
18
31
  * Split a text into chunks and pages (if applicable)
19
32
  */
20
- splitDocuments(documents: DocumentInterface[], options?: TConfig): Promise<{
21
- chunks: DocumentInterface<ChunkMetadata>[];
22
- }>;
33
+ splitDocuments(documents: DocumentInterface[], options?: TConfig, context?: TextSplitterExecutionContext): Promise<TextSplitterResult>;
23
34
  }
@@ -1,9 +1,12 @@
1
1
  import { IDocumentProcessorProvider, IIntegration, IKnowledgeDocument } from '@xpert-ai/contracts';
2
2
  import { Permissions, XpFileSystem } from '../../core/index';
3
+ import type { WorkspaceFileScope } from '../../runtime/capabilities/workspace-files';
3
4
  import { ChunkMetadata } from '../types';
4
5
  export type TDocumentTransformerConfig = {
5
6
  stage: 'test' | 'prod';
6
7
  tempDir?: string;
8
+ /** Trusted host scope for background transforms using Workspace Files and Sandbox Jobs. */
9
+ fileScope?: WorkspaceFileScope;
7
10
  permissions?: {
8
11
  fileSystem?: XpFileSystem;
9
12
  integration?: IIntegration;
@@ -1,7 +1,9 @@
1
+ import type { RuntimeIdentityScope } from '../runtime-scope';
1
2
  export type ActorTokenAct = Record<string, string | number | boolean | null | undefined>;
2
3
  export interface ActorTokenRequest {
3
4
  audience?: string | string[];
4
5
  ttlSeconds?: number;
6
+ /** Extra delegation metadata; cannot replace claims fixed by the host when creating the API. */
5
7
  act?: ActorTokenAct;
6
8
  }
7
9
  export interface ActorTokenResult {
@@ -13,3 +15,13 @@ export interface ActorTokenApi {
13
15
  getToken(input?: ActorTokenRequest): Promise<ActorTokenResult>;
14
16
  }
15
17
  export declare const ActorTokenRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ActorTokenApi>;
18
+ /** Host-defined delegation claims are fixed when the API is created. */
19
+ export type ActorTokenRuntimeScope = RuntimeIdentityScope & {
20
+ act?: ActorTokenAct;
21
+ };
22
+ export interface ActorTokenRuntimeFactory {
23
+ /** Create one independent token cache for a host-authorized caller/execution. */
24
+ createScopedApi(scope: ActorTokenRuntimeScope): ActorTokenApi;
25
+ }
26
+ /** Platform registry entry. The operation capability above is bound only inside a caller runtime. */
27
+ export declare const ActorTokenRuntimeFactoryCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ActorTokenRuntimeFactory>;
@@ -54,6 +54,8 @@ export type ArtifactLinkAccessInput = {
54
54
  expiresAt?: string | Date | null;
55
55
  ttlSeconds?: number | null;
56
56
  userConfirmedPublicLink?: boolean | null;
57
+ /** Trusted application authorization; must never be populated from untrusted tool arguments. */
58
+ publicLinkAuthorization?: 'application_policy';
57
59
  };
58
60
  /** Browser response hints and HTML safety profile for an Artifact link. */
59
61
  export type ArtifactLinkPresentationInput = {
@@ -1,4 +1,5 @@
1
- import type { WorkspacePortableFileReference } from './workspace-files';
1
+ import type { RuntimeIdentityScope } from '../runtime-scope';
2
+ import type { WorkspaceFilesApi, WorkspacePortableFileReference } from './workspace-files';
2
3
  export type KnowledgeDocumentVisualCandidateReason = 'same_block' | 'same_chunk' | 'same_page' | 'adjacent_page' | 'visual_summary_match' | 'visual_only_fallback';
3
4
  export type KnowledgeDocumentVisualTextAnchor = {
4
5
  page?: number;
@@ -6,10 +7,9 @@ export type KnowledgeDocumentVisualTextAnchor = {
6
7
  sourceBlockIds?: string[];
7
8
  };
8
9
  export type KnowledgeDocumentVisualBusinessScope = {
9
- namespace: 'bom.requirement-evidence';
10
- caseId: string;
11
- baselineId: string;
12
- runId: string;
10
+ /** Plugin-owned audit namespace; document authorization remains host-owned. */
11
+ namespace: string;
12
+ attributes: Record<string, string>;
13
13
  sourceDocumentId: string;
14
14
  };
15
15
  export type KnowledgeDocumentVisualCandidateRequest = {
@@ -76,3 +76,14 @@ export interface KnowledgeDocumentVisualAssetsApi {
76
76
  discardImageBatch(batchRef: string): Promise<void>;
77
77
  }
78
78
  export declare const KnowledgeDocumentVisualAssetsRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<KnowledgeDocumentVisualAssetsApi>;
79
+ export type KnowledgeDocumentVisualAssetsRuntimeDependencies = {
80
+ /** File writer already bound to the authorized project/workspace. */
81
+ workspaceFiles: WorkspaceFilesApi;
82
+ /** Optional host resolver for child executions whose identity is assigned after graph construction. */
83
+ resolveExecutionScope?: () => RuntimeIdentityScope;
84
+ };
85
+ export interface KnowledgeDocumentVisualAssetsRuntimeFactory {
86
+ /** Every API owns a fresh allow-list; supplied scope must identify an authorized execution. */
87
+ createScopedApi(scope: RuntimeIdentityScope, dependencies: KnowledgeDocumentVisualAssetsRuntimeDependencies): KnowledgeDocumentVisualAssetsApi;
88
+ }
89
+ export declare const KnowledgeDocumentVisualAssetsRuntimeFactoryCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<KnowledgeDocumentVisualAssetsRuntimeFactory>;
@@ -1,4 +1,4 @@
1
- import { type I18nObject, JSONValue } from '@xpert-ai/contracts';
1
+ import { type I18nObject, type DocumentTextParserConfig, type DocumentSheetParserConfig, JSONValue } from '@xpert-ai/contracts';
2
2
  import type { WorkspacePortableFileReference } from './workspace-files';
3
3
  export type KnowledgebaseDocumentFile = {
4
4
  buffer: Buffer;
@@ -199,7 +199,56 @@ export type KnowledgebaseReadImageResult = {
199
199
  reference: WorkspacePortableFileReference;
200
200
  buffer: Buffer;
201
201
  };
202
+ /** Bounded, ordered source text. The host checks document read access on every page. */
203
+ export type KnowledgebaseReadTextInput = {
204
+ knowledgebaseId: string;
205
+ documentId: string;
206
+ offset?: number;
207
+ limit?: number;
208
+ };
209
+ export type KnowledgebaseReadTextResult = {
210
+ knowledgebaseId: string;
211
+ documentId: string;
212
+ version: number;
213
+ sourceHash?: string | null;
214
+ total: number;
215
+ chunks: Array<{
216
+ id: string;
217
+ text: string;
218
+ page?: number;
219
+ version: number;
220
+ }>;
221
+ };
222
+ export type KnowledgebaseProcessingOptionsInput = {
223
+ knowledgebaseId: string;
224
+ fileName: string;
225
+ /** Omit to use the Knowledge base's default for this file type. */
226
+ processor?: string;
227
+ transformerIntegration?: string;
228
+ };
229
+ export type KnowledgebaseProcessingOptionsResult = {
230
+ fileType: string;
231
+ defaultProcessor: string;
232
+ processor: string;
233
+ defaultSource: 'knowledgebase' | 'platform';
234
+ providers: Array<{
235
+ name: string;
236
+ label: I18nObject;
237
+ integrationProvider?: string;
238
+ }>;
239
+ integrations: Array<{
240
+ id: string;
241
+ name: string;
242
+ provider: string;
243
+ }>;
244
+ integrationRequired: boolean;
245
+ selectedIntegrationId?: string;
246
+ /** Server-only resolved settings. Do not expose configuration/credentials to an iframe. */
247
+ parserConfig: DocumentTextParserConfig & Partial<DocumentSheetParserConfig>;
248
+ };
202
249
  export interface KnowledgebaseDocumentsApi {
250
+ getProcessingOptions(input: KnowledgebaseProcessingOptionsInput): Promise<KnowledgebaseProcessingOptionsResult>;
251
+ readText(input: KnowledgebaseReadTextInput): Promise<KnowledgebaseReadTextResult>;
203
252
  listDocuments(input: KnowledgebaseListDocumentsInput): Promise<KnowledgebaseListDocumentsResult>;
204
253
  createFolder(input: KnowledgebaseCreateFolderInput): Promise<KnowledgebaseCreateFolderResult>;
205
254
  moveDocument(input: KnowledgebaseMoveDocumentInput): Promise<KnowledgebaseMoveDocumentResult>;
@@ -15,6 +15,7 @@ export type KnowledgebaseSearchInput = {
15
15
  query: string;
16
16
  k?: number;
17
17
  score?: number;
18
+ rerankThreshold?: number;
18
19
  filter?: KnowledgeFilterNode;
19
20
  retrieval?: KnowledgebaseRetrievalSettings;
20
21
  source: string;
@@ -232,6 +232,8 @@ export type WorkspaceSearchUnderstandingChunksInput = WorkspaceFileScope & {
232
232
  * understanding files in Xpert workspace Volumes.
233
233
  */
234
234
  export interface WorkspaceFilesApi {
235
+ /** Host-bound storage identity for restoring the same scope in durable jobs. */
236
+ readonly scope?: Readonly<WorkspaceFileScope>;
235
237
  /** Upload raw bytes into an explicitly scoped workspace Volume. */
236
238
  uploadBuffer(input: WorkspaceUploadBufferInput): Promise<WorkspaceFile>;
237
239
  /** Register an existing workspace file with the platform understanding pipeline. */
@@ -1,2 +1,3 @@
1
1
  export * from './runtime-capability';
2
+ export * from './runtime-scope';
2
3
  export * from './capabilities';
@@ -0,0 +1,14 @@
1
+ /** Host-authorized identity and execution binding; never accept this from tool arguments or HTTP bodies. */
2
+ export type RuntimeIdentityScope = {
3
+ tenantId?: string | null;
4
+ organizationId?: string | null;
5
+ userId?: string | null;
6
+ workspaceId?: string | null;
7
+ projectId?: string | null;
8
+ xpertId?: string | null;
9
+ xpertName?: string | null;
10
+ conversationId?: string | null;
11
+ threadId?: string | null;
12
+ agentKey?: string | null;
13
+ executionId?: string | null;
14
+ };
@@ -4,3 +4,5 @@ export * from './descriptor';
4
4
  export * from './registry';
5
5
  export * from './adapters';
6
6
  export * from './coordinator';
7
+ export { XPERT_TOOL_RESULT_FORMAT_VERSION } from './tool-result';
8
+ export { prepareToolResult, type XpertPreparedToolResult, type XpertOutputDiagnostic } from './prepared-result';
@@ -0,0 +1,18 @@
1
+ import type { PromiseOrValue } from '../types';
2
+ declare const PREPARED_RESULT: unique symbol;
3
+ export interface XpertOutputDiagnostic {
4
+ code: 'tool_output_invalid';
5
+ issues: {
6
+ path: string;
7
+ code: string;
8
+ }[];
9
+ }
10
+ export interface XpertPreparedToolResult<T = unknown> {
11
+ readonly [PREPARED_RESULT]: true;
12
+ project(): PromiseOrValue<T>;
13
+ recover(diagnostic: XpertOutputDiagnostic): PromiseOrValue<T>;
14
+ }
15
+ /** Defer output projection until the adapter can validate and recover its result. */
16
+ export declare function prepareToolResult<T, TRecovery>(project: () => PromiseOrValue<T>, recover: (diagnostic: XpertOutputDiagnostic) => PromiseOrValue<TRecovery>): XpertPreparedToolResult<T | TRecovery>;
17
+ export declare function resolveToolResult<T>(value: unknown, validate: (output: unknown) => Promise<T>): Promise<T>;
18
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { ZodTypeAny } from 'zod/v3';
2
+ import type { XpertToolContent, XpertToolResult } from '../toolset/tool-result';
3
+ export declare const XPERT_TOOL_RESULT_FORMAT_VERSION = 1;
4
+ /** Validate the envelope separately so binary content never enters the business DTO. */
5
+ export declare function parseDecoratedToolResult(value: unknown, outputSchema: ZodTypeAny): Promise<XpertToolResult>;
6
+ export declare function agentContent(content: XpertToolContent[] | undefined): ({
7
+ type: string;
8
+ image_url: {
9
+ url: string;
10
+ };
11
+ text?: undefined;
12
+ } | {
13
+ type: string;
14
+ text: string;
15
+ image_url?: undefined;
16
+ })[];
@@ -1,4 +1,4 @@
1
- import type { IconDefinition, I18nObject, JsonSchemaObjectType, McpRequiredContext, McpToolBehavior, TAgentMiddlewareMeta } from '@xpert-ai/contracts';
1
+ import type { IconDefinition, I18nObject, JsonSchemaObjectType, McpRequiredContext, McpCapabilityApprovalMode, McpToolBehavior, TAgentMiddlewareMeta } from '@xpert-ai/contracts';
2
2
  import type { RunnableConfig } from '@langchain/core/runnables';
3
3
  import type { ZodTypeAny, infer as ZodInfer } from 'zod/v3';
4
4
  import type { AgentMiddleware } from '../agent/middleware/types';
@@ -6,6 +6,8 @@ import type { IAgentMiddlewareContext } from '../agent/middleware/strategy.inter
6
6
  import type { McpAppDefinition } from '../mcp/app';
7
7
  import type { ToolExecutionContext, ToolHostApi, ToolPrincipal } from '../toolset/tool-execution-context';
8
8
  import type { XpertToolAppBinding, XpertToolVisibility } from '../toolset/define-tool';
9
+ import type { XpertToolResult } from '../toolset/tool-result';
10
+ import type { XpertPreparedToolResult } from './prepared-result';
9
11
  import type { PromiseOrValue } from '../types';
10
12
  export type XpertBusinessToolSurface = 'middleware' | 'mcp';
11
13
  export interface XpertToolProviderMiddlewareDefinition {
@@ -38,6 +40,8 @@ export interface XpertToolProviderOptions {
38
40
  apps?: readonly McpAppDefinition[];
39
41
  }
40
42
  export interface XpertMcpToolOptions {
43
+ /** Default for auto-published tools; explicit administrator policy takes precedence. */
44
+ defaultApprovalMode?: McpCapabilityApprovalMode;
41
45
  behavior: McpToolBehavior;
42
46
  requiredContext: readonly McpRequiredContext[];
43
47
  visibility?: readonly XpertToolVisibility[];
@@ -50,6 +54,8 @@ export interface XpertToolOptions<TInputSchema extends ZodTypeAny = ZodTypeAny,
50
54
  description: string;
51
55
  inputSchema: TInputSchema;
52
56
  outputSchema?: TOutputSchema;
57
+ /** Opt in to standard content blocks; outputSchema validates structuredContent. */
58
+ resultFormat?: 'dto' | 'tool_result';
53
59
  /** true uses the class default, a string selects a declared group, false disables Middleware exposure. */
54
60
  middleware?: true | string | false;
55
61
  /** MCP exposure is opt-in. */
@@ -75,7 +81,7 @@ export interface XpertBusinessToolContext {
75
81
  host: ToolHostApi;
76
82
  middlewareOptions?: unknown;
77
83
  }
78
- export type XpertDecoratedToolMethod<TInputSchema extends ZodTypeAny = ZodTypeAny, TOutputSchema extends ZodTypeAny = ZodTypeAny> = (input: ZodInfer<TInputSchema>, context: XpertBusinessToolContext) => PromiseOrValue<ZodInfer<TOutputSchema>>;
84
+ export type XpertDecoratedToolMethod<TInputSchema extends ZodTypeAny = ZodTypeAny, TOutputSchema extends ZodTypeAny = ZodTypeAny> = (input: ZodInfer<TInputSchema>, context: XpertBusinessToolContext) => PromiseOrValue<ZodInfer<TOutputSchema> | XpertToolResult<ZodInfer<TOutputSchema>> | XpertPreparedToolResult>;
79
85
  export interface XpertToolProviderInstance {
80
86
  getMiddlewareExtensions?(provider: string, options: unknown, context: IAgentMiddlewareContext): PromiseOrValue<Omit<AgentMiddleware, 'name' | 'tools'>>;
81
87
  }
@@ -1,4 +1,4 @@
1
- import type { McpRequiredContext, McpToolBehavior } from '@xpert-ai/contracts';
1
+ import type { McpCapabilityApprovalMode, McpRequiredContext, McpToolBehavior } from '@xpert-ai/contracts';
2
2
  import type { ZodTypeAny, infer as ZodInfer } from 'zod/v3';
3
3
  import type { McpTaskExecutionPolicy } from '../mcp/task';
4
4
  import type { ToolExecutionContext } from './tool-execution-context';
@@ -21,6 +21,7 @@ export interface XpertToolDefinition<TInputSchema extends ZodTypeAny, TOutputSch
21
21
  outputSchema?: TOutputSchema;
22
22
  exposure: XpertToolExposure;
23
23
  behavior: McpToolBehavior;
24
+ defaultApprovalMode?: McpCapabilityApprovalMode;
24
25
  requiredContext: McpRequiredContext[];
25
26
  visibility?: XpertToolVisibility[];
26
27
  app?: XpertToolAppBinding;
@@ -51,7 +51,7 @@ export interface XpertPlugin<TConfig extends object = any> extends PluginLifecyc
51
51
  * template ids as `${pluginName}:${key}` when exposing them through the
52
52
  * xpert-template API.
53
53
  */
54
- templates?: XpertTemplateContribution[] | XpertTemplateProvider;
54
+ templates?: XpertTemplateContribution[] | XpertTemplateProvider | XpertTemplateCatalogProvider;
55
55
  /** Declares the required system-level permissions for this plugin. */
56
56
  permissions?: Permissions;
57
57
  /** Returns the DynamicModule to be mounted to the main application (can be set as global) */
@@ -78,6 +78,11 @@ export interface XpertTemplateContribution {
78
78
  startPrompts?: string[];
79
79
  promptWorkflows?: TPromptWorkflow[];
80
80
  releaseNotes?: string;
81
+ availableLocales?: string[];
82
+ defaultLocale?: string;
83
+ locale?: string;
84
+ pluginVersion?: string;
85
+ contentHash?: string;
81
86
  xpertName?: string;
82
87
  dependencies?: XpertTemplatePluginDependencies;
83
88
  [key: string]: unknown;
@@ -85,6 +90,12 @@ export interface XpertTemplateContribution {
85
90
  export interface XpertTemplateProvider {
86
91
  listTemplates(ctx: PluginContext): PromiseOrValue<XpertTemplateContribution[]>;
87
92
  }
93
+ /** Lists metadata without DSL; resolves exactly one immutable language variant on demand. */
94
+ export interface XpertTemplateCatalogProvider {
95
+ kind: 'catalog';
96
+ listTemplates(ctx: PluginContext): PromiseOrValue<XpertTemplateContribution[]>;
97
+ resolveTemplate(ctx: PluginContext, key: string, locale?: string): PromiseOrValue<XpertTemplateContribution>;
98
+ }
88
99
  export interface PluginContext<TConfig extends object = any> {
89
100
  module: ModuleRef;
90
101
  app?: INestApplicationContext;