@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/warp_grep/prompts.ts"],"sourcesContent":["/**\n * Prompts and descriptions for warpgrep_codebase_search\n */\n\n/**\n * Default tool name for the warp grep tool\n */\nexport const WARP_GREP_TOOL_NAME = 'warpgrep_codebase_search';\n\n/**\n * Default tool description for the warp grep tool\n */\nexport const WARP_GREP_DESCRIPTION = \n '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. ' +\n '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. ' +\n 'Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. ' +\n '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. ' +\n '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. ' +\n 'When a task requires exploration beyond a single known file, ALWAYS default to warpgrep codebase search before other search mechanisms.'\n\nexport const GITHUB_WARP_GREP_SEARCH_TOOL_NAME = 'warpgrep_github_search';\n\nexport const GITHUB_WARP_GREP_SEARCH_DESCRIPTION =\n '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. ' +\n '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. ' +\n 'WarpGrep searches GitHub repos the same way it searches local codebases: fast and accurate. ' +\n '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. ' +\n '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. ' +\n 'When a task involves exploring code in an external public repo, ALWAYS use warpgrep_github_search.';\n\nexport const GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA = {\n type: 'object' as const,\n properties: {\n query: { type: 'string' as const, description: 'Natural language search query describing what to find in the repository' },\n github: { type: 'string' as const, description: 'owner/repo shorthand (ex: \"vercel/next.js\" for \"https://github.com/vercel/next.js\")' },\n branch: { type: 'string' as const, description: 'Branch to search (defaults to the repository default branch)' },\n },\n required: ['query', 'github'] as const,\n};\n\nexport const GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;\nexport const GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;\nexport const GITHUB_SEARCH_INPUT_SCHEMA = GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA;\n\nexport const GITHUB_READ_FILE_TOOL_NAME = 'readfile_github_search';\n\nexport const GITHUB_READ_FILE_DESCRIPTION =\n 'Read a single file (or a line range) from a public GitHub repository. ' +\n 'Use this when you already know the exact file path you want to read, for example after finding it via warpgrep_github_search results. ' +\n 'Takes owner/repo shorthand and the file path within the repo. Optionally specify startLine and endLine (1-based) to read a specific range. ' +\n 'Returns the file content with line numbers.';\n\nexport const GITHUB_READ_FILE_INPUT_SCHEMA = {\n type: 'object' as const,\n properties: {\n github: { type: 'string' as const, description: 'owner/repo shorthand (e.g., \"vercel/next.js\")' },\n path: { type: 'string' as const, description: 'File path within the repository (e.g., \"src/server/index.ts\")' },\n startLine: { type: 'number' as const, description: 'Start line number (1-based). Omit to start from beginning.' },\n endLine: { type: 'number' as const, description: 'End line number (1-based, inclusive). Omit to read to the end.' },\n branch: { type: 'string' as const, description: 'Branch to read from (defaults to the repository default branch)' },\n },\n required: ['github', 'path'] as const,\n};\n\n/**\n * System prompt for the warp grep agent\n * Re-exported from agent/prompt.ts for convenience\n */\nexport { SYSTEM_PROMPT as WARP_GREP_SYSTEM_PROMPT, getSystemPrompt } from './agent/prompt.js';\n"],"mappings":";AAOO,IAAM,sBAAsB;AAK5B,IAAM,wBACX;AAOK,IAAM,oCAAoC;AAE1C,IAAM,sCACX;AAOK,IAAM,uCAAuC;AAAA,EAClD,MAAM;AAAA,EACN,YAAY;AAAA,IACV,OAAO,EAAE,MAAM,UAAmB,aAAa,0EAA0E;AAAA,IACzH,QAAQ,EAAE,MAAM,UAAmB,aAAa,sFAAsF;AAAA,IACtI,QAAQ,EAAE,MAAM,UAAmB,aAAa,+DAA+D;AAAA,EACjH;AAAA,EACA,UAAU,CAAC,SAAS,QAAQ;AAC9B;AAEO,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAClC,IAAM,6BAA6B;AAEnC,IAAM,6BAA6B;AAEnC,IAAM,+BACX;AAKK,IAAM,gCAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,YAAY;AAAA,IACV,QAAQ,EAAE,MAAM,UAAmB,aAAa,gDAAgD;AAAA,IAChG,MAAM,EAAE,MAAM,UAAmB,aAAa,gEAAgE;AAAA,IAC9G,WAAW,EAAE,MAAM,UAAmB,aAAa,6DAA6D;AAAA,IAChH,SAAS,EAAE,MAAM,UAAmB,aAAa,iEAAiE;AAAA,IAClH,QAAQ,EAAE,MAAM,UAAmB,aAAa,kEAAkE;AAAA,EACpH;AAAA,EACA,UAAU,CAAC,UAAU,MAAM;AAC7B;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQMPVJ2L.js";
|
|
4
4
|
import {
|
|
5
5
|
executeCodebaseSearch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UJS3AIWS.js";
|
|
7
7
|
|
|
8
8
|
// tools/codebase_search/vercel.ts
|
|
9
9
|
import { tool } from "ai";
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
getSystemPrompt,
|
|
56
56
|
vercel_default
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-QD7KPI7A.js.map
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
+
GITHUB_READ_FILE_DESCRIPTION,
|
|
3
|
+
GITHUB_READ_FILE_INPUT_SCHEMA,
|
|
4
|
+
GITHUB_READ_FILE_TOOL_NAME,
|
|
2
5
|
GITHUB_SEARCH_DESCRIPTION,
|
|
3
6
|
GITHUB_SEARCH_INPUT_SCHEMA,
|
|
4
7
|
GITHUB_SEARCH_TOOL_NAME,
|
|
5
8
|
WARP_GREP_DESCRIPTION,
|
|
6
9
|
WARP_GREP_TOOL_NAME
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OTOVGCG6.js";
|
|
8
11
|
import {
|
|
9
12
|
WarpGrepClient,
|
|
13
|
+
executeGitHubReadFile,
|
|
10
14
|
executeToolCall,
|
|
15
|
+
formatGitHubReadFileResult,
|
|
11
16
|
formatResult
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MXSGTN7R.js";
|
|
13
18
|
import {
|
|
14
19
|
getSystemPrompt
|
|
15
20
|
} from "./chunk-FMLHRJDF.js";
|
|
@@ -76,6 +81,24 @@ function createGitHubSearchTool(config) {
|
|
|
76
81
|
}
|
|
77
82
|
});
|
|
78
83
|
}
|
|
84
|
+
function createGitHubReadFileTool(config) {
|
|
85
|
+
const tool = {
|
|
86
|
+
type: "function",
|
|
87
|
+
function: {
|
|
88
|
+
name: GITHUB_READ_FILE_TOOL_NAME,
|
|
89
|
+
description: GITHUB_READ_FILE_DESCRIPTION,
|
|
90
|
+
parameters: GITHUB_READ_FILE_INPUT_SCHEMA
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return Object.assign(tool, {
|
|
94
|
+
execute: async (input) => {
|
|
95
|
+
return executeGitHubReadFile(input, config);
|
|
96
|
+
},
|
|
97
|
+
formatResult: (result) => {
|
|
98
|
+
return formatGitHubReadFileResult(result);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
79
102
|
var openai_default = warpGrepTool;
|
|
80
103
|
|
|
81
104
|
export {
|
|
@@ -83,6 +106,7 @@ export {
|
|
|
83
106
|
execute,
|
|
84
107
|
createWarpGrepTool,
|
|
85
108
|
createGitHubSearchTool,
|
|
109
|
+
createGitHubReadFileTool,
|
|
86
110
|
openai_default
|
|
87
111
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-QGRFAVGK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/warp_grep/openai.ts"],"sourcesContent":["/**\n * OpenAI SDK adapter for morph-warp-grep tool\n */\n\nimport type { ChatCompletionTool } from 'openai/resources/chat/completions';\nimport { executeToolCall, formatResult, WarpGrepClient, executeGitHubReadFile, formatGitHubReadFileResult } from './client.js';\nimport { WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, GITHUB_SEARCH_TOOL_NAME, GITHUB_SEARCH_DESCRIPTION, GITHUB_SEARCH_INPUT_SCHEMA, GITHUB_READ_FILE_TOOL_NAME, GITHUB_READ_FILE_DESCRIPTION, GITHUB_READ_FILE_INPUT_SCHEMA, getSystemPrompt } from './prompts.js';\nimport type { WarpGrepToolConfig, WarpGrepResult, GitHubSearchToolConfig, GitHubReadFileInput, GitHubReadFileResult, GitHubReadFileToolConfig } from './types.js';\n\n/**\n * Input schema for the warp grep tool\n */\nconst TOOL_PARAMETERS = {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Free-form repository question' },\n },\n required: ['query'],\n} as const;\n\n/**\n * OpenAI-native warp grep tool definition\n * \n * @example\n * ```typescript\n * import OpenAI from 'openai';\n * import { warpGrepTool, execute } from '@morphllm/morphsdk/tools/warp-grep/openai';\n * \n * const client = new OpenAI();\n * const response = await client.chat.completions.create({\n * model: 'gpt-4o',\n * tools: [warpGrepTool],\n * messages: [{ role: 'user', content: 'Find authentication middleware' }]\n * });\n * \n * // Execute the tool call\n * const result = await execute({ query: '...' }, { repoRoot: '.' });\n * ```\n */\nexport const warpGrepTool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: WARP_GREP_TOOL_NAME,\n description: WARP_GREP_DESCRIPTION,\n parameters: TOOL_PARAMETERS,\n },\n};\n\n/**\n * Execute warp grep search\n * \n * @param input - Tool input with query\n * @param config - Configuration with repoRoot and optional provider\n * @returns Search results\n */\nexport async function execute(\n input: { query: string } | string,\n config: WarpGrepToolConfig\n): Promise<WarpGrepResult> {\n return executeToolCall(input, config);\n}\n\n// Re-export formatResult and getSystemPrompt for convenience\nexport { formatResult, getSystemPrompt };\n\n/**\n * Create a custom warp grep tool with configuration and methods\n * \n * @param config - Configuration options\n * @returns Tool definition with execute and formatResult methods\n * \n * @example Local usage\n * ```typescript\n * import OpenAI from 'openai';\n * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/openai';\n * \n * const tool = createWarpGrepTool({ repoRoot: '.' });\n * \n * const client = new OpenAI();\n * const response = await client.chat.completions.create({\n * model: 'gpt-4o',\n * tools: [tool],\n * messages: [{ role: 'user', content: 'Find authentication middleware' }]\n * });\n * ```\n * \n * @example Remote sandbox (E2B, Modal, etc.)\n * ```typescript\n * const tool = createMorphWarpGrepTool({\n * repoRoot: '/home/repo',\n * remoteCommands: {\n * grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,\n * read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,\n * listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,\n * },\n * });\n * ```\n */\nexport function createWarpGrepTool(config: WarpGrepToolConfig) {\n const tool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: config.name ?? WARP_GREP_TOOL_NAME,\n description: config.description ?? WARP_GREP_DESCRIPTION,\n parameters: TOOL_PARAMETERS,\n },\n };\n\n return Object.assign(tool, {\n execute: async (input: unknown): Promise<WarpGrepResult> => {\n return executeToolCall(input as { query: string } | string, config);\n },\n formatResult: (result: WarpGrepResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return getSystemPrompt();\n },\n });\n}\n\n/**\n * Create a GitHub search tool for OpenAI SDK\n *\n * @param config - Configuration options (morphApiKey, morphApiUrl, codeSearchUrl, timeout)\n * @returns OpenAI ChatCompletionTool with execute and formatResult methods\n *\n * @example\n * ```typescript\n * import OpenAI from 'openai';\n * import { createGitHubSearchTool } from '@morphllm/morphsdk/tools/warp-grep/openai';\n *\n * const tool = createGitHubSearchTool({ morphApiKey: process.env.MORPH_API_KEY });\n *\n * const response = await openai.chat.completions.create({\n * model: 'gpt-4o',\n * tools: [tool],\n * messages: [{ role: 'user', content: 'How does auth work in vercel/next.js?' }]\n * });\n *\n * // Execute\n * const result = await tool.execute({ query: 'auth middleware', github: 'vercel/next.js' });\n * console.log(tool.formatResult(result));\n * ```\n */\nexport function createGitHubSearchTool(config: GitHubSearchToolConfig) {\n const client = new WarpGrepClient(config);\n\n const tool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: GITHUB_SEARCH_TOOL_NAME,\n description: GITHUB_SEARCH_DESCRIPTION,\n parameters: GITHUB_SEARCH_INPUT_SCHEMA,\n },\n };\n\n return Object.assign(tool, {\n execute: async (input: { query: string; github: string; branch?: string }): Promise<WarpGrepResult> => {\n return client.searchGitHub(input);\n },\n formatResult: (result: WarpGrepResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return getSystemPrompt();\n },\n });\n}\n\n/**\n * Create a GitHub read file tool for OpenAI SDK\n *\n * @param config - Optional configuration (timeout)\n * @returns OpenAI ChatCompletionTool with execute and formatResult methods\n *\n * @example\n * ```typescript\n * import OpenAI from 'openai';\n * import { createGitHubReadFileTool } from '@morphllm/morphsdk/tools/warp-grep/openai';\n *\n * const tool = createGitHubReadFileTool();\n *\n * const response = await openai.chat.completions.create({\n * model: 'gpt-4o',\n * tools: [tool],\n * messages: [{ role: 'user', content: 'Read the package.json from vercel/next.js' }]\n * });\n *\n * const result = await tool.execute({ github: 'vercel/next.js', path: 'package.json' });\n * console.log(tool.formatResult(result));\n * ```\n */\nexport function createGitHubReadFileTool(config?: GitHubReadFileToolConfig) {\n const tool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: GITHUB_READ_FILE_TOOL_NAME,\n description: GITHUB_READ_FILE_DESCRIPTION,\n parameters: GITHUB_READ_FILE_INPUT_SCHEMA,\n },\n };\n\n return Object.assign(tool, {\n execute: async (input: GitHubReadFileInput): Promise<GitHubReadFileResult> => {\n return executeGitHubReadFile(input, config);\n },\n formatResult: (result: GitHubReadFileResult): string => {\n return formatGitHubReadFileResult(result);\n },\n });\n}\n\nexport default warpGrepTool;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,kBAAkB;AAAA,EACtB,MAAM;AAAA,EACN,YAAY;AAAA,IACV,OAAO,EAAE,MAAM,UAAU,aAAa,gCAAgC;AAAA,EACxE;AAAA,EACA,UAAU,CAAC,OAAO;AACpB;AAqBO,IAAM,eAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY;AAAA,EACd;AACF;AASA,eAAsB,QACpB,OACA,QACyB;AACzB,SAAO,gBAAgB,OAAO,MAAM;AACtC;AAsCO,SAAS,mBAAmB,QAA4B;AAC7D,QAAM,OAA2B;AAAA,IAC/B,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM,OAAO,QAAQ;AAAA,MACrB,aAAa,OAAO,eAAe;AAAA,MACnC,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,MAAM;AAAA,IACzB,SAAS,OAAO,UAA4C;AAC1D,aAAO,gBAAgB,OAAqC,MAAM;AAAA,IACpE;AAAA,IACA,cAAc,CAAC,WAAmC;AAChD,aAAO,aAAa,MAAM;AAAA,IAC5B;AAAA,IACA,iBAAiB,MAAc;AAC7B,aAAO,gBAAgB;AAAA,IACzB;AAAA,EACF,CAAC;AACH;AA0BO,SAAS,uBAAuB,QAAgC;AACrE,QAAM,SAAS,IAAI,eAAe,MAAM;AAExC,QAAM,OAA2B;AAAA,IAC/B,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,MAAM;AAAA,IACzB,SAAS,OAAO,UAAuF;AACrG,aAAO,OAAO,aAAa,KAAK;AAAA,IAClC;AAAA,IACA,cAAc,CAAC,WAAmC;AAChD,aAAO,aAAa,MAAM;AAAA,IAC5B;AAAA,IACA,iBAAiB,MAAc;AAC7B,aAAO,gBAAgB;AAAA,IACzB;AAAA,EACF,CAAC;AACH;AAyBO,SAAS,yBAAyB,QAAmC;AAC1E,QAAM,OAA2B;AAAA,IAC/B,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,MAAM;AAAA,IACzB,SAAS,OAAO,UAA8D;AAC5E,aAAO,sBAAsB,OAAO,MAAM;AAAA,IAC5C;AAAA,IACA,cAAc,CAAC,WAAyC;AACtD,aAAO,2BAA2B,MAAM;AAAA,IAC1C;AAAA,EACF,CAAC;AACH;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProfilesClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DBSOONOY.js";
|
|
4
4
|
import {
|
|
5
5
|
buildEmbedCode,
|
|
6
6
|
buildLiveIframe,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
fetchWithRetry,
|
|
12
12
|
withTimeout
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K74GLGST.js";
|
|
14
14
|
|
|
15
15
|
// tools/browser/core.ts
|
|
16
16
|
var DEFAULT_CONFIG = {
|
|
@@ -609,4 +609,4 @@ export {
|
|
|
609
609
|
getWebp,
|
|
610
610
|
checkHealth
|
|
611
611
|
};
|
|
612
|
-
//# sourceMappingURL=chunk-
|
|
612
|
+
//# sourceMappingURL=chunk-UHL2ZEWG.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchWithRetry,
|
|
3
3
|
withTimeout
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K74GLGST.js";
|
|
5
5
|
|
|
6
6
|
// tools/codebase_search/core.ts
|
|
7
7
|
var CodebaseSearchClient = class {
|
|
@@ -102,4 +102,4 @@ export {
|
|
|
102
102
|
CodebaseSearchClient,
|
|
103
103
|
executeCodebaseSearch
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-UJS3AIWS.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeEditFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WE75QX2B.js";
|
|
4
4
|
import {
|
|
5
5
|
EDIT_FILE_SYSTEM_PROMPT,
|
|
6
6
|
EDIT_FILE_TOOL_DESCRIPTION
|
|
@@ -86,4 +86,4 @@ export {
|
|
|
86
86
|
vercel_default,
|
|
87
87
|
vercel_exports
|
|
88
88
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-UX65IRCX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/warp_grep/index.ts"],"sourcesContent":["/**\n * Morph Warp Grep SDK\n * \n * Fast and accurate code search tool for AI agents.\n * Uses ripgrep locally, or use `remoteCommands` for sandbox environments.\n * \n * @example Local usage\n * ```typescript\n * // With MorphClient (recommended)\n * import { MorphClient } from '@morphllm/morphsdk';\n * \n * const morph = new MorphClient({ morphApiKey: process.env.MORPH_API_KEY });\n * const result = await morph.warpGrep.execute({\n * query: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n * ```\n * \n * @example\n * ```typescript\n * // Standalone client\n * import { WarpGrepClient } from '@morphllm/morphsdk/tools/warp-grep';\n * \n * const client = new WarpGrepClient({ morphApiKey: process.env.MORPH_API_KEY });\n * const result = await client.execute({\n * query: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n * ```\n * \n * @example\n * ```typescript\n * // As a tool for AI agents\n * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';\n * \n * const tool = createWarpGrepTool({ repoRoot: '.' });\n * // Pass to Claude, GPT, Gemini, etc.\n * ```\n * \n * @example Remote sandbox (E2B, Modal, Daytona, etc.)\n * ```typescript\n * import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';\n * \n * const tool = createMorphWarpGrepTool({\n * repoRoot: '/home/repo',\n * remoteCommands: {\n * grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,\n * read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,\n * listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,\n * },\n * });\n * ```\n * \n * @example Provider-agnostic usage (bring your own tool abstraction)\n * ```typescript\n * import { \n * warpGrepInputSchema,\n * executeToolCall,\n * WARP_GREP_TOOL_NAME,\n * WARP_GREP_DESCRIPTION,\n * } from '@morphllm/morphsdk/tools/warp-grep';\n * \n * // Use with your own tool definition abstraction\n * const toolDef = createToolDef({\n * name: WARP_GREP_TOOL_NAME,\n * description: WARP_GREP_DESCRIPTION,\n * schema: warpGrepInputSchema,\n * });\n * \n * // Execute\n * const result = await executeToolCall(\n * { query: 'Find auth middleware' },\n * { repoRoot: '.', morphApiKey: process.env.MORPH_API_KEY }\n * );\n * ```\n */\n\nimport { z } from 'zod';\n\n/** Provider-agnostic Zod schema for warp grep input */\nexport const warpGrepInputSchema = z.object({\n query: z.string().describe('Free-form repository question'),\n});\n\nexport type WarpGrepInputSchema = z.infer<typeof warpGrepInputSchema>;\n\n// Core client and functions\nexport { WarpGrepClient, executeWarpGrep, executeToolCall, formatResult } from './client.js';\n\n// Types\nexport type {\n WarpGrepClientConfig,\n WarpGrepInput,\n WarpGrepResult,\n WarpGrepContext,\n WarpGrepToolConfig,\n WarpGrepProvider,\n GrepResult,\n ReadResult,\n ListDirectoryEntry,\n RemoteCommands,\n WarpGrepStep,\n GitHubSearchInput,\n GitHubSearchToolConfig,\n} from './types.js';\n\n// Prompts\nexport {\n WARP_GREP_DESCRIPTION,\n WARP_GREP_TOOL_NAME,\n WARP_GREP_SYSTEM_PROMPT,\n GITHUB_SEARCH_TOOL_NAME,\n GITHUB_SEARCH_DESCRIPTION,\n GITHUB_SEARCH_INPUT_SCHEMA,\n getSystemPrompt,\n} from './prompts.js';\n\n// Providers (re-exported for convenience)\nexport { LocalRipgrepProvider, RemoteCommandsProvider, createCodeStorageHttpCommands } from './providers/index.js';\nexport type { CodeStorageHttpConfig } from './providers/index.js';\n\n// Path utilities (for handling model path prediction issues)\nexport { fixPathRepetition } from './utils/paths.js';\n\n// Agent internals (advanced usage)\nexport { runWarpGrep, runWarpGrepStreaming } from './agent/index.js';\nexport type { AgentRunResult, SessionConfig, ChatMessage } from './agent/index.js';\n\n// Internal agent tools (for harness builders)\nexport { toolGrep, toolRead, toolListDirectory, readFinishFiles, normalizeFinishFiles } from './agent/tools/index.js';\n\n// Provider adapters are available via dedicated import paths:\n// - '@morphllm/morphsdk/tools/warp-grep/anthropic'\n// - '@morphllm/morphsdk/tools/warp-grep/openai'\n// - '@morphllm/morphsdk/tools/warp-grep/gemini'\n// - '@morphllm/morphsdk/tools/warp-grep/vercel'\n"],"mappings":";AA6EA,SAAS,SAAS;AAGX,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,OAAO,EAAE,OAAO,EAAE,SAAS,+BAA+B;AAC5D,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../tools/warp_grep/index.ts"],"sourcesContent":["/**\n * Morph Warp Grep SDK\n * \n * Fast and accurate code search tool for AI agents.\n * Uses ripgrep locally, or use `remoteCommands` for sandbox environments.\n * \n * @example Local usage\n * ```typescript\n * // With MorphClient (recommended)\n * import { MorphClient } from '@morphllm/morphsdk';\n * \n * const morph = new MorphClient({ morphApiKey: process.env.MORPH_API_KEY });\n * const result = await morph.warpGrep.execute({\n * query: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n * ```\n * \n * @example\n * ```typescript\n * // Standalone client\n * import { WarpGrepClient } from '@morphllm/morphsdk/tools/warp-grep';\n * \n * const client = new WarpGrepClient({ morphApiKey: process.env.MORPH_API_KEY });\n * const result = await client.execute({\n * query: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n * ```\n * \n * @example\n * ```typescript\n * // As a tool for AI agents\n * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';\n * \n * const tool = createWarpGrepTool({ repoRoot: '.' });\n * // Pass to Claude, GPT, Gemini, etc.\n * ```\n * \n * @example Remote sandbox (E2B, Modal, Daytona, etc.)\n * ```typescript\n * import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/anthropic';\n * \n * const tool = createMorphWarpGrepTool({\n * repoRoot: '/home/repo',\n * remoteCommands: {\n * grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,\n * read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,\n * listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,\n * },\n * });\n * ```\n * \n * @example Provider-agnostic usage (bring your own tool abstraction)\n * ```typescript\n * import { \n * warpGrepInputSchema,\n * executeToolCall,\n * WARP_GREP_TOOL_NAME,\n * WARP_GREP_DESCRIPTION,\n * } from '@morphllm/morphsdk/tools/warp-grep';\n * \n * // Use with your own tool definition abstraction\n * const toolDef = createToolDef({\n * name: WARP_GREP_TOOL_NAME,\n * description: WARP_GREP_DESCRIPTION,\n * schema: warpGrepInputSchema,\n * });\n * \n * // Execute\n * const result = await executeToolCall(\n * { query: 'Find auth middleware' },\n * { repoRoot: '.', morphApiKey: process.env.MORPH_API_KEY }\n * );\n * ```\n */\n\nimport { z } from 'zod';\n\n/** Provider-agnostic Zod schema for warp grep input */\nexport const warpGrepInputSchema = z.object({\n query: z.string().describe('Free-form repository question'),\n});\n\nexport type WarpGrepInputSchema = z.infer<typeof warpGrepInputSchema>;\n\n// Core client and functions\nexport { WarpGrepClient, executeWarpGrep, executeToolCall, formatResult, executeGitHubReadFile, formatGitHubReadFileResult } from './client.js';\n\n// Types\nexport type {\n WarpGrepClientConfig,\n WarpGrepInput,\n WarpGrepResult,\n WarpGrepContext,\n WarpGrepToolConfig,\n WarpGrepProvider,\n GrepResult,\n ReadResult,\n ListDirectoryEntry,\n RemoteCommands,\n WarpGrepStep,\n GitHubSearchInput,\n GitHubSearchToolConfig,\n GitHubReadFileInput,\n GitHubReadFileResult,\n GitHubReadFileToolConfig,\n} from './types.js';\n\n// Prompts\nexport {\n WARP_GREP_DESCRIPTION,\n WARP_GREP_TOOL_NAME,\n WARP_GREP_SYSTEM_PROMPT,\n GITHUB_SEARCH_TOOL_NAME,\n GITHUB_SEARCH_DESCRIPTION,\n GITHUB_SEARCH_INPUT_SCHEMA,\n GITHUB_READ_FILE_TOOL_NAME,\n GITHUB_READ_FILE_DESCRIPTION,\n GITHUB_READ_FILE_INPUT_SCHEMA,\n getSystemPrompt,\n} from './prompts.js';\n\n// Providers (re-exported for convenience)\nexport { LocalRipgrepProvider, RemoteCommandsProvider, createCodeStorageHttpCommands } from './providers/index.js';\nexport type { CodeStorageHttpConfig } from './providers/index.js';\n\n// Path utilities (for handling model path prediction issues)\nexport { fixPathRepetition } from './utils/paths.js';\n\n// Agent internals (advanced usage)\nexport { runWarpGrep, runWarpGrepStreaming } from './agent/index.js';\nexport type { AgentRunResult, SessionConfig, ChatMessage } from './agent/index.js';\n\n// Internal agent tools (for harness builders)\nexport { toolGrep, toolRead, toolListDirectory, readFinishFiles, normalizeFinishFiles } from './agent/tools/index.js';\n\n// Provider adapters are available via dedicated import paths:\n// - '@morphllm/morphsdk/tools/warp-grep/anthropic'\n// - '@morphllm/morphsdk/tools/warp-grep/openai'\n// - '@morphllm/morphsdk/tools/warp-grep/gemini'\n// - '@morphllm/morphsdk/tools/warp-grep/vercel'\n"],"mappings":";AA6EA,SAAS,SAAS;AAGX,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,OAAO,EAAE,OAAO,EAAE,SAAS,+BAA+B;AAC5D,CAAC;","names":[]}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createGitHubSearchTool as createGitHubSearchTool2,
|
|
3
3
|
createWarpGrepTool as createWarpGrepTool2
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H3U7J5RI.js";
|
|
5
5
|
import {
|
|
6
6
|
createGitHubSearchTool,
|
|
7
7
|
createWarpGrepTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QGRFAVGK.js";
|
|
9
9
|
import {
|
|
10
10
|
createGitHubSearchTool as createGitHubSearchTool3,
|
|
11
11
|
createWarpGrepTool as createWarpGrepTool3
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ETTCJWJK.js";
|
|
13
13
|
import {
|
|
14
14
|
WarpGrepClient
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MXSGTN7R.js";
|
|
16
16
|
import {
|
|
17
17
|
createCodebaseSearchTool
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OFJYDTQI.js";
|
|
19
19
|
import {
|
|
20
20
|
createCodebaseSearchTool as createCodebaseSearchTool3
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QD7KPI7A.js";
|
|
22
22
|
import {
|
|
23
23
|
createCodebaseSearchTool as createCodebaseSearchTool2
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-XXL62KSJ.js";
|
|
25
25
|
import {
|
|
26
26
|
CodebaseSearchClient
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UJS3AIWS.js";
|
|
28
28
|
import {
|
|
29
29
|
createEditFileTool
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ANPZFWYV.js";
|
|
31
31
|
import {
|
|
32
32
|
createEditFileTool as createEditFileTool3
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-UX65IRCX.js";
|
|
34
34
|
import {
|
|
35
35
|
createEditFileTool as createEditFileTool2
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-L426IMZD.js";
|
|
37
37
|
import {
|
|
38
38
|
FastApplyClient
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WE75QX2B.js";
|
|
40
40
|
import {
|
|
41
41
|
BrowserClient
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-UHL2ZEWG.js";
|
|
43
43
|
import {
|
|
44
44
|
CompactClient
|
|
45
45
|
} from "./chunk-J267T54M.js";
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
GeminiRouter,
|
|
49
49
|
OpenAIRouter,
|
|
50
50
|
RawRouter
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-5OJE7GH4.js";
|
|
52
52
|
import {
|
|
53
53
|
MorphGit
|
|
54
54
|
} from "./chunk-LE66XCOI.js";
|
|
@@ -696,4 +696,4 @@ export {
|
|
|
696
696
|
VercelToolFactory,
|
|
697
697
|
MorphClient
|
|
698
698
|
};
|
|
699
|
-
//# sourceMappingURL=chunk-
|
|
699
|
+
//# sourceMappingURL=chunk-V4KBK66V.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-YQMPVJ2L.js";
|
|
5
5
|
import {
|
|
6
6
|
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UJS3AIWS.js";
|
|
8
8
|
|
|
9
9
|
// tools/codebase_search/anthropic.ts
|
|
10
10
|
function createCodebaseSearchTool(config) {
|
|
@@ -80,4 +80,4 @@ function formatResult(result) {
|
|
|
80
80
|
export {
|
|
81
81
|
createCodebaseSearchTool
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-XXL62KSJ.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-FMLHRJDF.js";
|
|
24
24
|
import {
|
|
25
25
|
SDK_VERSION
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FMKJ72KT.js";
|
|
27
27
|
|
|
28
28
|
// tools/warp_grep/agent/runner.ts
|
|
29
29
|
import OpenAI from "openai";
|
|
@@ -53,9 +53,9 @@ async function callModel(messages, model, options = {}) {
|
|
|
53
53
|
});
|
|
54
54
|
} catch (error) {
|
|
55
55
|
if (error instanceof OpenAI.APIError && error.status === 404) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
56
|
+
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";
|
|
57
|
+
const errorText = error.message?.trim();
|
|
58
|
+
throw new Error(errorText || defaultMsg);
|
|
59
59
|
}
|
|
60
60
|
throw error;
|
|
61
61
|
}
|
|
@@ -406,4 +406,4 @@ export {
|
|
|
406
406
|
runWarpGrep,
|
|
407
407
|
runWarpGrepStreaming
|
|
408
408
|
};
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-ZZCMAFN7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/warp_grep/agent/runner.ts"],"sourcesContent":["import { AGENT_CONFIG, DEFAULT_MODEL } from './config.js';\nimport { getSystemPrompt } from './prompt.js';\nimport type { AgentRunResult, ChatMessage, SessionConfig, AgentFinish, WarpGrepExecutionMetrics, WarpGrepTurnMetrics, WarpGrepStep } from './types.js';\nimport { LLMResponseParser } from './parser.js';\nimport type { WarpGrepProvider } from '../providers/types.js';\nimport { toolGrep } from './tools/grep.js';\nimport { toolRead } from './tools/read.js';\nimport { toolListDirectory } from './tools/list_directory.js';\nimport { readFinishFiles } from './tools/finish.js';\nimport type { RetryConfig } from '../../utils/resilience.js';\nimport { formatAgentToolOutput } from './formatter.js';\nimport { formatTurnMessage, calculateContextBudget, buildInitialState, enforceContextLimit } from './helpers.js';\nimport OpenAI from 'openai';\nimport { SDK_VERSION } from '../../../version.js';\nimport path from 'path';\n\ntype EventName =\n | 'initial_state'\n | 'round_start'\n | 'round_end'\n | 'finish'\n | 'error';\n\nexport type EventCallback = (name: EventName, payload: Record<string, unknown>) => void;\n\nconst parser = new LLMResponseParser();\n\nconst DEFAULT_API_URL = 'https://api.morphllm.com';\n\ninterface CallModelOptions {\n morphApiKey?: string;\n morphApiUrl?: string;\n retryConfig?: RetryConfig;\n timeout?: number;\n}\n\nasync function callModel(\n messages: ChatMessage[],\n model: string,\n options: CallModelOptions = {}\n): Promise<string> {\n const baseUrl = options.morphApiUrl || DEFAULT_API_URL;\n const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || '';\n const timeoutMs = options.timeout ?? AGENT_CONFIG.TIMEOUT_MS;\n\n const client = new OpenAI({\n apiKey,\n baseURL: `${baseUrl}/v1`,\n maxRetries: options.retryConfig?.maxRetries,\n timeout: timeoutMs,\n defaultHeaders: { 'X-Morph-SDK-Version': SDK_VERSION },\n });\n\n const MAX_EMPTY_RETRIES = 1;\n\n for (let attempt = 0; attempt <= MAX_EMPTY_RETRIES; attempt++) {\n let data;\n try {\n data = await client.chat.completions.create({\n model,\n temperature: 0.0,\n max_tokens: 1024,\n messages,\n });\n } catch (error) {\n if (error instanceof OpenAI.APIError && error.status === 404) {\n const defaultMsg =\n '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';\n const errorText = error.message?.trim();\n throw new Error(errorText || defaultMsg);\n }\n throw error;\n }\n\n const choice = data?.choices?.[0];\n const content = choice?.message?.content;\n\n if (content && typeof content === 'string') {\n return content;\n }\n\n // Last attempt — throw with diagnostics\n if (attempt === MAX_EMPTY_RETRIES) {\n const finishReason = choice?.finish_reason ?? 'unknown';\n const hasToolCalls = Array.isArray(choice?.message?.tool_calls) && choice.message.tool_calls.length > 0;\n const choicesLen = data?.choices?.length ?? 0;\n const contentType = content === null ? 'null' : content === undefined ? 'undefined' : typeof content;\n\n throw new Error(\n `Invalid response from model: content=${contentType}, finish_reason=${finishReason}, ` +\n `has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`\n );\n }\n\n // Retry — brief pause before next attempt\n await new Promise(resolve => setTimeout(resolve, 200));\n }\n\n // Unreachable, but satisfies TypeScript\n throw new Error('Invalid response from model');\n}\n\nexport async function runWarpGrep(config: SessionConfig & { provider: WarpGrepProvider }): Promise<AgentRunResult> {\n const totalStart = Date.now();\n const timeoutMs = config.timeout ?? AGENT_CONFIG.TIMEOUT_MS;\n const timings: Partial<WarpGrepExecutionMetrics> = { turns: [], timeout_ms: timeoutMs };\n \n const repoRoot = path.resolve(config.repoRoot || process.cwd());\n const messages: ChatMessage[] = [];\n\n messages.push({ role: 'system' as const, content: getSystemPrompt() });\n \n const initialStateStart = Date.now();\n const initialState = await buildInitialState(repoRoot, config.query, config.provider);\n timings.initial_state_ms = Date.now() - initialStateStart;\n \n messages.push({ role: 'user', content: initialState });\n\n const maxTurns = AGENT_CONFIG.MAX_TURNS;\n const model = config.model || DEFAULT_MODEL;\n const provider = config.provider;\n const errors: Array<{ message: string }> = [];\n\n let finishMeta: AgentFinish | undefined;\n let terminationReason: AgentRunResult['terminationReason'] = 'terminated';\n\n for (let turn = 1; turn <= maxTurns; turn += 1) {\n const turnMetrics: WarpGrepTurnMetrics = { turn, morph_api_ms: 0, local_tools_ms: 0 };\n \n // Enforce hard context limit before calling model\n enforceContextLimit(messages);\n \n // call model\n const modelCallStart = Date.now();\n const assistantContent = await callModel(messages, model, {\n morphApiKey: config.morphApiKey,\n morphApiUrl: config.morphApiUrl,\n retryConfig: config.retryConfig,\n timeout: timeoutMs,\n }).catch((e: unknown) => {\n const errMsg = e instanceof Error ? e.message : String(e);\n console.error(`[warp_grep] Morph API call failed on turn ${turn}:`, errMsg);\n errors.push({ message: errMsg });\n return '';\n });\n turnMetrics.morph_api_ms = Date.now() - modelCallStart;\n\n if (!assistantContent) {\n console.error(`[warp_grep] Empty response from Morph API on turn ${turn}. Errors so far:`, errors);\n timings.turns!.push(turnMetrics);\n break;\n }\n messages.push({ role: 'assistant', content: assistantContent });\n\n // parse tool calls (no longer throws - returns _skip calls for malformed commands)\n const toolCalls = parser.parse(assistantContent);\n if (toolCalls.length === 0) {\n console.error(`[warp_grep] No tool calls parsed on turn ${turn}. Assistant content (first 500 chars):`, assistantContent.slice(0, 500));\n 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' });\n terminationReason = 'terminated';\n timings.turns!.push(turnMetrics);\n break;\n }\n\n const finishCalls = toolCalls.filter(c => c.name === 'finish');\n const grepCalls = toolCalls.filter(c => c.name === 'grep');\n const listDirCalls = toolCalls.filter(c => c.name === 'list_directory');\n const readCalls = toolCalls.filter(c => c.name === 'read');\n const skipCalls = toolCalls.filter(c => c.name === '_skip');\n\n const formatted: string[] = [];\n\n // Surface any skipped commands as feedback to the LLM\n for (const c of skipCalls) {\n const msg = (c.arguments as { message?: string })?.message || 'Command skipped due to parsing error';\n formatted.push(msg);\n }\n\n const allPromises: Array<Promise<string>> = [];\n \n for (const c of grepCalls) {\n const args = (c.arguments ?? {}) as { pattern: string; path: string; glob?: string };\n allPromises.push(\n toolGrep(provider, args).then(\n ({ output }) => formatAgentToolOutput('grep', args, output, { isError: false }),\n err => formatAgentToolOutput('grep', args, String(err), { isError: true })\n )\n );\n }\n \n for (const c of listDirCalls) {\n const args = (c.arguments ?? {}) as { path: string; pattern?: string | null };\n allPromises.push(\n toolListDirectory(provider, args).then(\n p => formatAgentToolOutput('list_directory', args, p, { isError: false }),\n err => formatAgentToolOutput('list_directory', args, String(err), { isError: true })\n )\n );\n }\n \n for (const c of readCalls) {\n const args = (c.arguments ?? {}) as { path: string; start?: number; end?: number; lines?: Array<[number, number]> };\n allPromises.push(\n toolRead(provider, args).then(\n p => formatAgentToolOutput('read', args, p, { isError: false }),\n err => formatAgentToolOutput('read', args, String(err), { isError: true })\n )\n );\n }\n \n const toolExecStart = Date.now();\n const allResults = await Promise.all(allPromises);\n turnMetrics.local_tools_ms = Date.now() - toolExecStart;\n \n for (const result of allResults) {\n formatted.push(result);\n }\n\n if (formatted.length > 0) {\n const turnMessage = formatTurnMessage(turn, maxTurns);\n const contextBudget = calculateContextBudget(messages);\n messages.push({ role: 'user', content: formatted.join('\\n') + turnMessage + '\\n' + contextBudget });\n }\n\n timings.turns!.push(turnMetrics);\n\n if (finishCalls.length) {\n const fc = finishCalls[0];\n const files = ((fc.arguments as any)?.files ?? []) as AgentFinish['files'];\n const textResult = (fc.arguments as any)?.textResult as string | undefined;\n finishMeta = { files };\n terminationReason = 'completed';\n\n // Text-only finish: model returned a text response instead of file references\n // (e.g. \"No relevant code found\"). Surface the text to the parent LLM.\n if (files.length === 0) {\n const payload = textResult || 'No relevant code found.';\n timings.turns!.push(turnMetrics);\n timings.total_ms = Date.now() - totalStart;\n return {\n terminationReason: 'completed',\n messages,\n finish: { payload, metadata: finishMeta },\n timings: timings as WarpGrepExecutionMetrics,\n };\n }\n\n break;\n }\n }\n\n if (terminationReason !== 'completed' || !finishMeta) {\n timings.total_ms = Date.now() - totalStart;\n return { terminationReason, messages, errors, timings: timings as WarpGrepExecutionMetrics };\n }\n\n // Build finish payload\n const parts: string[] = ['Relevant context found:'];\n for (const f of finishMeta.files) {\n const ranges = f.lines === '*' ? '*'\n : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(', ')\n : '*';\n parts.push(`- ${f.path}: ${ranges}`);\n }\n const payload = parts.join('\\n');\n\n // Resolve file contents for returned ranges\n // Wrap reader in try-catch to handle non-existent or unreadable files gracefully\n // Track files that couldn't be read for error reporting\n const finishResolutionStart = Date.now();\n const fileReadErrors: Array<{ path: string; error: string }> = [];\n const resolved = await readFinishFiles(\n repoRoot,\n finishMeta.files,\n async (p: string, s?: number, e?: number) => {\n try {\n const rr = await provider.read({ path: p, start: s, end: e });\n // rr.lines are \"line|content\" → strip the \"line|\" prefix\n return rr.lines.map(l => {\n const idx = l.indexOf('|');\n return idx >= 0 ? l.slice(idx + 1) : l;\n });\n } catch (err) {\n // File doesn't exist or can't be read - log error but don't throw\n // This handles cases where the agent hallucinated a path or the file was deleted\n const errorMsg = err instanceof Error ? err.message : String(err);\n fileReadErrors.push({ path: p, error: errorMsg });\n console.error(`[warp_grep] Failed to read file: ${p} - ${errorMsg}`);\n return [`[couldn't find: ${p}]`];\n }\n }\n );\n\n timings.finish_resolution_ms = Date.now() - finishResolutionStart;\n\n // Add file read errors to the result so MCP can report them\n if (fileReadErrors.length > 0) {\n errors.push(...fileReadErrors.map(e => ({ message: `File read error: ${e.path} - ${e.error}` })));\n }\n\n timings.total_ms = Date.now() - totalStart;\n return {\n terminationReason: 'completed',\n messages,\n finish: { payload, metadata: finishMeta, resolved },\n timings: timings as WarpGrepExecutionMetrics,\n };\n}\n\n/**\n * Streaming version of runWarpGrep that yields step information after each turn.\n * Yields WarpGrepStep with tool calls for each turn, then returns the final AgentRunResult.\n */\nexport async function* runWarpGrepStreaming(\n config: SessionConfig & { provider: WarpGrepProvider }\n): AsyncGenerator<WarpGrepStep, AgentRunResult, undefined> {\n const totalStart = Date.now();\n const timeoutMs = config.timeout ?? AGENT_CONFIG.TIMEOUT_MS;\n const timings: Partial<WarpGrepExecutionMetrics> = { turns: [], timeout_ms: timeoutMs };\n\n const repoRoot = path.resolve(config.repoRoot || process.cwd());\n const messages: ChatMessage[] = [];\n\n messages.push({ role: 'system' as const, content: getSystemPrompt() });\n\n const initialStateStart = Date.now();\n const initialState = await buildInitialState(repoRoot, config.query, config.provider);\n timings.initial_state_ms = Date.now() - initialStateStart;\n\n messages.push({ role: 'user', content: initialState });\n\n const maxTurns = AGENT_CONFIG.MAX_TURNS;\n const model = config.model || DEFAULT_MODEL;\n const provider = config.provider;\n const errors: Array<{ message: string }> = [];\n\n let finishMeta: AgentFinish | undefined;\n let terminationReason: AgentRunResult['terminationReason'] = 'terminated';\n\n for (let turn = 1; turn <= maxTurns; turn += 1) {\n const turnMetrics: WarpGrepTurnMetrics = { turn, morph_api_ms: 0, local_tools_ms: 0 };\n\n // Enforce hard context limit before calling model\n enforceContextLimit(messages);\n\n // call model\n const modelCallStart = Date.now();\n const assistantContent = await callModel(messages, model, {\n morphApiKey: config.morphApiKey,\n morphApiUrl: config.morphApiUrl,\n retryConfig: config.retryConfig,\n timeout: timeoutMs,\n }).catch((e: unknown) => {\n const errMsg = e instanceof Error ? e.message : String(e);\n console.error(`[warp_grep:stream] Morph API call failed on turn ${turn}:`, errMsg);\n errors.push({ message: errMsg });\n return '';\n });\n turnMetrics.morph_api_ms = Date.now() - modelCallStart;\n\n if (!assistantContent) {\n console.error(`[warp_grep:stream] Empty response from Morph API on turn ${turn}. Errors so far:`, errors);\n timings.turns!.push(turnMetrics);\n break;\n }\n messages.push({ role: 'assistant', content: assistantContent });\n\n // parse tool calls (no longer throws - returns _skip calls for malformed commands)\n const toolCalls = parser.parse(assistantContent);\n if (toolCalls.length === 0) {\n console.error(`[warp_grep:stream] No tool calls parsed on turn ${turn}. Assistant content (first 500 chars):`, assistantContent.slice(0, 500));\n 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' });\n terminationReason = 'terminated';\n timings.turns!.push(turnMetrics);\n break;\n }\n\n // Yield step with tool calls (before execution)\n yield {\n turn,\n toolCalls: toolCalls.map(c => ({\n name: c.name,\n arguments: c.arguments ?? {}\n }))\n };\n\n const finishCalls = toolCalls.filter(c => c.name === 'finish');\n const grepCalls = toolCalls.filter(c => c.name === 'grep');\n const listDirCalls = toolCalls.filter(c => c.name === 'list_directory');\n const readCalls = toolCalls.filter(c => c.name === 'read');\n const skipCalls = toolCalls.filter(c => c.name === '_skip');\n\n const formatted: string[] = [];\n\n // Surface any skipped commands as feedback to the LLM\n for (const c of skipCalls) {\n const msg = (c.arguments as { message?: string })?.message || 'Command skipped due to parsing error';\n formatted.push(msg);\n }\n\n const allPromises: Array<Promise<string>> = [];\n\n for (const c of grepCalls) {\n const args = (c.arguments ?? {}) as { pattern: string; path: string; glob?: string };\n allPromises.push(\n toolGrep(provider, args).then(\n ({ output }) => formatAgentToolOutput('grep', args, output, { isError: false }),\n err => formatAgentToolOutput('grep', args, String(err), { isError: true })\n )\n );\n }\n\n for (const c of listDirCalls) {\n const args = (c.arguments ?? {}) as { path: string; pattern?: string | null };\n allPromises.push(\n toolListDirectory(provider, args).then(\n p => formatAgentToolOutput('list_directory', args, p, { isError: false }),\n err => formatAgentToolOutput('list_directory', args, String(err), { isError: true })\n )\n );\n }\n\n for (const c of readCalls) {\n const args = (c.arguments ?? {}) as { path: string; start?: number; end?: number; lines?: Array<[number, number]> };\n allPromises.push(\n toolRead(provider, args).then(\n p => formatAgentToolOutput('read', args, p, { isError: false }),\n err => formatAgentToolOutput('read', args, String(err), { isError: true })\n )\n );\n }\n\n const toolExecStart = Date.now();\n const allResults = await Promise.all(allPromises);\n turnMetrics.local_tools_ms = Date.now() - toolExecStart;\n\n for (const result of allResults) {\n formatted.push(result);\n }\n\n if (formatted.length > 0) {\n const turnMessage = formatTurnMessage(turn, maxTurns);\n const contextBudget = calculateContextBudget(messages);\n messages.push({ role: 'user', content: formatted.join('\\n') + turnMessage + '\\n' + contextBudget });\n }\n\n timings.turns!.push(turnMetrics);\n\n if (finishCalls.length) {\n const fc = finishCalls[0];\n const files = ((fc.arguments as any)?.files ?? []) as AgentFinish['files'];\n const textResult = (fc.arguments as any)?.textResult as string | undefined;\n finishMeta = { files };\n terminationReason = 'completed';\n\n // Text-only finish: model returned a text response instead of file references\n if (files.length === 0) {\n const payload = textResult || 'No relevant code found.';\n timings.total_ms = Date.now() - totalStart;\n return {\n terminationReason: 'completed',\n messages,\n finish: { payload, metadata: finishMeta },\n timings: timings as WarpGrepExecutionMetrics,\n };\n }\n\n break;\n }\n }\n\n if (terminationReason !== 'completed' || !finishMeta) {\n timings.total_ms = Date.now() - totalStart;\n return { terminationReason, messages, errors, timings: timings as WarpGrepExecutionMetrics };\n }\n\n // Build finish payload\n const parts: string[] = ['Relevant context found:'];\n for (const f of finishMeta.files) {\n const ranges = f.lines === '*' ? '*'\n : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(', ')\n : '*';\n parts.push(`- ${f.path}: ${ranges}`);\n }\n const payload = parts.join('\\n');\n\n // Resolve file contents for returned ranges\n const finishResolutionStart = Date.now();\n const fileReadErrors: Array<{ path: string; error: string }> = [];\n const resolved = await readFinishFiles(\n repoRoot,\n finishMeta.files,\n async (p: string, s?: number, e?: number) => {\n try {\n const rr = await provider.read({ path: p, start: s, end: e });\n return rr.lines.map(l => {\n const idx = l.indexOf('|');\n return idx >= 0 ? l.slice(idx + 1) : l;\n });\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n fileReadErrors.push({ path: p, error: errorMsg });\n console.error(`[warp_grep] Failed to read file: ${p} - ${errorMsg}`);\n return [`[couldn't find: ${p}]`];\n }\n }\n );\n\n timings.finish_resolution_ms = Date.now() - finishResolutionStart;\n\n if (fileReadErrors.length > 0) {\n errors.push(...fileReadErrors.map(e => ({ message: `File read error: ${e.path} - ${e.error}` })));\n }\n\n timings.total_ms = Date.now() - totalStart;\n return {\n terminationReason: 'completed',\n messages,\n finish: { payload, metadata: finishMeta, resolved },\n timings: timings as WarpGrepExecutionMetrics,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,OAAO,YAAY;AAEnB,OAAO,UAAU;AAWjB,IAAM,SAAS,IAAI,kBAAkB;AAErC,IAAM,kBAAkB;AASxB,eAAe,UACb,UACA,OACA,UAA4B,CAAC,GACZ;AACjB,QAAM,UAAU,QAAQ,eAAe;AACvC,QAAM,SAAS,QAAQ,eAAe,QAAQ,IAAI,iBAAiB;AACnE,QAAM,YAAY,QAAQ,WAAW,aAAa;AAElD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB;AAAA,IACA,SAAS,GAAG,OAAO;AAAA,IACnB,YAAY,QAAQ,aAAa;AAAA,IACjC,SAAS;AAAA,IACT,gBAAgB,EAAE,uBAAuB,YAAY;AAAA,EACvD,CAAC;AAED,QAAM,oBAAoB;AAE1B,WAAS,UAAU,GAAG,WAAW,mBAAmB,WAAW;AAC7D,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,QAC1C;AAAA,QACA,aAAa;AAAA,QACb,YAAY;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO,YAAY,MAAM,WAAW,KAAK;AAC5D,cAAM,aACJ;AACF,cAAM,YAAY,MAAM,SAAS,KAAK;AACtC,cAAM,IAAI,MAAM,aAAa,UAAU;AAAA,MACzC;AACA,YAAM;AAAA,IACR;AAEA,UAAM,SAAS,MAAM,UAAU,CAAC;AAChC,UAAM,UAAU,QAAQ,SAAS;AAEjC,QAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,aAAO;AAAA,IACT;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,UAAQ,WAAW,KAAK,IAAI,IAAI;AAChC,SAAO;AAAA,IACL,mBAAmB;AAAA,IACnB;AAAA,IACA,QAAQ,EAAE,SAAS,UAAU,YAAY,SAAS;AAAA,IAClD;AAAA,EACF;AACF;","names":["payload"]}
|
|
@@ -8,7 +8,7 @@ import { CompactClient } from './tools/compact/core.js';
|
|
|
8
8
|
import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter } from './modelrouter/core.js';
|
|
9
9
|
import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
|
|
10
10
|
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
|
|
11
|
-
import { d as WarpGrepToolConfig, b as WarpGrepResult,
|
|
11
|
+
import { d as WarpGrepToolConfig, b as WarpGrepResult, g as GitHubSearchToolConfig, c as WarpGrepContext } from './types-DY_hq2eZ.js';
|
|
12
12
|
import * as openai_resources_index_mjs from 'openai/resources/index.mjs';
|
|
13
13
|
import * as _anthropic_ai_sdk_resources_messages_mjs from '@anthropic-ai/sdk/resources/messages.mjs';
|
|
14
14
|
import * as ai from 'ai';
|
package/dist/client.cjs
CHANGED
|
@@ -36,7 +36,7 @@ var init_package = __esm({
|
|
|
36
36
|
"package.json"() {
|
|
37
37
|
package_default = {
|
|
38
38
|
name: "@morphllm/morphsdk",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.123",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -3287,9 +3287,9 @@ async function callModel(messages, model, options = {}) {
|
|
|
3287
3287
|
});
|
|
3288
3288
|
} catch (error) {
|
|
3289
3289
|
if (error instanceof import_openai2.default.APIError && error.status === 404) {
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
);
|
|
3290
|
+
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";
|
|
3291
|
+
const errorText = error.message?.trim();
|
|
3292
|
+
throw new Error(errorText || defaultMsg);
|
|
3293
3293
|
}
|
|
3294
3294
|
throw error;
|
|
3295
3295
|
}
|
|
@@ -3895,6 +3895,23 @@ var WarpGrepClient = class {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
return this._searchGitHubAsync(input);
|
|
3897
3897
|
}
|
|
3898
|
+
/**
|
|
3899
|
+
* Read a single file from a public GitHub repository
|
|
3900
|
+
*
|
|
3901
|
+
* @example
|
|
3902
|
+
* ```typescript
|
|
3903
|
+
* const result = await client.readGitHubFile({
|
|
3904
|
+
* github: 'vercel/next.js',
|
|
3905
|
+
* path: 'src/server/app-render/index.tsx',
|
|
3906
|
+
* startLine: 1,
|
|
3907
|
+
* endLine: 50,
|
|
3908
|
+
* });
|
|
3909
|
+
* if (result.success) console.log(result.content);
|
|
3910
|
+
* ```
|
|
3911
|
+
*/
|
|
3912
|
+
async readGitHubFile(input) {
|
|
3913
|
+
return executeGitHubReadFile(input, { timeout: this.config.timeout });
|
|
3914
|
+
}
|
|
3898
3915
|
async _resolveGitHubRepo(input) {
|
|
3899
3916
|
const { owner, repo } = parseGitHubUrl(input.github);
|
|
3900
3917
|
const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;
|
|
@@ -4015,6 +4032,56 @@ async function* executeToolCallStreaming(input, config) {
|
|
|
4015
4032
|
}
|
|
4016
4033
|
return processAgentResult(agentResult);
|
|
4017
4034
|
}
|
|
4035
|
+
async function fetchRawGitHubFile(owner, repo, filePath, branch, timeout) {
|
|
4036
|
+
const branches = branch ? [branch] : ["HEAD"];
|
|
4037
|
+
const fallbacks = ["main", "master", "develop"];
|
|
4038
|
+
const fetchWithTimeout = (url) => timeout ? fetch(url, { signal: AbortSignal.timeout(timeout) }) : fetch(url);
|
|
4039
|
+
for (const b of branches) {
|
|
4040
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${b}/${filePath}`;
|
|
4041
|
+
const res = await fetchWithTimeout(url);
|
|
4042
|
+
if (res.ok) return { content: await res.text(), branch: b };
|
|
4043
|
+
}
|
|
4044
|
+
for (const fb of fallbacks) {
|
|
4045
|
+
if (branch && fb === branch) continue;
|
|
4046
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${fb}/${filePath}`;
|
|
4047
|
+
const res = await fetchWithTimeout(url);
|
|
4048
|
+
if (res.ok) return { content: await res.text(), branch: fb };
|
|
4049
|
+
}
|
|
4050
|
+
throw new Error(`File not found: ${owner}/${repo}/${filePath}`);
|
|
4051
|
+
}
|
|
4052
|
+
async function executeGitHubReadFile(input, config) {
|
|
4053
|
+
try {
|
|
4054
|
+
const { owner, repo } = parseGitHubUrl(input.github);
|
|
4055
|
+
const { content: raw, branch } = await fetchRawGitHubFile(
|
|
4056
|
+
owner,
|
|
4057
|
+
repo,
|
|
4058
|
+
input.path,
|
|
4059
|
+
input.branch,
|
|
4060
|
+
config?.timeout
|
|
4061
|
+
);
|
|
4062
|
+
const allLines = raw.split("\n");
|
|
4063
|
+
const totalLines = allLines.length;
|
|
4064
|
+
const start = Math.max(1, input.startLine ?? 1);
|
|
4065
|
+
const end = Math.min(totalLines, input.endLine ?? totalLines);
|
|
4066
|
+
const selected = allLines.slice(start - 1, end);
|
|
4067
|
+
const padWidth = String(end).length;
|
|
4068
|
+
const numbered = selected.map((line, i) => `${String(start + i).padStart(padWidth)}|${line}`).join("\n");
|
|
4069
|
+
return {
|
|
4070
|
+
success: true,
|
|
4071
|
+
content: numbered,
|
|
4072
|
+
path: input.path,
|
|
4073
|
+
github: `${owner}/${repo}`,
|
|
4074
|
+
branch,
|
|
4075
|
+
lineRange: [start, end],
|
|
4076
|
+
totalLines
|
|
4077
|
+
};
|
|
4078
|
+
} catch (error) {
|
|
4079
|
+
return {
|
|
4080
|
+
success: false,
|
|
4081
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4082
|
+
};
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4018
4085
|
function formatResult(result) {
|
|
4019
4086
|
if (!result.success) {
|
|
4020
4087
|
return `Search failed: ${result.error}`;
|
|
@@ -5209,17 +5276,20 @@ var RawRouter = class extends BaseRouter {
|
|
|
5209
5276
|
// tools/warp_grep/prompts.ts
|
|
5210
5277
|
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
5211
5278
|
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.';
|
|
5212
|
-
var
|
|
5213
|
-
var
|
|
5214
|
-
var
|
|
5279
|
+
var GITHUB_WARP_GREP_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
5280
|
+
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.';
|
|
5281
|
+
var GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA = {
|
|
5215
5282
|
type: "object",
|
|
5216
5283
|
properties: {
|
|
5217
5284
|
query: { type: "string", description: "Natural language search query describing what to find in the repository" },
|
|
5218
|
-
github: { type: "string", description: '
|
|
5285
|
+
github: { type: "string", description: 'owner/repo shorthand (ex: "vercel/next.js" for "https://github.com/vercel/next.js")' },
|
|
5219
5286
|
branch: { type: "string", description: "Branch to search (defaults to the repository default branch)" }
|
|
5220
5287
|
},
|
|
5221
5288
|
required: ["query", "github"]
|
|
5222
5289
|
};
|
|
5290
|
+
var GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;
|
|
5291
|
+
var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
|
|
5292
|
+
var GITHUB_SEARCH_INPUT_SCHEMA = GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA;
|
|
5223
5293
|
|
|
5224
5294
|
// tools/warp_grep/openai.ts
|
|
5225
5295
|
var TOOL_PARAMETERS = {
|