@morphllm/morphsdk 0.2.94 → 0.2.96
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-YJ354BA2.js → chunk-2AMEQAO2.js} +2 -2
- 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-UJ7LVT5G.js → chunk-2VERUKO2.js} +1 -1
- package/dist/chunk-2VERUKO2.js.map +1 -0
- package/dist/{chunk-R7WN43L2.js → chunk-4KMBU6T3.js} +4 -4
- package/dist/{chunk-IH3KN4AT.js → chunk-AIXF4GQC.js} +2 -2
- package/dist/{chunk-VHOWYK66.js → chunk-BGEEES52.js} +23 -33
- package/dist/chunk-BGEEES52.js.map +1 -0
- package/dist/{chunk-4WO7PJNT.js → chunk-EZEYREHA.js} +8 -8
- package/dist/{chunk-BVVDDTI7.js → chunk-L5WXPMCH.js} +2 -2
- package/dist/{chunk-FIA6LBW2.js → chunk-OTPYEYMZ.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-TXYCM4NP.js → chunk-QH4BSXOD.js} +3 -3
- package/dist/{chunk-M7GFXRKL.js → chunk-QJP62BXH.js} +157 -72
- package/dist/chunk-QJP62BXH.js.map +1 -0
- package/dist/{chunk-AV6YV2MH.js → chunk-R7IQWNSA.js} +8 -8
- package/dist/chunk-R7IQWNSA.js.map +1 -0
- package/dist/{chunk-ESRZJRTQ.js → chunk-SI2CKRKJ.js} +86 -56
- package/dist/chunk-SI2CKRKJ.js.map +1 -0
- package/dist/{chunk-FMWNVTJJ.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-WSQMWVSD.js → chunk-YZ5NCWO2.js} +6 -6
- package/dist/chunk-YZ5NCWO2.js.map +1 -0
- package/dist/client.cjs +280 -162
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +18 -18
- package/dist/index.cjs +280 -162
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -18
- package/dist/tools/browser/anthropic.cjs +54 -23
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -7
- package/dist/tools/browser/core.cjs +262 -124
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.d.ts +24 -24
- package/dist/tools/browser/core.js +5 -5
- package/dist/tools/browser/errors.cjs.map +1 -1
- package/dist/tools/browser/errors.d.ts +1 -1
- package/dist/tools/browser/errors.js +1 -1
- package/dist/tools/browser/index.cjs +277 -139
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.d.ts +3 -3
- package/dist/tools/browser/index.js +12 -12
- 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 +54 -23
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -7
- package/dist/tools/browser/profiles/core.cjs +85 -54
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.d.ts +33 -25
- package/dist/tools/browser/profiles/core.js +5 -3
- package/dist/tools/browser/profiles/index.cjs +85 -54
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.d.ts +2 -2
- package/dist/tools/browser/profiles/index.js +5 -3
- package/dist/tools/browser/profiles/types.cjs +1 -1
- package/dist/tools/browser/profiles/types.cjs.map +1 -1
- package/dist/tools/browser/profiles/types.d.ts +28 -9
- package/dist/tools/browser/profiles/types.js +1 -1
- 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 +54 -52
- package/dist/tools/browser/vercel.cjs +56 -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 -7
- 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 +2 -2
- 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 +2 -2
- 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 +7 -8
- 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 +10 -11
- 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/providers/local.js +2 -2
- 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 +1 -1
- package/dist/chunk-5QIWYEHJ.js.map +0 -1
- package/dist/chunk-AV6YV2MH.js.map +0 -1
- package/dist/chunk-ESRZJRTQ.js.map +0 -1
- package/dist/chunk-FMWNVTJJ.js.map +0 -1
- package/dist/chunk-IUG2FHNN.js.map +0 -1
- package/dist/chunk-M7GFXRKL.js.map +0 -1
- package/dist/chunk-SQN4DUQS.js.map +0 -1
- package/dist/chunk-UJ7LVT5G.js.map +0 -1
- package/dist/chunk-VHOWYK66.js.map +0 -1
- package/dist/chunk-WSQMWVSD.js.map +0 -1
- package/dist/chunk-YJ354BA2.js.map +0 -1
- /package/dist/{chunk-R7WN43L2.js.map → chunk-4KMBU6T3.js.map} +0 -0
- /package/dist/{chunk-IH3KN4AT.js.map → chunk-AIXF4GQC.js.map} +0 -0
- /package/dist/{chunk-4WO7PJNT.js.map → chunk-EZEYREHA.js.map} +0 -0
- /package/dist/{chunk-BVVDDTI7.js.map → chunk-L5WXPMCH.js.map} +0 -0
- /package/dist/{chunk-FIA6LBW2.js.map → chunk-OTPYEYMZ.js.map} +0 -0
- /package/dist/{chunk-TXYCM4NP.js.map → chunk-QH4BSXOD.js.map} +0 -0
|
@@ -3,19 +3,18 @@ import {
|
|
|
3
3
|
executeToolCall,
|
|
4
4
|
executeWarpGrep,
|
|
5
5
|
formatResult
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-QH4BSXOD.js";
|
|
7
|
+
import "../../chunk-BGEEES52.js";
|
|
8
8
|
import "../../chunk-PUGSTXLO.js";
|
|
9
9
|
import "../../chunk-KRDIR7GG.js";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-FMLHRJDF.js";
|
|
13
|
-
import "../../chunk-R7WN43L2.js";
|
|
10
|
+
import "../../chunk-4KMBU6T3.js";
|
|
11
|
+
import "../../chunk-G2RSY56Q.js";
|
|
14
12
|
import "../../chunk-YPKNMYD4.js";
|
|
15
13
|
import "../../chunk-TPP2UGQP.js";
|
|
16
14
|
import "../../chunk-5PNMAWLC.js";
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-APP75CBN.js";
|
|
16
|
+
import "../../chunk-SNGGSPYJ.js";
|
|
17
|
+
import "../../chunk-FMLHRJDF.js";
|
|
19
18
|
import "../../chunk-PZ5AY32C.js";
|
|
20
19
|
export {
|
|
21
20
|
WarpGrepClient,
|
|
@@ -731,80 +731,6 @@ function mergeRanges(ranges) {
|
|
|
731
731
|
return merged;
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
// tools/utils/resilience.ts
|
|
735
|
-
var DEFAULT_RETRY_CONFIG = {
|
|
736
|
-
maxRetries: 3,
|
|
737
|
-
initialDelay: 1e3,
|
|
738
|
-
maxDelay: 3e4,
|
|
739
|
-
backoffMultiplier: 2,
|
|
740
|
-
retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
|
|
741
|
-
};
|
|
742
|
-
async function fetchWithRetry(url, options, retryConfig = {}) {
|
|
743
|
-
const {
|
|
744
|
-
maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
|
|
745
|
-
initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
|
|
746
|
-
maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
|
|
747
|
-
backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
|
|
748
|
-
retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
749
|
-
onRetry
|
|
750
|
-
} = retryConfig;
|
|
751
|
-
let lastError = null;
|
|
752
|
-
let delay = initialDelay;
|
|
753
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
754
|
-
try {
|
|
755
|
-
const response = await fetch(url, options);
|
|
756
|
-
if (response.status === 429 || response.status === 503) {
|
|
757
|
-
if (attempt < maxRetries) {
|
|
758
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
759
|
-
const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
|
|
760
|
-
const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
|
|
761
|
-
if (onRetry) {
|
|
762
|
-
onRetry(attempt + 1, error);
|
|
763
|
-
}
|
|
764
|
-
await sleep(waitTime);
|
|
765
|
-
delay *= backoffMultiplier;
|
|
766
|
-
continue;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return response;
|
|
770
|
-
} catch (error) {
|
|
771
|
-
lastError = error;
|
|
772
|
-
const isRetryable = retryableErrors.some(
|
|
773
|
-
(errType) => lastError?.message?.includes(errType)
|
|
774
|
-
);
|
|
775
|
-
if (!isRetryable || attempt === maxRetries) {
|
|
776
|
-
throw lastError;
|
|
777
|
-
}
|
|
778
|
-
const waitTime = Math.min(delay, maxDelay);
|
|
779
|
-
if (onRetry) {
|
|
780
|
-
onRetry(attempt + 1, lastError);
|
|
781
|
-
}
|
|
782
|
-
await sleep(waitTime);
|
|
783
|
-
delay *= backoffMultiplier;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
throw lastError || new Error("Max retries exceeded");
|
|
787
|
-
}
|
|
788
|
-
async function withTimeout(promise, timeoutMs, errorMessage) {
|
|
789
|
-
let timeoutId;
|
|
790
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
791
|
-
timeoutId = setTimeout(() => {
|
|
792
|
-
reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
|
|
793
|
-
}, timeoutMs);
|
|
794
|
-
});
|
|
795
|
-
try {
|
|
796
|
-
const result = await Promise.race([promise, timeoutPromise]);
|
|
797
|
-
clearTimeout(timeoutId);
|
|
798
|
-
return result;
|
|
799
|
-
} catch (error) {
|
|
800
|
-
clearTimeout(timeoutId);
|
|
801
|
-
throw error;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
function sleep(ms) {
|
|
805
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
806
|
-
}
|
|
807
|
-
|
|
808
734
|
// tools/warp_grep/agent/formatter.ts
|
|
809
735
|
var ToolOutputFormatter = class {
|
|
810
736
|
format(toolName, args, output, options = {}) {
|
|
@@ -979,42 +905,36 @@ function enforceContextLimit(messages, maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS
|
|
|
979
905
|
}
|
|
980
906
|
|
|
981
907
|
// tools/warp_grep/agent/runner.ts
|
|
908
|
+
var import_openai = __toESM(require("openai"), 1);
|
|
982
909
|
var import_path2 = __toESM(require("path"), 1);
|
|
983
910
|
var parser = new LLMResponseParser();
|
|
984
911
|
var DEFAULT_API_URL = "https://api.morphllm.com";
|
|
985
912
|
async function callModel(messages, model, options = {}) {
|
|
986
913
|
const baseUrl = options.morphApiUrl || DEFAULT_API_URL;
|
|
987
914
|
const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || "";
|
|
988
|
-
const fetchPromise = fetchWithRetry(
|
|
989
|
-
`${baseUrl}/v1/chat/completions`,
|
|
990
|
-
{
|
|
991
|
-
method: "POST",
|
|
992
|
-
headers: {
|
|
993
|
-
"Content-Type": "application/json",
|
|
994
|
-
Authorization: `Bearer ${apiKey}`
|
|
995
|
-
},
|
|
996
|
-
body: JSON.stringify({
|
|
997
|
-
model,
|
|
998
|
-
temperature: 0,
|
|
999
|
-
max_tokens: 1024,
|
|
1000
|
-
repetition_penalty: 1.05,
|
|
1001
|
-
messages
|
|
1002
|
-
})
|
|
1003
|
-
},
|
|
1004
|
-
options.retryConfig
|
|
1005
|
-
);
|
|
1006
915
|
const timeoutMs = options.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
916
|
+
const client = new import_openai.default({
|
|
917
|
+
apiKey,
|
|
918
|
+
baseURL: `${baseUrl}/v1`,
|
|
919
|
+
maxRetries: options.retryConfig?.maxRetries,
|
|
920
|
+
timeout: timeoutMs
|
|
921
|
+
});
|
|
922
|
+
let data;
|
|
923
|
+
try {
|
|
924
|
+
data = await client.chat.completions.create({
|
|
925
|
+
model,
|
|
926
|
+
temperature: 0,
|
|
927
|
+
max_tokens: 1024,
|
|
928
|
+
messages
|
|
929
|
+
});
|
|
930
|
+
} catch (error) {
|
|
931
|
+
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1010
932
|
throw new Error(
|
|
1011
933
|
"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"
|
|
1012
934
|
);
|
|
1013
935
|
}
|
|
1014
|
-
|
|
1015
|
-
throw new Error(`morph-warp-grep error ${resp.status}: ${t}`);
|
|
936
|
+
throw error;
|
|
1016
937
|
}
|
|
1017
|
-
const data = await resp.json();
|
|
1018
938
|
const content = data?.choices?.[0]?.message?.content;
|
|
1019
939
|
if (!content || typeof content !== "string") {
|
|
1020
940
|
throw new Error("Invalid response from model");
|