@morphllm/morphsdk 0.2.56 → 0.2.58
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/anthropic-CaFUHxBW.d.ts +89 -0
- package/dist/{chunk-SALJ2K6S.js → chunk-2CASO3ZO.js} +60 -98
- package/dist/chunk-2CASO3ZO.js.map +1 -0
- package/dist/chunk-374N3GIA.js +118 -0
- package/dist/chunk-374N3GIA.js.map +1 -0
- package/dist/chunk-3IQIT6MC.js +65 -0
- package/dist/chunk-3IQIT6MC.js.map +1 -0
- package/dist/chunk-4VGOBA2J.js +57 -0
- package/dist/chunk-4VGOBA2J.js.map +1 -0
- package/dist/chunk-527P5X2E.js +98 -0
- package/dist/chunk-527P5X2E.js.map +1 -0
- package/dist/chunk-6N6ZYZYD.js +74 -0
- package/dist/chunk-6N6ZYZYD.js.map +1 -0
- package/dist/chunk-6Y5JB4JC.js +195 -0
- package/dist/chunk-6Y5JB4JC.js.map +1 -0
- package/dist/{chunk-WSSSSBWU.js → chunk-7EIHYJSG.js} +18 -18
- package/dist/chunk-7EIHYJSG.js.map +1 -0
- package/dist/{chunk-TICMYDII.js → chunk-APP75CBN.js} +33 -16
- package/dist/chunk-APP75CBN.js.map +1 -0
- package/dist/chunk-ILJ3J5IA.js +72 -0
- package/dist/chunk-ILJ3J5IA.js.map +1 -0
- package/dist/chunk-ISWL67SF.js +1 -0
- package/dist/chunk-KW7OEGZK.js +9 -0
- package/dist/chunk-KW7OEGZK.js.map +1 -0
- package/dist/chunk-Q5AHGIQO.js +205 -0
- package/dist/chunk-Q5AHGIQO.js.map +1 -0
- package/dist/{chunk-TJIUA27P.js → chunk-XT5ZO6ES.js} +9 -5
- package/dist/chunk-XT5ZO6ES.js.map +1 -0
- package/dist/{chunk-LVPVVLTI.js → chunk-YV75OQTE.js} +105 -17
- package/dist/chunk-YV75OQTE.js.map +1 -0
- package/dist/{chunk-ZJIIICRA.js → chunk-ZO4PPFCZ.js} +60 -29
- package/dist/chunk-ZO4PPFCZ.js.map +1 -0
- package/dist/{client-CFoR--IU.d.ts → client-CextMMm9.d.ts} +10 -15
- package/dist/client.cjs +698 -466
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +3 -2
- package/dist/client.js +14 -15
- package/dist/finish-kXAcUJyB.d.ts +33 -0
- package/dist/gemini-CE80Pbdy.d.ts +117 -0
- package/dist/index.cjs +711 -466
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +16 -16
- package/dist/openai-Fvpqln7F.d.ts +89 -0
- package/dist/tools/warp_grep/agent/config.cjs +8 -4
- package/dist/tools/warp_grep/agent/config.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/config.d.ts +7 -2
- package/dist/tools/warp_grep/agent/config.js +1 -1
- package/dist/tools/warp_grep/agent/formatter.cjs +32 -15
- package/dist/tools/warp_grep/agent/formatter.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/formatter.d.ts +1 -1
- package/dist/tools/warp_grep/agent/formatter.js +1 -1
- package/dist/tools/warp_grep/agent/parser.cjs +104 -17
- package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/parser.d.ts +3 -5
- package/dist/tools/warp_grep/agent/parser.js +1 -3
- package/dist/tools/warp_grep/agent/prompt.cjs +132 -56
- 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 +466 -313
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.d.ts +1 -0
- package/dist/tools/warp_grep/agent/runner.js +6 -9
- package/dist/tools/warp_grep/agent/types.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/types.d.ts +9 -2
- package/dist/tools/warp_grep/anthropic.cjs +656 -380
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +4 -74
- package/dist/tools/warp_grep/anthropic.js +13 -16
- package/dist/tools/warp_grep/client.cjs +1593 -0
- package/dist/tools/warp_grep/client.cjs.map +1 -0
- package/dist/tools/warp_grep/client.d.ts +87 -0
- package/dist/tools/warp_grep/client.js +26 -0
- package/dist/tools/warp_grep/gemini.cjs +1587 -0
- package/dist/tools/warp_grep/gemini.cjs.map +1 -0
- package/dist/tools/warp_grep/gemini.d.ts +7 -0
- package/dist/tools/warp_grep/gemini.js +34 -0
- package/dist/tools/warp_grep/harness.cjs +1195 -0
- package/dist/tools/warp_grep/harness.cjs.map +1 -0
- package/dist/tools/warp_grep/harness.d.ts +107 -0
- package/dist/tools/warp_grep/harness.js +68 -0
- package/dist/tools/warp_grep/harness.js.map +1 -0
- package/dist/tools/warp_grep/index.cjs +818 -466
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +11 -6
- package/dist/tools/warp_grep/index.js +43 -23
- package/dist/tools/warp_grep/openai.cjs +656 -378
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +4 -74
- package/dist/tools/warp_grep/openai.js +13 -14
- package/dist/tools/warp_grep/providers/local.cjs +66 -27
- package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/local.d.ts +4 -9
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/providers/remote.cjs +211 -0
- package/dist/tools/warp_grep/providers/remote.cjs.map +1 -0
- package/dist/tools/warp_grep/providers/remote.d.ts +67 -0
- package/dist/tools/warp_grep/providers/remote.js +9 -0
- package/dist/tools/warp_grep/providers/types.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/types.d.ts +7 -15
- package/dist/tools/warp_grep/vercel.cjs +668 -397
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +4 -51
- package/dist/tools/warp_grep/vercel.js +16 -15
- package/dist/types-a_hxdPI6.d.ts +144 -0
- package/dist/vercel-3yjvfmVB.d.ts +66 -0
- package/package.json +17 -2
- package/dist/chunk-4ZHDBKBY.js +0 -83
- package/dist/chunk-4ZHDBKBY.js.map +0 -1
- package/dist/chunk-73RQWOQC.js +0 -16
- package/dist/chunk-73RQWOQC.js.map +0 -1
- package/dist/chunk-7OQOOB3R.js +0 -1
- package/dist/chunk-EK7OQPWD.js +0 -44
- package/dist/chunk-EK7OQPWD.js.map +0 -1
- package/dist/chunk-GJURLQ3L.js +0 -77
- package/dist/chunk-GJURLQ3L.js.map +0 -1
- package/dist/chunk-HQO45BAJ.js +0 -14
- package/dist/chunk-HQO45BAJ.js.map +0 -1
- package/dist/chunk-LVPVVLTI.js.map +0 -1
- package/dist/chunk-NDZO5IPV.js +0 -121
- package/dist/chunk-NDZO5IPV.js.map +0 -1
- package/dist/chunk-QVRXBAMM.js +0 -107
- package/dist/chunk-QVRXBAMM.js.map +0 -1
- package/dist/chunk-SALJ2K6S.js.map +0 -1
- package/dist/chunk-TICMYDII.js.map +0 -1
- package/dist/chunk-TJIUA27P.js.map +0 -1
- package/dist/chunk-UIRJE422.js +0 -70
- package/dist/chunk-UIRJE422.js.map +0 -1
- package/dist/chunk-WETRQJGU.js +0 -129
- package/dist/chunk-WETRQJGU.js.map +0 -1
- package/dist/chunk-WSSSSBWU.js.map +0 -1
- package/dist/chunk-ZJIIICRA.js.map +0 -1
- package/dist/core-CpkYEi_T.d.ts +0 -158
- package/dist/tools/warp_grep/agent/grep_helpers.cjs +0 -148
- package/dist/tools/warp_grep/agent/grep_helpers.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/grep_helpers.d.ts +0 -16
- package/dist/tools/warp_grep/agent/grep_helpers.js +0 -14
- package/dist/tools/warp_grep/tools/analyse.cjs +0 -40
- package/dist/tools/warp_grep/tools/analyse.cjs.map +0 -1
- package/dist/tools/warp_grep/tools/analyse.d.ts +0 -10
- package/dist/tools/warp_grep/tools/analyse.js +0 -8
- package/dist/tools/warp_grep/tools/finish.cjs +0 -69
- package/dist/tools/warp_grep/tools/finish.cjs.map +0 -1
- package/dist/tools/warp_grep/tools/finish.d.ts +0 -10
- package/dist/tools/warp_grep/tools/finish.js +0 -10
- package/dist/tools/warp_grep/tools/grep.cjs +0 -38
- package/dist/tools/warp_grep/tools/grep.cjs.map +0 -1
- package/dist/tools/warp_grep/tools/grep.d.ts +0 -8
- package/dist/tools/warp_grep/tools/grep.js +0 -15
- package/dist/tools/warp_grep/tools/grep.js.map +0 -1
- package/dist/tools/warp_grep/tools/read.cjs +0 -38
- package/dist/tools/warp_grep/tools/read.cjs.map +0 -1
- package/dist/tools/warp_grep/tools/read.d.ts +0 -9
- package/dist/tools/warp_grep/tools/read.js +0 -8
- package/dist/tools/warp_grep/tools/read.js.map +0 -1
- package/dist/tools/warp_grep/utils/format.cjs +0 -42
- package/dist/tools/warp_grep/utils/format.cjs.map +0 -1
- package/dist/tools/warp_grep/utils/format.d.ts +0 -4
- package/dist/tools/warp_grep/utils/format.js +0 -18
- package/dist/tools/warp_grep/utils/format.js.map +0 -1
- /package/dist/{chunk-7OQOOB3R.js.map → chunk-ISWL67SF.js.map} +0 -0
- /package/dist/tools/warp_grep/{agent/grep_helpers.js.map → client.js.map} +0 -0
- /package/dist/tools/warp_grep/{tools/analyse.js.map → gemini.js.map} +0 -0
- /package/dist/tools/warp_grep/{tools/finish.js.map → providers/remote.js.map} +0 -0
package/dist/client.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import './tools/utils/resilience.js';
|
|
|
2
2
|
import './tools/fastapply/core.js';
|
|
3
3
|
import './tools/codebase_search/core.js';
|
|
4
4
|
import './tools/browser/core.js';
|
|
5
|
-
import './
|
|
5
|
+
import './tools/warp_grep/client.js';
|
|
6
6
|
import './git/client.js';
|
|
7
7
|
import './modelrouter/core.js';
|
|
8
|
-
export { M as MorphClient, a as MorphClientConfig } from './client-
|
|
8
|
+
export { M as MorphClient, a as MorphClientConfig } from './client-CextMMm9.js';
|
|
9
9
|
import './tools/fastapply/types.js';
|
|
10
10
|
import './tools/codebase_search/types.js';
|
|
11
11
|
import './tools/browser/types.js';
|
|
12
|
+
import './types-a_hxdPI6.js';
|
|
12
13
|
import './tools/warp_grep/providers/types.js';
|
|
13
14
|
import './git/types.js';
|
|
14
15
|
import 'isomorphic-git';
|
package/dist/client.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7EIHYJSG.js";
|
|
4
|
+
import "./chunk-3IQIT6MC.js";
|
|
5
|
+
import "./chunk-6N6ZYZYD.js";
|
|
6
|
+
import "./chunk-4VGOBA2J.js";
|
|
7
|
+
import "./chunk-KW7OEGZK.js";
|
|
8
|
+
import "./chunk-374N3GIA.js";
|
|
9
|
+
import "./chunk-2CASO3ZO.js";
|
|
10
|
+
import "./chunk-527P5X2E.js";
|
|
11
|
+
import "./chunk-6Y5JB4JC.js";
|
|
12
|
+
import "./chunk-APP75CBN.js";
|
|
13
|
+
import "./chunk-YV75OQTE.js";
|
|
14
|
+
import "./chunk-Q5AHGIQO.js";
|
|
15
|
+
import "./chunk-ZO4PPFCZ.js";
|
|
13
16
|
import "./chunk-G2RSY56Q.js";
|
|
14
17
|
import "./chunk-SMGZ6A64.js";
|
|
15
18
|
import "./chunk-TPP2UGQP.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-EK7OQPWD.js";
|
|
18
|
-
import "./chunk-TJIUA27P.js";
|
|
19
|
-
import "./chunk-TICMYDII.js";
|
|
20
|
-
import "./chunk-NDZO5IPV.js";
|
|
19
|
+
import "./chunk-XT5ZO6ES.js";
|
|
21
20
|
import "./chunk-UBX7QYBD.js";
|
|
22
21
|
import "./chunk-GJU7UOFL.js";
|
|
23
22
|
import "./chunk-76DJEQEP.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WarpGrepProvider } from './tools/warp_grep/providers/types.js';
|
|
2
|
+
import { FinishFileSpec } from './tools/warp_grep/agent/types.js';
|
|
3
|
+
|
|
4
|
+
declare function toolGrep(provider: WarpGrepProvider, args: {
|
|
5
|
+
pattern: string;
|
|
6
|
+
path: string;
|
|
7
|
+
glob?: string;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
output: string;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
declare function toolRead(provider: WarpGrepProvider, args: {
|
|
13
|
+
path: string;
|
|
14
|
+
start?: number;
|
|
15
|
+
end?: number;
|
|
16
|
+
lines?: Array<[number, number]>;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
|
|
19
|
+
declare function toolListDirectory(provider: WarpGrepProvider, args: {
|
|
20
|
+
path: string;
|
|
21
|
+
pattern?: string | null;
|
|
22
|
+
maxResults?: number;
|
|
23
|
+
maxDepth?: number;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
|
|
26
|
+
declare function normalizeFinishFiles(files: FinishFileSpec[]): FinishFileSpec[];
|
|
27
|
+
declare function readFinishFiles(repoRoot: string, files: FinishFileSpec[], reader: (path: string, start: number, end: number) => Promise<string[]>): Promise<{
|
|
28
|
+
path: string;
|
|
29
|
+
ranges: Array<[number, number]>;
|
|
30
|
+
content: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
|
|
33
|
+
export { toolRead as a, toolListDirectory as b, normalizeFinishFiles as n, readFinishFiles as r, toolGrep as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { FunctionDeclaration } from '@google/generative-ai';
|
|
2
|
+
import { formatResult } from './tools/warp_grep/client.js';
|
|
3
|
+
import { getSystemPrompt } from './tools/warp_grep/agent/prompt.js';
|
|
4
|
+
import { d as WarpGrepToolConfig, b as WarpGrepResult } from './types-a_hxdPI6.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Google Gemini SDK adapter for morph-warp-grep tool
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Gemini-native warp grep function declaration
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
16
|
+
* import { warpGrepFunctionDeclaration, execute } from '@morphllm/morphsdk/tools/warp-grep/gemini';
|
|
17
|
+
*
|
|
18
|
+
* const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
|
|
19
|
+
* const model = genAI.getGenerativeModel({
|
|
20
|
+
* model: 'gemini-2.0-flash',
|
|
21
|
+
* tools: [{ functionDeclarations: [warpGrepFunctionDeclaration] }]
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* const chat = model.startChat();
|
|
25
|
+
* const result = await chat.sendMessage('Find authentication middleware');
|
|
26
|
+
*
|
|
27
|
+
* // Handle function call
|
|
28
|
+
* const call = result.response.functionCalls()?.[0];
|
|
29
|
+
* if (call) {
|
|
30
|
+
* const searchResult = await execute(call.args, { repoRoot: '.' });
|
|
31
|
+
* console.log(searchResult);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const warpGrepFunctionDeclaration: FunctionDeclaration;
|
|
36
|
+
/**
|
|
37
|
+
* Execute warp grep search
|
|
38
|
+
*
|
|
39
|
+
* @param input - Tool input with query
|
|
40
|
+
* @param config - Configuration with repoRoot and optional provider
|
|
41
|
+
* @returns Search results
|
|
42
|
+
*/
|
|
43
|
+
declare function execute(input: {
|
|
44
|
+
query: string;
|
|
45
|
+
} | string, config: WarpGrepToolConfig): Promise<WarpGrepResult>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Gemini tool with execute method attached
|
|
49
|
+
*/
|
|
50
|
+
interface GeminiWarpGrepTool extends FunctionDeclaration {
|
|
51
|
+
execute: (input: unknown) => Promise<WarpGrepResult>;
|
|
52
|
+
formatResult: (result: WarpGrepResult) => string;
|
|
53
|
+
getSystemPrompt: () => string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a custom warp grep tool with configuration and methods
|
|
57
|
+
*
|
|
58
|
+
* @param config - Configuration options
|
|
59
|
+
* @returns Function declaration with execute and formatResult methods
|
|
60
|
+
*
|
|
61
|
+
* @example Local usage
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
64
|
+
* import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/gemini';
|
|
65
|
+
*
|
|
66
|
+
* const tool = createMorphWarpGrepTool({ repoRoot: '.' });
|
|
67
|
+
*
|
|
68
|
+
* const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
|
|
69
|
+
* const model = genAI.getGenerativeModel({
|
|
70
|
+
* model: 'gemini-2.0-flash',
|
|
71
|
+
* tools: [{ functionDeclarations: [tool] }]
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* const chat = model.startChat();
|
|
75
|
+
* const result = await chat.sendMessage('Find authentication middleware');
|
|
76
|
+
*
|
|
77
|
+
* // Handle function call
|
|
78
|
+
* const call = result.response.functionCalls()?.[0];
|
|
79
|
+
* if (call && call.name === tool.name) {
|
|
80
|
+
* const searchResult = await tool.execute(call.args);
|
|
81
|
+
* console.log(tool.formatResult(searchResult));
|
|
82
|
+
*
|
|
83
|
+
* // Send result back to model
|
|
84
|
+
* await chat.sendMessage([{
|
|
85
|
+
* functionResponse: {
|
|
86
|
+
* name: call.name,
|
|
87
|
+
* response: { result: tool.formatResult(searchResult) }
|
|
88
|
+
* }
|
|
89
|
+
* }]);
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example Remote sandbox (E2B, Modal, etc.)
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const tool = createMorphWarpGrepTool({
|
|
96
|
+
* repoRoot: '/home/repo',
|
|
97
|
+
* remoteCommands: {
|
|
98
|
+
* grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,
|
|
99
|
+
* read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,
|
|
100
|
+
* listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,
|
|
101
|
+
* },
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function createMorphWarpGrepTool(config: WarpGrepToolConfig): GeminiWarpGrepTool;
|
|
106
|
+
|
|
107
|
+
type gemini_GeminiWarpGrepTool = GeminiWarpGrepTool;
|
|
108
|
+
declare const gemini_createMorphWarpGrepTool: typeof createMorphWarpGrepTool;
|
|
109
|
+
declare const gemini_execute: typeof execute;
|
|
110
|
+
declare const gemini_formatResult: typeof formatResult;
|
|
111
|
+
declare const gemini_getSystemPrompt: typeof getSystemPrompt;
|
|
112
|
+
declare const gemini_warpGrepFunctionDeclaration: typeof warpGrepFunctionDeclaration;
|
|
113
|
+
declare namespace gemini {
|
|
114
|
+
export { type gemini_GeminiWarpGrepTool as GeminiWarpGrepTool, gemini_createMorphWarpGrepTool as createMorphWarpGrepTool, warpGrepFunctionDeclaration as default, gemini_execute as execute, gemini_formatResult as formatResult, gemini_getSystemPrompt as getSystemPrompt, gemini_warpGrepFunctionDeclaration as warpGrepFunctionDeclaration };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { type GeminiWarpGrepTool as G, createMorphWarpGrepTool as c, execute as e, gemini as g, warpGrepFunctionDeclaration as w };
|