@morphllm/morphsdk 0.2.196 → 0.2.198
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-35CF3OUB.js → chunk-3XS5P5XH.js} +6 -6
- package/dist/{chunk-2VTN7TKZ.js → chunk-4DNEBVGV.js} +2 -2
- package/dist/chunk-4DNEBVGV.js.map +1 -0
- package/dist/{chunk-OQVHJMRJ.js → chunk-4JUIEYAH.js} +4 -4
- package/dist/{chunk-LKFZBBTD.js → chunk-5TOJD2C5.js} +1 -1
- package/dist/chunk-5TOJD2C5.js.map +1 -0
- package/dist/{chunk-2JY7TZCP.js → chunk-6XFL2NER.js} +2 -2
- package/dist/{chunk-4ULSZFQP.js → chunk-CAFREMIT.js} +2 -2
- package/dist/{chunk-ZLLY7O4B.js → chunk-D2RFP6R2.js} +4 -4
- package/dist/{chunk-CZ74CRGH.js → chunk-EMURAU6J.js} +4 -6
- package/dist/chunk-EMURAU6J.js.map +1 -0
- package/dist/{chunk-R4XIWBIL.js → chunk-FESO6TDQ.js} +2 -2
- package/dist/{chunk-P47MJ3IW.js → chunk-FUYX2MNM.js} +4 -4
- package/dist/chunk-FUYX2MNM.js.map +1 -0
- package/dist/{chunk-UALXVIF2.js → chunk-GJ42MYUU.js} +2 -2
- package/dist/{chunk-ATAKRJQZ.js → chunk-IDMKQWQG.js} +1 -36
- package/dist/chunk-IDMKQWQG.js.map +1 -0
- package/dist/{chunk-F7MGS2FO.js → chunk-KQKLQHJF.js} +2 -2
- package/dist/{chunk-VLZ6PNAD.js → chunk-LN7GNFET.js} +7 -7
- package/dist/{chunk-I62NJUD2.js → chunk-O5264GI4.js} +2 -2
- package/dist/{chunk-E2ICGQI6.js → chunk-PEFXG5M6.js} +2 -2
- package/dist/{chunk-AGOQL5HV.js → chunk-PIIXU2H3.js} +2 -2
- package/dist/{chunk-HU62MINA.js → chunk-PV6EF6NG.js} +4 -4
- package/dist/{chunk-4MNM35CI.js → chunk-QKNGVBE2.js} +4 -4
- package/dist/{chunk-WHDQBPXO.js → chunk-SKN2L5CE.js} +2 -2
- package/dist/{chunk-XBOM427X.js → chunk-T6TXYTKH.js} +2 -2
- package/dist/{chunk-K5J5VRY2.js → chunk-VBZ7BG47.js} +4 -4
- package/dist/{chunk-KOUAORQW.js → chunk-WLMPQFER.js} +2 -2
- package/dist/{chunk-K7RNGQ7S.js → chunk-XH6KJJDI.js} +2 -2
- package/dist/{chunk-YH3GCNXJ.js → chunk-XK3PQZW6.js} +2 -2
- package/dist/{chunk-ZQDR653M.js → chunk-XTFRHVCW.js} +4 -4
- package/dist/{chunk-F6NHRM2W.js → chunk-YD6TNDR4.js} +5 -5
- package/dist/{chunk-5VAIYZKB.js → chunk-YHZJYCOU.js} +29 -47
- package/dist/{chunk-5VAIYZKB.js.map → chunk-YHZJYCOU.js.map} +1 -1
- package/dist/{chunk-W3XDECC2.js → chunk-YQ2G5YLI.js} +11 -11
- package/dist/{chunk-RNQAXIUA.js → chunk-YUH3MTP3.js} +2 -2
- package/dist/{chunk-FEIAMQNC.js → chunk-ZGERT23F.js} +4 -4
- package/dist/{chunk-7O44XTVM.js → chunk-ZQNTXHBQ.js} +2 -2
- package/dist/{chunk-HBCNZDKW.js → chunk-ZU5YYGBJ.js} +3 -19
- package/dist/chunk-ZU5YYGBJ.js.map +1 -0
- package/dist/{client-Rn1zymAl.d.ts → client-DCeydotn.d.ts} +0 -9
- package/dist/client.cjs +7 -811
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -9
- package/dist/client.js +30 -34
- package/dist/core/client.cjs +2 -18
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.d.ts +2 -2
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -18
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.d.ts +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -18
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +5 -5
- package/dist/core/resource.cjs.map +1 -1
- package/dist/core/resource.d.ts +1 -1
- package/dist/core/resource.js +1 -1
- package/dist/edge.cjs +2 -18
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +8 -8
- package/dist/index.cjs +7 -819
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -9
- package/dist/index.js +34 -49
- package/dist/modelrouter/core.cjs +2 -18
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +6 -6
- package/dist/modelrouter/index.cjs +2 -18
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +6 -6
- package/dist/subagents/anthropic.cjs +2 -18
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +12 -12
- package/dist/subagents/vercel.cjs +2 -18
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +12 -12
- package/dist/tools/browser/anthropic.cjs +2 -18
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +8 -8
- package/dist/tools/browser/core.cjs +2 -18
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +7 -7
- package/dist/tools/browser/index.cjs +2 -18
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +12 -12
- package/dist/tools/browser/openai.cjs +2 -18
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +8 -8
- package/dist/tools/browser/profiles/core.cjs +2 -18
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.js +3 -3
- package/dist/tools/browser/profiles/index.cjs +2 -18
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.js +3 -3
- package/dist/tools/browser/vercel.cjs +2 -18
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +8 -8
- package/dist/tools/codebase_search/anthropic.cjs +2 -18
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +7 -7
- package/dist/tools/codebase_search/core.cjs +2 -18
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +6 -6
- package/dist/tools/codebase_search/index.cjs +2 -18
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +11 -11
- package/dist/tools/codebase_search/openai.cjs +2 -18
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +7 -7
- package/dist/tools/codebase_search/vercel.cjs +2 -18
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +7 -7
- package/dist/tools/compact/core.cjs +2 -18
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +6 -6
- package/dist/tools/compact/index.cjs +2 -18
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +7 -7
- package/dist/tools/fastapply/anthropic.cjs +2 -18
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +8 -8
- package/dist/tools/fastapply/apply.cjs +2 -18
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -18
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +7 -7
- package/dist/tools/fastapply/index.cjs +2 -18
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +14 -14
- package/dist/tools/fastapply/openai.cjs +2 -18
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +8 -8
- package/dist/tools/fastapply/vercel.cjs +2 -18
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +8 -8
- package/dist/tools/index.cjs +2 -18
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +14 -14
- package/dist/tools/utils/resilience.cjs +2 -18
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +2 -18
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +2 -18
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +12 -12
- package/dist/tools/warp_grep/client.cjs +2 -18
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +11 -11
- package/dist/tools/warp_grep/gemini.cjs +2 -18
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +11 -11
- package/dist/tools/warp_grep/harness.js +6 -6
- package/dist/tools/warp_grep/index.cjs +2 -18
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +17 -17
- package/dist/tools/warp_grep/openai.cjs +2 -18
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +12 -12
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +2 -18
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +12 -12
- package/dist/tracing/core.cjs +2 -34
- package/dist/tracing/core.cjs.map +1 -1
- package/dist/tracing/core.d.ts +1 -2
- package/dist/tracing/core.js +2 -2
- package/dist/tracing/index.cjs +4 -42
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.ts +0 -34
- package/dist/tracing/index.js +3 -10
- package/dist/tracing/interaction.cjs +0 -30
- package/dist/tracing/interaction.cjs.map +1 -1
- package/dist/tracing/interaction.js +1 -1
- package/dist/tracing/types.cjs.map +1 -1
- package/dist/tracing/types.d.ts +1 -27
- package/dist/version.cjs +2 -18
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -18
- package/dist/chunk-2VTN7TKZ.js.map +0 -1
- package/dist/chunk-ATAKRJQZ.js.map +0 -1
- package/dist/chunk-CZ74CRGH.js.map +0 -1
- package/dist/chunk-GZMUGMOZ.js +0 -9
- package/dist/chunk-GZMUGMOZ.js.map +0 -1
- package/dist/chunk-HBCNZDKW.js.map +0 -1
- package/dist/chunk-JD6LOSNX.js +0 -202
- package/dist/chunk-JD6LOSNX.js.map +0 -1
- package/dist/chunk-LKFZBBTD.js.map +0 -1
- package/dist/chunk-P47MJ3IW.js.map +0 -1
- package/dist/chunk-TCCZBGG5.js +0 -46
- package/dist/chunk-TCCZBGG5.js.map +0 -1
- package/dist/chunk-XOZELE7Y.js +0 -561
- package/dist/chunk-XOZELE7Y.js.map +0 -1
- package/dist/git/client.cjs +0 -1123
- package/dist/git/client.cjs.map +0 -1
- package/dist/git/client.d.ts +0 -290
- package/dist/git/client.js +0 -14
- package/dist/git/client.js.map +0 -1
- package/dist/git/config.cjs +0 -41
- package/dist/git/config.cjs.map +0 -1
- package/dist/git/config.d.ts +0 -11
- package/dist/git/config.js +0 -17
- package/dist/git/config.js.map +0 -1
- package/dist/git/index.cjs +0 -1133
- package/dist/git/index.cjs.map +0 -1
- package/dist/git/index.d.ts +0 -7
- package/dist/git/index.js +0 -20
- package/dist/git/index.js.map +0 -1
- package/dist/git/types.cjs +0 -19
- package/dist/git/types.cjs.map +0 -1
- package/dist/git/types.d.ts +0 -133
- package/dist/git/types.js +0 -1
- package/dist/git/types.js.map +0 -1
- package/dist/tools/reflex/core.cjs +0 -762
- package/dist/tools/reflex/core.cjs.map +0 -1
- package/dist/tools/reflex/core.d.ts +0 -59
- package/dist/tools/reflex/core.js +0 -16
- package/dist/tools/reflex/core.js.map +0 -1
- package/dist/tools/reflex/index.cjs +0 -762
- package/dist/tools/reflex/index.cjs.map +0 -1
- package/dist/tools/reflex/index.d.ts +0 -5
- package/dist/tools/reflex/index.js +0 -16
- package/dist/tools/reflex/index.js.map +0 -1
- package/dist/tools/reflex/types.cjs +0 -19
- package/dist/tools/reflex/types.cjs.map +0 -1
- package/dist/tools/reflex/types.d.ts +0 -171
- package/dist/tools/reflex/types.js +0 -1
- package/dist/tools/reflex/types.js.map +0 -1
- package/dist/tools/traces/core.cjs +0 -76
- package/dist/tools/traces/core.cjs.map +0 -1
- package/dist/tools/traces/core.d.ts +0 -24
- package/dist/tools/traces/core.js +0 -9
- package/dist/tools/traces/core.js.map +0 -1
- package/dist/tools/traces/index.cjs +0 -76
- package/dist/tools/traces/index.cjs.map +0 -1
- package/dist/tools/traces/index.d.ts +0 -5
- package/dist/tools/traces/index.js +0 -9
- package/dist/tools/traces/index.js.map +0 -1
- package/dist/tools/traces/types.cjs +0 -19
- package/dist/tools/traces/types.cjs.map +0 -1
- package/dist/tools/traces/types.d.ts +0 -56
- package/dist/tools/traces/types.js +0 -1
- package/dist/tools/traces/types.js.map +0 -1
- /package/dist/{chunk-35CF3OUB.js.map → chunk-3XS5P5XH.js.map} +0 -0
- /package/dist/{chunk-OQVHJMRJ.js.map → chunk-4JUIEYAH.js.map} +0 -0
- /package/dist/{chunk-2JY7TZCP.js.map → chunk-6XFL2NER.js.map} +0 -0
- /package/dist/{chunk-4ULSZFQP.js.map → chunk-CAFREMIT.js.map} +0 -0
- /package/dist/{chunk-ZLLY7O4B.js.map → chunk-D2RFP6R2.js.map} +0 -0
- /package/dist/{chunk-R4XIWBIL.js.map → chunk-FESO6TDQ.js.map} +0 -0
- /package/dist/{chunk-UALXVIF2.js.map → chunk-GJ42MYUU.js.map} +0 -0
- /package/dist/{chunk-F7MGS2FO.js.map → chunk-KQKLQHJF.js.map} +0 -0
- /package/dist/{chunk-VLZ6PNAD.js.map → chunk-LN7GNFET.js.map} +0 -0
- /package/dist/{chunk-I62NJUD2.js.map → chunk-O5264GI4.js.map} +0 -0
- /package/dist/{chunk-E2ICGQI6.js.map → chunk-PEFXG5M6.js.map} +0 -0
- /package/dist/{chunk-AGOQL5HV.js.map → chunk-PIIXU2H3.js.map} +0 -0
- /package/dist/{chunk-HU62MINA.js.map → chunk-PV6EF6NG.js.map} +0 -0
- /package/dist/{chunk-4MNM35CI.js.map → chunk-QKNGVBE2.js.map} +0 -0
- /package/dist/{chunk-WHDQBPXO.js.map → chunk-SKN2L5CE.js.map} +0 -0
- /package/dist/{chunk-XBOM427X.js.map → chunk-T6TXYTKH.js.map} +0 -0
- /package/dist/{chunk-K5J5VRY2.js.map → chunk-VBZ7BG47.js.map} +0 -0
- /package/dist/{chunk-KOUAORQW.js.map → chunk-WLMPQFER.js.map} +0 -0
- /package/dist/{chunk-K7RNGQ7S.js.map → chunk-XH6KJJDI.js.map} +0 -0
- /package/dist/{chunk-YH3GCNXJ.js.map → chunk-XK3PQZW6.js.map} +0 -0
- /package/dist/{chunk-ZQDR653M.js.map → chunk-XTFRHVCW.js.map} +0 -0
- /package/dist/{chunk-F6NHRM2W.js.map → chunk-YD6TNDR4.js.map} +0 -0
- /package/dist/{chunk-W3XDECC2.js.map → chunk-YQ2G5YLI.js.map} +0 -0
- /package/dist/{chunk-RNQAXIUA.js.map → chunk-YUH3MTP3.js.map} +0 -0
- /package/dist/{chunk-FEIAMQNC.js.map → chunk-ZGERT23F.js.map} +0 -0
- /package/dist/{chunk-7O44XTVM.js.map → chunk-ZQNTXHBQ.js.map} +0 -0
package/dist/client.cjs
CHANGED
|
@@ -36,7 +36,7 @@ var init_package = __esm({
|
|
|
36
36
|
"package.json"() {
|
|
37
37
|
package_default = {
|
|
38
38
|
name: "@morphllm/morphsdk",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.198",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -143,11 +143,6 @@ var init_package = __esm({
|
|
|
143
143
|
import: "./dist/tools/codebase_search/vercel.js",
|
|
144
144
|
require: "./dist/tools/codebase_search/vercel.cjs"
|
|
145
145
|
},
|
|
146
|
-
"./tools/git": {
|
|
147
|
-
types: "./dist/git/index.d.ts",
|
|
148
|
-
import: "./dist/git/index.js",
|
|
149
|
-
require: "./dist/git/index.cjs"
|
|
150
|
-
},
|
|
151
146
|
"./tools/browser": {
|
|
152
147
|
types: "./dist/tools/browser/index.d.ts",
|
|
153
148
|
import: "./dist/tools/browser/index.js",
|
|
@@ -183,16 +178,6 @@ var init_package = __esm({
|
|
|
183
178
|
import: "./dist/tools/compact/index.js",
|
|
184
179
|
require: "./dist/tools/compact/index.cjs"
|
|
185
180
|
},
|
|
186
|
-
"./tools/reflex": {
|
|
187
|
-
types: "./dist/tools/reflex/index.d.ts",
|
|
188
|
-
import: "./dist/tools/reflex/index.js",
|
|
189
|
-
require: "./dist/tools/reflex/index.cjs"
|
|
190
|
-
},
|
|
191
|
-
"./tools/traces": {
|
|
192
|
-
types: "./dist/tools/traces/index.d.ts",
|
|
193
|
-
import: "./dist/tools/traces/index.js",
|
|
194
|
-
require: "./dist/tools/traces/index.cjs"
|
|
195
|
-
},
|
|
196
181
|
"./subagents": {
|
|
197
182
|
types: "./dist/subagents/index.d.ts",
|
|
198
183
|
import: "./dist/subagents/index.js",
|
|
@@ -223,7 +208,7 @@ var init_package = __esm({
|
|
|
223
208
|
"!dist/**/*.test.*"
|
|
224
209
|
],
|
|
225
210
|
scripts: {
|
|
226
|
-
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/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/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
|
|
211
|
+
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/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/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 tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.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 tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve && tsup ai-sdk/index.ts --format esm,cjs --sourcemap --dts --no-clean --out-dir dist/ai-sdk",
|
|
227
212
|
prepare: "npm run build",
|
|
228
213
|
typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
|
|
229
214
|
lint: "eslint .",
|
|
@@ -260,7 +245,6 @@ var init_package = __esm({
|
|
|
260
245
|
"@vscode/ripgrep": "^1.17.0",
|
|
261
246
|
ai: ">=5.0.0",
|
|
262
247
|
diff: "^7.0.0",
|
|
263
|
-
"isomorphic-git": "^1.25.10",
|
|
264
248
|
openai: "^4.52.7",
|
|
265
249
|
zod: ">=3.23.0"
|
|
266
250
|
},
|
|
@@ -334,8 +318,8 @@ var init_logger = __esm({
|
|
|
334
318
|
this.fileStream = null;
|
|
335
319
|
const f = typeof process !== "undefined" ? process.env.MORPH_LOG_FILE : void 0;
|
|
336
320
|
if (f) {
|
|
337
|
-
this.ready = import("fs").then((
|
|
338
|
-
this.fileStream =
|
|
321
|
+
this.ready = import("fs").then((fs4) => {
|
|
322
|
+
this.fileStream = fs4.createWriteStream(f, { flags: "a" });
|
|
339
323
|
}).catch(() => {
|
|
340
324
|
});
|
|
341
325
|
} else {
|
|
@@ -4759,790 +4743,11 @@ var GitHubClient = class extends APIResource {
|
|
|
4759
4743
|
}
|
|
4760
4744
|
};
|
|
4761
4745
|
|
|
4762
|
-
// git/client.ts
|
|
4763
|
-
var import_isomorphic_git = __toESM(require("isomorphic-git"), 1);
|
|
4764
|
-
var import_node = __toESM(require("isomorphic-git/http/node"), 1);
|
|
4765
|
-
var import_fs2 = __toESM(require("fs"), 1);
|
|
4766
|
-
var DEFAULT_PROXY_URL = "https://repos.morphllm.com";
|
|
4767
|
-
var MorphGit = class extends APIResource {
|
|
4768
|
-
apiKey;
|
|
4769
|
-
proxyUrl;
|
|
4770
|
-
constructor(clientOrConfig) {
|
|
4771
|
-
const isClient = clientOrConfig instanceof MorphAPIClient;
|
|
4772
|
-
if (!isClient) {
|
|
4773
|
-
if (!clientOrConfig.apiKey) {
|
|
4774
|
-
throw new Error("API key is required. Get one at https://morphllm.com/dashboard");
|
|
4775
|
-
}
|
|
4776
|
-
if (!clientOrConfig.apiKey.startsWith("sk-") && !clientOrConfig.apiKey.startsWith("morph-")) {
|
|
4777
|
-
throw new Error("Invalid API key format. Expected: sk-... or morph-...");
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
super(
|
|
4781
|
-
isClient ? clientOrConfig : new MorphAPIClient({
|
|
4782
|
-
apiKey: clientOrConfig.apiKey,
|
|
4783
|
-
reposURL: clientOrConfig.proxyUrl,
|
|
4784
|
-
retryConfig: clientOrConfig.retryConfig
|
|
4785
|
-
})
|
|
4786
|
-
);
|
|
4787
|
-
this.apiKey = this._client.resolveApiKey() ?? "";
|
|
4788
|
-
this.proxyUrl = isClient ? this._client.reposURL : clientOrConfig.proxyUrl || DEFAULT_PROXY_URL;
|
|
4789
|
-
}
|
|
4790
|
-
/**
|
|
4791
|
-
* Get auth callback for isomorphic-git operations
|
|
4792
|
-
* @private
|
|
4793
|
-
*/
|
|
4794
|
-
getAuthCallback() {
|
|
4795
|
-
return () => ({
|
|
4796
|
-
username: "morph",
|
|
4797
|
-
password: this.apiKey
|
|
4798
|
-
});
|
|
4799
|
-
}
|
|
4800
|
-
/**
|
|
4801
|
-
* Initialize a new repository
|
|
4802
|
-
* Creates the repo in the database and in the git provider
|
|
4803
|
-
*
|
|
4804
|
-
* @example
|
|
4805
|
-
* ```ts
|
|
4806
|
-
* await morphGit.init({
|
|
4807
|
-
* repoId: 'my-project',
|
|
4808
|
-
* dir: './my-project',
|
|
4809
|
-
* defaultBranch: 'main'
|
|
4810
|
-
* });
|
|
4811
|
-
* ```
|
|
4812
|
-
*/
|
|
4813
|
-
async init(options) {
|
|
4814
|
-
const { repoId, dir, defaultBranch = "main" } = options;
|
|
4815
|
-
const response = await fetch(`${this.proxyUrl}/v1/repos`, {
|
|
4816
|
-
method: "POST",
|
|
4817
|
-
headers: {
|
|
4818
|
-
"Authorization": `Bearer ${this.apiKey}`,
|
|
4819
|
-
"Content-Type": "application/json"
|
|
4820
|
-
},
|
|
4821
|
-
body: JSON.stringify({
|
|
4822
|
-
repoId,
|
|
4823
|
-
name: repoId,
|
|
4824
|
-
defaultBranch
|
|
4825
|
-
})
|
|
4826
|
-
});
|
|
4827
|
-
if (!response.ok) {
|
|
4828
|
-
const error = await response.text();
|
|
4829
|
-
throw new Error(`Failed to create repository: ${error}`);
|
|
4830
|
-
}
|
|
4831
|
-
await import_isomorphic_git.default.init({
|
|
4832
|
-
fs: import_fs2.default,
|
|
4833
|
-
dir,
|
|
4834
|
-
defaultBranch
|
|
4835
|
-
});
|
|
4836
|
-
await import_isomorphic_git.default.addRemote({
|
|
4837
|
-
fs: import_fs2.default,
|
|
4838
|
-
dir,
|
|
4839
|
-
remote: "origin",
|
|
4840
|
-
url: `${this.proxyUrl}/v1/repos/${repoId}`
|
|
4841
|
-
});
|
|
4842
|
-
console.log(`\u2713 Repository '${repoId}' initialized`);
|
|
4843
|
-
}
|
|
4844
|
-
/**
|
|
4845
|
-
* Clone a repository from Morph repos
|
|
4846
|
-
*
|
|
4847
|
-
* @example
|
|
4848
|
-
* ```ts
|
|
4849
|
-
* await morphGit.clone({
|
|
4850
|
-
* repoId: 'my-project',
|
|
4851
|
-
* dir: './my-project'
|
|
4852
|
-
* });
|
|
4853
|
-
* ```
|
|
4854
|
-
*/
|
|
4855
|
-
async clone(options) {
|
|
4856
|
-
const { repoId, dir, branch = "main", depth, singleBranch = true } = options;
|
|
4857
|
-
await import_isomorphic_git.default.clone({
|
|
4858
|
-
fs: import_fs2.default,
|
|
4859
|
-
http: import_node.default,
|
|
4860
|
-
dir,
|
|
4861
|
-
url: `${this.proxyUrl}/v1/repos/${repoId}`,
|
|
4862
|
-
ref: branch,
|
|
4863
|
-
singleBranch,
|
|
4864
|
-
depth,
|
|
4865
|
-
onAuth: this.getAuthCallback()
|
|
4866
|
-
});
|
|
4867
|
-
}
|
|
4868
|
-
/**
|
|
4869
|
-
* Push changes to remote repository
|
|
4870
|
-
*
|
|
4871
|
-
* @example
|
|
4872
|
-
* ```ts
|
|
4873
|
-
* await morphGit.push({
|
|
4874
|
-
* dir: './my-project',
|
|
4875
|
-
* branch: 'main', // Required: explicit branch name
|
|
4876
|
-
* index: true // Optional: generate embeddings for semantic search
|
|
4877
|
-
* });
|
|
4878
|
-
* ```
|
|
4879
|
-
*/
|
|
4880
|
-
async push(options) {
|
|
4881
|
-
const { dir, remote = "origin", branch, waitForEmbeddings, index = false } = options;
|
|
4882
|
-
if (!branch) {
|
|
4883
|
-
throw new Error(
|
|
4884
|
-
'branch is required for push operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
|
|
4885
|
-
);
|
|
4886
|
-
}
|
|
4887
|
-
const commitHash = await import_isomorphic_git.default.resolveRef({ fs: import_fs2.default, dir, ref: "HEAD" });
|
|
4888
|
-
let repoId;
|
|
4889
|
-
const remotes = await import_isomorphic_git.default.listRemotes({ fs: import_fs2.default, dir });
|
|
4890
|
-
const originRemote = remotes.find((r) => r.remote === remote);
|
|
4891
|
-
if (originRemote) {
|
|
4892
|
-
const match = originRemote.url.match(/\/repos\/([^\/]+)$/);
|
|
4893
|
-
if (match) {
|
|
4894
|
-
repoId = match[1];
|
|
4895
|
-
}
|
|
4896
|
-
}
|
|
4897
|
-
await import_isomorphic_git.default.push({
|
|
4898
|
-
fs: import_fs2.default,
|
|
4899
|
-
http: import_node.default,
|
|
4900
|
-
dir,
|
|
4901
|
-
remote,
|
|
4902
|
-
ref: branch,
|
|
4903
|
-
onAuth: this.getAuthCallback()
|
|
4904
|
-
});
|
|
4905
|
-
if (repoId && commitHash) {
|
|
4906
|
-
await this.configureCommit({ repoId, commitHash, branch, index });
|
|
4907
|
-
}
|
|
4908
|
-
if (waitForEmbeddings && repoId && commitHash && index) {
|
|
4909
|
-
await this.waitForEmbeddings({ repoId, commitHash });
|
|
4910
|
-
}
|
|
4911
|
-
}
|
|
4912
|
-
/**
|
|
4913
|
-
* Configure commit settings on the backend after push.
|
|
4914
|
-
* Sets the index flag to control embedding generation.
|
|
4915
|
-
* @private
|
|
4916
|
-
*/
|
|
4917
|
-
async configureCommit(options) {
|
|
4918
|
-
const { repoId, commitHash, branch, index } = options;
|
|
4919
|
-
const response = await fetch(
|
|
4920
|
-
`${this.proxyUrl}/v1/repos/${repoId}/commits/${commitHash}/config`,
|
|
4921
|
-
{
|
|
4922
|
-
method: "POST",
|
|
4923
|
-
headers: {
|
|
4924
|
-
"Authorization": `Bearer ${this.apiKey}`,
|
|
4925
|
-
"Content-Type": "application/json"
|
|
4926
|
-
},
|
|
4927
|
-
body: JSON.stringify({ index, branch })
|
|
4928
|
-
}
|
|
4929
|
-
);
|
|
4930
|
-
if (!response.ok) {
|
|
4931
|
-
console.warn(`Failed to configure commit: ${response.status}`);
|
|
4932
|
-
}
|
|
4933
|
-
}
|
|
4934
|
-
/**
|
|
4935
|
-
* Pull changes from remote repository
|
|
4936
|
-
*
|
|
4937
|
-
* @example
|
|
4938
|
-
* ```ts
|
|
4939
|
-
* await morphGit.pull({
|
|
4940
|
-
* dir: './my-project',
|
|
4941
|
-
* branch: 'main' // Required: explicit branch name
|
|
4942
|
-
* });
|
|
4943
|
-
* ```
|
|
4944
|
-
*/
|
|
4945
|
-
async pull(options) {
|
|
4946
|
-
const { dir, remote = "origin", branch } = options;
|
|
4947
|
-
if (!branch) {
|
|
4948
|
-
throw new Error(
|
|
4949
|
-
'branch is required for pull operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
|
|
4950
|
-
);
|
|
4951
|
-
}
|
|
4952
|
-
await import_isomorphic_git.default.pull({
|
|
4953
|
-
fs: import_fs2.default,
|
|
4954
|
-
http: import_node.default,
|
|
4955
|
-
dir,
|
|
4956
|
-
remote,
|
|
4957
|
-
ref: branch,
|
|
4958
|
-
onAuth: this.getAuthCallback(),
|
|
4959
|
-
author: {
|
|
4960
|
-
name: "Morph Agent",
|
|
4961
|
-
email: "agent@morph.com"
|
|
4962
|
-
}
|
|
4963
|
-
});
|
|
4964
|
-
}
|
|
4965
|
-
/**
|
|
4966
|
-
* Wait for embeddings to complete after push.
|
|
4967
|
-
* Polls status endpoint until embeddings are done.
|
|
4968
|
-
*
|
|
4969
|
-
* @example
|
|
4970
|
-
* ```ts
|
|
4971
|
-
* await morphGit.push({ dir: './my-project', branch: 'main' });
|
|
4972
|
-
* await morphGit.waitForEmbeddings({
|
|
4973
|
-
* repoId: 'my-project',
|
|
4974
|
-
* onProgress: (p) => console.log(`${p.filesProcessed}/${p.totalFiles}`)
|
|
4975
|
-
* });
|
|
4976
|
-
* ```
|
|
4977
|
-
*/
|
|
4978
|
-
async waitForEmbeddings(options) {
|
|
4979
|
-
const { repoId, commitHash, timeout = 12e4, onProgress } = options;
|
|
4980
|
-
const startTime = Date.now();
|
|
4981
|
-
const pollInterval = 1e3;
|
|
4982
|
-
while (Date.now() - startTime < timeout) {
|
|
4983
|
-
const statusUrl = `${this.proxyUrl}/v1/repos/${repoId}/embedding-status` + (commitHash ? `?commit_hash=${commitHash}` : "");
|
|
4984
|
-
const response = await fetch(statusUrl, {
|
|
4985
|
-
headers: { "Authorization": `Bearer ${this.apiKey}` }
|
|
4986
|
-
});
|
|
4987
|
-
if (response.status === 404) {
|
|
4988
|
-
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
4989
|
-
continue;
|
|
4990
|
-
}
|
|
4991
|
-
if (!response.ok) {
|
|
4992
|
-
throw new Error(`Failed to get embedding status: ${response.status}`);
|
|
4993
|
-
}
|
|
4994
|
-
const status = await response.json();
|
|
4995
|
-
if (onProgress && status.progress) {
|
|
4996
|
-
onProgress(status.progress);
|
|
4997
|
-
}
|
|
4998
|
-
if (status.status === "completed") {
|
|
4999
|
-
return;
|
|
5000
|
-
}
|
|
5001
|
-
if (status.status === "failed") {
|
|
5002
|
-
throw new Error(`Embeddings failed: ${status.error || "Unknown error"}`);
|
|
5003
|
-
}
|
|
5004
|
-
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
5005
|
-
}
|
|
5006
|
-
throw new Error(`Embeddings timed out after ${timeout}ms`);
|
|
5007
|
-
}
|
|
5008
|
-
/**
|
|
5009
|
-
* Stage a file for commit
|
|
5010
|
-
*
|
|
5011
|
-
* @example
|
|
5012
|
-
* ```ts
|
|
5013
|
-
* await morphGit.add({
|
|
5014
|
-
* dir: './my-project',
|
|
5015
|
-
* filepath: 'src/app.ts'
|
|
5016
|
-
* });
|
|
5017
|
-
* ```
|
|
5018
|
-
*/
|
|
5019
|
-
async add(options) {
|
|
5020
|
-
const { dir, filepath } = options;
|
|
5021
|
-
await import_isomorphic_git.default.add({
|
|
5022
|
-
fs: import_fs2.default,
|
|
5023
|
-
dir,
|
|
5024
|
-
filepath
|
|
5025
|
-
});
|
|
5026
|
-
}
|
|
5027
|
-
/**
|
|
5028
|
-
* Remove a file from staging
|
|
5029
|
-
*
|
|
5030
|
-
* @example
|
|
5031
|
-
* ```ts
|
|
5032
|
-
* await morphGit.remove({
|
|
5033
|
-
* dir: './my-project',
|
|
5034
|
-
* filepath: 'src/old-file.ts'
|
|
5035
|
-
* });
|
|
5036
|
-
* ```
|
|
5037
|
-
*/
|
|
5038
|
-
async remove(options) {
|
|
5039
|
-
const { dir, filepath } = options;
|
|
5040
|
-
await import_isomorphic_git.default.remove({
|
|
5041
|
-
fs: import_fs2.default,
|
|
5042
|
-
dir,
|
|
5043
|
-
filepath
|
|
5044
|
-
});
|
|
5045
|
-
}
|
|
5046
|
-
/**
|
|
5047
|
-
* Commit staged changes
|
|
5048
|
-
*
|
|
5049
|
-
* @example
|
|
5050
|
-
* ```ts
|
|
5051
|
-
* await morphGit.commit({
|
|
5052
|
-
* dir: './my-project',
|
|
5053
|
-
* message: 'Add new feature',
|
|
5054
|
-
* author: {
|
|
5055
|
-
* name: 'AI Agent',
|
|
5056
|
-
* email: 'ai@example.com'
|
|
5057
|
-
* },
|
|
5058
|
-
* metadata: { issueId: 'PROJ-123', source: 'agent' },
|
|
5059
|
-
* chatHistory: [
|
|
5060
|
-
* { role: 'user', content: 'Please add a new feature' },
|
|
5061
|
-
* { role: 'assistant', content: 'I will add that feature' }
|
|
5062
|
-
* ],
|
|
5063
|
-
* recordingId: 'rec_123'
|
|
5064
|
-
* });
|
|
5065
|
-
* ```
|
|
5066
|
-
*/
|
|
5067
|
-
async commit(options) {
|
|
5068
|
-
const { dir, message, author, metadata, chatHistory, recordingId } = options;
|
|
5069
|
-
const commitAuthor = author || {
|
|
5070
|
-
name: "Morph SDK",
|
|
5071
|
-
email: "sdk@morphllm.com"
|
|
5072
|
-
};
|
|
5073
|
-
const sha = await import_isomorphic_git.default.commit({
|
|
5074
|
-
fs: import_fs2.default,
|
|
5075
|
-
dir,
|
|
5076
|
-
message,
|
|
5077
|
-
author: commitAuthor
|
|
5078
|
-
});
|
|
5079
|
-
if (metadata || chatHistory || recordingId) {
|
|
5080
|
-
const notes = {
|
|
5081
|
-
metadata,
|
|
5082
|
-
chatHistory,
|
|
5083
|
-
recordingId,
|
|
5084
|
-
_version: 1
|
|
5085
|
-
};
|
|
5086
|
-
await import_isomorphic_git.default.addNote({
|
|
5087
|
-
fs: import_fs2.default,
|
|
5088
|
-
dir,
|
|
5089
|
-
ref: "refs/notes/morph-metadata",
|
|
5090
|
-
oid: sha,
|
|
5091
|
-
note: JSON.stringify(notes, null, 2),
|
|
5092
|
-
author: commitAuthor
|
|
5093
|
-
});
|
|
5094
|
-
}
|
|
5095
|
-
return sha;
|
|
5096
|
-
}
|
|
5097
|
-
/**
|
|
5098
|
-
* Get status of a file
|
|
5099
|
-
*
|
|
5100
|
-
* @example
|
|
5101
|
-
* ```ts
|
|
5102
|
-
* const status = await morphGit.status({
|
|
5103
|
-
* dir: './my-project',
|
|
5104
|
-
* filepath: 'src/app.ts'
|
|
5105
|
-
* });
|
|
5106
|
-
* console.log(status); // 'modified', '*added', etc.
|
|
5107
|
-
* ```
|
|
5108
|
-
*/
|
|
5109
|
-
async status(options) {
|
|
5110
|
-
const { dir, filepath } = options;
|
|
5111
|
-
if (!filepath) {
|
|
5112
|
-
throw new Error("filepath is required for status check");
|
|
5113
|
-
}
|
|
5114
|
-
const status = await import_isomorphic_git.default.status({
|
|
5115
|
-
fs: import_fs2.default,
|
|
5116
|
-
dir,
|
|
5117
|
-
filepath
|
|
5118
|
-
});
|
|
5119
|
-
return status;
|
|
5120
|
-
}
|
|
5121
|
-
/**
|
|
5122
|
-
* Get commit history
|
|
5123
|
-
*
|
|
5124
|
-
* @example
|
|
5125
|
-
* ```ts
|
|
5126
|
-
* const commits = await morphGit.log({
|
|
5127
|
-
* dir: './my-project',
|
|
5128
|
-
* depth: 10
|
|
5129
|
-
* });
|
|
5130
|
-
* ```
|
|
5131
|
-
*/
|
|
5132
|
-
async log(options) {
|
|
5133
|
-
const { dir, depth, ref } = options;
|
|
5134
|
-
const commits = await import_isomorphic_git.default.log({
|
|
5135
|
-
fs: import_fs2.default,
|
|
5136
|
-
dir,
|
|
5137
|
-
depth,
|
|
5138
|
-
ref
|
|
5139
|
-
});
|
|
5140
|
-
return commits;
|
|
5141
|
-
}
|
|
5142
|
-
/**
|
|
5143
|
-
* Checkout a branch or commit
|
|
5144
|
-
*
|
|
5145
|
-
* @example
|
|
5146
|
-
* ```ts
|
|
5147
|
-
* await morphGit.checkout({
|
|
5148
|
-
* dir: './my-project',
|
|
5149
|
-
* ref: 'feature-branch'
|
|
5150
|
-
* });
|
|
5151
|
-
* ```
|
|
5152
|
-
*/
|
|
5153
|
-
async checkout(options) {
|
|
5154
|
-
const { dir, ref } = options;
|
|
5155
|
-
await import_isomorphic_git.default.checkout({
|
|
5156
|
-
fs: import_fs2.default,
|
|
5157
|
-
dir,
|
|
5158
|
-
ref
|
|
5159
|
-
});
|
|
5160
|
-
}
|
|
5161
|
-
/**
|
|
5162
|
-
* Create a new branch
|
|
5163
|
-
*
|
|
5164
|
-
* @example
|
|
5165
|
-
* ```ts
|
|
5166
|
-
* await morphGit.branch({
|
|
5167
|
-
* dir: './my-project',
|
|
5168
|
-
* name: 'feature-branch',
|
|
5169
|
-
* checkout: true
|
|
5170
|
-
* });
|
|
5171
|
-
* ```
|
|
5172
|
-
*/
|
|
5173
|
-
async branch(options) {
|
|
5174
|
-
const { dir, name, checkout = false } = options;
|
|
5175
|
-
await import_isomorphic_git.default.branch({
|
|
5176
|
-
fs: import_fs2.default,
|
|
5177
|
-
dir,
|
|
5178
|
-
ref: name,
|
|
5179
|
-
checkout
|
|
5180
|
-
});
|
|
5181
|
-
}
|
|
5182
|
-
/**
|
|
5183
|
-
* List all branches
|
|
5184
|
-
*
|
|
5185
|
-
* @example
|
|
5186
|
-
* ```ts
|
|
5187
|
-
* const branches = await morphGit.listBranches({
|
|
5188
|
-
* dir: './my-project'
|
|
5189
|
-
* });
|
|
5190
|
-
* ```
|
|
5191
|
-
*/
|
|
5192
|
-
async listBranches(options) {
|
|
5193
|
-
const { dir } = options;
|
|
5194
|
-
const branches = await import_isomorphic_git.default.listBranches({
|
|
5195
|
-
fs: import_fs2.default,
|
|
5196
|
-
dir
|
|
5197
|
-
});
|
|
5198
|
-
return branches;
|
|
5199
|
-
}
|
|
5200
|
-
/**
|
|
5201
|
-
* Get the current branch name
|
|
5202
|
-
*
|
|
5203
|
-
* @example
|
|
5204
|
-
* ```ts
|
|
5205
|
-
* const branch = await morphGit.currentBranch({
|
|
5206
|
-
* dir: './my-project'
|
|
5207
|
-
* });
|
|
5208
|
-
* ```
|
|
5209
|
-
*/
|
|
5210
|
-
async currentBranch(options) {
|
|
5211
|
-
const { dir } = options;
|
|
5212
|
-
const branch = await import_isomorphic_git.default.currentBranch({
|
|
5213
|
-
fs: import_fs2.default,
|
|
5214
|
-
dir
|
|
5215
|
-
});
|
|
5216
|
-
return branch || void 0;
|
|
5217
|
-
}
|
|
5218
|
-
/**
|
|
5219
|
-
* Get list of changed files (similar to git diff --name-only)
|
|
5220
|
-
*
|
|
5221
|
-
* @example
|
|
5222
|
-
* ```ts
|
|
5223
|
-
* const changes = await morphGit.statusMatrix({
|
|
5224
|
-
* dir: './my-project'
|
|
5225
|
-
* });
|
|
5226
|
-
* ```
|
|
5227
|
-
*/
|
|
5228
|
-
async statusMatrix(options) {
|
|
5229
|
-
const { dir } = options;
|
|
5230
|
-
const matrix = await import_isomorphic_git.default.statusMatrix({
|
|
5231
|
-
fs: import_fs2.default,
|
|
5232
|
-
dir
|
|
5233
|
-
});
|
|
5234
|
-
return matrix.map(([filepath, HEADStatus, workdirStatus, stageStatus]) => {
|
|
5235
|
-
let status = "unmodified";
|
|
5236
|
-
if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 2) {
|
|
5237
|
-
status = "modified";
|
|
5238
|
-
} else if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 1) {
|
|
5239
|
-
status = "*modified";
|
|
5240
|
-
} else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 2) {
|
|
5241
|
-
status = "added";
|
|
5242
|
-
} else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 0) {
|
|
5243
|
-
status = "*added";
|
|
5244
|
-
} else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 0) {
|
|
5245
|
-
status = "deleted";
|
|
5246
|
-
} else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 1) {
|
|
5247
|
-
status = "*deleted";
|
|
5248
|
-
} else if (HEADStatus === 1 && workdirStatus === 1 && stageStatus === 1) {
|
|
5249
|
-
status = "unmodified";
|
|
5250
|
-
} else if (HEADStatus === 0 && workdirStatus === 0 && stageStatus === 0) {
|
|
5251
|
-
status = "absent";
|
|
5252
|
-
}
|
|
5253
|
-
return {
|
|
5254
|
-
filepath,
|
|
5255
|
-
status
|
|
5256
|
-
};
|
|
5257
|
-
});
|
|
5258
|
-
}
|
|
5259
|
-
/**
|
|
5260
|
-
* Get the current commit hash
|
|
5261
|
-
*
|
|
5262
|
-
* @example
|
|
5263
|
-
* ```ts
|
|
5264
|
-
* const hash = await morphGit.resolveRef({
|
|
5265
|
-
* dir: './my-project',
|
|
5266
|
-
* ref: 'HEAD'
|
|
5267
|
-
* });
|
|
5268
|
-
* ```
|
|
5269
|
-
*/
|
|
5270
|
-
async resolveRef(options) {
|
|
5271
|
-
const { dir, ref } = options;
|
|
5272
|
-
const oid = await import_isomorphic_git.default.resolveRef({
|
|
5273
|
-
fs: import_fs2.default,
|
|
5274
|
-
dir,
|
|
5275
|
-
ref
|
|
5276
|
-
});
|
|
5277
|
-
return oid;
|
|
5278
|
-
}
|
|
5279
|
-
/**
|
|
5280
|
-
* Get notes (metadata, chat history, recording ID) attached to a commit
|
|
5281
|
-
*
|
|
5282
|
-
* @example
|
|
5283
|
-
* ```ts
|
|
5284
|
-
* const notes = await morphGit.getCommitMetadata({
|
|
5285
|
-
* dir: './my-project',
|
|
5286
|
-
* commitSha: 'abc123...'
|
|
5287
|
-
* });
|
|
5288
|
-
*
|
|
5289
|
-
* if (notes) {
|
|
5290
|
-
* console.log('Metadata:', notes.metadata);
|
|
5291
|
-
* console.log('Chat history:', notes.chatHistory);
|
|
5292
|
-
* console.log('Recording ID:', notes.recordingId);
|
|
5293
|
-
* }
|
|
5294
|
-
* ```
|
|
5295
|
-
*/
|
|
5296
|
-
async getCommitMetadata(options) {
|
|
5297
|
-
try {
|
|
5298
|
-
const note = await import_isomorphic_git.default.readNote({
|
|
5299
|
-
fs: import_fs2.default,
|
|
5300
|
-
dir: options.dir,
|
|
5301
|
-
ref: "refs/notes/morph-metadata",
|
|
5302
|
-
oid: options.commitSha
|
|
5303
|
-
});
|
|
5304
|
-
const notes = JSON.parse(new TextDecoder().decode(note));
|
|
5305
|
-
return notes;
|
|
5306
|
-
} catch (err) {
|
|
5307
|
-
return null;
|
|
5308
|
-
}
|
|
5309
|
-
}
|
|
5310
|
-
};
|
|
5311
|
-
|
|
5312
|
-
// git/index.ts
|
|
5313
|
-
var import_isomorphic_git2 = __toESM(require("isomorphic-git"), 1);
|
|
5314
|
-
var import_node2 = __toESM(require("isomorphic-git/http/node"), 1);
|
|
5315
|
-
|
|
5316
|
-
// tools/reflex/core.ts
|
|
5317
|
-
var BASE_MODEL = "morph-reflex-v1";
|
|
5318
|
-
function resolveClient2(clientOrConfig) {
|
|
5319
|
-
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
5320
|
-
return new MorphAPIClient({
|
|
5321
|
-
apiKey: clientOrConfig.apiKey,
|
|
5322
|
-
baseURL: clientOrConfig.baseUrl,
|
|
5323
|
-
timeout: clientOrConfig.timeout,
|
|
5324
|
-
retryConfig: clientOrConfig.retryConfig,
|
|
5325
|
-
debug: clientOrConfig.debug
|
|
5326
|
-
});
|
|
5327
|
-
}
|
|
5328
|
-
var ReflexClient = class extends APIResource {
|
|
5329
|
-
/** Train, retrieve, and manage classifier jobs. */
|
|
5330
|
-
jobs;
|
|
5331
|
-
constructor(clientOrConfig = {}) {
|
|
5332
|
-
super(resolveClient2(clientOrConfig));
|
|
5333
|
-
this.jobs = new ReflexJobsResource(this._client);
|
|
5334
|
-
}
|
|
5335
|
-
/** Classify text against one trained model. The model must be `succeeded`. */
|
|
5336
|
-
async predict(input) {
|
|
5337
|
-
const completionId = input.completionId ?? crypto.randomUUID();
|
|
5338
|
-
const raw = await this._client.post("/v1/reflex/predict", {
|
|
5339
|
-
body: { model: input.model, text: input.text },
|
|
5340
|
-
headers: { "X-Completion-Id": completionId }
|
|
5341
|
-
});
|
|
5342
|
-
return {
|
|
5343
|
-
...toClassification(raw),
|
|
5344
|
-
inferenceTimeMs: raw.inference_time_ms,
|
|
5345
|
-
prefillTokens: raw.prefill_tokens ?? 0,
|
|
5346
|
-
completionId
|
|
5347
|
-
};
|
|
5348
|
-
}
|
|
5349
|
-
/**
|
|
5350
|
-
* Classify text against several models in one request. They share a single
|
|
5351
|
-
* prefill, so the input is tokenized once — cheaper and faster than a call per
|
|
5352
|
-
* model. Each model returns its own prediction (or an `error` if it failed).
|
|
5353
|
-
*/
|
|
5354
|
-
async predictMany(input) {
|
|
5355
|
-
const completionId = input.completionId ?? crypto.randomUUID();
|
|
5356
|
-
const raw = await this._client.post("/v1/reflex/predict", {
|
|
5357
|
-
body: { models: input.models, text: input.text },
|
|
5358
|
-
headers: { "X-Completion-Id": completionId }
|
|
5359
|
-
});
|
|
5360
|
-
return {
|
|
5361
|
-
predictions: (raw.predictions ?? []).map(toPrediction),
|
|
5362
|
-
inferenceTimeMs: raw.inference_time_ms,
|
|
5363
|
-
prefillTokens: raw.prefill_tokens ?? 0,
|
|
5364
|
-
completionId
|
|
5365
|
-
};
|
|
5366
|
-
}
|
|
5367
|
-
};
|
|
5368
|
-
var ReflexJobsResource = class extends APIResource {
|
|
5369
|
-
/** Start a training job from labeled data, a description, or unlabeled text. */
|
|
5370
|
-
async create(input) {
|
|
5371
|
-
return toReflexJob(await this._client.post("/v1/fine_tuning/jobs", { body: createBody(input) }));
|
|
5372
|
-
}
|
|
5373
|
-
/** Fetch a job by id. */
|
|
5374
|
-
async retrieve(id) {
|
|
5375
|
-
return toReflexJob(await this._client.get(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}`));
|
|
5376
|
-
}
|
|
5377
|
-
/** List the caller's jobs, newest first. */
|
|
5378
|
-
async list(input = {}) {
|
|
5379
|
-
const raw = await this._client.get("/v1/fine_tuning/jobs", {
|
|
5380
|
-
query: { limit: input.limit, after: input.after }
|
|
5381
|
-
});
|
|
5382
|
-
return { data: (raw.data ?? []).map(toReflexJob), hasMore: Boolean(raw.has_more) };
|
|
5383
|
-
}
|
|
5384
|
-
/** Stop a queued or running job. */
|
|
5385
|
-
async cancel(id) {
|
|
5386
|
-
return toReflexJob(await this._client.post(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}/cancel`));
|
|
5387
|
-
}
|
|
5388
|
-
/** Delete a job and its trained model. */
|
|
5389
|
-
async delete(id) {
|
|
5390
|
-
const raw = await this._client.delete(
|
|
5391
|
-
`/v1/fine_tuning/jobs/${encodeURIComponent(id)}`
|
|
5392
|
-
);
|
|
5393
|
-
return { id: raw.id, deleted: Boolean(raw.deleted) };
|
|
5394
|
-
}
|
|
5395
|
-
/** The training loss curve as events, plus a terminal event. */
|
|
5396
|
-
async events(id) {
|
|
5397
|
-
const raw = await this._client.get(
|
|
5398
|
-
`/v1/fine_tuning/jobs/${encodeURIComponent(id)}/events`
|
|
5399
|
-
);
|
|
5400
|
-
return (raw.data ?? []).map(toReflexEvent);
|
|
5401
|
-
}
|
|
5402
|
-
/**
|
|
5403
|
-
* Poll until the job reaches a terminal status and return it on success.
|
|
5404
|
-
* Throws a `MorphError` if it fails, is cancelled, or exceeds `timeoutMs`.
|
|
5405
|
-
*/
|
|
5406
|
-
async waitForReady(id, opts = {}) {
|
|
5407
|
-
const pollMs = opts.pollMs ?? 3e3;
|
|
5408
|
-
const deadline = Date.now() + (opts.timeoutMs ?? 15 * 6e4);
|
|
5409
|
-
for (; ; ) {
|
|
5410
|
-
const job = await this.retrieve(id);
|
|
5411
|
-
if (job.status === "succeeded") return job;
|
|
5412
|
-
if (job.status === "failed" || job.status === "cancelled") {
|
|
5413
|
-
throw new MorphError(job.error?.message ?? `Reflex job ${job.status}`, `reflex_job_${job.status}`);
|
|
5414
|
-
}
|
|
5415
|
-
if (Date.now() >= deadline) {
|
|
5416
|
-
throw new MorphError(`Reflex job ${id} did not finish in time`, "reflex_timeout");
|
|
5417
|
-
}
|
|
5418
|
-
await sleep2(pollMs);
|
|
5419
|
-
}
|
|
5420
|
-
}
|
|
5421
|
-
};
|
|
5422
|
-
function createBody(input) {
|
|
5423
|
-
const base = { model: BASE_MODEL };
|
|
5424
|
-
if (input.suffix) base.suffix = input.suffix;
|
|
5425
|
-
if ("trainingData" in input) {
|
|
5426
|
-
if (input.labels) base.labels = input.labels;
|
|
5427
|
-
return { ...base, training_data: input.trainingData };
|
|
5428
|
-
}
|
|
5429
|
-
if ("generate" in input) {
|
|
5430
|
-
return {
|
|
5431
|
-
...base,
|
|
5432
|
-
labels: input.labels,
|
|
5433
|
-
generate: {
|
|
5434
|
-
description: input.generate.description,
|
|
5435
|
-
...input.generate.examplesPerLabel != null ? { examples_per_label: input.generate.examplesPerLabel } : {}
|
|
5436
|
-
}
|
|
5437
|
-
};
|
|
5438
|
-
}
|
|
5439
|
-
return {
|
|
5440
|
-
...base,
|
|
5441
|
-
labels: input.labels,
|
|
5442
|
-
label_data: {
|
|
5443
|
-
texts: input.labelData.texts,
|
|
5444
|
-
...input.labelData.description ? { description: input.labelData.description } : {}
|
|
5445
|
-
}
|
|
5446
|
-
};
|
|
5447
|
-
}
|
|
5448
|
-
function toReflexJob(raw) {
|
|
5449
|
-
return {
|
|
5450
|
-
id: raw.id,
|
|
5451
|
-
object: "fine_tuning.job",
|
|
5452
|
-
model: raw.model,
|
|
5453
|
-
createdAt: raw.created_at,
|
|
5454
|
-
finishedAt: raw.finished_at ?? null,
|
|
5455
|
-
fineTunedModel: raw.fine_tuned_model ?? null,
|
|
5456
|
-
status: raw.status,
|
|
5457
|
-
labels: raw.labels ?? [],
|
|
5458
|
-
trainedExamples: raw.trained_examples ?? 0,
|
|
5459
|
-
result: raw.result ? { accuracy: raw.result.accuracy ?? null, f1Score: raw.result.f1_score ?? null } : null,
|
|
5460
|
-
error: raw.error ? { message: raw.error.message } : null,
|
|
5461
|
-
suffix: raw.suffix ?? null
|
|
5462
|
-
};
|
|
5463
|
-
}
|
|
5464
|
-
function toClassification(raw) {
|
|
5465
|
-
const classes = (raw.classes ?? []).map((c) => ({
|
|
5466
|
-
classId: c.class_id,
|
|
5467
|
-
label: c.label,
|
|
5468
|
-
score: c.score,
|
|
5469
|
-
selected: c.selected
|
|
5470
|
-
}));
|
|
5471
|
-
const selectedClasses = classes.filter((c) => c.selected);
|
|
5472
|
-
const top = selectedClasses.reduce(
|
|
5473
|
-
(best, c) => best === null || c.score > best.score ? c : best,
|
|
5474
|
-
null
|
|
5475
|
-
);
|
|
5476
|
-
return {
|
|
5477
|
-
model: raw.model,
|
|
5478
|
-
mode: raw.mode === "multi_label" ? "multi_label" : "single_label",
|
|
5479
|
-
classes,
|
|
5480
|
-
selected: selectedClasses.map((c) => c.label),
|
|
5481
|
-
label: top ? top.label : null,
|
|
5482
|
-
confidence: top ? top.score : null
|
|
5483
|
-
};
|
|
5484
|
-
}
|
|
5485
|
-
function toPrediction(raw) {
|
|
5486
|
-
const error = raw.error ? { message: typeof raw.error === "string" ? raw.error : raw.error.message } : null;
|
|
5487
|
-
return { ...toClassification(raw), error };
|
|
5488
|
-
}
|
|
5489
|
-
function toReflexEvent(raw) {
|
|
5490
|
-
return {
|
|
5491
|
-
id: raw.id,
|
|
5492
|
-
createdAt: raw.created_at,
|
|
5493
|
-
level: raw.level,
|
|
5494
|
-
message: raw.message,
|
|
5495
|
-
type: raw.type,
|
|
5496
|
-
data: { epoch: raw.data?.epoch ?? 0, step: raw.data?.step ?? 0, trainLoss: raw.data?.train_loss ?? 0 }
|
|
5497
|
-
};
|
|
5498
|
-
}
|
|
5499
|
-
function sleep2(ms) {
|
|
5500
|
-
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
5501
|
-
}
|
|
5502
|
-
|
|
5503
|
-
// tools/traces/core.ts
|
|
5504
|
-
var TracesClient = class extends APIResource {
|
|
5505
|
-
/** List traced turns, newest first. Filter by `convoId`; page with `limit`/`offset`. */
|
|
5506
|
-
async list(input = {}) {
|
|
5507
|
-
const raw = await this._client.get("/v1/reflex/traces", {
|
|
5508
|
-
query: { convo_id: input.convoId, limit: input.limit, offset: input.offset }
|
|
5509
|
-
});
|
|
5510
|
-
return {
|
|
5511
|
-
data: (raw.data ?? []).map(toTrace),
|
|
5512
|
-
hasMore: Boolean(raw.has_more),
|
|
5513
|
-
offset: raw.offset ?? 0
|
|
5514
|
-
};
|
|
5515
|
-
}
|
|
5516
|
-
};
|
|
5517
|
-
function toReflexResult(raw) {
|
|
5518
|
-
return {
|
|
5519
|
-
model: raw.model,
|
|
5520
|
-
transform: raw.transform,
|
|
5521
|
-
label: raw.label ?? null,
|
|
5522
|
-
score: raw.score,
|
|
5523
|
-
selected: raw.selected ?? [],
|
|
5524
|
-
status: raw.status,
|
|
5525
|
-
transformVersion: raw.transform_version
|
|
5526
|
-
};
|
|
5527
|
-
}
|
|
5528
|
-
function toTrace(raw) {
|
|
5529
|
-
return {
|
|
5530
|
-
convoId: raw.convo_id,
|
|
5531
|
-
eventId: raw.event_id,
|
|
5532
|
-
spanKind: raw.span_kind,
|
|
5533
|
-
model: raw.model,
|
|
5534
|
-
inputText: raw.input_text,
|
|
5535
|
-
outputText: raw.output_text,
|
|
5536
|
-
startTime: raw.start_time,
|
|
5537
|
-
reflexResults: (raw.reflex_results ?? []).map(toReflexResult)
|
|
5538
|
-
};
|
|
5539
|
-
}
|
|
5540
|
-
|
|
5541
4746
|
// modelrouter/core.ts
|
|
5542
4747
|
init_logger();
|
|
5543
4748
|
var DEFAULT_API_URL5 = "https://api.morphllm.com";
|
|
5544
4749
|
var DEFAULT_TIMEOUT6 = 5e3;
|
|
5545
|
-
function
|
|
4750
|
+
function resolveClient2(clientOrConfig) {
|
|
5546
4751
|
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
5547
4752
|
return new MorphAPIClient({
|
|
5548
4753
|
apiKey: clientOrConfig.apiKey,
|
|
@@ -5556,7 +4761,7 @@ var BaseRouter = class extends APIResource {
|
|
|
5556
4761
|
provider;
|
|
5557
4762
|
timeout;
|
|
5558
4763
|
constructor(provider, clientOrConfig = {}) {
|
|
5559
|
-
super(
|
|
4764
|
+
super(resolveClient2(clientOrConfig));
|
|
5560
4765
|
this.provider = provider;
|
|
5561
4766
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
5562
4767
|
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT6;
|
|
@@ -5663,7 +4868,7 @@ var RawRouter = class extends BaseRouter {
|
|
|
5663
4868
|
var RouterClassifier = class extends APIResource {
|
|
5664
4869
|
timeout;
|
|
5665
4870
|
constructor(clientOrConfig = {}) {
|
|
5666
|
-
super(
|
|
4871
|
+
super(resolveClient2(clientOrConfig));
|
|
5667
4872
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
5668
4873
|
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT6;
|
|
5669
4874
|
}
|
|
@@ -7087,8 +6292,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7087
6292
|
browser;
|
|
7088
6293
|
/** GitHub tool for PR context, comments, and check runs */
|
|
7089
6294
|
github;
|
|
7090
|
-
/** Git tool for version control operations */
|
|
7091
|
-
git;
|
|
7092
6295
|
/** Model routers for intelligent model selection */
|
|
7093
6296
|
routers;
|
|
7094
6297
|
/** OpenAI-compatible tool factories */
|
|
@@ -7099,10 +6302,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7099
6302
|
vercel;
|
|
7100
6303
|
/** Compact context with line ranges */
|
|
7101
6304
|
compact;
|
|
7102
|
-
/** Reflex: train and serve small text classifiers */
|
|
7103
|
-
reflex;
|
|
7104
|
-
/** Traces: read back turns shipped with `morphTracing()`, with their Reflex labels */
|
|
7105
|
-
traces;
|
|
7106
6305
|
/**
|
|
7107
6306
|
* Create a new Morph SDK client
|
|
7108
6307
|
*
|
|
@@ -7134,7 +6333,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7134
6333
|
this.warpGrep = new WarpGrepClient(this);
|
|
7135
6334
|
this.browser = new BrowserClient(this);
|
|
7136
6335
|
this.github = new GitHubClient(this, { installationId: config.github?.installationId });
|
|
7137
|
-
this.git = new MorphGit(this);
|
|
7138
6336
|
this.routers = {
|
|
7139
6337
|
openai: new OpenAIRouter(this),
|
|
7140
6338
|
anthropic: new AnthropicRouter(this),
|
|
@@ -7144,8 +6342,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7144
6342
|
};
|
|
7145
6343
|
const compactClient = new CompactClient(this);
|
|
7146
6344
|
this.compact = compactClient.compact.bind(compactClient);
|
|
7147
|
-
this.reflex = new ReflexClient(this);
|
|
7148
|
-
this.traces = new TracesClient(this);
|
|
7149
6345
|
this.openai = new OpenAIToolFactory(config);
|
|
7150
6346
|
this.anthropic = new AnthropicToolFactory(config);
|
|
7151
6347
|
this.vercel = new VercelToolFactory(config);
|