@morphllm/morphsdk 0.2.69 → 0.2.71

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.
Files changed (57) hide show
  1. package/dist/{chunk-XFCMTW5L.js → chunk-4WJSTOHP.js} +3 -16
  2. package/dist/{chunk-XFCMTW5L.js.map → chunk-4WJSTOHP.js.map} +1 -1
  3. package/dist/chunk-B5A4XLSQ.js +10 -0
  4. package/dist/chunk-B5A4XLSQ.js.map +1 -0
  5. package/dist/{chunk-B3J2O2NW.js → chunk-BPVNNJ6D.js} +5 -5
  6. package/dist/{chunk-Q6GHKKS5.js → chunk-IYLEB6BY.js} +3 -15
  7. package/dist/{chunk-Q6GHKKS5.js.map → chunk-IYLEB6BY.js.map} +1 -1
  8. package/dist/{chunk-E4434A4Y.js → chunk-NGF2VIQV.js} +2 -2
  9. package/dist/{chunk-P6OEPI4N.js → chunk-POVU2CPK.js} +4 -20
  10. package/dist/{chunk-P6OEPI4N.js.map → chunk-POVU2CPK.js.map} +1 -1
  11. package/dist/{chunk-SUBBMTMY.js → chunk-RRWN62VU.js} +2 -2
  12. package/dist/chunk-RRWN62VU.js.map +1 -0
  13. package/dist/client.cjs +1 -1
  14. package/dist/client.cjs.map +1 -1
  15. package/dist/client.js +6 -6
  16. package/dist/index.cjs +6 -13
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +7 -8
  19. package/dist/tools/warp_grep/agent/runner.cjs +1 -1
  20. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  21. package/dist/tools/warp_grep/agent/runner.js +1 -1
  22. package/dist/tools/warp_grep/anthropic.cjs +1 -1
  23. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  24. package/dist/tools/warp_grep/anthropic.d.ts +78 -3
  25. package/dist/tools/warp_grep/anthropic.js +3 -3
  26. package/dist/tools/warp_grep/client.cjs +1 -1
  27. package/dist/tools/warp_grep/client.cjs.map +1 -1
  28. package/dist/tools/warp_grep/client.js +2 -2
  29. package/dist/tools/warp_grep/gemini.cjs +3 -4
  30. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  31. package/dist/tools/warp_grep/gemini.d.ts +109 -3
  32. package/dist/tools/warp_grep/gemini.js +46 -9
  33. package/dist/tools/warp_grep/gemini.js.map +1 -1
  34. package/dist/tools/warp_grep/index.cjs +7 -188
  35. package/dist/tools/warp_grep/index.cjs.map +1 -1
  36. package/dist/tools/warp_grep/index.d.ts +89 -9
  37. package/dist/tools/warp_grep/index.js +5 -18
  38. package/dist/tools/warp_grep/openai.cjs +1 -1
  39. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  40. package/dist/tools/warp_grep/openai.d.ts +78 -3
  41. package/dist/tools/warp_grep/openai.js +3 -3
  42. package/dist/tools/warp_grep/vercel.cjs +1 -1
  43. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  44. package/dist/tools/warp_grep/vercel.d.ts +56 -3
  45. package/dist/tools/warp_grep/vercel.js +3 -3
  46. package/package.json +1 -1
  47. package/dist/anthropic-BC-AMEIN.d.ts +0 -89
  48. package/dist/chunk-2LSVUHIE.js +0 -75
  49. package/dist/chunk-2LSVUHIE.js.map +0 -1
  50. package/dist/chunk-ISWL67SF.js +0 -1
  51. package/dist/chunk-ISWL67SF.js.map +0 -1
  52. package/dist/chunk-SUBBMTMY.js.map +0 -1
  53. package/dist/gemini-BIFBiIjY.d.ts +0 -119
  54. package/dist/openai-Beb9escY.d.ts +0 -89
  55. package/dist/vercel-Bo84tpBe.d.ts +0 -66
  56. /package/dist/{chunk-B3J2O2NW.js.map → chunk-BPVNNJ6D.js.map} +0 -0
  57. /package/dist/{chunk-E4434A4Y.js.map → chunk-NGF2VIQV.js.map} +0 -0
@@ -1,7 +1,82 @@
1
- import 'openai/resources/chat/completions';
1
+ import { ChatCompletionTool } from 'openai/resources/chat/completions';
2
2
  export { formatResult } from './client.js';
