@mcpc-tech/core 0.2.0-beta.10 → 0.2.2
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/{mod.mjs → index.mjs} +1664 -660
- package/package.json +37 -24
- package/{src/plugins → plugins}/large-result.mjs +87 -32
- package/{src/plugins/search-tool.mjs → plugins/search.mjs} +44 -5
- package/plugins.mjs +83 -31
- package/types/mod.d.ts +5 -3
- package/types/mod.d.ts.map +1 -1
- package/types/src/ai-sdk-adapter.d.ts +53 -0
- package/types/src/ai-sdk-adapter.d.ts.map +1 -0
- package/types/src/compose.d.ts +22 -67
- package/types/src/compose.d.ts.map +1 -1
- package/types/src/plugin-types.d.ts +36 -9
- package/types/src/plugin-types.d.ts.map +1 -1
- package/types/src/plugins/large-result.d.ts +18 -0
- package/types/src/plugins/large-result.d.ts.map +1 -0
- package/types/src/plugins/search-tool.d.ts +20 -0
- package/types/src/plugins/search-tool.d.ts.map +1 -0
- package/types/src/service/tools.d.ts +4 -0
- package/types/src/service/tools.d.ts.map +1 -0
- package/types/src/types.d.ts +4 -0
- package/types/src/types.d.ts.map +1 -1
- package/types/src/utils/common/env.d.ts +4 -0
- package/types/src/utils/common/env.d.ts.map +1 -0
- package/types/src/utils/common/json.d.ts +6 -0
- package/types/src/utils/common/json.d.ts.map +1 -0
- package/types/src/utils/common/mcp.d.ts +11 -0
- package/types/src/utils/common/mcp.d.ts.map +1 -0
- package/types/src/utils/schema.d.ts +55 -0
- package/types/src/utils/schema.d.ts.map +1 -0
- package/types/src/utils/state.d.ts +5 -0
- package/types/src/utils/state.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-sdk-adapter.d.ts","sources":["../../src/ai-sdk-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;CAOC,GAED,cAAc,mBAAmB,uBAAuB;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,OAAO,iBAAS,oBACd,QAAQ,mBAAmB,EAC3B,MAAM,UAAU,EAChB,YAAY,gBAAgB,GAC3B,OAAO,MAAM,EAAE,OAAO;AAoBzB;;;CAGC,GACD,iBAAiB;GACd;IACC,aAAa,MAAM;IACnB,YAAY,GAAG;IACf,UAAU,OAAO,GAAG,KAAK,QAAQ,GAAG;OAClC,OAAO;;AAGb;;;CAGC,GACD,iBAAiB;GACd,QAAQ,GAAG,IAAG,OAAO"}
|
package/types/src/compose.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Implementation } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { type Schema } from "
|
|
1
|
+
import { type Implementation, type Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { type Schema } from "./utils/schema.js";
|
|
3
3
|
import type { McpSettingsSchema } from "./service/tools.js";
|
|
4
4
|
import { Server, type ServerOptions } from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
import type z from "zod";
|
|
@@ -7,77 +7,49 @@ import type { ComposeDefinition } from "./set-up-mcp-compose.js";
|
|
|
7
7
|
import type { JSONSchema, ToolCallback } from "./types.js";
|
|
8
8
|
import type { ToolConfig, ToolPlugin } from "./plugin-types.js";
|
|
9
9
|
export declare class ComposableMCPServer extends Server {
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
toolNameMapping: Map<string, string>;
|
|
10
|
+
private pluginManager: any;
|
|
11
|
+
private toolManager: any;
|
|
12
|
+
private logger: any;
|
|
13
|
+
get toolNameMapping(): Map<string, string>;
|
|
15
14
|
constructor(_serverInfo: Implementation, options: ServerOptions);
|
|
16
15
|
/**
|
|
17
16
|
* Initialize built-in plugins - called during setup
|
|
18
17
|
*/ initBuiltInPlugins(): Promise<void>;
|
|
19
18
|
private applyPluginTransforms: any;
|
|
20
19
|
private resolveToolName: any;
|
|
21
|
-
tool<T>(name: string, description: string, paramsSchema: Schema<T
|
|
20
|
+
tool<T>(name: string, description: string, paramsSchema: Schema<T> | JSONSchema, cb: (args: T, extra?: unknown) => unknown, options?: {
|
|
22
21
|
internal?: boolean;
|
|
23
22
|
plugins?: ToolPlugin[];
|
|
24
23
|
}): void;
|
|
25
24
|
/**
|
|
26
|
-
* Register a tool override with description, hide, args transformation, and/or custom handler
|
|
27
|
-
*/ /**
|
|
28
25
|
* Get tool callback from registry
|
|
29
26
|
*/ getToolCallback(name: string): ToolCallback | undefined;
|
|
30
27
|
/**
|
|
31
|
-
* Find tool configuration
|
|
28
|
+
* Find tool configuration
|
|
32
29
|
*/ findToolConfig(toolId: string): ToolConfig | undefined;
|
|
33
30
|
/**
|
|
34
31
|
* Call any registered tool directly, whether it's public or internal
|
|
35
32
|
*/ callTool(name: string, args: unknown): Promise<unknown>;
|
|
36
33
|
/**
|
|
37
|
-
* Get all
|
|
38
|
-
*/ getInternalToolNames(): string[];
|
|
39
|
-
/**
|
|
40
|
-
* Get all public tool names
|
|
34
|
+
* Get all public tool names (exposed to MCP clients)
|
|
41
35
|
*/ getPublicToolNames(): string[];
|
|
42
36
|
/**
|
|
43
|
-
* Get all
|
|
44
|
-
*/
|
|
37
|
+
* Get all public tools (for AI SDK integration)
|
|
38
|
+
*/ getPublicTools(): Tool[];
|
|
45
39
|
/**
|
|
46
40
|
* Get all hidden tool names
|
|
47
41
|
*/ getHiddenToolNames(): string[];
|
|
48
42
|
/**
|
|
49
|
-
* Get
|
|
50
|
-
*/
|
|
43
|
+
* Get hidden tool schema by name (for internal access)
|
|
44
|
+
*/ getHiddenToolSchema(name: string): {
|
|
51
45
|
description: string;
|
|
52
46
|
schema: JSONSchema;
|
|
53
47
|
} | undefined;
|
|
54
48
|
/**
|
|
55
|
-
* Check if a tool exists (visible or
|
|
49
|
+
* Check if a tool exists (visible or hidden)
|
|
56
50
|
*/ hasToolNamed(name: string): boolean;
|
|
57
51
|
/**
|
|
58
|
-
* Configure tool behavior
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Override description
|
|
62
|
-
* server.configTool('myTool', {
|
|
63
|
-
* callback: originalCallback,
|
|
64
|
-
* description: 'Enhanced tool description'
|
|
65
|
-
* });
|
|
66
|
-
*
|
|
67
|
-
* // Hide tool from agentic execution
|
|
68
|
-
* server.configTool('myTool', {
|
|
69
|
-
* callback: originalCallback,
|
|
70
|
-
* description: 'Hidden tool',
|
|
71
|
-
* visibility: { hide: true }
|
|
72
|
-
* });
|
|
73
|
-
*
|
|
74
|
-
* // Make tool globally available
|
|
75
|
-
* server.configTool('myTool', {
|
|
76
|
-
* callback: originalCallback,
|
|
77
|
-
* description: 'Global tool',
|
|
78
|
-
* visibility: { global: true }
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
52
|
+
* Configure tool behavior
|
|
81
53
|
*/ configTool(toolName: string, config: ToolConfig): void;
|
|
82
54
|
/**
|
|
83
55
|
* Get tool configuration
|
|
@@ -86,34 +58,17 @@ export declare class ComposableMCPServer extends Server {
|
|
|
86
58
|
* Remove tool configuration
|
|
87
59
|
*/ removeToolConfig(toolName: string): boolean;
|
|
88
60
|
/**
|
|
89
|
-
* Register a tool plugin
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* // Global plugin for all tools
|
|
93
|
-
* server.addPlugin({
|
|
94
|
-
* name: 'logger',
|
|
95
|
-
* transformTool: (tool, context) => {
|
|
96
|
-
* const originalExecute = tool.execute;
|
|
97
|
-
* tool.execute = async (args, extra) => {
|
|
98
|
-
* console.log(`Calling ${tool.name} with:`, args);
|
|
99
|
-
* const result = await originalExecute(args, extra);
|
|
100
|
-
* console.log(`Result:`, result);
|
|
101
|
-
* return result;
|
|
102
|
-
* };
|
|
103
|
-
* return tool;
|
|
104
|
-
* }
|
|
105
|
-
* });
|
|
106
|
-
* ```
|
|
61
|
+
* Register a tool plugin with validation and error handling
|
|
107
62
|
*/ addPlugin(plugin: ToolPlugin): Promise<void>;
|
|
108
63
|
/**
|
|
109
64
|
* Load and register a plugin from a file path with optional parameters
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*/ loadPluginFromPath(pluginPath: string): Promise<void>;
|
|
114
|
-
private applyTransformToolHooks: any;
|
|
65
|
+
*/ loadPluginFromPath(pluginPath: string, options?: {
|
|
66
|
+
cache?: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
115
68
|
private processToolsWithPlugins: any;
|
|
116
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Dispose all plugins and cleanup resources
|
|
71
|
+
*/ disposePlugins(): Promise<void>;
|
|
117
72
|
compose(name: string | null, description: string, depsConfig?: z.infer<typeof McpSettingsSchema>, options?: ComposeDefinition["options"]): Promise<void>;
|
|
118
73
|
}
|
|
119
74
|
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sources":["../../src/compose.ts"],"names":[],"mappings":"AAAA,SAGE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sources":["../../src/compose.ts"],"names":[],"mappings":"AAAA,SAGE,KAAK,cAAc,EAGnB,KAAK,IAAI,6CAC6C;AACxD,SAAwC,KAAK,MAAM,4BAA4B;AAC/E,cAAc,iBAAiB,6BAA6B;AAC5D,SACE,MAAM,EACN,KAAK,aAAa,oDAC2C;AAC/D,YAAY,aAAyB;AAGrC,cAAc,iBAAiB,kCAAkC;AACjE,cAAc,UAAU,EAAE,YAAY,qBAAqB;AAQ3D,cAA4B,UAAU,EAAE,UAAU,4BAA4B;AAU9E,OAAO,cAAM,4BAA4B;EACvC,QAAQ,mBAA6B;EACrC,QAAQ,iBAAyB;EACjC,QAAQ,YAAsC;EAG9C,IAAI,mBAAmB,IAAI,MAAM,EAAE,MAAM;EAIzC,YAAY,aAAa,cAAc,EAAE,SAAS,aAAa;EAiB/D;;GAEC,GACD,AAAM,sBAAsB,QAAQ,IAAI;UAqB1B;UAyDN;EAIR,KAAK,GACH,MAAM,MAAM,EACZ,aAAa,MAAM,EACnB,cAAc,OAAO,KAAK,UAAU,EACpC,KAAK,MAAM,GAAG,QAAQ,OAAO,KAAK,OAAO,EACzC;IAAW,WAAW,OAAO;IAAE,UAAU;GAAmB;EAqE9D;;GAEC,GACD,gBAAgB,MAAM,MAAM,GAAG,eAAe,SAAS;EAIvD;;GAEC,GACD,eAAe,QAAQ,MAAM,GAAG,aAAa,SAAS;EAItD;;GAEC,GACD,AAAM,SAAS,MAAM,MAAM,EAAE,MAAM,OAAO,GAAG,QAAQ,OAAO;EAyB5D;;GAEC,GACD,sBAAsB,MAAM;EAI5B;;GAEC,GACD,kBAAkB;EAIlB;;GAEC,GACD,sBAAsB,MAAM;EAI5B;;GAEC,GACD,oBACE,MAAM,MAAM;IACT,aAAa,MAAM;IAAE,QAAQ;MAAe,SAAS;EAI1D;;GAEC,GACD,aAAa,MAAM,MAAM,GAAG,OAAO;EAInC;;GAEC,GACD,WAAW,UAAU,MAAM,EAAE,QAAQ,UAAU,GAAG,IAAI;EAItD;;GAEC,GACD,cAAc,UAAU,MAAM,GAAG,aAAa,SAAS;EAIvD;;GAEC,GACD,iBAAiB,UAAU,MAAM,GAAG,OAAO;EAI3C;;GAEC,GACD,AAAM,UAAU,QAAQ,UAAU,GAAG,QAAQ,IAAI;EAIjD;;GAEC,GACD,AAAM,mBACJ,YAAY,MAAM,EAClB;IAAW,QAAQ,OAAO;GAAoB,GAC7C,QAAQ,IAAI;UAOD;EAUd;;GAEC,GACD,AAAM,kBAAkB,QAAQ,IAAI;EAI9B,QACJ,MAAM,MAAM,GAAG,IAAI,EACnB,aAAa,MAAM,EACnB,aAAY,EAAE,aAAa,kBAAuC,EAClE,UAAS,kBAAkB,UAAgC;AA+P/D"}
|
|
@@ -8,43 +8,70 @@ export interface ComposedTool extends Tool {
|
|
|
8
8
|
execute: ToolCallback;
|
|
9
9
|
}
|
|
10
10
|
export interface ToolPlugin {
|
|
11
|
-
/** Plugin name for identification */ name: string;
|
|
11
|
+
/** Plugin name for identification (must be unique) */ name: string;
|
|
12
|
+
/** Plugin version for debugging and compatibility checks */ version?: string;
|
|
12
13
|
/** Plugin execution order - 'pre' (before core), 'post' (after core), or default */ enforce?: "pre" | "post";
|
|
13
14
|
/** Apply plugin conditionally based on mode */ apply?: "agentic" | "workflow" | ((mode: string) => boolean);
|
|
15
|
+
/** Plugin dependencies - names of plugins that must be loaded first */ dependencies?: string[];
|
|
14
16
|
/** Called when plugin is added to server - for initial setup */ configureServer?: (server: ComposableMCPServer) => void | Promise<void>;
|
|
15
17
|
/** Called before composition starts - for validation and config */ composeStart?: (context: ComposeStartContext) => void | Promise<void>;
|
|
16
18
|
/** Called for each tool during composition - main transformation hook */ transformTool?: (tool: ComposedTool, context: TransformContext) => ComposedTool | void | Promise<ComposedTool | void>;
|
|
17
19
|
/** Called after all tools are composed but before registration */ finalizeComposition?: (tools: Record<string, ComposedTool>, context: FinalizeContext) => void | Promise<void>;
|
|
18
20
|
/** Called after composition is complete - for logging and cleanup */ composeEnd?: (result: ComposeEndContext) => void | Promise<void>;
|
|
21
|
+
/** Called before tool execution - transform input arguments */ transformInput?: (args: unknown, context: RuntimeTransformContext) => unknown | Promise<unknown>;
|
|
22
|
+
/** Called after tool execution - transform output result */ transformOutput?: (result: unknown, context: RuntimeTransformContext) => unknown | Promise<unknown>;
|
|
23
|
+
/** Called when plugin is removed or server is disposed - for cleanup */ dispose?: () => void | Promise<void>;
|
|
19
24
|
}
|
|
20
25
|
/** Context for composeStart hook */ export interface ComposeStartContext {
|
|
21
26
|
serverName: string;
|
|
22
27
|
description: string;
|
|
23
28
|
mode: "agentic" | "agentic_workflow";
|
|
24
|
-
server:
|
|
29
|
+
server: ComposableMCPServer;
|
|
30
|
+
/** All available tool names before composition */ availableTools: string[];
|
|
25
31
|
}
|
|
26
32
|
/** Context for transformTool hook */ export interface TransformContext {
|
|
27
33
|
toolName: string;
|
|
28
|
-
server:
|
|
34
|
+
server: ComposableMCPServer;
|
|
29
35
|
mode: "agentic" | "agentic_workflow";
|
|
36
|
+
/** Original tool definition before any transformations */ originalTool: ComposedTool;
|
|
37
|
+
/** Index of current transformation (how many plugins have processed this tool) */ transformationIndex: number;
|
|
30
38
|
}
|
|
31
39
|
/** Context for finalizeComposition hook */ export interface FinalizeContext {
|
|
32
40
|
serverName: string;
|
|
33
41
|
mode: "agentic" | "agentic_workflow";
|
|
34
|
-
server:
|
|
42
|
+
server: ComposableMCPServer;
|
|
43
|
+
/** Names of all composed tools */ toolNames: string[];
|
|
35
44
|
}
|
|
36
45
|
/** Context for composeEnd hook */ export interface ComposeEndContext {
|
|
37
46
|
toolName: string | null;
|
|
38
47
|
pluginNames: string[];
|
|
39
48
|
mode: "agentic" | "agentic_workflow";
|
|
40
|
-
server:
|
|
49
|
+
server: ComposableMCPServer;
|
|
50
|
+
/** Composition statistics - simplified */ stats: {
|
|
51
|
+
totalTools: number;
|
|
52
|
+
/** Tools exposed to MCP clients (public: true) */ publicTools: number;
|
|
53
|
+
/** Tools hidden from agent context (hidden: true) */ hiddenTools: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Context for runtime transformation hooks (transformInput/transformOutput) */ export interface RuntimeTransformContext {
|
|
57
|
+
toolName: string;
|
|
58
|
+
server: ComposableMCPServer;
|
|
59
|
+
/** Original input arguments (available in transformOutput) */ originalArgs?: unknown;
|
|
60
|
+
/** Transformation direction */ direction: "input" | "output";
|
|
41
61
|
}
|
|
42
62
|
export interface ToolConfig {
|
|
43
63
|
/** Override the tool's description */ description?: string;
|
|
44
|
-
/** Tool visibility
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
/** Tool visibility settings - simplified to two independent flags */ visibility?: {
|
|
65
|
+
/**
|
|
66
|
+
* If true, tool is exposed to MCP clients (appears in listTools response)
|
|
67
|
+
* Mapped from XML: <tool name="xxx" global/>
|
|
68
|
+
* Default: false (tool only available within agent)
|
|
69
|
+
*/ public?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If true, tool is hidden from agent's tool context (but still callable)
|
|
72
|
+
* Mapped from XML: <tool name="xxx" hide/>
|
|
73
|
+
* Default: false (tool appears in agent description)
|
|
74
|
+
*/ hidden?: boolean;
|
|
48
75
|
};
|
|
49
76
|
}
|
|
50
77
|
//# sourceMappingURL=plugin-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-types.d.ts","sources":["../../src/plugin-types.ts"],"names":[],"mappings":"AAAA;;;CAGC,GAED,cAAc,IAAI,6CAAyD;AAC3E,cAAc,YAAY,qBAAqB;AAC/C,cAAc,mBAAmB,uBAAuB;AAExD,iBAAiB,qBAAqB;EACpC,SAAS;;AAKX,iBAAiB;EACf,
|
|
1
|
+
{"version":3,"file":"plugin-types.d.ts","sources":["../../src/plugin-types.ts"],"names":[],"mappings":"AAAA;;;CAGC,GAED,cAAc,IAAI,6CAAyD;AAC3E,cAAc,YAAY,qBAAqB;AAC/C,cAAc,mBAAmB,uBAAuB;AAExD,iBAAiB,qBAAqB;EACpC,SAAS;;AAKX,iBAAiB;EACf,oDAAoD,GACpD,MAAM,MAAM;EAEZ,0DAA0D,GAC1D,UAAU,MAAM;EAEhB,kFAAkF,GAClF,UAAU,QAAQ;EAElB,6CAA6C,GAC7C,QAAQ,YAAY,eAAe,MAAM,MAAM,KAAK,OAAO;EAE3D,qEAAqE,GACrE,eAAe,MAAM;EAIrB,8DAA8D,GAC9D,mBAAmB,QAAQ,wBAAwB,IAAI,GAAG,QAAQ,IAAI;EAEtE,iEAAiE,GACjE,gBAAgB,SAAS,wBAAwB,IAAI,GAAG,QAAQ,IAAI;EAEpE,uEAAuE,GACvE,iBACE,MAAM,cACN,SAAS,qBACN,eAAe,IAAI,GAAG,QAAQ,eAAe,IAAI;EAEtD,gEAAgE,GAChE,uBACE,OAAO,OAAO,MAAM,EAAE,eACtB,SAAS,oBACN,IAAI,GAAG,QAAQ,IAAI;EAExB,mEAAmE,GACnE,cAAc,QAAQ,sBAAsB,IAAI,GAAG,QAAQ,IAAI;EAI/D,6DAA6D,GAC7D,kBACE,MAAM,OAAO,EACb,SAAS,4BACN,OAAO,GAAG,QAAQ,OAAO;EAE9B,0DAA0D,GAC1D,mBACE,QAAQ,OAAO,EACf,SAAS,4BACN,OAAO,GAAG,QAAQ,OAAO;EAE9B,sEAAsE,GACtE,gBAAgB,IAAI,GAAG,QAAQ,IAAI;;AAarC,kCAAkC,GAClC,iBAAiB;EACf,YAAY,MAAM;EAClB,aAAa,MAAM;EACnB,MAAM,YAAY;EAClB,QAAQ;EACR,gDAAgD,GAChD,gBAAgB,MAAM;;AAGxB,mCAAmC,GACnC,iBAAiB;EACf,UAAU,MAAM;EAChB,QAAQ;EACR,MAAM,YAAY;EAClB,wDAAwD,GACxD,cAAc;EACd,gFAAgF,GAChF,qBAAqB,MAAM;;AAG7B,yCAAyC,GACzC,iBAAiB;EACf,YAAY,MAAM;EAClB,MAAM,YAAY;EAClB,QAAQ;EACR,gCAAgC,GAChC,WAAW,MAAM;;AAGnB,gCAAgC,GAChC,iBAAiB;EACf,UAAU,MAAM,GAAG,IAAI;EACvB,aAAa,MAAM;EACnB,MAAM,YAAY;EAClB,QAAQ;EACR,wCAAwC,GACxC;IACE,YAAY,MAAM;IAClB,gDAAgD,GAChD,aAAa,MAAM;IACnB,mDAAmD,GACnD,aAAa,MAAM;;;AAIvB,8EAA8E,GAC9E,iBAAiB;EACf,UAAU,MAAM;EAChB,QAAQ;EACR,4DAA4D,GAC5D,eAAe,OAAO;EACtB,6BAA6B,GAC7B,WAAW,UAAU;;AAevB,iBAAiB;EACf,oCAAoC,GACpC,cAAc,MAAM;EACpB,mEAAmE,GACnE;IACE;;;;KAIC,GACD,SAAS,OAAO;IAChB;;;;KAIC,GACD,SAAS,OAAO"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SearchOptions } from "./search-tool.js";
|
|
2
|
+
import type { ToolPlugin } from "../plugin-types.js";
|
|
3
|
+
interface PluginOptions {
|
|
4
|
+
maxSize?: number;
|
|
5
|
+
previewSize?: number;
|
|
6
|
+
tempDir?: string;
|
|
7
|
+
search?: SearchOptions;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create a plugin that handles large tool results by saving them to files
|
|
11
|
+
* and providing search capabilities for the saved content.
|
|
12
|
+
*/ export declare function createLargeResultPlugin(options?: PluginOptions): ToolPlugin;
|
|
13
|
+
/**
|
|
14
|
+
* Default large result plugin instance with common settings
|
|
15
|
+
*/ declare const defaultLargeResultPlugin: ToolPlugin;
|
|
16
|
+
export declare const createPlugin: any;
|
|
17
|
+
export default defaultLargeResultPlugin;
|
|
18
|
+
//# sourceMappingURL=large-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"large-result.d.ts","sources":["../../../src/plugins/large-result.ts"],"names":[],"mappings":"AAQA,SAA6B,KAAK,aAAa,2BAA2B;AAC1E,cAAc,UAAU,6BAA6B;UAE3C;EACR,UAAU,MAAM;EAChB,cAAc,MAAM;EACpB,UAAU,MAAM;EAChB,SAAS;;AAGX;;;CAGC,GACD,OAAO,iBAAS,wBACd,UAAS,aAAkB,GAC1B;AAoGH;;CAEC,GACD,cAAM,0BAA0B;AAMhC,OAAO,cAAM,kBAAuC;AAEpD,eAAe,yBAAyB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolPlugin } from "../plugin-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the search plugin
|
|
4
|
+
*/ export interface SearchOptions {
|
|
5
|
+
/** Whether to enable search globally (default: true) */ global?: boolean;
|
|
6
|
+
/** Maximum number of search results to return (default: 20) */ maxResults?: number;
|
|
7
|
+
/** Maximum output size in characters (default: 5000) */ maxOutputSize?: number;
|
|
8
|
+
/** Allowed directory for search operations - restricts search scope for security (default: system temp directory) */ allowedDir?: string;
|
|
9
|
+
/** Whether search should be case sensitive (default: false) */ caseSensitive?: boolean;
|
|
10
|
+
/** Search timeout in milliseconds (default: 30000) */ timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a search plugin that adds file search capability with size limits
|
|
14
|
+
*/ export declare function createSearchPlugin(options?: SearchOptions): ToolPlugin;
|
|
15
|
+
/**
|
|
16
|
+
* Default search plugin instance with common settings
|
|
17
|
+
*/ declare const defaultSearchPlugin: ToolPlugin;
|
|
18
|
+
export declare const createPlugin: any;
|
|
19
|
+
export default defaultSearchPlugin;
|
|
20
|
+
//# sourceMappingURL=search-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-tool.d.ts","sources":["../../../src/plugins/search-tool.ts"],"names":[],"mappings":"AASA,cAAc,UAAU,6BAA6B;AAIrD;;CAEC,GACD,iBAAiB;EACf,sDAAsD,GACtD,SAAS,OAAO;EAChB,6DAA6D,GAC7D,aAAa,MAAM;EACnB,sDAAsD,GACtD,gBAAgB,MAAM;EACtB,mHAAmH,GACnH,aAAa,MAAM;EACnB,6DAA6D,GAC7D,gBAAgB,OAAO;EACvB,oDAAoD,GACpD,YAAY,MAAM;;AAGpB;;CAEC,GACD,OAAO,iBAAS,mBAAmB,UAAS,aAAkB,GAAG;AA0PjE;;CAEC,GACD,cAAM,qBAAqB;AAS3B,OAAO,cAAM,kBAAkC;AAE/C,eAAe,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sources":["../../../src/service/tools.ts"],"names":[],"mappings":"AAAA,SAAS,CAAC,cAA0B;AAwCpC,OAAO,cAAM,mBAAmB,EAAE,UAAU,OAAO,MAAM,EAAE,EAAE,aAGxD;AASL,YAAY,aACR,EAAE,aAAa,qBACf,EAAE,aAAa"}
|
package/types/src/types.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ export type JSONSchema = Record<string, unknown>;
|
|
|
2
2
|
export type ToolCallback = (args: unknown, extra?: unknown) => unknown;
|
|
3
3
|
export interface SamplingConfig {
|
|
4
4
|
maxIterations?: number;
|
|
5
|
+
/**
|
|
6
|
+
* Use LLM to summarize sub-agent results (default: true).
|
|
7
|
+
* Set to false to return full conversation history for debugging.
|
|
8
|
+
*/ summarize?: boolean;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
11
|
* XML-like tool reference string where only `name` is required.
|
package/types/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,aAAa,OAAO,MAAM,EAAE,OAAO;AAE/C,YAAY,gBAAgB,MAAM,OAAO,EAAE,QAAQ,OAAO,KAAK,OAAO;AAEtE,iBAAiB;EACf,gBAAgB,MAAM;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,aAAa,OAAO,MAAM,EAAE,OAAO;AAE/C,YAAY,gBAAgB,MAAM,OAAO,EAAE,QAAQ,OAAO,KAAK,OAAO;AAEtE,iBAAiB;EACf,gBAAgB,MAAM;EACtB;;;GAGC,GACD,YAAY,OAAO;;AAiDrB;;;;;;;;CAQC,GACD,YAAY,WAAW,MAAM,cAAc,EAAE,MAAM,CAAC,CAAC;AACrD,YAAY,YACR,KACA,UACA,YACA,iBACA;AACJ,YAAY,UAAU,OAAO;AAE7B,YAAY,cACP,YAAY,EAAE,MAAM,CAAC,CAAC,EAAE,WAAW,YAAY,aAC/C,YAAY,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sources":["../../../../src/utils/common/env.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,eAAe;AAEnC,OAAO,cAAM,qBAAwD;AACrE,OAAO,cAAM,aACiD,OAAO,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempts to parse JSON with a repair function if initial parse fails.
|
|
3
|
+
*/ export declare function parseJSON<T, U extends boolean = false>(text: string, throwError?: U): U extends false ? T | null : T;
|
|
4
|
+
export declare function truncateJSON(obj: unknown): string;
|
|
5
|
+
export declare function optionalObject<T>(obj: T, condition: boolean): T;
|
|
6
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sources":["../../../../src/utils/common/json.ts"],"names":[],"mappings":"AAGA;;CAEC,GACD,OAAO,iBAAS,UAAU,GAAG,UAAU,OAAO,GAAG,KAAK,EACpD,MAAM,MAAM,EACZ,aAAa,CAAC,GACb,UAAU,KAAK,GAAG,IAAI,IAAI,GAAG;AAsBhC,OAAO,iBAAS,aAAa,KAAK,OAAO,GAAG,MAAM;AAQlD,OAAO,iBAAS,eAAe,GAAG,KAAK,CAAC,EAAE,WAAW,OAAO,GAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { McpSettingsSchema } from "../../service/tools.js";
|
|
2
|
+
import type z from "zod";
|
|
3
|
+
export declare function composeMcpDepTools(mcpConfig: z.input<typeof McpSettingsSchema> | z.infer<typeof McpSettingsSchema>, filterIn?: (params: {
|
|
4
|
+
action: string;
|
|
5
|
+
tool: any;
|
|
6
|
+
mcpName: string;
|
|
7
|
+
toolNameWithScope: string;
|
|
8
|
+
internalToolName: string;
|
|
9
|
+
toolId: string;
|
|
10
|
+
}) => boolean): Promise<Record<string, any>>;
|
|
11
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sources":["../../../../src/utils/common/mcp.ts"],"names":[],"mappings":"AAIA,cACE,iBAAiB,iCAEa;AAChC,YAAY,aAAyB;AA2IrC,OAAO,iBAAe,mBACpB,WACI,EAAE,aAAa,qBACf,EAAE,aAAa,kBAAkB,EACrC,YAAY;EACV,QAAQ,MAAM;EACd,MAAM,GAAG;EACT,SAAS,MAAM;EACf,mBAAmB,MAAM;EACzB,kBAAkB,MAAM;EACxB,QAAQ,MAAM;MACV,OAAO,GACZ,QAAQ,OAAO,MAAM,EAAE,GAAG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Schema types and helpers
|
|
3
|
+
* Replaces AI SDK dependencies while maintaining compatibility
|
|
4
|
+
*/ import type { JSONSchema } from "../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schema symbol for internal type checking
|
|
7
|
+
*/ declare const schemaSymbol: unique symbol;
|
|
8
|
+
declare const validatorSymbol: unique symbol;
|
|
9
|
+
/**
|
|
10
|
+
* Schema type that wraps JSON Schema with type information
|
|
11
|
+
* Compatible with AI SDK's Schema<T> interface
|
|
12
|
+
*/ export interface Schema<T = unknown> {
|
|
13
|
+
readonly [schemaSymbol]: true;
|
|
14
|
+
readonly [validatorSymbol]: true;
|
|
15
|
+
readonly _type?: T;
|
|
16
|
+
readonly jsonSchema: JSONSchema;
|
|
17
|
+
readonly validate?: (value: unknown) => {
|
|
18
|
+
success: boolean;
|
|
19
|
+
value?: T;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wraps a JSON Schema object into our Schema type
|
|
24
|
+
* Compatible with AI SDK's jsonSchema() function
|
|
25
|
+
*
|
|
26
|
+
* @param schema - JSON Schema object or already wrapped Schema
|
|
27
|
+
* @param options - Optional validation configuration
|
|
28
|
+
* @returns Schema<T> wrapper or the original schema if already wrapped
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const schema = jsonSchema({
|
|
33
|
+
* type: "object",
|
|
34
|
+
* properties: {
|
|
35
|
+
* name: { type: "string" }
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/ export declare function jsonSchema<T = unknown>(schema: JSONSchema | Schema<T>, options?: {
|
|
40
|
+
validate?: (value: unknown) => {
|
|
41
|
+
success: boolean;
|
|
42
|
+
value?: T;
|
|
43
|
+
};
|
|
44
|
+
}): Schema<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Type guard to check if a value is a wrapped Schema
|
|
47
|
+
*/ export declare function isWrappedSchema(value: unknown): value is Schema;
|
|
48
|
+
/**
|
|
49
|
+
* Extract JSON Schema from wrapped or unwrapped schema
|
|
50
|
+
* Provides backward compatibility with both formats
|
|
51
|
+
*
|
|
52
|
+
* @param schema - Schema object (wrapped or unwrapped)
|
|
53
|
+
* @returns The underlying JSON Schema
|
|
54
|
+
*/ export declare function extractJsonSchema(schema: Schema | JSONSchema): JSONSchema;
|
|
55
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA;;;CAGC,GAED,cAAc,UAAU,sBAAsB;AAE9C;;CAEC,GACD,cAAM;AACN,cAAM;AAEN;;;CAGC,GACD,iBAAiB,OAAO,IAAI,OAAO;YACvB,eAAe,IAAI;YACnB,kBAAkB,IAAI;WACvB,QAAQ;WACR,YAAY;WACZ,YAAY,OAAO,OAAO;IAAO,SAAS,OAAO;IAAE,QAAQ;;;AAGtE;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,iBAAS,WAAW,IAAI,OAAO,EACpC,QAAQ,aAAa,OAAO,EAAE,EAC9B;EAAW,YAAY,OAAO,OAAO;IAAO,SAAS,OAAO;IAAE,QAAQ;;CAClE,GACH,OAAO;AAeV;;CAEC,GACD,OAAO,iBAAS,gBAAgB,OAAO,OAAO,GAAG,SAAS;AAS1D;;;;;;CAMC,GACD,OAAO,iBAAS,kBAAkB,QAAQ,SAAS,UAAU,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sources":["../../../src/utils/state.ts"],"names":[],"mappings":"AAAA,YAAY;EACV,aAAa,MAAM;EACnB,SAAS,MAAM,MAAM"}
|