@morphllm/morphsdk 0.2.202 → 0.2.203
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-2PPYWRMZ.js +3 -4
- package/dist/{chunk-SIFDK4AA.js → chunk-2UIOCSVJ.js} +3 -24
- package/dist/chunk-44OIEPIO.js +4 -23
- package/dist/chunk-4EQQGUZ7.cjs +104 -0
- package/dist/chunk-4OUGA3KS.js +1 -5
- package/dist/chunk-4R5MDGL6.cjs +280 -0
- package/dist/chunk-65W4I66Q.cjs +103 -0
- package/dist/{chunk-3CPI6ZIC.js → chunk-66THRMD7.js} +10 -35
- package/dist/chunk-6TZCVTW5.js +3 -4
- package/dist/chunk-6WP7EA4F.js +2 -4
- package/dist/chunk-74A4HLIO.cjs +42 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-7NA7X7W2.cjs +77 -0
- package/dist/chunk-7PJYY46L.cjs +2 -0
- package/dist/chunk-AFF6XYKL.cjs +71 -0
- package/dist/{chunk-2XU3XXUE.js → chunk-AJBZA23L.js} +3 -25
- package/dist/chunk-AWFZKS27.cjs +11 -0
- package/dist/{chunk-LVKKICOB.js → chunk-AXEKIRRY.js} +22 -62
- package/dist/chunk-B3FD67F2.cjs +256 -0
- package/dist/chunk-BJBWWIZV.cjs +2 -0
- package/dist/{chunk-UAZKHSEU.js → chunk-E3XNKAMI.js} +5 -15
- package/dist/{chunk-VQDDL3UH.js → chunk-E7FLETFO.js} +2 -8
- package/dist/{chunk-YAM6P5OQ.js → chunk-EI2M567U.js} +2 -6
- package/dist/chunk-EJTL2BOZ.cjs +42 -0
- package/dist/chunk-ETBRAKVV.js +1 -5
- package/dist/{chunk-6OYJC4TZ.js → chunk-EZ2OFDBJ.js} +5 -19
- package/dist/chunk-FBOZIVVQ.js +1 -0
- package/dist/{chunk-CAWQEHKP.js → chunk-GDFPZ3NJ.js} +4 -19
- package/dist/{chunk-UKXCGQPS.js → chunk-GIQAIHUI.js} +8 -33
- package/dist/chunk-GSUQGDCL.cjs +235 -0
- package/dist/{chunk-D6YJ5X3C.js → chunk-H3HRSRR5.js} +4 -12
- package/dist/chunk-HDP4QAZL.js +1 -4
- package/dist/chunk-HMLYJVZM.cjs +410 -0
- package/dist/chunk-IPJA3ZS6.cjs +10 -0
- package/dist/{chunk-XPHNS7NW.js → chunk-IUM6CQYX.js} +3 -12
- package/dist/{chunk-26K5EJD3.js → chunk-J56Q6C4Y.js} +4 -18
- package/dist/chunk-JBTR3FQD.cjs +135 -0
- package/dist/chunk-JNQKQKHS.cjs +81 -0
- package/dist/chunk-JOZC4T6C.cjs +168 -0
- package/dist/{chunk-JEVLCA5C.js → chunk-JUGNTIVU.js} +6 -19
- package/dist/{chunk-NFPRKZQ5.js → chunk-JY6COF3X.js} +5 -22
- package/dist/{chunk-ICCGLO6V.js → chunk-KLVJIC2O.js} +5 -17
- package/dist/chunk-KSZYOX6S.cjs +91 -0
- package/dist/chunk-KVGZ2TSG.cjs +274 -0
- package/dist/chunk-LDM7RNNN.js +1 -0
- package/dist/{chunk-65TUD7JV.js → chunk-LLQH6CCB.js} +10 -28
- package/dist/chunk-M34E2AMK.js +1 -5
- package/dist/chunk-MF56KEI4.js +1 -4
- package/dist/chunk-MLKGABMK.js +1 -3
- package/dist/chunk-MLPZKUCO.js +4 -5
- package/dist/chunk-MWXJ6DZ2.cjs +21 -0
- package/dist/{chunk-IBRBSDLT.js → chunk-N7UKZ5X7.js} +2 -6
- package/dist/chunk-NDUC7OV6.cjs +74 -0
- package/dist/{chunk-PDSIWL7I.js → chunk-NLACTMZT.js} +6 -19
- package/dist/chunk-NNKBKENK.cjs +15 -0
- package/dist/chunk-NRG6QX3L.js +1 -3
- package/dist/chunk-OCCGJ4S6.js +8 -0
- package/dist/chunk-ODY2NKQU.cjs +50 -0
- package/dist/chunk-OM5ZSXQW.cjs +91 -0
- package/dist/chunk-OOEORM7H.cjs +334 -0
- package/dist/chunk-OPDWMD4Q.js +1 -3
- package/dist/chunk-OSL4CNSO.js +7 -23
- package/dist/chunk-OXXMTDOY.cjs +86 -0
- package/dist/chunk-PA3UTI4A.js +1 -4
- package/dist/chunk-QEEAIXL5.cjs +74 -0
- package/dist/chunk-RYVW7RUM.js +2 -6
- package/dist/chunk-S6QBPXBI.cjs +107 -0
- package/dist/chunk-TL34BLQD.cjs +10 -0
- package/dist/chunk-TPZHMD7J.cjs +72 -0
- package/dist/chunk-UAPK3AIJ.js +1 -10
- package/dist/chunk-UF5IKELS.cjs +26 -0
- package/dist/chunk-UNX7V6P6.cjs +60 -0
- package/dist/chunk-UUCRWJJR.cjs +313 -0
- package/dist/chunk-VDFLPO7B.cjs +396 -0
- package/dist/chunk-VHD7CW5O.cjs +43 -0
- package/dist/chunk-VL4QNALG.cjs +50 -0
- package/dist/chunk-WR7LSUIR.cjs +213 -0
- package/dist/chunk-XE6D4J63.cjs +72 -0
- package/dist/chunk-ZLG2M2I4.cjs +21 -0
- package/dist/chunk-ZSHVXDA2.js +4 -10
- package/dist/client.cjs +40 -4360
- package/dist/client.js +32 -37
- package/dist/core/client.cjs +10 -476
- package/dist/core/client.js +6 -11
- package/dist/core/error.cjs +8 -251
- package/dist/core/error.js +4 -9
- package/dist/core/index.cjs +20 -488
- package/dist/core/index.js +8 -19
- package/dist/core/resource.cjs +9 -33
- package/dist/core/resource.js +2 -7
- package/dist/edge.cjs +62 -1111
- package/dist/edge.js +10 -42
- package/dist/index.cjs +115 -4431
- package/dist/index.js +39 -87
- package/dist/modelrouter/core.cjs +28 -648
- package/dist/modelrouter/core.js +8 -21
- package/dist/modelrouter/index.cjs +28 -648
- package/dist/modelrouter/index.js +8 -21
- package/dist/modelrouter/types.cjs +1 -17
- package/dist/modelrouter/types.js +1 -0
- package/dist/subagents/anthropic.cjs +27 -2784
- package/dist/subagents/anthropic.js +19 -24
- package/dist/subagents/index.cjs +14 -95
- package/dist/subagents/index.js +2 -11
- package/dist/subagents/prompts.cjs +14 -93
- package/dist/subagents/prompts.js +2 -11
- package/dist/subagents/types.cjs +1 -17
- package/dist/subagents/types.js +1 -0
- package/dist/subagents/vercel.cjs +27 -2761
- package/dist/subagents/vercel.js +19 -24
- package/dist/tools/compact/core.cjs +12 -548
- package/dist/tools/compact/core.js +8 -13
- package/dist/tools/compact/index.cjs +17 -595
- package/dist/tools/compact/index.js +9 -17
- package/dist/tools/compact/types.cjs +1 -17
- package/dist/tools/compact/types.js +1 -0
- package/dist/tools/fastapply/anthropic.cjs +27 -891
- package/dist/tools/fastapply/anthropic.js +11 -24
- package/dist/tools/fastapply/apply.cjs +28 -672
- package/dist/tools/fastapply/apply.js +4 -19
- package/dist/tools/fastapply/core.cjs +37 -1061
- package/dist/tools/fastapply/core.js +9 -29
- package/dist/tools/fastapply/index.cjs +62 -1062
- package/dist/tools/fastapply/index.js +14 -44
- package/dist/tools/fastapply/openai.cjs +32 -901
- package/dist/tools/fastapply/openai.js +11 -26
- package/dist/tools/fastapply/prompts.cjs +10 -62
- package/dist/tools/fastapply/prompts.js +2 -9
- package/dist/tools/fastapply/types.cjs +1 -17
- package/dist/tools/fastapply/types.js +1 -0
- package/dist/tools/fastapply/vercel.cjs +25 -897
- package/dist/tools/fastapply/vercel.js +11 -22
- package/dist/tools/index.cjs +62 -1062
- package/dist/tools/index.js +14 -44
- package/dist/tools/utils/resilience.cjs +15 -312
- package/dist/tools/utils/resilience.js +3 -12
- package/dist/tools/warp_grep/agent/config.cjs +16 -127
- package/dist/tools/warp_grep/agent/config.js +2 -11
- package/dist/tools/warp_grep/agent/formatter.cjs +12 -48
- package/dist/tools/warp_grep/agent/formatter.js +2 -9
- package/dist/tools/warp_grep/agent/parser.cjs +16 -83
- package/dist/tools/warp_grep/agent/parser.js +2 -11
- package/dist/tools/warp_grep/agent/runner.cjs +15 -1081
- package/dist/tools/warp_grep/agent/runner.js +7 -14
- package/dist/tools/warp_grep/agent/types.cjs +1 -17
- package/dist/tools/warp_grep/agent/types.js +1 -0
- package/dist/tools/warp_grep/anthropic.cjs +47 -2561
- package/dist/tools/warp_grep/anthropic.js +19 -35
- package/dist/tools/warp_grep/client.cjs +49 -2471
- package/dist/tools/warp_grep/client.js +17 -34
- package/dist/tools/warp_grep/gemini.cjs +48 -2490
- package/dist/tools/warp_grep/gemini.js +21 -41
- package/dist/tools/warp_grep/harness.cjs +81 -936
- package/dist/tools/warp_grep/harness.js +12 -51
- package/dist/tools/warp_grep/index.cjs +124 -2575
- package/dist/tools/warp_grep/index.js +24 -87
- package/dist/tools/warp_grep/openai.cjs +53 -2575
- package/dist/tools/warp_grep/openai.js +19 -37
- package/dist/tools/warp_grep/providers/code_storage_http.cjs +12 -65
- package/dist/tools/warp_grep/providers/code_storage_http.js +2 -9
- package/dist/tools/warp_grep/providers/local.cjs +10 -589
- package/dist/tools/warp_grep/providers/local.js +6 -11
- package/dist/tools/warp_grep/providers/remote.cjs +8 -331
- package/dist/tools/warp_grep/providers/remote.js +3 -8
- package/dist/tools/warp_grep/providers/types.cjs +1 -17
- package/dist/tools/warp_grep/providers/types.js +1 -0
- package/dist/tools/warp_grep/utils/files.cjs +9 -42
- package/dist/tools/warp_grep/utils/files.js +2 -7
- package/dist/tools/warp_grep/utils/github.cjs +9 -43
- package/dist/tools/warp_grep/utils/github.js +2 -7
- package/dist/tools/warp_grep/utils/paths.cjs +28 -104
- package/dist/tools/warp_grep/utils/paths.js +2 -17
- package/dist/tools/warp_grep/utils/ripgrep.cjs +9 -103
- package/dist/tools/warp_grep/utils/ripgrep.js +2 -7
- package/dist/tools/warp_grep/vercel.cjs +53 -2557
- package/dist/tools/warp_grep/vercel.js +19 -37
- package/dist/version.cjs +7 -225
- package/dist/version.js +2 -7
- package/package.json +2 -2
- package/dist/chunk-E6TL6MIH.js +0 -203
|
@@ -1,1063 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this._log("warn", component, msg, data);
|
|
64
|
-
}
|
|
65
|
-
error(component, msg, data) {
|
|
66
|
-
this._log("error", component, msg, data);
|
|
67
|
-
}
|
|
68
|
-
enable() {
|
|
69
|
-
this.enabled = true;
|
|
70
|
-
}
|
|
71
|
-
get isEnabled() {
|
|
72
|
-
return this.enabled;
|
|
73
|
-
}
|
|
74
|
-
_log(level, component, msg, data) {
|
|
75
|
-
if (level !== "error" && !this.enabled) return;
|
|
76
|
-
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
77
|
-
const prefix = `[${ts}] [${level.toUpperCase()}] [${component}]`;
|
|
78
|
-
console.error(data ? `${prefix} ${msg} ${JSON.stringify(data)}` : `${prefix} ${msg}`);
|
|
79
|
-
this.fileStream?.write(JSON.stringify({ ts, level, component, msg, ...data && { data } }) + "\n");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
logger = new MorphLogger();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// package.json
|
|
87
|
-
var package_default;
|
|
88
|
-
var init_package = __esm({
|
|
89
|
-
"package.json"() {
|
|
90
|
-
package_default = {
|
|
91
|
-
name: "@morphllm/morphsdk",
|
|
92
|
-
version: "0.2.202",
|
|
93
|
-
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
94
|
-
type: "module",
|
|
95
|
-
main: "./dist/index.cjs",
|
|
96
|
-
module: "./dist/index.js",
|
|
97
|
-
types: "./dist/index.d.ts",
|
|
98
|
-
exports: {
|
|
99
|
-
".": {
|
|
100
|
-
types: "./dist/index.d.ts",
|
|
101
|
-
import: "./dist/index.js",
|
|
102
|
-
require: "./dist/index.cjs"
|
|
103
|
-
},
|
|
104
|
-
"./logger": {
|
|
105
|
-
types: "./dist/logger.d.ts",
|
|
106
|
-
import: "./dist/logger.js",
|
|
107
|
-
require: "./dist/logger.cjs"
|
|
108
|
-
},
|
|
109
|
-
"./edge": {
|
|
110
|
-
types: "./dist/edge.d.ts",
|
|
111
|
-
import: "./dist/edge.js",
|
|
112
|
-
require: "./dist/edge.cjs"
|
|
113
|
-
},
|
|
114
|
-
"./tools/warp-grep": {
|
|
115
|
-
types: "./dist/tools/warp_grep/index.d.ts",
|
|
116
|
-
import: "./dist/tools/warp_grep/index.js",
|
|
117
|
-
require: "./dist/tools/warp_grep/index.cjs"
|
|
118
|
-
},
|
|
119
|
-
"./tools/warp-grep/openai": {
|
|
120
|
-
types: "./dist/tools/warp_grep/openai.d.ts",
|
|
121
|
-
import: "./dist/tools/warp_grep/openai.js",
|
|
122
|
-
require: "./dist/tools/warp_grep/openai.cjs"
|
|
123
|
-
},
|
|
124
|
-
"./tools/warp-grep/anthropic": {
|
|
125
|
-
types: "./dist/tools/warp_grep/anthropic.d.ts",
|
|
126
|
-
import: "./dist/tools/warp_grep/anthropic.js",
|
|
127
|
-
require: "./dist/tools/warp_grep/anthropic.cjs"
|
|
128
|
-
},
|
|
129
|
-
"./tools/warp-grep/vercel": {
|
|
130
|
-
types: "./dist/tools/warp_grep/vercel.d.ts",
|
|
131
|
-
import: "./dist/tools/warp_grep/vercel.js",
|
|
132
|
-
require: "./dist/tools/warp_grep/vercel.cjs"
|
|
133
|
-
},
|
|
134
|
-
"./tools/warp-grep/client": {
|
|
135
|
-
types: "./dist/tools/warp_grep/client.d.ts",
|
|
136
|
-
import: "./dist/tools/warp_grep/client.js",
|
|
137
|
-
require: "./dist/tools/warp_grep/client.cjs"
|
|
138
|
-
},
|
|
139
|
-
"./tools/warp-grep/gemini": {
|
|
140
|
-
types: "./dist/tools/warp_grep/gemini.d.ts",
|
|
141
|
-
import: "./dist/tools/warp_grep/gemini.js",
|
|
142
|
-
require: "./dist/tools/warp_grep/gemini.cjs"
|
|
143
|
-
},
|
|
144
|
-
"./tools/warp-grep/harness": {
|
|
145
|
-
types: "./dist/tools/warp_grep/harness.d.ts",
|
|
146
|
-
import: "./dist/tools/warp_grep/harness.js",
|
|
147
|
-
require: "./dist/tools/warp_grep/harness.cjs"
|
|
148
|
-
},
|
|
149
|
-
"./tools/fastapply": {
|
|
150
|
-
types: "./dist/tools/fastapply/index.d.ts",
|
|
151
|
-
import: "./dist/tools/fastapply/index.js",
|
|
152
|
-
require: "./dist/tools/fastapply/index.cjs"
|
|
153
|
-
},
|
|
154
|
-
"./tools/fastapply/anthropic": {
|
|
155
|
-
types: "./dist/tools/fastapply/anthropic.d.ts",
|
|
156
|
-
import: "./dist/tools/fastapply/anthropic.js",
|
|
157
|
-
require: "./dist/tools/fastapply/anthropic.cjs"
|
|
158
|
-
},
|
|
159
|
-
"./tools/fastapply/openai": {
|
|
160
|
-
types: "./dist/tools/fastapply/openai.d.ts",
|
|
161
|
-
import: "./dist/tools/fastapply/openai.js",
|
|
162
|
-
require: "./dist/tools/fastapply/openai.cjs"
|
|
163
|
-
},
|
|
164
|
-
"./tools/fastapply/vercel": {
|
|
165
|
-
types: "./dist/tools/fastapply/vercel.d.ts",
|
|
166
|
-
import: "./dist/tools/fastapply/vercel.js",
|
|
167
|
-
require: "./dist/tools/fastapply/vercel.cjs"
|
|
168
|
-
},
|
|
169
|
-
"./modelrouter": {
|
|
170
|
-
types: "./dist/modelrouter/index.d.ts",
|
|
171
|
-
import: "./dist/modelrouter/index.js",
|
|
172
|
-
require: "./dist/modelrouter/index.cjs"
|
|
173
|
-
},
|
|
174
|
-
"./tools/compact": {
|
|
175
|
-
types: "./dist/tools/compact/index.d.ts",
|
|
176
|
-
import: "./dist/tools/compact/index.js",
|
|
177
|
-
require: "./dist/tools/compact/index.cjs"
|
|
178
|
-
},
|
|
179
|
-
"./subagents": {
|
|
180
|
-
types: "./dist/subagents/index.d.ts",
|
|
181
|
-
import: "./dist/subagents/index.js",
|
|
182
|
-
require: "./dist/subagents/index.cjs"
|
|
183
|
-
},
|
|
184
|
-
"./subagents/vercel": {
|
|
185
|
-
types: "./dist/subagents/vercel.d.ts",
|
|
186
|
-
import: "./dist/subagents/vercel.js",
|
|
187
|
-
require: "./dist/subagents/vercel.cjs"
|
|
188
|
-
},
|
|
189
|
-
"./subagents/anthropic": {
|
|
190
|
-
types: "./dist/subagents/anthropic.d.ts",
|
|
191
|
-
import: "./dist/subagents/anthropic.js",
|
|
192
|
-
require: "./dist/subagents/anthropic.cjs"
|
|
193
|
-
},
|
|
194
|
-
"./ai-sdk": {
|
|
195
|
-
types: "./dist/ai-sdk/index.d.ts",
|
|
196
|
-
import: "./dist/ai-sdk/index.js",
|
|
197
|
-
require: "./dist/ai-sdk/index.cjs"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
files: [
|
|
201
|
-
"dist/**/*.js",
|
|
202
|
-
"dist/**/*.cjs",
|
|
203
|
-
"dist/**/*.d.ts",
|
|
204
|
-
"!dist/**/__tests__/**",
|
|
205
|
-
"!dist/**/*.test.*"
|
|
206
|
-
],
|
|
207
|
-
scripts: {
|
|
208
|
-
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts --format esm,cjs --clean --dts --dts-resolve && tsup ai-sdk/index.ts --format esm,cjs --dts --no-clean --out-dir dist/ai-sdk",
|
|
209
|
-
prepare: "npm run build",
|
|
210
|
-
typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
|
|
211
|
-
lint: "eslint .",
|
|
212
|
-
test: "vitest run",
|
|
213
|
-
"test:watch": "vitest watch",
|
|
214
|
-
"test:anthropic": "vitest run anthropic",
|
|
215
|
-
"test:openai": "vitest run openai",
|
|
216
|
-
"test:vercel": "vitest run vercel",
|
|
217
|
-
"test:git": "vitest run git",
|
|
218
|
-
"test:agent": "npx tsx tests/fullAgentTest.ts",
|
|
219
|
-
"test:integration": "npx tsx tests/fullIntegrationTest.ts",
|
|
220
|
-
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
221
|
-
"release:patch": "npm version patch && npm publish",
|
|
222
|
-
"release:minor": "npm version minor && npm publish",
|
|
223
|
-
"release:major": "npm version major && npm publish"
|
|
224
|
-
},
|
|
225
|
-
keywords: [
|
|
226
|
-
"morph",
|
|
227
|
-
"fast-apply",
|
|
228
|
-
"cli",
|
|
229
|
-
"sdk",
|
|
230
|
-
"edit-file"
|
|
231
|
-
],
|
|
232
|
-
engines: {
|
|
233
|
-
node: ">=18"
|
|
234
|
-
},
|
|
235
|
-
license: "MIT",
|
|
236
|
-
dependencies: {
|
|
237
|
-
"@vscode/ripgrep": "^1.17.0",
|
|
238
|
-
ai: ">=5.0.0",
|
|
239
|
-
diff: "^7.0.0",
|
|
240
|
-
openai: "^4.52.7",
|
|
241
|
-
zod: ">=3.23.0"
|
|
242
|
-
},
|
|
243
|
-
devDependencies: {
|
|
244
|
-
"@ai-sdk/anthropic": "^2.0.70",
|
|
245
|
-
"@ai-sdk/openai": "^2.0.35",
|
|
246
|
-
"@anthropic-ai/sdk": "^0.30.1",
|
|
247
|
-
"@google/generative-ai": "^0.24.1",
|
|
248
|
-
"@types/diff": "^7.0.2",
|
|
249
|
-
"@types/node": "^20.14.10",
|
|
250
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
251
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
252
|
-
dotenv: "^16.4.5",
|
|
253
|
-
eslint: "^8.57.0",
|
|
254
|
-
shx: "^0.3.4",
|
|
255
|
-
tsup: "^8.5.0",
|
|
256
|
-
tsx: "^4.16.2",
|
|
257
|
-
typescript: "^5.5.4",
|
|
258
|
-
vitest: "^2.1.6"
|
|
259
|
-
},
|
|
260
|
-
peerDependencies: {
|
|
261
|
-
"@ai-sdk/openai-compatible": ">=2.0.74 <4",
|
|
262
|
-
"@anthropic-ai/sdk": ">=0.25.0",
|
|
263
|
-
"@google/generative-ai": ">=0.21.0",
|
|
264
|
-
ai: ">=5.0.0",
|
|
265
|
-
zod: ">=3.23.0"
|
|
266
|
-
},
|
|
267
|
-
peerDependenciesMeta: {
|
|
268
|
-
"@anthropic-ai/sdk": {
|
|
269
|
-
optional: true
|
|
270
|
-
},
|
|
271
|
-
"@google/generative-ai": {
|
|
272
|
-
optional: true
|
|
273
|
-
},
|
|
274
|
-
ai: {
|
|
275
|
-
optional: true
|
|
276
|
-
},
|
|
277
|
-
zod: {
|
|
278
|
-
optional: true
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
publishConfig: {
|
|
282
|
-
access: "public"
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
// version.ts
|
|
289
|
-
var SDK_VERSION;
|
|
290
|
-
var init_version = __esm({
|
|
291
|
-
"version.ts"() {
|
|
292
|
-
"use strict";
|
|
293
|
-
init_package();
|
|
294
|
-
SDK_VERSION = package_default.version;
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
// tools/fastapply/anchors.ts
|
|
299
|
-
function escapeRegExp(value) {
|
|
300
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
301
|
-
}
|
|
302
|
-
function findNamespace(values) {
|
|
303
|
-
for (let namespace = 0; namespace < Number.MAX_SAFE_INTEGER; namespace++) {
|
|
304
|
-
const prefix = `\u27EAM${namespace}:`;
|
|
305
|
-
if (values.every((value) => !value.includes(prefix))) {
|
|
306
|
-
return namespace;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
throw new Error("Unable to allocate a Fast Apply anchor namespace");
|
|
310
|
-
}
|
|
311
|
-
function htmlLabel(token) {
|
|
312
|
-
if (!token.startsWith("<")) return "text";
|
|
313
|
-
const match = token.match(/^<\s*(!doctype|\/?[a-zA-Z][\w:-]*)/);
|
|
314
|
-
return (match?.[1] ?? "tag").toLowerCase();
|
|
315
|
-
}
|
|
316
|
-
function htmlTokenUnits(value, visibleTags = /* @__PURE__ */ new Set()) {
|
|
317
|
-
return (value.match(/<[^>]*>|[^<]+/g) ?? [value]).map((token) => ({
|
|
318
|
-
value: token,
|
|
319
|
-
label: htmlLabel(token),
|
|
320
|
-
anchorable: token.length >= DEFAULT_MIN_ANCHOR_LINE_LENGTH && !visibleTags.has(htmlLabel(token).replace(/^\//, ""))
|
|
321
|
-
}));
|
|
322
|
-
}
|
|
323
|
-
function sourceUnits(originalCode, editContext) {
|
|
324
|
-
const trimmed = originalCode.trimStart().toLowerCase();
|
|
325
|
-
const looksLikeHtml = (trimmed.startsWith("<!doctype") || trimmed.startsWith("<html")) && /<\/html\s*>/i.test(originalCode);
|
|
326
|
-
if (looksLikeHtml) {
|
|
327
|
-
const contextWords = new Set(
|
|
328
|
-
editContext.join(" ").toLowerCase().match(/[a-z][\w:-]*/g) ?? []
|
|
329
|
-
);
|
|
330
|
-
return htmlTokenUnits(originalCode, contextWords);
|
|
331
|
-
}
|
|
332
|
-
const parts = originalCode.split(/(\r\n|\n|\r)/);
|
|
333
|
-
const units = [];
|
|
334
|
-
for (let index = 0; index < parts.length; index += 2) {
|
|
335
|
-
const line = parts[index] ?? "";
|
|
336
|
-
const lineEnding = parts[index + 1] ?? "";
|
|
337
|
-
units.push({
|
|
338
|
-
value: line,
|
|
339
|
-
label: "line",
|
|
340
|
-
anchorable: line.length >= DEFAULT_MIN_ANCHOR_LINE_LENGTH
|
|
341
|
-
});
|
|
342
|
-
if (lineEnding) {
|
|
343
|
-
units.push({ value: lineEnding, anchorable: false });
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return units;
|
|
347
|
-
}
|
|
348
|
-
function copyCount(value) {
|
|
349
|
-
const words = {
|
|
350
|
-
one: 1,
|
|
351
|
-
two: 2,
|
|
352
|
-
three: 3,
|
|
353
|
-
four: 4,
|
|
354
|
-
five: 5,
|
|
355
|
-
six: 6,
|
|
356
|
-
seven: 7,
|
|
357
|
-
eight: 8,
|
|
358
|
-
nine: 9,
|
|
359
|
-
ten: 10
|
|
360
|
-
};
|
|
361
|
-
return /^\d+$/.test(value) ? Number(value) : words[value.toLowerCase()];
|
|
362
|
-
}
|
|
363
|
-
function structuralExpectation(originalCode, editContext) {
|
|
364
|
-
const context = editContext.join(" ");
|
|
365
|
-
const match = context.match(
|
|
366
|
-
/(?:for every|for each|each)\s+([a-z][\w:-]*)[\s\S]{0,120}?add\s+(one|two|three|four|five|six|seven|eight|nine|ten|\d+)\s+identical cop(?:y|ies)/i
|
|
367
|
-
);
|
|
368
|
-
if (!match) return void 0;
|
|
369
|
-
const tag = match[1].toLowerCase();
|
|
370
|
-
const addedCopies = copyCount(match[2]);
|
|
371
|
-
if (addedCopies === void 0) return void 0;
|
|
372
|
-
const tagPattern = new RegExp(`<${escapeRegExp(tag)}(?:\\s|>)`, "gi");
|
|
373
|
-
const originalCount = originalCode.match(tagPattern)?.length ?? 0;
|
|
374
|
-
if (originalCount === 0) return void 0;
|
|
375
|
-
return { tag, expectedCount: originalCount * (addedCopies + 1) };
|
|
376
|
-
}
|
|
377
|
-
function createAnchorCompactionPlan(originalCode, collisionValues = []) {
|
|
378
|
-
const namespace = findNamespace([originalCode, ...collisionValues]);
|
|
379
|
-
const expectation = structuralExpectation(originalCode, collisionValues);
|
|
380
|
-
const markerPrefix = `\u27EAM${namespace}:`;
|
|
381
|
-
const definitions = /* @__PURE__ */ new Map();
|
|
382
|
-
const values = [];
|
|
383
|
-
const markers = [];
|
|
384
|
-
let anchorCount = 0;
|
|
385
|
-
let skeleton = "";
|
|
386
|
-
for (const unit of sourceUnits(originalCode, collisionValues)) {
|
|
387
|
-
if (!unit.anchorable) {
|
|
388
|
-
skeleton += unit.value;
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
let id = definitions.get(unit.value);
|
|
392
|
-
if (id === void 0) {
|
|
393
|
-
id = values.length;
|
|
394
|
-
definitions.set(unit.value, id);
|
|
395
|
-
values.push(unit.value);
|
|
396
|
-
markers.push(`${markerPrefix}${id}:${unit.label ?? "unit"}\u27EB`);
|
|
397
|
-
}
|
|
398
|
-
skeleton += markers[id];
|
|
399
|
-
anchorCount++;
|
|
400
|
-
}
|
|
401
|
-
if (anchorCount === 0 || skeleton.length >= originalCode.length) {
|
|
402
|
-
return void 0;
|
|
403
|
-
}
|
|
404
|
-
const definitionsBegin = `\u27EAMORPH_DEFINITIONS_BEGIN_${namespace}\u27EB`;
|
|
405
|
-
const definitionsEnd = `\u27EAMORPH_DEFINITIONS_END_${namespace}\u27EB`;
|
|
406
|
-
const codeBegin = `\u27EAMORPH_CODE_BEGIN_${namespace}\u27EB`;
|
|
407
|
-
const serializedDefinitions = values.map((value, id) => `${markers[id]}=${JSON.stringify(value)}`).join("\n");
|
|
408
|
-
const code = [
|
|
409
|
-
definitionsBegin,
|
|
410
|
-
serializedDefinitions,
|
|
411
|
-
definitionsEnd,
|
|
412
|
-
codeBegin,
|
|
413
|
-
skeleton
|
|
414
|
-
].join("\n");
|
|
415
|
-
const instructionSuffix = `
|
|
416
|
-
|
|
417
|
-
LARGE-FILE ANCHOR PROTOCOL:
|
|
418
|
-
The <code> block starts with an exact anchor definition table, then ${codeBegin}, then the source skeleton.
|
|
419
|
-
Each ${markerPrefix}N:kind\u27EB placeholder represents the exact source fragment in its matching JSON-string definition. The kind suffix describes its HTML tag, text, or source line.
|
|
420
|
-
Return only the updated source skeleton after ${codeBegin}; never return the definition table or protocol delimiters.
|
|
421
|
-
Copy a placeholder exactly when its source fragment is unchanged. You may repeat, reorder, or remove placeholders when the requested edit requires it.
|
|
422
|
-
To modify an anchored fragment, output the modified source instead of its placeholder.
|
|
423
|
-
Do not invent or alter placeholder IDs.`;
|
|
424
|
-
const markerPattern = new RegExp(`${escapeRegExp(markerPrefix)}(\\d+):[^\u27EB]+\u27EB`, "g");
|
|
425
|
-
return {
|
|
426
|
-
code,
|
|
427
|
-
instructionSuffix,
|
|
428
|
-
anchorCount,
|
|
429
|
-
uniqueAnchorCount: values.length,
|
|
430
|
-
hasStructuralValidation: expectation !== void 0,
|
|
431
|
-
expand(content) {
|
|
432
|
-
const codeBeginIndex = content.lastIndexOf(codeBegin);
|
|
433
|
-
const skeletonContent = codeBeginIndex >= 0 ? content.slice(codeBeginIndex + codeBegin.length).replace(/^\r?\n/, "") : content;
|
|
434
|
-
const expanded = skeletonContent.replace(markerPattern, (marker, idText) => {
|
|
435
|
-
const id = Number(idText);
|
|
436
|
-
const value = values[id];
|
|
437
|
-
return value === void 0 || markers[id] !== marker ? marker : value;
|
|
438
|
-
});
|
|
439
|
-
if (expanded.includes(markerPrefix)) {
|
|
440
|
-
throw new FastApplyAnchorIntegrityError();
|
|
441
|
-
}
|
|
442
|
-
if (expectation) {
|
|
443
|
-
const tagPattern = new RegExp(`<${escapeRegExp(expectation.tag)}(?:\\s|>)`, "gi");
|
|
444
|
-
const actualCount = expanded.match(tagPattern)?.length ?? 0;
|
|
445
|
-
if (actualCount !== expectation.expectedCount) {
|
|
446
|
-
throw new FastApplyAnchorIntegrityError();
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return expanded;
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
var DEFAULT_MIN_ANCHOR_LINE_LENGTH, DEFAULT_ANCHOR_COMPACTION_THRESHOLD, FastApplyAnchorIntegrityError;
|
|
454
|
-
var init_anchors = __esm({
|
|
455
|
-
"tools/fastapply/anchors.ts"() {
|
|
456
|
-
"use strict";
|
|
457
|
-
DEFAULT_MIN_ANCHOR_LINE_LENGTH = 24;
|
|
458
|
-
DEFAULT_ANCHOR_COMPACTION_THRESHOLD = 128 * 1024;
|
|
459
|
-
FastApplyAnchorIntegrityError = class extends Error {
|
|
460
|
-
code = "anchor_integrity_failed";
|
|
461
|
-
completionId;
|
|
462
|
-
constructor(completionId) {
|
|
463
|
-
super(
|
|
464
|
-
"Fast Apply failed large-file anchor integrity checks. The partial result was discarded safely."
|
|
465
|
-
);
|
|
466
|
-
this.name = "FastApplyAnchorIntegrityError";
|
|
467
|
-
this.completionId = completionId;
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// tools/fastapply/apply.ts
|
|
474
|
-
var apply_exports = {};
|
|
475
|
-
__export(apply_exports, {
|
|
476
|
-
FastApplyAnchorIntegrityError: () => FastApplyAnchorIntegrityError,
|
|
477
|
-
FastApplyContextLengthError: () => FastApplyContextLengthError,
|
|
478
|
-
applyEdit: () => applyEdit,
|
|
479
|
-
callMorphAPI: () => callMorphAPI,
|
|
480
|
-
countChanges: () => countChanges,
|
|
481
|
-
generateUdiff: () => generateUdiff
|
|
482
|
-
});
|
|
483
|
-
function isAsyncIterable(value) {
|
|
484
|
-
return typeof value === "object" && value !== null && Symbol.asyncIterator in value;
|
|
485
|
-
}
|
|
486
|
-
async function collectCompletion(response) {
|
|
487
|
-
if (!isAsyncIterable(response)) {
|
|
488
|
-
const completion = response;
|
|
489
|
-
return {
|
|
490
|
-
content: completion.choices?.[0]?.message?.content ?? "",
|
|
491
|
-
completionId: completion.id,
|
|
492
|
-
finishReason: completion.choices?.[0]?.finish_reason
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
const content = [];
|
|
496
|
-
let completionId;
|
|
497
|
-
let finishReason;
|
|
498
|
-
for await (const chunk of response) {
|
|
499
|
-
completionId = chunk.id ?? completionId;
|
|
500
|
-
for (const choice of chunk.choices ?? []) {
|
|
501
|
-
if (choice.delta?.content) {
|
|
502
|
-
content.push(choice.delta.content);
|
|
503
|
-
}
|
|
504
|
-
if (choice.finish_reason !== void 0 && choice.finish_reason !== null) {
|
|
505
|
-
finishReason = choice.finish_reason;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return { content: content.join(""), completionId, finishReason };
|
|
510
|
-
}
|
|
511
|
-
function generateUdiff(original, modified, filepath) {
|
|
512
|
-
return (0, import_diff.createTwoFilesPatch)(
|
|
513
|
-
filepath,
|
|
514
|
-
filepath,
|
|
515
|
-
original,
|
|
516
|
-
modified,
|
|
517
|
-
"Original",
|
|
518
|
-
"Modified"
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
function countChanges(original, modified) {
|
|
522
|
-
const diff = generateUdiff(original, modified, "file");
|
|
523
|
-
const lines = diff.split("\n");
|
|
524
|
-
let linesAdded = 0;
|
|
525
|
-
let linesRemoved = 0;
|
|
526
|
-
for (const line of lines) {
|
|
527
|
-
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
528
|
-
linesAdded++;
|
|
529
|
-
} else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
530
|
-
linesRemoved++;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
const linesModified = Math.min(linesAdded, linesRemoved);
|
|
534
|
-
return {
|
|
535
|
-
linesAdded: linesAdded - linesModified,
|
|
536
|
-
linesRemoved: linesRemoved - linesModified,
|
|
537
|
-
linesModified
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
async function callMorphAPI(originalCode, codeEdit, instructions, filepath, config) {
|
|
541
|
-
const apiKey = config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
542
|
-
const apiUrl = config.morphApiUrl || DEFAULT_API_URL;
|
|
543
|
-
const useLarge = config.large ?? (typeof process !== "undefined" ? process.env?.MORPH_LARGE_APPLY !== "false" : true);
|
|
544
|
-
const model = useLarge ? "morph-v3-large" : "morph-v3-fast";
|
|
545
|
-
const timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
546
|
-
const debug = config.debug || false;
|
|
547
|
-
if (!apiKey) {
|
|
548
|
-
throw new Error(
|
|
549
|
-
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
const anchorThreshold = config.anchorCompactionThreshold ?? DEFAULT_ANCHOR_COMPACTION_THRESHOLD;
|
|
553
|
-
const anchorPlan = config.anchorCompaction !== false && originalCode.length >= anchorThreshold ? createAnchorCompactionPlan(originalCode, [codeEdit, instructions]) : void 0;
|
|
554
|
-
const requestCode = anchorPlan?.code ?? originalCode;
|
|
555
|
-
const requestInstructions = anchorPlan ? instructions + anchorPlan.instructionSuffix : instructions;
|
|
556
|
-
const message = `<instruction>${requestInstructions}</instruction>
|
|
557
|
-
<code>${requestCode}</code>
|
|
558
|
-
<update>${codeEdit}</update>`;
|
|
559
|
-
logger.debug("FastApply", "http_request", {
|
|
560
|
-
url: `${apiUrl}/v1/chat/completions`,
|
|
561
|
-
model,
|
|
562
|
-
filepath,
|
|
563
|
-
instruction_len: instructions.length,
|
|
564
|
-
original_len: originalCode.length,
|
|
565
|
-
request_code_len: requestCode.length,
|
|
566
|
-
code_edit_len: codeEdit.length,
|
|
567
|
-
anchor_count: anchorPlan?.anchorCount ?? 0,
|
|
568
|
-
unique_anchor_count: anchorPlan?.uniqueAnchorCount ?? 0
|
|
569
|
-
});
|
|
570
|
-
const startTime = Date.now();
|
|
571
|
-
const client = new import_openai.default({
|
|
572
|
-
apiKey,
|
|
573
|
-
baseURL: `${apiUrl}/v1`,
|
|
574
|
-
timeout,
|
|
575
|
-
maxRetries: config.retryConfig?.maxRetries ?? 3,
|
|
576
|
-
defaultHeaders: {
|
|
577
|
-
"X-Morph-SDK-Version": SDK_VERSION,
|
|
578
|
-
...anchorPlan ? { "X-Morph-Apply-Context": "extralong" } : {}
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
try {
|
|
582
|
-
const maxAttempts = anchorPlan?.hasStructuralValidation ? 2 : 1;
|
|
583
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
584
|
-
const response = await client.chat.completions.create({
|
|
585
|
-
model,
|
|
586
|
-
messages: [{ role: "user", content: message }],
|
|
587
|
-
stream: true
|
|
588
|
-
});
|
|
589
|
-
const completion = await collectCompletion(response);
|
|
590
|
-
if (completion.finishReason === "length") {
|
|
591
|
-
throw new FastApplyContextLengthError(completion.completionId);
|
|
592
|
-
}
|
|
593
|
-
let content = completion.content;
|
|
594
|
-
if (!content) {
|
|
595
|
-
throw new Error("Morph API returned empty response");
|
|
596
|
-
}
|
|
597
|
-
if (anchorPlan) {
|
|
598
|
-
try {
|
|
599
|
-
content = anchorPlan.expand(content);
|
|
600
|
-
} catch (error) {
|
|
601
|
-
if (error instanceof FastApplyAnchorIntegrityError) {
|
|
602
|
-
if (attempt < maxAttempts) {
|
|
603
|
-
logger.warn("FastApply", "anchor_validation_retry", {
|
|
604
|
-
attempt,
|
|
605
|
-
completion_id: completion.completionId
|
|
606
|
-
});
|
|
607
|
-
continue;
|
|
608
|
-
}
|
|
609
|
-
throw new FastApplyAnchorIntegrityError(completion.completionId);
|
|
610
|
-
}
|
|
611
|
-
throw error;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
const elapsed = Date.now() - startTime;
|
|
615
|
-
logger.debug("FastApply", "http_response", { status: 200, completion_id: completion.completionId, content_len: content.length, latency_ms: elapsed });
|
|
616
|
-
return { content, completionId: completion.completionId };
|
|
617
|
-
}
|
|
618
|
-
throw new FastApplyAnchorIntegrityError();
|
|
619
|
-
} catch (error) {
|
|
620
|
-
const elapsed = Date.now() - startTime;
|
|
621
|
-
const status = error?.status || error?.response?.status;
|
|
622
|
-
logger.error("FastApply", "http_error", {
|
|
623
|
-
status,
|
|
624
|
-
error: error?.message,
|
|
625
|
-
latency_ms: elapsed
|
|
626
|
-
});
|
|
627
|
-
if (status === 401) {
|
|
628
|
-
const err = new Error(
|
|
629
|
-
"Authentication failed: Your Morph API key is invalid or has been revoked. Please visit https://morphllm.com to get a valid API key, then update your MCP configuration."
|
|
630
|
-
);
|
|
631
|
-
err.status = 401;
|
|
632
|
-
throw err;
|
|
633
|
-
}
|
|
634
|
-
if (status === 429) {
|
|
635
|
-
const err = new Error(
|
|
636
|
-
"Rate limited: You've exceeded your Morph API usage limits. Please visit https://morphllm.com to check your plan and purchase additional credits."
|
|
637
|
-
);
|
|
638
|
-
err.status = 429;
|
|
639
|
-
throw err;
|
|
640
|
-
}
|
|
641
|
-
throw error;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
async function applyEdit(input, config = {}) {
|
|
645
|
-
const filepath = input.filepath || "file";
|
|
646
|
-
try {
|
|
647
|
-
logger.debug("FastApply", "apply_edit_start", { original_len: input.originalCode.length, code_edit_len: input.codeEdit.length });
|
|
648
|
-
const instruction = input.instruction ?? input.instructions ?? "";
|
|
649
|
-
const { content: mergedCode, completionId } = await callMorphAPI(
|
|
650
|
-
input.originalCode,
|
|
651
|
-
input.codeEdit,
|
|
652
|
-
instruction,
|
|
653
|
-
filepath,
|
|
654
|
-
config
|
|
655
|
-
);
|
|
656
|
-
const udiff = config.generateUdiff !== false ? generateUdiff(input.originalCode, mergedCode, filepath) : void 0;
|
|
657
|
-
const changes = countChanges(input.originalCode, mergedCode);
|
|
658
|
-
return {
|
|
659
|
-
success: true,
|
|
660
|
-
mergedCode,
|
|
661
|
-
udiff,
|
|
662
|
-
changes,
|
|
663
|
-
completionId
|
|
664
|
-
};
|
|
665
|
-
} catch (error) {
|
|
666
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
667
|
-
logger.error("FastApply", "apply_edit_error", { error: errorMessage });
|
|
668
|
-
const structuredError = error instanceof FastApplyContextLengthError || error instanceof FastApplyAnchorIntegrityError ? error : void 0;
|
|
669
|
-
return {
|
|
670
|
-
success: false,
|
|
671
|
-
changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },
|
|
672
|
-
error: errorMessage,
|
|
673
|
-
errorCode: structuredError?.code,
|
|
674
|
-
completionId: structuredError?.completionId
|
|
675
|
-
};
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
var import_diff, import_openai, DEFAULT_API_URL, DEFAULT_TIMEOUT, FastApplyContextLengthError;
|
|
679
|
-
var init_apply = __esm({
|
|
680
|
-
"tools/fastapply/apply.ts"() {
|
|
681
|
-
"use strict";
|
|
682
|
-
import_diff = require("diff");
|
|
683
|
-
import_openai = __toESM(require("openai"), 1);
|
|
684
|
-
init_version();
|
|
685
|
-
init_logger();
|
|
686
|
-
init_anchors();
|
|
687
|
-
init_anchors();
|
|
688
|
-
DEFAULT_API_URL = "https://api.morphllm.com";
|
|
689
|
-
DEFAULT_TIMEOUT = 6e5;
|
|
690
|
-
FastApplyContextLengthError = class extends Error {
|
|
691
|
-
code = "context_length_exceeded";
|
|
692
|
-
completionId;
|
|
693
|
-
constructor(completionId) {
|
|
694
|
-
super(
|
|
695
|
-
"Fast Apply exhausted its context window before producing the complete file. Retry with a smaller input/update or use sparse anchors for unchanged code."
|
|
696
|
-
);
|
|
697
|
-
this.name = "FastApplyContextLengthError";
|
|
698
|
-
this.completionId = completionId;
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
// tools/fastapply/index.ts
|
|
705
|
-
var fastapply_exports = {};
|
|
706
|
-
__export(fastapply_exports, {
|
|
707
|
-
EDIT_FILE_SYSTEM_PROMPT: () => EDIT_FILE_SYSTEM_PROMPT,
|
|
708
|
-
EDIT_FILE_TOOL_DESCRIPTION: () => EDIT_FILE_TOOL_DESCRIPTION,
|
|
709
|
-
FastApplyAnchorIntegrityError: () => FastApplyAnchorIntegrityError,
|
|
710
|
-
FastApplyContextLengthError: () => FastApplyContextLengthError,
|
|
711
|
-
anthropic: () => anthropic_exports,
|
|
712
|
-
applyEdit: () => applyEdit,
|
|
713
|
-
countChanges: () => countChanges,
|
|
714
|
-
executeEditFile: () => executeEditFile,
|
|
715
|
-
generateUdiff: () => generateUdiff,
|
|
716
|
-
openai: () => openai_exports,
|
|
717
|
-
vercel: () => vercel_exports
|
|
718
|
-
});
|
|
719
|
-
module.exports = __toCommonJS(fastapply_exports);
|
|
720
|
-
|
|
721
|
-
// tools/fastapply/core.ts
|
|
722
|
-
var import_path = require("path");
|
|
723
|
-
init_logger();
|
|
724
|
-
|
|
725
|
-
// tools/utils/resilience.ts
|
|
726
|
-
init_version();
|
|
727
|
-
|
|
728
|
-
// core/client.ts
|
|
729
|
-
init_logger();
|
|
730
|
-
init_version();
|
|
731
|
-
|
|
732
|
-
// tools/fastapply/core.ts
|
|
733
|
-
init_apply();
|
|
734
|
-
init_apply();
|
|
735
|
-
var DEFAULT_CONFIG = {
|
|
736
|
-
morphApiUrl: "https://api.morphllm.com",
|
|
737
|
-
baseDir: process.cwd(),
|
|
738
|
-
generateUdiff: true,
|
|
739
|
-
autoWrite: true,
|
|
740
|
-
timeout: 6e5,
|
|
741
|
-
anchorCompaction: true,
|
|
742
|
-
anchorCompactionThreshold: 128 * 1024,
|
|
743
|
-
debug: false
|
|
744
|
-
};
|
|
745
|
-
async function executeEditFile(input, config = {}) {
|
|
746
|
-
const baseDir = config.baseDir || DEFAULT_CONFIG.baseDir;
|
|
747
|
-
const fullPath = (0, import_path.resolve)((0, import_path.join)(baseDir, input.target_filepath));
|
|
748
|
-
logger.debug("FastApply", "execute_start", { target_filepath: input.target_filepath, baseDir, autoWrite: config.autoWrite !== false });
|
|
749
|
-
const relativePath = (0, import_path.relative)(baseDir, fullPath);
|
|
750
|
-
if (relativePath.startsWith("..") || fullPath === baseDir) {
|
|
751
|
-
logger.warn("FastApply", "security_check_failed", { target_filepath: input.target_filepath, relative: relativePath });
|
|
752
|
-
return {
|
|
753
|
-
success: false,
|
|
754
|
-
filepath: input.target_filepath,
|
|
755
|
-
changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },
|
|
756
|
-
error: `Invalid filepath: '${input.target_filepath}' is outside baseDir`
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
logger.debug("FastApply", "security_check", { resolved: fullPath, relative: relativePath });
|
|
760
|
-
try {
|
|
761
|
-
const { readFile, writeFile } = await import("fs/promises");
|
|
762
|
-
const { callMorphAPI: callMorphAPI2, generateUdiff: generateUdiff2, countChanges: countChanges2 } = await Promise.resolve().then(() => (init_apply(), apply_exports));
|
|
763
|
-
let originalCode = "";
|
|
764
|
-
let fileExists = true;
|
|
765
|
-
try {
|
|
766
|
-
originalCode = await readFile(fullPath, "utf-8");
|
|
767
|
-
logger.debug("FastApply", "file_read", { path: fullPath, exists: true, size_bytes: originalCode.length });
|
|
768
|
-
} catch (error) {
|
|
769
|
-
if (error.code !== "ENOENT") {
|
|
770
|
-
throw error;
|
|
771
|
-
}
|
|
772
|
-
fileExists = false;
|
|
773
|
-
logger.debug("FastApply", "file_read", { path: fullPath, exists: false });
|
|
774
|
-
}
|
|
775
|
-
const instruction = input.instruction ?? input.instructions ?? "";
|
|
776
|
-
logger.debug("FastApply", "api_call", { instruction_len: instruction.length, code_edit_len: input.code_edit.length, original_len: originalCode.length });
|
|
777
|
-
const { content: mergedCode, completionId } = await callMorphAPI2(originalCode, input.code_edit, instruction, input.target_filepath, config);
|
|
778
|
-
logger.debug("FastApply", "api_response", { completion_id: completionId, merged_len: mergedCode.length });
|
|
779
|
-
const udiff = config.generateUdiff !== false ? generateUdiff2(originalCode, mergedCode, input.target_filepath) : void 0;
|
|
780
|
-
if (config.autoWrite !== false) {
|
|
781
|
-
await writeFile(fullPath, mergedCode, "utf-8");
|
|
782
|
-
logger.debug("FastApply", "file_write", { path: fullPath, size_bytes: mergedCode.length });
|
|
783
|
-
}
|
|
784
|
-
const changes = countChanges2(originalCode, mergedCode);
|
|
785
|
-
logger.debug("FastApply", "changes", { added: changes.linesAdded, removed: changes.linesRemoved, modified: changes.linesModified });
|
|
786
|
-
return {
|
|
787
|
-
success: true,
|
|
788
|
-
filepath: input.target_filepath,
|
|
789
|
-
udiff,
|
|
790
|
-
changes,
|
|
791
|
-
completionId
|
|
792
|
-
};
|
|
793
|
-
} catch (error) {
|
|
794
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
795
|
-
const structuredError = error instanceof FastApplyContextLengthError || error instanceof FastApplyAnchorIntegrityError ? error : void 0;
|
|
796
|
-
logger.error("FastApply", "execute_error", { error: errorMessage, target_filepath: input.target_filepath, stack: error instanceof Error ? error.stack : void 0 });
|
|
797
|
-
return {
|
|
798
|
-
success: false,
|
|
799
|
-
filepath: input.target_filepath,
|
|
800
|
-
changes: { linesAdded: 0, linesRemoved: 0, linesModified: 0 },
|
|
801
|
-
error: errorMessage,
|
|
802
|
-
errorCode: structuredError?.code,
|
|
803
|
-
completionId: structuredError?.completionId
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
// tools/fastapply/prompts.ts
|
|
809
|
-
var EDIT_FILE_TOOL_DESCRIPTION = `Use this tool to make an edit to an existing file.
|
|
810
|
-
|
|
811
|
-
This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
|
|
812
|
-
|
|
813
|
-
When writing the edit, you should specify each edit in sequence, with the special comment // ... existing code ... to represent unchanged code in between edited lines.
|
|
814
|
-
|
|
815
|
-
For example:
|
|
816
|
-
|
|
817
|
-
// ... existing code ...
|
|
818
|
-
FIRST_EDIT
|
|
819
|
-
// ... existing code ...
|
|
820
|
-
SECOND_EDIT
|
|
821
|
-
// ... existing code ...
|
|
822
|
-
THIRD_EDIT
|
|
823
|
-
// ... existing code ...
|
|
824
|
-
|
|
825
|
-
You should still bias towards repeating as few lines of the original file as possible to convey the change.
|
|
826
|
-
But, each edit should contain minimally sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
|
|
827
|
-
|
|
828
|
-
DO NOT omit spans of pre-existing code (or comments) without using the // ... existing code ... comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
|
|
829
|
-
|
|
830
|
-
If you plan on deleting a section, you must provide context before and after to delete it.
|
|
831
|
-
|
|
832
|
-
Make sure it is clear what the edit should be, and where it should be applied.
|
|
833
|
-
Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.`;
|
|
834
|
-
var EDIT_FILE_SYSTEM_PROMPT = `When the user is asking for edits to their code, use the edit_file tool to highlight the changes necessary and add comments to indicate where unchanged code has been skipped. For example:
|
|
835
|
-
|
|
836
|
-
// ... existing code ...
|
|
837
|
-
{{ edit_1 }}
|
|
838
|
-
// ... existing code ...
|
|
839
|
-
{{ edit_2 }}
|
|
840
|
-
// ... existing code ...
|
|
841
|
-
|
|
842
|
-
Often this will mean that the start/end of the file will be skipped, but that's okay! Rewrite the entire file ONLY if specifically requested. Always provide a brief explanation of the updates, unless the user specifically requests only the code.
|
|
843
|
-
|
|
844
|
-
These edit codeblocks are also read by a less intelligent language model, colloquially called the apply model, to update the file. To help specify the edit to the apply model, you will be very careful when generating the codeblock to not introduce ambiguity. You will specify all unchanged regions (code and comments) of the file with "// ... existing code ..." comment markers. This will ensure the apply model will not delete existing unchanged code or comments when editing the file.`;
|
|
845
|
-
|
|
846
|
-
// tools/fastapply/anthropic.ts
|
|
847
|
-
var anthropic_exports = {};
|
|
848
|
-
__export(anthropic_exports, {
|
|
849
|
-
createEditFileTool: () => createEditFileTool,
|
|
850
|
-
editFileTool: () => editFileTool,
|
|
851
|
-
execute: () => execute,
|
|
852
|
-
formatResult: () => formatResult,
|
|
853
|
-
getSystemPrompt: () => getSystemPrompt
|
|
854
|
-
});
|
|
855
|
-
var editFileTool = {
|
|
856
|
-
name: "edit_file",
|
|
857
|
-
description: EDIT_FILE_TOOL_DESCRIPTION,
|
|
858
|
-
input_schema: {
|
|
859
|
-
type: "object",
|
|
860
|
-
properties: {
|
|
861
|
-
target_filepath: {
|
|
862
|
-
type: "string",
|
|
863
|
-
description: "The path of the target file to modify"
|
|
864
|
-
},
|
|
865
|
-
instruction: {
|
|
866
|
-
type: "string",
|
|
867
|
-
description: "A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."
|
|
868
|
-
},
|
|
869
|
-
code_edit: {
|
|
870
|
-
type: "string",
|
|
871
|
-
description: "Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections."
|
|
872
|
-
}
|
|
873
|
-
},
|
|
874
|
-
required: ["target_filepath", "instruction", "code_edit"]
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
function formatResult(result) {
|
|
878
|
-
if (!result.success) {
|
|
879
|
-
return `Error editing file: ${result.error}`;
|
|
880
|
-
}
|
|
881
|
-
const { changes } = result;
|
|
882
|
-
return `Successfully applied changes to ${result.filepath}. Added ${changes.linesAdded}, removed ${changes.linesRemoved}, modified ${changes.linesModified}.`;
|
|
883
|
-
}
|
|
884
|
-
function createEditFileTool(config = {}) {
|
|
885
|
-
const toolDef = {
|
|
886
|
-
...editFileTool,
|
|
887
|
-
...config.description && { description: config.description }
|
|
888
|
-
};
|
|
889
|
-
return Object.assign({}, toolDef, {
|
|
890
|
-
execute: async (input) => {
|
|
891
|
-
return executeEditFile(input, config);
|
|
892
|
-
},
|
|
893
|
-
formatResult: (result) => {
|
|
894
|
-
return formatResult(result);
|
|
895
|
-
},
|
|
896
|
-
getSystemPrompt: () => {
|
|
897
|
-
return EDIT_FILE_SYSTEM_PROMPT;
|
|
898
|
-
}
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
async function execute(input, config) {
|
|
902
|
-
return executeEditFile(input, config);
|
|
903
|
-
}
|
|
904
|
-
function getSystemPrompt() {
|
|
905
|
-
return EDIT_FILE_SYSTEM_PROMPT;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
// tools/fastapply/openai.ts
|
|
909
|
-
var openai_exports = {};
|
|
910
|
-
__export(openai_exports, {
|
|
911
|
-
createEditFileTool: () => createEditFileTool2,
|
|
912
|
-
default: () => openai_default,
|
|
913
|
-
editFileTool: () => editFileTool2,
|
|
914
|
-
execute: () => execute2,
|
|
915
|
-
formatResult: () => formatResult2,
|
|
916
|
-
getSystemPrompt: () => getSystemPrompt2
|
|
917
|
-
});
|
|
918
|
-
var editFileTool2 = {
|
|
919
|
-
type: "function",
|
|
920
|
-
function: {
|
|
921
|
-
name: "edit_file",
|
|
922
|
-
description: EDIT_FILE_TOOL_DESCRIPTION,
|
|
923
|
-
parameters: {
|
|
924
|
-
type: "object",
|
|
925
|
-
properties: {
|
|
926
|
-
target_filepath: {
|
|
927
|
-
type: "string",
|
|
928
|
-
description: "The path of the target file to modify"
|
|
929
|
-
},
|
|
930
|
-
instruction: {
|
|
931
|
-
type: "string",
|
|
932
|
-
description: "A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."
|
|
933
|
-
},
|
|
934
|
-
code_edit: {
|
|
935
|
-
type: "string",
|
|
936
|
-
description: "Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections."
|
|
937
|
-
}
|
|
938
|
-
},
|
|
939
|
-
required: ["target_filepath", "instruction", "code_edit"]
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
};
|
|
943
|
-
async function execute2(input, config) {
|
|
944
|
-
return executeEditFile(input, config);
|
|
945
|
-
}
|
|
946
|
-
function getSystemPrompt2() {
|
|
947
|
-
return EDIT_FILE_SYSTEM_PROMPT;
|
|
948
|
-
}
|
|
949
|
-
function formatResult2(result) {
|
|
950
|
-
if (!result.success) {
|
|
951
|
-
return `Error editing file: ${result.error}`;
|
|
952
|
-
}
|
|
953
|
-
const { changes } = result;
|
|
954
|
-
return `Successfully applied changes to ${result.filepath}. Added ${changes.linesAdded}, removed ${changes.linesRemoved}, modified ${changes.linesModified}.`;
|
|
955
|
-
}
|
|
956
|
-
function createEditFileTool2(config = {}) {
|
|
957
|
-
const toolDef = {
|
|
958
|
-
...editFileTool2,
|
|
959
|
-
...config.description && {
|
|
960
|
-
function: {
|
|
961
|
-
...editFileTool2.function,
|
|
962
|
-
description: config.description
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
return Object.assign({}, toolDef, {
|
|
967
|
-
execute: async (input) => {
|
|
968
|
-
const parsedInput = typeof input === "string" ? JSON.parse(input) : input;
|
|
969
|
-
return execute2(parsedInput, config);
|
|
970
|
-
},
|
|
971
|
-
formatResult: (result) => {
|
|
972
|
-
return formatResult2(result);
|
|
973
|
-
},
|
|
974
|
-
getSystemPrompt: () => {
|
|
975
|
-
return getSystemPrompt2();
|
|
976
|
-
}
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
var openai_default = editFileTool2;
|
|
980
|
-
|
|
981
|
-
// tools/fastapply/vercel.ts
|
|
982
|
-
var vercel_exports = {};
|
|
983
|
-
__export(vercel_exports, {
|
|
984
|
-
createEditFileTool: () => createEditFileTool3,
|
|
985
|
-
default: () => vercel_default,
|
|
986
|
-
editFileTool: () => editFileTool3,
|
|
987
|
-
getSystemPrompt: () => getSystemPrompt3
|
|
988
|
-
});
|
|
989
|
-
var import_ai = require("ai");
|
|
990
|
-
var import_zod = require("zod");
|
|
991
|
-
var editFileSchema = import_zod.z.object({
|
|
992
|
-
target_filepath: import_zod.z.string().describe("The path of the target file to modify"),
|
|
993
|
-
instruction: import_zod.z.string().describe("A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."),
|
|
994
|
-
code_edit: import_zod.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.")
|
|
995
|
-
});
|
|
996
|
-
var editFileTool3 = (0, import_ai.tool)({
|
|
997
|
-
description: EDIT_FILE_TOOL_DESCRIPTION,
|
|
998
|
-
inputSchema: editFileSchema,
|
|
999
|
-
execute: async (params) => {
|
|
1000
|
-
const result = await executeEditFile({
|
|
1001
|
-
target_filepath: params.target_filepath,
|
|
1002
|
-
instruction: params.instruction,
|
|
1003
|
-
code_edit: params.code_edit
|
|
1004
|
-
});
|
|
1005
|
-
if (!result.success) {
|
|
1006
|
-
throw new Error(`Failed to edit file: ${result.error}`);
|
|
1007
|
-
}
|
|
1008
|
-
return {
|
|
1009
|
-
success: true,
|
|
1010
|
-
filepath: result.filepath,
|
|
1011
|
-
changes: result.changes,
|
|
1012
|
-
udiff: result.udiff
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
});
|
|
1016
|
-
function getSystemPrompt3() {
|
|
1017
|
-
return EDIT_FILE_SYSTEM_PROMPT;
|
|
1018
|
-
}
|
|
1019
|
-
function createEditFileTool3(config = {}) {
|
|
1020
|
-
const schema = import_zod.z.object({
|
|
1021
|
-
target_filepath: import_zod.z.string().describe("The path of the target file to modify"),
|
|
1022
|
-
instruction: import_zod.z.string().describe("A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."),
|
|
1023
|
-
code_edit: import_zod.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.")
|
|
1024
|
-
});
|
|
1025
|
-
return (0, import_ai.tool)({
|
|
1026
|
-
description: config.description || EDIT_FILE_TOOL_DESCRIPTION,
|
|
1027
|
-
inputSchema: schema,
|
|
1028
|
-
execute: async (params) => {
|
|
1029
|
-
const result = await executeEditFile(
|
|
1030
|
-
{
|
|
1031
|
-
target_filepath: params.target_filepath,
|
|
1032
|
-
instruction: params.instruction,
|
|
1033
|
-
code_edit: params.code_edit
|
|
1034
|
-
},
|
|
1035
|
-
config
|
|
1036
|
-
);
|
|
1037
|
-
if (!result.success) {
|
|
1038
|
-
throw new Error(`Failed to edit file: ${result.error}`);
|
|
1039
|
-
}
|
|
1040
|
-
return {
|
|
1041
|
-
success: true,
|
|
1042
|
-
filepath: result.filepath,
|
|
1043
|
-
changes: result.changes,
|
|
1044
|
-
udiff: result.udiff
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
var vercel_default = editFileTool3;
|
|
1050
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1051
|
-
0 && (module.exports = {
|
|
1052
|
-
EDIT_FILE_SYSTEM_PROMPT,
|
|
1053
|
-
EDIT_FILE_TOOL_DESCRIPTION,
|
|
1054
|
-
FastApplyAnchorIntegrityError,
|
|
1055
|
-
FastApplyContextLengthError,
|
|
1056
|
-
anthropic,
|
|
1057
|
-
applyEdit,
|
|
1058
|
-
countChanges,
|
|
1059
|
-
executeEditFile,
|
|
1060
|
-
generateUdiff,
|
|
1061
|
-
openai,
|
|
1062
|
-
vercel
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../../chunk-BJBWWIZV.cjs');
|
|
4
|
+
var chunkOXXMTDOY_cjs = require('../../chunk-OXXMTDOY.cjs');
|
|
5
|
+
var chunkJNQKQKHS_cjs = require('../../chunk-JNQKQKHS.cjs');
|
|
6
|
+
var chunkNDUC7OV6_cjs = require('../../chunk-NDUC7OV6.cjs');
|
|
7
|
+
var chunk74A4HLIO_cjs = require('../../chunk-74A4HLIO.cjs');
|
|
8
|
+
var chunkJBTR3FQD_cjs = require('../../chunk-JBTR3FQD.cjs');
|
|
9
|
+
var chunkVDFLPO7B_cjs = require('../../chunk-VDFLPO7B.cjs');
|
|
10
|
+
require('../../chunk-65W4I66Q.cjs');
|
|
11
|
+
require('../../chunk-VL4QNALG.cjs');
|
|
12
|
+
require('../../chunk-ZLG2M2I4.cjs');
|
|
13
|
+
require('../../chunk-OM5ZSXQW.cjs');
|
|
14
|
+
require('../../chunk-TL34BLQD.cjs');
|
|
15
|
+
require('../../chunk-AWFZKS27.cjs');
|
|
16
|
+
require('../../chunk-75ZPJI57.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(exports, "openai", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkOXXMTDOY_cjs.openai_exports; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "vercel", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkJNQKQKHS_cjs.vercel_exports; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "anthropic", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkNDUC7OV6_cjs.anthropic_exports; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "EDIT_FILE_SYSTEM_PROMPT", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunk74A4HLIO_cjs.EDIT_FILE_SYSTEM_PROMPT; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "EDIT_FILE_TOOL_DESCRIPTION", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunk74A4HLIO_cjs.EDIT_FILE_TOOL_DESCRIPTION; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "executeEditFile", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkJBTR3FQD_cjs.executeEditFile; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "FastApplyAnchorIntegrityError", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunkVDFLPO7B_cjs.FastApplyAnchorIntegrityError; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "FastApplyContextLengthError", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunkVDFLPO7B_cjs.FastApplyContextLengthError; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "applyEdit", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunkVDFLPO7B_cjs.applyEdit; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "countChanges", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunkVDFLPO7B_cjs.countChanges; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "generateUdiff", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunkVDFLPO7B_cjs.generateUdiff; }
|
|
1063
63
|
});
|