@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.
Files changed (135) hide show
  1. package/dist/chunk-2AMEQAO2.js +46 -0
  2. package/dist/chunk-2AMEQAO2.js.map +1 -0
  3. package/dist/{chunk-EI4UKP24.js → chunk-2HMEZZKK.js} +2 -2
  4. package/dist/{chunk-EI4UKP24.js.map → chunk-2HMEZZKK.js.map} +1 -1
  5. package/dist/chunk-2VERUKO2.js +177 -0
  6. package/dist/chunk-2VERUKO2.js.map +1 -0
  7. package/dist/{chunk-VHOWYK66.js → chunk-43LQLGP6.js} +23 -33
  8. package/dist/chunk-43LQLGP6.js.map +1 -0
  9. package/dist/{chunk-LMUZ3NGC.js → chunk-73RV6EXR.js} +2 -2
  10. package/dist/{chunk-PBLPZ6AU.js → chunk-7D6TXC7X.js} +2 -2
  11. package/dist/{chunk-GU6DACME.js → chunk-O7LDZA52.js} +2 -2
  12. package/dist/{chunk-5QIWYEHJ.js → chunk-PE4KGDA6.js} +1 -8
  13. package/dist/chunk-PE4KGDA6.js.map +1 -0
  14. package/dist/{chunk-SQN4DUQS.js → chunk-Q6Y4R236.js} +26 -2
  15. package/dist/chunk-Q6Y4R236.js.map +1 -0
  16. package/dist/{chunk-PUGIOVSP.js → chunk-QAT5UVPX.js} +2 -2
  17. package/dist/{chunk-MIIJWDOQ.js → chunk-QJP62BXH.js} +166 -71
  18. package/dist/chunk-QJP62BXH.js.map +1 -0
  19. package/dist/{chunk-EYGBUH2R.js → chunk-R7IQWNSA.js} +8 -8
  20. package/dist/chunk-R7IQWNSA.js.map +1 -0
  21. package/dist/chunk-SI2CKRKJ.js +389 -0
  22. package/dist/chunk-SI2CKRKJ.js.map +1 -0
  23. package/dist/{chunk-4WLGDYWQ.js → chunk-TSENDJQI.js} +6 -6
  24. package/dist/chunk-TSENDJQI.js.map +1 -0
  25. package/dist/{chunk-IUG2FHNN.js → chunk-XH7P7HVT.js} +1 -8
  26. package/dist/chunk-XH7P7HVT.js.map +1 -0
  27. package/dist/{chunk-FNLNDMIX.js → chunk-YZ5NCWO2.js} +6 -6
  28. package/dist/chunk-YZ5NCWO2.js.map +1 -0
  29. package/dist/{chunk-IJ54DTJ3.js → chunk-ZYTAKEBW.js} +13 -13
  30. package/dist/client.cjs +770 -110
  31. package/dist/client.cjs.map +1 -1
  32. package/dist/client.d.ts +2 -0
  33. package/dist/client.js +16 -13
  34. package/dist/index.cjs +770 -110
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +16 -13
  38. package/dist/tools/browser/anthropic.cjs +58 -23
  39. package/dist/tools/browser/anthropic.cjs.map +1 -1
  40. package/dist/tools/browser/anthropic.js +7 -4
  41. package/dist/tools/browser/core.cjs +750 -70
  42. package/dist/tools/browser/core.cjs.map +1 -1
  43. package/dist/tools/browser/core.d.ts +30 -24
  44. package/dist/tools/browser/core.js +5 -2
  45. package/dist/tools/browser/errors.cjs +208 -0
  46. package/dist/tools/browser/errors.cjs.map +1 -0
  47. package/dist/tools/browser/errors.d.ts +158 -0
  48. package/dist/tools/browser/errors.js +22 -0
  49. package/dist/tools/browser/errors.js.map +1 -0
  50. package/dist/tools/browser/index.cjs +783 -85
  51. package/dist/tools/browser/index.cjs.map +1 -1
  52. package/dist/tools/browser/index.d.ts +5 -2
  53. package/dist/tools/browser/index.js +32 -9
  54. package/dist/tools/browser/index.js.map +1 -1
  55. package/dist/tools/browser/live.cjs +25 -1
  56. package/dist/tools/browser/live.cjs.map +1 -1
  57. package/dist/tools/browser/live.js +1 -1
  58. package/dist/tools/browser/openai.cjs +58 -23
  59. package/dist/tools/browser/openai.cjs.map +1 -1
  60. package/dist/tools/browser/openai.js +7 -4
  61. package/dist/tools/browser/profiles/core.cjs +670 -0
  62. package/dist/tools/browser/profiles/core.cjs.map +1 -0
  63. package/dist/tools/browser/profiles/core.d.ts +187 -0
  64. package/dist/tools/browser/profiles/core.js +29 -0
  65. package/dist/tools/browser/profiles/core.js.map +1 -0
  66. package/dist/tools/browser/profiles/index.cjs +670 -0
  67. package/dist/tools/browser/profiles/index.cjs.map +1 -0
  68. package/dist/tools/browser/profiles/index.d.ts +4 -0
  69. package/dist/tools/browser/profiles/index.js +29 -0
  70. package/dist/tools/browser/profiles/index.js.map +1 -0
  71. package/dist/tools/browser/profiles/types.cjs +74 -0
  72. package/dist/tools/browser/profiles/types.cjs.map +1 -0
  73. package/dist/tools/browser/profiles/types.d.ts +195 -0
  74. package/dist/tools/browser/profiles/types.js +16 -0
  75. package/dist/tools/browser/profiles/types.js.map +1 -0
  76. package/dist/tools/browser/prompts.cjs +1 -1
  77. package/dist/tools/browser/prompts.cjs.map +1 -1
  78. package/dist/tools/browser/prompts.d.ts +1 -1
  79. package/dist/tools/browser/prompts.js +1 -1
  80. package/dist/tools/browser/types.cjs.map +1 -1
  81. package/dist/tools/browser/types.d.ts +55 -51
  82. package/dist/tools/browser/vercel.cjs +60 -25
  83. package/dist/tools/browser/vercel.cjs.map +1 -1
  84. package/dist/tools/browser/vercel.d.ts +1 -1
  85. package/dist/tools/browser/vercel.js +7 -4
  86. package/dist/tools/fastapply/anthropic.cjs +0 -7
  87. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  88. package/dist/tools/fastapply/anthropic.js +1 -1
  89. package/dist/tools/fastapply/index.cjs +0 -14
  90. package/dist/tools/fastapply/index.cjs.map +1 -1
  91. package/dist/tools/fastapply/index.js +5 -5
  92. package/dist/tools/fastapply/openai.cjs +0 -7
  93. package/dist/tools/fastapply/openai.cjs.map +1 -1
  94. package/dist/tools/fastapply/openai.js +1 -1
  95. package/dist/tools/index.cjs +0 -14
  96. package/dist/tools/index.cjs.map +1 -1
  97. package/dist/tools/index.js +5 -5
  98. package/dist/tools/warp_grep/agent/runner.cjs +18 -98
  99. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  100. package/dist/tools/warp_grep/agent/runner.js +2 -3
  101. package/dist/tools/warp_grep/anthropic.cjs +18 -98
  102. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  103. package/dist/tools/warp_grep/anthropic.js +8 -9
  104. package/dist/tools/warp_grep/client.cjs +18 -98
  105. package/dist/tools/warp_grep/client.cjs.map +1 -1
  106. package/dist/tools/warp_grep/client.js +5 -6
  107. package/dist/tools/warp_grep/gemini.cjs +18 -98
  108. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  109. package/dist/tools/warp_grep/gemini.js +7 -8
  110. package/dist/tools/warp_grep/gemini.js.map +1 -1
  111. package/dist/tools/warp_grep/harness.js +10 -10
  112. package/dist/tools/warp_grep/index.cjs +18 -98
  113. package/dist/tools/warp_grep/index.cjs.map +1 -1
  114. package/dist/tools/warp_grep/index.js +8 -9
  115. package/dist/tools/warp_grep/openai.cjs +18 -98
  116. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  117. package/dist/tools/warp_grep/openai.js +8 -9
  118. package/dist/tools/warp_grep/vercel.cjs +18 -98
  119. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  120. package/dist/tools/warp_grep/vercel.js +8 -9
  121. package/dist/{vercel-CsnNSdze.d.ts → vercel-CVF27qFK.d.ts} +10 -10
  122. package/package.json +7 -2
  123. package/dist/chunk-4WLGDYWQ.js.map +0 -1
  124. package/dist/chunk-5QIWYEHJ.js.map +0 -1
  125. package/dist/chunk-EYGBUH2R.js.map +0 -1
  126. package/dist/chunk-FNLNDMIX.js.map +0 -1
  127. package/dist/chunk-IUG2FHNN.js.map +0 -1
  128. package/dist/chunk-MIIJWDOQ.js.map +0 -1
  129. package/dist/chunk-SQN4DUQS.js.map +0 -1
  130. package/dist/chunk-VHOWYK66.js.map +0 -1
  131. /package/dist/{chunk-LMUZ3NGC.js.map → chunk-73RV6EXR.js.map} +0 -0
  132. /package/dist/{chunk-PBLPZ6AU.js.map → chunk-7D6TXC7X.js.map} +0 -0
  133. /package/dist/{chunk-GU6DACME.js.map → chunk-O7LDZA52.js.map} +0 -0
  134. /package/dist/{chunk-PUGIOVSP.js.map → chunk-QAT5UVPX.js.map} +0 -0
  135. /package/dist/{chunk-IJ54DTJ3.js.map → chunk-ZYTAKEBW.js.map} +0 -0
