@morphllm/morphsdk 0.2.195 → 0.2.197
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/ai-sdk/index.cjs.map +1 -1
- package/dist/ai-sdk/index.d.ts +1 -1
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/{chunk-XUMLQ7AJ.js → chunk-2BT4UGKH.js} +2 -2
- package/dist/{chunk-FNN5776O.js → chunk-2HXELZI5.js} +2 -2
- package/dist/{chunk-JGC6S5SB.js → chunk-2XDSHAB5.js} +2 -2
- package/dist/{chunk-LOXY4VVO.js → chunk-4FWK3CEH.js} +31 -37
- package/dist/{chunk-LOXY4VVO.js.map → chunk-4FWK3CEH.js.map} +1 -1
- package/dist/{chunk-LNXRPEMK.js → chunk-6YZCPCAY.js} +4 -4
- package/dist/{chunk-KDVOJBKE.js → chunk-7QOGUY4A.js} +3 -3
- package/dist/{chunk-H353ZTXC.js → chunk-BECYWCEZ.js} +4 -4
- package/dist/{chunk-MUK6LFVY.js → chunk-DHGXGVHC.js} +7 -7
- package/dist/{chunk-FC3HXR2Q.js → chunk-DNL4DMMS.js} +2 -2
- package/dist/{chunk-QGR6OVVY.js → chunk-DW6ZIVCM.js} +3 -3
- package/dist/{chunk-MPTEH2CO.js → chunk-EGI642TV.js} +3 -9
- package/dist/chunk-EGI642TV.js.map +1 -0
- package/dist/{chunk-35U2MW77.js → chunk-FLWBVHDC.js} +4 -4
- package/dist/{chunk-PSFKWZKR.js → chunk-GE5MNVT7.js} +2 -2
- package/dist/{chunk-O3GWJKDO.js → chunk-JU6TCHVI.js} +2 -2
- package/dist/{chunk-R5XYEQV6.js → chunk-JZJY2XFQ.js} +2 -2
- package/dist/{chunk-DUPKDVNP.js → chunk-LRHJVSSD.js} +2 -2
- package/dist/{chunk-HLSOQ7MP.js → chunk-NKFAMQF2.js} +3 -3
- package/dist/{chunk-VLZ6PNAD.js → chunk-OPNTDMHH.js} +4 -4
- package/dist/{chunk-L7U5WS4B.js → chunk-PQCOBN7L.js} +4 -4
- package/dist/{chunk-6FVLHSQ6.js → chunk-SVD3YRWM.js} +2 -2
- package/dist/{chunk-LXRSNY7W.js → chunk-TJUZAO7T.js} +2 -2
- package/dist/{chunk-BSJVZEHN.js → chunk-UOS3XKJD.js} +2 -2
- package/dist/{chunk-SFLWBHK2.js → chunk-UZA2ODNU.js} +2 -2
- package/dist/{chunk-H2YBEXR4.js → chunk-VGCPVDFP.js} +2 -2
- package/dist/{chunk-K75R3X5V.js → chunk-VJD6MF3M.js} +3 -3
- package/dist/{chunk-6P4KCGAG.js → chunk-W34BUTVR.js} +2 -2
- package/dist/{chunk-ORDOOXPQ.js → chunk-WDLDKJHT.js} +6 -6
- package/dist/{chunk-HHKAZTGY.js → chunk-WFOGTZF6.js} +2 -2
- package/dist/{chunk-2YOE44FF.js → chunk-WN6YLBEH.js} +3 -3
- package/dist/{chunk-GWFZGS3Z.js → chunk-YVKRPVOM.js} +4 -4
- package/dist/{chunk-4YWADZPB.js → chunk-ZA3UJRSE.js} +2 -2
- package/dist/{client-Rn1zymAl.d.ts → client-B3fWTCcL.d.ts} +0 -3
- package/dist/client.cjs +4 -567
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -5
- package/dist/client.js +32 -34
- package/dist/core/client.cjs +2 -8
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -8
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -8
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/edge.cjs +2 -8
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/index.cjs +4 -569
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +38 -43
- package/dist/modelrouter/core.cjs +2 -8
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +5 -5
- package/dist/modelrouter/index.cjs +2 -8
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +5 -5
- package/dist/subagents/anthropic.cjs +2 -8
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +11 -11
- package/dist/subagents/vercel.cjs +2 -8
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +11 -11
- package/dist/tools/browser/anthropic.cjs +2 -8
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -7
- package/dist/tools/browser/core.cjs +2 -8
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +6 -6
- package/dist/tools/browser/index.cjs +2 -8
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +11 -11
- package/dist/tools/browser/openai.cjs +2 -8
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -7
- package/dist/tools/browser/profiles/core.cjs +2 -8
- 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 -8
- 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 -8
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +7 -7
- package/dist/tools/codebase_search/anthropic.cjs +2 -8
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +6 -6
- package/dist/tools/codebase_search/core.cjs +2 -8
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +5 -5
- package/dist/tools/codebase_search/index.cjs +2 -8
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +10 -10
- package/dist/tools/codebase_search/openai.cjs +2 -8
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +6 -6
- package/dist/tools/codebase_search/vercel.cjs +2 -8
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +6 -6
- package/dist/tools/compact/core.cjs +2 -8
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +5 -5
- package/dist/tools/compact/index.cjs +2 -8
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +2 -8
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +7 -7
- package/dist/tools/fastapply/apply.cjs +2 -8
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -8
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +6 -6
- package/dist/tools/fastapply/index.cjs +2 -8
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +13 -13
- package/dist/tools/fastapply/openai.cjs +2 -8
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +7 -7
- package/dist/tools/fastapply/vercel.cjs +2 -8
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +7 -7
- package/dist/tools/index.cjs +2 -8
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +13 -13
- package/dist/tools/reflex/core.cjs +2 -8
- package/dist/tools/reflex/core.cjs.map +1 -1
- package/dist/tools/reflex/core.js +5 -5
- package/dist/tools/reflex/index.cjs +2 -8
- package/dist/tools/reflex/index.cjs.map +1 -1
- package/dist/tools/reflex/index.js +5 -5
- package/dist/tools/utils/resilience.cjs +2 -8
- 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 -8
- 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 -8
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +11 -11
- package/dist/tools/warp_grep/client.cjs +2 -8
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +10 -10
- package/dist/tools/warp_grep/gemini.cjs +2 -8
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +10 -10
- package/dist/tools/warp_grep/harness.js +6 -6
- package/dist/tools/warp_grep/index.cjs +2 -8
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +14 -14
- package/dist/tools/warp_grep/openai.cjs +2 -8
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +11 -11
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +2 -8
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +11 -11
- package/dist/version.cjs +2 -8
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -8
- package/dist/chunk-GZMUGMOZ.js +0 -9
- package/dist/chunk-GZMUGMOZ.js.map +0 -1
- package/dist/chunk-MPTEH2CO.js.map +0 -1
- package/dist/chunk-QSMGHCAG.js +0 -561
- package/dist/chunk-QSMGHCAG.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/{chunk-XUMLQ7AJ.js.map → chunk-2BT4UGKH.js.map} +0 -0
- /package/dist/{chunk-FNN5776O.js.map → chunk-2HXELZI5.js.map} +0 -0
- /package/dist/{chunk-JGC6S5SB.js.map → chunk-2XDSHAB5.js.map} +0 -0
- /package/dist/{chunk-LNXRPEMK.js.map → chunk-6YZCPCAY.js.map} +0 -0
- /package/dist/{chunk-KDVOJBKE.js.map → chunk-7QOGUY4A.js.map} +0 -0
- /package/dist/{chunk-H353ZTXC.js.map → chunk-BECYWCEZ.js.map} +0 -0
- /package/dist/{chunk-MUK6LFVY.js.map → chunk-DHGXGVHC.js.map} +0 -0
- /package/dist/{chunk-FC3HXR2Q.js.map → chunk-DNL4DMMS.js.map} +0 -0
- /package/dist/{chunk-QGR6OVVY.js.map → chunk-DW6ZIVCM.js.map} +0 -0
- /package/dist/{chunk-35U2MW77.js.map → chunk-FLWBVHDC.js.map} +0 -0
- /package/dist/{chunk-PSFKWZKR.js.map → chunk-GE5MNVT7.js.map} +0 -0
- /package/dist/{chunk-O3GWJKDO.js.map → chunk-JU6TCHVI.js.map} +0 -0
- /package/dist/{chunk-R5XYEQV6.js.map → chunk-JZJY2XFQ.js.map} +0 -0
- /package/dist/{chunk-DUPKDVNP.js.map → chunk-LRHJVSSD.js.map} +0 -0
- /package/dist/{chunk-HLSOQ7MP.js.map → chunk-NKFAMQF2.js.map} +0 -0
- /package/dist/{chunk-VLZ6PNAD.js.map → chunk-OPNTDMHH.js.map} +0 -0
- /package/dist/{chunk-L7U5WS4B.js.map → chunk-PQCOBN7L.js.map} +0 -0
- /package/dist/{chunk-6FVLHSQ6.js.map → chunk-SVD3YRWM.js.map} +0 -0
- /package/dist/{chunk-LXRSNY7W.js.map → chunk-TJUZAO7T.js.map} +0 -0
- /package/dist/{chunk-BSJVZEHN.js.map → chunk-UOS3XKJD.js.map} +0 -0
- /package/dist/{chunk-SFLWBHK2.js.map → chunk-UZA2ODNU.js.map} +0 -0
- /package/dist/{chunk-H2YBEXR4.js.map → chunk-VGCPVDFP.js.map} +0 -0
- /package/dist/{chunk-K75R3X5V.js.map → chunk-VJD6MF3M.js.map} +0 -0
- /package/dist/{chunk-6P4KCGAG.js.map → chunk-W34BUTVR.js.map} +0 -0
- /package/dist/{chunk-ORDOOXPQ.js.map → chunk-WDLDKJHT.js.map} +0 -0
- /package/dist/{chunk-HHKAZTGY.js.map → chunk-WFOGTZF6.js.map} +0 -0
- /package/dist/{chunk-2YOE44FF.js.map → chunk-WN6YLBEH.js.map} +0 -0
- /package/dist/{chunk-GWFZGS3Z.js.map → chunk-YVKRPVOM.js.map} +0 -0
- /package/dist/{chunk-4YWADZPB.js.map → chunk-ZA3UJRSE.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.197",
|
|
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",
|
|
@@ -223,7 +218,7 @@ var init_package = __esm({
|
|
|
223
218
|
"!dist/**/*.test.*"
|
|
224
219
|
],
|
|
225
220
|
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
|
|
221
|
+
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/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/traces/index.ts tools/traces/core.ts tools/traces/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
222
|
prepare: "npm run build",
|
|
228
223
|
typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
|
|
229
224
|
lint: "eslint .",
|
|
@@ -260,7 +255,6 @@ var init_package = __esm({
|
|
|
260
255
|
"@vscode/ripgrep": "^1.17.0",
|
|
261
256
|
ai: ">=5.0.0",
|
|
262
257
|
diff: "^7.0.0",
|
|
263
|
-
"isomorphic-git": "^1.25.10",
|
|
264
258
|
openai: "^4.52.7",
|
|
265
259
|
zod: ">=3.23.0"
|
|
266
260
|
},
|
|
@@ -334,8 +328,8 @@ var init_logger = __esm({
|
|
|
334
328
|
this.fileStream = null;
|
|
335
329
|
const f = typeof process !== "undefined" ? process.env.MORPH_LOG_FILE : void 0;
|
|
336
330
|
if (f) {
|
|
337
|
-
this.ready = import("fs").then((
|
|
338
|
-
this.fileStream =
|
|
331
|
+
this.ready = import("fs").then((fs4) => {
|
|
332
|
+
this.fileStream = fs4.createWriteStream(f, { flags: "a" });
|
|
339
333
|
}).catch(() => {
|
|
340
334
|
});
|
|
341
335
|
} else {
|
|
@@ -4759,560 +4753,6 @@ var GitHubClient = class extends APIResource {
|
|
|
4759
4753
|
}
|
|
4760
4754
|
};
|
|
4761
4755
|
|
|
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
4756
|
// tools/reflex/core.ts
|
|
5317
4757
|
var BASE_MODEL = "morph-reflex-v1";
|
|
5318
4758
|
function resolveClient2(clientOrConfig) {
|
|
@@ -7087,8 +6527,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7087
6527
|
browser;
|
|
7088
6528
|
/** GitHub tool for PR context, comments, and check runs */
|
|
7089
6529
|
github;
|
|
7090
|
-
/** Git tool for version control operations */
|
|
7091
|
-
git;
|
|
7092
6530
|
/** Model routers for intelligent model selection */
|
|
7093
6531
|
routers;
|
|
7094
6532
|
/** OpenAI-compatible tool factories */
|
|
@@ -7134,7 +6572,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
7134
6572
|
this.warpGrep = new WarpGrepClient(this);
|
|
7135
6573
|
this.browser = new BrowserClient(this);
|
|
7136
6574
|
this.github = new GitHubClient(this, { installationId: config.github?.installationId });
|
|
7137
|
-
this.git = new MorphGit(this);
|
|
7138
6575
|
this.routers = {
|
|
7139
6576
|
openai: new OpenAIRouter(this),
|
|
7140
6577
|
anthropic: new AnthropicRouter(this),
|