@morphllm/morphsdk 0.2.120 → 0.2.122
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-7TM4RBXE.js → chunk-2AQLRL4U.js} +2 -2
- package/dist/{chunk-XQ4KEOJT.js → chunk-2MJEULZU.js} +2 -2
- package/dist/{chunk-SNY2UKHQ.js → chunk-3PMFQ5AV.js} +4 -4
- package/dist/{chunk-A54BOCBI.js → chunk-4GEBF5OH.js} +2 -2
- package/dist/{chunk-VVEK5JSH.js → chunk-4IU2K63O.js} +4 -4
- package/dist/{chunk-HCN2MLSO.js → chunk-4LA3OT4Q.js} +28 -4
- package/dist/chunk-4LA3OT4Q.js.map +1 -0
- package/dist/{chunk-HBWOWL7L.js → chunk-5UUJULLM.js} +2 -2
- package/dist/chunk-63VHBANJ.js +22 -0
- package/dist/chunk-63VHBANJ.js.map +1 -0
- package/dist/{chunk-L5C6E32T.js → chunk-64KNVHR4.js} +1 -1
- package/dist/{chunk-L5C6E32T.js.map → chunk-64KNVHR4.js.map} +1 -1
- package/dist/{chunk-2BPPWIJI.js → chunk-73GZ6KUK.js} +2 -2
- package/dist/{chunk-NW6PJIID.js → chunk-7KOUCN6T.js} +2 -2
- package/dist/{chunk-NLDYHLRB.js → chunk-EBROW6GK.js} +2 -2
- package/dist/{chunk-TVPEH6FF.js → chunk-GTANVDUZ.js} +2 -2
- package/dist/chunk-J267T54M.js +76 -0
- package/dist/chunk-J267T54M.js.map +1 -0
- package/dist/{chunk-KW7OEGZK.js → chunk-KJZMKDDP.js} +16 -2
- package/dist/{chunk-KW7OEGZK.js.map → chunk-KJZMKDDP.js.map} +1 -1
- package/dist/{chunk-4VLTYTEY.js → chunk-L4URLBKV.js} +3 -3
- package/dist/{chunk-T7F3DIRK.js → chunk-LE24SVVU.js} +2 -2
- package/dist/{chunk-BVINWDTA.js → chunk-MQWEZJTP.js} +6 -6
- package/dist/{chunk-6ODXYTLF.js → chunk-OTGBQEVH.js} +2 -2
- package/dist/{chunk-7HKYJ2MW.js → chunk-OWISPSLH.js} +2 -2
- package/dist/{chunk-HQAPRX5T.js → chunk-QGE7FGGT.js} +4 -4
- package/dist/{chunk-4RO43W62.js → chunk-RNKHRNSG.js} +8 -3
- package/dist/chunk-RNKHRNSG.js.map +1 -0
- package/dist/{chunk-RZ4VC4BG.js → chunk-T3T4LGRD.js} +30 -3
- package/dist/chunk-T3T4LGRD.js.map +1 -0
- package/dist/{chunk-FZUUET6R.js → chunk-TBLMIAIH.js} +28 -3
- package/dist/chunk-TBLMIAIH.js.map +1 -0
- package/dist/{chunk-RODHADNG.js → chunk-TXT3W4QK.js} +69 -11
- package/dist/chunk-TXT3W4QK.js.map +1 -0
- package/dist/{chunk-P4EPXC2Q.js → chunk-UDGJQBTC.js} +70 -17
- package/dist/{chunk-P4EPXC2Q.js.map → chunk-UDGJQBTC.js.map} +1 -1
- package/dist/chunk-WYYR2EU6.js +29 -0
- package/dist/chunk-WYYR2EU6.js.map +1 -0
- package/dist/{chunk-5HPN4VL2.js → chunk-ZHRT6F72.js} +1 -1
- package/dist/{client-D7iO2TbA.d.ts → client-BJrzbMYL.d.ts} +52 -2
- package/dist/client.cjs +302 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +5 -2
- package/dist/client.js +25 -22
- package/dist/edge.cjs +81 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.d.ts +3 -0
- package/dist/edge.js +8 -4
- package/dist/index.cjs +304 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +30 -24
- package/dist/modelrouter/core.cjs +7 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +3 -3
- package/dist/modelrouter/index.cjs +7 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +3 -3
- package/dist/tools/browser/anthropic.cjs +7 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +5 -5
- package/dist/tools/browser/core.cjs +7 -2
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +4 -4
- package/dist/tools/browser/index.cjs +7 -2
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +7 -7
- package/dist/tools/browser/openai.cjs +7 -2
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +5 -5
- package/dist/tools/browser/profiles/core.cjs +7 -2
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.js +3 -3
- package/dist/tools/browser/profiles/index.cjs +7 -2
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.js +3 -3
- package/dist/tools/browser/vercel.cjs +7 -2
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +5 -5
- package/dist/tools/codebase_search/anthropic.cjs +7 -2
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +4 -4
- package/dist/tools/codebase_search/core.cjs +7 -2
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +3 -3
- package/dist/tools/codebase_search/index.cjs +7 -2
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +6 -6
- package/dist/tools/codebase_search/openai.cjs +7 -2
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +4 -4
- package/dist/tools/codebase_search/vercel.cjs +7 -2
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +4 -4
- package/dist/tools/compact/core.cjs +110 -0
- package/dist/tools/compact/core.cjs.map +1 -0
- package/dist/tools/compact/core.d.ts +37 -0
- package/dist/tools/compact/core.js +8 -0
- package/dist/tools/compact/core.js.map +1 -0
- package/dist/tools/compact/index.cjs +112 -0
- package/dist/tools/compact/index.cjs.map +1 -0
- package/dist/tools/compact/index.d.ts +4 -0
- package/dist/tools/compact/index.js +8 -0
- package/dist/tools/compact/index.js.map +1 -0
- package/dist/tools/compact/types.cjs +19 -0
- package/dist/tools/compact/types.cjs.map +1 -0
- package/dist/tools/compact/types.d.ts +60 -0
- package/dist/tools/compact/types.js +1 -0
- package/dist/tools/compact/types.js.map +1 -0
- package/dist/tools/fastapply/anthropic.cjs +7 -2
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +4 -4
- package/dist/tools/fastapply/apply.cjs +7 -2
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +7 -2
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +3 -3
- package/dist/tools/fastapply/index.cjs +7 -2
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.d.ts +1 -1
- package/dist/tools/fastapply/index.js +8 -8
- package/dist/tools/fastapply/openai.cjs +7 -2
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +4 -4
- package/dist/tools/fastapply/vercel.cjs +7 -2
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.d.ts +1 -1
- package/dist/tools/fastapply/vercel.js +4 -4
- package/dist/tools/index.cjs +7 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +8 -8
- package/dist/tools/utils/resilience.cjs +7 -2
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +7 -2
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +369 -2
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +35 -2
- package/dist/tools/warp_grep/anthropic.js +10 -6
- package/dist/tools/warp_grep/client.cjs +109 -9
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.d.ts +32 -1
- package/dist/tools/warp_grep/client.js +6 -4
- package/dist/tools/warp_grep/gemini.cjs +369 -2
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +35 -2
- package/dist/tools/warp_grep/gemini.js +39 -5
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/harness.js +4 -4
- package/dist/tools/warp_grep/index.cjs +128 -9
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +23 -2
- package/dist/tools/warp_grep/index.js +19 -8
- package/dist/tools/warp_grep/openai.cjs +372 -2
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +35 -2
- package/dist/tools/warp_grep/openai.js +10 -6
- package/dist/tools/warp_grep/providers/code_storage_http.cjs +53 -0
- package/dist/tools/warp_grep/providers/code_storage_http.cjs.map +1 -0
- package/dist/tools/warp_grep/providers/code_storage_http.d.ts +23 -0
- package/dist/tools/warp_grep/providers/code_storage_http.js +8 -0
- package/dist/tools/warp_grep/providers/code_storage_http.js.map +1 -0
- package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
- package/dist/tools/warp_grep/utils/github.cjs +46 -0
- package/dist/tools/warp_grep/utils/github.cjs.map +1 -0
- package/dist/tools/warp_grep/utils/github.d.ts +13 -0
- package/dist/tools/warp_grep/utils/github.js +8 -0
- package/dist/tools/warp_grep/utils/github.js.map +1 -0
- package/dist/tools/warp_grep/vercel.cjs +157 -2
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +32 -2
- package/dist/tools/warp_grep/vercel.js +10 -6
- package/dist/{types-D5p8QErL.d.ts → types-CA7989hK.d.ts} +17 -1
- package/dist/version.cjs +7 -2
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/dist/chunk-4RO43W62.js.map +0 -1
- package/dist/chunk-FZUUET6R.js.map +0 -1
- package/dist/chunk-HCN2MLSO.js.map +0 -1
- package/dist/chunk-RODHADNG.js.map +0 -1
- package/dist/chunk-RZ4VC4BG.js.map +0 -1
- package/dist/{chunk-7TM4RBXE.js.map → chunk-2AQLRL4U.js.map} +0 -0
- package/dist/{chunk-XQ4KEOJT.js.map → chunk-2MJEULZU.js.map} +0 -0
- package/dist/{chunk-SNY2UKHQ.js.map → chunk-3PMFQ5AV.js.map} +0 -0
- package/dist/{chunk-A54BOCBI.js.map → chunk-4GEBF5OH.js.map} +0 -0
- package/dist/{chunk-VVEK5JSH.js.map → chunk-4IU2K63O.js.map} +0 -0
- package/dist/{chunk-HBWOWL7L.js.map → chunk-5UUJULLM.js.map} +0 -0
- package/dist/{chunk-2BPPWIJI.js.map → chunk-73GZ6KUK.js.map} +0 -0
- package/dist/{chunk-NW6PJIID.js.map → chunk-7KOUCN6T.js.map} +0 -0
- package/dist/{chunk-NLDYHLRB.js.map → chunk-EBROW6GK.js.map} +0 -0
- package/dist/{chunk-TVPEH6FF.js.map → chunk-GTANVDUZ.js.map} +0 -0
- package/dist/{chunk-4VLTYTEY.js.map → chunk-L4URLBKV.js.map} +0 -0
- package/dist/{chunk-T7F3DIRK.js.map → chunk-LE24SVVU.js.map} +0 -0
- package/dist/{chunk-BVINWDTA.js.map → chunk-MQWEZJTP.js.map} +0 -0
- package/dist/{chunk-6ODXYTLF.js.map → chunk-OTGBQEVH.js.map} +0 -0
- package/dist/{chunk-7HKYJ2MW.js.map → chunk-OWISPSLH.js.map} +0 -0
- package/dist/{chunk-HQAPRX5T.js.map → chunk-QGE7FGGT.js.map} +0 -0
- package/dist/{chunk-5HPN4VL2.js.map → chunk-ZHRT6F72.js.map} +0 -0
- package/dist/{vercel-B1GZ_g9N.d.ts → vercel-BTSPdTA-.d.ts} +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export { WarpGrepClient, executeToolCall, executeWarpGrep, formatResult } from './client.js';
|
|
3
|
-
export { R as RemoteCommands, W as WarpGrepClientConfig, c as WarpGrepContext, a as WarpGrepInput, b as WarpGrepResult, d as WarpGrepToolConfig } from '../../types-
|
|
3
|
+
export { G as GitHubSearchInput, e as GitHubSearchToolConfig, R as RemoteCommands, W as WarpGrepClientConfig, c as WarpGrepContext, a as WarpGrepInput, b as WarpGrepResult, d as WarpGrepToolConfig } from '../../types-CA7989hK.js';
|
|
4
4
|
export { GrepResult, ListDirectoryEntry, ReadResult, WarpGrepProvider } from './providers/types.js';
|
|
5
5
|
export { LocalRipgrepProvider } from './providers/local.js';
|
|
6
6
|
export { RemoteCommandsProvider } from './providers/remote.js';
|
|
7
|
+
export { CodeStorageHttpConfig, createCodeStorageHttpCommands } from './providers/code_storage_http.js';
|
|
7
8
|
export { fixPathRepetition } from './utils/paths.js';
|
|
8
9
|
export { runWarpGrep, runWarpGrepStreaming } from './agent/runner.js';
|
|
9
10
|
export { AgentRunResult, ChatMessage, SessionConfig, WarpGrepStep } from './agent/types.js';
|
|
@@ -22,6 +23,26 @@ declare const WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
|
22
23
|
* Default tool description for the warp grep tool
|
|
23
24
|
*/
|
|
24
25
|
declare const WARP_GREP_DESCRIPTION: string;
|
|
26
|
+
declare const GITHUB_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
27
|
+
declare const GITHUB_SEARCH_DESCRIPTION = "Search a public GitHub repository using WarpGrep. Provide a GitHub URL or owner/repo shorthand and a natural language query.";
|
|
28
|
+
declare const GITHUB_SEARCH_INPUT_SCHEMA: {
|
|
29
|
+
type: "object";
|
|
30
|
+
properties: {
|
|
31
|
+
query: {
|
|
32
|
+
type: "string";
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
github: {
|
|
36
|
+
type: "string";
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
branch: {
|
|
40
|
+
type: "string";
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
required: readonly ["query", "github"];
|
|
45
|
+
};
|
|
25
46
|
|
|
26
47
|
/**
|
|
27
48
|
* Morph Warp Grep SDK
|
|
@@ -110,4 +131,4 @@ declare const warpGrepInputSchema: z.ZodObject<{
|
|
|
110
131
|
}>;
|
|
111
132
|
type WarpGrepInputSchema = z.infer<typeof warpGrepInputSchema>;
|
|
112
133
|
|
|
113
|
-
export { WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, type WarpGrepInputSchema, warpGrepInputSchema };
|
|
134
|
+
export { GITHUB_SEARCH_DESCRIPTION, GITHUB_SEARCH_INPUT_SCHEMA, GITHUB_SEARCH_TOOL_NAME, WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, type WarpGrepInputSchema, warpGrepInputSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
warpGrepInputSchema
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-64KNVHR4.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalRipgrepProvider
|
|
6
6
|
} from "../../chunk-EF7ZYLA2.js";
|
|
@@ -10,22 +10,29 @@ import {
|
|
|
10
10
|
} from "../../chunk-YPKNMYD4.js";
|
|
11
11
|
import "../../chunk-TPP2UGQP.js";
|
|
12
12
|
import {
|
|
13
|
+
GITHUB_SEARCH_DESCRIPTION,
|
|
14
|
+
GITHUB_SEARCH_INPUT_SCHEMA,
|
|
15
|
+
GITHUB_SEARCH_TOOL_NAME,
|
|
13
16
|
WARP_GREP_DESCRIPTION,
|
|
14
17
|
WARP_GREP_TOOL_NAME
|
|
15
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-KJZMKDDP.js";
|
|
16
19
|
import {
|
|
17
20
|
WarpGrepClient,
|
|
18
21
|
executeToolCall,
|
|
19
22
|
executeWarpGrep,
|
|
20
23
|
formatResult
|
|
21
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-TXT3W4QK.js";
|
|
22
25
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from "../../chunk-BVINWDTA.js";
|
|
26
|
+
createCodeStorageHttpCommands
|
|
27
|
+
} from "../../chunk-WYYR2EU6.js";
|
|
26
28
|
import {
|
|
27
29
|
RemoteCommandsProvider
|
|
28
30
|
} from "../../chunk-PUGSTXLO.js";
|
|
31
|
+
import "../../chunk-63VHBANJ.js";
|
|
32
|
+
import {
|
|
33
|
+
runWarpGrep,
|
|
34
|
+
runWarpGrepStreaming
|
|
35
|
+
} from "../../chunk-MQWEZJTP.js";
|
|
29
36
|
import {
|
|
30
37
|
normalizeFinishFiles,
|
|
31
38
|
readFinishFiles,
|
|
@@ -33,22 +40,26 @@ import {
|
|
|
33
40
|
toolListDirectory,
|
|
34
41
|
toolRead
|
|
35
42
|
} from "../../chunk-3MLWXJTJ.js";
|
|
43
|
+
import "../../chunk-5PNMAWLC.js";
|
|
36
44
|
import "../../chunk-APP75CBN.js";
|
|
37
45
|
import "../../chunk-GHGJAQSJ.js";
|
|
38
46
|
import {
|
|
39
47
|
SYSTEM_PROMPT,
|
|
40
48
|
getSystemPrompt
|
|
41
49
|
} from "../../chunk-FMLHRJDF.js";
|
|
42
|
-
import "../../chunk-
|
|
43
|
-
import "../../chunk-4RO43W62.js";
|
|
50
|
+
import "../../chunk-RNKHRNSG.js";
|
|
44
51
|
import "../../chunk-PZ5AY32C.js";
|
|
45
52
|
export {
|
|
53
|
+
GITHUB_SEARCH_DESCRIPTION,
|
|
54
|
+
GITHUB_SEARCH_INPUT_SCHEMA,
|
|
55
|
+
GITHUB_SEARCH_TOOL_NAME,
|
|
46
56
|
LocalRipgrepProvider,
|
|
47
57
|
RemoteCommandsProvider,
|
|
48
58
|
WARP_GREP_DESCRIPTION,
|
|
49
59
|
SYSTEM_PROMPT as WARP_GREP_SYSTEM_PROMPT,
|
|
50
60
|
WARP_GREP_TOOL_NAME,
|
|
51
61
|
WarpGrepClient,
|
|
62
|
+
createCodeStorageHttpCommands,
|
|
52
63
|
executeToolCall,
|
|
53
64
|
executeWarpGrep,
|
|
54
65
|
fixPathRepetition,
|
|
@@ -572,6 +572,7 @@ Details: ${res.stderr}` : ""}`
|
|
|
572
572
|
// tools/warp_grep/openai.ts
|
|
573
573
|
var openai_exports = {};
|
|
574
574
|
__export(openai_exports, {
|
|
575
|
+
createGitHubSearchTool: () => createGitHubSearchTool,
|
|
575
576
|
createWarpGrepTool: () => createWarpGrepTool,
|
|
576
577
|
default: () => openai_default,
|
|
577
578
|
execute: () => execute,
|
|
@@ -1378,7 +1379,7 @@ var import_openai = __toESM(require("openai"), 1);
|
|
|
1378
1379
|
// package.json
|
|
1379
1380
|
var package_default = {
|
|
1380
1381
|
name: "@morphllm/morphsdk",
|
|
1381
|
-
version: "0.2.
|
|
1382
|
+
version: "0.2.122",
|
|
1382
1383
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
1383
1384
|
type: "module",
|
|
1384
1385
|
main: "./dist/index.cjs",
|
|
@@ -1504,6 +1505,11 @@ var package_default = {
|
|
|
1504
1505
|
types: "./dist/modelrouter/index.d.ts",
|
|
1505
1506
|
import: "./dist/modelrouter/index.js",
|
|
1506
1507
|
require: "./dist/modelrouter/index.cjs"
|
|
1508
|
+
},
|
|
1509
|
+
"./tools/compact": {
|
|
1510
|
+
types: "./dist/tools/compact/index.d.ts",
|
|
1511
|
+
import: "./dist/tools/compact/index.js",
|
|
1512
|
+
require: "./dist/tools/compact/index.cjs"
|
|
1507
1513
|
}
|
|
1508
1514
|
},
|
|
1509
1515
|
files: [
|
|
@@ -1515,7 +1521,7 @@ var package_default = {
|
|
|
1515
1521
|
"!dist/**/*.test.*"
|
|
1516
1522
|
],
|
|
1517
1523
|
scripts: {
|
|
1518
|
-
build: "tsup version.ts index.ts edge.ts client.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/prompt.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/utils/resilience.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
1524
|
+
build: "tsup version.ts index.ts edge.ts client.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/prompt.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
1519
1525
|
prepare: "npm run build",
|
|
1520
1526
|
typecheck: "tsc --noEmit",
|
|
1521
1527
|
lint: "eslint .",
|
|
@@ -1806,6 +1812,171 @@ async function runWarpGrep(config) {
|
|
|
1806
1812
|
timings
|
|
1807
1813
|
};
|
|
1808
1814
|
}
|
|
1815
|
+
async function* runWarpGrepStreaming(config) {
|
|
1816
|
+
const totalStart = Date.now();
|
|
1817
|
+
const timeoutMs = config.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
|
|
1818
|
+
const timings = { turns: [], timeout_ms: timeoutMs };
|
|
1819
|
+
const repoRoot = import_path2.default.resolve(config.repoRoot || process.cwd());
|
|
1820
|
+
const messages = [];
|
|
1821
|
+
messages.push({ role: "system", content: getSystemPrompt() });
|
|
1822
|
+
const initialStateStart = Date.now();
|
|
1823
|
+
const initialState = await buildInitialState(repoRoot, config.query, config.provider);
|
|
1824
|
+
timings.initial_state_ms = Date.now() - initialStateStart;
|
|
1825
|
+
messages.push({ role: "user", content: initialState });
|
|
1826
|
+
const maxTurns = AGENT_CONFIG.MAX_TURNS;
|
|
1827
|
+
const model = config.model || DEFAULT_MODEL;
|
|
1828
|
+
const provider = config.provider;
|
|
1829
|
+
const errors = [];
|
|
1830
|
+
let finishMeta;
|
|
1831
|
+
let terminationReason = "terminated";
|
|
1832
|
+
for (let turn = 1; turn <= maxTurns; turn += 1) {
|
|
1833
|
+
const turnMetrics = { turn, morph_api_ms: 0, local_tools_ms: 0 };
|
|
1834
|
+
enforceContextLimit(messages);
|
|
1835
|
+
const modelCallStart = Date.now();
|
|
1836
|
+
const assistantContent = await callModel(messages, model, {
|
|
1837
|
+
morphApiKey: config.morphApiKey,
|
|
1838
|
+
morphApiUrl: config.morphApiUrl,
|
|
1839
|
+
retryConfig: config.retryConfig,
|
|
1840
|
+
timeout: timeoutMs
|
|
1841
|
+
}).catch((e) => {
|
|
1842
|
+
const errMsg = e instanceof Error ? e.message : String(e);
|
|
1843
|
+
console.error(`[warp_grep:stream] Morph API call failed on turn ${turn}:`, errMsg);
|
|
1844
|
+
errors.push({ message: errMsg });
|
|
1845
|
+
return "";
|
|
1846
|
+
});
|
|
1847
|
+
turnMetrics.morph_api_ms = Date.now() - modelCallStart;
|
|
1848
|
+
if (!assistantContent) {
|
|
1849
|
+
console.error(`[warp_grep:stream] Empty response from Morph API on turn ${turn}. Errors so far:`, errors);
|
|
1850
|
+
timings.turns.push(turnMetrics);
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
messages.push({ role: "assistant", content: assistantContent });
|
|
1854
|
+
const toolCalls = parser.parse(assistantContent);
|
|
1855
|
+
if (toolCalls.length === 0) {
|
|
1856
|
+
console.error(`[warp_grep:stream] No tool calls parsed on turn ${turn}. Assistant content (first 500 chars):`, assistantContent.slice(0, 500));
|
|
1857
|
+
errors.push({ message: "No tool calls produced by the model. Your MCP is likely out of date! Update it by running: rm -rf ~/.npm/_npx && npm cache clean --force && npx -y @morphllm/morphmcp@latest" });
|
|
1858
|
+
terminationReason = "terminated";
|
|
1859
|
+
timings.turns.push(turnMetrics);
|
|
1860
|
+
break;
|
|
1861
|
+
}
|
|
1862
|
+
yield {
|
|
1863
|
+
turn,
|
|
1864
|
+
toolCalls: toolCalls.map((c) => ({
|
|
1865
|
+
name: c.name,
|
|
1866
|
+
arguments: c.arguments ?? {}
|
|
1867
|
+
}))
|
|
1868
|
+
};
|
|
1869
|
+
const finishCalls = toolCalls.filter((c) => c.name === "finish");
|
|
1870
|
+
const grepCalls = toolCalls.filter((c) => c.name === "grep");
|
|
1871
|
+
const listDirCalls = toolCalls.filter((c) => c.name === "list_directory");
|
|
1872
|
+
const readCalls = toolCalls.filter((c) => c.name === "read");
|
|
1873
|
+
const skipCalls = toolCalls.filter((c) => c.name === "_skip");
|
|
1874
|
+
const formatted = [];
|
|
1875
|
+
for (const c of skipCalls) {
|
|
1876
|
+
const msg = c.arguments?.message || "Command skipped due to parsing error";
|
|
1877
|
+
formatted.push(msg);
|
|
1878
|
+
}
|
|
1879
|
+
const allPromises = [];
|
|
1880
|
+
for (const c of grepCalls) {
|
|
1881
|
+
const args = c.arguments ?? {};
|
|
1882
|
+
allPromises.push(
|
|
1883
|
+
toolGrep(provider, args).then(
|
|
1884
|
+
({ output }) => formatAgentToolOutput("grep", args, output, { isError: false }),
|
|
1885
|
+
(err) => formatAgentToolOutput("grep", args, String(err), { isError: true })
|
|
1886
|
+
)
|
|
1887
|
+
);
|
|
1888
|
+
}
|
|
1889
|
+
for (const c of listDirCalls) {
|
|
1890
|
+
const args = c.arguments ?? {};
|
|
1891
|
+
allPromises.push(
|
|
1892
|
+
toolListDirectory(provider, args).then(
|
|
1893
|
+
(p) => formatAgentToolOutput("list_directory", args, p, { isError: false }),
|
|
1894
|
+
(err) => formatAgentToolOutput("list_directory", args, String(err), { isError: true })
|
|
1895
|
+
)
|
|
1896
|
+
);
|
|
1897
|
+
}
|
|
1898
|
+
for (const c of readCalls) {
|
|
1899
|
+
const args = c.arguments ?? {};
|
|
1900
|
+
allPromises.push(
|
|
1901
|
+
toolRead(provider, args).then(
|
|
1902
|
+
(p) => formatAgentToolOutput("read", args, p, { isError: false }),
|
|
1903
|
+
(err) => formatAgentToolOutput("read", args, String(err), { isError: true })
|
|
1904
|
+
)
|
|
1905
|
+
);
|
|
1906
|
+
}
|
|
1907
|
+
const toolExecStart = Date.now();
|
|
1908
|
+
const allResults = await Promise.all(allPromises);
|
|
1909
|
+
turnMetrics.local_tools_ms = Date.now() - toolExecStart;
|
|
1910
|
+
for (const result of allResults) {
|
|
1911
|
+
formatted.push(result);
|
|
1912
|
+
}
|
|
1913
|
+
if (formatted.length > 0) {
|
|
1914
|
+
const turnMessage = formatTurnMessage(turn, maxTurns);
|
|
1915
|
+
const contextBudget = calculateContextBudget(messages);
|
|
1916
|
+
messages.push({ role: "user", content: formatted.join("\n") + turnMessage + "\n" + contextBudget });
|
|
1917
|
+
}
|
|
1918
|
+
timings.turns.push(turnMetrics);
|
|
1919
|
+
if (finishCalls.length) {
|
|
1920
|
+
const fc = finishCalls[0];
|
|
1921
|
+
const files = fc.arguments?.files ?? [];
|
|
1922
|
+
const textResult = fc.arguments?.textResult;
|
|
1923
|
+
finishMeta = { files };
|
|
1924
|
+
terminationReason = "completed";
|
|
1925
|
+
if (files.length === 0) {
|
|
1926
|
+
const payload2 = textResult || "No relevant code found.";
|
|
1927
|
+
timings.total_ms = Date.now() - totalStart;
|
|
1928
|
+
return {
|
|
1929
|
+
terminationReason: "completed",
|
|
1930
|
+
messages,
|
|
1931
|
+
finish: { payload: payload2, metadata: finishMeta },
|
|
1932
|
+
timings
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
break;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
if (terminationReason !== "completed" || !finishMeta) {
|
|
1939
|
+
timings.total_ms = Date.now() - totalStart;
|
|
1940
|
+
return { terminationReason, messages, errors, timings };
|
|
1941
|
+
}
|
|
1942
|
+
const parts = ["Relevant context found:"];
|
|
1943
|
+
for (const f of finishMeta.files) {
|
|
1944
|
+
const ranges = f.lines === "*" ? "*" : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(", ") : "*";
|
|
1945
|
+
parts.push(`- ${f.path}: ${ranges}`);
|
|
1946
|
+
}
|
|
1947
|
+
const payload = parts.join("\n");
|
|
1948
|
+
const finishResolutionStart = Date.now();
|
|
1949
|
+
const fileReadErrors = [];
|
|
1950
|
+
const resolved = await readFinishFiles(
|
|
1951
|
+
repoRoot,
|
|
1952
|
+
finishMeta.files,
|
|
1953
|
+
async (p, s, e) => {
|
|
1954
|
+
try {
|
|
1955
|
+
const rr = await provider.read({ path: p, start: s, end: e });
|
|
1956
|
+
return rr.lines.map((l) => {
|
|
1957
|
+
const idx = l.indexOf("|");
|
|
1958
|
+
return idx >= 0 ? l.slice(idx + 1) : l;
|
|
1959
|
+
});
|
|
1960
|
+
} catch (err) {
|
|
1961
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
1962
|
+
fileReadErrors.push({ path: p, error: errorMsg });
|
|
1963
|
+
console.error(`[warp_grep] Failed to read file: ${p} - ${errorMsg}`);
|
|
1964
|
+
return [`[couldn't find: ${p}]`];
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
);
|
|
1968
|
+
timings.finish_resolution_ms = Date.now() - finishResolutionStart;
|
|
1969
|
+
if (fileReadErrors.length > 0) {
|
|
1970
|
+
errors.push(...fileReadErrors.map((e) => ({ message: `File read error: ${e.path} - ${e.error}` })));
|
|
1971
|
+
}
|
|
1972
|
+
timings.total_ms = Date.now() - totalStart;
|
|
1973
|
+
return {
|
|
1974
|
+
terminationReason: "completed",
|
|
1975
|
+
messages,
|
|
1976
|
+
finish: { payload, metadata: finishMeta, resolved },
|
|
1977
|
+
timings
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1809
1980
|
|
|
1810
1981
|
// tools/warp_grep/providers/remote.ts
|
|
1811
1982
|
init_config();
|
|
@@ -1988,11 +2159,136 @@ var RemoteCommandsProvider = class {
|
|
|
1988
2159
|
}
|
|
1989
2160
|
};
|
|
1990
2161
|
|
|
2162
|
+
// tools/warp_grep/providers/code_storage_http.ts
|
|
2163
|
+
async function post(url, body, op) {
|
|
2164
|
+
const res = await fetch(url, {
|
|
2165
|
+
method: "POST",
|
|
2166
|
+
headers: { "Content-Type": "application/json" },
|
|
2167
|
+
body: JSON.stringify(body)
|
|
2168
|
+
});
|
|
2169
|
+
if (!res.ok) {
|
|
2170
|
+
const text = await res.text().catch(() => res.statusText);
|
|
2171
|
+
throw new Error(`${op} failed (${res.status}): ${text}`);
|
|
2172
|
+
}
|
|
2173
|
+
const data = await res.json();
|
|
2174
|
+
if (data.error) throw new Error(data.error);
|
|
2175
|
+
return data.stdout;
|
|
2176
|
+
}
|
|
2177
|
+
function createCodeStorageHttpCommands(config) {
|
|
2178
|
+
const { baseUrl, repoId, branch } = config;
|
|
2179
|
+
const encodedRepoId = encodeURIComponent(repoId);
|
|
2180
|
+
return {
|
|
2181
|
+
grep: (pattern, path5, glob) => post(`${baseUrl}/api/code-search/${encodedRepoId}/grep`, { pattern, path: path5, glob, branch }, "grep"),
|
|
2182
|
+
read: (path5, start, end) => post(`${baseUrl}/api/code-search/${encodedRepoId}/read`, { path: path5, start, end, branch }, "read"),
|
|
2183
|
+
listDir: (path5, maxDepth) => post(`${baseUrl}/api/code-search/${encodedRepoId}/list`, { path: path5, maxDepth, branch }, "list")
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
// tools/warp_grep/utils/github.ts
|
|
2188
|
+
function parseGitHubUrl(input) {
|
|
2189
|
+
input = input.trim();
|
|
2190
|
+
const urlPattern = /^(?:https?:\/\/)?github\.com\/([^\/]+)\/([^\/\?\#]+)/;
|
|
2191
|
+
const match = input.match(urlPattern);
|
|
2192
|
+
if (match) {
|
|
2193
|
+
return { owner: match[1], repo: match[2].replace(/\.git$/, "") };
|
|
2194
|
+
}
|
|
2195
|
+
const shortPattern = /^([^\/]+)\/([^\/]+)$/;
|
|
2196
|
+
const shortMatch = input.match(shortPattern);
|
|
2197
|
+
if (shortMatch && !shortMatch[1].includes(".")) {
|
|
2198
|
+
return { owner: shortMatch[1], repo: shortMatch[2].replace(/\.git$/, "") };
|
|
2199
|
+
}
|
|
2200
|
+
throw new Error(
|
|
2201
|
+
`Invalid GitHub URL or shorthand: "${input}". Expected "owner/repo" or "https://github.com/owner/repo"`
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
1991
2205
|
// tools/warp_grep/client.ts
|
|
2206
|
+
var DEFAULT_CODE_SEARCH_URL = "https://morphllm.com";
|
|
1992
2207
|
async function getLocalProvider(repoRoot, excludes) {
|
|
1993
2208
|
const { LocalRipgrepProvider: LocalRipgrepProvider2 } = await Promise.resolve().then(() => (init_local(), local_exports));
|
|
1994
2209
|
return new LocalRipgrepProvider2(repoRoot, excludes);
|
|
1995
2210
|
}
|
|
2211
|
+
var WarpGrepClient = class {
|
|
2212
|
+
config;
|
|
2213
|
+
constructor(config = {}) {
|
|
2214
|
+
this.config = { ...config };
|
|
2215
|
+
}
|
|
2216
|
+
execute(input) {
|
|
2217
|
+
const toolConfig = {
|
|
2218
|
+
repoRoot: input.repoRoot,
|
|
2219
|
+
remoteCommands: input.remoteCommands,
|
|
2220
|
+
provider: input.provider,
|
|
2221
|
+
excludes: input.excludes,
|
|
2222
|
+
includes: input.includes,
|
|
2223
|
+
debug: input.debug ?? this.config.debug,
|
|
2224
|
+
morphApiKey: this.config.morphApiKey,
|
|
2225
|
+
morphApiUrl: this.config.morphApiUrl,
|
|
2226
|
+
retryConfig: this.config.retryConfig,
|
|
2227
|
+
timeout: this.config.timeout
|
|
2228
|
+
};
|
|
2229
|
+
if (input.streamSteps) {
|
|
2230
|
+
return executeToolCallStreaming({ query: input.query }, toolConfig);
|
|
2231
|
+
}
|
|
2232
|
+
return executeToolCall({ query: input.query }, toolConfig);
|
|
2233
|
+
}
|
|
2234
|
+
searchGitHub(input) {
|
|
2235
|
+
if (input.streamSteps) {
|
|
2236
|
+
return this._searchGitHubStreaming(input);
|
|
2237
|
+
}
|
|
2238
|
+
return this._searchGitHubAsync(input);
|
|
2239
|
+
}
|
|
2240
|
+
async _resolveGitHubRepo(input) {
|
|
2241
|
+
const { owner, repo } = parseGitHubUrl(input.github);
|
|
2242
|
+
const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;
|
|
2243
|
+
const importRes = await fetch(`${baseUrl}/api/code-search/get-or-create?url=${encodeURIComponent(`${owner}/${repo}`)}`);
|
|
2244
|
+
if (!importRes.ok) {
|
|
2245
|
+
const text = await importRes.text().catch(() => importRes.statusText);
|
|
2246
|
+
throw new Error(`Failed to import repo ${owner}/${repo}: ${text}`);
|
|
2247
|
+
}
|
|
2248
|
+
const { repoId, defaultBranch } = await importRes.json();
|
|
2249
|
+
return {
|
|
2250
|
+
repo,
|
|
2251
|
+
remoteCommands: createCodeStorageHttpCommands({ baseUrl, repoId, branch: input.branch || defaultBranch })
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
async _searchGitHubAsync(input) {
|
|
2255
|
+
try {
|
|
2256
|
+
const { repo, remoteCommands } = await this._resolveGitHubRepo(input);
|
|
2257
|
+
return this.execute({
|
|
2258
|
+
query: input.query,
|
|
2259
|
+
repoRoot: repo,
|
|
2260
|
+
remoteCommands
|
|
2261
|
+
});
|
|
2262
|
+
} catch (error) {
|
|
2263
|
+
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
async *_searchGitHubStreaming(input) {
|
|
2267
|
+
let repo;
|
|
2268
|
+
let remoteCommands;
|
|
2269
|
+
try {
|
|
2270
|
+
({ repo, remoteCommands } = await this._resolveGitHubRepo(input));
|
|
2271
|
+
} catch (error) {
|
|
2272
|
+
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
2273
|
+
}
|
|
2274
|
+
const generator = this.execute({
|
|
2275
|
+
query: input.query,
|
|
2276
|
+
repoRoot: repo,
|
|
2277
|
+
remoteCommands,
|
|
2278
|
+
streamSteps: true
|
|
2279
|
+
});
|
|
2280
|
+
let result;
|
|
2281
|
+
for (; ; ) {
|
|
2282
|
+
const { value, done } = await generator.next();
|
|
2283
|
+
if (done) {
|
|
2284
|
+
result = value;
|
|
2285
|
+
break;
|
|
2286
|
+
}
|
|
2287
|
+
yield value;
|
|
2288
|
+
}
|
|
2289
|
+
return result;
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
1996
2292
|
async function executeToolCall(input, config) {
|
|
1997
2293
|
const parsed = typeof input === "string" ? JSON.parse(input) : input;
|
|
1998
2294
|
const provider = config.remoteCommands ? new RemoteCommandsProvider(config.repoRoot, config.remoteCommands) : config.provider ?? await getLocalProvider(config.repoRoot, config.excludes);
|
|
@@ -2021,6 +2317,46 @@ async function executeToolCall(input, config) {
|
|
|
2021
2317
|
}));
|
|
2022
2318
|
return { success: true, contexts, summary: finish.payload };
|
|
2023
2319
|
}
|
|
2320
|
+
function processAgentResult(result) {
|
|
2321
|
+
const finish = result.finish;
|
|
2322
|
+
if (result.terminationReason !== "completed" || !finish?.metadata) {
|
|
2323
|
+
const errorDetails = result.errors?.map((e) => e.message).join("; ") || "unknown reason";
|
|
2324
|
+
console.error(`[warp_grep] processAgentResult failed. Reason: ${result.terminationReason}. Errors: ${errorDetails}. Turns: ${result.timings?.turns?.length ?? 0}`);
|
|
2325
|
+
return { success: false, error: `Search did not complete: ${errorDetails}` };
|
|
2326
|
+
}
|
|
2327
|
+
const contexts = (finish.resolved ?? []).map((r) => ({
|
|
2328
|
+
file: r.path,
|
|
2329
|
+
content: r.content,
|
|
2330
|
+
lines: r.ranges
|
|
2331
|
+
}));
|
|
2332
|
+
return { success: true, contexts, summary: finish.payload };
|
|
2333
|
+
}
|
|
2334
|
+
async function* executeToolCallStreaming(input, config) {
|
|
2335
|
+
const parsed = typeof input === "string" ? JSON.parse(input) : input;
|
|
2336
|
+
const provider = config.remoteCommands ? new RemoteCommandsProvider(config.repoRoot, config.remoteCommands) : config.provider ?? await getLocalProvider(config.repoRoot, config.excludes);
|
|
2337
|
+
const generator = runWarpGrepStreaming({
|
|
2338
|
+
query: parsed.query,
|
|
2339
|
+
repoRoot: config.repoRoot,
|
|
2340
|
+
provider,
|
|
2341
|
+
excludes: config.excludes,
|
|
2342
|
+
includes: config.includes,
|
|
2343
|
+
debug: config.debug ?? false,
|
|
2344
|
+
morphApiKey: config.morphApiKey,
|
|
2345
|
+
morphApiUrl: config.morphApiUrl,
|
|
2346
|
+
retryConfig: config.retryConfig,
|
|
2347
|
+
timeout: config.timeout
|
|
2348
|
+
});
|
|
2349
|
+
let agentResult;
|
|
2350
|
+
for (; ; ) {
|
|
2351
|
+
const { value, done } = await generator.next();
|
|
2352
|
+
if (done) {
|
|
2353
|
+
agentResult = value;
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
yield value;
|
|
2357
|
+
}
|
|
2358
|
+
return processAgentResult(agentResult);
|
|
2359
|
+
}
|
|
2024
2360
|
function formatResult(result) {
|
|
2025
2361
|
if (!result.success) {
|
|
2026
2362
|
return `Search failed: ${result.error}`;
|
|
@@ -2049,6 +2385,17 @@ function formatResult(result) {
|
|
|
2049
2385
|
// tools/warp_grep/prompts.ts
|
|
2050
2386
|
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
2051
2387
|
var WARP_GREP_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase to gather context, and the task does not involve a single file or function which is provided by name, you should ALWAYS use the warpgrep codebase search tool first instead of running search commands. When the task requires exploration beyond a single known file, invoke warpgrep first with a natural-language query describing the target functionality, bug, or architectural concern. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. Keep queries action-oriented (e.g., "Find where billing invoices are generated and emailed"), and after reviewing the summarized results, you may verify important findings with other search tools or direct file reads to ensure completeness. Warp Grep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task requires exploration beyond a single known file, ALWAYS default to warpgrep codebase search before other search mechanisms.';
|
|
2388
|
+
var GITHUB_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
2389
|
+
var GITHUB_SEARCH_DESCRIPTION = "Search a public GitHub repository using WarpGrep. Provide a GitHub URL or owner/repo shorthand and a natural language query.";
|
|
2390
|
+
var GITHUB_SEARCH_INPUT_SCHEMA = {
|
|
2391
|
+
type: "object",
|
|
2392
|
+
properties: {
|
|
2393
|
+
query: { type: "string", description: "Natural language search query describing what to find in the repository" },
|
|
2394
|
+
github: { type: "string", description: 'GitHub repository URL or owner/repo shorthand (e.g., "vercel/next.js" or "https://github.com/vercel/next.js")' },
|
|
2395
|
+
branch: { type: "string", description: "Branch to search (defaults to the repository default branch)" }
|
|
2396
|
+
},
|
|
2397
|
+
required: ["query", "github"]
|
|
2398
|
+
};
|
|
2052
2399
|
|
|
2053
2400
|
// tools/warp_grep/openai.ts
|
|
2054
2401
|
var TOOL_PARAMETERS = {
|
|
@@ -2090,9 +2437,32 @@ function createWarpGrepTool(config) {
|
|
|
2090
2437
|
}
|
|
2091
2438
|
});
|
|
2092
2439
|
}
|
|
2440
|
+
function createGitHubSearchTool(config) {
|
|
2441
|
+
const client = new WarpGrepClient(config);
|
|
2442
|
+
const tool = {
|
|
2443
|
+
type: "function",
|
|
2444
|
+
function: {
|
|
2445
|
+
name: GITHUB_SEARCH_TOOL_NAME,
|
|
2446
|
+
description: GITHUB_SEARCH_DESCRIPTION,
|
|
2447
|
+
parameters: GITHUB_SEARCH_INPUT_SCHEMA
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
return Object.assign(tool, {
|
|
2451
|
+
execute: async (input) => {
|
|
2452
|
+
return client.searchGitHub(input);
|
|
2453
|
+
},
|
|
2454
|
+
formatResult: (result) => {
|
|
2455
|
+
return formatResult(result);
|
|
2456
|
+
},
|
|
2457
|
+
getSystemPrompt: () => {
|
|
2458
|
+
return getSystemPrompt();
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2093
2462
|
var openai_default = warpGrepTool;
|
|
2094
2463
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2095
2464
|
0 && (module.exports = {
|
|
2465
|
+
createGitHubSearchTool,
|
|
2096
2466
|
createWarpGrepTool,
|
|
2097
2467
|
execute,
|
|
2098
2468
|
formatResult,
|