@morphllm/morphsdk 0.2.126 → 0.2.127
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-GISRJI5P.js → chunk-3ZA7Y66U.js} +2 -2
- package/dist/{chunk-AXYGFPEJ.js → chunk-6DRIR7AI.js} +5 -4
- package/dist/chunk-6DRIR7AI.js.map +1 -0
- package/dist/{chunk-ULZOJQ2W.js → chunk-ADHGSV2D.js} +2 -2
- package/dist/{chunk-37ZZ24IX.js → chunk-DS7YL4V3.js} +8 -4
- package/dist/{chunk-37ZZ24IX.js.map → chunk-DS7YL4V3.js.map} +1 -1
- package/dist/{chunk-IYZX6EYC.js → chunk-EGOCFCAH.js} +2 -2
- package/dist/{chunk-C26M3TWM.js → chunk-EL6CCK7C.js} +2 -2
- package/dist/{chunk-EB656RG6.js → chunk-GDCVK6SP.js} +2 -2
- package/dist/{chunk-5CIUBER5.js → chunk-GVF4Q75N.js} +2 -2
- package/dist/{chunk-CPZKCBED.js → chunk-GWKCMFD6.js} +2 -2
- package/dist/{chunk-VYJUGQUR.js → chunk-HZK5TEUK.js} +1 -1
- package/dist/{chunk-6Y2LHEJJ.js → chunk-K6YSD3DR.js} +2 -2
- package/dist/{chunk-R74NP2D4.js → chunk-LX34ZO3N.js} +2 -2
- package/dist/{chunk-W7WUZMKZ.js → chunk-LXBIP5FI.js} +2 -2
- package/dist/{chunk-K6GLBQBV.js → chunk-MJHAVXFK.js} +2 -2
- package/dist/{chunk-FAH4YGRN.js → chunk-NQQS5BZZ.js} +3 -3
- package/dist/{chunk-KJVFYRXY.js → chunk-QOE522DB.js} +15 -15
- package/dist/{chunk-QK5RNORE.js → chunk-QUULFOWB.js} +10 -5
- package/dist/{chunk-QK5RNORE.js.map → chunk-QUULFOWB.js.map} +1 -1
- package/dist/{chunk-CYVV5X5K.js → chunk-R5IFI552.js} +2 -2
- package/dist/{chunk-CYVV5X5K.js.map → chunk-R5IFI552.js.map} +1 -1
- package/dist/{chunk-76PPJZWV.js → chunk-REJNS3OW.js} +8 -4
- package/dist/{chunk-76PPJZWV.js.map → chunk-REJNS3OW.js.map} +1 -1
- package/dist/{chunk-6722FXFI.js → chunk-U73OIAJC.js} +2 -2
- package/dist/{chunk-3NLCSADX.js → chunk-UAQ7UWZB.js} +2 -2
- package/dist/{chunk-KUABSLVR.js → chunk-YTUQEDWH.js} +2 -2
- package/dist/{chunk-TREVNTLA.js → chunk-ZVAXTR2V.js} +2 -2
- package/dist/{chunk-YHZRHPJI.js → chunk-ZYD2SEQK.js} +2 -2
- package/dist/{client-s3_iDem0.d.ts → client-CNYzlN_6.d.ts} +6 -3
- package/dist/client.cjs +22 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -1
- 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 +22 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -21
- 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 +1 -1
- 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 +10 -5
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +2 -1
- package/dist/tools/warp_grep/anthropic.js +5 -5
- package/dist/tools/warp_grep/client.cjs +1 -1
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +3 -3
- package/dist/tools/warp_grep/gemini.cjs +10 -5
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +2 -1
- package/dist/tools/warp_grep/gemini.js +12 -7
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +5 -4
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +6 -2
- package/dist/tools/warp_grep/index.js +4 -4
- package/dist/tools/warp_grep/openai.cjs +10 -5
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +2 -1
- package/dist/tools/warp_grep/openai.js +5 -5
- package/dist/tools/warp_grep/vercel.cjs +9 -4
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +2 -1
- package/dist/tools/warp_grep/vercel.js +5 -5
- 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-AXYGFPEJ.js.map +0 -1
- /package/dist/{chunk-GISRJI5P.js.map → chunk-3ZA7Y66U.js.map} +0 -0
- /package/dist/{chunk-ULZOJQ2W.js.map → chunk-ADHGSV2D.js.map} +0 -0
- /package/dist/{chunk-IYZX6EYC.js.map → chunk-EGOCFCAH.js.map} +0 -0
- /package/dist/{chunk-C26M3TWM.js.map → chunk-EL6CCK7C.js.map} +0 -0
- /package/dist/{chunk-EB656RG6.js.map → chunk-GDCVK6SP.js.map} +0 -0
- /package/dist/{chunk-5CIUBER5.js.map → chunk-GVF4Q75N.js.map} +0 -0
- /package/dist/{chunk-CPZKCBED.js.map → chunk-GWKCMFD6.js.map} +0 -0
- /package/dist/{chunk-VYJUGQUR.js.map → chunk-HZK5TEUK.js.map} +0 -0
- /package/dist/{chunk-6Y2LHEJJ.js.map → chunk-K6YSD3DR.js.map} +0 -0
- /package/dist/{chunk-R74NP2D4.js.map → chunk-LX34ZO3N.js.map} +0 -0
- /package/dist/{chunk-W7WUZMKZ.js.map → chunk-LXBIP5FI.js.map} +0 -0
- /package/dist/{chunk-K6GLBQBV.js.map → chunk-MJHAVXFK.js.map} +0 -0
- /package/dist/{chunk-FAH4YGRN.js.map → chunk-NQQS5BZZ.js.map} +0 -0
- /package/dist/{chunk-KJVFYRXY.js.map → chunk-QOE522DB.js.map} +0 -0
- /package/dist/{chunk-6722FXFI.js.map → chunk-U73OIAJC.js.map} +0 -0
- /package/dist/{chunk-3NLCSADX.js.map → chunk-UAQ7UWZB.js.map} +0 -0
- /package/dist/{chunk-KUABSLVR.js.map → chunk-YTUQEDWH.js.map} +0 -0
- /package/dist/{chunk-TREVNTLA.js.map → chunk-ZVAXTR2V.js.map} +0 -0
- /package/dist/{chunk-YHZRHPJI.js.map → chunk-ZYD2SEQK.js.map} +0 -0
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
GITHUB_SEARCH_TOOL_NAME,
|
|
8
8
|
WARP_GREP_DESCRIPTION,
|
|
9
9
|
WARP_GREP_TOOL_NAME
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6DRIR7AI.js";
|
|
11
11
|
import {
|
|
12
12
|
WarpGrepClient,
|
|
13
13
|
executeGitHubReadFile,
|
|
14
14
|
executeToolCall,
|
|
15
15
|
formatGitHubReadFileResult,
|
|
16
16
|
formatResult
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EL6CCK7C.js";
|
|
18
18
|
|
|
19
19
|
// tools/warp_grep/openai.ts
|
|
20
20
|
var TOOL_PARAMETERS = {
|
|
@@ -65,7 +65,11 @@ function createGitHubSearchTool(config) {
|
|
|
65
65
|
};
|
|
66
66
|
return Object.assign(tool, {
|
|
67
67
|
execute: async (input) => {
|
|
68
|
-
|
|
68
|
+
const github = input.github_url || input.owner_repo;
|
|
69
|
+
if (!github) {
|
|
70
|
+
throw new Error("Please provide github search url or owner/repo id");
|
|
71
|
+
}
|
|
72
|
+
return client.searchGitHub({ query: input.query, github, branch: input.branch });
|
|
69
73
|
},
|
|
70
74
|
formatResult: (result) => {
|
|
71
75
|
return formatResult(result);
|
|
@@ -100,4 +104,4 @@ export {
|
|
|
100
104
|
createGitHubReadFileTool,
|
|
101
105
|
openai_default
|
|
102
106
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-REJNS3OW.js.map
|
|
@@ -1 +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 } 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 for convenience\nexport { formatResult };\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 });\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;
|
|
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 } 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 for convenience\nexport { formatResult };\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 });\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_url?: string; owner_repo?: string; branch?: string }): Promise<WarpGrepResult> => {\n const github = input.github_url || input.owner_repo;\n if (!github) {\n throw new Error('Please provide github search url or owner/repo id');\n }\n return client.searchGitHub({ query: input.query, github, branch: input.branch });\n },\n formatResult: (result: WarpGrepResult): string => {\n return formatResult(result);\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,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,UAAiH;AAC/H,YAAM,SAAS,MAAM,cAAc,MAAM;AACzC,UAAI,CAAC,QAAQ;AACX,cAAM,IAAI,MAAM,mDAAmD;AAAA,MACrE;AACA,aAAO,OAAO,aAAa,EAAE,OAAO,MAAM,OAAO,QAAQ,QAAQ,MAAM,OAAO,CAAC;AAAA,IACjF;AAAA,IACA,cAAc,CAAC,WAAmC;AAChD,aAAO,aAAa,MAAM;AAAA,IAC5B;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
|
executeEditFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HZK5TEUK.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-U73OIAJC.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQMPVJ2L.js";
|
|
4
4
|
import {
|
|
5
5
|
executeCodebaseSearch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3ZA7Y66U.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-UAQ7UWZB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchWithRetry,
|
|
3
3
|
withTimeout
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ADHGSV2D.js";
|
|
5
5
|
|
|
6
6
|
// modelrouter/core.ts
|
|
7
7
|
var DEFAULT_CONFIG = {
|
|
@@ -209,4 +209,4 @@ export {
|
|
|
209
209
|
GeminiRouter,
|
|
210
210
|
RawRouter
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-YTUQEDWH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R5IFI552.js";
|
|
4
4
|
|
|
5
5
|
// tools/fastapply/apply.ts
|
|
6
6
|
import { createTwoFilesPatch } from "diff";
|
|
@@ -116,4 +116,4 @@ export {
|
|
|
116
116
|
callMorphAPI,
|
|
117
117
|
applyEdit
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-ZVAXTR2V.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-3ZA7Y66U.js";
|
|
8
8
|
|
|
9
9
|
// tools/codebase_search/openai.ts
|
|
10
10
|
var codebaseSearchTool = {
|
|
@@ -125,4 +125,4 @@ export {
|
|
|
125
125
|
getSystemPrompt,
|
|
126
126
|
openai_default
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-ZYD2SEQK.js.map
|
|
@@ -674,7 +674,8 @@ declare class OpenAIToolFactory {
|
|
|
674
674
|
createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
|
|
675
675
|
execute: (input: {
|
|
676
676
|
query: string;
|
|
677
|
-
|
|
677
|
+
github_url?: string;
|
|
678
|
+
owner_repo?: string;
|
|
678
679
|
branch?: string;
|
|
679
680
|
}) => Promise<WarpGrepResult>;
|
|
680
681
|
formatResult: (result: WarpGrepResult) => string;
|
|
@@ -744,7 +745,8 @@ declare class AnthropicToolFactory {
|
|
|
744
745
|
createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
|
|
745
746
|
execute: (input: {
|
|
746
747
|
query: string;
|
|
747
|
-
|
|
748
|
+
github_url?: string;
|
|
749
|
+
owner_repo?: string;
|
|
748
750
|
branch?: string;
|
|
749
751
|
}) => Promise<WarpGrepResult>;
|
|
750
752
|
formatResult: (result: WarpGrepResult) => string;
|
|
@@ -844,8 +846,9 @@ declare class VercelToolFactory {
|
|
|
844
846
|
*/
|
|
845
847
|
createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): ai.Tool<{
|
|
846
848
|
query: string;
|
|
847
|
-
github: string;
|
|
848
849
|
branch?: string | undefined;
|
|
850
|
+
github_url?: string | undefined;
|
|
851
|
+
owner_repo?: string | undefined;
|
|
849
852
|
}, {
|
|
850
853
|
success: boolean;
|
|
851
854
|
contexts: WarpGrepContext[] | undefined;
|
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.127",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -4867,15 +4867,16 @@ var RawRouter = class extends BaseRouter {
|
|
|
4867
4867
|
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
4868
4868
|
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.';
|
|
4869
4869
|
var GITHUB_WARP_GREP_SEARCH_TOOL_NAME = "warpgrep_github_search";
|
|
4870
|
-
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. ONLY use this tool when the task requires understanding code in an external repo, and invoke warpgrep_github_search with a
|
|
4870
|
+
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. ONLY use this tool when the task requires understanding code in an external repo, and invoke warpgrep_github_search with a natural-language query describing the target functionality, bug, or architectural concern. DO NOT use this tool when the task requires understanding code in your local workspace. Use warpgrep_codebase_search instead.Useful when you suspect a library or framework is being used in a way that is not documented, or if you suspect an update or a bug in the library or framework.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. You must provide either a github_url or owner_repo parameter (at least one is required).';
|
|
4871
4871
|
var GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA = {
|
|
4872
4872
|
type: "object",
|
|
4873
4873
|
properties: {
|
|
4874
4874
|
query: { type: "string", description: "Natural language search query describing what to find in the repository" },
|
|
4875
|
-
|
|
4875
|
+
github_url: { type: "string", description: 'GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.' },
|
|
4876
|
+
owner_repo: { type: "string", description: 'Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.' },
|
|
4876
4877
|
branch: { type: "string", description: "Branch to search (defaults to the repository default branch)" }
|
|
4877
4878
|
},
|
|
4878
|
-
required: ["query"
|
|
4879
|
+
required: ["query"]
|
|
4879
4880
|
};
|
|
4880
4881
|
var GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;
|
|
4881
4882
|
var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
|
|
@@ -4919,7 +4920,11 @@ function createGitHubSearchTool(config) {
|
|
|
4919
4920
|
};
|
|
4920
4921
|
return Object.assign(tool4, {
|
|
4921
4922
|
execute: async (input) => {
|
|
4922
|
-
|
|
4923
|
+
const github = input.github_url || input.owner_repo;
|
|
4924
|
+
if (!github) {
|
|
4925
|
+
throw new Error("Please provide github search url or owner/repo id");
|
|
4926
|
+
}
|
|
4927
|
+
return client.searchGitHub({ query: input.query, github, branch: input.branch });
|
|
4923
4928
|
},
|
|
4924
4929
|
formatResult: (result) => {
|
|
4925
4930
|
return formatResult(result);
|
|
@@ -5216,7 +5221,11 @@ function createGitHubSearchTool2(config) {
|
|
|
5216
5221
|
};
|
|
5217
5222
|
return Object.assign(tool4, {
|
|
5218
5223
|
execute: async (input) => {
|
|
5219
|
-
|
|
5224
|
+
const github = input.github_url || input.owner_repo;
|
|
5225
|
+
if (!github) {
|
|
5226
|
+
throw new Error("Please provide github search url or owner/repo id");
|
|
5227
|
+
}
|
|
5228
|
+
return client.searchGitHub({ query: input.query, github, branch: input.branch });
|
|
5220
5229
|
},
|
|
5221
5230
|
formatResult: (result) => {
|
|
5222
5231
|
return formatResult(result);
|
|
@@ -5439,11 +5448,16 @@ function createGitHubSearchTool3(config) {
|
|
|
5439
5448
|
description: GITHUB_SEARCH_DESCRIPTION,
|
|
5440
5449
|
inputSchema: import_zod.z.object({
|
|
5441
5450
|
query: import_zod.z.string().describe("Natural language search query"),
|
|
5442
|
-
|
|
5451
|
+
github_url: import_zod.z.string().optional().describe('GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.'),
|
|
5452
|
+
owner_repo: import_zod.z.string().optional().describe('Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.'),
|
|
5443
5453
|
branch: import_zod.z.string().optional().describe("Branch to search (defaults to repo default branch)")
|
|
5444
5454
|
}),
|
|
5445
5455
|
execute: async (params) => {
|
|
5446
|
-
const
|
|
5456
|
+
const github = params.github_url || params.owner_repo;
|
|
5457
|
+
if (!github) {
|
|
5458
|
+
throw new Error("Please provide github search url or owner/repo id");
|
|
5459
|
+
}
|
|
5460
|
+
const result = await client.searchGitHub({ query: params.query, github, branch: params.branch });
|
|
5447
5461
|
if (!result.success) {
|
|
5448
5462
|
throw new Error(`GitHub search failed: ${result.error}`);
|
|
5449
5463
|
}
|