@morphllm/morphsdk 0.2.45 → 0.2.47
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/README.md +1 -1
- package/dist/{chunk-TVFGHXPE.js → chunk-3FTAIJBH.js} +4 -4
- package/dist/{chunk-ZRLEAPZV.js → chunk-76DJEQEP.js} +4 -4
- package/dist/{chunk-W3XLPMV3.js → chunk-7HS6YXA3.js} +21 -5
- package/dist/{chunk-W3XLPMV3.js.map → chunk-7HS6YXA3.js.map} +1 -1
- package/dist/chunk-BLXC5R4W.js +82 -0
- package/dist/chunk-BLXC5R4W.js.map +1 -0
- package/dist/chunk-FA6UGPVL.js +105 -0
- package/dist/chunk-FA6UGPVL.js.map +1 -0
- package/dist/{chunk-PEGZVGG4.js → chunk-G4AWE5A2.js} +4 -4
- package/dist/{chunk-OUEJ6XEO.js → chunk-GJU7UOFL.js} +4 -4
- package/dist/{chunk-Q7PDN7TS.js → chunk-GZMUGMOZ.js} +1 -1
- package/dist/{chunk-Q7PDN7TS.js.map → chunk-GZMUGMOZ.js.map} +1 -1
- package/dist/chunk-JYBVRF72.js +1 -0
- package/dist/chunk-OOZSGWSK.js +70 -0
- package/dist/chunk-OOZSGWSK.js.map +1 -0
- package/dist/{chunk-GDR65N2J.js → chunk-OXHGFHEU.js} +53 -26
- package/dist/chunk-OXHGFHEU.js.map +1 -0
- package/dist/{chunk-VBBJGWHY.js → chunk-P2XKFWFD.js} +2 -2
- package/dist/chunk-RAKREIXE.js +76 -0
- package/dist/chunk-RAKREIXE.js.map +1 -0
- package/dist/chunk-SDI2FI6G.js +283 -0
- package/dist/chunk-SDI2FI6G.js.map +1 -0
- package/dist/{chunk-GTOXMAF2.js → chunk-SWQPIKPY.js} +44 -3
- package/dist/chunk-SWQPIKPY.js.map +1 -0
- package/dist/chunk-TJIUA27P.js +94 -0
- package/dist/chunk-TJIUA27P.js.map +1 -0
- package/dist/{chunk-O5DA5V5S.js → chunk-UBX7QYBD.js} +4 -4
- package/dist/{chunk-UYBIKZPM.js → chunk-UCWTZSW5.js} +3 -3
- package/dist/{chunk-X4CQ6D3G.js → chunk-UIZT3KVJ.js} +4 -4
- package/dist/chunk-WETRQJGU.js +129 -0
- package/dist/chunk-WETRQJGU.js.map +1 -0
- package/dist/{chunk-RSLIOCOE.js → chunk-XQIVYQD6.js} +3 -2
- package/dist/chunk-XQIVYQD6.js.map +1 -0
- package/dist/client-BGctTHu9.d.ts +318 -0
- package/dist/client.cjs +1886 -44
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +14 -110
- package/dist/client.js +28 -3
- package/dist/core-DxiUwyBe.d.ts +156 -0
- package/dist/git/client.cjs +52 -25
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.d.ts +17 -8
- package/dist/git/client.js +1 -1
- package/dist/git/index.cjs +52 -25
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.d.ts +1 -1
- package/dist/git/index.js +2 -2
- package/dist/git/types.cjs.map +1 -1
- package/dist/git/types.d.ts +20 -2
- package/dist/index.cjs +1965 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +47 -5
- package/dist/tools/codebase_search/anthropic.js +2 -2
- package/dist/tools/codebase_search/index.js +9 -9
- package/dist/tools/codebase_search/openai.js +2 -2
- package/dist/tools/codebase_search/vercel.js +2 -2
- package/dist/tools/fastapply/anthropic.js +2 -2
- package/dist/tools/fastapply/index.js +7 -7
- package/dist/tools/fastapply/openai.js +2 -2
- package/dist/tools/fastapply/vercel.js +2 -2
- package/dist/tools/index.js +7 -7
- package/dist/tools/warp_grep/agent/config.cjs +80 -1
- package/dist/tools/warp_grep/agent/config.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/config.js +1 -1
- package/dist/tools/warp_grep/agent/parser.cjs +43 -2
- package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/parser.js +1 -1
- package/dist/tools/warp_grep/agent/prompt.cjs +89 -45
- package/dist/tools/warp_grep/agent/prompt.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/prompt.d.ts +1 -1
- package/dist/tools/warp_grep/agent/prompt.js +1 -1
- package/dist/tools/warp_grep/agent/runner.cjs +229 -49
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +4 -4
- package/dist/tools/warp_grep/agent/types.js +0 -1
- package/dist/tools/warp_grep/anthropic.cjs +313 -84
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +75 -12
- package/dist/tools/warp_grep/anthropic.js +22 -9
- package/dist/tools/warp_grep/index.cjs +417 -127
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +17 -4
- package/dist/tools/warp_grep/index.js +30 -22
- package/dist/tools/warp_grep/openai.cjs +316 -84
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +73 -29
- package/dist/tools/warp_grep/openai.js +22 -9
- package/dist/tools/warp_grep/providers/command.cjs +80 -1
- package/dist/tools/warp_grep/providers/command.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/command.js +2 -2
- package/dist/tools/warp_grep/providers/local.cjs +82 -2
- package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/local.js +3 -3
- package/dist/tools/warp_grep/utils/ripgrep.cjs +2 -1
- package/dist/tools/warp_grep/utils/ripgrep.cjs.map +1 -1
- package/dist/tools/warp_grep/utils/ripgrep.js +1 -1
- package/dist/tools/warp_grep/vercel.cjs +293 -58
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +40 -19
- package/dist/tools/warp_grep/vercel.js +18 -9
- package/package.json +2 -1
- package/dist/chunk-AFEPUNAO.js +0 -15
- package/dist/chunk-AFEPUNAO.js.map +0 -1
- package/dist/chunk-GDR65N2J.js.map +0 -1
- package/dist/chunk-GTOXMAF2.js.map +0 -1
- package/dist/chunk-HKZB23U7.js +0 -85
- package/dist/chunk-HKZB23U7.js.map +0 -1
- package/dist/chunk-IQHKEIQX.js +0 -54
- package/dist/chunk-IQHKEIQX.js.map +0 -1
- package/dist/chunk-JKFVDM62.js +0 -45
- package/dist/chunk-JKFVDM62.js.map +0 -1
- package/dist/chunk-K6FQZZ2E.js +0 -104
- package/dist/chunk-K6FQZZ2E.js.map +0 -1
- package/dist/chunk-KL4YVZRF.js +0 -57
- package/dist/chunk-KL4YVZRF.js.map +0 -1
- package/dist/chunk-RSLIOCOE.js.map +0 -1
- package/dist/chunk-XYPMN4A3.js +0 -1
- /package/dist/{chunk-TVFGHXPE.js.map → chunk-3FTAIJBH.js.map} +0 -0
- /package/dist/{chunk-ZRLEAPZV.js.map → chunk-76DJEQEP.js.map} +0 -0
- /package/dist/{chunk-PEGZVGG4.js.map → chunk-G4AWE5A2.js.map} +0 -0
- /package/dist/{chunk-OUEJ6XEO.js.map → chunk-GJU7UOFL.js.map} +0 -0
- /package/dist/{chunk-XYPMN4A3.js.map → chunk-JYBVRF72.js.map} +0 -0
- /package/dist/{chunk-VBBJGWHY.js.map → chunk-P2XKFWFD.js.map} +0 -0
- /package/dist/{chunk-O5DA5V5S.js.map → chunk-UBX7QYBD.js.map} +0 -0
- /package/dist/{chunk-UYBIKZPM.js.map → chunk-UCWTZSW5.js.map} +0 -0
- /package/dist/{chunk-X4CQ6D3G.js.map → chunk-UIZT3KVJ.js.map} +0 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { RetryConfig } from './tools/utils/resilience.js';
|
|
2
|
+
import { FastApplyClient } from './tools/fastapply/core.js';
|
|
3
|
+
import { CodebaseSearchClient } from './tools/codebase_search/core.js';
|
|
4
|
+
import { BrowserClient } from './tools/browser/core.js';
|
|
5
|
+
import { e as WarpGrepToolConfig, c as WarpGrepResult, d as WarpGrepContext, W as WarpGrepClient } from './core-DxiUwyBe.js';
|
|
6
|
+
import { MorphGit } from './git/client.js';
|
|
7
|
+
import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter } from './modelrouter/core.js';
|
|
8
|
+
import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
|
|
9
|
+
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
|
|
10
|
+
import * as openai_resources_index_mjs from 'openai/resources/index.mjs';
|
|
11
|
+
import * as _anthropic_ai_sdk_resources_messages_mjs from '@anthropic-ai/sdk/resources/messages.mjs';
|
|
12
|
+
import * as ai from 'ai';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Factory for creating OpenAI-compatible tools with inherited API key
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
|
|
20
|
+
*
|
|
21
|
+
* const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
|
|
22
|
+
* const searchTool = morph.openai.createCodebaseSearchTool({ repoId: 'my-project' });
|
|
23
|
+
* const editTool = morph.openai.createEditFileTool({ baseDir: './src' });
|
|
24
|
+
*
|
|
25
|
+
* // Use with OpenAI client
|
|
26
|
+
* const response = await openai.chat.completions.create({
|
|
27
|
+
* model: 'gpt-4o',
|
|
28
|
+
* tools: [grepTool, searchTool, editTool],
|
|
29
|
+
* messages: [{ role: 'user', content: 'Find and fix the bug' }]
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class OpenAIToolFactory {
|
|
34
|
+
private config;
|
|
35
|
+
constructor(config: MorphClientConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Create an OpenAI-compatible warp grep tool
|
|
38
|
+
*
|
|
39
|
+
* @param toolConfig - Tool configuration (apiKey inherited from MorphClient)
|
|
40
|
+
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
41
|
+
*/
|
|
42
|
+
createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'apiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
|
|
43
|
+
execute: (input: unknown) => Promise<WarpGrepResult>;
|
|
44
|
+
formatResult: (result: WarpGrepResult) => string;
|
|
45
|
+
getSystemPrompt: () => string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Create an OpenAI-compatible codebase search tool
|
|
49
|
+
*
|
|
50
|
+
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
51
|
+
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
52
|
+
*/
|
|
53
|
+
createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
|
|
54
|
+
execute: (input: CodebaseSearchInput | string) => Promise<CodebaseSearchResult>;
|
|
55
|
+
formatResult: (result: CodebaseSearchResult) => string;
|
|
56
|
+
getSystemPrompt: () => string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Create an OpenAI-compatible edit file tool
|
|
60
|
+
*
|
|
61
|
+
* @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
|
|
62
|
+
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
63
|
+
*/
|
|
64
|
+
createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
|
|
65
|
+
execute: (input: EditFileInput | string) => Promise<EditFileResult>;
|
|
66
|
+
formatResult: (result: EditFileResult) => string;
|
|
67
|
+
getSystemPrompt: () => string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Factory for creating Anthropic-compatible tools with inherited API key
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
|
|
77
|
+
*
|
|
78
|
+
* const grepTool = morph.anthropic.createWarpGrepTool({ repoRoot: '.' });
|
|
79
|
+
* const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'my-project' });
|
|
80
|
+
* const editTool = morph.anthropic.createEditFileTool({ baseDir: './src' });
|
|
81
|
+
*
|
|
82
|
+
* // Use with Anthropic client
|
|
83
|
+
* const response = await anthropic.messages.create({
|
|
84
|
+
* model: 'claude-sonnet-4-5-20250929',
|
|
85
|
+
* tools: [grepTool, searchTool, editTool],
|
|
86
|
+
* messages: [{ role: 'user', content: 'Find and fix the bug' }]
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare class AnthropicToolFactory {
|
|
91
|
+
private config;
|
|
92
|
+
constructor(config: MorphClientConfig);
|
|
93
|
+
/**
|
|
94
|
+
* Create an Anthropic-compatible warp grep tool
|
|
95
|
+
*
|
|
96
|
+
* @param toolConfig - Tool configuration (apiKey inherited from MorphClient)
|
|
97
|
+
* @returns Anthropic Tool with execute and formatResult methods
|
|
98
|
+
*/
|
|
99
|
+
createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'apiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
|
|
100
|
+
execute: (input: unknown) => Promise<WarpGrepResult>;
|
|
101
|
+
formatResult: (result: WarpGrepResult) => string;
|
|
102
|
+
getSystemPrompt: () => string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Create an Anthropic-compatible codebase search tool
|
|
106
|
+
*
|
|
107
|
+
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
108
|
+
* @returns Anthropic Tool with execute and formatResult methods
|
|
109
|
+
*/
|
|
110
|
+
createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
|
|
111
|
+
execute: (input: CodebaseSearchInput) => Promise<CodebaseSearchResult>;
|
|
112
|
+
formatResult: (result: CodebaseSearchResult) => string;
|
|
113
|
+
getSystemPrompt: () => string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Create an Anthropic-compatible edit file tool
|
|
117
|
+
*
|
|
118
|
+
* @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
|
|
119
|
+
* @returns Anthropic Tool with execute and formatResult methods
|
|
120
|
+
*/
|
|
121
|
+
createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
|
|
122
|
+
execute: (input: EditFileInput) => Promise<EditFileResult>;
|
|
123
|
+
formatResult: (result: EditFileResult) => string;
|
|
124
|
+
getSystemPrompt: () => string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Factory for creating Vercel AI SDK-compatible tools with inherited API key
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
|
|
134
|
+
*
|
|
135
|
+
* const grepTool = morph.vercel.createWarpGrepTool({ repoRoot: '.' });
|
|
136
|
+
* const searchTool = morph.vercel.createCodebaseSearchTool({ repoId: 'my-project' });
|
|
137
|
+
* const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
|
|
138
|
+
*
|
|
139
|
+
* // Use with Vercel AI SDK
|
|
140
|
+
* const result = await generateText({
|
|
141
|
+
* model: anthropic('claude-sonnet-4-5-20250929'),
|
|
142
|
+
* tools: { grep: grepTool, search: searchTool, edit: editTool },
|
|
143
|
+
* prompt: 'Find and fix the bug'
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare class VercelToolFactory {
|
|
148
|
+
private config;
|
|
149
|
+
constructor(config: MorphClientConfig);
|
|
150
|
+
/**
|
|
151
|
+
* Create a Vercel AI SDK-compatible warp grep tool
|
|
152
|
+
*
|
|
153
|
+
* @param toolConfig - Tool configuration (apiKey inherited from MorphClient)
|
|
154
|
+
* @returns Vercel AI SDK tool
|
|
155
|
+
*/
|
|
156
|
+
createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'apiKey'>): ai.Tool<{
|
|
157
|
+
query: string;
|
|
158
|
+
}, {
|
|
159
|
+
success: boolean;
|
|
160
|
+
error: string;
|
|
161
|
+
contexts?: undefined;
|
|
162
|
+
summary?: undefined;
|
|
163
|
+
} | {
|
|
164
|
+
success: boolean;
|
|
165
|
+
contexts: WarpGrepContext[];
|
|
166
|
+
summary: string;
|
|
167
|
+
error?: undefined;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a Vercel AI SDK-compatible codebase search tool
|
|
171
|
+
*
|
|
172
|
+
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
173
|
+
* @returns Vercel AI SDK tool
|
|
174
|
+
*/
|
|
175
|
+
createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): ai.Tool<{
|
|
176
|
+
query: string;
|
|
177
|
+
target_directories: string[];
|
|
178
|
+
explanation: string;
|
|
179
|
+
limit?: number | undefined;
|
|
180
|
+
}, {
|
|
181
|
+
error: string | undefined;
|
|
182
|
+
results: never[];
|
|
183
|
+
found?: undefined;
|
|
184
|
+
searchTime?: undefined;
|
|
185
|
+
} | {
|
|
186
|
+
found: number;
|
|
187
|
+
searchTime: string;
|
|
188
|
+
results: {
|
|
189
|
+
file: string;
|
|
190
|
+
symbol: string;
|
|
191
|
+
lines: string;
|
|
192
|
+
language: string;
|
|
193
|
+
relevance: string;
|
|
194
|
+
code: string;
|
|
195
|
+
}[];
|
|
196
|
+
error?: undefined;
|
|
197
|
+
}>;
|
|
198
|
+
/**
|
|
199
|
+
* Create a Vercel AI SDK-compatible edit file tool
|
|
200
|
+
*
|
|
201
|
+
* @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
|
|
202
|
+
* @returns Vercel AI SDK tool
|
|
203
|
+
*/
|
|
204
|
+
createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): ai.Tool<{
|
|
205
|
+
target_filepath: string;
|
|
206
|
+
instructions: string;
|
|
207
|
+
code_edit: string;
|
|
208
|
+
}, {
|
|
209
|
+
success: boolean;
|
|
210
|
+
filepath: string;
|
|
211
|
+
changes: EditChanges;
|
|
212
|
+
udiff: string | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Unified Morph SDK Client
|
|
218
|
+
*
|
|
219
|
+
* Provides access to all Morph tools through a single interface
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* import { MorphClient } from '@morphllm/morphsdk';
|
|
224
|
+
*
|
|
225
|
+
* const morph = new MorphClient({
|
|
226
|
+
* apiKey: process.env.MORPH_API_KEY,
|
|
227
|
+
* debug: true,
|
|
228
|
+
* timeout: 60000
|
|
229
|
+
* });
|
|
230
|
+
*
|
|
231
|
+
* // Direct execution
|
|
232
|
+
* await morph.fastApply.execute({ target_filepath: 'src/index.ts', ... });
|
|
233
|
+
* await morph.warpGrep.execute({ query: 'Find auth', repoRoot: '.' });
|
|
234
|
+
* await morph.codebaseSearch.search({ query: 'auth logic', repoId: 'x' });
|
|
235
|
+
*
|
|
236
|
+
* // Tool creation for AI agents (API key inherited)
|
|
237
|
+
* const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
|
|
238
|
+
* const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'x' });
|
|
239
|
+
* const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
|
|
240
|
+
*
|
|
241
|
+
* // Use tools with OpenAI
|
|
242
|
+
* const response = await openai.chat.completions.create({
|
|
243
|
+
* model: 'gpt-4o',
|
|
244
|
+
* tools: [grepTool],
|
|
245
|
+
* messages: [{ role: 'user', content: 'Find the bug' }]
|
|
246
|
+
* });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Configuration for the MorphClient
|
|
252
|
+
*/
|
|
253
|
+
interface MorphClientConfig {
|
|
254
|
+
/** Morph API key for authentication (defaults to MORPH_API_KEY env var) */
|
|
255
|
+
apiKey?: string;
|
|
256
|
+
/** Enable debug logging across all tools */
|
|
257
|
+
debug?: boolean;
|
|
258
|
+
/** Default timeout in milliseconds for API requests */
|
|
259
|
+
timeout?: number;
|
|
260
|
+
/** Retry configuration for failed requests */
|
|
261
|
+
retryConfig?: RetryConfig;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Unified Morph SDK Client
|
|
265
|
+
*
|
|
266
|
+
* Provides access to all Morph tools through a single interface:
|
|
267
|
+
* - fastApply: AI-powered file editing with intelligent merging
|
|
268
|
+
* - codebaseSearch: Semantic code search
|
|
269
|
+
* - warpGrep: Fast code search with ripgrep
|
|
270
|
+
* - browser: AI-powered browser automation
|
|
271
|
+
* - git: Version control operations
|
|
272
|
+
* - routers: Intelligent model selection (OpenAI, Anthropic, Gemini)
|
|
273
|
+
* - openai/anthropic/vercel: Tool factories for agent frameworks
|
|
274
|
+
*/
|
|
275
|
+
declare class MorphClient {
|
|
276
|
+
/** Client configuration */
|
|
277
|
+
config: MorphClientConfig;
|
|
278
|
+
/** FastApply tool for editing files with AI-powered merge */
|
|
279
|
+
fastApply: FastApplyClient;
|
|
280
|
+
/** CodebaseSearch tool for semantic code search */
|
|
281
|
+
codebaseSearch: CodebaseSearchClient;
|
|
282
|
+
/** WarpGrep tool for fast code search using ripgrep */
|
|
283
|
+
warpGrep: WarpGrepClient;
|
|
284
|
+
/** Browser tool for AI-powered browser automation */
|
|
285
|
+
browser: BrowserClient;
|
|
286
|
+
/** Git tool for version control operations */
|
|
287
|
+
git: MorphGit;
|
|
288
|
+
/** Model routers for intelligent model selection */
|
|
289
|
+
routers: {
|
|
290
|
+
openai: OpenAIRouter;
|
|
291
|
+
anthropic: AnthropicRouter;
|
|
292
|
+
gemini: GeminiRouter;
|
|
293
|
+
raw: RawRouter;
|
|
294
|
+
};
|
|
295
|
+
/** OpenAI-compatible tool factories */
|
|
296
|
+
openai: OpenAIToolFactory;
|
|
297
|
+
/** Anthropic-compatible tool factories */
|
|
298
|
+
anthropic: AnthropicToolFactory;
|
|
299
|
+
/** Vercel AI SDK tool factories */
|
|
300
|
+
vercel: VercelToolFactory;
|
|
301
|
+
/**
|
|
302
|
+
* Create a new Morph SDK client
|
|
303
|
+
*
|
|
304
|
+
* @param config - Client configuration (apiKey, debug, timeout, retryConfig)
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* const morph = new MorphClient({
|
|
309
|
+
* apiKey: process.env.MORPH_API_KEY,
|
|
310
|
+
* debug: true,
|
|
311
|
+
* timeout: 60000
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
constructor(config?: MorphClientConfig);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export { AnthropicToolFactory as A, MorphClient as M, OpenAIToolFactory as O, VercelToolFactory as V, type MorphClientConfig as a };
|