@morphllm/morphsdk 0.2.40 → 0.2.41

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 (128) hide show
  1. package/dist/anthropic-DpEAqqZF.d.ts +88 -0
  2. package/dist/{chunk-NCVWIW7L.js → chunk-EYHXBQQX.js} +7 -81
  3. package/dist/chunk-EYHXBQQX.js.map +1 -0
  4. package/dist/{chunk-LUI7APXX.js → chunk-FP7INILQ.js} +2 -2
  5. package/dist/{chunk-4WIBODS7.js → chunk-GDR65N2J.js} +1 -1
  6. package/dist/chunk-GDR65N2J.js.map +1 -0
  7. package/dist/{chunk-JSZQVUSE.js → chunk-GGBB2HDM.js} +2 -2
  8. package/dist/{chunk-7MCSSJJA.js → chunk-GU3SULV5.js} +2 -2
  9. package/dist/{chunk-Y2IY7NYY.js → chunk-O5DA5V5S.js} +2 -2
  10. package/dist/{chunk-4A7UBGLS.js → chunk-OUEJ6XEO.js} +2 -2
  11. package/dist/chunk-SQN4DUQS.js +84 -0
  12. package/dist/chunk-SQN4DUQS.js.map +1 -0
  13. package/dist/{chunk-N5654KQR.js → chunk-W3XLPMV3.js} +15 -15
  14. package/dist/{chunk-DIWNR3UP.js → chunk-W7NRFNLI.js} +4 -4
  15. package/dist/{chunk-AG3ICTC5.js → chunk-WM77HRKO.js} +4 -7
  16. package/dist/chunk-WM77HRKO.js.map +1 -0
  17. package/dist/{chunk-WHZQDTM6.js → chunk-ZRLEAPZV.js} +2 -2
  18. package/dist/client.cjs +3 -6
  19. package/dist/client.cjs.map +1 -1
  20. package/dist/client.d.ts +114 -0
  21. package/dist/client.js +5 -4
  22. package/dist/git/client.cjs.map +1 -1
  23. package/dist/git/client.d.ts +275 -0
  24. package/dist/git/client.js +1 -1
  25. package/dist/git/config.d.ts +11 -0
  26. package/dist/git/index.cjs.map +1 -1
  27. package/dist/git/index.d.ts +5 -0
  28. package/dist/git/index.js +1 -1
  29. package/dist/git/types.d.ts +115 -0
  30. package/dist/index.cjs +3 -6
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.ts +14 -0
  33. package/dist/index.js +5 -4
  34. package/dist/modelrouter/core.d.ts +69 -0
  35. package/dist/modelrouter/index.d.ts +2 -0
  36. package/dist/modelrouter/types.d.ts +39 -0
  37. package/dist/openai-BkKsS30n.d.ts +111 -0
  38. package/dist/tools/browser/anthropic.d.ts +51 -0
  39. package/dist/tools/browser/anthropic.js +2 -1
  40. package/dist/tools/browser/anthropic.js.map +1 -1
  41. package/dist/tools/browser/core.d.ts +203 -0
  42. package/dist/tools/browser/core.js +2 -1
  43. package/dist/tools/browser/index.d.ts +5 -0
  44. package/dist/tools/browser/index.js +7 -5
  45. package/dist/tools/browser/live.cjs +112 -0
  46. package/dist/tools/browser/live.cjs.map +1 -0
  47. package/dist/tools/browser/live.d.ts +75 -0
  48. package/dist/tools/browser/live.js +16 -0
  49. package/dist/tools/browser/live.js.map +1 -0
  50. package/dist/tools/browser/openai.d.ts +73 -0
  51. package/dist/tools/browser/openai.js +2 -1
  52. package/dist/tools/browser/openai.js.map +1 -1
  53. package/dist/tools/browser/prompts.d.ts +7 -0
  54. package/dist/tools/browser/types.d.ts +255 -0
  55. package/dist/tools/browser/vercel.d.ts +69 -0
  56. package/dist/tools/browser/vercel.js +2 -1
  57. package/dist/tools/browser/vercel.js.map +1 -1
  58. package/dist/tools/codebase_search/anthropic.cjs +2 -5
  59. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  60. package/dist/tools/codebase_search/anthropic.d.ts +40 -0
  61. package/dist/tools/codebase_search/anthropic.js +2 -2
  62. package/dist/tools/codebase_search/core.cjs +3 -6
  63. package/dist/tools/codebase_search/core.cjs.map +1 -1
  64. package/dist/tools/codebase_search/core.d.ts +40 -0
  65. package/dist/tools/codebase_search/core.js +1 -1
  66. package/dist/tools/codebase_search/index.cjs +2 -5
  67. package/dist/tools/codebase_search/index.cjs.map +1 -1
  68. package/dist/tools/codebase_search/index.d.ts +10 -0
  69. package/dist/tools/codebase_search/index.js +6 -6
  70. package/dist/tools/codebase_search/openai.cjs +2 -5
  71. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  72. package/dist/tools/codebase_search/openai.d.ts +87 -0
  73. package/dist/tools/codebase_search/openai.js +2 -2
  74. package/dist/tools/codebase_search/prompts.d.ts +7 -0
  75. package/dist/tools/codebase_search/types.d.ts +50 -0
  76. package/dist/tools/codebase_search/vercel.cjs +2 -5
  77. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  78. package/dist/tools/codebase_search/vercel.d.ts +65 -0
  79. package/dist/tools/codebase_search/vercel.js +2 -2
  80. package/dist/tools/fastapply/anthropic.d.ts +4 -0
  81. package/dist/tools/fastapply/core.d.ts +41 -0
  82. package/dist/tools/fastapply/index.d.ts +10 -0
  83. package/dist/tools/fastapply/openai.d.ts +4 -0
  84. package/dist/tools/fastapply/prompts.d.ts +7 -0
  85. package/dist/tools/fastapply/types.d.ts +77 -0
  86. package/dist/tools/fastapply/vercel.d.ts +4 -0
  87. package/dist/tools/index.d.ts +10 -0
  88. package/dist/tools/utils/resilience.d.ts +58 -0
  89. package/dist/tools/warp_grep/agent/config.d.ts +8 -0
  90. package/dist/tools/warp_grep/agent/formatter.d.ts +14 -0
  91. package/dist/tools/warp_grep/agent/grep_helpers.d.ts +16 -0
  92. package/dist/tools/warp_grep/agent/parser.d.ts +16 -0
  93. package/dist/tools/warp_grep/agent/prompt.d.ts +4 -0
  94. package/dist/tools/warp_grep/agent/runner.d.ts +10 -0
  95. package/dist/tools/warp_grep/agent/runner.js +6 -6
  96. package/dist/tools/warp_grep/agent/types.d.ts +44 -0
  97. package/dist/tools/warp_grep/anthropic.d.ts +14 -0
  98. package/dist/tools/warp_grep/anthropic.js +7 -7
  99. package/dist/tools/warp_grep/index.d.ts +11 -0
  100. package/dist/tools/warp_grep/index.js +9 -9
  101. package/dist/tools/warp_grep/openai.d.ts +33 -0
  102. package/dist/tools/warp_grep/openai.js +7 -7
  103. package/dist/tools/warp_grep/providers/command.d.ts +48 -0
  104. package/dist/tools/warp_grep/providers/local.d.ts +30 -0
  105. package/dist/tools/warp_grep/providers/types.d.ts +49 -0
  106. package/dist/tools/warp_grep/tools/analyse.d.ts +10 -0
  107. package/dist/tools/warp_grep/tools/finish.d.ts +10 -0
  108. package/dist/tools/warp_grep/tools/grep.d.ts +8 -0
  109. package/dist/tools/warp_grep/tools/read.d.ts +9 -0
  110. package/dist/tools/warp_grep/utils/files.d.ts +3 -0
  111. package/dist/tools/warp_grep/utils/format.d.ts +4 -0
  112. package/dist/tools/warp_grep/utils/paths.d.ts +7 -0
  113. package/dist/tools/warp_grep/utils/ripgrep.d.ts +11 -0
  114. package/dist/tools/warp_grep/vercel.d.ts +33 -0
  115. package/dist/tools/warp_grep/vercel.js +7 -7
  116. package/dist/vercel-B1GZ_g9N.d.ts +69 -0
  117. package/package.json +2 -3
  118. package/dist/chunk-4WIBODS7.js.map +0 -1
  119. package/dist/chunk-AG3ICTC5.js.map +0 -1
  120. package/dist/chunk-NCVWIW7L.js.map +0 -1
  121. /package/dist/{chunk-LUI7APXX.js.map → chunk-FP7INILQ.js.map} +0 -0
  122. /package/dist/{chunk-JSZQVUSE.js.map → chunk-GGBB2HDM.js.map} +0 -0
  123. /package/dist/{chunk-7MCSSJJA.js.map → chunk-GU3SULV5.js.map} +0 -0
  124. /package/dist/{chunk-Y2IY7NYY.js.map → chunk-O5DA5V5S.js.map} +0 -0
  125. /package/dist/{chunk-4A7UBGLS.js.map → chunk-OUEJ6XEO.js.map} +0 -0
  126. /package/dist/{chunk-N5654KQR.js.map → chunk-W3XLPMV3.js.map} +0 -0
  127. /package/dist/{chunk-DIWNR3UP.js.map → chunk-W7NRFNLI.js.map} +0 -0
  128. /package/dist/{chunk-WHZQDTM6.js.map → chunk-ZRLEAPZV.js.map} +0 -0
