@morphllm/morphsdk 0.2.122 → 0.2.124
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-T3T4LGRD.js → chunk-27BLOUAR.js} +27 -3
- package/dist/chunk-27BLOUAR.js.map +1 -0
- package/dist/{chunk-2MJEULZU.js → chunk-34UAUD5I.js} +2 -2
- package/dist/{chunk-OTGBQEVH.js → chunk-3ZO2UAYM.js} +2 -2
- package/dist/{chunk-L4URLBKV.js → chunk-A2OVRHEW.js} +3 -3
- package/dist/{chunk-7KOUCN6T.js → chunk-BFJAFWMR.js} +2 -2
- package/dist/{chunk-5UUJULLM.js → chunk-DUJ32DHI.js} +2 -2
- package/dist/{chunk-73GZ6KUK.js → chunk-EIJAUTHH.js} +2 -2
- package/dist/{chunk-OWISPSLH.js → chunk-F7VTQZH7.js} +2 -2
- package/dist/{chunk-WYYR2EU6.js → chunk-GVGJIXV2.js} +7 -2
- package/dist/chunk-GVGJIXV2.js.map +1 -0
- package/dist/{chunk-MQWEZJTP.js → chunk-HHRHUUGN.js} +5 -5
- package/dist/chunk-HHRHUUGN.js.map +1 -0
- package/dist/{chunk-TBLMIAIH.js → chunk-ICLIJKYL.js} +25 -3
- package/dist/chunk-ICLIJKYL.js.map +1 -0
- package/dist/{chunk-4GEBF5OH.js → chunk-KAI2DLL5.js} +2 -2
- package/dist/{chunk-GTANVDUZ.js → chunk-KQRX2K2W.js} +2 -2
- package/dist/{chunk-4LA3OT4Q.js → chunk-M6VWLSL4.js} +25 -4
- package/dist/chunk-M6VWLSL4.js.map +1 -0
- package/dist/{chunk-EBROW6GK.js → chunk-N6YX3M4I.js} +2 -2
- package/dist/chunk-OTOVGCG6.js +42 -0
- package/dist/chunk-OTOVGCG6.js.map +1 -0
- package/dist/{chunk-TXT3W4QK.js → chunk-S4RLT56A.js} +81 -3
- package/dist/chunk-S4RLT56A.js.map +1 -0
- package/dist/{chunk-RNKHRNSG.js → chunk-SGRNIWJD.js} +2 -2
- package/dist/{chunk-RNKHRNSG.js.map → chunk-SGRNIWJD.js.map} +1 -1
- package/dist/{chunk-QGE7FGGT.js → chunk-STPK3AAF.js} +2 -2
- package/dist/{chunk-64KNVHR4.js → chunk-V3HLOZK2.js} +1 -1
- package/dist/{chunk-64KNVHR4.js.map → chunk-V3HLOZK2.js.map} +1 -1
- package/dist/{chunk-LE24SVVU.js → chunk-VKQLHW6G.js} +2 -2
- package/dist/{chunk-3PMFQ5AV.js → chunk-W4PYHVIJ.js} +2 -2
- package/dist/{chunk-2AQLRL4U.js → chunk-WG5E7MMA.js} +2 -2
- package/dist/{chunk-4IU2K63O.js → chunk-Z7U7ZRMP.js} +2 -2
- package/dist/{chunk-ZHRT6F72.js → chunk-ZD5PEXNS.js} +1 -1
- package/dist/{chunk-UDGJQBTC.js → chunk-ZVVCJGNL.js} +15 -15
- package/dist/{client-BJrzbMYL.d.ts → client-JHPwle1Z.d.ts} +1 -1
- package/dist/client.cjs +84 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +22 -22
- package/dist/edge.cjs +1 -1
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +4 -4
- package/dist/index.cjs +84 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -23
- package/dist/modelrouter/core.cjs +1 -1
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +3 -3
- package/dist/modelrouter/index.cjs +1 -1
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +3 -3
- package/dist/tools/browser/anthropic.cjs +1 -1
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +5 -5
- package/dist/tools/browser/core.cjs +1 -1
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +4 -4
- package/dist/tools/browser/index.cjs +1 -1
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +7 -7
- package/dist/tools/browser/openai.cjs +1 -1
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +5 -5
- package/dist/tools/browser/profiles/core.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +5 -5
- package/dist/tools/codebase_search/anthropic.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +4 -4
- package/dist/tools/fastapply/anthropic.cjs +1 -1
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +4 -4
- package/dist/tools/fastapply/apply.cjs +1 -1
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +1 -1
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +3 -3
- package/dist/tools/fastapply/index.cjs +1 -1
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +6 -6
- package/dist/tools/fastapply/openai.cjs +1 -1
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +4 -4
- package/dist/tools/fastapply/vercel.cjs +1 -1
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +4 -4
- package/dist/tools/index.cjs +1 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +6 -6
- package/dist/tools/utils/resilience.cjs +1 -1
- 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 +4 -4
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +2 -2
- package/dist/tools/warp_grep/anthropic.cjs +123 -9
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +29 -2
- package/dist/tools/warp_grep/anthropic.js +8 -6
- package/dist/tools/warp_grep/client.cjs +90 -5
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.d.ts +27 -2
- package/dist/tools/warp_grep/client.js +8 -4
- package/dist/tools/warp_grep/gemini.cjs +120 -7
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +29 -2
- package/dist/tools/warp_grep/gemini.js +36 -5
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +116 -9
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +32 -4
- package/dist/tools/warp_grep/index.js +16 -6
- package/dist/tools/warp_grep/openai.cjs +126 -9
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +29 -2
- package/dist/tools/warp_grep/openai.js +8 -6
- package/dist/tools/warp_grep/providers/code_storage_http.cjs +6 -1
- package/dist/tools/warp_grep/providers/code_storage_http.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/code_storage_http.d.ts +1 -1
- package/dist/tools/warp_grep/providers/code_storage_http.js +1 -1
- package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
- package/dist/tools/warp_grep/vercel.cjs +101 -6
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +30 -2
- package/dist/tools/warp_grep/vercel.js +8 -6
- package/dist/{types-CA7989hK.d.ts → types-DY_hq2eZ.d.ts} +37 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4LA3OT4Q.js.map +0 -1
- package/dist/chunk-KJZMKDDP.js +0 -23
- package/dist/chunk-KJZMKDDP.js.map +0 -1
- package/dist/chunk-MQWEZJTP.js.map +0 -1
- package/dist/chunk-T3T4LGRD.js.map +0 -1
- package/dist/chunk-TBLMIAIH.js.map +0 -1
- package/dist/chunk-TXT3W4QK.js.map +0 -1
- package/dist/chunk-WYYR2EU6.js.map +0 -1
- /package/dist/{chunk-2MJEULZU.js.map → chunk-34UAUD5I.js.map} +0 -0
- /package/dist/{chunk-OTGBQEVH.js.map → chunk-3ZO2UAYM.js.map} +0 -0
- /package/dist/{chunk-L4URLBKV.js.map → chunk-A2OVRHEW.js.map} +0 -0
- /package/dist/{chunk-7KOUCN6T.js.map → chunk-BFJAFWMR.js.map} +0 -0
- /package/dist/{chunk-5UUJULLM.js.map → chunk-DUJ32DHI.js.map} +0 -0
- /package/dist/{chunk-73GZ6KUK.js.map → chunk-EIJAUTHH.js.map} +0 -0
- /package/dist/{chunk-OWISPSLH.js.map → chunk-F7VTQZH7.js.map} +0 -0
- /package/dist/{chunk-4GEBF5OH.js.map → chunk-KAI2DLL5.js.map} +0 -0
- /package/dist/{chunk-GTANVDUZ.js.map → chunk-KQRX2K2W.js.map} +0 -0
- /package/dist/{chunk-EBROW6GK.js.map → chunk-N6YX3M4I.js.map} +0 -0
- /package/dist/{chunk-QGE7FGGT.js.map → chunk-STPK3AAF.js.map} +0 -0
- /package/dist/{chunk-LE24SVVU.js.map → chunk-VKQLHW6G.js.map} +0 -0
- /package/dist/{chunk-3PMFQ5AV.js.map → chunk-W4PYHVIJ.js.map} +0 -0
- /package/dist/{chunk-2AQLRL4U.js.map → chunk-WG5E7MMA.js.map} +0 -0
- /package/dist/{chunk-4IU2K63O.js.map → chunk-Z7U7ZRMP.js.map} +0 -0
- /package/dist/{chunk-ZHRT6F72.js.map → chunk-ZD5PEXNS.js.map} +0 -0
- /package/dist/{chunk-UDGJQBTC.js.map → chunk-ZVVCJGNL.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export { WarpGrepClient, executeToolCall, executeWarpGrep, formatResult } from './client.js';
|
|
3
|
-
export { G as GitHubSearchInput,
|
|
2
|
+
export { WarpGrepClient, executeGitHubReadFile, executeToolCall, executeWarpGrep, formatGitHubReadFileResult, formatResult } from './client.js';
|
|
3
|
+
export { e as GitHubReadFileInput, f as GitHubReadFileResult, h as GitHubReadFileToolConfig, G as GitHubSearchInput, g as GitHubSearchToolConfig, R as RemoteCommands, W as WarpGrepClientConfig, c as WarpGrepContext, a as WarpGrepInput, b as WarpGrepResult, d as WarpGrepToolConfig } from '../../types-DY_hq2eZ.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';
|
|
@@ -24,7 +24,7 @@ declare const WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
|
24
24
|
*/
|
|
25
25
|
declare const WARP_GREP_DESCRIPTION: string;
|
|
26
26
|
declare const GITHUB_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
27
|
-
declare const GITHUB_SEARCH_DESCRIPTION
|
|
27
|
+
declare const GITHUB_SEARCH_DESCRIPTION: string;
|
|
28
28
|
declare const GITHUB_SEARCH_INPUT_SCHEMA: {
|
|
29
29
|
type: "object";
|
|
30
30
|
properties: {
|
|
@@ -43,6 +43,34 @@ declare const GITHUB_SEARCH_INPUT_SCHEMA: {
|
|
|
43
43
|
};
|
|
44
44
|
required: readonly ["query", "github"];
|
|
45
45
|
};
|
|
46
|
+
declare const GITHUB_READ_FILE_TOOL_NAME = "readfile_github_search";
|
|
47
|
+
declare const GITHUB_READ_FILE_DESCRIPTION: string;
|
|
48
|
+
declare const GITHUB_READ_FILE_INPUT_SCHEMA: {
|
|
49
|
+
type: "object";
|
|
50
|
+
properties: {
|
|
51
|
+
github: {
|
|
52
|
+
type: "string";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
path: {
|
|
56
|
+
type: "string";
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
startLine: {
|
|
60
|
+
type: "number";
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
endLine: {
|
|
64
|
+
type: "number";
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
branch: {
|
|
68
|
+
type: "string";
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
required: readonly ["github", "path"];
|
|
73
|
+
};
|
|
46
74
|
|
|
47
75
|
/**
|
|
48
76
|
* Morph Warp Grep SDK
|
|
@@ -131,4 +159,4 @@ declare const warpGrepInputSchema: z.ZodObject<{
|
|
|
131
159
|
}>;
|
|
132
160
|
type WarpGrepInputSchema = z.infer<typeof warpGrepInputSchema>;
|
|
133
161
|
|
|
134
|
-
export { GITHUB_SEARCH_DESCRIPTION, GITHUB_SEARCH_INPUT_SCHEMA, GITHUB_SEARCH_TOOL_NAME, WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, type WarpGrepInputSchema, warpGrepInputSchema };
|
|
162
|
+
export { GITHUB_READ_FILE_DESCRIPTION, GITHUB_READ_FILE_INPUT_SCHEMA, GITHUB_READ_FILE_TOOL_NAME, 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-V3HLOZK2.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalRipgrepProvider
|
|
6
6
|
} from "../../chunk-EF7ZYLA2.js";
|
|
@@ -10,21 +10,26 @@ import {
|
|
|
10
10
|
} from "../../chunk-YPKNMYD4.js";
|
|
11
11
|
import "../../chunk-TPP2UGQP.js";
|
|
12
12
|
import {
|
|
13
|
+
GITHUB_READ_FILE_DESCRIPTION,
|
|
14
|
+
GITHUB_READ_FILE_INPUT_SCHEMA,
|
|
15
|
+
GITHUB_READ_FILE_TOOL_NAME,
|
|
13
16
|
GITHUB_SEARCH_DESCRIPTION,
|
|
14
17
|
GITHUB_SEARCH_INPUT_SCHEMA,
|
|
15
18
|
GITHUB_SEARCH_TOOL_NAME,
|
|
16
19
|
WARP_GREP_DESCRIPTION,
|
|
17
20
|
WARP_GREP_TOOL_NAME
|
|
18
|
-
} from "../../chunk-
|
|
21
|
+
} from "../../chunk-OTOVGCG6.js";
|
|
19
22
|
import {
|
|
20
23
|
WarpGrepClient,
|
|
24
|
+
executeGitHubReadFile,
|
|
21
25
|
executeToolCall,
|
|
22
26
|
executeWarpGrep,
|
|
27
|
+
formatGitHubReadFileResult,
|
|
23
28
|
formatResult
|
|
24
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-S4RLT56A.js";
|
|
25
30
|
import {
|
|
26
31
|
createCodeStorageHttpCommands
|
|
27
|
-
} from "../../chunk-
|
|
32
|
+
} from "../../chunk-GVGJIXV2.js";
|
|
28
33
|
import {
|
|
29
34
|
RemoteCommandsProvider
|
|
30
35
|
} from "../../chunk-PUGSTXLO.js";
|
|
@@ -32,7 +37,7 @@ import "../../chunk-63VHBANJ.js";
|
|
|
32
37
|
import {
|
|
33
38
|
runWarpGrep,
|
|
34
39
|
runWarpGrepStreaming
|
|
35
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-HHRHUUGN.js";
|
|
36
41
|
import {
|
|
37
42
|
normalizeFinishFiles,
|
|
38
43
|
readFinishFiles,
|
|
@@ -47,9 +52,12 @@ import {
|
|
|
47
52
|
SYSTEM_PROMPT,
|
|
48
53
|
getSystemPrompt
|
|
49
54
|
} from "../../chunk-FMLHRJDF.js";
|
|
50
|
-
import "../../chunk-
|
|
55
|
+
import "../../chunk-SGRNIWJD.js";
|
|
51
56
|
import "../../chunk-PZ5AY32C.js";
|
|
52
57
|
export {
|
|
58
|
+
GITHUB_READ_FILE_DESCRIPTION,
|
|
59
|
+
GITHUB_READ_FILE_INPUT_SCHEMA,
|
|
60
|
+
GITHUB_READ_FILE_TOOL_NAME,
|
|
53
61
|
GITHUB_SEARCH_DESCRIPTION,
|
|
54
62
|
GITHUB_SEARCH_INPUT_SCHEMA,
|
|
55
63
|
GITHUB_SEARCH_TOOL_NAME,
|
|
@@ -60,9 +68,11 @@ export {
|
|
|
60
68
|
WARP_GREP_TOOL_NAME,
|
|
61
69
|
WarpGrepClient,
|
|
62
70
|
createCodeStorageHttpCommands,
|
|
71
|
+
executeGitHubReadFile,
|
|
63
72
|
executeToolCall,
|
|
64
73
|
executeWarpGrep,
|
|
65
74
|
fixPathRepetition,
|
|
75
|
+
formatGitHubReadFileResult,
|
|
66
76
|
formatResult,
|
|
67
77
|
getSystemPrompt,
|
|
68
78
|
normalizeFinishFiles,
|
|
@@ -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
|
+
createGitHubReadFileTool: () => createGitHubReadFileTool,
|
|
575
576
|
createGitHubSearchTool: () => createGitHubSearchTool,
|
|
576
577
|
createWarpGrepTool: () => createWarpGrepTool,
|
|
577
578
|
default: () => openai_default,
|
|
@@ -1379,7 +1380,7 @@ var import_openai = __toESM(require("openai"), 1);
|
|
|
1379
1380
|
// package.json
|
|
1380
1381
|
var package_default = {
|
|
1381
1382
|
name: "@morphllm/morphsdk",
|
|
1382
|
-
version: "0.2.
|
|
1383
|
+
version: "0.2.124",
|
|
1383
1384
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
1384
1385
|
type: "module",
|
|
1385
1386
|
main: "./dist/index.cjs",
|
|
@@ -1629,9 +1630,9 @@ async function callModel(messages, model, options = {}) {
|
|
|
1629
1630
|
});
|
|
1630
1631
|
} catch (error) {
|
|
1631
1632
|
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
);
|
|
1633
|
+
const defaultMsg = "The endpoint you are trying to call is likely deprecated. Please update with: npm cache clean --force && npx -y @morphllm/morphmcp@latest or visit: https://morphllm.com/mcp";
|
|
1634
|
+
const errorText = error.message?.trim();
|
|
1635
|
+
throw new Error(errorText || defaultMsg);
|
|
1635
1636
|
}
|
|
1636
1637
|
throw error;
|
|
1637
1638
|
}
|
|
@@ -2168,7 +2169,12 @@ async function post(url, body, op) {
|
|
|
2168
2169
|
});
|
|
2169
2170
|
if (!res.ok) {
|
|
2170
2171
|
const text = await res.text().catch(() => res.statusText);
|
|
2171
|
-
|
|
2172
|
+
try {
|
|
2173
|
+
const parsed = JSON.parse(text);
|
|
2174
|
+
if (parsed.error) return `Error: ${parsed.error}`;
|
|
2175
|
+
} catch {
|
|
2176
|
+
}
|
|
2177
|
+
return `Error: ${op} failed (${res.status}): ${text}`;
|
|
2172
2178
|
}
|
|
2173
2179
|
const data = await res.json();
|
|
2174
2180
|
if (data.error) throw new Error(data.error);
|
|
@@ -2237,6 +2243,23 @@ var WarpGrepClient = class {
|
|
|
2237
2243
|
}
|
|
2238
2244
|
return this._searchGitHubAsync(input);
|
|
2239
2245
|
}
|
|
2246
|
+
/**
|
|
2247
|
+
* Read a single file from a public GitHub repository
|
|
2248
|
+
*
|
|
2249
|
+
* @example
|
|
2250
|
+
* ```typescript
|
|
2251
|
+
* const result = await client.readGitHubFile({
|
|
2252
|
+
* github: 'vercel/next.js',
|
|
2253
|
+
* path: 'src/server/app-render/index.tsx',
|
|
2254
|
+
* startLine: 1,
|
|
2255
|
+
* endLine: 50,
|
|
2256
|
+
* });
|
|
2257
|
+
* if (result.success) console.log(result.content);
|
|
2258
|
+
* ```
|
|
2259
|
+
*/
|
|
2260
|
+
async readGitHubFile(input) {
|
|
2261
|
+
return executeGitHubReadFile(input, { timeout: this.config.timeout });
|
|
2262
|
+
}
|
|
2240
2263
|
async _resolveGitHubRepo(input) {
|
|
2241
2264
|
const { owner, repo } = parseGitHubUrl(input.github);
|
|
2242
2265
|
const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;
|
|
@@ -2357,6 +2380,65 @@ async function* executeToolCallStreaming(input, config) {
|
|
|
2357
2380
|
}
|
|
2358
2381
|
return processAgentResult(agentResult);
|
|
2359
2382
|
}
|
|
2383
|
+
async function fetchRawGitHubFile(owner, repo, filePath, branch, timeout) {
|
|
2384
|
+
const branches = branch ? [branch] : ["HEAD"];
|
|
2385
|
+
const fallbacks = ["main", "master", "develop"];
|
|
2386
|
+
const fetchWithTimeout = (url) => timeout ? fetch(url, { signal: AbortSignal.timeout(timeout) }) : fetch(url);
|
|
2387
|
+
for (const b of branches) {
|
|
2388
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${b}/${filePath}`;
|
|
2389
|
+
const res = await fetchWithTimeout(url);
|
|
2390
|
+
if (res.ok) return { content: await res.text(), branch: b };
|
|
2391
|
+
}
|
|
2392
|
+
for (const fb of fallbacks) {
|
|
2393
|
+
if (branch && fb === branch) continue;
|
|
2394
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${fb}/${filePath}`;
|
|
2395
|
+
const res = await fetchWithTimeout(url);
|
|
2396
|
+
if (res.ok) return { content: await res.text(), branch: fb };
|
|
2397
|
+
}
|
|
2398
|
+
throw new Error(`File not found: ${owner}/${repo}/${filePath}`);
|
|
2399
|
+
}
|
|
2400
|
+
async function executeGitHubReadFile(input, config) {
|
|
2401
|
+
try {
|
|
2402
|
+
const { owner, repo } = parseGitHubUrl(input.github);
|
|
2403
|
+
const { content: raw, branch } = await fetchRawGitHubFile(
|
|
2404
|
+
owner,
|
|
2405
|
+
repo,
|
|
2406
|
+
input.path,
|
|
2407
|
+
input.branch,
|
|
2408
|
+
config?.timeout
|
|
2409
|
+
);
|
|
2410
|
+
const allLines = raw.split("\n");
|
|
2411
|
+
const totalLines = allLines.length;
|
|
2412
|
+
const start = Math.max(1, input.startLine ?? 1);
|
|
2413
|
+
const end = Math.min(totalLines, input.endLine ?? totalLines);
|
|
2414
|
+
const selected = allLines.slice(start - 1, end);
|
|
2415
|
+
const padWidth = String(end).length;
|
|
2416
|
+
const numbered = selected.map((line, i) => `${String(start + i).padStart(padWidth)}|${line}`).join("\n");
|
|
2417
|
+
return {
|
|
2418
|
+
success: true,
|
|
2419
|
+
content: numbered,
|
|
2420
|
+
path: input.path,
|
|
2421
|
+
github: `${owner}/${repo}`,
|
|
2422
|
+
branch,
|
|
2423
|
+
lineRange: [start, end],
|
|
2424
|
+
totalLines
|
|
2425
|
+
};
|
|
2426
|
+
} catch (error) {
|
|
2427
|
+
return {
|
|
2428
|
+
success: false,
|
|
2429
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
function formatGitHubReadFileResult(result) {
|
|
2434
|
+
if (!result.success) {
|
|
2435
|
+
return `Failed to read file: ${result.error}`;
|
|
2436
|
+
}
|
|
2437
|
+
const rangeStr = result.lineRange ? ` (lines ${result.lineRange[0]}-${result.lineRange[1]} of ${result.totalLines})` : "";
|
|
2438
|
+
return `File: ${result.github}/${result.path}${rangeStr}
|
|
2439
|
+
|
|
2440
|
+
${result.content}`;
|
|
2441
|
+
}
|
|
2360
2442
|
function formatResult(result) {
|
|
2361
2443
|
if (!result.success) {
|
|
2362
2444
|
return `Search failed: ${result.error}`;
|
|
@@ -2385,17 +2467,33 @@ function formatResult(result) {
|
|
|
2385
2467
|
// tools/warp_grep/prompts.ts
|
|
2386
2468
|
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
2387
2469
|
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
|
|
2389
|
-
var
|
|
2390
|
-
var
|
|
2470
|
+
var GITHUB_WARP_GREP_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
2471
|
+
var GITHUB_WARP_GREP_SEARCH_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase of a public GitHub repository (not your local workspace), use warpgrep_github_search instead of warpgrep_codebase_search. When the task requires understanding code in an external repo, invoke warpgrep_github_search with a GitHub URL or owner/repo shorthand (e.g., vercel/next.js) and a natural-language query describing the target functionality, bug, or architectural concern. WarpGrep searches GitHub repos the same way it searches local codebases: fast and accurate. Keep queries action-oriented (e.g., "Find where how the new use workflow directive works"), and after reviewing the results, you may verify important findings with other tools or direct file reads. WarpGrep 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 involves exploring code in an external public repo, ALWAYS use warpgrep_github_search.';
|
|
2472
|
+
var GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA = {
|
|
2391
2473
|
type: "object",
|
|
2392
2474
|
properties: {
|
|
2393
2475
|
query: { type: "string", description: "Natural language search query describing what to find in the repository" },
|
|
2394
|
-
github: { type: "string", description: '
|
|
2476
|
+
github: { type: "string", description: 'owner/repo shorthand (ex: "vercel/next.js" for "https://github.com/vercel/next.js")' },
|
|
2395
2477
|
branch: { type: "string", description: "Branch to search (defaults to the repository default branch)" }
|
|
2396
2478
|
},
|
|
2397
2479
|
required: ["query", "github"]
|
|
2398
2480
|
};
|
|
2481
|
+
var GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;
|
|
2482
|
+
var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
|
|
2483
|
+
var GITHUB_SEARCH_INPUT_SCHEMA = GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA;
|
|
2484
|
+
var GITHUB_READ_FILE_TOOL_NAME = "readfile_github_search";
|
|
2485
|
+
var GITHUB_READ_FILE_DESCRIPTION = "Read a single file (or a line range) from a public GitHub repository. Use this when you already know the exact file path you want to read, for example after finding it via warpgrep_github_search results. Takes owner/repo shorthand and the file path within the repo. Optionally specify startLine and endLine (1-based) to read a specific range. Returns the file content with line numbers.";
|
|
2486
|
+
var GITHUB_READ_FILE_INPUT_SCHEMA = {
|
|
2487
|
+
type: "object",
|
|
2488
|
+
properties: {
|
|
2489
|
+
github: { type: "string", description: 'owner/repo shorthand (e.g., "vercel/next.js")' },
|
|
2490
|
+
path: { type: "string", description: 'File path within the repository (e.g., "src/server/index.ts")' },
|
|
2491
|
+
startLine: { type: "number", description: "Start line number (1-based). Omit to start from beginning." },
|
|
2492
|
+
endLine: { type: "number", description: "End line number (1-based, inclusive). Omit to read to the end." },
|
|
2493
|
+
branch: { type: "string", description: "Branch to read from (defaults to the repository default branch)" }
|
|
2494
|
+
},
|
|
2495
|
+
required: ["github", "path"]
|
|
2496
|
+
};
|
|
2399
2497
|
|
|
2400
2498
|
// tools/warp_grep/openai.ts
|
|
2401
2499
|
var TOOL_PARAMETERS = {
|
|
@@ -2459,9 +2557,28 @@ function createGitHubSearchTool(config) {
|
|
|
2459
2557
|
}
|
|
2460
2558
|
});
|
|
2461
2559
|
}
|
|
2560
|
+
function createGitHubReadFileTool(config) {
|
|
2561
|
+
const tool = {
|
|
2562
|
+
type: "function",
|
|
2563
|
+
function: {
|
|
2564
|
+
name: GITHUB_READ_FILE_TOOL_NAME,
|
|
2565
|
+
description: GITHUB_READ_FILE_DESCRIPTION,
|
|
2566
|
+
parameters: GITHUB_READ_FILE_INPUT_SCHEMA
|
|
2567
|
+
}
|
|
2568
|
+
};
|
|
2569
|
+
return Object.assign(tool, {
|
|
2570
|
+
execute: async (input) => {
|
|
2571
|
+
return executeGitHubReadFile(input, config);
|
|
2572
|
+
},
|
|
2573
|
+
formatResult: (result) => {
|
|
2574
|
+
return formatGitHubReadFileResult(result);
|
|
2575
|
+
}
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2462
2578
|
var openai_default = warpGrepTool;
|
|
2463
2579
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2464
2580
|
0 && (module.exports = {
|
|
2581
|
+
createGitHubReadFileTool,
|
|
2465
2582
|
createGitHubSearchTool,
|
|
2466
2583
|
createWarpGrepTool,
|
|
2467
2584
|
execute,
|