3
3
  export { getSystemPrompt } from './agent/prompt.js';
4
- import '../../types-CnvVDM63.js';
5
- export { c as createWarpGrepTool, w as default, e as execute, w as warpGrepTool } from '../../openai-Beb9escY.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
+ * OpenAI SDK adapter for morph-warp-grep tool
10
+ */
11
+
12
+ /**
13
+ * OpenAI-native warp grep tool definition
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import OpenAI from 'openai';
18
+ * import { warpGrepTool, execute } from '@morphllm/morphsdk/tools/warp-grep/openai';
19
+ *
20
+ * const client = new OpenAI();
21
+ * const response = await client.chat.completions.create({
22
+ * model: 'gpt-4o',
23
+ * tools: [warpGrepTool],
24
+ * messages: [{ role: 'user', content: 'Find authentication middleware' }]
25
+ * });
26
+ *
27
+ * // Execute the tool call
28
+ * const result = await execute({ query: '...' }, { repoRoot: '.' });
29
+ * ```
30
+ */
31
+ declare const warpGrepTool: ChatCompletionTool;
32
+ /**
33
+ * Execute warp grep search
34
+ *
35
+ * @param input - Tool input with query
36
+ * @param config - Configuration with repoRoot and optional provider
37
+ * @returns Search results
38
+ */
39
+ declare function execute(input: {
40
+ query: string;
41
+ } | string, config: WarpGrepToolConfig): Promise<WarpGrepResult>;
42
+
43
+ /**
44
+ * Create a custom warp grep tool with configuration and methods
45
+ *
46
+ * @param config - Configuration options
47
+ * @returns Tool definition with execute and formatResult methods
48
+ *
49
+ * @example Local usage
50
+ * ```typescript
51
+ * import OpenAI from 'openai';
52
+ * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/openai';
53
+ *
54
+ * const tool = createWarpGrepTool({ repoRoot: '.' });
55
+ *
56
+ * const client = new OpenAI();
57
+ * const response = await client.chat.completions.create({
58
+ * model: 'gpt-4o',
59
+ * tools: [tool],
60
+ * messages: [{ role: 'user', content: 'Find authentication middleware' }]
61
+ * });
62
+ * ```
63
+ *
64
+ * @example Remote sandbox (E2B, Modal, etc.)
65
+ * ```typescript
66
+ * const tool = createMorphWarpGrepTool({
67
+ * repoRoot: '/home/repo',
68
+ * remoteCommands: {
69
+ * grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout,
70
+ * read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout,
71
+ * listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout,
72
+ * },
73
+ * });
74
+ * ```
75
+ */
76
+ declare function createWarpGrepTool(config: WarpGrepToolConfig): ChatCompletionTool & {
77
+ execute: (input: unknown) => Promise<WarpGrepResult>;
78
+ formatResult: (result: WarpGrepResult) => string;
79
+ getSystemPrompt: () => string;
80
+ };
81
+
82
+ export { createWarpGrepTool, warpGrepTool as default, execute, warpGrepTool };
@@ -3,12 +3,12 @@ import {
3
3
  execute,
4
4
  openai_default,
5
5
  warpGrepTool
6
- } from "../../chunk-XFCMTW5L.js";
6
+ } from "../../chunk-4WJSTOHP.js";
7
7
  import "../../chunk-KW7OEGZK.js";
8
8
  import {
9
9
  formatResult
10
- } from "../../chunk-E4434A4Y.js";
11
- import "../../chunk-SUBBMTMY.js";
10
+ } from "../../chunk-NGF2VIQV.js";
11
+ import "../../chunk-RRWN62VU.js";
12
12
  import "../../chunk-26QXQFLZ.js";
13
13
  import "../../chunk-DCIUCDWJ.js";
14
14
  import "../../chunk-APP75CBN.js";
@@ -935,7 +935,7 @@ var import_path2 = __toESM(require("path"), 1);
935
935
  var parser = new LLMResponseParser();
936
936
  var DEFAULT_API_URL = "https://api.morphllm.com";
937
937
  async function callModel(messages, model, options = {}) {
938
- const baseUrl = DEFAULT_API_URL;
938
+ const baseUrl = options.morphApiUrl || DEFAULT_API_URL;
939
939
  const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || "";
940
940
  const fetchPromise = fetchWithRetry(
941
941
  `${baseUrl}/v1/chat/completions`,