@@ -0,0 +1,10 @@
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';
@@ -0,0 +1,58 @@
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 };
@@ -0,0 +1,8 @@
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 };
@@ -0,0 +1,14 @@
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 };
@@ -0,0 +1,16 @@
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 };
@@ -0,0 +1,16 @@
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 };
@@ -0,0 +1,4 @@
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 };
@@ -0,0 +1,10 @@
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,14 +1,14 @@
1
1
  import {
2
2
  runWarpGrep
3
- } from "../../../chunk-N5654KQR.js";
4
- import "../../../chunk-AFEPUNAO.js";
5
- import "../../../chunk-TICMYDII.js";
6
- import "../../../chunk-NDZO5IPV.js";
3
+ } from "../../../chunk-W3XLPMV3.js";
4
+ import "../../../chunk-EK7OQPWD.js";
5
+ import "../../../chunk-Z2FBMSNE.js";
7
6
  import "../../../chunk-GTOXMAF2.js";
8
7
  import "../../../chunk-HKZB23U7.js";
9
8
  import "../../../chunk-73RQWOQC.js";
10
- import "../../../chunk-EK7OQPWD.js";
11
- import "../../../chunk-Z2FBMSNE.js";
9
+ import "../../../chunk-AFEPUNAO.js";
10
+ import "../../../chunk-TICMYDII.js";
11
+ import "../../../chunk-NDZO5IPV.js";
12
12
  import "../../../chunk-4VWJFZVS.js";
