@morphllm/morphsdk 0.2.52 → 0.2.54
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-UU6XCZG3.js → chunk-4HOUN5TW.js} +6 -5
- package/dist/chunk-4HOUN5TW.js.map +1 -0
- package/dist/{chunk-G4AWE5A2.js → chunk-5QIWYEHJ.js} +2 -2
- package/dist/{chunk-64PMM72R.js → chunk-CKTA4AXM.js} +58 -2
- package/dist/chunk-CKTA4AXM.js.map +1 -0
- package/dist/{chunk-MZT6HVGD.js → chunk-D5ZSGQT4.js} +5 -3
- package/dist/{chunk-MZT6HVGD.js.map → chunk-D5ZSGQT4.js.map} +1 -1
- package/dist/{chunk-YR53PPVM.js → chunk-FB3E5BRY.js} +6 -5
- package/dist/chunk-FB3E5BRY.js.map +1 -0
- package/dist/{chunk-L5BMGLLQ.js → chunk-IFVROB4L.js} +21 -14
- package/dist/{chunk-L5BMGLLQ.js.map → chunk-IFVROB4L.js.map} +1 -1
- package/dist/{chunk-3FTAIJBH.js → chunk-IUG2FHNN.js} +2 -2
- package/dist/{chunk-PZDR5ZZ2.js → chunk-KVMZPOUT.js} +9 -9
- package/dist/{chunk-FYQUSDOE.js → chunk-PYTBBWL6.js} +3 -3
- package/dist/{chunk-UIZT3KVJ.js → chunk-QZNGKOCZ.js} +2 -2
- package/dist/{client-BGctTHu9.d.ts → client-CFoR--IU.d.ts} +1 -1
- package/dist/client.cjs +67 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +15 -15
- package/dist/{core-DxiUwyBe.d.ts → core-CpkYEi_T.d.ts} +2 -0
- package/dist/index.cjs +71 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +19 -17
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +2 -2
- package/dist/tools/fastapply/core.cjs +57 -0
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.d.ts +50 -2
- package/dist/tools/fastapply/core.js +3 -1
- package/dist/tools/fastapply/index.cjs +34 -0
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.d.ts +2 -2
- package/dist/tools/fastapply/index.js +6 -4
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +2 -2
- package/dist/tools/fastapply/types.cjs.map +1 -1
- package/dist/tools/fastapply/types.d.ts +47 -1
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +2 -2
- package/dist/tools/index.cjs +34 -0
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +6 -4
- package/dist/tools/warp_grep/agent/runner.cjs +8 -1
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +6 -6
- package/dist/tools/warp_grep/anthropic.cjs +12 -4
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +2 -2
- package/dist/tools/warp_grep/anthropic.js +8 -8
- package/dist/tools/warp_grep/index.cjs +14 -4
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +7 -3
- package/dist/tools/warp_grep/index.js +12 -10
- package/dist/tools/warp_grep/openai.cjs +12 -4
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +2 -2
- package/dist/tools/warp_grep/openai.js +8 -8
- package/dist/tools/warp_grep/vercel.cjs +9 -2
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +2 -2
- package/dist/tools/warp_grep/vercel.js +8 -8
- package/package.json +1 -1
- package/dist/chunk-64PMM72R.js.map +0 -1
- package/dist/chunk-UU6XCZG3.js.map +0 -1
- package/dist/chunk-YR53PPVM.js.map +0 -1
- /package/dist/{chunk-G4AWE5A2.js.map → chunk-5QIWYEHJ.js.map} +0 -0
- /package/dist/{chunk-3FTAIJBH.js.map → chunk-IUG2FHNN.js.map} +0 -0
- /package/dist/{chunk-PZDR5ZZ2.js.map → chunk-KVMZPOUT.js.map} +0 -0
- /package/dist/{chunk-FYQUSDOE.js.map → chunk-PYTBBWL6.js.map} +0 -0
- /package/dist/{chunk-UIZT3KVJ.js.map → chunk-QZNGKOCZ.js.map} +0 -0
package/dist/client.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import './tools/utils/resilience.js';
|
|
|
2
2
|
import './tools/fastapply/core.js';
|
|
3
3
|
import './tools/codebase_search/core.js';
|
|
4
4
|
import './tools/browser/core.js';
|
|
5
|
-
import './core-
|
|
5
|
+
import './core-CpkYEi_T.js';
|
|
6
6
|
import './git/client.js';
|
|
7
7
|
import './modelrouter/core.js';
|
|
8
|
-
export { M as MorphClient, a as MorphClientConfig } from './client-
|
|
8
|
+
export { M as MorphClient, a as MorphClientConfig } from './client-CFoR--IU.js';
|
|
9
9
|
import './tools/fastapply/types.js';
|
|
10
10
|
import './tools/codebase_search/types.js';
|
|
11
11
|
import './tools/browser/types.js';
|
package/dist/client.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KVMZPOUT.js";
|
|
4
|
+
import "./chunk-FB3E5BRY.js";
|
|
5
|
+
import "./chunk-4HOUN5TW.js";
|
|
6
|
+
import "./chunk-PYTBBWL6.js";
|
|
7
|
+
import "./chunk-D5ZSGQT4.js";
|
|
8
|
+
import "./chunk-IFVROB4L.js";
|
|
9
|
+
import "./chunk-EK7OQPWD.js";
|
|
10
|
+
import "./chunk-HQO45BAJ.js";
|
|
11
11
|
import "./chunk-LVPVVLTI.js";
|
|
12
12
|
import "./chunk-WETRQJGU.js";
|
|
13
|
-
import "./chunk-HQO45BAJ.js";
|
|
14
13
|
import "./chunk-ZJIIICRA.js";
|
|
15
14
|
import "./chunk-G2RSY56Q.js";
|
|
16
15
|
import "./chunk-SMGZ6A64.js";
|
|
17
16
|
import "./chunk-TPP2UGQP.js";
|
|
18
|
-
import "./chunk-TJIUA27P.js";
|
|
19
17
|
import "./chunk-73RQWOQC.js";
|
|
20
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-TJIUA27P.js";
|
|
19
|
+
import "./chunk-TICMYDII.js";
|
|
20
|
+
import "./chunk-NDZO5IPV.js";
|
|
21
21
|
import "./chunk-UBX7QYBD.js";
|
|
22
22
|
import "./chunk-GJU7UOFL.js";
|
|
23
23
|
import "./chunk-76DJEQEP.js";
|
|
24
24
|
import "./chunk-WM77HRKO.js";
|
|
25
25
|
import "./chunk-YQMPVJ2L.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-IUG2FHNN.js";
|
|
27
|
+
import "./chunk-5QIWYEHJ.js";
|
|
28
|
+
import "./chunk-QZNGKOCZ.js";
|
|
29
|
+
import "./chunk-CKTA4AXM.js";
|
|
30
30
|
import "./chunk-63WE2C5R.js";
|
|
31
31
|
import "./chunk-LVY5LPEX.js";
|
|
32
32
|
import "./chunk-SQN4DUQS.js";
|
|
@@ -69,6 +69,8 @@ interface WarpGrepToolConfig {
|
|
|
69
69
|
debug?: boolean;
|
|
70
70
|
/** Morph API key (defaults to MORPH_API_KEY env var) */
|
|
71
71
|
apiKey?: string;
|
|
72
|
+
/** Custom tool name (defaults to 'warpgrep_codebase_search') */
|
|
73
|
+
name?: string;
|
|
72
74
|
/** Custom tool description */
|
|
73
75
|
description?: string;
|
|
74
76
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,8 @@ __export(index_exports, {
|
|
|
44
44
|
OpenAIToolFactory: () => OpenAIToolFactory,
|
|
45
45
|
RawRouter: () => RawRouter,
|
|
46
46
|
VercelToolFactory: () => VercelToolFactory,
|
|
47
|
-
WarpGrepClient: () => WarpGrepClient
|
|
47
|
+
WarpGrepClient: () => WarpGrepClient,
|
|
48
|
+
applyEdit: () => applyEdit
|
|
48
49
|
});
|
|
49
50
|
module.exports = __toCommonJS(index_exports);
|
|
50
51
|
|
|
@@ -159,6 +160,29 @@ var FastApplyClient = class {
|
|
|
159
160
|
async execute(input, overrides) {
|
|
160
161
|
return executeEditFile(input, { ...this.config, ...overrides });
|
|
161
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Apply an edit to code directly without file I/O
|
|
165
|
+
*
|
|
166
|
+
* Useful for sandbox environments or when you manage your own file system.
|
|
167
|
+
* Compatible with the earlier OpenAI client API contract.
|
|
168
|
+
*
|
|
169
|
+
* @param input - Code and edit parameters
|
|
170
|
+
* @param overrides - Optional config overrides for this operation
|
|
171
|
+
* @returns Result with merged code
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const result = await client.applyEdit({
|
|
176
|
+
* originalCode: 'function hello() { return "world"; }',
|
|
177
|
+
* codeEdit: 'function hello() { return "universe"; }',
|
|
178
|
+
* instructions: 'Change return value'
|
|
179
|
+
* });
|
|
180
|
+
* console.log(result.mergedCode);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
async applyEdit(input, overrides) {
|
|
184
|
+
return applyEdit(input, { ...this.config, ...overrides });
|
|
185
|
+
}
|
|
162
186
|
};
|
|
163
187
|
function generateUdiff(original, modified, filepath) {
|
|
164
188
|
return (0, import_diff.createTwoFilesPatch)(
|
|
@@ -288,6 +312,38 @@ async function executeEditFile(input, config = {}) {
|
|
|
288
312
|
};
|
|
289
313
|
}
|
|
290
314
|
}
|
|
315
|
+
async function applyEdit(input, config = {}) {
|
|
316
|
+
const debug = config.debug || false;
|
|
317
|
+
const filepath = input.filepath || "file";
|
|
318
|
+
try {
|
|
319
|
+
if (debug) {
|
|
320
|
+
console.log(`[FastApply] Applying edit to code (${input.originalCode.length} chars)`);
|
|
321
|
+
}
|
|
322
|
+
const mergedCode = await callMorphAPI(
|
|
323
|
+
input.originalCode,
|
|
324
|
+
input.codeEdit,
|
|
325
|
+
input.instructions,
|
|
326
|
+
filepath,
|
|
327
|
+
config
|
|
328
|
+
);
|
|
329
|
+
const udiff = config.generateUdiff !== false ? generateUdiff(input.originalCode, mergedCode, filepath) : void 0;
|
|
330
|
+
const changes = countChanges(input.originalCode, mergedCode);
|
|
331
|
+
return {
|
|
332
|
+
success: true,
|
|
333
|
+
mergedCode,
|
|
334
|
+
udiff,
|
|
335
|
+
changes
|
|
336
|
+
};
|
|
337
|
+
} catch (error) {
|
|
338
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
339
|
+
if (debug) console.error(`[FastApply] Error: ${errorMessage}`);
|
|
340
|
+
return {
|
|
341
|
+
success: false,
|
|
342
|
+
changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },
|
|
343
|
+
error: errorMessage
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
291
347
|
|
|
292
348
|
// tools/codebase_search/core.ts
|
|
293
349
|
var CodebaseSearchClient = class {
|
|
@@ -1722,6 +1778,7 @@ async function runWarpGrep(config) {
|
|
|
1722
1778
|
parts.push(`- ${f.path}: ${ranges}`);
|
|
1723
1779
|
}
|
|
1724
1780
|
const payload = parts.join("\n");
|
|
1781
|
+
const fileReadErrors = [];
|
|
1725
1782
|
const resolved = await readFinishFiles(
|
|
1726
1783
|
repoRoot,
|
|
1727
1784
|
finishMeta.files,
|
|
@@ -1732,11 +1789,17 @@ async function runWarpGrep(config) {
|
|
|
1732
1789
|
const idx = l.indexOf("|");
|
|
1733
1790
|
return idx >= 0 ? l.slice(idx + 1) : l;
|
|
1734
1791
|
});
|
|
1735
|
-
} catch {
|
|
1792
|
+
} catch (err) {
|
|
1793
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
1794
|
+
fileReadErrors.push({ path: p, error: errorMsg });
|
|
1795
|
+
console.error(`[warp_grep] Failed to read file: ${p} - ${errorMsg}`);
|
|
1736
1796
|
return [`[couldn't find: ${p}]`];
|
|
1737
1797
|
}
|
|
1738
1798
|
}
|
|
1739
1799
|
);
|
|
1800
|
+
if (fileReadErrors.length > 0) {
|
|
1801
|
+
errors.push(...fileReadErrors.map((e) => ({ message: `File read error: ${e.path} - ${e.error}` })));
|
|
1802
|
+
}
|
|
1740
1803
|
return {
|
|
1741
1804
|
terminationReason: "completed",
|
|
1742
1805
|
messages,
|
|
@@ -2826,7 +2889,8 @@ var RawRouter = class extends BaseRouter {
|
|
|
2826
2889
|
};
|
|
2827
2890
|
|
|
2828
2891
|
// tools/warp_grep/prompts.ts
|
|
2829
|
-
var
|
|
2892
|
+
var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
|
|
2893
|
+
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.';
|
|
2830
2894
|
|
|
2831
2895
|
// tools/warp_grep/openai.ts
|
|
2832
2896
|
var TOOL_PARAMETERS = {
|
|
@@ -2862,7 +2926,7 @@ function createMorphWarpGrepTool(config) {
|
|
|
2862
2926
|
const tool4 = {
|
|
2863
2927
|
type: "function",
|
|
2864
2928
|
function: {
|
|
2865
|
-
name:
|
|
2929
|
+
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
2866
2930
|
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
2867
2931
|
parameters: TOOL_PARAMETERS
|
|
2868
2932
|
}
|
|
@@ -3169,7 +3233,7 @@ async function execute3(input, config) {
|
|
|
3169
3233
|
}
|
|
3170
3234
|
function createMorphWarpGrepTool2(config) {
|
|
3171
3235
|
const tool4 = {
|
|
3172
|
-
name:
|
|
3236
|
+
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
3173
3237
|
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
3174
3238
|
input_schema: INPUT_SCHEMA
|
|
3175
3239
|
};
|
|
@@ -3715,6 +3779,7 @@ var CommandExecProvider = class {
|
|
|
3715
3779
|
OpenAIToolFactory,
|
|
3716
3780
|
RawRouter,
|
|
3717
3781
|
VercelToolFactory,
|
|
3718
|
-
WarpGrepClient
|
|
3782
|
+
WarpGrepClient,
|
|
3783
|
+
applyEdit
|
|
3719
3784
|
});
|
|
3720
3785
|
//# sourceMappingURL=index.cjs.map
|