@morphllm/morphsdk 0.2.54 → 0.2.56

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 (47) hide show
  1. package/dist/{chunk-4HOUN5TW.js → chunk-4ZHDBKBY.js} +3 -3
  2. package/dist/chunk-7OQOOB3R.js +1 -0
  3. package/dist/{chunk-FB3E5BRY.js → chunk-GJURLQ3L.js} +3 -3
  4. package/dist/{chunk-D5ZSGQT4.js → chunk-QVRXBAMM.js} +2 -2
  5. package/dist/{chunk-IFVROB4L.js → chunk-SALJ2K6S.js} +9 -10
  6. package/dist/chunk-SALJ2K6S.js.map +1 -0
  7. package/dist/{chunk-PYTBBWL6.js → chunk-UIRJE422.js} +3 -3
  8. package/dist/{chunk-KVMZPOUT.js → chunk-WSSSSBWU.js} +5 -5
  9. package/dist/client.cjs +12 -13
  10. package/dist/client.cjs.map +1 -1
  11. package/dist/client.js +7 -7
  12. package/dist/index.cjs +12 -80
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +0 -1
  15. package/dist/index.js +8 -12
  16. package/dist/tools/warp_grep/agent/runner.cjs +5 -6
  17. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  18. package/dist/tools/warp_grep/agent/runner.js +2 -2
  19. package/dist/tools/warp_grep/anthropic.cjs +12 -13
  20. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  21. package/dist/tools/warp_grep/anthropic.js +4 -4
  22. package/dist/tools/warp_grep/index.cjs +12 -80
  23. package/dist/tools/warp_grep/index.cjs.map +1 -1
  24. package/dist/tools/warp_grep/index.d.ts +0 -1
  25. package/dist/tools/warp_grep/index.js +7 -11
  26. package/dist/tools/warp_grep/openai.cjs +12 -13
  27. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  28. package/dist/tools/warp_grep/openai.js +4 -4
  29. package/dist/tools/warp_grep/vercel.cjs +12 -13
  30. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  31. package/dist/tools/warp_grep/vercel.js +4 -4
  32. package/package.json +2 -2
  33. package/dist/chunk-IFVROB4L.js.map +0 -1
  34. package/dist/chunk-JYBVRF72.js +0 -1
  35. package/dist/chunk-P2XKFWFD.js +0 -73
  36. package/dist/chunk-P2XKFWFD.js.map +0 -1
  37. package/dist/tools/warp_grep/providers/command.cjs +0 -177
  38. package/dist/tools/warp_grep/providers/command.cjs.map +0 -1
  39. package/dist/tools/warp_grep/providers/command.d.ts +0 -48
  40. package/dist/tools/warp_grep/providers/command.js +0 -9
  41. package/dist/tools/warp_grep/providers/command.js.map +0 -1
  42. /package/dist/{chunk-4HOUN5TW.js.map → chunk-4ZHDBKBY.js.map} +0 -0
  43. /package/dist/{chunk-JYBVRF72.js.map → chunk-7OQOOB3R.js.map} +0 -0
  44. /package/dist/{chunk-FB3E5BRY.js.map → chunk-GJURLQ3L.js.map} +0 -0
  45. /package/dist/{chunk-D5ZSGQT4.js.map → chunk-QVRXBAMM.js.map} +0 -0
  46. /package/dist/{chunk-PYTBBWL6.js.map → chunk-UIRJE422.js.map} +0 -0
  47. /package/dist/{chunk-KVMZPOUT.js.map → chunk-WSSSSBWU.js.map} +0 -0
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // tools/warp_grep/index.ts
31
31
  var warp_grep_exports = {};