@@ -10,11 +10,11 @@ import {
10
10
  executeToolCall,
11
11
  executeWarpGrep,
12
12
  formatResult
13
- } from "../../chunk-PUGIOVSP.js";
13
+ } from "../../chunk-QAT5UVPX.js";
14
14
  import {
15
15
  runWarpGrep,
16
16
  runWarpGrepStreaming
17
- } from "../../chunk-VHOWYK66.js";
17
+ } from "../../chunk-43LQLGP6.js";
18
18
  import {
19
19
  RemoteCommandsProvider
20
20
  } from "../../chunk-PUGSTXLO.js";
@@ -25,12 +25,6 @@ import {
25
25
  toolListDirectory,
26
26
  toolRead
27
27
  } from "../../chunk-KRDIR7GG.js";
28
- import "../../chunk-APP75CBN.js";
29
- import "../../chunk-SNGGSPYJ.js";
30
- import {
31
- SYSTEM_PROMPT,
32
- getSystemPrompt
33
- } from "../../chunk-FMLHRJDF.js";
34
28
  import {
35
29
  LocalRipgrepProvider
36
30
  } from "../../chunk-4KMBU6T3.js";
@@ -40,7 +34,12 @@ import {
40
34
  } from "../../chunk-YPKNMYD4.js";
