@morphllm/morphsdk 0.2.69 → 0.2.70
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-B3J2O2NW.js → chunk-AB27WETH.js} +4 -4
- package/dist/chunk-B5A4XLSQ.js +10 -0
- package/dist/chunk-B5A4XLSQ.js.map +1 -0
- package/dist/{chunk-P6OEPI4N.js → chunk-GZP6HY5W.js} +3 -19
- package/dist/{chunk-P6OEPI4N.js.map → chunk-GZP6HY5W.js.map} +1 -1
- package/dist/{chunk-XFCMTW5L.js → chunk-I2GXV3BQ.js} +2 -15
- package/dist/{chunk-XFCMTW5L.js.map → chunk-I2GXV3BQ.js.map} +1 -1
- package/dist/{chunk-Q6GHKKS5.js → chunk-PT3DGIUF.js} +2 -14
- package/dist/{chunk-Q6GHKKS5.js.map → chunk-PT3DGIUF.js.map} +1 -1
- package/dist/client.js +4 -4
- package/dist/index.cjs +5 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -6
- package/dist/tools/warp_grep/anthropic.d.ts +78 -3
- package/dist/tools/warp_grep/anthropic.js +1 -1
- package/dist/tools/warp_grep/gemini.cjs +2 -3
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +109 -3
- package/dist/tools/warp_grep/gemini.js +44 -7
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +6 -187
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +89 -9
- package/dist/tools/warp_grep/index.js +3 -16
- package/dist/tools/warp_grep/openai.d.ts +78 -3
- package/dist/tools/warp_grep/openai.js +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +56 -3
- package/dist/tools/warp_grep/vercel.js +1 -1
- package/package.json +1 -1
- package/dist/anthropic-BC-AMEIN.d.ts +0 -89
- package/dist/chunk-2LSVUHIE.js +0 -75
- package/dist/chunk-2LSVUHIE.js.map +0 -1
- package/dist/chunk-ISWL67SF.js +0 -1
- package/dist/chunk-ISWL67SF.js.map +0 -1
- package/dist/gemini-BIFBiIjY.d.ts +0 -119
- package/dist/openai-Beb9escY.d.ts +0 -89
- package/dist/vercel-Bo84tpBe.d.ts +0 -66
- /package/dist/{chunk-B3J2O2NW.js.map → chunk-AB27WETH.js.map} +0 -0
|
@@ -1,7 +1,113 @@
|
|
|
1
|
-
import '@google/generative-ai';
|
|
1
|
+
import { FunctionDeclaration } from '@google/generative-ai';
|
|
2
2
|
export { formatResult } from './client.js';
|
|
3
3
|
export { getSystemPrompt } from './agent/prompt.js';
|
|
4
|
-
import '../../types-CnvVDM63.js';
|
|
5
|
-
export { G as GeminiWarpGrepTool, a as createMorphWarpGrepTool, c as createWarpGrepTool, w as default, e as execute, w as warpGrepFunctionDeclaration } from '../../gemini-BIFBiIjY.js';
|
|
4
|
+
import { d as WarpGrepToolConfig, b as WarpGrepResult } from '../../types-CnvVDM63.js';
|
|
6
5
|
import './providers/types.js';
|
|
7
6
|
import '../utils/resilience.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Google Gemini SDK adapter for morph-warp-grep tool
|
|
10
|
+
*
|
|
11
|
+
* Requires @google/generative-ai as a peer dependency.
|
|
12
|
+
* Install with: npm install @google/generative-ai
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gemini-native warp grep function declaration
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
21
|
+
* import { warpGrepFunctionDeclaration, execute } from '@morphllm/morphsdk/tools/warp-grep/gemini';
|
|
22
|
+
*
|
|
23
|
+
* const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
|
|
24
|
+
* const model = genAI.getGenerativeModel({
|
|
25
|
+
* model: 'gemini-2.0-flash',
|
|
26
|
+
* tools: [{ functionDeclarations: [warpGrepFunctionDeclaration] }]
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const chat = model.startChat();
|
|
30
|
+
* const result = await chat.sendMessage('Find authentication middleware');
|
|
31
|
+
*
|
|
32
|
+
* // Handle function call
|
|
33
|
+
* const call = result.response.functionCalls()?.[0];
|
|
34
|
+
* if (call) {
|
|
35
|
+
* const searchResult = await execute(call.args, { repoRoot: '.' });
|
|
36
|
+
* console.log(searchResult);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const warpGrepFunctionDeclaration: FunctionDeclaration;
|
|
41
|
+
/**
|
|
42
|
+
* Execute warp grep search
|
|
43
|
+
*
|
|
44
|
+
* @param input - Tool input with query
|
|
45
|
+
* @param config - Configuration with repoRoot and optional provider
|
|
46
|
+
* @returns Search results
|
|
47
|
+
*/
|
|
48
|
+
declare function execute(input: {
|
|
49
|
+
query: string;
|
|
50
|
+
} | string, config: WarpGrepToolConfig): Promise<WarpGrepResult>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gemini tool with execute method attached
|
|
54
|
+
*/
|
|
55
|
+
interface GeminiWarpGrepTool extends FunctionDeclaration {
|
|
56
|
+
execute: (input: unknown) => Promise<WarpGrepResult>;
|
|
57
|
+
formatResult: (result: WarpGrepResult) => string;
|
|
58
|
+
getSystemPrompt: () => string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a custom warp grep tool with configuration and methods
|
|
62
|
+
*
|
|
63
|
+
* @param config - Configuration options
|
|
64
|
+
* @returns Function declaration with execute and formatResult methods
|
|
65
|
+
*
|
|
66
|
+
* @example Local usage
|
|
67
|
+
* ```typescript
|
|
68
|
+
* import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
69
|
+
* import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/gemini';
|
|
70
|
+
*
|
|
71
|
+
* const tool = createMorphWarpGrepTool({ repoRoot: '.' });
|
|
72
|
+
*
|
|
73
|
+
* const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
|
|
74
|
+
* const model = genAI.getGenerativeModel({
|
|
75
|
+
* model: 'gemini-2.0-flash',
|
|
76
|
+
* tools: [{ functionDeclarations: [tool] }]
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* const chat = model.startChat();
|
|
80
|
+
* const result = await chat.sendMessage('Find authentication middleware');
|
|
81
|
+
*
|
|
82
|
+
* // Handle function call
|
|
83
|
+
* const call = result.response.functionCalls()?.[0];
|
|
84
|
+
* if (call && call.name === tool.name) {
|
|
85
|
+
* const searchResult = await tool.execute(call.args);
|
|
86
|
+
* console.log(tool.formatResult(searchResult));
|
|
87
|
+
*
|
|
88
|
+
* // Send result back to model
|
|
89
|
+
* await chat.sendMessage([{
|
|
90
|
+
* functionResponse: {
|
|
91
|
+
* name: call.name,
|
|
92
|
+
* response: { result: tool.formatResult(searchResult) }
|
|
93
|
+
* }
|
|
94
|
+
* }]);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example Remote sandbox (E2B, Modal, etc.)
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const tool = createMorphWarpGrepTool({
|
|
101
|
+
* repoRoot: '/home/repo',
|
|
102
|
+
* remoteCommands: {
|
|
103
|
+
* grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,
|
|
104
|
+
* read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,
|
|
105
|
+
* listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,
|
|
106
|
+
* },
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare function createWarpGrepTool(config: WarpGrepToolConfig): GeminiWarpGrepTool;
|
|
111
|
+
declare const createMorphWarpGrepTool: typeof createWarpGrepTool;
|
|
112
|
+
|
|
113
|
+
export { type GeminiWarpGrepTool, createMorphWarpGrepTool, createWarpGrepTool, warpGrepFunctionDeclaration as default, execute, warpGrepFunctionDeclaration };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
gemini_default,
|
|
6
|
-
warpGrepFunctionDeclaration
|
|
7
|
-
} from "../../chunk-2LSVUHIE.js";
|
|
8
|
-
import "../../chunk-KW7OEGZK.js";
|
|
2
|
+
WARP_GREP_DESCRIPTION,
|
|
3
|
+
WARP_GREP_TOOL_NAME
|
|
4
|
+
} from "../../chunk-KW7OEGZK.js";
|
|
9
5
|
import {
|
|
6
|
+
executeToolCall,
|
|
10
7
|
formatResult
|
|
11
8
|
} from "../../chunk-E4434A4Y.js";
|
|
12
9
|
import "../../chunk-SUBBMTMY.js";
|
|
@@ -24,6 +21,46 @@ import "../../chunk-TPP2UGQP.js";
|
|
|
24
21
|
import "../../chunk-XT5ZO6ES.js";
|
|
25
22
|
import "../../chunk-4VWJFZVS.js";
|
|
26
23
|
import "../../chunk-PZ5AY32C.js";
|
|
24
|
+
|
|
25
|
+
// tools/warp_grep/gemini.ts
|
|
26
|
+
var TOOL_PARAMETERS = {
|
|
27
|
+
type: "OBJECT",
|
|
28
|
+
properties: {
|
|
29
|
+
query: {
|
|
30
|
+
type: "STRING",
|
|
31
|
+
description: "Free-form repository question"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
required: ["query"]
|
|
35
|
+
};
|
|
36
|
+
var warpGrepFunctionDeclaration = {
|
|
37
|
+
name: WARP_GREP_TOOL_NAME,
|
|
38
|
+
description: WARP_GREP_DESCRIPTION,
|
|
39
|
+
parameters: TOOL_PARAMETERS
|
|
40
|
+
};
|
|
41
|
+
async function execute(input, config) {
|
|
42
|
+
return executeToolCall(input, config);
|
|
43
|
+
}
|
|
44
|
+
function createWarpGrepTool(config) {
|
|
45
|
+
const declaration = {
|
|
46
|
+
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
47
|
+
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
48
|
+
parameters: TOOL_PARAMETERS
|
|
49
|
+
};
|
|
50
|
+
return Object.assign(declaration, {
|
|
51
|
+
execute: async (input) => {
|
|
52
|
+
return executeToolCall(input, config);
|
|
53
|
+
},
|
|
54
|
+
formatResult: (result) => {
|
|
55
|
+
return formatResult(result);
|
|
56
|
+
},
|
|
57
|
+
getSystemPrompt: () => {
|
|
58
|
+
return getSystemPrompt();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var createMorphWarpGrepTool = createWarpGrepTool;
|
|
63
|
+
var gemini_default = warpGrepFunctionDeclaration;
|
|
27
64
|
export {
|
|
28
65
|
createMorphWarpGrepTool,
|
|
29
66
|
createWarpGrepTool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../tools/warp_grep/gemini.ts"],"sourcesContent":["/**\n * Google Gemini SDK adapter for morph-warp-grep tool\n * \n * Requires @google/generative-ai as a peer dependency.\n * Install with: npm install @google/generative-ai\n */\n\nimport type { FunctionDeclaration, FunctionDeclarationSchema } from '@google/generative-ai';\nimport { executeToolCall, formatResult } from './client.js';\nimport { WARP_GREP_DESCRIPTION, WARP_GREP_TOOL_NAME, getSystemPrompt } from './prompts.js';\nimport type { WarpGrepToolConfig, WarpGrepResult } from './types.js';\n\n// Use plain object to avoid runtime import of SchemaType enum\nconst TOOL_PARAMETERS = {\n type: 'OBJECT',\n properties: {\n query: { \n type: 'STRING', \n description: 'Free-form repository question' \n },\n },\n required: ['query'],\n} as unknown as FunctionDeclarationSchema;\n\n/**\n * Gemini-native warp grep function declaration\n * \n * @example\n * ```typescript\n * import { GoogleGenerativeAI } from '@google/generative-ai';\n * import { warpGrepFunctionDeclaration, execute } from '@morphllm/morphsdk/tools/warp-grep/gemini';\n * \n * const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);\n * const model = genAI.getGenerativeModel({\n * model: 'gemini-2.0-flash',\n * tools: [{ functionDeclarations: [warpGrepFunctionDeclaration] }]\n * });\n * \n * const chat = model.startChat();\n * const result = await chat.sendMessage('Find authentication middleware');\n * \n * // Handle function call\n * const call = result.response.functionCalls()?.[0];\n * if (call) {\n * const searchResult = await execute(call.args, { repoRoot: '.' });\n * console.log(searchResult);\n * }\n * ```\n */\nexport const warpGrepFunctionDeclaration: FunctionDeclaration = {\n name: WARP_GREP_TOOL_NAME,\n description: WARP_GREP_DESCRIPTION,\n parameters: TOOL_PARAMETERS,\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\nexport { formatResult, getSystemPrompt };\n\n/**\n * Gemini tool with execute method attached\n */\nexport interface GeminiWarpGrepTool extends FunctionDeclaration {\n execute: (input: unknown) => Promise<WarpGrepResult>;\n formatResult: (result: WarpGrepResult) => string;\n getSystemPrompt: () => string;\n}\n\n/**\n * Create a custom warp grep tool with configuration and methods\n * \n * @param config - Configuration options\n * @returns Function declaration with execute and formatResult methods\n * \n * @example Local usage\n * ```typescript\n * import { GoogleGenerativeAI } from '@google/generative-ai';\n * import { createMorphWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/gemini';\n * \n * const tool = createMorphWarpGrepTool({ repoRoot: '.' });\n * \n * const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);\n * const model = genAI.getGenerativeModel({\n * model: 'gemini-2.0-flash',\n * tools: [{ functionDeclarations: [tool] }]\n * });\n * \n * const chat = model.startChat();\n * const result = await chat.sendMessage('Find authentication middleware');\n * \n * // Handle function call\n * const call = result.response.functionCalls()?.[0];\n * if (call && call.name === tool.name) {\n * const searchResult = await tool.execute(call.args);\n * console.log(tool.formatResult(searchResult));\n * \n * // Send result back to model\n * await chat.sendMessage([{\n * functionResponse: {\n * name: call.name,\n * response: { result: tool.formatResult(searchResult) }\n * }\n * }]);\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): GeminiWarpGrepTool {\n const declaration: FunctionDeclaration = {\n name: config.name ?? WARP_GREP_TOOL_NAME,\n description: config.description ?? WARP_GREP_DESCRIPTION,\n parameters: TOOL_PARAMETERS,\n };\n\n return Object.assign(declaration, {\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// Legacy alias for backwards compatibility\nexport const createMorphWarpGrepTool = createWarpGrepTool;\n\nexport default warpGrepFunctionDeclaration;\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,kBAAkB;AAAA,EACtB,MAAM;AAAA,EACN,YAAY;AAAA,IACV,OAAO;AAAA,MACL,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,UAAU,CAAC,OAAO;AACpB;AA2BO,IAAM,8BAAmD;AAAA,EAC9D,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AACd;AASA,eAAsB,QACpB,OACA,QACyB;AACzB,SAAO,gBAAgB,OAAO,MAAM;AACtC;AA+DO,SAAS,mBAAmB,QAAgD;AACjF,QAAM,cAAmC;AAAA,IACvC,MAAM,OAAO,QAAQ;AAAA,IACrB,aAAa,OAAO,eAAe;AAAA,IACnC,YAAY;AAAA,EACd;AAEA,SAAO,OAAO,OAAO,aAAa;AAAA,IAChC,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;AAGO,IAAM,0BAA0B;AAEvC,IAAO,iBAAQ;","names":[]}
|
|
@@ -36,22 +36,20 @@ __export(warp_grep_exports, {
|
|
|
36
36
|
WARP_GREP_SYSTEM_PROMPT: () => SYSTEM_PROMPT,
|
|
37
37
|
WARP_GREP_TOOL_NAME: () => WARP_GREP_TOOL_NAME,
|
|
38
38
|
WarpGrepClient: () => WarpGrepClient,
|
|
39
|
-
anthropic: () => anthropic_exports,
|
|
40
39
|
executeToolCall: () => executeToolCall,
|
|
41
40
|
executeWarpGrep: () => executeWarpGrep,
|
|
42
41
|
formatResult: () => formatResult,
|
|
43
|
-
gemini: () => gemini_exports,
|
|
44
42
|
getSystemPrompt: () => getSystemPrompt,
|
|
45
43
|
normalizeFinishFiles: () => normalizeFinishFiles,
|
|
46
|
-
openai: () => openai_exports,
|
|
47
44
|
readFinishFiles: () => readFinishFiles,
|
|
48
45
|
runWarpGrep: () => runWarpGrep,
|
|
49
46
|
toolGrep: () => toolGrep,
|
|
50
47
|
toolListDirectory: () => toolListDirectory,
|
|
51
48
|
toolRead: () => toolRead,
|
|
52
|
-
|
|
49
|
+
warpGrepInputSchema: () => warpGrepInputSchema
|
|
53
50
|
});
|
|
54
51
|
module.exports = __toCommonJS(warp_grep_exports);
|
|
52
|
+
var import_zod = require("zod");
|
|
55
53
|
|
|
56
54
|
// tools/warp_grep/agent/config.ts
|
|
57
55
|
var AGENT_CONFIG = {
|
|
@@ -1763,186 +1761,10 @@ function formatResult(result) {
|
|
|
1763
1761
|
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
1764
1762
|
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.';
|
|
1765
1763
|
|
|
1766
|
-
// tools/warp_grep/
|
|
1767
|
-
var
|
|
1768
|
-
|
|
1769
|
-
createWarpGrepTool: () => createWarpGrepTool,
|
|
1770
|
-
execute: () => execute,
|
|
1771
|
-
formatResult: () => formatResult,
|
|
1772
|
-
getSystemPrompt: () => getSystemPrompt,
|
|
1773
|
-
warpGrepTool: () => warpGrepTool
|
|
1774
|
-
});
|
|
1775
|
-
var INPUT_SCHEMA = {
|
|
1776
|
-
type: "object",
|
|
1777
|
-
properties: {
|
|
1778
|
-
query: { type: "string", description: "Free-form repository question" }
|
|
1779
|
-
},
|
|
1780
|
-
required: ["query"]
|
|
1781
|
-
};
|
|
1782
|
-
var warpGrepTool = {
|
|
1783
|
-
name: WARP_GREP_TOOL_NAME,
|
|
1784
|
-
description: WARP_GREP_DESCRIPTION,
|
|
1785
|
-
input_schema: INPUT_SCHEMA
|
|
1786
|
-
};
|
|
1787
|
-
async function execute(input, config) {
|
|
1788
|
-
return executeToolCall(input, config);
|
|
1789
|
-
}
|
|
1790
|
-
function createWarpGrepTool(config) {
|
|
1791
|
-
const tool2 = {
|
|
1792
|
-
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
1793
|
-
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
1794
|
-
input_schema: INPUT_SCHEMA
|
|
1795
|
-
};
|
|
1796
|
-
return Object.assign(tool2, {
|
|
1797
|
-
execute: async (input) => {
|
|
1798
|
-
return executeToolCall(input, config);
|
|
1799
|
-
},
|
|
1800
|
-
formatResult: (result) => {
|
|
1801
|
-
return formatResult(result);
|
|
1802
|
-
},
|
|
1803
|
-
getSystemPrompt: () => {
|
|
1804
|
-
return getSystemPrompt();
|
|
1805
|
-
}
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
// tools/warp_grep/openai.ts
|
|
1810
|
-
var openai_exports = {};
|
|
1811
|
-
__export(openai_exports, {
|
|
1812
|
-
createWarpGrepTool: () => createWarpGrepTool2,
|
|
1813
|
-
default: () => openai_default,
|
|
1814
|
-
execute: () => execute2,
|
|
1815
|
-
formatResult: () => formatResult,
|
|
1816
|
-
getSystemPrompt: () => getSystemPrompt,
|
|
1817
|
-
warpGrepTool: () => warpGrepTool2
|
|
1818
|
-
});
|
|
1819
|
-
var TOOL_PARAMETERS = {
|
|
1820
|
-
type: "object",
|
|
1821
|
-
properties: {
|
|
1822
|
-
query: { type: "string", description: "Free-form repository question" }
|
|
1823
|
-
},
|
|
1824
|
-
required: ["query"]
|
|
1825
|
-
};
|
|
1826
|
-
var warpGrepTool2 = {
|
|
1827
|
-
type: "function",
|
|
1828
|
-
function: {
|
|
1829
|
-
name: WARP_GREP_TOOL_NAME,
|
|
1830
|
-
description: WARP_GREP_DESCRIPTION,
|
|
1831
|
-
parameters: TOOL_PARAMETERS
|
|
1832
|
-
}
|
|
1833
|
-
};
|
|
1834
|
-
async function execute2(input, config) {
|
|
1835
|
-
return executeToolCall(input, config);
|
|
1836
|
-
}
|
|
1837
|
-
function createWarpGrepTool2(config) {
|
|
1838
|
-
const tool2 = {
|
|
1839
|
-
type: "function",
|
|
1840
|
-
function: {
|
|
1841
|
-
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
1842
|
-
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
1843
|
-
parameters: TOOL_PARAMETERS
|
|
1844
|
-
}
|
|
1845
|
-
};
|
|
1846
|
-
return Object.assign(tool2, {
|
|
1847
|
-
execute: async (input) => {
|
|
1848
|
-
return executeToolCall(input, config);
|
|
1849
|
-
},
|
|
1850
|
-
formatResult: (result) => {
|
|
1851
|
-
return formatResult(result);
|
|
1852
|
-
},
|
|
1853
|
-
getSystemPrompt: () => {
|
|
1854
|
-
return getSystemPrompt();
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
var openai_default = warpGrepTool2;
|
|
1859
|
-
|
|
1860
|
-
// tools/warp_grep/vercel.ts
|
|
1861
|
-
var vercel_exports = {};
|
|
1862
|
-
__export(vercel_exports, {
|
|
1863
|
-
createWarpGrepTool: () => createWarpGrepTool3,
|
|
1864
|
-
default: () => vercel_default,
|
|
1865
|
-
execute: () => execute3,
|
|
1866
|
-
formatResult: () => formatResult,
|
|
1867
|
-
getSystemPrompt: () => getSystemPrompt
|
|
1868
|
-
});
|
|
1869
|
-
var import_ai = require("ai");
|
|
1870
|
-
var import_zod = require("zod");
|
|
1871
|
-
async function execute3(input, config) {
|
|
1872
|
-
return executeToolCall(input, config);
|
|
1873
|
-
}
|
|
1874
|
-
function createWarpGrepTool3(config) {
|
|
1875
|
-
const schema = import_zod.z.object({
|
|
1876
|
-
query: import_zod.z.string().describe("Free-form repository question")
|
|
1877
|
-
});
|
|
1878
|
-
return (0, import_ai.tool)({
|
|
1879
|
-
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
1880
|
-
inputSchema: schema,
|
|
1881
|
-
execute: async (params) => {
|
|
1882
|
-
const result = await executeToolCall(params, config);
|
|
1883
|
-
if (!result.success) {
|
|
1884
|
-
throw new Error(`Failed to search codebase: ${result.error}`);
|
|
1885
|
-
}
|
|
1886
|
-
return {
|
|
1887
|
-
success: true,
|
|
1888
|
-
contexts: result.contexts,
|
|
1889
|
-
summary: result.summary
|
|
1890
|
-
};
|
|
1891
|
-
}
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1894
|
-
var vercel_default = createWarpGrepTool3;
|
|
1895
|
-
|
|
1896
|
-
// tools/warp_grep/gemini.ts
|
|
1897
|
-
var gemini_exports = {};
|
|
1898
|
-
__export(gemini_exports, {
|
|
1899
|
-
createMorphWarpGrepTool: () => createMorphWarpGrepTool,
|
|
1900
|
-
createWarpGrepTool: () => createWarpGrepTool4,
|
|
1901
|
-
default: () => gemini_default,
|
|
1902
|
-
execute: () => execute4,
|
|
1903
|
-
formatResult: () => formatResult,
|
|
1904
|
-
getSystemPrompt: () => getSystemPrompt,
|
|
1905
|
-
warpGrepFunctionDeclaration: () => warpGrepFunctionDeclaration
|
|
1764
|
+
// tools/warp_grep/index.ts
|
|
1765
|
+
var warpGrepInputSchema = import_zod.z.object({
|
|
1766
|
+
query: import_zod.z.string().describe("Free-form repository question")
|
|
1906
1767
|
});
|
|
1907
|
-
var import_generative_ai = require("@google/generative-ai");
|
|
1908
|
-
var TOOL_PARAMETERS2 = {
|
|
1909
|
-
type: import_generative_ai.SchemaType.OBJECT,
|
|
1910
|
-
properties: {
|
|
1911
|
-
query: {
|
|
1912
|
-
type: import_generative_ai.SchemaType.STRING,
|
|
1913
|
-
description: "Free-form repository question"
|
|
1914
|
-
}
|
|
1915
|
-
},
|
|
1916
|
-
required: ["query"]
|
|
1917
|
-
};
|
|
1918
|
-
var warpGrepFunctionDeclaration = {
|
|
1919
|
-
name: WARP_GREP_TOOL_NAME,
|
|
1920
|
-
description: WARP_GREP_DESCRIPTION,
|
|
1921
|
-
parameters: TOOL_PARAMETERS2
|
|
1922
|
-
};
|
|
1923
|
-
async function execute4(input, config) {
|
|
1924
|
-
return executeToolCall(input, config);
|
|
1925
|
-
}
|
|
1926
|
-
function createWarpGrepTool4(config) {
|
|
1927
|
-
const declaration = {
|
|
1928
|
-
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
1929
|
-
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
1930
|
-
parameters: TOOL_PARAMETERS2
|
|
1931
|
-
};
|
|
1932
|
-
return Object.assign(declaration, {
|
|
1933
|
-
execute: async (input) => {
|
|
1934
|
-
return executeToolCall(input, config);
|
|
1935
|
-
},
|
|
1936
|
-
formatResult: (result) => {
|
|
1937
|
-
return formatResult(result);
|
|
1938
|
-
},
|
|
1939
|
-
getSystemPrompt: () => {
|
|
1940
|
-
return getSystemPrompt();
|
|
1941
|
-
}
|
|
1942
|
-
});
|
|
1943
|
-
}
|
|
1944
|
-
var createMorphWarpGrepTool = createWarpGrepTool4;
|
|
1945
|
-
var gemini_default = warpGrepFunctionDeclaration;
|
|
1946
1768
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1947
1769
|
0 && (module.exports = {
|
|
1948
1770
|
LocalRipgrepProvider,
|
|
@@ -1951,19 +1773,16 @@ var gemini_default = warpGrepFunctionDeclaration;
|
|
|
1951
1773
|
WARP_GREP_SYSTEM_PROMPT,
|
|
1952
1774
|
WARP_GREP_TOOL_NAME,
|
|
1953
1775
|
WarpGrepClient,
|
|
1954
|
-
anthropic,
|
|
1955
1776
|
executeToolCall,
|
|
1956
1777
|
executeWarpGrep,
|
|
1957
1778
|
formatResult,
|
|
1958
|
-
gemini,
|
|
1959
1779
|
getSystemPrompt,
|
|
1960
1780
|
normalizeFinishFiles,
|
|
1961
|
-
openai,
|
|
1962
1781
|
readFinishFiles,
|
|
1963
1782
|
runWarpGrep,
|
|
1964
1783
|
toolGrep,
|
|
1965
1784
|
toolListDirectory,
|
|
1966
1785
|
toolRead,
|
|
1967
|
-
|
|
1786
|
+
warpGrepInputSchema
|
|
1968
1787
|
});
|
|
1969
1788
|
//# sourceMappingURL=index.cjs.map
|