@morphllm/morphsdk 0.2.111 → 0.2.113
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-JYKYQ5DN.js → chunk-2SOSDQFG.js} +19 -40
- package/dist/chunk-2SOSDQFG.js.map +1 -0
- package/dist/{chunk-I3IN742Q.js → chunk-A3PK4H7A.js} +2 -2
- package/dist/{chunk-KQP6ZPYB.js → chunk-JD4H6U3Z.js} +2 -2
- package/dist/{chunk-TLC3QKE6.js → chunk-R3BSIJCL.js} +4 -3
- package/dist/{chunk-TLC3QKE6.js.map → chunk-R3BSIJCL.js.map} +1 -1
- package/dist/{chunk-HDRLLCAD.js → chunk-TGUQHW3I.js} +2 -2
- package/dist/{chunk-2MAUPERG.js → chunk-Z6TF5G4R.js} +5 -4
- package/dist/chunk-Z6TF5G4R.js.map +1 -0
- package/dist/{client-DksVOIsG.d.ts → client-Bm_umdno.d.ts} +3 -14
- package/dist/client.cjs +21 -40
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +6 -6
- package/dist/edge.cjs +4 -3
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +1 -1
- package/dist/index.cjs +21 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +7 -5
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +3 -3
- package/dist/tools/fastapply/apply.cjs +4 -3
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.d.ts +4 -1
- package/dist/tools/fastapply/apply.js +1 -1
- package/dist/tools/fastapply/core.cjs +7 -5
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +2 -2
- package/dist/tools/fastapply/index.cjs +7 -5
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +5 -5
- package/dist/tools/fastapply/openai.cjs +7 -5
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +3 -3
- package/dist/tools/fastapply/types.cjs.map +1 -1
- package/dist/tools/fastapply/types.d.ts +5 -0
- package/dist/tools/fastapply/vercel.cjs +7 -5
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +3 -3
- package/dist/tools/index.cjs +7 -5
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-2MAUPERG.js.map +0 -1
- package/dist/chunk-JYKYQ5DN.js.map +0 -1
- /package/dist/{chunk-I3IN742Q.js.map → chunk-A3PK4H7A.js.map} +0 -0
- /package/dist/{chunk-KQP6ZPYB.js.map → chunk-JD4H6U3Z.js.map} +0 -0
- /package/dist/{chunk-HDRLLCAD.js.map → chunk-TGUQHW3I.js.map} +0 -0
package/dist/client.cjs
CHANGED
|
@@ -196,7 +196,7 @@ async function callMorphAPI(originalCode, codeEdit, instructions, filepath, conf
|
|
|
196
196
|
if (debug) {
|
|
197
197
|
console.log(`[FastApply] \u2705 Success in ${elapsed}ms, merged: ${data.choices[0].message.content.length} chars`);
|
|
198
198
|
}
|
|
199
|
-
return data.choices[0].message.content;
|
|
199
|
+
return { content: data.choices[0].message.content, completionId: data.id };
|
|
200
200
|
}
|
|
201
201
|
async function applyEdit(input, config = {}) {
|
|
202
202
|
const debug = config.debug || false;
|
|
@@ -205,7 +205,7 @@ async function applyEdit(input, config = {}) {
|
|
|
205
205
|
if (debug) {
|
|
206
206
|
console.log(`[FastApply] Applying edit to code (${input.originalCode.length} chars)`);
|
|
207
207
|
}
|
|
208
|
-
const mergedCode = await callMorphAPI(
|
|
208
|
+
const { content: mergedCode, completionId } = await callMorphAPI(
|
|
209
209
|
input.originalCode,
|
|
210
210
|
input.codeEdit,
|
|
211
211
|
input.instructions,
|
|
@@ -218,7 +218,8 @@ async function applyEdit(input, config = {}) {
|
|
|
218
218
|
success: true,
|
|
219
219
|
mergedCode,
|
|
220
220
|
udiff,
|
|
221
|
-
changes
|
|
221
|
+
changes,
|
|
222
|
+
completionId
|
|
222
223
|
};
|
|
223
224
|
} catch (error) {
|
|
224
225
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -867,7 +868,7 @@ async function executeEditFile(input, config = {}) {
|
|
|
867
868
|
}
|
|
868
869
|
if (debug) console.log(`[FastApply] File doesn't exist, will create new file`);
|
|
869
870
|
}
|
|
870
|
-
const mergedCode = await callMorphAPI2(originalCode, input.code_edit, input.instructions, input.target_filepath, config);
|
|
871
|
+
const { content: mergedCode, completionId } = await callMorphAPI2(originalCode, input.code_edit, input.instructions, input.target_filepath, config);
|
|
871
872
|
const udiff = config.generateUdiff !== false ? generateUdiff2(originalCode, mergedCode, input.target_filepath) : void 0;
|
|
872
873
|
if (config.autoWrite !== false) {
|
|
873
874
|
await writeFile(fullPath, mergedCode, "utf-8");
|
|
@@ -878,7 +879,8 @@ async function executeEditFile(input, config = {}) {
|
|
|
878
879
|
success: true,
|
|
879
880
|
filepath: input.target_filepath,
|
|
880
881
|
udiff,
|
|
881
|
-
changes
|
|
882
|
+
changes,
|
|
883
|
+
completionId
|
|
882
884
|
};
|
|
883
885
|
} catch (error) {
|
|
884
886
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -3688,13 +3690,11 @@ var PermissionError = class extends GitHubError {
|
|
|
3688
3690
|
};
|
|
3689
3691
|
|
|
3690
3692
|
// tools/github/core.ts
|
|
3691
|
-
var
|
|
3692
|
-
var BACKEND_BASE_URL = "https://browser.morphllm.com";
|
|
3693
|
+
var DEFAULT_BASE_URL = "https://api.morphllm.com";
|
|
3693
3694
|
var DEFAULT_TIMEOUT2 = 3e4;
|
|
3694
3695
|
var GitHubClient = class {
|
|
3695
3696
|
apiKey;
|
|
3696
|
-
|
|
3697
|
-
backendUrl;
|
|
3697
|
+
baseUrl;
|
|
3698
3698
|
timeout;
|
|
3699
3699
|
debug;
|
|
3700
3700
|
defaultInstallationId;
|
|
@@ -3721,8 +3721,7 @@ var GitHubClient = class {
|
|
|
3721
3721
|
}
|
|
3722
3722
|
constructor(config = {}) {
|
|
3723
3723
|
this.apiKey = config.apiKey || process.env.MORPH_API_KEY || "";
|
|
3724
|
-
this.
|
|
3725
|
-
this.backendUrl = config.backendUrl || BACKEND_BASE_URL;
|
|
3724
|
+
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
3726
3725
|
this.timeout = config.timeout || DEFAULT_TIMEOUT2;
|
|
3727
3726
|
this.debug = config.debug || false;
|
|
3728
3727
|
this.defaultInstallationId = config.installationId;
|
|
@@ -3767,24 +3766,10 @@ var GitHubClient = class {
|
|
|
3767
3766
|
};
|
|
3768
3767
|
}
|
|
3769
3768
|
/**
|
|
3770
|
-
* Make an API request
|
|
3769
|
+
* Make an authenticated API request
|
|
3771
3770
|
*/
|
|
3772
3771
|
async request(method, path5, body) {
|
|
3773
|
-
|
|
3774
|
-
}
|
|
3775
|
-
// TODO: These endpoints use Octokit and currently live in landing.
|
|
3776
|
-
// Move them to the backend so all GitHub SDK traffic goes through a single URL.
|
|
3777
|
-
/**
|
|
3778
|
-
* Make an API request to the landing app (Octokit-based endpoints)
|
|
3779
|
-
*/
|
|
3780
|
-
async landingRequest(method, path5, body) {
|
|
3781
|
-
return this._fetch(this.landingUrl, method, path5, body);
|
|
3782
|
-
}
|
|
3783
|
-
/**
|
|
3784
|
-
* Shared fetch logic for both backend and landing requests
|
|
3785
|
-
*/
|
|
3786
|
-
async _fetch(baseUrl, method, path5, body) {
|
|
3787
|
-
const url = `${baseUrl}${path5}`;
|
|
3772
|
+
const url = `${this.baseUrl}${path5}`;
|
|
3788
3773
|
if (this.debug) {
|
|
3789
3774
|
console.log(`[GitHub SDK] ${method} ${path5}`, body || "");
|
|
3790
3775
|
}
|
|
@@ -3916,7 +3901,6 @@ var GitHubClient = class {
|
|
|
3916
3901
|
}
|
|
3917
3902
|
// ==========================================================================
|
|
3918
3903
|
// Pull Requests
|
|
3919
|
-
// TODO: Move to backend — currently uses Octokit in landing
|
|
3920
3904
|
// ==========================================================================
|
|
3921
3905
|
async listPullRequests(input) {
|
|
3922
3906
|
const installationId = this.getInstallationId(input);
|
|
@@ -3926,7 +3910,7 @@ var GitHubClient = class {
|
|
|
3926
3910
|
...input.state && { state: input.state },
|
|
3927
3911
|
...installationId && { installationId }
|
|
3928
3912
|
});
|
|
3929
|
-
return this.
|
|
3913
|
+
return this.request("GET", `/api/v1/github/pulls?${params}`);
|
|
3930
3914
|
}
|
|
3931
3915
|
async getPullRequest(input) {
|
|
3932
3916
|
const installationId = this.getInstallationId(input);
|
|
@@ -3935,14 +3919,13 @@ var GitHubClient = class {
|
|
|
3935
3919
|
repo: input.repo,
|
|
3936
3920
|
...installationId && { installationId }
|
|
3937
3921
|
});
|
|
3938
|
-
return this.
|
|
3922
|
+
return this.request(
|
|
3939
3923
|
"GET",
|
|
3940
3924
|
`/api/v1/github/pulls/${input.number}?${params}`
|
|
3941
3925
|
);
|
|
3942
3926
|
}
|
|
3943
3927
|
// ==========================================================================
|
|
3944
3928
|
// Deployments
|
|
3945
|
-
// TODO: Move to backend — currently uses Octokit in landing
|
|
3946
3929
|
// ==========================================================================
|
|
3947
3930
|
async listDeployments(input) {
|
|
3948
3931
|
const installationId = this.getInstallationId(input);
|
|
@@ -3953,11 +3936,10 @@ var GitHubClient = class {
|
|
|
3953
3936
|
...input.environment && { environment: input.environment },
|
|
3954
3937
|
...installationId && { installationId }
|
|
3955
3938
|
});
|
|
3956
|
-
return this.
|
|
3939
|
+
return this.request("GET", `/api/v1/github/deployments?${params}`);
|
|
3957
3940
|
}
|
|
3958
3941
|
// ==========================================================================
|
|
3959
3942
|
// Comments
|
|
3960
|
-
// TODO: Move to backend — currently uses Octokit in landing
|
|
3961
3943
|
// ==========================================================================
|
|
3962
3944
|
async listComments(input) {
|
|
3963
3945
|
const installationId = this.getInstallationId(input);
|
|
@@ -3967,11 +3949,11 @@ var GitHubClient = class {
|
|
|
3967
3949
|
pr: String(input.pr),
|
|
3968
3950
|
...installationId && { installationId }
|
|
3969
3951
|
});
|
|
3970
|
-
return this.
|
|
3952
|
+
return this.request("GET", `/api/v1/github/comments?${params}`);
|
|
3971
3953
|
}
|
|
3972
3954
|
async createComment(input) {
|
|
3973
3955
|
const installationId = this.getInstallationId(input);
|
|
3974
|
-
return this.
|
|
3956
|
+
return this.request("POST", "/api/v1/github/comments", {
|
|
3975
3957
|
owner: input.owner,
|
|
3976
3958
|
repo: input.repo,
|
|
3977
3959
|
pr: input.pr,
|
|
@@ -3981,7 +3963,7 @@ var GitHubClient = class {
|
|
|
3981
3963
|
}
|
|
3982
3964
|
async updateComment(input) {
|
|
3983
3965
|
const installationId = this.getInstallationId(input);
|
|
3984
|
-
return this.
|
|
3966
|
+
return this.request("PATCH", `/api/v1/github/comments/${input.commentId}`, {
|
|
3985
3967
|
owner: input.owner,
|
|
3986
3968
|
repo: input.repo,
|
|
3987
3969
|
body: input.body,
|
|
@@ -3995,15 +3977,14 @@ var GitHubClient = class {
|
|
|
3995
3977
|
repo: input.repo,
|
|
3996
3978
|
...installationId && { installationId }
|
|
3997
3979
|
});
|
|
3998
|
-
await this.
|
|
3980
|
+
await this.request("DELETE", `/api/v1/github/comments/${input.commentId}?${params}`);
|
|
3999
3981
|
}
|
|
4000
3982
|
// ==========================================================================
|
|
4001
3983
|
// Check Runs
|
|
4002
|
-
// TODO: Move to backend — currently uses Octokit in landing
|
|
4003
3984
|
// ==========================================================================
|
|
4004
3985
|
async createCheckRun(input) {
|
|
4005
3986
|
const installationId = this.getInstallationId(input);
|
|
4006
|
-
return this.
|
|
3987
|
+
return this.request("POST", "/api/v1/github/check-runs", {
|
|
4007
3988
|
owner: input.owner,
|
|
4008
3989
|
repo: input.repo,
|
|
4009
3990
|
sha: input.sha,
|
|
@@ -4016,7 +3997,7 @@ var GitHubClient = class {
|
|
|
4016
3997
|
}
|
|
4017
3998
|
async updateCheckRun(input) {
|
|
4018
3999
|
const installationId = this.getInstallationId(input);
|
|
4019
|
-
return this.
|
|
4000
|
+
return this.request("PATCH", `/api/v1/github/check-runs/${input.checkRunId}`, {
|
|
4020
4001
|
owner: input.owner,
|
|
4021
4002
|
repo: input.repo,
|
|
4022
4003
|
...input.status && { status: input.status },
|