@morphllm/morphsdk 0.2.51 → 0.2.53
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-2GZMA5OY.js → chunk-2XNF3W7C.js} +3 -3
- package/dist/{chunk-W3QUAOGV.js → chunk-563REN2T.js} +3 -3
- package/dist/{chunk-G4AWE5A2.js → chunk-5QIWYEHJ.js} +2 -2
- package/dist/{chunk-X3WAPQSV.js → chunk-C4IXE2RM.js} +3 -3
- package/dist/{chunk-64PMM72R.js → chunk-CKTA4AXM.js} +58 -2
- package/dist/chunk-CKTA4AXM.js.map +1 -0
- package/dist/{chunk-HBH4FWIZ.js → chunk-IFVROB4L.js} +9 -2
- package/dist/{chunk-HBH4FWIZ.js.map → chunk-IFVROB4L.js.map} +1 -1
- package/dist/{chunk-3FTAIJBH.js → chunk-IUG2FHNN.js} +2 -2
- package/dist/{chunk-KMWLHINT.js → chunk-KYVR4QCG.js} +3 -3
- package/dist/{chunk-KMWLHINT.js.map → chunk-KYVR4QCG.js.map} +1 -1
- package/dist/{chunk-3IASMZXX.js → chunk-NOQCKVY3.js} +9 -9
- package/dist/{chunk-UIZT3KVJ.js → chunk-QZNGKOCZ.js} +2 -2
- package/dist/client.cjs +64 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +10 -10
- package/dist/index.cjs +68 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +14 -12
- 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 +1 -1
- package/dist/tools/warp_grep/anthropic.cjs +9 -2
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +3 -3
- package/dist/tools/warp_grep/index.cjs +9 -2
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +5 -5
- package/dist/tools/warp_grep/openai.cjs +9 -2
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +3 -3
- 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.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-64PMM72R.js.map +0 -1
- /package/dist/{chunk-2GZMA5OY.js.map → chunk-2XNF3W7C.js.map} +0 -0
- /package/dist/{chunk-W3QUAOGV.js.map → chunk-563REN2T.js.map} +0 -0
- /package/dist/{chunk-G4AWE5A2.js.map → chunk-5QIWYEHJ.js.map} +0 -0
- /package/dist/{chunk-X3WAPQSV.js.map → chunk-C4IXE2RM.js.map} +0 -0
- /package/dist/{chunk-3FTAIJBH.js.map → chunk-IUG2FHNN.js.map} +0 -0
- /package/dist/{chunk-3IASMZXX.js.map → chunk-NOQCKVY3.js.map} +0 -0
- /package/dist/{chunk-UIZT3KVJ.js.map → chunk-QZNGKOCZ.js.map} +0 -0
package/dist/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-NOQCKVY3.js";
|
|
4
|
+
import "./chunk-C4IXE2RM.js";
|
|
5
|
+
import "./chunk-2XNF3W7C.js";
|
|
6
|
+
import "./chunk-563REN2T.js";
|
|
7
|
+
import "./chunk-KYVR4QCG.js";
|
|
8
|
+
import "./chunk-IFVROB4L.js";
|
|
9
9
|
import "./chunk-EK7OQPWD.js";
|
|
10
10
|
import "./chunk-HQO45BAJ.js";
|
|
11
11
|
import "./chunk-LVPVVLTI.js";
|
|
@@ -23,10 +23,10 @@ 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";
|
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,7 @@ var RawRouter = class extends BaseRouter {
|
|
|
2826
2889
|
};
|
|
2827
2890
|
|
|
2828
2891
|
// tools/warp_grep/prompts.ts
|
|
2829
|
-
var WARP_GREP_DESCRIPTION = "
|
|
2892
|
+
var WARP_GREP_DESCRIPTION = "ALWAYS use Warp Grep when you need to search a large chunk of code. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. 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 ";
|
|
2830
2893
|
|
|
2831
2894
|
// tools/warp_grep/openai.ts
|
|
2832
2895
|
var TOOL_PARAMETERS = {
|
|
@@ -3715,6 +3778,7 @@ var CommandExecProvider = class {
|
|
|
3715
3778
|
OpenAIToolFactory,
|
|
3716
3779
|
RawRouter,
|
|
3717
3780
|
VercelToolFactory,
|
|
3718
|
-
WarpGrepClient
|
|
3781
|
+
WarpGrepClient,
|
|
3782
|
+
applyEdit
|
|
3719
3783
|
});
|
|
3720
3784
|
//# sourceMappingURL=index.cjs.map
|