13
13
  import "../../../chunk-PZ5AY32C.js";
14
14
  export {
@@ -0,0 +1,44 @@
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 };
@@ -0,0 +1,14 @@
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,19 +1,19 @@
1
1
  import {
2
2
  createMorphWarpGrepTool
3
- } from "../../chunk-JSZQVUSE.js";
4
- import "../../chunk-N5654KQR.js";
3
+ } from "../../chunk-GGBB2HDM.js";
4
+ import "../../chunk-W3XLPMV3.js";
5
+ import "../../chunk-EK7OQPWD.js";
6
+ import "../../chunk-Z2FBMSNE.js";
7
+ import "../../chunk-GTOXMAF2.js";
8
+ import "../../chunk-HKZB23U7.js";
5
9
  import "../../chunk-UYBIKZPM.js";
6
10
  import "../../chunk-G2RSY56Q.js";
7
11
  import "../../chunk-SMGZ6A64.js";
8
12
  import "../../chunk-RSLIOCOE.js";
13
+ import "../../chunk-73RQWOQC.js";
9
14
  import "../../chunk-AFEPUNAO.js";
10
15
  import "../../chunk-TICMYDII.js";
11
16
  import "../../chunk-NDZO5IPV.js";
12
- import "../../chunk-GTOXMAF2.js";
13
- import "../../chunk-HKZB23U7.js";
14
- import "../../chunk-73RQWOQC.js";
15
- import "../../chunk-EK7OQPWD.js";
16
- import "../../chunk-Z2FBMSNE.js";
17
17
  import "../../chunk-4VWJFZVS.js";
18
18
  import "../../chunk-PZ5AY32C.js";
19
19
  export {
@@ -0,0 +1,11 @@
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';
@@ -4,22 +4,27 @@ import {
4
4
  } from "../../chunk-VBBJGWHY.js";
5
5
  import {
6
6
  createMorphWarpGrepTool
7
- } from "../../chunk-JSZQVUSE.js";
7
+ } from "../../chunk-GGBB2HDM.js";
8
8
  import {
9
9
  createMorphWarpGrepTool as createMorphWarpGrepTool2
10
- } from "../../chunk-7MCSSJJA.js";
10
+ } from "../../chunk-GU3SULV5.js";
11
11
  import {
12
12
  createMorphWarpGrepTool as createMorphWarpGrepTool3
13
- } from "../../chunk-LUI7APXX.js";
13
+ } from "../../chunk-FP7INILQ.js";
14
14
  import {
15
15
  runWarpGrep
16
- } from "../../chunk-N5654KQR.js";
16
+ } from "../../chunk-W3XLPMV3.js";
17
+ import "../../chunk-EK7OQPWD.js";
18
+ import "../../chunk-Z2FBMSNE.js";
19
+ import "../../chunk-GTOXMAF2.js";
20
+ import "../../chunk-HKZB23U7.js";
17
21
  import {
18
22
  LocalRipgrepProvider
19
23
  } from "../../chunk-UYBIKZPM.js";
20
24
  import "../../chunk-G2RSY56Q.js";
