@morphllm/morphsdk 0.2.69 → 0.2.71
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/dist/{chunk-XFCMTW5L.js → chunk-4WJSTOHP.js} +3 -16
- package/dist/{chunk-XFCMTW5L.js.map → chunk-4WJSTOHP.js.map} +1 -1
- package/dist/chunk-B5A4XLSQ.js +10 -0
- package/dist/chunk-B5A4XLSQ.js.map +1 -0
- package/dist/{chunk-B3J2O2NW.js → chunk-BPVNNJ6D.js} +5 -5
- package/dist/{chunk-Q6GHKKS5.js → chunk-IYLEB6BY.js} +3 -15
- package/dist/{chunk-Q6GHKKS5.js.map → chunk-IYLEB6BY.js.map} +1 -1
- package/dist/{chunk-E4434A4Y.js → chunk-NGF2VIQV.js} +2 -2
- package/dist/{chunk-P6OEPI4N.js → chunk-POVU2CPK.js} +4 -20
- package/dist/{chunk-P6OEPI4N.js.map → chunk-POVU2CPK.js.map} +1 -1
- package/dist/{chunk-SUBBMTMY.js → chunk-RRWN62VU.js} +2 -2
- package/dist/chunk-RRWN62VU.js.map +1 -0
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +6 -6
- package/dist/index.cjs +6 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -8
- package/dist/tools/warp_grep/agent/runner.cjs +1 -1
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +1 -1
- package/dist/tools/warp_grep/anthropic.cjs +1 -1
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +78 -3
- package/dist/tools/warp_grep/anthropic.js +3 -3
- package/dist/tools/warp_grep/client.cjs +1 -1
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +2 -2
- package/dist/tools/warp_grep/gemini.cjs +3 -4
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +109 -3
- package/dist/tools/warp_grep/gemini.js +46 -9
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +7 -188
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +89 -9
- package/dist/tools/warp_grep/index.js +5 -18
- package/dist/tools/warp_grep/openai.cjs +1 -1
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +78 -3
- package/dist/tools/warp_grep/openai.js +3 -3
- package/dist/tools/warp_grep/vercel.cjs +1 -1
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +56 -3
- package/dist/tools/warp_grep/vercel.js +3 -3
- package/package.json +1 -1
- package/dist/anthropic-BC-AMEIN.d.ts +0 -89
- package/dist/chunk-2LSVUHIE.js +0 -75
- package/dist/chunk-2LSVUHIE.js.map +0 -1
- package/dist/chunk-ISWL67SF.js +0 -1
- package/dist/chunk-ISWL67SF.js.map +0 -1
- package/dist/chunk-SUBBMTMY.js.map +0 -1
- package/dist/gemini-BIFBiIjY.d.ts +0 -119
- package/dist/openai-Beb9escY.d.ts +0 -89
- package/dist/vercel-Bo84tpBe.d.ts +0 -66
- /package/dist/{chunk-B3J2O2NW.js.map → chunk-BPVNNJ6D.js.map} +0 -0
- /package/dist/{chunk-E4434A4Y.js.map → chunk-NGF2VIQV.js.map} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
export { WarpGrepClient, executeToolCall, executeWarpGrep, formatResult } from './client.js';
|
|
2
3
|
export { R as RemoteCommands, W as WarpGrepClientConfig, c as WarpGrepContext, a as WarpGrepInput, b as WarpGrepResult, d as WarpGrepToolConfig } from '../../types-CnvVDM63.js';
|
|
3
4
|
export { GrepResult, ListDirectoryEntry, ReadResult, WarpGrepProvider } from './providers/types.js';
|
|
@@ -7,15 +8,7 @@ export { runWarpGrep } from './agent/runner.js';
|
|
|
7
8
|
export { AgentRunResult, ChatMessage, SessionConfig } from './agent/types.js';
|
|
8
9
|
export { SYSTEM_PROMPT as WARP_GREP_SYSTEM_PROMPT, getSystemPrompt } from './agent/prompt.js';
|
|
9
10
|
export { n as normalizeFinishFiles, r as readFinishFiles, t as toolGrep, b as toolListDirectory, a as toolRead } from '../../finish-pPJfB0uO.js';
|
|
10
|
-
export { a as anthropic } from '../../anthropic-BC-AMEIN.js';
|
|
11
|
-
export { o as openai } from '../../openai-Beb9escY.js';
|
|
12
|
-
export { v as vercel } from '../../vercel-Bo84tpBe.js';
|
|
13
|
-
export { g as gemini } from '../../gemini-BIFBiIjY.js';
|
|
14
11
|
import '../utils/resilience.js';
|
|
15
|
-
import '@anthropic-ai/sdk/resources/messages';
|
|
16
|
-
import 'openai/resources/chat/completions';
|
|
17
|
-
import 'ai';
|
|
18
|
-
import '@google/generative-ai';
|
|
19
12
|
|
|
20
13
|
/**
|
|
21
14
|
* Prompts and descriptions for warpgrep_codebase_search
|
|
@@ -29,4 +22,91 @@ declare const WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
|
29
22
|
*/
|
|
30
23
|
declare const WARP_GREP_DESCRIPTION: string;
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Morph Warp Grep SDK
|
|
27
|
+
*
|
|
28
|
+
* Fast and accurate code search tool for AI agents.
|
|
29
|
+
* Uses ripgrep locally, or use `remoteCommands` for sandbox environments.
|
|
30
|
+
*
|
|
31
|
+
* @example Local usage
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // With MorphClient (recommended)
|
|
34
|
+
* import { MorphClient } from '@morphllm/morphsdk';
|
|
35
|
+
*
|
|
36
|
+
* const morph = new MorphClient({ morphApiKey: process.env.MORPH_API_KEY });
|
|
37
|
+
* const result = await morph.warpGrep.execute({
|
|
38
|
+
* query: 'Find authentication middleware',
|
|
39
|
+
* repoRoot: '.'
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Standalone client
|
|
46
|
+
* import { WarpGrepClient } from '@morphllm/morphsdk/tools/warp-grep';
|
|
47
|
+
*
|
|
48
|
+
* const client = new WarpGrepClient({ morphApiKey: process.env.MORPH_API_KEY });
|
|
49
|
+
* const result = await client.execute({
|
|
50
|
+
* query: 'Find authentication middleware',
|
|
51
|
+
* repoRoot: '.'
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // As a tool for AI agents
|
|
58
|
+
* import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';
|
|
59
|
+
*
|
|
60
|
+
* const tool = createWarpGrepTool({ repoRoot: '.' });
|
|
61
|
+
* // Pass to Claude, GPT, Gemini, etc.
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Remote sandbox (E2B, Modal, Daytona, etc.)
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';
|
|
67
|
+
*
|
|
68
|
+
* const tool = createMorphWarpGrepTool({
|
|
69
|
+
* repoRoot: '/home/repo',
|
|
70
|
+
* remoteCommands: {
|
|
71
|
+
* grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,
|
|
72
|
+
* read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,
|
|
73
|
+
* listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,
|
|
74
|
+
* },
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Provider-agnostic usage (bring your own tool abstraction)
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import {
|
|
81
|
+
* warpGrepInputSchema,
|
|
82
|
+
* executeToolCall,
|
|
83
|
+
* WARP_GREP_TOOL_NAME,
|
|
84
|
+
* WARP_GREP_DESCRIPTION,
|
|
85
|
+
* } from '@morphllm/morphsdk/tools/warp-grep';
|
|
86
|
+
*
|
|
87
|
+
* // Use with your own tool definition abstraction
|
|
88
|
+
* const toolDef = createToolDef({
|
|
89
|
+
* name: WARP_GREP_TOOL_NAME,
|
|
90
|
+
* description: WARP_GREP_DESCRIPTION,
|
|
91
|
+
* schema: warpGrepInputSchema,
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* // Execute
|
|
95
|
+
* const result = await executeToolCall(
|
|
96
|
+
* { query: 'Find auth middleware' },
|
|
97
|
+
* { repoRoot: '.', morphApiKey: process.env.MORPH_API_KEY }
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/** Provider-agnostic Zod schema for warp grep input */
|
|
103
|
+
declare const warpGrepInputSchema: z.ZodObject<{
|
|
104
|
+
query: z.ZodString;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
query: string;
|
|
107
|
+
}, {
|
|
108
|
+
query: string;
|
|
109
|
+
}>;
|
|
110
|
+
type WarpGrepInputSchema = z.infer<typeof warpGrepInputSchema>;
|
|
111
|
+
|
|
112
|
+
export { WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, type WarpGrepInputSchema, warpGrepInputSchema };
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import "../../chunk-ISWL67SF.js";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import {
|
|
6
|
-
anthropic_exports
|
|
7
|
-
} from "../../chunk-Q6GHKKS5.js";
|
|
8
|
-
import {
|
|
9
|
-
openai_exports
|
|
10
|
-
} from "../../chunk-XFCMTW5L.js";
|
|
11
|
-
import {
|
|
12
|
-
vercel_exports
|
|
13
|
-
} from "../../chunk-P6OEPI4N.js";
|
|
2
|
+
warpGrepInputSchema
|
|
3
|
+
} from "../../chunk-B5A4XLSQ.js";
|
|
14
4
|
import {
|
|
15
5
|
WARP_GREP_DESCRIPTION,
|
|
16
6
|
WARP_GREP_TOOL_NAME
|
|
@@ -20,10 +10,10 @@ import {
|
|
|
20
10
|
executeToolCall,
|
|
21
11
|
executeWarpGrep,
|
|
22
12
|
formatResult
|
|
23
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-NGF2VIQV.js";
|
|
24
14
|
import {
|
|
25
15
|
runWarpGrep
|
|
26
|
-
} from "../../chunk-
|
|
16
|
+
} from "../../chunk-RRWN62VU.js";
|
|
27
17
|
import {
|
|
28
18
|
RemoteCommandsProvider
|
|
29
19
|
} from "../../chunk-26QXQFLZ.js";
|
|
@@ -56,19 +46,16 @@ export {
|
|
|
56
46
|
SYSTEM_PROMPT as WARP_GREP_SYSTEM_PROMPT,
|
|
57
47
|
WARP_GREP_TOOL_NAME,
|
|
58
48
|
WarpGrepClient,
|
|
59
|
-
anthropic_exports as anthropic,
|
|
60
49
|
executeToolCall,
|
|
61
50
|
executeWarpGrep,
|
|
62
51
|
formatResult,
|
|
63
|
-
gemini_exports as gemini,
|
|
64
52
|
getSystemPrompt,
|
|
65
53
|
normalizeFinishFiles,
|
|
66
|
-
openai_exports as openai,
|
|
67
54
|
readFinishFiles,
|
|
68
55
|
runWarpGrep,
|
|
69
56
|
toolGrep,
|
|
70
57
|
toolListDirectory,
|
|
71
58
|
toolRead,
|
|
72
|
-
|
|
59
|
+
warpGrepInputSchema
|
|
73
60
|
};
|
|
74
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -934,7 +934,7 @@ var import_path2 = __toESM(require("path"), 1);
|
|
|
934
934
|
var parser = new LLMResponseParser();
|
|
935
935
|
var DEFAULT_API_URL = "https://api.morphllm.com";
|
|
936
936
|
async function callModel(messages, model, options = {}) {
|
|
937
|
-
const baseUrl = DEFAULT_API_URL;
|
|
937
|
+
const baseUrl = options.morphApiUrl || DEFAULT_API_URL;
|
|
938
938
|
const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || "";
|
|
939
939
|
const fetchPromise = fetchWithRetry(
|
|
940
940
|
`${baseUrl}/v1/chat/completions`,
|