@morphllm/morphsdk 0.2.93 → 0.2.95
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-2AMEQAO2.js +46 -0
- package/dist/chunk-2AMEQAO2.js.map +1 -0
- package/dist/{chunk-EI4UKP24.js → chunk-2HMEZZKK.js} +2 -2
- package/dist/{chunk-EI4UKP24.js.map → chunk-2HMEZZKK.js.map} +1 -1
- package/dist/chunk-2VERUKO2.js +177 -0
- package/dist/chunk-2VERUKO2.js.map +1 -0
- package/dist/{chunk-VHOWYK66.js → chunk-43LQLGP6.js} +23 -33
- package/dist/chunk-43LQLGP6.js.map +1 -0
- package/dist/{chunk-LMUZ3NGC.js → chunk-73RV6EXR.js} +2 -2
- package/dist/{chunk-PBLPZ6AU.js → chunk-7D6TXC7X.js} +2 -2
- package/dist/{chunk-GU6DACME.js → chunk-O7LDZA52.js} +2 -2
- package/dist/{chunk-5QIWYEHJ.js → chunk-PE4KGDA6.js} +1 -8
- package/dist/chunk-PE4KGDA6.js.map +1 -0
- package/dist/{chunk-SQN4DUQS.js → chunk-Q6Y4R236.js} +26 -2
- package/dist/chunk-Q6Y4R236.js.map +1 -0
- package/dist/{chunk-PUGIOVSP.js → chunk-QAT5UVPX.js} +2 -2
- package/dist/{chunk-MIIJWDOQ.js → chunk-QJP62BXH.js} +166 -71
- package/dist/chunk-QJP62BXH.js.map +1 -0
- package/dist/{chunk-EYGBUH2R.js → chunk-R7IQWNSA.js} +8 -8
- package/dist/chunk-R7IQWNSA.js.map +1 -0
- package/dist/chunk-SI2CKRKJ.js +389 -0
- package/dist/chunk-SI2CKRKJ.js.map +1 -0
- package/dist/{chunk-4WLGDYWQ.js → chunk-TSENDJQI.js} +6 -6
- package/dist/chunk-TSENDJQI.js.map +1 -0
- package/dist/{chunk-IUG2FHNN.js → chunk-XH7P7HVT.js} +1 -8
- package/dist/chunk-XH7P7HVT.js.map +1 -0
- package/dist/{chunk-FNLNDMIX.js → chunk-YZ5NCWO2.js} +6 -6
- package/dist/chunk-YZ5NCWO2.js.map +1 -0
- package/dist/{chunk-IJ54DTJ3.js → chunk-ZYTAKEBW.js} +13 -13
- package/dist/client.cjs +770 -110
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +16 -13
- package/dist/index.cjs +770 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -13
- package/dist/tools/browser/anthropic.cjs +58 -23
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -4
- package/dist/tools/browser/core.cjs +750 -70
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.d.ts +30 -24
- package/dist/tools/browser/core.js +5 -2
- package/dist/tools/browser/errors.cjs +208 -0
- package/dist/tools/browser/errors.cjs.map +1 -0
- package/dist/tools/browser/errors.d.ts +158 -0
- package/dist/tools/browser/errors.js +22 -0
- package/dist/tools/browser/errors.js.map +1 -0
- package/dist/tools/browser/index.cjs +783 -85
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.d.ts +5 -2
- package/dist/tools/browser/index.js +32 -9
- package/dist/tools/browser/index.js.map +1 -1
- package/dist/tools/browser/live.cjs +25 -1
- package/dist/tools/browser/live.cjs.map +1 -1
- package/dist/tools/browser/live.js +1 -1
- package/dist/tools/browser/openai.cjs +58 -23
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -4
- package/dist/tools/browser/profiles/core.cjs +670 -0
- package/dist/tools/browser/profiles/core.cjs.map +1 -0
- package/dist/tools/browser/profiles/core.d.ts +187 -0
- package/dist/tools/browser/profiles/core.js +29 -0
- package/dist/tools/browser/profiles/core.js.map +1 -0
- package/dist/tools/browser/profiles/index.cjs +670 -0
- package/dist/tools/browser/profiles/index.cjs.map +1 -0
- package/dist/tools/browser/profiles/index.d.ts +4 -0
- package/dist/tools/browser/profiles/index.js +29 -0
- package/dist/tools/browser/profiles/index.js.map +1 -0
- package/dist/tools/browser/profiles/types.cjs +74 -0
- package/dist/tools/browser/profiles/types.cjs.map +1 -0
- package/dist/tools/browser/profiles/types.d.ts +195 -0
- package/dist/tools/browser/profiles/types.js +16 -0
- package/dist/tools/browser/profiles/types.js.map +1 -0
- package/dist/tools/browser/prompts.cjs +1 -1
- package/dist/tools/browser/prompts.cjs.map +1 -1
- package/dist/tools/browser/prompts.d.ts +1 -1
- package/dist/tools/browser/prompts.js +1 -1
- package/dist/tools/browser/types.cjs.map +1 -1
- package/dist/tools/browser/types.d.ts +55 -51
- package/dist/tools/browser/vercel.cjs +60 -25
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.d.ts +1 -1
- package/dist/tools/browser/vercel.js +7 -4
- package/dist/tools/fastapply/anthropic.cjs +0 -7
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +1 -1
- package/dist/tools/fastapply/index.cjs +0 -14
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +5 -5
- package/dist/tools/fastapply/openai.cjs +0 -7
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +1 -1
- package/dist/tools/index.cjs +0 -14
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +5 -5
- package/dist/tools/warp_grep/agent/runner.cjs +18 -98
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +2 -3
- package/dist/tools/warp_grep/anthropic.cjs +18 -98
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +8 -9
- package/dist/tools/warp_grep/client.cjs +18 -98
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +5 -6
- package/dist/tools/warp_grep/gemini.cjs +18 -98
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +7 -8
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/harness.js +10 -10
- package/dist/tools/warp_grep/index.cjs +18 -98
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +8 -9
- package/dist/tools/warp_grep/openai.cjs +18 -98
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +8 -9
- package/dist/tools/warp_grep/vercel.cjs +18 -98
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +8 -9
- package/dist/{vercel-CsnNSdze.d.ts → vercel-CVF27qFK.d.ts} +10 -10
- package/package.json +7 -2
- package/dist/chunk-4WLGDYWQ.js.map +0 -1
- package/dist/chunk-5QIWYEHJ.js.map +0 -1
- package/dist/chunk-EYGBUH2R.js.map +0 -1
- package/dist/chunk-FNLNDMIX.js.map +0 -1
- package/dist/chunk-IUG2FHNN.js.map +0 -1
- package/dist/chunk-MIIJWDOQ.js.map +0 -1
- package/dist/chunk-SQN4DUQS.js.map +0 -1
- package/dist/chunk-VHOWYK66.js.map +0 -1
- /package/dist/{chunk-LMUZ3NGC.js.map → chunk-73RV6EXR.js.map} +0 -0
- /package/dist/{chunk-PBLPZ6AU.js.map → chunk-7D6TXC7X.js.map} +0 -0
- /package/dist/{chunk-GU6DACME.js.map → chunk-O7LDZA52.js.map} +0 -0
- /package/dist/{chunk-PUGIOVSP.js.map → chunk-QAT5UVPX.js.map} +0 -0
- /package/dist/{chunk-IJ54DTJ3.js.map → chunk-ZYTAKEBW.js.map} +0 -0
|
@@ -3,25 +3,24 @@ import {
|
|
|
3
3
|
execute,
|
|
4
4
|
openai_default,
|
|
5
5
|
warpGrepTool
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-73RV6EXR.js";
|
|
7
7
|
import "../../chunk-KW7OEGZK.js";
|
|
8
8
|
import {
|
|
9
9
|
formatResult
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
} from "../../chunk-QAT5UVPX.js";
|
|
11
|
+
import "../../chunk-43LQLGP6.js";
|
|
12
12
|
import "../../chunk-PUGSTXLO.js";
|
|
13
13
|
import "../../chunk-KRDIR7GG.js";
|
|
14
|
-
import "../../chunk-APP75CBN.js";
|
|
15
|
-
import "../../chunk-SNGGSPYJ.js";
|
|
16
|
-
import {
|
|
17
|
-
getSystemPrompt
|
|
18
|
-
} from "../../chunk-FMLHRJDF.js";
|
|
19
14
|
import "../../chunk-4KMBU6T3.js";
|
|
20
15
|
import "../../chunk-G2RSY56Q.js";
|
|
21
16
|
import "../../chunk-YPKNMYD4.js";
|
|
22
17
|
import "../../chunk-TPP2UGQP.js";
|
|
23
18
|
import "../../chunk-5PNMAWLC.js";
|
|
24
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-APP75CBN.js";
|
|
20
|
+
import "../../chunk-SNGGSPYJ.js";
|
|
21
|
+
import {
|
|
22
|
+
getSystemPrompt
|
|
23
|
+
} from "../../chunk-FMLHRJDF.js";
|
|
25
24
|
import "../../chunk-PZ5AY32C.js";
|
|
26
25
|
export {
|
|
27
26
|
createWarpGrepTool,
|
|
@@ -732,80 +732,6 @@ function mergeRanges(ranges) {
|
|
|
732
732
|
return merged;
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
-
// tools/utils/resilience.ts
|
|
736
|
-
var DEFAULT_RETRY_CONFIG = {
|
|
737
|
-
maxRetries: 3,
|
|
738
|
-
initialDelay: 1e3,
|
|
739
|
-
maxDelay: 3e4,
|
|
740
|
-
backoffMultiplier: 2,
|
|
741
|
-
retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
|
|
742
|
-
};
|
|
743
|
-
async function fetchWithRetry(url, options, retryConfig = {}) {
|
|
744
|
-
const {
|
|
745
|
-
maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
|
|
746
|
-
initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
|
|
747
|
-
maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
|
|
748
|
-
backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
|
|
749
|
-
retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
750
|
-
onRetry
|
|
751
|
-
} = retryConfig;
|
|
752
|
-
let lastError = null;
|
|
753
|
-
let delay = initialDelay;
|
|
754
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
755
|
-
try {
|
|
756
|
-
const response = await fetch(url, options);
|
|
757
|
-
if (response.status === 429 || response.status === 503) {
|
|
758
|
-
if (attempt < maxRetries) {
|
|
759
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
760
|
-
const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
|
|
761
|
-
const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
|
|
762
|
-
if (onRetry) {
|
|
763
|
-
onRetry(attempt + 1, error);
|
|
764
|
-
}
|
|
765
|
-
await sleep(waitTime);
|
|
766
|
-
delay *= backoffMultiplier;
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
return response;
|
|
771
|
-
} catch (error) {
|
|
772
|
-
lastError = error;
|
|
773
|
-
const isRetryable = retryableErrors.some(
|
|
774
|
-
(errType) => lastError?.message?.includes(errType)
|
|
775
|
-
);
|
|
776
|
-
if (!isRetryable || attempt === maxRetries) {
|
|
777
|
-
throw lastError;
|
|
778
|
-
}
|
|
779
|
-
const waitTime = Math.min(delay, maxDelay);
|
|
780
|
-
if (onRetry) {
|
|
781
|
-
onRetry(attempt + 1, lastError);
|
|
782
|
-
}
|
|
783
|
-
await sleep(waitTime);
|
|
784
|
-
delay *= backoffMultiplier;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
throw lastError || new Error("Max retries exceeded");
|
|
788
|
-
}
|
|
789
|
-
async function withTimeout(promise, timeoutMs, errorMessage) {
|
|
790
|
-
let timeoutId;
|
|
791
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
792
|
-
timeoutId = setTimeout(() => {
|
|
793
|
-
reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
|
|
794
|
-
}, timeoutMs);
|
|
795
|
-
});
|
|
796
|
-
try {
|
|
797
|
-
const result = await Promise.race([promise, timeoutPromise]);
|
|
798
|
-
clearTimeout(timeoutId);
|
|
799
|
-
return result;
|
|
800
|
-
} catch (error) {
|
|
801
|
-
clearTimeout(timeoutId);
|
|
802
|
-
throw error;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
function sleep(ms) {
|
|
806
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
807
|
-
}
|
|
808
|
-
|
|
809
735
|
// tools/warp_grep/agent/formatter.ts
|
|
810
736
|
var ToolOutputFormatter = class {
|
|
811
737
|
format(toolName, args, output, options = {}) {
|
|
@@ -980,42 +906,36 @@ function enforceContextLimit(messages, maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS
|
|
|
980
906
|
}
|
|
981
907
|
|
|
982
908
|
// tools/warp_grep/agent/runner.ts
|
|
909
|
+
var import_openai = __toESM(require("openai"), 1);
|
|
983
910
|
var import_path2 = __toESM(require("path"), 1);
|
|
984
911
|
var parser = new LLMResponseParser();
|
|
985
912
|
var DEFAULT_API_URL = "https://api.morphllm.com";
|
|
986
913
|
async function callModel(messages, model, options = {}) {
|
|
987
914
|
const baseUrl = options.morphApiUrl || DEFAULT_API_URL;
|
|
988
915
|
const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || "";
|
|
989
|
-
const fetchPromise = fetchWithRetry(
|
|
990
|
-
`${baseUrl}/v1/chat/completions`,
|
|
991
|
-
{
|
|
992
|
-
method: "POST",
|
|
993
|
-
headers: {
|
|
994
|
-
"Content-Type": "application/json",
|
|
995
|
-
Authorization: `Bearer ${apiKey}`
|
|
996
|
-
},
|
|
997
|
-
body: JSON.stringify({
|
|
998
|
-
model,
|
|
999
|
-
temperature: 0,
|
|
1000
|
-
max_tokens: 1024,
|
|
1001
|
-
repetition_penalty: 1.05,
|
|
1002
|
-
messages
|
|
1003
|
-
})
|
|
1004
|
-
},
|
|
1005
|
-
options.retryConfig
|
|
1006
|
-
);
|
|
1007
916
|
const timeoutMs = options.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
|
|
917
|
+
const client = new import_openai.default({
|
|
918
|
+
apiKey,
|
|
919
|
+
baseURL: baseUrl,
|
|
920
|
+
maxRetries: options.retryConfig?.maxRetries,
|
|
921
|
+
timeout: timeoutMs
|
|
922
|
+
});
|
|
923
|
+
let data;
|
|
924
|
+
try {
|
|
925
|
+
data = await client.chat.completions.create({
|
|
926
|
+
model,
|
|
927
|
+
temperature: 0,
|
|
928
|
+
max_tokens: 1024,
|
|
929
|
+
messages
|
|
930
|
+
});
|
|
931
|
+
} catch (error) {
|
|
932
|
+
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1011
933
|
throw new Error(
|
|
1012
934
|
"The endpoint you are trying to call is likely deprecated. Please update with: npm cache clean --force && npx -y @morphllm/morphmcp@latest or visit: https://morphllm.com/mcp"
|
|
1013
935
|
);
|
|
1014
936
|
}
|
|
1015
|
-
|
|
1016
|
-
throw new Error(`morph-warp-grep error ${resp.status}: ${t}`);
|
|
937
|
+
throw error;
|
|
1017
938
|
}
|
|
1018
|
-
const data = await resp.json();
|
|
1019
939
|
const content = data?.choices?.[0]?.message?.content;
|
|
1020
940
|
if (!content || typeof content !== "string") {
|
|
1021
941
|
throw new Error("Invalid response from model");
|