21
25
  import "../../chunk-SMGZ6A64.js";
22
26
  import "../../chunk-RSLIOCOE.js";
27
+ import "../../chunk-73RQWOQC.js";
23
28
  import {
24
29
  AGENT_CONFIG,
25
30
  DEFAULT_EXCLUDES,
@@ -27,11 +32,6 @@ import {
27
32
  } from "../../chunk-AFEPUNAO.js";
28
33
  import "../../chunk-TICMYDII.js";
29
34
  import "../../chunk-NDZO5IPV.js";
30
- import "../../chunk-GTOXMAF2.js";
31
- import "../../chunk-HKZB23U7.js";
32
- import "../../chunk-73RQWOQC.js";
33
- import "../../chunk-EK7OQPWD.js";
34
- import "../../chunk-Z2FBMSNE.js";
35
35
  import "../../chunk-4VWJFZVS.js";
36
36
  import "../../chunk-PZ5AY32C.js";
37
37
  export {
@@ -0,0 +1,33 @@
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,19 +1,19 @@
1
1
  import {
2
2
  createMorphWarpGrepTool
3
- } from "../../chunk-7MCSSJJA.js";
4
- import "../../chunk-N5654KQR.js";
3
+ } from "../../chunk-GU3SULV5.js";
4
+ import "../../chunk-W3XLPMV3.js";
5
+ import "../../chunk-EK7OQPWD.js";
6
+ import "../../chunk-Z2FBMSNE.js";
7
+ import "../../chunk-GTOXMAF2.js";
8
+ import "../../chunk-HKZB23U7.js";
5
9
  import "../../chunk-UYBIKZPM.js";
6
10
  import "../../chunk-G2RSY56Q.js";
7
11
  import "../../chunk-SMGZ6A64.js";
8
12
  import "../../chunk-RSLIOCOE.js";
13
+ import "../../chunk-73RQWOQC.js";
9
14
  import "../../chunk-AFEPUNAO.js";
10
15
  import "../../chunk-TICMYDII.js";
11
16
  import "../../chunk-NDZO5IPV.js";
12
- import "../../chunk-GTOXMAF2.js";
13
- import "../../chunk-HKZB23U7.js";
14
- import "../../chunk-73RQWOQC.js";
15
- import "../../chunk-EK7OQPWD.js";
16
- import "../../chunk-Z2FBMSNE.js";
17
17
  import "../../chunk-4VWJFZVS.js";
18
18
  import "../../chunk-PZ5AY32C.js";
19
19
  export {
@@ -0,0 +1,48 @@
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 };
@@ -0,0 +1,30 @@
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 };
@@ -0,0 +1,49 @@
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 };
@@ -0,0 +1,10 @@
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 };
@@ -0,0 +1,10 @@
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 };
@@ -0,0 +1,8 @@
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 };
@@ -0,0 +1,9 @@
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 };
@@ -0,0 +1,3 @@
1
+ declare function readAllLines(filePath: string): Promise<string[]>;
2
+
3
+ export { readAllLines };
@@ -0,0 +1,4 @@
1
+ declare function section(name: string, content: string): string;
2
+ declare function joinSections(sections: string[]): string;
3
+
4
+ export { joinSections, section };
@@ -0,0 +1,7 @@
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 };
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,33 @@
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,19 +1,19 @@
1
1
  import {
2
2
  createMorphWarpGrepTool
3
- } from "../../chunk-LUI7APXX.js";
4
- import "../../chunk-N5654KQR.js";
3
+ } from "../../chunk-FP7INILQ.js";
4
+ import "../../chunk-W3XLPMV3.js";
5
+ import "../../chunk-EK7OQPWD.js";
6
+ import "../../chunk-Z2FBMSNE.js";
7
+ import "../../chunk-GTOXMAF2.js";
8
+ import "../../chunk-HKZB23U7.js";
5
9
  import "../../chunk-UYBIKZPM.js";
6
10
  import "../../chunk-G2RSY56Q.js";
7
11
  import "../../chunk-SMGZ6A64.js";
8
12
  import "../../chunk-RSLIOCOE.js";
13
+ import "../../chunk-73RQWOQC.js";
9
14
  import "../../chunk-AFEPUNAO.js";
10
15
  import "../../chunk-TICMYDII.js";
11
16
  import "../../chunk-NDZO5IPV.js";
12
- import "../../chunk-GTOXMAF2.js";
13
- import "../../chunk-HKZB23U7.js";
14
- import "../../chunk-73RQWOQC.js";
15
- import "../../chunk-EK7OQPWD.js";
16
- import "../../chunk-Z2FBMSNE.js";
17
17
  import "../../chunk-4VWJFZVS.js";
18
18
  import "../../chunk-PZ5AY32C.js";
19
19
  export {