@elizaos/plugin-mcp 1.7.0 → 2.0.0-alpha.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/LICENSE +23 -0
- package/dist/cjs/index.cjs +857 -1099
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js.map +25 -27
- package/dist/index.d.ts +2 -7
- package/dist/node/actions/callToolAction.d.ts +3 -0
- package/dist/node/actions/callToolAction.d.ts.map +1 -0
- package/dist/node/actions/readResourceAction.d.ts +3 -0
- package/dist/node/actions/readResourceAction.d.ts.map +1 -0
- package/dist/node/generated/prompts/typescript/prompts.d.ts +24 -0
- package/dist/node/generated/prompts/typescript/prompts.d.ts.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/{index.js → node/index.js} +874 -1104
- package/dist/node/index.js.map +31 -0
- package/dist/node/provider.d.ts.map +1 -0
- package/dist/{service.d.ts → node/service.d.ts} +6 -8
- package/dist/node/service.d.ts.map +1 -0
- package/dist/node/templates/errorAnalysisPrompt.d.ts +2 -0
- package/dist/node/templates/errorAnalysisPrompt.d.ts.map +1 -0
- package/dist/node/templates/feedbackTemplate.d.ts +8 -0
- package/dist/node/templates/feedbackTemplate.d.ts.map +1 -0
- package/dist/node/templates/resourceAnalysisTemplate.d.ts +8 -0
- package/dist/node/templates/resourceAnalysisTemplate.d.ts.map +1 -0
- package/dist/node/templates/resourceSelectionTemplate.d.ts +8 -0
- package/dist/node/templates/resourceSelectionTemplate.d.ts.map +1 -0
- package/dist/node/templates/toolReasoningTemplate.d.ts +8 -0
- package/dist/node/templates/toolReasoningTemplate.d.ts.map +1 -0
- package/dist/node/templates/toolSelectionTemplate.d.ts +8 -0
- package/dist/node/templates/toolSelectionTemplate.d.ts.map +1 -0
- package/dist/{tool-compatibility/index.d.ts → node/tool-compatibility/base.d.ts} +15 -16
- package/dist/node/tool-compatibility/base.d.ts.map +1 -0
- package/dist/node/tool-compatibility/index.d.ts +7 -0
- package/dist/node/tool-compatibility/index.d.ts.map +1 -0
- package/dist/node/tool-compatibility/integration-test.d.ts +10 -0
- package/dist/node/tool-compatibility/integration-test.d.ts.map +1 -0
- package/dist/node/tool-compatibility/providers/anthropic.d.ts +11 -0
- package/dist/node/tool-compatibility/providers/anthropic.d.ts.map +1 -0
- package/dist/node/tool-compatibility/providers/google.d.ts +11 -0
- package/dist/node/tool-compatibility/providers/google.d.ts.map +1 -0
- package/dist/node/tool-compatibility/providers/openai.d.ts +18 -0
- package/dist/node/tool-compatibility/providers/openai.d.ts.map +1 -0
- package/dist/node/tool-compatibility/test-example.d.ts +4 -0
- package/dist/node/tool-compatibility/test-example.d.ts.map +1 -0
- package/dist/node/types.d.ts +191 -0
- package/dist/node/types.d.ts.map +1 -0
- package/dist/{utils → node/utils}/error.d.ts +4 -4
- package/dist/node/utils/error.d.ts.map +1 -0
- package/dist/node/utils/handler.d.ts +8 -0
- package/dist/node/utils/handler.d.ts.map +1 -0
- package/dist/node/utils/json.d.ts +11 -0
- package/dist/node/utils/json.d.ts.map +1 -0
- package/dist/node/utils/mcp.d.ts +5 -0
- package/dist/node/utils/mcp.d.ts.map +1 -0
- package/dist/node/utils/processing.d.ts +43 -0
- package/dist/node/utils/processing.d.ts.map +1 -0
- package/dist/node/utils/schemas.d.ts +72 -0
- package/dist/node/utils/schemas.d.ts.map +1 -0
- package/dist/node/utils/selection.d.ts +14 -0
- package/dist/node/utils/selection.d.ts.map +1 -0
- package/dist/node/utils/validation.d.ts +17 -0
- package/dist/node/utils/validation.d.ts.map +1 -0
- package/dist/node/utils/wrapper.d.ts +18 -0
- package/dist/node/utils/wrapper.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +37 -45
- package/README.md +0 -275
- package/dist/actions/callToolAction.d.ts +0 -3
- package/dist/actions/callToolAction.d.ts.map +0 -1
- package/dist/actions/readResourceAction.d.ts +0 -3
- package/dist/actions/readResourceAction.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -33
- package/dist/provider.d.ts.map +0 -1
- package/dist/service.d.ts.map +0 -1
- package/dist/templates/errorAnalysisPrompt.d.ts +0 -2
- package/dist/templates/errorAnalysisPrompt.d.ts.map +0 -1
- package/dist/templates/feedbackTemplate.d.ts +0 -2
- package/dist/templates/feedbackTemplate.d.ts.map +0 -1
- package/dist/templates/resourceAnalysisTemplate.d.ts +0 -2
- package/dist/templates/resourceAnalysisTemplate.d.ts.map +0 -1
- package/dist/templates/resourceSelectionTemplate.d.ts +0 -2
- package/dist/templates/resourceSelectionTemplate.d.ts.map +0 -1
- package/dist/templates/toolReasoningTemplate.d.ts +0 -2
- package/dist/templates/toolReasoningTemplate.d.ts.map +0 -1
- package/dist/templates/toolSelectionTemplate.d.ts +0 -3
- package/dist/templates/toolSelectionTemplate.d.ts.map +0 -1
- package/dist/tool-compatibility/index.d.ts.map +0 -1
- package/dist/tool-compatibility/providers/anthropic.d.ts +0 -12
- package/dist/tool-compatibility/providers/anthropic.d.ts.map +0 -1
- package/dist/tool-compatibility/providers/google.d.ts +0 -12
- package/dist/tool-compatibility/providers/google.d.ts.map +0 -1
- package/dist/tool-compatibility/providers/openai.d.ts +0 -20
- package/dist/tool-compatibility/providers/openai.d.ts.map +0 -1
- package/dist/types.d.ts +0 -166
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/handler.d.ts +0 -3
- package/dist/utils/handler.d.ts.map +0 -1
- package/dist/utils/json.d.ts +0 -9
- package/dist/utils/json.d.ts.map +0 -1
- package/dist/utils/mcp.d.ts +0 -5
- package/dist/utils/mcp.d.ts.map +0 -1
- package/dist/utils/processing.d.ts +0 -43
- package/dist/utils/processing.d.ts.map +0 -1
- package/dist/utils/schemas.d.ts +0 -69
- package/dist/utils/schemas.d.ts.map +0 -1
- package/dist/utils/selection.d.ts +0 -38
- package/dist/utils/selection.d.ts.map +0 -1
- package/dist/utils/validation.d.ts +0 -34
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/wrapper.d.ts +0 -27
- package/dist/utils/wrapper.d.ts.map +0 -1
- /package/dist/{provider.d.ts → node/provider.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { McpToolCompatibility, type SchemaConstraints } from "../base";
|
|
2
|
+
export declare class AnthropicMcpCompatibility extends McpToolCompatibility {
|
|
3
|
+
shouldApply(): boolean;
|
|
4
|
+
protected getUnsupportedStringProperties(): readonly string[];
|
|
5
|
+
protected getUnsupportedNumberProperties(): readonly string[];
|
|
6
|
+
protected getUnsupportedArrayProperties(): readonly string[];
|
|
7
|
+
protected getUnsupportedObjectProperties(): readonly string[];
|
|
8
|
+
protected mergeDescription(originalDescription: string | undefined, constraints: SchemaConstraints): string;
|
|
9
|
+
private formatConstraintsForAnthropic;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../src/tool-compatibility/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQvE,qBAAa,yBAA0B,SAAQ,oBAAoB;IACjE,WAAW,IAAI,OAAO;IAItB,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,6BAA6B,IAAI,SAAS,MAAM,EAAE;IAI5D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,gBAAgB,CACxB,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,WAAW,EAAE,iBAAiB,GAC7B,MAAM;IAUT,OAAO,CAAC,6BAA6B;CAetC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { McpToolCompatibility, type SchemaConstraints } from "../base";
|
|
2
|
+
export declare class GoogleMcpCompatibility extends McpToolCompatibility {
|
|
3
|
+
shouldApply(): boolean;
|
|
4
|
+
protected getUnsupportedStringProperties(): readonly string[];
|
|
5
|
+
protected getUnsupportedNumberProperties(): readonly string[];
|
|
6
|
+
protected getUnsupportedArrayProperties(): readonly string[];
|
|
7
|
+
protected getUnsupportedObjectProperties(): readonly string[];
|
|
8
|
+
protected mergeDescription(originalDescription: string | undefined, constraints: SchemaConstraints): string;
|
|
9
|
+
private formatConstraintsForGoogle;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=google.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../src/tool-compatibility/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqBvE,qBAAa,sBAAuB,SAAQ,oBAAoB;IAC9D,WAAW,IAAI,OAAO;IAItB,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,6BAA6B,IAAI,SAAS,MAAM,EAAE;IAI5D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,gBAAgB,CACxB,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,WAAW,EAAE,iBAAiB,GAC7B,MAAM;IAUT,OAAO,CAAC,0BAA0B;CAiEnC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { McpToolCompatibility, type SchemaConstraints } from "../base";
|
|
2
|
+
export declare class OpenAIMcpCompatibility extends McpToolCompatibility {
|
|
3
|
+
shouldApply(): boolean;
|
|
4
|
+
protected getUnsupportedStringProperties(): readonly string[];
|
|
5
|
+
protected getUnsupportedNumberProperties(): readonly string[];
|
|
6
|
+
protected getUnsupportedArrayProperties(): readonly string[];
|
|
7
|
+
protected getUnsupportedObjectProperties(): readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare class OpenAIReasoningMcpCompatibility extends McpToolCompatibility {
|
|
10
|
+
shouldApply(): boolean;
|
|
11
|
+
protected getUnsupportedStringProperties(): readonly string[];
|
|
12
|
+
protected getUnsupportedNumberProperties(): readonly string[];
|
|
13
|
+
protected getUnsupportedArrayProperties(): readonly string[];
|
|
14
|
+
protected getUnsupportedObjectProperties(): readonly string[];
|
|
15
|
+
protected mergeDescription(originalDescription: string | undefined, constraints: SchemaConstraints): string;
|
|
16
|
+
private formatConstraintsForReasoningModel;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../../src/tool-compatibility/providers/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAcvE,qBAAa,sBAAuB,SAAQ,oBAAoB;IAC9D,WAAW,IAAI,OAAO;IAOtB,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAc7D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAO7D,SAAS,CAAC,6BAA6B,IAAI,SAAS,MAAM,EAAE;IAO5D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;CAG9D;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,IAAI,OAAO;IAItB,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,6BAA6B,IAAI,SAAS,MAAM,EAAE;IAI5D,SAAS,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IAI7D,SAAS,CAAC,gBAAgB,CACxB,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,WAAW,EAAE,iBAAiB,GAC7B,MAAM;IAUT,OAAO,CAAC,kCAAkC;CAuC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-example.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/test-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkH/C,wBAAsB,4BAA4B,kBAuDjD;AAqCD,wBAAsB,YAAY,yBAqBjC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import type { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
3
|
+
import type { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
|
+
import type { EmbeddedResource, ImageContent, Resource, ResourceTemplate, TextContent, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
export declare const MCP_SERVICE_NAME: "mcp";
|
|
6
|
+
export declare const DEFAULT_MCP_TIMEOUT_SECONDS = 60000;
|
|
7
|
+
export declare const MIN_MCP_TIMEOUT_SECONDS = 1;
|
|
8
|
+
export declare const DEFAULT_MAX_RETRIES = 2;
|
|
9
|
+
export interface PingConfig {
|
|
10
|
+
readonly enabled: boolean;
|
|
11
|
+
readonly intervalMs: number;
|
|
12
|
+
readonly timeoutMs: number;
|
|
13
|
+
readonly failuresBeforeDisconnect: number;
|
|
14
|
+
}
|
|
15
|
+
export type ConnectionStatus = "connecting" | "connected" | "disconnected" | "failed";
|
|
16
|
+
export interface ConnectionState {
|
|
17
|
+
status: ConnectionStatus;
|
|
18
|
+
pingInterval?: ReturnType<typeof setInterval>;
|
|
19
|
+
reconnectTimeout?: ReturnType<typeof setTimeout>;
|
|
20
|
+
reconnectAttempts: number;
|
|
21
|
+
lastConnected?: Date;
|
|
22
|
+
lastError?: Error;
|
|
23
|
+
consecutivePingFailures: number;
|
|
24
|
+
}
|
|
25
|
+
export interface StdioMcpServerConfig {
|
|
26
|
+
readonly type: "stdio";
|
|
27
|
+
readonly command: string;
|
|
28
|
+
readonly args?: readonly string[];
|
|
29
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
30
|
+
readonly cwd?: string;
|
|
31
|
+
readonly timeoutInMillis?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface HttpMcpServerConfig {
|
|
34
|
+
readonly type: "http" | "streamable-http" | "sse";
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly timeout?: number;
|
|
37
|
+
}
|
|
38
|
+
export type McpServerConfig = StdioMcpServerConfig | HttpMcpServerConfig;
|
|
39
|
+
export interface McpSettings {
|
|
40
|
+
readonly servers: Readonly<Record<string, McpServerConfig>>;
|
|
41
|
+
readonly maxRetries?: number;
|
|
42
|
+
}
|
|
43
|
+
export type McpServerStatus = "connecting" | "connected" | "disconnected";
|
|
44
|
+
export interface McpServer {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
status: McpServerStatus;
|
|
47
|
+
readonly config: string;
|
|
48
|
+
error?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
tools?: readonly Tool[];
|
|
51
|
+
resources?: readonly Resource[];
|
|
52
|
+
resourceTemplates?: readonly ResourceTemplate[];
|
|
53
|
+
}
|
|
54
|
+
export interface McpConnection {
|
|
55
|
+
server: McpServer;
|
|
56
|
+
readonly client: Client;
|
|
57
|
+
readonly transport: StdioClientTransport | SSEClientTransport;
|
|
58
|
+
}
|
|
59
|
+
export interface McpToolResult {
|
|
60
|
+
readonly content: ReadonlyArray<TextContent | ImageContent | EmbeddedResource>;
|
|
61
|
+
readonly isError?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface McpResourceContent {
|
|
64
|
+
readonly uri: string;
|
|
65
|
+
readonly mimeType?: string;
|
|
66
|
+
readonly text?: string;
|
|
67
|
+
readonly blob?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface McpResourceResponse {
|
|
70
|
+
readonly contents: readonly McpResourceContent[];
|
|
71
|
+
}
|
|
72
|
+
export interface McpToolInputSchema {
|
|
73
|
+
readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;
|
|
74
|
+
readonly required?: readonly string[];
|
|
75
|
+
readonly [key: string]: JsonSchemaValue | Readonly<Record<string, JsonSchemaProperty>> | readonly string[] | undefined;
|
|
76
|
+
}
|
|
77
|
+
export interface McpToolInfo {
|
|
78
|
+
readonly description: string;
|
|
79
|
+
readonly inputSchema?: McpToolInputSchema;
|
|
80
|
+
}
|
|
81
|
+
export interface McpResourceInfo {
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly description: string;
|
|
84
|
+
readonly mimeType?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface McpServerInfo {
|
|
87
|
+
readonly status: string;
|
|
88
|
+
readonly tools: Readonly<Record<string, McpToolInfo>>;
|
|
89
|
+
readonly resources: Readonly<Record<string, McpResourceInfo>>;
|
|
90
|
+
}
|
|
91
|
+
export interface McpProviderData {
|
|
92
|
+
readonly [serverName: string]: McpServerInfo;
|
|
93
|
+
}
|
|
94
|
+
export interface McpProviderValues {
|
|
95
|
+
readonly mcp: McpProviderData;
|
|
96
|
+
readonly mcpText?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface McpProvider {
|
|
99
|
+
readonly values: McpProviderValues;
|
|
100
|
+
readonly data: {
|
|
101
|
+
readonly mcp: McpProviderData;
|
|
102
|
+
};
|
|
103
|
+
readonly text: string;
|
|
104
|
+
}
|
|
105
|
+
export type JsonSchemaPrimitive = string | number | boolean | null;
|
|
106
|
+
export type JsonSchemaValue = JsonSchemaPrimitive | JsonSchemaObject | JsonSchemaArray;
|
|
107
|
+
export interface JsonSchemaObject {
|
|
108
|
+
readonly [key: string]: JsonSchemaValue;
|
|
109
|
+
}
|
|
110
|
+
export type JsonSchemaArray = readonly JsonSchemaValue[];
|
|
111
|
+
export interface JsonSchemaProperty {
|
|
112
|
+
readonly type?: string;
|
|
113
|
+
readonly description?: string;
|
|
114
|
+
readonly minLength?: number;
|
|
115
|
+
readonly maxLength?: number;
|
|
116
|
+
readonly pattern?: string;
|
|
117
|
+
readonly format?: string;
|
|
118
|
+
readonly enum?: readonly string[];
|
|
119
|
+
readonly minimum?: number;
|
|
120
|
+
readonly maximum?: number;
|
|
121
|
+
readonly items?: JsonSchemaProperty;
|
|
122
|
+
readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;
|
|
123
|
+
readonly required?: readonly string[];
|
|
124
|
+
readonly [key: string]: JsonSchemaValue | JsonSchemaProperty | Readonly<Record<string, JsonSchemaProperty>> | readonly string[] | undefined;
|
|
125
|
+
}
|
|
126
|
+
export declare const ToolSelectionSchema: {
|
|
127
|
+
readonly type: "object";
|
|
128
|
+
readonly required: readonly ["serverName", "toolName", "arguments"];
|
|
129
|
+
readonly properties: {
|
|
130
|
+
readonly serverName: {
|
|
131
|
+
readonly type: "string";
|
|
132
|
+
readonly minLength: 1;
|
|
133
|
+
readonly errorMessage: "serverName must not be empty";
|
|
134
|
+
};
|
|
135
|
+
readonly toolName: {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
readonly minLength: 1;
|
|
138
|
+
readonly errorMessage: "toolName must not be empty";
|
|
139
|
+
};
|
|
140
|
+
readonly arguments: {
|
|
141
|
+
readonly type: "object";
|
|
142
|
+
};
|
|
143
|
+
readonly reasoning: {
|
|
144
|
+
readonly type: "string";
|
|
145
|
+
};
|
|
146
|
+
readonly noToolAvailable: {
|
|
147
|
+
readonly type: "boolean";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export declare const ResourceSelectionSchema: {
|
|
152
|
+
readonly type: "object";
|
|
153
|
+
readonly required: readonly ["serverName", "uri"];
|
|
154
|
+
readonly properties: {
|
|
155
|
+
readonly serverName: {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
readonly minLength: 1;
|
|
158
|
+
readonly errorMessage: "serverName must not be empty";
|
|
159
|
+
};
|
|
160
|
+
readonly uri: {
|
|
161
|
+
readonly type: "string";
|
|
162
|
+
readonly minLength: 1;
|
|
163
|
+
readonly errorMessage: "uri must not be empty";
|
|
164
|
+
};
|
|
165
|
+
readonly reasoning: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
};
|
|
168
|
+
readonly noResourceAvailable: {
|
|
169
|
+
readonly type: "boolean";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
export declare const DEFAULT_PING_CONFIG: Readonly<PingConfig>;
|
|
174
|
+
export declare const MAX_RECONNECT_ATTEMPTS = 5;
|
|
175
|
+
export declare const BACKOFF_MULTIPLIER = 2;
|
|
176
|
+
export declare const INITIAL_RETRY_DELAY = 2000;
|
|
177
|
+
interface SuccessResult<T> {
|
|
178
|
+
readonly success: true;
|
|
179
|
+
readonly data: T;
|
|
180
|
+
}
|
|
181
|
+
interface ErrorResult {
|
|
182
|
+
readonly success: false;
|
|
183
|
+
readonly error: string;
|
|
184
|
+
}
|
|
185
|
+
export type ValidationResult<T> = SuccessResult<T> | ErrorResult;
|
|
186
|
+
export declare function assertNonNull<T>(value: T | null | undefined, message: string): T;
|
|
187
|
+
export declare function assertString(value: unknown, message: string): string;
|
|
188
|
+
export declare function assertNonEmptyString(value: unknown, message: string): string;
|
|
189
|
+
export declare function assertObject(value: unknown, message: string): Record<string, unknown>;
|
|
190
|
+
export {};
|
|
191
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,KAAK,EACV,gBAAgB,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AE,MAAM,GAAG,MAAM,CAK5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKrF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
3
|
-
import type { McpProvider } from
|
|
4
|
-
export declare function handleMcpError(state: State, mcpProvider: McpProvider, error: unknown, runtime: IAgentRuntime, message: Memory, type:
|
|
1
|
+
import type { State } from "@elizaos/core";
|
|
2
|
+
import { type ActionResult, type HandlerCallback, type IAgentRuntime, type Memory } from "@elizaos/core";
|
|
3
|
+
import type { McpProvider } from "../types";
|
|
4
|
+
export declare function handleMcpError(state: State, mcpProvider: McpProvider, error: unknown, runtime: IAgentRuntime, message: Memory, type: "tool" | "resource", callback?: HandlerCallback): Promise<ActionResult>;
|
|
5
5
|
export declare class McpError extends Error {
|
|
6
6
|
readonly code: string;
|
|
7
7
|
constructor(message: string, code?: string);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utils/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAsB,cAAc,CAClC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,YAAY,CAAC,CAkDvB;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkB;IAMrD,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ;IAOtE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ;IAInE,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ;IAOlE,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAIjD,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ;CAMnE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ActionResult, HandlerCallback } from "@elizaos/core";
|
|
2
|
+
interface ToolSelectionResult {
|
|
3
|
+
readonly noToolAvailable?: boolean;
|
|
4
|
+
readonly reasoning?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function handleNoToolAvailable(callback: HandlerCallback | undefined, toolSelection: ToolSelectionResult | null | undefined): Promise<ActionResult>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/utils/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEnE,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,aAAa,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GACpD,OAAO,CAAC,YAAY,CAAC,CAyBvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function parseJSON<T>(input: string): T;
|
|
2
|
+
export declare function validateJsonSchema<T>(data: unknown, schema: Readonly<Record<string, unknown>>): {
|
|
3
|
+
success: true;
|
|
4
|
+
data: T;
|
|
5
|
+
} | {
|
|
6
|
+
success: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function stringifyJSON(value: unknown): string;
|
|
10
|
+
export declare function assertJsonObject(value: unknown, context: string): Record<string, unknown>;
|
|
11
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAa7C;AAqBD,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAWhE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IAgentRuntime, Memory } from "@elizaos/core";
|
|
2
|
+
import type { McpProvider, McpServer } from "../types";
|
|
3
|
+
export declare function createMcpMemory(runtime: IAgentRuntime, message: Memory, type: "tool" | "resource", serverName: string, content: string, metadata: Readonly<Record<string, unknown>>): Promise<void>;
|
|
4
|
+
export declare function buildMcpProviderData(servers: readonly McpServer[]): McpProvider;
|
|
5
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/utils/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EACV,WAAW,EAGX,SAAS,EAGV,MAAM,UAAU,CAAC;AAElB,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,WAAW,CA6D/E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type HandlerCallback, type IAgentRuntime, type Media, type Memory, type State } from "@elizaos/core";
|
|
2
|
+
import type { McpProviderData, McpResourceContent } from "../types";
|
|
3
|
+
interface ResourceResult {
|
|
4
|
+
readonly contents: readonly McpResourceContent[];
|
|
5
|
+
}
|
|
6
|
+
export declare function processResourceResult(result: ResourceResult, uri: string): {
|
|
7
|
+
resourceContent: string;
|
|
8
|
+
resourceMeta: string;
|
|
9
|
+
};
|
|
10
|
+
interface ToolContentItem {
|
|
11
|
+
readonly type: string;
|
|
12
|
+
readonly text?: string;
|
|
13
|
+
readonly mimeType?: string;
|
|
14
|
+
readonly data?: string;
|
|
15
|
+
readonly resource?: {
|
|
16
|
+
readonly uri: string;
|
|
17
|
+
readonly text?: string;
|
|
18
|
+
readonly blob?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface ToolResult {
|
|
22
|
+
readonly content: readonly ToolContentItem[];
|
|
23
|
+
readonly isError?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function processToolResult(result: ToolResult, serverName: string, toolName: string, runtime: IAgentRuntime, messageEntityId: string): {
|
|
26
|
+
toolOutput: string;
|
|
27
|
+
hasAttachments: boolean;
|
|
28
|
+
attachments: Media[];
|
|
29
|
+
};
|
|
30
|
+
export declare function handleResourceAnalysis(runtime: IAgentRuntime, message: Memory, uri: string, serverName: string, resourceContent: string, resourceMeta: string, callback?: HandlerCallback): Promise<void>;
|
|
31
|
+
interface McpProviderArg {
|
|
32
|
+
readonly values: {
|
|
33
|
+
readonly mcp: McpProviderData;
|
|
34
|
+
};
|
|
35
|
+
readonly data: {
|
|
36
|
+
readonly mcp: McpProviderData;
|
|
37
|
+
};
|
|
38
|
+
readonly text: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function handleToolResponse(runtime: IAgentRuntime, message: Memory, serverName: string, toolName: string, toolArgs: Readonly<Record<string, unknown>>, toolOutput: string, hasAttachments: boolean, attachments: readonly Media[], state: State, mcpProvider: McpProviderArg, callback?: HandlerCallback): Promise<Memory>;
|
|
41
|
+
export declare function sendInitialResponse(callback?: HandlerCallback): Promise<void>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=processing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.d.ts","sourceRoot":"","sources":["../../../src/utils/processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAcpE,UAAU,cAAc;IACtB,QAAQ,CAAC,QAAQ,EAA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;IACtB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAA;KAAE,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC3C,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,OAAO,EACvB,WAAW,EAAE,SAAS,KAAK,EAAE,EAC7B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,cAAc,EAC3B,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const toolSelectionNameSchema: {
|
|
2
|
+
readonly type: "object";
|
|
3
|
+
readonly required: readonly ["serverName", "toolName"];
|
|
4
|
+
readonly properties: {
|
|
5
|
+
readonly serverName: {
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
readonly minLength: 1;
|
|
8
|
+
readonly errorMessage: "serverName must not be empty";
|
|
9
|
+
};
|
|
10
|
+
readonly toolName: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly errorMessage: "toolName must not be empty";
|
|
14
|
+
};
|
|
15
|
+
readonly reasoning: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
};
|
|
18
|
+
readonly noToolAvailable: {
|
|
19
|
+
readonly type: "boolean";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export interface ToolSelectionName {
|
|
24
|
+
readonly serverName: string;
|
|
25
|
+
readonly toolName: string;
|
|
26
|
+
readonly reasoning?: string;
|
|
27
|
+
readonly noToolAvailable?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const toolSelectionArgumentSchema: {
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly required: readonly ["toolArguments"];
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly toolArguments: {
|
|
34
|
+
readonly type: "object";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export interface ToolSelectionArgument {
|
|
39
|
+
readonly toolArguments: Readonly<Record<string, unknown>>;
|
|
40
|
+
}
|
|
41
|
+
export declare const ResourceSelectionSchema: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly required: readonly ["serverName", "uri"];
|
|
44
|
+
readonly properties: {
|
|
45
|
+
readonly serverName: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly minLength: 1;
|
|
48
|
+
readonly errorMessage: "serverName must not be empty";
|
|
49
|
+
};
|
|
50
|
+
readonly uri: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly minLength: 1;
|
|
53
|
+
readonly errorMessage: "uri must not be empty";
|
|
54
|
+
};
|
|
55
|
+
readonly reasoning: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
};
|
|
58
|
+
readonly noResourceAvailable: {
|
|
59
|
+
readonly type: "boolean";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export interface ResourceSelection {
|
|
64
|
+
readonly serverName: string;
|
|
65
|
+
readonly uri: string;
|
|
66
|
+
readonly reasoning?: string;
|
|
67
|
+
readonly noResourceAvailable?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function isToolSelectionName(value: unknown): value is ToolSelectionName;
|
|
70
|
+
export declare function isToolSelectionArgument(value: unknown): value is ToolSelectionArgument;
|
|
71
|
+
export declare function isResourceSelection(value: unknown): value is ResourceSelection;
|
|
72
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/utils/schemas.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,2BAA2B;;;;;;;;CAQ9B,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAW9E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAMtF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAW9E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HandlerCallback, type IAgentRuntime, type Memory, type State } from "@elizaos/core";
|
|
2
|
+
import type { McpProvider } from "../types";
|
|
3
|
+
import type { ToolSelectionArgument, ToolSelectionName } from "./schemas";
|
|
4
|
+
export interface CreateToolSelectionOptions {
|
|
5
|
+
readonly runtime: IAgentRuntime;
|
|
6
|
+
readonly state: State;
|
|
7
|
+
readonly message: Memory;
|
|
8
|
+
readonly callback?: HandlerCallback;
|
|
9
|
+
readonly mcpProvider: McpProvider;
|
|
10
|
+
readonly toolSelectionName?: ToolSelectionName;
|
|
11
|
+
}
|
|
12
|
+
export declare function createToolSelectionName({ runtime, state, message, callback, mcpProvider, }: CreateToolSelectionOptions): Promise<ToolSelectionName | null>;
|
|
13
|
+
export declare function createToolSelectionArgument({ runtime, state, message, callback, mcpProvider, toolSelectionName, }: CreateToolSelectionOptions): Promise<ToolSelectionArgument | null>;
|
|
14
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/utils/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,EAAE,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA0BhE;AAED,wBAAsB,2BAA2B,CAAC,EAChD,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,EACX,iBAAiB,GAClB,EAAE,0BAA0B,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAmDpE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { State } from "@elizaos/core";
|
|
2
|
+
import { type ValidationResult } from "../types";
|
|
3
|
+
import { type ResourceSelection, type ToolSelectionArgument, type ToolSelectionName } from "./schemas";
|
|
4
|
+
export type { ResourceSelection } from "./schemas";
|
|
5
|
+
export interface ToolSelection {
|
|
6
|
+
readonly serverName: string;
|
|
7
|
+
readonly toolName: string;
|
|
8
|
+
readonly arguments: Readonly<Record<string, unknown>>;
|
|
9
|
+
readonly reasoning?: string;
|
|
10
|
+
readonly noToolAvailable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function validateToolSelectionName(parsed: unknown, state: State): ValidationResult<ToolSelectionName>;
|
|
13
|
+
export declare function validateToolSelectionArgument(parsed: unknown, toolInputSchema: Readonly<Record<string, unknown>>): ValidationResult<ToolSelectionArgument>;
|
|
14
|
+
export declare function validateResourceSelection(selection: unknown): ValidationResult<ResourceSelection>;
|
|
15
|
+
export declare function createToolSelectionFeedbackPrompt(originalResponse: string, errorMessage: string, composedState: State, userMessage: string): string;
|
|
16
|
+
export declare function createResourceSelectionFeedbackPrompt(originalResponse: string, errorMessage: string, composedState: State, userMessage: string): string;
|
|
17
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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1
|
+
import { type HandlerCallback, type IAgentRuntime, type Memory, type State } from "@elizaos/core";
|
|
2
|
+
import { type ValidationResult } from "../types";
|
|
3
|
+
export type Input = string | Record<string, unknown>;
|
|
4
|
+
type CreateFeedbackPromptFn = (originalResponse: Input, errorMessage: string, composedState: State, userMessage: string) => string;
|
|
5
|
+
export interface WithModelRetryOptions<T> {
|
|
6
|
+
readonly runtime: IAgentRuntime;
|
|
7
|
+
readonly message: Memory;
|
|
8
|
+
readonly state: State;
|
|
9
|
+
readonly input: Input;
|
|
10
|
+
readonly validationFn: (data: Input) => ValidationResult<T>;
|
|
11
|
+
readonly createFeedbackPromptFn: CreateFeedbackPromptFn;
|
|
12
|
+
readonly callback?: HandlerCallback;
|
|
13
|
+
readonly failureMsg?: string;
|
|
14
|
+
readonly retryCount?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function withModelRetry<T>({ runtime, message, state, callback, input, validationFn, createFeedbackPromptFn, failureMsg, retryCount, }: WithModelRetryOptions<T>): Promise<T | null>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/utils/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGxF,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,KAAK,sBAAsB,GAAG,CAC5B,gBAAgB,EAAE,KAAK,EACvB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,KAAK,EACpB,WAAW,EAAE,MAAM,KAChB,MAAM,CAAC;AAEZ,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACt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