32
32
  __export(warp_grep_exports, {
33
- CommandExecProvider: () => CommandExecProvider,
34
33
  LocalRipgrepProvider: () => LocalRipgrepProvider,
35
34
  WARP_GREP_DESCRIPTION: () => WARP_GREP_DESCRIPTION,
36
35
  WARP_GREP_SYSTEM_PROMPT: () => SYSTEM_PROMPT,
@@ -770,13 +769,12 @@ function mergeRanges(ranges) {
770
769
 
771
770
  // tools/warp_grep/agent/runner.ts
772
771
  var import_path = __toESM(require("path"), 1);
773
- var import_promises = __toESM(require("fs/promises"), 1);
774
772
  var parser = new LLMResponseParser();
775
- async function buildInitialState(repoRoot, query) {
773
+ async function buildInitialState(repoRoot, query, provider) {
776
774
  try {
777
- const entries = await import_promises.default.readdir(repoRoot, { withFileTypes: true });
778
- const dirs = entries.filter((e) => e.isDirectory()).map((d) => d.name).slice(0, 50);
779
- const files = entries.filter((e) => e.isFile()).map((f) => f.name).slice(0, 50);
775
+ const entries = await provider.analyse({ path: ".", maxResults: 100 });
776
+ const dirs = entries.filter((e) => e.type === "dir").map((d) => d.name).slice(0, 50);
777
+ const files = entries.filter((e) => e.type === "file").map((f) => f.name).slice(0, 50);
780
778
  const parts = [
781
779
  `<repo_root>${repoRoot}</repo_root>`,
782
780
  `<top_dirs>${dirs.join(", ")}</top_dirs>`,
@@ -825,7 +823,7 @@ async function runWarpGrep(config) {
825
823
  messages.push(systemMessage);
826
824
  const queryContent = `<query>${config.query}</query>`;
827
825
  messages.push({ role: "user", content: queryContent });
828
- const initialState = await buildInitialState(repoRoot, config.query);
826
+ const initialState = await buildInitialState(repoRoot, config.query, config.provider);
829
827
  messages.push({ role: "user", content: initialState });
830
828
  const maxRounds = AGENT_CONFIG.MAX_ROUNDS;
831
829
  const model = config.model || DEFAULT_MODEL;
@@ -968,7 +966,7 @@ async function runWarpGrep(config) {
968
966
  }
969
967
 
970
968
  // tools/warp_grep/providers/local.ts
971
- var import_promises3 = __toESM(require("fs/promises"), 1);
969
+ var import_promises2 = __toESM(require("fs/promises"), 1);
972
970
  var import_path3 = __toESM(require("path"), 1);
973
971
 
974
972
  // tools/warp_grep/utils/ripgrep.ts
@@ -1078,9 +1076,9 @@ function isTextualFile(filePath, maxBytes = 2e6) {
1078
1076
  }
1079
1077
 
1080
1078
  // tools/warp_grep/utils/files.ts
1081
- var import_promises2 = __toESM(require("fs/promises"), 1);
1079
+ var import_promises = __toESM(require("fs/promises"), 1);
1082
1080
  async function readAllLines(filePath) {
1083
- const content = await import_promises2.default.readFile(filePath, "utf8");
1081
+ const content = await import_promises.default.readFile(filePath, "utf8");
1084
1082
  return content.split(/\r?\n/);
1085
1083
  }
1086
1084
 
@@ -1092,7 +1090,7 @@ var LocalRipgrepProvider = class {
1092
1090
  }
1093
1091
  async grep(params) {
1094
1092
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1095
- const stat = await import_promises3.default.stat(abs).catch(() => null);
1093
+ const stat = await import_promises2.default.stat(abs).catch(() => null);
1096
1094
  if (!stat) return { lines: [] };
1097
1095
  const targetArg = abs === import_path3.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
1098
1096
  const args = [
@@ -1150,7 +1148,7 @@ Details: ${res.stderr}` : ""}`
1150
1148
  }
1151
1149
  async read(params) {
1152
1150
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1153
- const stat = await import_promises3.default.stat(abs).catch(() => null);
1151
+ const stat = await import_promises2.default.stat(abs).catch(() => null);
1154
1152
  if (!stat || !stat.isFile()) {
1155
1153
  return {
1156
1154
  lines: [],
@@ -1186,7 +1184,7 @@ Details: ${res.stderr}` : ""}`
1186
1184
  }
1187
1185
  async analyse(params) {
1188
1186
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1189
- const stat = await import_promises3.default.stat(abs).catch(() => null);
1187
+ const stat = await import_promises2.default.stat(abs).catch(() => null);
1190
1188
  if (!stat || !stat.isDirectory()) {
1191
1189
  return [];
1192
1190
  }
@@ -1196,7 +1194,7 @@ Details: ${res.stderr}` : ""}`
1196
1194
  const results = [];
1197
1195
  async function walk(dir, depth) {
1198
1196
  if (depth > maxDepth || results.length >= maxResults) return;
1199
- const entries = await import_promises3.default.readdir(dir, { withFileTypes: true });
1197
+ const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
1200
1198
  for (const entry of entries) {
1201
1199
  const full = import_path3.default.join(dir, entry.name);
1202
1200
  const rel = toRepoRelative(abs, full).replace(/^[.][/\\]?/, "");
@@ -1312,71 +1310,6 @@ function formatResult(result) {
1312
1310
  var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
1313
1311
  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.';
1314
1312
 
1315
- // tools/warp_grep/providers/command.ts
1316
- var CommandExecProvider = class {
1317
- constructor(opts) {
1318
- this.opts = opts;
1319
- }
1320
- map(path4) {
1321
- return this.opts.pathMap ? this.opts.pathMap(path4) : path4;
1322
- }
1323
- async grep(params) {
1324
- const remotePath = this.map(params.path);
1325
- const args = [
1326
- "--no-config",
1327
- "--no-heading",
1328
- "--with-filename",
1329
- "--line-number",
1330
- "--color=never",
1331
- "--trim",
1332
- "--max-columns=400",
1333
- ...(this.opts.excludes ?? DEFAULT_EXCLUDES).flatMap((e) => ["-g", `!${e}`]),
1334
- params.pattern,
1335
- remotePath || "."
1336
- ];
1337
- const res = await this.opts.run("rg", args, { cwd: this.opts.cwd, env: this.opts.env });
1338
- if (res.exitCode === -1) throw new Error(res.stderr || "ripgrep execution failed");
1339
- if (res.exitCode !== 0 && res.exitCode !== 1) throw new Error(res.stderr || `ripgrep failed (${res.exitCode})`);
1340
- const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
1341
- return { lines };
1342
- }
1343
- async glob(params) {
1344
- const remotePath = this.map(params.path);
1345
- const args = [
1346
- "--no-config",
1347
- "--files",
1348
- "-g",
1349
- params.pattern,
1350
- ...(this.opts.excludes ?? DEFAULT_EXCLUDES).flatMap((e) => ["-g", `!${e}`]),
1351
- remotePath || "."
1352
- ];
1353
- const res = await this.opts.run("rg", args, { cwd: this.opts.cwd, env: this.opts.env });
1354
- if (res.exitCode === -1) throw new Error(res.stderr || "ripgrep execution failed");
1355
- const files = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
1356
- return { files };
1357
- }
1358
- async read(params) {
1359
- const remotePath = this.map(params.path);
1360
- const rc = this.opts.readCommand ? this.opts.readCommand(remotePath, params.start, params.end) : { cmd: "sed", args: ["-n", `${params.start ?? 1},${params.end ?? 1e6}p`, remotePath] };
1361
- const res = await this.opts.run(rc.cmd, rc.args, { cwd: this.opts.cwd, env: this.opts.env });
1362
- if (res.exitCode !== 0) throw new Error(res.stderr || `read failed (${res.exitCode})`);
1363
- const text = res.stdout || "";
1364
- const lines = text.split(/\r?\n/).map((line, idx) => `${(params.start ?? 1) + idx}|${line}`);
1365
- return { lines: lines.filter((l) => l !== `${(params.start ?? 1) + (lines.length - 1)}|`) };
1366
- }
1367
- async analyse(params) {
1368
- const target = this.map(params.path);
1369
- const pattern = params.pattern ?? "*";
1370
- const files = await this.glob({ pattern, path: target }).catch(() => ({ files: [] }));
1371
- return files.files.slice(0, params.maxResults ?? 100).map((f) => ({
1372
- name: f.split("/").pop() || f,
1373
- path: f,
1374
- type: f.endsWith("/") ? "dir" : "file",
1375
- depth: 0
1376
- }));
1377
- }
1378
- };
1379
-
1380
1313
  // tools/warp_grep/openai.ts
1381
1314
  var TOOL_PARAMETERS = {
1382
1315
  type: "object",
@@ -1513,7 +1446,6 @@ function createMorphWarpGrepTool3(config) {
1513
1446
  }
1514
1447
  // Annotate the CommonJS export names for ESM import in node:
1515
1448
  0 && (module.exports = {
1516
- CommandExecProvider,
1517
1449
  LocalRipgrepProvider,
1518
1450
  WARP_GREP_DESCRIPTION,
1519
1451
  WARP_GREP_SYSTEM_PROMPT,