@morphllm/morphsdk 0.2.102 → 0.2.103
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-2MAUPERG.js +129 -0
- package/dist/chunk-2MAUPERG.js.map +1 -0
- package/dist/{chunk-QH4BSXOD.js → chunk-4CZPXV6R.js} +8 -7
- package/dist/chunk-4CZPXV6R.js.map +1 -0
- package/dist/{chunk-AIXF4GQC.js → chunk-AFLEE2PO.js} +2 -2
- package/dist/{chunk-CP4NZGRY.js → chunk-EMMSRY32.js} +3 -3
- package/dist/chunk-EMMSRY32.js.map +1 -0
- package/dist/{chunk-QZNGKOCZ.js → chunk-HDRLLCAD.js} +4 -4
- package/dist/{chunk-BKIM7SNY.js → chunk-I3IN742Q.js} +4 -4
- package/dist/{chunk-7UYDS6OX.js → chunk-KQP6ZPYB.js} +4 -4
- package/dist/{chunk-OTPYEYMZ.js → chunk-MY4OU4ON.js} +2 -2
- package/dist/{chunk-UBX7QYBD.js → chunk-O5DA5V5S.js} +4 -4
- package/dist/{chunk-GJU7UOFL.js → chunk-OUEJ6XEO.js} +4 -4
- package/dist/{chunk-L5WXPMCH.js → chunk-QUIGATZE.js} +2 -2
- package/dist/chunk-TLC3QKE6.js +114 -0
- package/dist/chunk-TLC3QKE6.js.map +1 -0
- package/dist/{chunk-4J6NACK2.js → chunk-Y2OTK5WC.js} +15 -15
- package/dist/{chunk-4KMBU6T3.js → chunk-YJZP5ZL5.js} +4 -4
- package/dist/{chunk-76DJEQEP.js → chunk-ZRLEAPZV.js} +4 -4
- package/dist/{chunk-BGEEES52.js → chunk-ZROQPUCQ.js} +7 -7
- package/dist/client.cjs +2922 -2840
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.js +18 -21
- package/dist/edge.cjs +437 -0
- package/dist/edge.cjs.map +1 -0
- package/dist/edge.d.ts +5 -0
- package/dist/edge.js +25 -0
- package/dist/edge.js.map +1 -0
- package/dist/index.cjs +1981 -1888
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +28 -26
- package/dist/modelrouter/core.cjs +2 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +1 -1
- package/dist/modelrouter/index.cjs +2 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +1 -1
- package/dist/tools/browser/index.js +3 -3
- package/dist/tools/codebase_search/anthropic.js +2 -2
- package/dist/tools/codebase_search/index.js +6 -6
- package/dist/tools/codebase_search/openai.js +2 -2
- package/dist/tools/codebase_search/vercel.js +2 -2
- package/dist/tools/fastapply/anthropic.cjs +109 -40
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +3 -2
- package/dist/tools/fastapply/apply.cjs +227 -0
- package/dist/tools/fastapply/apply.cjs.map +1 -0
- package/dist/tools/fastapply/apply.d.ts +59 -0
- package/dist/tools/fastapply/apply.js +15 -0
- package/dist/tools/fastapply/apply.js.map +1 -0
- package/dist/tools/fastapply/core.cjs +156 -116
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.d.ts +5 -41
- package/dist/tools/fastapply/core.js +6 -2
- package/dist/tools/fastapply/index.cjs +113 -76
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.d.ts +2 -1
- package/dist/tools/fastapply/index.js +11 -9
- package/dist/tools/fastapply/openai.cjs +110 -41
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +3 -2
- package/dist/tools/fastapply/vercel.cjs +110 -41
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +3 -2
- package/dist/tools/index.cjs +113 -76
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +11 -9
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +549 -500
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +5 -9
- package/dist/tools/warp_grep/client.cjs +550 -501
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +4 -8
- package/dist/tools/warp_grep/gemini.cjs +549 -500
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +4 -8
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/harness.js +12 -12
- package/dist/tools/warp_grep/index.cjs +559 -501
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +12 -12
- package/dist/tools/warp_grep/openai.cjs +549 -500
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +5 -9
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +549 -500
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +5 -9
- package/package.json +7 -2
- package/dist/chunk-CKTA4AXM.js +0 -233
- package/dist/chunk-CKTA4AXM.js.map +0 -1
- package/dist/chunk-CP4NZGRY.js.map +0 -1
- package/dist/chunk-QH4BSXOD.js.map +0 -1
- /package/dist/{chunk-AIXF4GQC.js.map → chunk-AFLEE2PO.js.map} +0 -0
- /package/dist/{chunk-QZNGKOCZ.js.map → chunk-HDRLLCAD.js.map} +0 -0
- /package/dist/{chunk-BKIM7SNY.js.map → chunk-I3IN742Q.js.map} +0 -0
- /package/dist/{chunk-7UYDS6OX.js.map → chunk-KQP6ZPYB.js.map} +0 -0
- /package/dist/{chunk-OTPYEYMZ.js.map → chunk-MY4OU4ON.js.map} +0 -0
- /package/dist/{chunk-UBX7QYBD.js.map → chunk-O5DA5V5S.js.map} +0 -0
- /package/dist/{chunk-GJU7UOFL.js.map → chunk-OUEJ6XEO.js.map} +0 -0
- /package/dist/{chunk-L5WXPMCH.js.map → chunk-QUIGATZE.js.map} +0 -0
- /package/dist/{chunk-4J6NACK2.js.map → chunk-Y2OTK5WC.js.map} +0 -0
- /package/dist/{chunk-4KMBU6T3.js.map → chunk-YJZP5ZL5.js.map} +0 -0
- /package/dist/{chunk-76DJEQEP.js.map → chunk-ZRLEAPZV.js.map} +0 -0
- /package/dist/{chunk-BGEEES52.js.map → chunk-ZROQPUCQ.js.map} +0 -0
package/dist/client.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import './git/client.js';
|
|
|
7
7
|
import './modelrouter/core.js';
|
|
8
8
|
export { M as MorphClient, a as MorphClientConfig } from './client-BVeUudyD.js';
|
|
9
9
|
import './tools/fastapply/types.js';
|
|
10
|
+
import './tools/fastapply/apply.js';
|
|
10
11
|
import './tools/codebase_search/types.js';
|
|
11
12
|
import './tools/browser/types.js';
|
|
12
13
|
import './tools/browser/profiles/core.js';
|
package/dist/client.js
CHANGED
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Y2OTK5WC.js";
|
|
4
|
+
import "./chunk-QUIGATZE.js";
|
|
5
|
+
import "./chunk-MY4OU4ON.js";
|
|
6
|
+
import "./chunk-AFLEE2PO.js";
|
|
7
7
|
import "./chunk-KW7OEGZK.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-4CZPXV6R.js";
|
|
9
|
+
import "./chunk-ZROQPUCQ.js";
|
|
10
10
|
import "./chunk-PUGSTXLO.js";
|
|
11
11
|
import "./chunk-KRDIR7GG.js";
|
|
12
|
-
import "./chunk-4KMBU6T3.js";
|
|
13
|
-
import "./chunk-G2RSY56Q.js";
|
|
14
|
-
import "./chunk-YPKNMYD4.js";
|
|
15
|
-
import "./chunk-TPP2UGQP.js";
|
|
16
|
-
import "./chunk-5PNMAWLC.js";
|
|
17
|
-
import "./chunk-APP75CBN.js";
|
|
18
12
|
import "./chunk-SNGGSPYJ.js";
|
|
19
13
|
import "./chunk-FMLHRJDF.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-5PNMAWLC.js";
|
|
15
|
+
import "./chunk-APP75CBN.js";
|
|
16
|
+
import "./chunk-O5DA5V5S.js";
|
|
17
|
+
import "./chunk-OUEJ6XEO.js";
|
|
18
|
+
import "./chunk-ZRLEAPZV.js";
|
|
24
19
|
import "./chunk-YQMPVJ2L.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-WM77HRKO.js";
|
|
21
|
+
import "./chunk-HDRLLCAD.js";
|
|
22
|
+
import "./chunk-KQP6ZPYB.js";
|
|
23
|
+
import "./chunk-I3IN742Q.js";
|
|
29
24
|
import "./chunk-63WE2C5R.js";
|
|
25
|
+
import "./chunk-TLC3QKE6.js";
|
|
30
26
|
import "./chunk-4IOC2D5Y.js";
|
|
31
27
|
import "./chunk-SI2CKRKJ.js";
|
|
32
28
|
import "./chunk-2AMEQAO2.js";
|
|
33
29
|
import "./chunk-2VERUKO2.js";
|
|
34
30
|
import "./chunk-Q6Y4R236.js";
|
|
31
|
+
import "./chunk-2MAUPERG.js";
|
|
35
32
|
import "./chunk-GZMUGMOZ.js";
|
|
36
33
|
import "./chunk-LE66XCOI.js";
|
|
37
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-EMMSRY32.js";
|
|
38
35
|
import "./chunk-4VWJFZVS.js";
|
|
39
36
|
import "./chunk-PZ5AY32C.js";
|
|
40
37
|
export {
|
package/dist/edge.cjs
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// edge.ts
|
|
21
|
+
var edge_exports = {};
|
|
22
|
+
__export(edge_exports, {
|
|
23
|
+
AnthropicRouter: () => AnthropicRouter,
|
|
24
|
+
GeminiRouter: () => GeminiRouter,
|
|
25
|
+
OpenAIRouter: () => OpenAIRouter,
|
|
26
|
+
RawRouter: () => RawRouter,
|
|
27
|
+
applyEdit: () => applyEdit,
|
|
28
|
+
callMorphAPI: () => callMorphAPI,
|
|
29
|
+
countChanges: () => countChanges,
|
|
30
|
+
generateUdiff: () => generateUdiff
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(edge_exports);
|
|
33
|
+
|
|
34
|
+
// tools/fastapply/apply.ts
|
|
35
|
+
var import_diff = require("diff");
|
|
36
|
+
|
|
37
|
+
// tools/utils/resilience.ts
|
|
38
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
39
|
+
maxRetries: 3,
|
|
40
|
+
initialDelay: 1e3,
|
|
41
|
+
maxDelay: 3e4,
|
|
42
|
+
backoffMultiplier: 2,
|
|
43
|
+
retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
|
|
44
|
+
};
|
|
45
|
+
async function fetchWithRetry(url, options, retryConfig = {}) {
|
|
46
|
+
const {
|
|
47
|
+
maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
|
|
48
|
+
initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
|
|
49
|
+
maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
|
|
50
|
+
backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
|
|
51
|
+
retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
52
|
+
onRetry
|
|
53
|
+
} = retryConfig;
|
|
54
|
+
let lastError = null;
|
|
55
|
+
let delay = initialDelay;
|
|
56
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(url, options);
|
|
59
|
+
if (response.status === 429 || response.status === 503) {
|
|
60
|
+
if (attempt < maxRetries) {
|
|
61
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
62
|
+
const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
|
|
63
|
+
const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
|
|
64
|
+
if (onRetry) {
|
|
65
|
+
onRetry(attempt + 1, error);
|
|
66
|
+
}
|
|
67
|
+
await sleep(waitTime);
|
|
68
|
+
delay *= backoffMultiplier;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return response;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
lastError = error;
|
|
75
|
+
const isRetryable = retryableErrors.some(
|
|
76
|
+
(errType) => lastError?.message?.includes(errType)
|
|
77
|
+
);
|
|
78
|
+
if (!isRetryable || attempt === maxRetries) {
|
|
79
|
+
throw lastError;
|
|
80
|
+
}
|
|
81
|
+
const waitTime = Math.min(delay, maxDelay);
|
|
82
|
+
if (onRetry) {
|
|
83
|
+
onRetry(attempt + 1, lastError);
|
|
84
|
+
}
|
|
85
|
+
await sleep(waitTime);
|
|
86
|
+
delay *= backoffMultiplier;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
throw lastError || new Error("Max retries exceeded");
|
|
90
|
+
}
|
|
91
|
+
async function withTimeout(promise, timeoutMs, errorMessage) {
|
|
92
|
+
let timeoutId;
|
|
93
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
94
|
+
timeoutId = setTimeout(() => {
|
|
95
|
+
reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
|
|
96
|
+
}, timeoutMs);
|
|
97
|
+
});
|
|
98
|
+
try {
|
|
99
|
+
const result = await Promise.race([promise, timeoutPromise]);
|
|
100
|
+
clearTimeout(timeoutId);
|
|
101
|
+
return result;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
clearTimeout(timeoutId);
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function sleep(ms) {
|
|
108
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// tools/fastapply/apply.ts
|
|
112
|
+
var DEFAULT_API_URL = "https://api.morphllm.com";
|
|
113
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
114
|
+
function generateUdiff(original, modified, filepath) {
|
|
115
|
+
return (0, import_diff.createTwoFilesPatch)(
|
|
116
|
+
filepath,
|
|
117
|
+
filepath,
|
|
118
|
+
original,
|
|
119
|
+
modified,
|
|
120
|
+
"Original",
|
|
121
|
+
"Modified"
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function countChanges(original, modified) {
|
|
125
|
+
const diff = generateUdiff(original, modified, "file");
|
|
126
|
+
const lines = diff.split("\n");
|
|
127
|
+
let linesAdded = 0;
|
|
128
|
+
let linesRemoved = 0;
|
|
129
|
+
for (const line of lines) {
|
|
130
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
131
|
+
linesAdded++;
|
|
132
|
+
} else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
133
|
+
linesRemoved++;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const linesModified = Math.min(linesAdded, linesRemoved);
|
|
137
|
+
return {
|
|
138
|
+
linesAdded: linesAdded - linesModified,
|
|
139
|
+
linesRemoved: linesRemoved - linesModified,
|
|
140
|
+
linesModified
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
async function callMorphAPI(originalCode, codeEdit, instructions, filepath, config) {
|
|
144
|
+
const apiKey = config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
145
|
+
const apiUrl = config.morphApiUrl || DEFAULT_API_URL;
|
|
146
|
+
const timeout = config.timeout || DEFAULT_TIMEOUT;
|
|
147
|
+
const debug = config.debug || false;
|
|
148
|
+
if (!apiKey) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
const message = `<instruction>${instructions}</instruction>
|
|
154
|
+
<code>${originalCode}</code>
|
|
155
|
+
<update>${codeEdit}</update>`;
|
|
156
|
+
if (debug) {
|
|
157
|
+
console.log(`[FastApply] Calling ${apiUrl}/v1/chat/completions`);
|
|
158
|
+
console.log(`[FastApply] File: ${filepath}, Instructions: ${instructions.slice(0, 60)}...`);
|
|
159
|
+
console.log(`[FastApply] Original: ${originalCode.length} chars, Edit: ${codeEdit.length} chars`);
|
|
160
|
+
}
|
|
161
|
+
const startTime = Date.now();
|
|
162
|
+
const fetchPromise = fetchWithRetry(
|
|
163
|
+
`${apiUrl}/v1/chat/completions`,
|
|
164
|
+
{
|
|
165
|
+
method: "POST",
|
|
166
|
+
headers: {
|
|
167
|
+
"Content-Type": "application/json",
|
|
168
|
+
"Authorization": `Bearer ${apiKey}`
|
|
169
|
+
},
|
|
170
|
+
body: JSON.stringify({
|
|
171
|
+
model: "morph-v3-fast",
|
|
172
|
+
messages: [{ role: "user", content: message }]
|
|
173
|
+
})
|
|
174
|
+
},
|
|
175
|
+
config.retryConfig
|
|
176
|
+
);
|
|
177
|
+
const response = await withTimeout(
|
|
178
|
+
fetchPromise,
|
|
179
|
+
timeout,
|
|
180
|
+
`Morph API request timed out after ${timeout}ms`
|
|
181
|
+
);
|
|
182
|
+
if (!response.ok) {
|
|
183
|
+
const error = await response.text();
|
|
184
|
+
if (debug) console.error(`[FastApply] API error: ${response.status} - ${error}`);
|
|
185
|
+
throw new Error(`Morph API error (${response.status}): ${error}`);
|
|
186
|
+
}
|
|
187
|
+
const data = await response.json();
|
|
188
|
+
const elapsed = Date.now() - startTime;
|
|
189
|
+
if (debug) {
|
|
190
|
+
console.log(`[FastApply] \u2705 Success in ${elapsed}ms, merged: ${data.choices[0].message.content.length} chars`);
|
|
191
|
+
}
|
|
192
|
+
return data.choices[0].message.content;
|
|
193
|
+
}
|
|
194
|
+
async function applyEdit(input, config = {}) {
|
|
195
|
+
const debug = config.debug || false;
|
|
196
|
+
const filepath = input.filepath || "file";
|
|
197
|
+
try {
|
|
198
|
+
if (debug) {
|
|
199
|
+
console.log(`[FastApply] Applying edit to code (${input.originalCode.length} chars)`);
|
|
200
|
+
}
|
|
201
|
+
const mergedCode = await callMorphAPI(
|
|
202
|
+
input.originalCode,
|
|
203
|
+
input.codeEdit,
|
|
204
|
+
input.instructions,
|
|
205
|
+
filepath,
|
|
206
|
+
config
|
|
207
|
+
);
|
|
208
|
+
const udiff = config.generateUdiff !== false ? generateUdiff(input.originalCode, mergedCode, filepath) : void 0;
|
|
209
|
+
const changes = countChanges(input.originalCode, mergedCode);
|
|
210
|
+
return {
|
|
211
|
+
success: true,
|
|
212
|
+
mergedCode,
|
|
213
|
+
udiff,
|
|
214
|
+
changes
|
|
215
|
+
};
|
|
216
|
+
} catch (error) {
|
|
217
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
218
|
+
if (debug) console.error(`[FastApply] Error: ${errorMessage}`);
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },
|
|
222
|
+
error: errorMessage
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// modelrouter/core.ts
|
|
228
|
+
var DEFAULT_CONFIG = {
|
|
229
|
+
apiUrl: "https://api.morphllm.com",
|
|
230
|
+
timeout: 5e3,
|
|
231
|
+
// 5 seconds (responses typically <500ms)
|
|
232
|
+
debug: false
|
|
233
|
+
};
|
|
234
|
+
var BaseRouter = class {
|
|
235
|
+
config;
|
|
236
|
+
provider;
|
|
237
|
+
constructor(provider, config = {}) {
|
|
238
|
+
this.provider = provider;
|
|
239
|
+
this.config = {
|
|
240
|
+
apiKey: config.apiKey,
|
|
241
|
+
apiUrl: config.apiUrl || DEFAULT_CONFIG.apiUrl,
|
|
242
|
+
timeout: config.timeout || DEFAULT_CONFIG.timeout,
|
|
243
|
+
debug: config.debug || DEFAULT_CONFIG.debug,
|
|
244
|
+
retryConfig: config.retryConfig
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Select the optimal model for a given input and mode
|
|
249
|
+
*/
|
|
250
|
+
async selectModel(input) {
|
|
251
|
+
const mode = input.mode || "balanced";
|
|
252
|
+
const apiKey = this.config.apiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
253
|
+
if (!apiKey) {
|
|
254
|
+
throw new Error(
|
|
255
|
+
"Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config."
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
const url = `${this.config.apiUrl}/v1/router/${this.provider}`;
|
|
259
|
+
const payload = {
|
|
260
|
+
input: input.input,
|
|
261
|
+
mode
|
|
262
|
+
};
|
|
263
|
+
if (this.config.debug) {
|
|
264
|
+
console.log(`[ModelRouter] Requesting ${this.provider} model selection:`, {
|
|
265
|
+
mode,
|
|
266
|
+
inputLength: input.input.length
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
const fetchPromise = fetchWithRetry(
|
|
271
|
+
url,
|
|
272
|
+
{
|
|
273
|
+
method: "POST",
|
|
274
|
+
headers: {
|
|
275
|
+
"Content-Type": "application/json",
|
|
276
|
+
Authorization: `Bearer ${apiKey}`
|
|
277
|
+
},
|
|
278
|
+
body: JSON.stringify(payload)
|
|
279
|
+
},
|
|
280
|
+
this.config.retryConfig
|
|
281
|
+
);
|
|
282
|
+
const response = await withTimeout(
|
|
283
|
+
fetchPromise,
|
|
284
|
+
this.config.timeout,
|
|
285
|
+
`Router API request timed out after ${this.config.timeout}ms`
|
|
286
|
+
);
|
|
287
|
+
if (!response.ok) {
|
|
288
|
+
const errorText = await response.text();
|
|
289
|
+
throw new Error(
|
|
290
|
+
`Router API error (${response.status}): ${errorText || response.statusText}`
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
const apiResult = await response.json();
|
|
294
|
+
const result = {
|
|
295
|
+
model: apiResult.model
|
|
296
|
+
};
|
|
297
|
+
if (this.config.debug) {
|
|
298
|
+
console.log(`[ModelRouter] Selected model: ${apiResult.model}, Confidence: ${apiResult.confidence?.toFixed(3)}`);
|
|
299
|
+
}
|
|
300
|
+
return result;
|
|
301
|
+
} catch (error) {
|
|
302
|
+
if (this.config.debug) {
|
|
303
|
+
console.error(`[ModelRouter] Error selecting model:`, error);
|
|
304
|
+
}
|
|
305
|
+
throw error;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
var OpenAIRouter = class extends BaseRouter {
|
|
310
|
+
constructor(config = {}) {
|
|
311
|
+
super("openai", config);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Select optimal GPT-5 model
|
|
315
|
+
*
|
|
316
|
+
* @param input - User input and mode
|
|
317
|
+
* @returns Selected model name (gpt-5-mini | gpt-5-low | gpt-5-medium | gpt-5-high)
|
|
318
|
+
*/
|
|
319
|
+
async selectModel(input) {
|
|
320
|
+
return super.selectModel(input);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
var AnthropicRouter = class extends BaseRouter {
|
|
324
|
+
constructor(config = {}) {
|
|
325
|
+
super("anthropic", config);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Select optimal Claude model
|
|
329
|
+
*
|
|
330
|
+
* @param input - User input and mode
|
|
331
|
+
* @returns Selected model name (claude-4.5-haiku | claude-4.5-sonnet)
|
|
332
|
+
*/
|
|
333
|
+
async selectModel(input) {
|
|
334
|
+
return super.selectModel(input);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var GeminiRouter = class extends BaseRouter {
|
|
338
|
+
constructor(config = {}) {
|
|
339
|
+
super("gemini", config);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Select optimal Gemini model
|
|
343
|
+
*
|
|
344
|
+
* @param input - User input and mode
|
|
345
|
+
* @returns Selected model name (gemini-2.5-flash | gemini-2.5-pro)
|
|
346
|
+
*/
|
|
347
|
+
async selectModel(input) {
|
|
348
|
+
return super.selectModel(input);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
var RawRouter = class extends BaseRouter {
|
|
352
|
+
constructor(config = {}) {
|
|
353
|
+
super("raw", config);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Get raw difficulty classification
|
|
357
|
+
*
|
|
358
|
+
* @param input - User input and mode
|
|
359
|
+
* @returns Raw difficulty (easy | medium | hard | needs_info)
|
|
360
|
+
*/
|
|
361
|
+
async classify(input) {
|
|
362
|
+
const mode = input.mode || "balanced";
|
|
363
|
+
const apiKey = this.config.apiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
364
|
+
if (!apiKey) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
"Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config."
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
const url = `${this.config.apiUrl}/v1/router/raw`;
|
|
370
|
+
const payload = {
|
|
371
|
+
input: input.input,
|
|
372
|
+
mode
|
|
373
|
+
};
|
|
374
|
+
if (this.config.debug) {
|
|
375
|
+
console.log(`[RawRouter] Requesting raw difficulty classification:`, {
|
|
376
|
+
mode,
|
|
377
|
+
inputLength: input.input.length
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
try {
|
|
381
|
+
const fetchPromise = fetchWithRetry(
|
|
382
|
+
url,
|
|
383
|
+
{
|
|
384
|
+
method: "POST",
|
|
385
|
+
headers: {
|
|
386
|
+
"Content-Type": "application/json",
|
|
387
|
+
Authorization: `Bearer ${apiKey}`
|
|
388
|
+
},
|
|
389
|
+
body: JSON.stringify(payload)
|
|
390
|
+
},
|
|
391
|
+
this.config.retryConfig
|
|
392
|
+
);
|
|
393
|
+
const response = await withTimeout(
|
|
394
|
+
fetchPromise,
|
|
395
|
+
this.config.timeout,
|
|
396
|
+
`Router API request timed out after ${this.config.timeout}ms`
|
|
397
|
+
);
|
|
398
|
+
if (!response.ok) {
|
|
399
|
+
const errorText = await response.text();
|
|
400
|
+
throw new Error(
|
|
401
|
+
`Router API error (${response.status}): ${errorText || response.statusText}`
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
const apiResult = await response.json();
|
|
405
|
+
let difficulty;
|
|
406
|
+
if (apiResult.difficulty === "") {
|
|
407
|
+
difficulty = "medium";
|
|
408
|
+
} else {
|
|
409
|
+
difficulty = apiResult.difficulty || apiResult.model;
|
|
410
|
+
}
|
|
411
|
+
const result = {
|
|
412
|
+
difficulty
|
|
413
|
+
};
|
|
414
|
+
if (this.config.debug) {
|
|
415
|
+
console.log(`[RawRouter] Classified as: ${difficulty}`);
|
|
416
|
+
}
|
|
417
|
+
return result;
|
|
418
|
+
} catch (error) {
|
|
419
|
+
if (this.config.debug) {
|
|
420
|
+
console.error(`[RawRouter] Error classifying:`, error);
|
|
421
|
+
}
|
|
422
|
+
throw error;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
427
|
+
0 && (module.exports = {
|
|
428
|
+
AnthropicRouter,
|
|
429
|
+
GeminiRouter,
|
|
430
|
+
OpenAIRouter,
|
|
431
|
+
RawRouter,
|
|
432
|
+
applyEdit,
|
|
433
|
+
callMorphAPI,
|
|
434
|
+
countChanges,
|
|
435
|
+
generateUdiff
|
|
436
|
+
});
|
|
437
|
+
//# sourceMappingURL=edge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../edge.ts","../tools/fastapply/apply.ts","../tools/utils/resilience.ts","../modelrouter/core.ts"],"sourcesContent":["/**\n * Morph SDK - Edge-Compatible Entry Point\n *\n * This module has zero Node.js dependencies and works on:\n * - Cloudflare Workers\n * - Vercel Edge Functions\n * - Deno Deploy\n * - Browser environments\n *\n * For full functionality including file operations, use the main entry point:\n * import { MorphClient } from '@morphllm/morphsdk';\n *\n * @example\n * ```typescript\n * // Edge-compatible usage (Cloudflare Workers, Vercel Edge, etc.)\n * import { applyEdit, OpenAIRouter } from '@morphllm/morphsdk/edge';\n *\n * // Fast Apply\n * const result = await applyEdit({\n * originalCode: 'function hello() { return \"world\"; }',\n * codeEdit: 'function hello() { return \"universe\"; }',\n * instructions: 'Change return value'\n * }, {\n * morphApiKey: env.MORPH_API_KEY\n * });\n *\n * // Model Router\n * const router = new OpenAIRouter({ apiKey: env.MORPH_API_KEY });\n * const { model } = await router.selectModel({ input: 'Write a hello world' });\n * ```\n */\n\n// Edge-compatible FastApply functions\nexport {\n applyEdit,\n generateUdiff,\n countChanges,\n callMorphAPI,\n} from './tools/fastapply/apply.js';\n\n// Edge-compatible Model Routers\nexport {\n OpenAIRouter,\n AnthropicRouter,\n GeminiRouter,\n RawRouter,\n} from './modelrouter/core.js';\n\n// Export FastApply types\nexport type {\n ApplyEditInput,\n ApplyEditResult,\n ApplyEditConfig,\n EditChanges,\n} from './tools/fastapply/types.js';\n\n// Export Model Router types\nexport type {\n RouterConfig,\n RouterInput,\n RouterResult,\n RawRouterResult,\n ComplexityLevel,\n RouterMode,\n Provider,\n} from './modelrouter/types.js';\n\nexport type {\n RetryConfig,\n} from './tools/utils/resilience.js';\n","/**\n * Edge-compatible code application API\n *\n * This module has zero Node.js dependencies and works on:\n * - Cloudflare Workers\n * - Vercel Edge Functions\n * - Deno Deploy\n * - Browser environments\n *\n * For file-based operations, use executeEditFile from core.ts\n */\n\nimport { createTwoFilesPatch } from 'diff';\nimport { fetchWithRetry, withTimeout } from '../utils/resilience.js';\nimport type {\n EditChanges,\n MorphApplyResponse,\n ApplyEditInput,\n ApplyEditResult,\n ApplyEditConfig,\n} from './types.js';\n\nconst DEFAULT_API_URL = 'https://api.morphllm.com';\nconst DEFAULT_TIMEOUT = 30000;\n\n/**\n * Generate a unified diff between two strings\n */\nexport function generateUdiff(\n original: string,\n modified: string,\n filepath: string\n): string {\n return createTwoFilesPatch(\n filepath,\n filepath,\n original,\n modified,\n 'Original',\n 'Modified'\n );\n}\n\n/**\n * Count changes from a unified diff\n */\nexport function countChanges(original: string, modified: string): EditChanges {\n const diff = generateUdiff(original, modified, 'file');\n const lines = diff.split('\\n');\n\n let linesAdded = 0;\n let linesRemoved = 0;\n\n for (const line of lines) {\n if (line.startsWith('+') && !line.startsWith('+++')) {\n linesAdded++;\n } else if (line.startsWith('-') && !line.startsWith('---')) {\n linesRemoved++;\n }\n }\n\n const linesModified = Math.min(linesAdded, linesRemoved);\n\n return {\n linesAdded: linesAdded - linesModified,\n linesRemoved: linesRemoved - linesModified,\n linesModified,\n };\n}\n\n/**\n * Call Morph Apply API to merge code edits\n * Uses OpenAI-compatible chat completions endpoint with XML-formatted message\n */\nexport async function callMorphAPI(\n originalCode: string,\n codeEdit: string,\n instructions: string,\n filepath: string,\n config: ApplyEditConfig\n): Promise<string> {\n const apiKey = config.morphApiKey || (typeof process !== 'undefined' ? process.env?.MORPH_API_KEY : undefined);\n const apiUrl = config.morphApiUrl || DEFAULT_API_URL;\n const timeout = config.timeout || DEFAULT_TIMEOUT;\n const debug = config.debug || false;\n\n if (!apiKey) {\n throw new Error(\n 'Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config.'\n );\n }\n\n // Format message with XML tags as per Morph Fast Apply spec\n const message = `<instruction>${instructions}</instruction>\\n<code>${originalCode}</code>\\n<update>${codeEdit}</update>`;\n\n if (debug) {\n console.log(`[FastApply] Calling ${apiUrl}/v1/chat/completions`);\n console.log(`[FastApply] File: ${filepath}, Instructions: ${instructions.slice(0, 60)}...`);\n console.log(`[FastApply] Original: ${originalCode.length} chars, Edit: ${codeEdit.length} chars`);\n }\n\n const startTime = Date.now();\n\n // Fetch with retry and timeout\n const fetchPromise = fetchWithRetry(\n `${apiUrl}/v1/chat/completions`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n model: 'morph-v3-fast',\n messages: [{ role: 'user', content: message }],\n }),\n },\n config.retryConfig\n );\n\n const response = await withTimeout(\n fetchPromise,\n timeout,\n `Morph API request timed out after ${timeout}ms`\n );\n\n if (!response.ok) {\n const error = await response.text();\n if (debug) console.error(`[FastApply] API error: ${response.status} - ${error}`);\n throw new Error(`Morph API error (${response.status}): ${error}`);\n }\n\n const data: MorphApplyResponse = await response.json();\n const elapsed = Date.now() - startTime;\n\n if (debug) {\n console.log(`[FastApply] ✅ Success in ${elapsed}ms, merged: ${data.choices[0].message.content.length} chars`);\n }\n\n return data.choices[0].message.content;\n}\n\n/**\n * Apply an edit to code directly without file I/O\n *\n * This is the edge-compatible code-in/code-out API that accepts code content directly\n * and returns the merged result without reading or writing any files.\n *\n * Works on Cloudflare Workers, Vercel Edge Functions, Deno, and browsers.\n *\n * @param input - Code and edit parameters\n * @param config - Optional configuration\n * @returns Result with merged code\n *\n * @example\n * ```typescript\n * import { applyEdit } from '@morphllm/morphsdk';\n *\n * const result = await applyEdit({\n * originalCode: fs.readFileSync('file.ts', 'utf-8'),\n * codeEdit: '// ... existing code ...\\nconst newVar = 42;\\n// ... existing code ...',\n * instructions: 'Add a new variable',\n * filepath: 'file.ts' // optional, for udiff context\n * });\n *\n * if (result.success) {\n * fs.writeFileSync('file.ts', result.mergedCode);\n * }\n * ```\n */\nexport async function applyEdit(\n input: ApplyEditInput,\n config: ApplyEditConfig = {}\n): Promise<ApplyEditResult> {\n const debug = config.debug || false;\n const filepath = input.filepath || 'file';\n\n try {\n if (debug) {\n console.log(`[FastApply] Applying edit to code (${input.originalCode.length} chars)`);\n }\n\n const mergedCode = await callMorphAPI(\n input.originalCode,\n input.codeEdit,\n input.instructions,\n filepath,\n config\n );\n\n const udiff = config.generateUdiff !== false\n ? generateUdiff(input.originalCode, mergedCode, filepath)\n : undefined;\n\n const changes = countChanges(input.originalCode, mergedCode);\n\n return {\n success: true,\n mergedCode,\n udiff,\n changes,\n };\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';\n if (debug) console.error(`[FastApply] Error: ${errorMessage}`);\n\n return {\n success: false,\n changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },\n error: errorMessage,\n };\n }\n}\n","/**\n * Resilience utilities for retry logic and timeout handling\n */\n\nexport interface RetryConfig {\n maxRetries?: number; // Default: 3\n initialDelay?: number; // Default: 1000ms\n maxDelay?: number; // Default: 30000ms\n backoffMultiplier?: number; // Default: 2\n retryableErrors?: string[]; // Default: ['ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND']\n onRetry?: (attempt: number, error: Error) => void;\n}\n\nconst DEFAULT_RETRY_CONFIG: Required<Omit<RetryConfig, 'onRetry'>> = {\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30000,\n backoffMultiplier: 2,\n retryableErrors: ['ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND'],\n};\n\n/**\n * Retry a fetch request with exponential backoff\n * \n * @param url - Request URL\n * @param options - Fetch options\n * @param retryConfig - Retry configuration\n * @returns Response from fetch\n * \n * @example\n * ```typescript\n * const response = await fetchWithRetry(\n * 'https://api.example.com/data',\n * { method: 'POST', body: JSON.stringify(data) },\n * { maxRetries: 5, initialDelay: 500 }\n * );\n * ```\n */\nexport async function fetchWithRetry(\n url: string,\n options: RequestInit,\n retryConfig: RetryConfig = {}\n): Promise<Response> {\n const {\n maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,\n initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,\n maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,\n backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,\n retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,\n onRetry,\n } = retryConfig;\n\n let lastError: Error | null = null;\n let delay = initialDelay;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n const response = await fetch(url, options);\n \n // Retry on 429 (rate limit) or 503 (service unavailable)\n if (response.status === 429 || response.status === 503) {\n if (attempt < maxRetries) {\n // Check for Retry-After header\n const retryAfter = response.headers.get('Retry-After');\n const waitTime = retryAfter \n ? parseInt(retryAfter) * 1000 \n : Math.min(delay, maxDelay);\n \n const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);\n if (onRetry) {\n onRetry(attempt + 1, error);\n }\n \n await sleep(waitTime);\n delay *= backoffMultiplier;\n continue;\n }\n }\n\n return response;\n } catch (error) {\n lastError = error as Error;\n \n // Check if error is retryable\n const isRetryable = retryableErrors.some(errType => \n lastError?.message?.includes(errType)\n );\n\n if (!isRetryable || attempt === maxRetries) {\n throw lastError;\n }\n\n // Exponential backoff\n const waitTime = Math.min(delay, maxDelay);\n if (onRetry) {\n onRetry(attempt + 1, lastError);\n }\n \n await sleep(waitTime);\n delay *= backoffMultiplier;\n }\n }\n\n throw lastError || new Error('Max retries exceeded');\n}\n\n/**\n * Add timeout to any promise\n * \n * @param promise - Promise to wrap with timeout\n * @param timeoutMs - Timeout in milliseconds\n * @param errorMessage - Optional custom error message\n * @returns Promise that rejects if timeout is reached\n * \n * @example\n * ```typescript\n * const result = await withTimeout(\n * fetchData(),\n * 5000,\n * 'Data fetch timed out'\n * );\n * ```\n */\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n errorMessage?: string\n): Promise<T> {\n let timeoutId: NodeJS.Timeout | number;\n \n const timeoutPromise = new Promise<never>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const result = await Promise.race([promise, timeoutPromise]);\n clearTimeout(timeoutId!);\n return result;\n } catch (error) {\n clearTimeout(timeoutId!);\n throw error;\n }\n}\n\n/**\n * Sleep for specified milliseconds\n */\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Unified error type for all tools\n */\nexport class MorphError extends Error {\n constructor(\n message: string,\n public code: string,\n public statusCode?: number,\n public retryable: boolean = false\n ) {\n super(message);\n this.name = 'MorphError';\n }\n}\n\n\n","/**\n * Core implementation for intelligent model routing\n */\n\nimport { fetchWithRetry, withTimeout } from '../tools/utils/resilience.js';\nimport type {\n RouterConfig,\n RouterInput,\n RouterResult,\n RawRouterResult,\n ComplexityLevel,\n RouterMode,\n Provider,\n} from './types.js';\n\nconst DEFAULT_CONFIG = {\n apiUrl: 'https://api.morphllm.com',\n timeout: 5000, // 5 seconds (responses typically <500ms)\n debug: false,\n};\n\nabstract class BaseRouter {\n protected config: Required<Omit<RouterConfig, 'apiKey' | 'retryConfig'>> & Pick<RouterConfig, 'apiKey' | 'retryConfig'>;\n protected provider: Provider;\n\n constructor(provider: Provider, config: RouterConfig = {}) {\n this.provider = provider;\n this.config = {\n apiKey: config.apiKey,\n apiUrl: config.apiUrl || DEFAULT_CONFIG.apiUrl,\n timeout: config.timeout || DEFAULT_CONFIG.timeout,\n debug: config.debug || DEFAULT_CONFIG.debug,\n retryConfig: config.retryConfig,\n };\n }\n\n /**\n * Select the optimal model for a given input and mode\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n const mode = input.mode || 'balanced';\n const apiKey = this.config.apiKey || (typeof process !== 'undefined' ? process.env?.MORPH_API_KEY : undefined);\n\n if (!apiKey) {\n throw new Error(\n 'Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config.'\n );\n }\n\n const url = `${this.config.apiUrl}/v1/router/${this.provider}`;\n const payload = {\n input: input.input,\n mode,\n };\n\n if (this.config.debug) {\n console.log(`[ModelRouter] Requesting ${this.provider} model selection:`, {\n mode,\n inputLength: input.input.length,\n });\n }\n\n try {\n const fetchPromise = fetchWithRetry(\n url,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify(payload),\n },\n this.config.retryConfig\n );\n\n const response = await withTimeout(\n fetchPromise,\n this.config.timeout,\n `Router API request timed out after ${this.config.timeout}ms`\n );\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Router API error (${response.status}): ${errorText || response.statusText}`\n );\n }\n\n const apiResult: { model: string; confidence?: number } = await response.json();\n\n const result: RouterResult = {\n model: apiResult.model,\n };\n\n if (this.config.debug) {\n console.log(`[ModelRouter] Selected model: ${apiResult.model}, Confidence: ${apiResult.confidence?.toFixed(3)}`);\n }\n\n return result;\n } catch (error) {\n if (this.config.debug) {\n console.error(`[ModelRouter] Error selecting model:`, error);\n }\n throw error;\n }\n }\n}\n\n/**\n * OpenAI model router for GPT-5 series\n */\nexport class OpenAIRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('openai', config);\n }\n\n /**\n * Select optimal GPT-5 model\n * \n * @param input - User input and mode\n * @returns Selected model name (gpt-5-mini | gpt-5-low | gpt-5-medium | gpt-5-high)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n\n/**\n * Anthropic model router for Claude 4.5 series\n */\nexport class AnthropicRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('anthropic', config);\n }\n\n /**\n * Select optimal Claude model\n * \n * @param input - User input and mode\n * @returns Selected model name (claude-4.5-haiku | claude-4.5-sonnet)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n\n/**\n * Google Gemini model router\n */\nexport class GeminiRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('gemini', config);\n }\n\n /**\n * Select optimal Gemini model\n * \n * @param input - User input and mode\n * @returns Selected model name (gemini-2.5-flash | gemini-2.5-pro)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n\n/**\n * Raw difficulty classification router (no provider-specific mapping)\n */\nexport class RawRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('raw' as Provider, config);\n }\n\n /**\n * Get raw difficulty classification\n * \n * @param input - User input and mode\n * @returns Raw difficulty (easy | medium | hard | needs_info)\n */\n async classify(input: RouterInput): Promise<RawRouterResult> {\n const mode = input.mode || 'balanced';\n const apiKey = this.config.apiKey || (typeof process !== 'undefined' ? process.env?.MORPH_API_KEY : undefined);\n\n if (!apiKey) {\n throw new Error(\n 'Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config.'\n );\n }\n\n const url = `${this.config.apiUrl}/v1/router/raw`;\n const payload = {\n input: input.input,\n mode,\n };\n\n if (this.config.debug) {\n console.log(`[RawRouter] Requesting raw difficulty classification:`, {\n mode,\n inputLength: input.input.length,\n });\n }\n\n try {\n const fetchPromise = fetchWithRetry(\n url,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify(payload),\n },\n this.config.retryConfig\n );\n\n const response = await withTimeout(\n fetchPromise,\n this.config.timeout,\n `Router API request timed out after ${this.config.timeout}ms`\n );\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Router API error (${response.status}): ${errorText || response.statusText}`\n );\n }\n\n const apiResult: { model?: string; difficulty?: string; confidence?: number } = await response.json();\n\n // Support both 'model' and 'difficulty' fields for compatibility\n // Empty string from API means \"medium\" difficulty (API bug workaround)\n let difficulty: ComplexityLevel;\n if (apiResult.difficulty === '') {\n difficulty = 'medium';\n } else {\n difficulty = (apiResult.difficulty || apiResult.model) as ComplexityLevel;\n }\n\n const result: RawRouterResult = {\n difficulty,\n };\n\n if (this.config.debug) {\n console.log(`[RawRouter] Classified as: ${difficulty}`);\n }\n\n return result;\n } catch (error) {\n if (this.config.debug) {\n console.error(`[RawRouter] Error classifying:`, error);\n }\n throw error;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYA,kBAAoC;;;ACCpC,IAAM,uBAA+D;AAAA,EACnE,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,iBAAiB,CAAC,gBAAgB,aAAa,WAAW;AAC5D;AAmBA,eAAsB,eACpB,KACA,SACA,cAA2B,CAAC,GACT;AACnB,QAAM;AAAA,IACJ,aAAa,qBAAqB;AAAA,IAClC,eAAe,qBAAqB;AAAA,IACpC,WAAW,qBAAqB;AAAA,IAChC,oBAAoB,qBAAqB;AAAA,IACzC,kBAAkB,qBAAqB;AAAA,IACvC;AAAA,EACF,IAAI;AAEJ,MAAI,YAA0B;AAC9B,MAAI,QAAQ;AAEZ,WAAS,UAAU,GAAG,WAAW,YAAY,WAAW;AACtD,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,KAAK,OAAO;AAGzC,UAAI,SAAS,WAAW,OAAO,SAAS,WAAW,KAAK;AACtD,YAAI,UAAU,YAAY;AAExB,gBAAM,aAAa,SAAS,QAAQ,IAAI,aAAa;AACrD,gBAAM,WA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O;AAAA,MAC3D;AAEA,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,YAAY,MAAM,SAAS,KAAK;AACtC,cAAM,IAAI;AAAA,UACR,qBAAqB,SAAS,MAAM,MAAM,aAAa,SAAS,UAAU;AAAA,QAC5E;AAAA,MACF;AAEA,YAAM,YAA0E,MAAM,SAAS,KAAK;AAIpG,UAAI;AACJ,UAAI,UAAU,eAAe,IAAI;AAC/B,qBAAa;AAAA,MACf,OAAO;AACL,qBAAc,UAAU,cAAc,UAAU;AAAA,MAClD;AAEA,YAAM,SAA0B;AAAA,QAC9B;AAAA,MACF;AAEA,UAAI,KAAK,OAAO,OAAO;AACrB,gBAAQ,IAAI,8BAA8B,UAAU,EAAE;AAAA,MACxD;AAEA,aAAO;AAAA,IACT,SAAS,OAAO;AACd,UAAI,KAAK,OAAO,OAAO;AACrB,gBAAQ,MAAM,kCAAkC,KAAK;AAAA,MACvD;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
package/dist/edge.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { applyEdit, callMorphAPI, countChanges, generateUdiff } from './tools/fastapply/apply.js';
|
|
2
|
+
export { AnthropicRouter, GeminiRouter, OpenAIRouter, RawRouter } from './modelrouter/core.js';
|
|
3
|
+
export { ApplyEditConfig, ApplyEditInput, ApplyEditResult, EditChanges } from './tools/fastapply/types.js';
|
|
4
|
+
export { ComplexityLevel, Provider, RawRouterResult, RouterConfig, RouterInput, RouterMode, RouterResult } from './modelrouter/types.js';
|
|
5
|
+
export { RetryConfig } from './tools/utils/resilience.js';
|
package/dist/edge.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyEdit,
|
|
3
|
+
callMorphAPI,
|
|
4
|
+
countChanges,
|
|
5
|
+
generateUdiff
|
|
6
|
+
} from "./chunk-2MAUPERG.js";
|
|
7
|
+
import {
|
|
8
|
+
AnthropicRouter,
|
|
9
|
+
GeminiRouter,
|
|
10
|
+
OpenAIRouter,
|
|
11
|
+
RawRouter
|
|
12
|
+
} from "./chunk-EMMSRY32.js";
|
|
13
|
+
import "./chunk-4VWJFZVS.js";
|
|
14
|
+
import "./chunk-PZ5AY32C.js";
|
|
15
|
+
export {
|
|
16
|
+
AnthropicRouter,
|
|
17
|
+
GeminiRouter,
|
|
18
|
+
OpenAIRouter,
|
|
19
|
+
RawRouter,
|
|
20
|
+
applyEdit,
|
|
21
|
+
callMorphAPI,
|
|
22
|
+
countChanges,
|
|
23
|
+
generateUdiff
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=edge.js.map
|
package/dist/edge.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|