41
35
  import "../../chunk-TPP2UGQP.js";
42
36
  import "../../chunk-5PNMAWLC.js";
43
- import "../../chunk-4VWJFZVS.js";
37
+ import "../../chunk-APP75CBN.js";
38
+ import "../../chunk-SNGGSPYJ.js";
39
+ import {
40
+ SYSTEM_PROMPT,
41
+ getSystemPrompt
42
+ } from "../../chunk-FMLHRJDF.js";
44
43
  import "../../chunk-PZ5AY32C.js";
45
44
  export {
46
45
  LocalRipgrepProvider,
@@ -730,80 +730,6 @@ function mergeRanges(ranges) {
730
730
  return merged;
731
731
  }
732
732
 
733
- // tools/utils/resilience.ts
734
- var DEFAULT_RETRY_CONFIG = {
735
- maxRetries: 3,
736
- initialDelay: 1e3,
737
- maxDelay: 3e4,
738
- backoffMultiplier: 2,
739
- retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
740
- };
741
- async function fetchWithRetry(url, options, retryConfig = {}) {
742
- const {
743
- maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
744
- initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
745
- maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
746
- backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
747
- retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
748
- onRetry
749
- } = retryConfig;
750
- let lastError = null;
751
- let delay = initialDelay;
752
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
753
- try {
754
- const response = await fetch(url, options);
755
- if (response.status === 429 || response.status === 503) {
756
- if (attempt < maxRetries) {
757
- const retryAfter = response.headers.get("Retry-After");
758
- const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
759
- const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
760
- if (onRetry) {
761
- onRetry(attempt + 1, error);
762
- }
763
- await sleep(waitTime);
764
- delay *= backoffMultiplier;
765
- continue;
766
- }
767
- }
768
- return response;
769
- } catch (error) {
770
- lastError = error;
771
- const isRetryable = retryableErrors.some(
772
- (errType) => lastError?.message?.includes(errType)
773
- );
774
- if (!isRetryable || attempt === maxRetries) {
775
- throw lastError;
776
- }
777
- const waitTime = Math.min(delay, maxDelay);
778
- if (onRetry) {
779
- onRetry(attempt + 1, lastError);
780
- }
781
- await sleep(waitTime);
782
- delay *= backoffMultiplier;
783
- }
784
- }
785
- throw lastError || new Error("Max retries exceeded");
786
- }
787
- async function withTimeout(promise, timeoutMs, errorMessage) {
788
- let timeoutId;
789
- const timeoutPromise = new Promise((_, reject) => {
790
- timeoutId = setTimeout(() => {
791
- reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
792
- }, timeoutMs);
793
- });
794
- try {
795
- const result = await Promise.race([promise, timeoutPromise]);
796
- clearTimeout(timeoutId);
797
- return result;
798
- } catch (error) {
799
- clearTimeout(timeoutId);
800
- throw error;
801
- }
802
- }
803
- function sleep(ms) {
804
- return new Promise((resolve) => setTimeout(resolve, ms));
805
- }
806
-
807
733
  // tools/warp_grep/agent/formatter.ts
