@morphllm/morphsdk 0.2.38 → 0.2.40

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 (99) hide show
  1. package/dist/{chunk-AKVAAKRB.js → chunk-3NTGAUTJ.js} +73 -2
  2. package/dist/chunk-3NTGAUTJ.js.map +1 -0
  3. package/dist/{chunk-TBVDBQZ2.js → chunk-4WIBODS7.js} +61 -3
  4. package/dist/chunk-4WIBODS7.js.map +1 -0
  5. package/dist/{chunk-LN4CTQZG.js → chunk-7MCSSJJA.js} +2 -2
  6. package/dist/{chunk-DJSQUQGY.js → chunk-DIWNR3UP.js} +3 -3
  7. package/dist/{chunk-W5CHJ6OX.js → chunk-JSZQVUSE.js} +2 -2
  8. package/dist/{chunk-YSBSDU75.js → chunk-LUI7APXX.js} +2 -2
  9. package/dist/{chunk-EAA7D24N.js → chunk-N5654KQR.js} +13 -13
  10. package/dist/client.cjs +60 -2
  11. package/dist/client.cjs.map +1 -1
  12. package/dist/client.js +3 -3
  13. package/dist/git/client.cjs +60 -2
  14. package/dist/git/client.cjs.map +1 -1
  15. package/dist/git/client.js +1 -1
  16. package/dist/git/index.cjs +60 -2
  17. package/dist/git/index.cjs.map +1 -1
  18. package/dist/git/index.js +1 -1
  19. package/dist/git/types.cjs.map +1 -1
  20. package/dist/index.cjs +60 -2
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.js +3 -3
  23. package/dist/modelrouter/core.cjs +74 -2
  24. package/dist/modelrouter/core.cjs.map +1 -1
  25. package/dist/modelrouter/core.js +5 -3
  26. package/dist/modelrouter/index.cjs +74 -2
  27. package/dist/modelrouter/index.cjs.map +1 -1
  28. package/dist/modelrouter/index.js +5 -3
  29. package/dist/modelrouter/types.cjs.map +1 -1
  30. package/dist/tools/warp_grep/agent/runner.js +5 -5
  31. package/dist/tools/warp_grep/anthropic.js +6 -6
  32. package/dist/tools/warp_grep/index.js +8 -8
  33. package/dist/tools/warp_grep/openai.js +6 -6
  34. package/dist/tools/warp_grep/vercel.js +6 -6
  35. package/package.json +1 -1
  36. package/dist/anthropic-DpEAqqZF.d.ts +0 -88
  37. package/dist/chunk-AKVAAKRB.js.map +0 -1
  38. package/dist/chunk-TBVDBQZ2.js.map +0 -1
  39. package/dist/client.d.ts +0 -114
  40. package/dist/git/client.d.ts +0 -261
  41. package/dist/git/config.d.ts +0 -11
  42. package/dist/git/index.d.ts +0 -5
  43. package/dist/git/types.d.ts +0 -102
  44. package/dist/index.d.ts +0 -14
  45. package/dist/modelrouter/core.d.ts +0 -56
  46. package/dist/modelrouter/index.d.ts +0 -2
  47. package/dist/modelrouter/types.d.ts +0 -35
  48. package/dist/openai-BkKsS30n.d.ts +0 -111
  49. package/dist/tools/browser/anthropic.d.ts +0 -51
  50. package/dist/tools/browser/core.d.ts +0 -203
  51. package/dist/tools/browser/index.d.ts +0 -72
  52. package/dist/tools/browser/openai.d.ts +0 -73
  53. package/dist/tools/browser/prompts.d.ts +0 -7
  54. package/dist/tools/browser/types.d.ts +0 -255
  55. package/dist/tools/browser/vercel.d.ts +0 -69
  56. package/dist/tools/codebase_search/anthropic.d.ts +0 -40
  57. package/dist/tools/codebase_search/core.d.ts +0 -40
  58. package/dist/tools/codebase_search/index.d.ts +0 -10
  59. package/dist/tools/codebase_search/openai.d.ts +0 -87
  60. package/dist/tools/codebase_search/prompts.d.ts +0 -7
  61. package/dist/tools/codebase_search/types.d.ts +0 -50
  62. package/dist/tools/codebase_search/vercel.d.ts +0 -65
  63. package/dist/tools/fastapply/anthropic.d.ts +0 -4
  64. package/dist/tools/fastapply/core.d.ts +0 -41
  65. package/dist/tools/fastapply/index.d.ts +0 -10
  66. package/dist/tools/fastapply/openai.d.ts +0 -4
  67. package/dist/tools/fastapply/prompts.d.ts +0 -7
  68. package/dist/tools/fastapply/types.d.ts +0 -77
  69. package/dist/tools/fastapply/vercel.d.ts +0 -4
  70. package/dist/tools/index.d.ts +0 -10
  71. package/dist/tools/utils/resilience.d.ts +0 -58
  72. package/dist/tools/warp_grep/agent/config.d.ts +0 -8
  73. package/dist/tools/warp_grep/agent/formatter.d.ts +0 -14
  74. package/dist/tools/warp_grep/agent/grep_helpers.d.ts +0 -16
  75. package/dist/tools/warp_grep/agent/parser.d.ts +0 -16
  76. package/dist/tools/warp_grep/agent/prompt.d.ts +0 -4
  77. package/dist/tools/warp_grep/agent/runner.d.ts +0 -10
  78. package/dist/tools/warp_grep/agent/types.d.ts +0 -44
  79. package/dist/tools/warp_grep/anthropic.d.ts +0 -14
  80. package/dist/tools/warp_grep/index.d.ts +0 -11
  81. package/dist/tools/warp_grep/openai.d.ts +0 -33
  82. package/dist/tools/warp_grep/providers/command.d.ts +0 -48
  83. package/dist/tools/warp_grep/providers/local.d.ts +0 -30
  84. package/dist/tools/warp_grep/providers/types.d.ts +0 -49
  85. package/dist/tools/warp_grep/tools/analyse.d.ts +0 -10
  86. package/dist/tools/warp_grep/tools/finish.d.ts +0 -10
  87. package/dist/tools/warp_grep/tools/grep.d.ts +0 -8
  88. package/dist/tools/warp_grep/tools/read.d.ts +0 -9
  89. package/dist/tools/warp_grep/utils/files.d.ts +0 -3
  90. package/dist/tools/warp_grep/utils/format.d.ts +0 -4
  91. package/dist/tools/warp_grep/utils/paths.d.ts +0 -7
  92. package/dist/tools/warp_grep/utils/ripgrep.d.ts +0 -11
  93. package/dist/tools/warp_grep/vercel.d.ts +0 -33
  94. package/dist/vercel-B1GZ_g9N.d.ts +0 -69
  95. /package/dist/{chunk-LN4CTQZG.js.map → chunk-7MCSSJJA.js.map} +0 -0
  96. /package/dist/{chunk-DJSQUQGY.js.map → chunk-DIWNR3UP.js.map} +0 -0
  97. /package/dist/{chunk-W5CHJ6OX.js.map → chunk-JSZQVUSE.js.map} +0 -0
  98. /package/dist/{chunk-YSBSDU75.js.map → chunk-LUI7APXX.js.map} +0 -0
  99. /package/dist/{chunk-EAA7D24N.js.map → chunk-N5654KQR.js.map} +0 -0
