@morphllm/morphsdk 0.2.53 → 0.2.55

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 (45) hide show
  1. package/dist/{chunk-IFVROB4L.js → chunk-37SRI4GW.js} +6 -7
  2. package/dist/chunk-37SRI4GW.js.map +1 -0
  3. package/dist/{chunk-C4IXE2RM.js → chunk-BSHJGJ25.js} +6 -5
  4. package/dist/chunk-BSHJGJ25.js.map +1 -0
  5. package/dist/{chunk-NOQCKVY3.js → chunk-C6QQL6FX.js} +5 -5
  6. package/dist/{chunk-KYVR4QCG.js → chunk-KO6JQFRE.js} +5 -3
  7. package/dist/{chunk-KYVR4QCG.js.map → chunk-KO6JQFRE.js.map} +1 -1
  8. package/dist/{chunk-563REN2T.js → chunk-X5HNQ7SB.js} +3 -3
  9. package/dist/{chunk-2XNF3W7C.js → chunk-ZWY434TS.js} +6 -5
  10. package/dist/chunk-ZWY434TS.js.map +1 -0
  11. package/dist/{client-BGctTHu9.d.ts → client-CFoR--IU.d.ts} +1 -1
  12. package/dist/client.cjs +16 -16
  13. package/dist/client.cjs.map +1 -1
  14. package/dist/client.d.ts +2 -2
  15. package/dist/client.js +6 -6
  16. package/dist/{core-DxiUwyBe.d.ts → core-CpkYEi_T.d.ts} +2 -0
  17. package/dist/index.cjs +16 -16
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +6 -6
  21. package/dist/tools/warp_grep/agent/runner.cjs +5 -6
  22. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  23. package/dist/tools/warp_grep/agent/runner.js +1 -1
  24. package/dist/tools/warp_grep/anthropic.cjs +16 -16
  25. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  26. package/dist/tools/warp_grep/anthropic.d.ts +2 -2
  27. package/dist/tools/warp_grep/anthropic.js +3 -3
  28. package/dist/tools/warp_grep/index.cjs +18 -16
  29. package/dist/tools/warp_grep/index.cjs.map +1 -1
  30. package/dist/tools/warp_grep/index.d.ts +7 -3
  31. package/dist/tools/warp_grep/index.js +7 -5
  32. package/dist/tools/warp_grep/openai.cjs +16 -16
  33. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  34. package/dist/tools/warp_grep/openai.d.ts +2 -2
  35. package/dist/tools/warp_grep/openai.js +3 -3
  36. package/dist/tools/warp_grep/vercel.cjs +13 -14
  37. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  38. package/dist/tools/warp_grep/vercel.d.ts +2 -2
  39. package/dist/tools/warp_grep/vercel.js +3 -3
  40. package/package.json +1 -1
  41. package/dist/chunk-2XNF3W7C.js.map +0 -1
  42. package/dist/chunk-C4IXE2RM.js.map +0 -1
  43. package/dist/chunk-IFVROB4L.js.map +0 -1
  44. /package/dist/{chunk-NOQCKVY3.js.map → chunk-C6QQL6FX.js.map} +0 -0
  45. /package/dist/{chunk-563REN2T.js.map → chunk-X5HNQ7SB.js.map} +0 -0
package/dist/client.d.ts CHANGED
@@ -2,10 +2,10 @@ import './tools/utils/resilience.js';
2
2
  import './tools/fastapply/core.js';
3
3
  import './tools/codebase_search/core.js';
4
4
  import './tools/browser/core.js';
5
- import './core-DxiUwyBe.js';
5
+ import './core-CpkYEi_T.js';
6
6
  import './git/client.js';
7
7
  import './modelrouter/core.js';
8
- export { M as MorphClient, a as MorphClientConfig } from './client-BGctTHu9.js';
8
+ export { M as MorphClient, a as MorphClientConfig } from './client-CFoR--IU.js';
9
9
  import './tools/fastapply/types.js';
10
10
  import './tools/codebase_search/types.js';
11
11
  import './tools/browser/types.js';
