@xpert-ai/plugin-sdk 3.18.4 → 3.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +44 -0
- package/data-workbench.cjs.default.js +1 -0
- package/data-workbench.cjs.js +518 -0
- package/data-workbench.cjs.mjs +2 -0
- package/data-workbench.d.ts +1 -0
- package/data-workbench.esm.js +512 -0
- package/index.cjs.js +3118 -33
- package/index.esm.js +3109 -39
- package/model-provider.cjs.js +9 -0
- package/model-provider.esm.js +8 -2
- package/package.json +33 -27
- package/src/data-workbench.d.ts +3 -0
- package/src/lib/ai-model/utils/tokenizer.d.ts +6 -0
- package/src/lib/core/runtime-capability.d.ts +4 -0
- package/src/lib/data/datasource/index.d.ts +3 -0
- package/src/lib/data/datasource/types.d.ts +2 -0
- package/src/lib/data/datasource/workbench-adapter.d.ts +39 -0
- package/src/lib/data/datasource/workbench-sql.d.ts +12 -0
- package/src/lib/data/datasource/workbench.d.ts +133 -0
- package/src/lib/mcp/resource-template.d.ts +2 -3
- package/src/lib/mcp/resource.d.ts +5 -1
- package/src/lib/rag/textsplitter/strategy.interface.d.ts +15 -4
- package/src/lib/rag/transformer/strategy.interface.d.ts +3 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/knowledge-graph.d.ts +59 -0
- package/src/lib/runtime/capabilities/workspace-files.d.ts +2 -0
- package/src/lib/tool-provider/component.d.ts +2 -0
- package/src/lib/tool-provider/decorators.d.ts +1 -1
- package/src/lib/tool-provider/index.d.ts +3 -0
- package/src/lib/tool-provider/mcp-methods.d.ts +39 -0
- package/src/lib/tool-provider/provider-methods.d.ts +5 -0
- package/src/lib/tool-provider/tool-result.d.ts +1 -1
- package/src/lib/tool-provider/types.d.ts +12 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { XpertDecoratedMcpDescriptor } from './mcp-methods';
|
|
1
2
|
import type { IconDefinition, I18nObject, JsonSchemaObjectType, McpRequiredContext, McpCapabilityApprovalMode, McpToolBehavior, TAgentMiddlewareMeta } from '@xpert-ai/contracts';
|
|
2
3
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
4
|
import type { ZodTypeAny, infer as ZodInfer } from 'zod/v3';
|
|
4
5
|
import type { AgentMiddleware } from '../agent/middleware/types';
|
|
5
6
|
import type { IAgentMiddlewareContext } from '../agent/middleware/strategy.interface';
|
|
7
|
+
import type { McpCapabilityDefinitions } from '../mcp/runtime';
|
|
8
|
+
import type { McpTaskExecutionPolicy } from '../mcp/task';
|
|
6
9
|
import type { McpAppDefinition } from '../mcp/app';
|
|
7
10
|
import type { ToolExecutionContext, ToolHostApi, ToolPrincipal } from '../toolset/tool-execution-context';
|
|
8
11
|
import type { XpertToolAppBinding, XpertToolVisibility } from '../toolset/define-tool';
|
|
@@ -40,6 +43,9 @@ export interface XpertToolProviderOptions {
|
|
|
40
43
|
apps?: readonly McpAppDefinition[];
|
|
41
44
|
}
|
|
42
45
|
export interface XpertMcpToolOptions {
|
|
46
|
+
/** Additional transport-specific validation, applied after the shared input schema. */
|
|
47
|
+
inputSchema?: ZodTypeAny;
|
|
48
|
+
task?: McpTaskExecutionPolicy;
|
|
43
49
|
/** Default for auto-published tools; explicit administrator policy takes precedence. */
|
|
44
50
|
defaultApprovalMode?: McpCapabilityApprovalMode;
|
|
45
51
|
behavior: McpToolBehavior;
|
|
@@ -54,7 +60,7 @@ export interface XpertToolOptions<TInputSchema extends ZodTypeAny = ZodTypeAny,
|
|
|
54
60
|
description: string;
|
|
55
61
|
inputSchema: TInputSchema;
|
|
56
62
|
outputSchema?: TOutputSchema;
|
|
57
|
-
/** Opt in to
|
|
63
|
+
/** Opt in to validated content blocks. When provided, outputSchema validates structuredContent. */
|
|
58
64
|
resultFormat?: 'dto' | 'tool_result';
|
|
59
65
|
/** true uses the class default, a string selects a declared group, false disables Middleware exposure. */
|
|
60
66
|
middleware?: true | string | false;
|
|
@@ -79,10 +85,14 @@ export interface XpertBusinessToolContext {
|
|
|
79
85
|
traceId?: string;
|
|
80
86
|
signal?: AbortSignal;
|
|
81
87
|
host: ToolHostApi;
|
|
88
|
+
/** Native Agent feature configuration, scoped to this invocation. */
|
|
89
|
+
xpertFeatures?: IAgentMiddlewareContext['xpertFeatures'];
|
|
82
90
|
middlewareOptions?: unknown;
|
|
83
91
|
}
|
|
84
92
|
export type XpertDecoratedToolMethod<TInputSchema extends ZodTypeAny = ZodTypeAny, TOutputSchema extends ZodTypeAny = ZodTypeAny> = (input: ZodInfer<TInputSchema>, context: XpertBusinessToolContext) => PromiseOrValue<ZodInfer<TOutputSchema> | XpertToolResult<ZodInfer<TOutputSchema>> | XpertPreparedToolResult>;
|
|
85
93
|
export interface XpertToolProviderInstance {
|
|
94
|
+
/** Compatibility hook for legacy providers; prefer resource and prompt method decorators. */
|
|
95
|
+
getMcpExtensions?(): Pick<McpCapabilityDefinitions, 'resources' | 'resourceTemplates' | 'prompts'>;
|
|
86
96
|
getMiddlewareExtensions?(provider: string, options: unknown, context: IAgentMiddlewareContext): PromiseOrValue<Omit<AgentMiddleware, 'name' | 'tools'>>;
|
|
87
97
|
}
|
|
88
98
|
export interface XpertDecoratedToolDescriptor {
|
|
@@ -93,6 +103,7 @@ export interface XpertDecoratedToolDescriptor {
|
|
|
93
103
|
export interface XpertToolProviderDescriptor {
|
|
94
104
|
options: Readonly<XpertToolProviderOptions>;
|
|
95
105
|
tools: readonly XpertDecoratedToolDescriptor[];
|
|
106
|
+
mcpMethods?: readonly XpertDecoratedMcpDescriptor[];
|
|
96
107
|
}
|
|
97
108
|
export interface XpertAgentToolRunnableConfig extends RunnableConfig {
|
|
98
109
|
configurable?: RunnableConfig['configurable'] & {
|