@@ -1,4 +0,0 @@
1
- import 'openai/resources/chat/completions';
2
- import './types.js';
3
- export { c as createEditFileTool, e as default, e as editFileTool, a as execute, f as formatResult, g as getSystemPrompt } from '../../openai-BkKsS30n.js';
4
- import '../utils/resilience.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * System prompts for edit_file tool
3
- */
4
- declare const EDIT_FILE_TOOL_DESCRIPTION = "Use this tool to make an edit to an existing file.\n\nThis will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.\n\nWhen writing the edit, you should specify each edit in sequence, with the special comment // ... existing code ... to represent unchanged code in between edited lines.\n\nFor example:\n\n// ... existing code ...\nFIRST_EDIT\n// ... existing code ...\nSECOND_EDIT\n// ... existing code ...\nTHIRD_EDIT\n// ... existing code ...\n\nYou should still bias towards repeating as few lines of the original file as possible to convey the change.\nBut, each edit should contain minimally sufficient context of unchanged lines around the code you're editing to resolve ambiguity.\n\nDO NOT omit spans of pre-existing code (or comments) without using the // ... existing code ... comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.\n\nIf you plan on deleting a section, you must provide context before and after to delete it.\n\nMake sure it is clear what the edit should be, and where it should be applied.\nMake edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.";
5
- declare const EDIT_FILE_SYSTEM_PROMPT = "When the user is asking for edits to their code, use the edit_file tool to highlight the changes necessary and add comments to indicate where unchanged code has been skipped. For example:\n\n// ... existing code ...\n{{ edit_1 }}\n// ... existing code ...\n{{ edit_2 }}\n// ... existing code ...\n\nOften this will mean that the start/end of the file will be skipped, but that's okay! Rewrite the entire file ONLY if specifically requested. Always provide a brief explanation of the updates, unless the user specifically requests only the code.\n\nThese edit codeblocks are also read by a less intelligent language model, colloquially called the apply model, to update the file. To help specify the edit to the apply model, you will be very careful when generating the codeblock to not introduce ambiguity. You will specify all unchanged regions (code and comments) of the file with \"// ... existing code ...\" comment markers. This will ensure the apply model will not delete existing unchanged code or comments when editing the file.";
6
-
7
- export { EDIT_FILE_SYSTEM_PROMPT, EDIT_FILE_TOOL_DESCRIPTION };
@@ -1,77 +0,0 @@
1
- import { RetryConfig } from '../utils/resilience.js';
2
-
3
- /**
4
- * Core types for Morph Fast Apply SDK
5
- */
6
-
7
- /**
8
- * Input parameters for the edit_file tool
9
- */
10
- interface EditFileInput {
11
- /** Path to the file to edit (relative to baseDir) */
12
- target_filepath: string;
13
- /** First-person description of what you're changing */
14
- instructions: string;
15
- /** Lazy edit with // ... existing code ... markers */
16
- code_edit: string;
17
- }
18
- /**
19
- * Statistics about the changes made
20
- */
21
- interface EditChanges {
22
- linesAdded: number;
23
- linesRemoved: number;
24
- linesModified: number;
25
- }
26
- /**
27
- * Result returned after executing an edit
28
- */
29
- interface EditFileResult {
30
- /** Whether the edit was successful */
31
- success: boolean;
32
- /** Path to the edited file */
33
- filepath: string;
34
- /** Universal diff format showing changes */
35
- udiff?: string;
36
- /** Statistics about the changes */
37
- changes: EditChanges;
38
- /** Error message if unsuccessful */
39
- error?: string;
40
- }
41
- /**
42
- * Configuration options for the edit_file tool
43
- */
44
- interface EditFileConfig {
45
- /** Morph API key (defaults to MORPH_API_KEY env var) */
46
- morphApiKey?: string;
47
- /** Morph API base URL */
48
- morphApiUrl?: string;
49
- /** Base directory for file operations (defaults to cwd) */
50
- baseDir?: string;
51
- /** Whether to generate udiff (default: true) */
52
- generateUdiff?: boolean;
53
- /** Whether to automatically write to file (default: true) */
54
- autoWrite?: boolean;
55
- /** Custom system prompt (null to disable) */
56
- systemPrompt?: string | null;
57
- /** Custom tool description (defaults to EDIT_FILE_TOOL_DESCRIPTION) */
58
- description?: string;
59
- /** Timeout for API calls in ms (default: 30000) */
60
- timeout?: number;
61
- /** Retry configuration for API calls */
62
- retryConfig?: RetryConfig;
63
- /** Enable debug logging (default: false) */
64
- debug?: boolean;
65
- }
66
- /**
67
- * Response from Morph Apply API
68
- */
69
- interface MorphApplyResponse {
70
- choices: Array<{
71
- message: {
72
- content: string;
73
- };
74
- }>;
75
- }
76
-
77
- export type { EditChanges, EditFileConfig, EditFileInput, EditFileResult, MorphApplyResponse };
@@ -1,4 +0,0 @@
1
- import 'ai';
2
- import './types.js';
3
- export { c as createEditFileTool, e as default, e as editFileTool, g as getSystemPrompt } from '../../vercel-B1GZ_g9N.js';
4
- import '../utils/resilience.js';
@@ -1,10 +0,0 @@
1
- export { countChanges, executeEditFile, generateUdiff } from './fastapply/core.js';
2
- export { EditChanges, EditFileConfig, EditFileInput, EditFileResult } from './fastapply/types.js';
3
- export { EDIT_FILE_SYSTEM_PROMPT, EDIT_FILE_TOOL_DESCRIPTION } from './fastapply/prompts.js';
4
- export { a as anthropic } from '../anthropic-DpEAqqZF.js';
5
- export { o as openai } from '../openai-BkKsS30n.js';
6
- export { v as vercel } from '../vercel-B1GZ_g9N.js';
7
- import './utils/resilience.js';
8
- import '@anthropic-ai/sdk/resources/messages';
9
- import 'openai/resources/chat/completions';
10
- import 'ai';
@@ -1,58 +0,0 @@
1
- /**
2
- * Resilience utilities for retry logic and timeout handling
3
- */
4
- interface RetryConfig {
5
- maxRetries?: number;
6
- initialDelay?: number;
7
- maxDelay?: number;
8
- backoffMultiplier?: number;
9
- retryableErrors?: string[];
10
- onRetry?: (attempt: number, error: Error) => void;
11
- }
12
- /**
13
- * Retry a fetch request with exponential backoff
14
- *
15
- * @param url - Request URL
16
- * @param options - Fetch options
17
- * @param retryConfig - Retry configuration
18
- * @returns Response from fetch
19
- *
20
- * @example
21
- * ```typescript
22
- * const response = await fetchWithRetry(
23
- * 'https://api.example.com/data',
24
- * { method: 'POST', body: JSON.stringify(data) },
25
- * { maxRetries: 5, initialDelay: 500 }
26
- * );
27
- * ```
28
- */
29
- declare function fetchWithRetry(url: string, options: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
30
- /**
31
- * Add timeout to any promise
32
- *
33
- * @param promise - Promise to wrap with timeout
34
- * @param timeoutMs - Timeout in milliseconds
35
- * @param errorMessage - Optional custom error message
36
- * @returns Promise that rejects if timeout is reached
37
- *
38
- * @example
39
- * ```typescript
40
- * const result = await withTimeout(
41
- * fetchData(),
42
- * 5000,
43
- * 'Data fetch timed out'
44
- * );
45
- * ```
46
- */
47
- declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
48
- /**
49
- * Unified error type for all tools
50
- */
51
- declare class MorphError extends Error {
52
- code: string;
53
- statusCode?: number | undefined;
54
- retryable: boolean;
55
- constructor(message: string, code: string, statusCode?: number | undefined, retryable?: boolean);
56
- }
57
-
58
- export { MorphError, type RetryConfig, fetchWithRetry, withTimeout };
@@ -1,8 +0,0 @@
1
- declare const AGENT_CONFIG: {
2
- MAX_ROUNDS: number;
3
- TIMEOUT_MS: number;
4
- };
5
- declare const DEFAULT_EXCLUDES: string[];
6
- declare const DEFAULT_MODEL = "morph-warp-grep";
7
-
8
- export { AGENT_CONFIG, DEFAULT_EXCLUDES, DEFAULT_MODEL };
@@ -1,14 +0,0 @@
1
- declare class ToolOutputFormatter {
2
- format(toolName: string, args: Record<string, unknown> | null | undefined, output: string, options?: {
3
- isError?: boolean;
4
- }): string;
5
- private formatRead;
6
- private formatAnalyse;
7
- private formatGrep;
8
- private asString;
9
- }
10
- declare function formatAgentToolOutput(toolName: string, args: Record<string, unknown> | null | undefined, output: string, options?: {
11
- isError?: boolean;
12
- }): string;
13
-
14
- export { ToolOutputFormatter, formatAgentToolOutput };
@@ -1,16 +0,0 @@
1
- interface GrepMatch {
2
- path: string;
3
- lineNumber: number;
4
- content: string;
5
- }
6
- declare class GrepState {
7
- private readonly seenLines;
8
- isNew(path: string, lineNumber: number): boolean;
9
- add(path: string, lineNumber: number): void;
10
- private makeKey;
11
- }
12
- declare const MAX_GREP_OUTPUT_CHARS_PER_TURN = 60000;
13
- declare function parseAndFilterGrepOutput(rawOutput: string, state: GrepState): GrepMatch[];
14
- declare function formatTurnGrepOutput(matches: GrepMatch[], maxChars?: number): string;
15
-
16
- export { type GrepMatch, GrepState, MAX_GREP_OUTPUT_CHARS_PER_TURN, formatTurnGrepOutput, parseAndFilterGrepOutput };
@@ -1,16 +0,0 @@
1
- import { ToolCall } from './types.js';
2
-
3
- declare class LLMResponseParseError extends Error {
4
- constructor(message: string);
5
- }
6
- declare class LLMResponseParser {
7
- private readonly finishSpecSplitRe;
8
- parse(text: string): ToolCall[];
9
- private splitLine;
10
- private handleAnalyse;
11
- private handleGrep;
12
- private handleRead;
13
- private handleFinish;
14
- }
15
-
16
- export { LLMResponseParseError, LLMResponseParser };
@@ -1,4 +0,0 @@
1
- declare const SYSTEM_PROMPT = "You are a code search agent. Your task is to find relevant code snippets based on a search query.\n\n<workflow>\nYou operate in exactly 3 rounds of tool exploration, followed by a final answer:\n\n1. In each round, you can make MULTIPLE tool calls (up to 8) to search in parallel. All tool results will be returned together after each round.\n2. After your third round of tool calls, your next turn MUST be a single call to the `finish` tool with all the context you have found.\n</workflow>\n\n<tool_calling>\nYou have tools at your disposal to solve the coding task. Follow these rules regarding tool calls:\n\n### 1. `analyse` - Explore Directories\nExplore directory structure in a tree-like format.\n**Syntax:** `analyse <path> [pattern]`\n- `<path>`: Directory path to analyze (defaults to `.`)\n- `[pattern]`: Optional regex pattern to filter names\n\nFor example:\n```\nanalyse src/api\nanalyse . \"test\"\n```\n\n### 2. `read` - Read File Contents\nRead entire files or specific line ranges.\n**Syntax:** `read <path>[:start-end]`\n- `<path>`: File path to read\n- `[:start-end]`: Optional 1-based, inclusive line range\n\nFor example:\n```\nread src/main.py\nread src/database/connection.py:10-50\n```\n\n### 3. `grep` - Search with Regex\nSearch for regex patterns across files using ripgrep.\n**Syntax:** `grep '<pattern>' <path>`\n- `'<pattern>'`: Regex pattern (always wrap in single quotes)\n- `<path>`: Directory or file to search (use `.` for the repo root)\n\nFor example:\n```\ngrep 'create_user' .\ngrep 'import.*requests' src/api\ngrep 'class\\\\s+AuthService' controllers/auth.py\n```\n\n### 4. `finish` - Submit Final Answer\nSubmit your findings when complete.\n**Syntax:** `finish <file1:range1,range2...> [file2:range3...]`\n- Provide file paths with colon-separated, comma-separated line ranges\n\nFor example:\n```\nfinish src/api/auth.py:25-50,75-80 src/models/user.py:10-15\n```\n</tool_calling>\n\n<strategy>\n- Use the `analyse`, `grep`, and `read` tools to gather information about the codebase.\n- Leverage the tools smartly to make full use of their potential\n- Make parallel tool calls within each round to investigate multiple paths or files efficiently\n- Be systematic and thorough within your 3-round limit\n</strategy>\n\n<output_format>\n- Only output tool calls themselves\n- Do not include explanatory text, reasoning, or commentary\n- Each tool call should be on its own line\n- After 3 rounds of exploration, call `finish` with all relevant code snippets you found\n</output_format>\n\nBegin your exploration now to find code relevant to the query.";
2
- declare function getSystemPrompt(): string;
3
-
4
- export { SYSTEM_PROMPT, getSystemPrompt };
@@ -1,10 +0,0 @@
1
- import { SessionConfig, AgentRunResult } from './types.js';
2
- import { WarpGrepProvider } from '../providers/types.js';
3
-
4
- type EventName = 'initial_state' | 'round_start' | 'round_end' | 'finish' | 'error';
5
- type EventCallback = (name: EventName, payload: Record<string, unknown>) => void;
6
- declare function runWarpGrep(config: SessionConfig & {
7
- provider: WarpGrepProvider;
8
- }): Promise<AgentRunResult>;
9
-
10
- export { type EventCallback, runWarpGrep };
@@ -1,44 +0,0 @@
1
- type ChatMessage = {
2
- role: 'system' | 'user' | 'assistant';
3
- content: string;
4
- };
5
- type ToolName = 'analyse' | 'grep' | 'glob' | 'read' | 'finish';
6
- type ToolCall = {
7
- name: ToolName;
8
- arguments?: Record<string, unknown>;
9
- };
10
- type FinishFileSpec = {
11
- path: string;
12
- lines: Array<[number, number]>;
13
- };
14
- type AgentFinish = {
15
- files: FinishFileSpec[];
16
- };
17
- type ResolvedFile = {
18
- path: string;
19
- content: string;
20
- };
21
- type AgentRunResult = {
22
- terminationReason: 'completed' | 'terminated' | 'error';
23
- messages: ChatMessage[];
24
- finish?: {
25
- payload: string;
26
- metadata?: AgentFinish;
27
- resolved?: ResolvedFile[];
28
- };
29
- errors?: Array<{
30
- message: string;
31
- }>;
32
- };
33
- type SessionConfig = {
34
- query: string;
35
- model?: string;
36
- repoRoot: string;
37
- excludes?: string[];
38
- includes?: string[];
39
- debug?: boolean;
40
- provider?: unknown;
41
- apiKey?: string;
42
- };
43
-
44
- export type { AgentFinish, AgentRunResult, ChatMessage, FinishFileSpec, ResolvedFile, SessionConfig, ToolCall, ToolName };
@@ -1,14 +0,0 @@
1
- import { WarpGrepProvider } from './providers/types.js';
2
-
3
- type WarpGrepConfig = {
4
- repoRoot: string;
5
- provider?: WarpGrepProvider;
6
- excludes?: string[];
7
- includes?: string[];
8
- debug?: boolean;
9
- apiKey?: string;
10
- description?: string;
11
- };
12
- declare function createMorphWarpGrepTool(config: WarpGrepConfig): any;
13
-
14
- export { type WarpGrepConfig, createMorphWarpGrepTool };
@@ -1,11 +0,0 @@
1
- export { AgentFinish, AgentRunResult, ChatMessage, FinishFileSpec, ResolvedFile, SessionConfig, ToolCall, ToolName } from './agent/types.js';
2
- export { AGENT_CONFIG, DEFAULT_EXCLUDES, DEFAULT_MODEL } from './agent/config.js';
3
- export { runWarpGrep } from './agent/runner.js';
4
- export { AnalyseEntry, GrepResult, ReadResult, WarpGrepProvider } from './providers/types.js';
5
- export { LocalRipgrepProvider } from './providers/local.js';
6
- export { CommandExecProvider } from './providers/command.js';
7
- export { createMorphWarpGrepTool as createOpenAIWarpGrepTool } from './openai.js';
8
- export { createMorphWarpGrepTool as createAnthropicWarpGrepTool } from './anthropic.js';
9
- export { createMorphWarpGrepTool as createVercelWarpGrepTool } from './vercel.js';
10
- import 'openai/resources/chat/completions';
11
- import 'ai';
@@ -1,33 +0,0 @@
1
- import { ChatMessage } from './agent/types.js';
2
- import { WarpGrepProvider } from './providers/types.js';
3
- import { ChatCompletionTool } from 'openai/resources/chat/completions';
4
-
5
- type WarpGrepConfig = {
6
- repoRoot: string;
7
- provider?: WarpGrepProvider;
8
- excludes?: string[];
9
- includes?: string[];
10
- debug?: boolean;
11
- apiKey?: string;
12
- description?: string;
13
- };
14
- declare function createMorphWarpGrepTool(config: WarpGrepConfig): ChatCompletionTool & {
15
- execute: (input: unknown) => Promise<{
16
- success: boolean;
17
- error: string;
18
- messages: ChatMessage[];
19
- contexts?: undefined;
20
- summary?: undefined;
21
- } | {
22
- success: boolean;
23
- contexts: {
24
- file: any;
25
- content: any;
26
- }[];
27
- summary: string;
28
- error?: undefined;
29
- messages?: undefined;
30
- }>;
31
- };
32
-
33
- export { type WarpGrepConfig, createMorphWarpGrepTool };
@@ -1,48 +0,0 @@
1
- import { WarpGrepProvider, GrepResult, ReadResult, AnalyseEntry } from './types.js';
2
-
3
- type ExecResult = {
4
- stdout: string;
5
- stderr: string;
6
- exitCode: number;
7
- };
8
- declare class CommandExecProvider implements WarpGrepProvider {
9
- private readonly opts;
10
- constructor(opts: {
11
- run: (cmd: string, args: string[], options?: {
12
- cwd?: string;
13
- env?: Record<string, string>;
14
- }) => Promise<ExecResult>;
15
- pathMap?: (localPath: string) => string;
16
- cwd?: string;
17
- env?: Record<string, string>;
18
- readCommand?: (remotePath: string, start?: number, end?: number) => {
19
- cmd: string;
20
- args: string[];
21
- };
22
- excludes?: string[];
23
- });
24
- private map;
25
- grep(params: {
26
- pattern: string;
27
- path: string;
28
- }): Promise<GrepResult>;
29
- glob(params: {
30
- pattern: string;
31
- path: string;
32
- }): Promise<{
33
- files: string[];
34
- }>;
35
- read(params: {
36
- path: string;
37
- start?: number;
38
- end?: number;
39
- }): Promise<ReadResult>;
40
- analyse(params: {
41
- path: string;
42
- pattern?: string | null;
43
- maxResults?: number;
44
- maxDepth?: number;
45
- }): Promise<AnalyseEntry[]>;
46
- }
47
-
48
- export { CommandExecProvider };
@@ -1,30 +0,0 @@
1
- import { WarpGrepProvider, GrepResult, ReadResult, AnalyseEntry } from './types.js';
2
-
3
- declare class LocalRipgrepProvider implements WarpGrepProvider {
4
- private readonly repoRoot;
5
- private readonly excludes;
6
- constructor(repoRoot: string, excludes?: string[]);
7
- grep(params: {
8
- pattern: string;
9
- path: string;
10
- }): Promise<GrepResult>;
11
- glob(params: {
12
- pattern: string;
13
- path: string;
14
- }): Promise<{
15
- files: string[];
16
- }>;
17
- read(params: {
18
- path: string;
19
- start?: number;
20
- end?: number;
21
- }): Promise<ReadResult>;
22
- analyse(params: {
23
- path: string;
24
- pattern?: string | null;
25
- maxResults?: number;
26
- maxDepth?: number;
27
- }): Promise<AnalyseEntry[]>;
28
- }
29
-
30
- export { LocalRipgrepProvider };
@@ -1,49 +0,0 @@
1
- type GrepResult = {
2
- lines: string[];
3
- };
4
- type ReadResult = {
5
- lines: string[];
6
- };
7
- type AnalyseEntry = {
8
- name: string;
9
- path: string;
10
- type: 'file' | 'dir';
11
- depth: number;
12
- };
13
- interface WarpGrepProvider {
14
- /**
15
- * Run regex grep
16
- */
17
- grep(params: {
18
- pattern: string;
19
- path: string;
20
- }): Promise<GrepResult>;
21
- /**
22
- * List files by glob pattern (optional; may fallback internally)
23
- */
24
- glob?(params: {
25
- pattern: string;
26
- path: string;
27
- }): Promise<{
28
- files: string[];
29
- }>;
30
- /**
31
- * Read lines from a file, optionally a range (1-based inclusive)
32
- */
33
- read(params: {
34
- path: string;
35
- start?: number;
36
- end?: number;
37
- }): Promise<ReadResult>;
38
- /**
39
- * Provide a lightweight directory overview for guidance
40
- */
41
- analyse(params: {
42
- path: string;
43
- pattern?: string | null;
44
- maxResults?: number;
45
- maxDepth?: number;
46
- }): Promise<AnalyseEntry[]>;
47
- }
48
-
49
- export type { AnalyseEntry, GrepResult, ReadResult, WarpGrepProvider };
@@ -1,10 +0,0 @@
1
- import { WarpGrepProvider } from '../providers/types.js';
2
-
3
- declare function toolAnalyse(provider: WarpGrepProvider, args: {
4
- path: string;
5
- pattern?: string | null;
6
- maxResults?: number;
7
- maxDepth?: number;
8
- }): Promise<string>;
9
-
10
- export { toolAnalyse };
@@ -1,10 +0,0 @@
1
- import { FinishFileSpec } from '../agent/types.js';
2
-
3
- declare function normalizeFinishFiles(files: FinishFileSpec[]): FinishFileSpec[];
4
- declare function readFinishFiles(repoRoot: string, files: FinishFileSpec[], reader: (path: string, start: number, end: number) => Promise<string[]>): Promise<{
5
- path: string;
6
- ranges: Array<[number, number]>;
7
- content: string;
8
- }[]>;
9
-
10
- export { normalizeFinishFiles, readFinishFiles };
@@ -1,8 +0,0 @@
1
- import { WarpGrepProvider } from '../providers/types.js';
2
-
3
- declare function toolGrep(provider: WarpGrepProvider, args: {
4
- pattern: string;
5
- path: string;
6
- }): Promise<string>;
7
-
8
- export { toolGrep };
@@ -1,9 +0,0 @@
1
- import { WarpGrepProvider } from '../providers/types.js';
2
-
3
- declare function toolRead(provider: WarpGrepProvider, args: {
4
- path: string;
5
- start?: number;
6
- end?: number;
7
- }): Promise<string>;
8
-
9
- export { toolRead };
@@ -1,3 +0,0 @@
1
- declare function readAllLines(filePath: string): Promise<string[]>;
2
-
3
- export { readAllLines };
@@ -1,4 +0,0 @@
1
- declare function section(name: string, content: string): string;
2
- declare function joinSections(sections: string[]): string;
3
-
4
- export { joinSections, section };
@@ -1,7 +0,0 @@
1
- declare function resolveUnderRepo(repoRoot: string, targetPath: string): string;
2
- declare function ensureWithinRepo(repoRoot: string, absTarget: string): void;
3
- declare function toRepoRelative(repoRoot: string, absPath: string): string;
4
- declare function isSymlink(p: string): boolean;
5
- declare function isTextualFile(filePath: string, maxBytes?: number): boolean;
6
-
7
- export { ensureWithinRepo, isSymlink, isTextualFile, resolveUnderRepo, toRepoRelative };
@@ -1,11 +0,0 @@
1
- type ExecResult = {
2
- stdout: string;
3
- stderr: string;
4
- exitCode: number;
5
- };
6
- declare function runRipgrep(args: string[], opts?: {
7
- cwd?: string;
8
- env?: NodeJS.ProcessEnv;
9
- }): Promise<ExecResult>;
10
-
11
- export { type ExecResult, runRipgrep };
@@ -1,33 +0,0 @@
1
- import * as ai from 'ai';
2
- import { ChatMessage } from './agent/types.js';
3
- import { WarpGrepProvider } from './providers/types.js';
4
-
5
- type WarpGrepConfig = {
6
- repoRoot: string;
7
- provider?: WarpGrepProvider;
8
- excludes?: string[];
9
- includes?: string[];
10
- debug?: boolean;
11
- apiKey?: string;
12
- description?: string;
13
- };
14
- declare function createMorphWarpGrepTool(config: WarpGrepConfig): ai.Tool<{
15
- query: string;
16
- }, {
17
- success: boolean;
18
- error: string;
19
- messages: ChatMessage[];
20
- contexts?: undefined;
21
- summary?: undefined;
22
- } | {
23
- success: boolean;
24
- contexts: {
25
- file: any;
26
- content: any;
27
- }[];
28
- summary: string;
29
- error?: undefined;
30
- messages?: undefined;
31
- }>;
32
-
33
- export { type WarpGrepConfig, createMorphWarpGrepTool };
@@ -1,69 +0,0 @@
1
- import * as ai from 'ai';
2
- import { EditChanges, EditFileConfig } from './tools/fastapply/types.js';
3
-
4
- declare const editFileTool: ai.Tool<{
5
- target_filepath: string;
6
- instructions: string;
7
- code_edit: string;
8
- }, {
9
- success: boolean;
10
- filepath: string;
11
- changes: EditChanges;
12
- udiff: string | undefined;
13
- }>;
14
- /**
15
- * Get the system prompt for edit_file usage
16
- *
17
- * Add this to your system message to guide the model on using edit_file properly.
18
- *
19
- * @example
20
- * ```ts
21
- * const result = await generateText({
22
- * model: anthropic('claude-sonnet-4-5-20250929'),
23
- * system: getSystemPrompt(),
24
- * tools: { editFile: editFileTool },
25
- * prompt: "Fix bugs"
26
- * });
27
- * ```
28
- */
29
- declare function getSystemPrompt(): string;
30
- /**
31
- * Create a custom edit_file tool with configuration
32
- *
33
- * @param config - Configuration options
34
- * @returns Vercel AI SDK tool with custom config
35
- *
36
- * @example
37
- * ```ts
38
- * const customEditTool = createEditFileTool({
39
- * baseDir: './src',
40
- * generateUdiff: true,
41
- * description: 'Custom tool description for your use case'
42
- * });
43
- *
44
- * const result = await generateText({
45
- * model: anthropic('claude-sonnet-4-5-20250929'),
46
- * tools: { editFile: customEditTool },
47
- * prompt: "Fix bugs"
48
- * });
49
- * ```
50
- */
51
- declare function createEditFileTool(config?: EditFileConfig): ai.Tool<{
52
- target_filepath: string;
53
- instructions: string;
54
- code_edit: string;
55
- }, {
56
- success: boolean;
57
- filepath: string;
58
- changes: EditChanges;
59
- udiff: string | undefined;
60
- }>;
61
-
62
- declare const vercel_createEditFileTool: typeof createEditFileTool;
63
- declare const vercel_editFileTool: typeof editFileTool;
64
- declare const vercel_getSystemPrompt: typeof getSystemPrompt;
65
- declare namespace vercel {
66
- export { vercel_createEditFileTool as createEditFileTool, editFileTool as default, vercel_editFileTool as editFileTool, vercel_getSystemPrompt as getSystemPrompt };
67
- }
68
-
69
- export { createEditFileTool as c, editFileTool as e, getSystemPrompt as g, vercel as v };