package/dist/client.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-NOQCKVY3.js";
4
- import "./chunk-C4IXE2RM.js";
5
- import "./chunk-2XNF3W7C.js";
6
- import "./chunk-563REN2T.js";
7
- import "./chunk-KYVR4QCG.js";
8
- import "./chunk-IFVROB4L.js";
3
+ } from "./chunk-C6QQL6FX.js";
4
+ import "./chunk-BSHJGJ25.js";
5
+ import "./chunk-ZWY434TS.js";
6
+ import "./chunk-X5HNQ7SB.js";
7
+ import "./chunk-KO6JQFRE.js";
8
+ import "./chunk-37SRI4GW.js";
9
9
  import "./chunk-EK7OQPWD.js";
10
10
  import "./chunk-HQO45BAJ.js";
11
11
  import "./chunk-LVPVVLTI.js";
@@ -69,6 +69,8 @@ interface WarpGrepToolConfig {
69
69
  debug?: boolean;
70
70
  /** Morph API key (defaults to MORPH_API_KEY env var) */
71
71
  apiKey?: string;
72
+ /** Custom tool name (defaults to 'warpgrep_codebase_search') */
73
+ name?: string;
72
74
  /** Custom tool description */
73
75
  description?: string;
74
76
  }
package/dist/index.cjs CHANGED
@@ -1610,13 +1610,12 @@ function mergeRanges(ranges) {
1610
1610
 
1611
1611
  // tools/warp_grep/agent/runner.ts
1612
1612
  var import_path2 = __toESM(require("path"), 1);
1613
- var import_promises2 = __toESM(require("fs/promises"), 1);
1614
1613
  var parser = new LLMResponseParser();
1615
- async function buildInitialState(repoRoot, query) {
1614
+ async function buildInitialState(repoRoot, query, provider) {
1616
1615
  try {
1617
- const entries = await import_promises2.default.readdir(repoRoot, { withFileTypes: true });
1618
- const dirs = entries.filter((e) => e.isDirectory()).map((d) => d.name).slice(0, 50);
1619
- const files = entries.filter((e) => e.isFile()).map((f) => f.name).slice(0, 50);
1616
+ const entries = await provider.analyse({ path: ".", maxResults: 100 });
1617
+ const dirs = entries.filter((e) => e.type === "dir").map((d) => d.name).slice(0, 50);
1618
+ const files = entries.filter((e) => e.type === "file").map((f) => f.name).slice(0, 50);
1620
1619
  const parts = [
1621
1620
  `<repo_root>${repoRoot}</repo_root>`,
1622
1621
  `<top_dirs>${dirs.join(", ")}</top_dirs>`,
@@ -1665,7 +1664,7 @@ async function runWarpGrep(config) {
1665
1664
  messages.push(systemMessage);
1666
1665
  const queryContent = `<query>${config.query}</query>`;
1667
1666
  messages.push({ role: "user", content: queryContent });
1668
- const initialState = await buildInitialState(repoRoot, config.query);
1667
+ const initialState = await buildInitialState(repoRoot, config.query, config.provider);
1669
1668
  messages.push({ role: "user", content: initialState });
1670
1669
  const maxRounds = AGENT_CONFIG.MAX_ROUNDS;
1671
1670
  const model = config.model || DEFAULT_MODEL;
@@ -1808,7 +1807,7 @@ async function runWarpGrep(config) {
1808
1807
  }
1809
1808
 
1810
1809
  // tools/warp_grep/providers/local.ts
1811
- var import_promises4 = __toESM(require("fs/promises"), 1);
1810
+ var import_promises3 = __toESM(require("fs/promises"), 1);
1812
1811
  var import_path4 = __toESM(require("path"), 1);
1813
1812
 
1814
1813
  // tools/warp_grep/utils/ripgrep.ts
@@ -1918,9 +1917,9 @@ function isTextualFile(filePath, maxBytes = 2e6) {
1918
1917
  }
1919
1918
 
1920
1919
  // tools/warp_grep/utils/files.ts
1921
- var import_promises3 = __toESM(require("fs/promises"), 1);
1920
+ var import_promises2 = __toESM(require("fs/promises"), 1);
1922
1921
  async function readAllLines(filePath) {
1923
- const content = await import_promises3.default.readFile(filePath, "utf8");
1922
+ const content = await import_promises2.default.readFile(filePath, "utf8");
1924
1923
  return content.split(/\r?\n/);
1925
1924
  }
1926
1925
 
@@ -1932,7 +1931,7 @@ var LocalRipgrepProvider = class {
1932
1931
  }
1933
1932
  async grep(params) {
1934
1933
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1935
- const stat = await import_promises4.default.stat(abs).catch(() => null);
1934
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
1936
1935
  if (!stat) return { lines: [] };
1937
1936
  const targetArg = abs === import_path4.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
1938
1937
  const args = [
@@ -1990,7 +1989,7 @@ Details: ${res.stderr}` : ""}`
1990
1989
  }
1991
1990
  async read(params) {
1992
1991
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1993
- const stat = await import_promises4.default.stat(abs).catch(() => null);
1992
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
1994
1993
  if (!stat || !stat.isFile()) {
1995
1994
  return {
1996
1995
  lines: [],
@@ -2026,7 +2025,7 @@ Details: ${res.stderr}` : ""}`
2026
2025
  }
2027
2026
  async analyse(params) {
2028
2027
  const abs = resolveUnderRepo(this.repoRoot, params.path);
2029
- const stat = await import_promises4.default.stat(abs).catch(() => null);
2028
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
2030
2029
  if (!stat || !stat.isDirectory()) {
2031
2030
  return [];
2032
2031
  }
@@ -2036,7 +2035,7 @@ Details: ${res.stderr}` : ""}`
2036
2035
  const results = [];
2037
2036
  async function walk(dir, depth) {
2038
2037
  if (depth > maxDepth || results.length >= maxResults) return;
2039
- const entries = await import_promises4.default.readdir(dir, { withFileTypes: true });
2038
+ const entries = await import_promises3.default.readdir(dir, { withFileTypes: true });
2040
2039
  for (const entry of entries) {
2041
2040
  const full = import_path4.default.join(dir, entry.name);
2042
2041
  const rel = toRepoRelative(abs, full).replace(/^[.][/\\]?/, "");
@@ -2889,7 +2888,8 @@ var RawRouter = class extends BaseRouter {
2889
2888
  };
2890
2889
 
2891
2890
  // tools/warp_grep/prompts.ts
2892
- var WARP_GREP_DESCRIPTION = "ALWAYS use Warp Grep when you need to search a large chunk of code. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. Warp Grep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type ";
2891
+ var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
2892
+ var WARP_GREP_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase to gather context, and the task does not involve a single file or function which is provided by name, you should ALWAYS use the warpgrep codebase search tool first instead of running search commands. When the task requires exploration beyond a single known file, invoke warpgrep first with a natural-language query describing the target functionality, bug, or architectural concern. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. Keep queries action-oriented (e.g., "Find where billing invoices are generated and emailed"), and after reviewing the summarized results, you may verify important findings with other search tools or direct file reads to ensure completeness. Warp Grep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task requires exploration beyond a single known file, ALWAYS default to warpgrep codebase search before other search mechanisms.';
2893
2893
 
2894
2894
  // tools/warp_grep/openai.ts
2895
2895
  var TOOL_PARAMETERS = {
@@ -2925,7 +2925,7 @@ function createMorphWarpGrepTool(config) {
2925
2925
  const tool4 = {
2926
2926
  type: "function",
2927
2927
  function: {
2928
- name: "morph-warp-grep",
2928
+ name: config.name ?? WARP_GREP_TOOL_NAME,
2929
2929
  description: config.description ?? WARP_GREP_DESCRIPTION,
2930
2930
  parameters: TOOL_PARAMETERS
2931
2931
  }
@@ -3232,7 +3232,7 @@ async function execute3(input, config) {
3232
3232
  }
3233
3233
  function createMorphWarpGrepTool2(config) {
3234
3234
  const tool4 = {
3235
- name: "morph-warp-grep",
3235
+ name: config.name ?? WARP_GREP_TOOL_NAME,
3236
3236
  description: config.description ?? WARP_GREP_DESCRIPTION,
3237
3237
  input_schema: INPUT_SCHEMA
3238
3238
  };