@morphllm/morphsdk 0.2.122 → 0.2.123
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-2AQLRL4U.js → chunk-5OJE7GH4.js} +2 -2
- package/dist/{chunk-4IU2K63O.js → chunk-ANPZFWYV.js} +2 -2
- package/dist/{chunk-OTGBQEVH.js → chunk-BJ2764MK.js} +2 -2
- package/dist/{chunk-GTANVDUZ.js → chunk-DBSOONOY.js} +2 -2
- package/dist/{chunk-TBLMIAIH.js → chunk-ETTCJWJK.js} +25 -3
- package/dist/chunk-ETTCJWJK.js.map +1 -0
- package/dist/{chunk-RNKHRNSG.js → chunk-FMKJ72KT.js} +2 -2
- package/dist/{chunk-RNKHRNSG.js.map → chunk-FMKJ72KT.js.map} +1 -1
- package/dist/{chunk-EBROW6GK.js → chunk-GXFJLL5O.js} +2 -2
- package/dist/{chunk-4LA3OT4Q.js → chunk-H3U7J5RI.js} +25 -4
- package/dist/chunk-H3U7J5RI.js.map +1 -0
- package/dist/{chunk-LE24SVVU.js → chunk-HVBJ4UO6.js} +2 -2
- package/dist/{chunk-73GZ6KUK.js → chunk-K74GLGST.js} +2 -2
- package/dist/{chunk-4GEBF5OH.js → chunk-KL3AMLGL.js} +2 -2
- package/dist/{chunk-3PMFQ5AV.js → chunk-L426IMZD.js} +2 -2
- package/dist/{chunk-TXT3W4QK.js → chunk-MXSGTN7R.js} +80 -2
- package/dist/chunk-MXSGTN7R.js.map +1 -0
- package/dist/{chunk-2MJEULZU.js → chunk-OFJYDTQI.js} +2 -2
- package/dist/chunk-OTOVGCG6.js +42 -0
- package/dist/chunk-OTOVGCG6.js.map +1 -0
- package/dist/{chunk-7KOUCN6T.js → chunk-QD7KPI7A.js} +2 -2
- package/dist/{chunk-T3T4LGRD.js → chunk-QGRFAVGK.js} +27 -3
- package/dist/chunk-QGRFAVGK.js.map +1 -0
- package/dist/{chunk-L4URLBKV.js → chunk-UHL2ZEWG.js} +3 -3
- package/dist/{chunk-5UUJULLM.js → chunk-UJS3AIWS.js} +2 -2
- package/dist/{chunk-QGE7FGGT.js → chunk-UX65IRCX.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-UDGJQBTC.js → chunk-V4KBK66V.js} +15 -15
- package/dist/{chunk-ZHRT6F72.js → chunk-WE75QX2B.js} +1 -1
- package/dist/{chunk-OWISPSLH.js → chunk-XXL62KSJ.js} +2 -2
- package/dist/{chunk-MQWEZJTP.js → chunk-ZZCMAFN7.js} +5 -5
- package/dist/chunk-ZZCMAFN7.js.map +1 -0
- package/dist/{client-BJrzbMYL.d.ts → client-JHPwle1Z.d.ts} +1 -1
- package/dist/client.cjs +78 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +21 -21
- package/dist/edge.cjs +1 -1
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +4 -4
- package/dist/index.cjs +78 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +22 -22
- 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 +117 -8
- 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 +7 -5
- package/dist/tools/warp_grep/client.cjs +84 -4
- 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 +7 -3
- package/dist/tools/warp_grep/gemini.cjs +114 -6
- 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 +35 -4
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +110 -8
- 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 +15 -5
- package/dist/tools/warp_grep/openai.cjs +120 -8
- 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 +7 -5
- package/dist/tools/warp_grep/providers/code_storage_http.d.ts +1 -1
- package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
- package/dist/tools/warp_grep/vercel.cjs +95 -5
- 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 +7 -5
- 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-2AQLRL4U.js.map → chunk-5OJE7GH4.js.map} +0 -0
- /package/dist/{chunk-4IU2K63O.js.map → chunk-ANPZFWYV.js.map} +0 -0
- /package/dist/{chunk-OTGBQEVH.js.map → chunk-BJ2764MK.js.map} +0 -0
- /package/dist/{chunk-GTANVDUZ.js.map → chunk-DBSOONOY.js.map} +0 -0
- /package/dist/{chunk-EBROW6GK.js.map → chunk-GXFJLL5O.js.map} +0 -0
- /package/dist/{chunk-LE24SVVU.js.map → chunk-HVBJ4UO6.js.map} +0 -0
- /package/dist/{chunk-73GZ6KUK.js.map → chunk-K74GLGST.js.map} +0 -0
- /package/dist/{chunk-4GEBF5OH.js.map → chunk-KL3AMLGL.js.map} +0 -0
- /package/dist/{chunk-3PMFQ5AV.js.map → chunk-L426IMZD.js.map} +0 -0
- /package/dist/{chunk-2MJEULZU.js.map → chunk-OFJYDTQI.js.map} +0 -0
- /package/dist/{chunk-7KOUCN6T.js.map → chunk-QD7KPI7A.js.map} +0 -0
- /package/dist/{chunk-L4URLBKV.js.map → chunk-UHL2ZEWG.js.map} +0 -0
- /package/dist/{chunk-5UUJULLM.js.map → chunk-UJS3AIWS.js.map} +0 -0
- /package/dist/{chunk-QGE7FGGT.js.map → chunk-UX65IRCX.js.map} +0 -0
- /package/dist/{chunk-UDGJQBTC.js.map → chunk-V4KBK66V.js.map} +0 -0
- /package/dist/{chunk-ZHRT6F72.js.map → chunk-WE75QX2B.js.map} +0 -0
- /package/dist/{chunk-OWISPSLH.js.map → chunk-XXL62KSJ.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChatCompletionTool } from 'openai/resources/chat/completions';
|
|
2
2
|
export { formatResult } from './client.js';
|
|
3
3
|
export { getSystemPrompt } from './agent/prompt.js';
|
|
4
|
-
import { d as WarpGrepToolConfig, b as WarpGrepResult,
|
|
4
|
+
import { d as WarpGrepToolConfig, b as WarpGrepResult, g as GitHubSearchToolConfig, h as GitHubReadFileToolConfig, e as GitHubReadFileInput, f as GitHubReadFileResult } from '../../types-DY_hq2eZ.js';
|
|
5
5
|
import './agent/types.js';
|
|
6
6
|
import '../utils/resilience.js';
|
|
7
7
|
import './providers/types.js';
|
|
@@ -112,5 +112,32 @@ declare function createGitHubSearchTool(config: GitHubSearchToolConfig): ChatCom
|
|
|
112
112
|
formatResult: (result: WarpGrepResult) => string;
|
|
113
113
|
getSystemPrompt: () => string;
|
|
114
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Create a GitHub read file tool for OpenAI SDK
|
|
117
|
+
*
|
|
118
|
+
* @param config - Optional configuration (timeout)
|
|
119
|
+
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* import OpenAI from 'openai';
|
|
124
|
+
* import { createGitHubReadFileTool } from '@morphllm/morphsdk/tools/warp-grep/openai';
|
|
125
|
+
*
|
|
126
|
+
* const tool = createGitHubReadFileTool();
|
|
127
|
+
*
|
|
128
|
+
* const response = await openai.chat.completions.create({
|
|
129
|
+
* model: 'gpt-4o',
|
|
130
|
+
* tools: [tool],
|
|
131
|
+
* messages: [{ role: 'user', content: 'Read the package.json from vercel/next.js' }]
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* const result = await tool.execute({ github: 'vercel/next.js', path: 'package.json' });
|
|
135
|
+
* console.log(tool.formatResult(result));
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
declare function createGitHubReadFileTool(config?: GitHubReadFileToolConfig): ChatCompletionTool & {
|
|
139
|
+
execute: (input: GitHubReadFileInput) => Promise<GitHubReadFileResult>;
|
|
140
|
+
formatResult: (result: GitHubReadFileResult) => string;
|
|
141
|
+
};
|
|
115
142
|
|
|
116
|
-
export { createGitHubSearchTool, createWarpGrepTool, warpGrepTool as default, execute, warpGrepTool };
|
|
143
|
+
export { createGitHubReadFileTool, createGitHubSearchTool, createWarpGrepTool, warpGrepTool as default, execute, warpGrepTool };
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createGitHubReadFileTool,
|
|
2
3
|
createGitHubSearchTool,
|
|
3
4
|
createWarpGrepTool,
|
|
4
5
|
execute,
|
|
5
6
|
openai_default,
|
|
6
7
|
warpGrepTool
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-QGRFAVGK.js";
|
|
9
|
+
import "../../chunk-OTOVGCG6.js";
|
|
9
10
|
import {
|
|
10
11
|
formatResult
|
|
11
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-MXSGTN7R.js";
|
|
12
13
|
import "../../chunk-WYYR2EU6.js";
|
|
13
14
|
import "../../chunk-PUGSTXLO.js";
|
|
14
15
|
import "../../chunk-63VHBANJ.js";
|
|
15
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-ZZCMAFN7.js";
|
|
16
17
|
import "../../chunk-3MLWXJTJ.js";
|
|
17
18
|
import "../../chunk-5PNMAWLC.js";
|
|
18
19
|
import "../../chunk-APP75CBN.js";
|
|
@@ -20,9 +21,10 @@ import "../../chunk-GHGJAQSJ.js";
|
|
|
20
21
|
import {
|
|
21
22
|
getSystemPrompt
|
|
22
23
|
} from "../../chunk-FMLHRJDF.js";
|
|
23
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-FMKJ72KT.js";
|
|
24
25
|
import "../../chunk-PZ5AY32C.js";
|
|
25
26
|
export {
|
|
27
|
+
createGitHubReadFileTool,
|
|
26
28
|
createGitHubSearchTool,
|
|
27
29
|
createWarpGrepTool,
|
|
28
30
|
openai_default as default,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WarpGrepProvider, GrepResult, ReadResult, ListDirectoryEntry } from './types.js';
|
|
2
|
-
import { R as RemoteCommands } from '../../../types-
|
|
2
|
+
import { R as RemoteCommands } from '../../../types-DY_hq2eZ.js';
|
|
3
3
|
import '../../utils/resilience.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -572,6 +572,7 @@ Details: ${res.stderr}` : ""}`
|
|
|
572
572
|
// tools/warp_grep/vercel.ts
|
|
573
573
|
var vercel_exports = {};
|
|
574
574
|
__export(vercel_exports, {
|
|
575
|
+
createGitHubReadFileTool: () => createGitHubReadFileTool,
|
|
575
576
|
createGitHubSearchTool: () => createGitHubSearchTool,
|
|
576
577
|
createWarpGrepTool: () => createWarpGrepTool,
|
|
577
578
|
default: () => vercel_default,
|
|
@@ -1381,7 +1382,7 @@ var import_openai = __toESM(require("openai"), 1);
|
|
|
1381
1382
|
// package.json
|
|
1382
1383
|
var package_default = {
|
|
1383
1384
|
name: "@morphllm/morphsdk",
|
|
1384
|
-
version: "0.2.
|
|
1385
|
+
version: "0.2.123",
|
|
1385
1386
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
1386
1387
|
type: "module",
|
|
1387
1388
|
main: "./dist/index.cjs",
|
|
@@ -1631,9 +1632,9 @@ async function callModel(messages, model, options = {}) {
|
|
|
1631
1632
|
});
|
|
1632
1633
|
} catch (error) {
|
|
1633
1634
|
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
);
|
|
1635
|
+
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";
|
|
1636
|
+
const errorText = error.message?.trim();
|
|
1637
|
+
throw new Error(errorText || defaultMsg);
|
|
1637
1638
|
}
|
|
1638
1639
|
throw error;
|
|
1639
1640
|
}
|
|
@@ -2239,6 +2240,23 @@ var WarpGrepClient = class {
|
|
|
2239
2240
|
}
|
|
2240
2241
|
return this._searchGitHubAsync(input);
|
|
2241
2242
|
}
|
|
2243
|
+
/**
|
|
2244
|
+
* Read a single file from a public GitHub repository
|
|
2245
|
+
*
|
|
2246
|
+
* @example
|
|
2247
|
+
* ```typescript
|
|
2248
|
+
* const result = await client.readGitHubFile({
|
|
2249
|
+
* github: 'vercel/next.js',
|
|
2250
|
+
* path: 'src/server/app-render/index.tsx',
|
|
2251
|
+
* startLine: 1,
|
|
2252
|
+
* endLine: 50,
|
|
2253
|
+
* });
|
|
2254
|
+
* if (result.success) console.log(result.content);
|
|
2255
|
+
* ```
|
|
2256
|
+
*/
|
|
2257
|
+
async readGitHubFile(input) {
|
|
2258
|
+
return executeGitHubReadFile(input, { timeout: this.config.timeout });
|
|
2259
|
+
}
|
|
2242
2260
|
async _resolveGitHubRepo(input) {
|
|
2243
2261
|
const { owner, repo } = parseGitHubUrl(input.github);
|
|
2244
2262
|
const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;
|
|
@@ -2359,6 +2377,56 @@ async function* executeToolCallStreaming(input, config) {
|
|
|
2359
2377
|
}
|
|
2360
2378
|
return processAgentResult(agentResult);
|
|
2361
2379
|
}
|
|
2380
|
+
async function fetchRawGitHubFile(owner, repo, filePath, branch, timeout) {
|
|
2381
|
+
const branches = branch ? [branch] : ["HEAD"];
|
|
2382
|
+
const fallbacks = ["main", "master", "develop"];
|
|
2383
|
+
const fetchWithTimeout = (url) => timeout ? fetch(url, { signal: AbortSignal.timeout(timeout) }) : fetch(url);
|
|
2384
|
+
for (const b of branches) {
|
|
2385
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${b}/${filePath}`;
|
|
2386
|
+
const res = await fetchWithTimeout(url);
|
|
2387
|
+
if (res.ok) return { content: await res.text(), branch: b };
|
|
2388
|
+
}
|
|
2389
|
+
for (const fb of fallbacks) {
|
|
2390
|
+
if (branch && fb === branch) continue;
|
|
2391
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${fb}/${filePath}`;
|
|
2392
|
+
const res = await fetchWithTimeout(url);
|
|
2393
|
+
if (res.ok) return { content: await res.text(), branch: fb };
|
|
2394
|
+
}
|
|
2395
|
+
throw new Error(`File not found: ${owner}/${repo}/${filePath}`);
|
|
2396
|
+
}
|
|
2397
|
+
async function executeGitHubReadFile(input, config) {
|
|
2398
|
+
try {
|
|
2399
|
+
const { owner, repo } = parseGitHubUrl(input.github);
|
|
2400
|
+
const { content: raw, branch } = await fetchRawGitHubFile(
|
|
2401
|
+
owner,
|
|
2402
|
+
repo,
|
|
2403
|
+
input.path,
|
|
2404
|
+
input.branch,
|
|
2405
|
+
config?.timeout
|
|
2406
|
+
);
|
|
2407
|
+
const allLines = raw.split("\n");
|
|
2408
|
+
const totalLines = allLines.length;
|
|
2409
|
+
const start = Math.max(1, input.startLine ?? 1);
|
|
2410
|
+
const end = Math.min(totalLines, input.endLine ?? totalLines);
|
|
2411
|
+
const selected = allLines.slice(start - 1, end);
|
|
2412
|
+
const padWidth = String(end).length;
|
|
2413
|
+
const numbered = selected.map((line, i) => `${String(start + i).padStart(padWidth)}|${line}`).join("\n");
|
|
2414
|
+
return {
|
|
2415
|
+
success: true,
|
|
2416
|
+
content: numbered,
|
|
2417
|
+
path: input.path,
|
|
2418
|
+
github: `${owner}/${repo}`,
|
|
2419
|
+
branch,
|
|
2420
|
+
lineRange: [start, end],
|
|
2421
|
+
totalLines
|
|
2422
|
+
};
|
|
2423
|
+
} catch (error) {
|
|
2424
|
+
return {
|
|
2425
|
+
success: false,
|
|
2426
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2427
|
+
};
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2362
2430
|
function formatResult(result) {
|
|
2363
2431
|
if (!result.success) {
|
|
2364
2432
|
return `Search failed: ${result.error}`;
|
|
@@ -2386,7 +2454,9 @@ function formatResult(result) {
|
|
|
2386
2454
|
|
|
2387
2455
|
// tools/warp_grep/prompts.ts
|
|
2388
2456
|
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.';
|
|
2389
|
-
var
|
|
2457
|
+
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.';
|
|
2458
|
+
var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
|
|
2459
|
+
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.";
|
|
2390
2460
|
|
|
2391
2461
|
// tools/warp_grep/vercel.ts
|
|
2392
2462
|
var warpGrepJsonSchema = {
|
|
@@ -2457,9 +2527,29 @@ function createGitHubSearchTool(config) {
|
|
|
2457
2527
|
}
|
|
2458
2528
|
});
|
|
2459
2529
|
}
|
|
2530
|
+
function createGitHubReadFileTool(config) {
|
|
2531
|
+
return (0, import_ai.tool)({
|
|
2532
|
+
description: GITHUB_READ_FILE_DESCRIPTION,
|
|
2533
|
+
inputSchema: import_zod.z.object({
|
|
2534
|
+
github: import_zod.z.string().describe('owner/repo shorthand (e.g., "vercel/next.js")'),
|
|
2535
|
+
path: import_zod.z.string().describe("File path within the repository"),
|
|
2536
|
+
startLine: import_zod.z.number().optional().describe("Start line number (1-based)"),
|
|
2537
|
+
endLine: import_zod.z.number().optional().describe("End line number (1-based, inclusive)"),
|
|
2538
|
+
branch: import_zod.z.string().optional().describe("Branch to read from (defaults to repo default branch)")
|
|
2539
|
+
}),
|
|
2540
|
+
execute: async (params) => {
|
|
2541
|
+
const result = await executeGitHubReadFile(params, config);
|
|
2542
|
+
if (!result.success) {
|
|
2543
|
+
throw new Error(`GitHub read file failed: ${result.error}`);
|
|
2544
|
+
}
|
|
2545
|
+
return result;
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2460
2549
|
var vercel_default = createWarpGrepTool;
|
|
2461
2550
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2462
2551
|
0 && (module.exports = {
|
|
2552
|
+
createGitHubReadFileTool,
|
|
2463
2553
|
createGitHubSearchTool,
|
|
2464
2554
|
createWarpGrepTool,
|
|
2465
2555
|
execute,
|