808
734
  var ToolOutputFormatter = class {
809
735
  format(toolName, args, output, options = {}) {
@@ -978,42 +904,36 @@ function enforceContextLimit(messages, maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS
978
904
  }
979
905
 
980
906
  // tools/warp_grep/agent/runner.ts
907
+ var import_openai = __toESM(require("openai"), 1);
981
908
  var import_path2 = __toESM(require("path"), 1);
982
909
  var parser = new LLMResponseParser();
983
910
  var DEFAULT_API_URL = "https://api.morphllm.com";
984
911
  async function callModel(messages, model, options = {}) {
985
912
  const baseUrl = options.morphApiUrl || DEFAULT_API_URL;
986
913
  const apiKey = options.morphApiKey || process.env.MORPH_API_KEY || "";
987
- const fetchPromise = fetchWithRetry(
988
- `${baseUrl}/v1/chat/completions`,
989
- {
990
- method: "POST",
991
- headers: {
992
- "Content-Type": "application/json",
993
- Authorization: `Bearer ${apiKey}`
994
- },
995
- body: JSON.stringify({
996
- model,
997
- temperature: 0,
998
- max_tokens: 1024,
999
- repetition_penalty: 1.05,
1000
- messages
1001
- })
1002
- },
1003
- options.retryConfig
1004
- );
1005
914
  const timeoutMs = options.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
1006
- const resp = await withTimeout(fetchPromise, timeoutMs, "morph-warp-grep request timed out");
1007
- if (!resp.ok) {
1008
- if (resp.status === 404) {
915
+ const client = new import_openai.default({
916
+ apiKey,
917
+ baseURL: baseUrl,
918
+ maxRetries: options.retryConfig?.maxRetries,
919
+ timeout: timeoutMs
920
+ });
921
+ let data;
922
+ try {
923
+ data = await client.chat.completions.create({
924
+ model,
925
+ temperature: 0,
926
+ max_tokens: 1024,
927
+ messages
928
+ });
929
+ } catch (error) {
930
+ if (error instanceof import_openai.default.APIError && error.status === 404) {
1009
931
  throw new Error(
1010
932
  "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"
1011
933
  );
1012
934
  }
1013
- const t = await resp.text();
1014
- throw new Error(`morph-warp-grep error ${resp.status}: ${t}`);
935
+ throw error;
1015
936
  }
1016
- const data = await resp.json();
1017
937
  const content = data?.choices?.[0]?.message?.content;
1018
938
  if (!content || typeof content !== "string") {
1019
939
  throw new Error("Invalid response from model");