@morphllm/morphsdk 0.2.202 → 0.2.204

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 (246) hide show
  1. package/README.md +101 -0
  2. package/dist/chunk-2GMG5XKU.js +100 -0
  3. package/dist/chunk-2PPYWRMZ.js +3 -4
  4. package/dist/chunk-3HAHJYZQ.cjs +74 -0
  5. package/dist/{chunk-2XU3XXUE.js → chunk-3JROKKS4.js} +3 -25
  6. package/dist/{chunk-26K5EJD3.js → chunk-43JBUEIX.js} +4 -18
  7. package/dist/chunk-44OIEPIO.js +4 -23
  8. package/dist/chunk-4EQQGUZ7.cjs +104 -0
  9. package/dist/chunk-4OUGA3KS.js +1 -5
  10. package/dist/{chunk-VQDDL3UH.js → chunk-4TZBUFVP.js} +2 -8
  11. package/dist/{chunk-YAM6P5OQ.js → chunk-564XJOQP.js} +2 -6
  12. package/dist/chunk-5H3FKFOI.cjs +77 -0
  13. package/dist/chunk-5TTZQF4X.cjs +110 -0
  14. package/dist/chunk-6HAYJA6M.cjs +317 -0
  15. package/dist/chunk-6TZCVTW5.js +3 -4
  16. package/dist/chunk-6WP7EA4F.js +2 -4
  17. package/dist/chunk-74A4HLIO.cjs +42 -0
  18. package/dist/chunk-75ZPJI57.cjs +9 -0
  19. package/dist/chunk-7PJYY46L.cjs +2 -0
  20. package/dist/chunk-AWFZKS27.cjs +11 -0
  21. package/dist/chunk-BJBWWIZV.cjs +2 -0
  22. package/dist/chunk-DLYDIYDK.cjs +305 -0
  23. package/dist/{chunk-65TUD7JV.js → chunk-DYCMPDPV.js} +13 -29
  24. package/dist/{chunk-3CPI6ZIC.js → chunk-DZP7BR66.js} +22 -43
  25. package/dist/chunk-E63OPKP7.js +96 -0
  26. package/dist/chunk-E6V75LI6.cjs +334 -0
  27. package/dist/{chunk-XPHNS7NW.js → chunk-EJ6ID24K.js} +3 -12
  28. package/dist/chunk-EJTL2BOZ.cjs +42 -0
  29. package/dist/chunk-ETBRAKVV.js +1 -5
  30. package/dist/chunk-F633IVQA.cjs +91 -0
  31. package/dist/chunk-FBOZIVVQ.js +1 -0
  32. package/dist/{chunk-UKXCGQPS.js → chunk-FGA6EYC2.js} +35 -37
  33. package/dist/{chunk-CAWQEHKP.js → chunk-G4RODMXA.js} +4 -19
  34. package/dist/chunk-GUNGJC6X.cjs +256 -0
  35. package/dist/chunk-GYE3FY6Z.js +8 -0
  36. package/dist/chunk-HDP4QAZL.js +1 -4
  37. package/dist/chunk-HNMEBYIS.cjs +86 -0
  38. package/dist/chunk-HP3PCOTW.cjs +81 -0
  39. package/dist/{chunk-ICCGLO6V.js → chunk-IGXNLXPN.js} +12 -17
  40. package/dist/chunk-IPJA3ZS6.cjs +10 -0
  41. package/dist/chunk-JHC2R3HU.cjs +317 -0
  42. package/dist/{chunk-IBRBSDLT.js → chunk-JVMIFGZY.js} +5 -8
  43. package/dist/chunk-KF6S3EPJ.cjs +100 -0
  44. package/dist/chunk-KVGZ2TSG.cjs +274 -0
  45. package/dist/{chunk-6OYJC4TZ.js → chunk-L5SCKZVK.js} +13 -22
  46. package/dist/chunk-LDM7RNNN.js +1 -0
  47. package/dist/{chunk-UAZKHSEU.js → chunk-LQST3NW2.js} +5 -15
  48. package/dist/chunk-M34E2AMK.js +1 -5
  49. package/dist/chunk-MF56KEI4.js +1 -4
  50. package/dist/chunk-MLKGABMK.js +1 -3
  51. package/dist/chunk-MLPZKUCO.js +4 -5
  52. package/dist/chunk-MMX5PUGC.cjs +242 -0
  53. package/dist/chunk-MWXJ6DZ2.cjs +21 -0
  54. package/dist/chunk-NJWOWXUR.cjs +137 -0
  55. package/dist/chunk-NNKBKENK.cjs +15 -0
  56. package/dist/chunk-NRG6QX3L.js +1 -3
  57. package/dist/chunk-OCKEEEYE.cjs +433 -0
  58. package/dist/chunk-OENJO7YW.js +306 -0
  59. package/dist/chunk-OKLAYEBC.cjs +2 -0
  60. package/dist/chunk-OPDWMD4Q.js +1 -3
  61. package/dist/{chunk-D6YJ5X3C.js → chunk-OX5GN2KB.js} +26 -14
  62. package/dist/{chunk-JEVLCA5C.js → chunk-OYBOP47A.js} +18 -19
  63. package/dist/chunk-OZHCHPIE.js +1 -0
  64. package/dist/chunk-PA3UTI4A.js +1 -4
  65. package/dist/chunk-QEEAIXL5.cjs +74 -0
  66. package/dist/chunk-QT5LGZG3.cjs +10 -0
  67. package/dist/chunk-R3TUE7O2.cjs +107 -0
  68. package/dist/chunk-RYVW7RUM.js +2 -6
  69. package/dist/{chunk-LVKKICOB.js → chunk-SOQYE5A4.js} +36 -69
  70. package/dist/chunk-ST2OXLT5.cjs +91 -0
  71. package/dist/{chunk-SIFDK4AA.js → chunk-TH4MG73B.js} +3 -24
  72. package/dist/{chunk-OSL4CNSO.js → chunk-TLMAMVAW.js} +7 -23
  73. package/dist/chunk-TPZHMD7J.cjs +72 -0
  74. package/dist/{chunk-PDSIWL7I.js → chunk-U4PYAGNR.js} +6 -19
  75. package/dist/chunk-UAPK3AIJ.js +1 -10
  76. package/dist/chunk-UF5IKELS.cjs +26 -0
  77. package/dist/chunk-UHFVWYSP.cjs +408 -0
  78. package/dist/chunk-UKBSXYKE.cjs +280 -0
  79. package/dist/chunk-UNX7V6P6.cjs +60 -0
  80. package/dist/chunk-UZMMJ47A.cjs +107 -0
  81. package/dist/chunk-VHD7CW5O.cjs +43 -0
  82. package/dist/chunk-VL4QNALG.cjs +50 -0
  83. package/dist/chunk-VYE7O4FM.cjs +51 -0
  84. package/dist/chunk-WIYVT4UO.cjs +173 -0
  85. package/dist/chunk-WJHHO24M.cjs +91 -0
  86. package/dist/chunk-WR7LSUIR.cjs +213 -0
  87. package/dist/chunk-XE6D4J63.cjs +72 -0
  88. package/dist/chunk-YAUXTFIN.cjs +21 -0
  89. package/dist/{chunk-NFPRKZQ5.js → chunk-YJUCGZNN.js} +5 -22
  90. package/dist/chunk-ZSHVXDA2.js +4 -10
  91. package/dist/chunk-ZX6T3LNG.js +302 -0
  92. package/dist/{client-BWhi-vSj.d.ts → client-DSXbcxII.d.ts} +10 -1
  93. package/dist/client.cjs +44 -4360
  94. package/dist/client.d.ts +4 -2
  95. package/dist/client.js +36 -37
  96. package/dist/core/client.cjs +14 -476
  97. package/dist/core/client.d.ts +8 -0
  98. package/dist/core/client.js +10 -11
  99. package/dist/core/error.cjs +8 -251
  100. package/dist/core/error.js +4 -9
  101. package/dist/core/index.cjs +27 -491
  102. package/dist/core/index.d.ts +2 -0
  103. package/dist/core/index.js +12 -19
  104. package/dist/core/resource.cjs +9 -33
  105. package/dist/core/resource.d.ts +2 -0
  106. package/dist/core/resource.js +2 -7
  107. package/dist/edge.cjs +74 -1111
  108. package/dist/edge.d.ts +3 -0
  109. package/dist/edge.js +14 -42
  110. package/dist/guard-CvW03v4u.d.ts +59 -0
  111. package/dist/index.cjs +140 -4431
  112. package/dist/index.d.ts +6 -2
  113. package/dist/index.js +44 -87
  114. package/dist/modelrouter/core.cjs +35 -651
  115. package/dist/modelrouter/core.d.ts +2 -0
  116. package/dist/modelrouter/core.js +12 -21
  117. package/dist/modelrouter/index.cjs +35 -651
  118. package/dist/modelrouter/index.d.ts +2 -0
  119. package/dist/modelrouter/index.js +12 -21
  120. package/dist/modelrouter/types.cjs +1 -17
  121. package/dist/modelrouter/types.d.ts +5 -0
  122. package/dist/modelrouter/types.js +1 -0
  123. package/dist/subagents/anthropic.cjs +31 -2784
  124. package/dist/subagents/anthropic.d.ts +3 -1
  125. package/dist/subagents/anthropic.js +23 -24
  126. package/dist/subagents/index.cjs +14 -95
  127. package/dist/subagents/index.d.ts +3 -1
  128. package/dist/subagents/index.js +2 -11
  129. package/dist/subagents/prompts.cjs +14 -93
  130. package/dist/subagents/prompts.d.ts +3 -1
  131. package/dist/subagents/prompts.js +2 -11
  132. package/dist/subagents/types.cjs +1 -17
  133. package/dist/subagents/types.d.ts +3 -1
  134. package/dist/subagents/types.js +1 -0
  135. package/dist/subagents/vercel.cjs +31 -2761
  136. package/dist/subagents/vercel.d.ts +3 -1
  137. package/dist/subagents/vercel.js +23 -24
  138. package/dist/tools/compact/core.cjs +20 -552
  139. package/dist/tools/compact/core.d.ts +2 -0
  140. package/dist/tools/compact/core.js +12 -13
  141. package/dist/tools/compact/index.cjs +24 -598
  142. package/dist/tools/compact/index.d.ts +3 -1
  143. package/dist/tools/compact/index.js +13 -17
  144. package/dist/tools/compact/types.cjs +1 -17
  145. package/dist/tools/compact/types.d.ts +4 -4
  146. package/dist/tools/compact/types.js +1 -0
  147. package/dist/tools/fastapply/anthropic.cjs +39 -899
  148. package/dist/tools/fastapply/anthropic.d.ts +2 -0
  149. package/dist/tools/fastapply/anthropic.js +15 -24
  150. package/dist/tools/fastapply/apply.cjs +32 -672
  151. package/dist/tools/fastapply/apply.d.ts +2 -0
  152. package/dist/tools/fastapply/apply.js +8 -19
  153. package/dist/tools/fastapply/core.cjs +49 -1069
  154. package/dist/tools/fastapply/core.d.ts +3 -0
  155. package/dist/tools/fastapply/core.js +13 -29
  156. package/dist/tools/fastapply/index.cjs +56 -1052
  157. package/dist/tools/fastapply/index.d.ts +2 -0
  158. package/dist/tools/fastapply/index.js +18 -44
  159. package/dist/tools/fastapply/openai.cjs +45 -910
  160. package/dist/tools/fastapply/openai.d.ts +2 -0
  161. package/dist/tools/fastapply/openai.js +15 -26
  162. package/dist/tools/fastapply/prompts.cjs +10 -62
  163. package/dist/tools/fastapply/prompts.js +2 -9
  164. package/dist/tools/fastapply/types.cjs +1 -17
  165. package/dist/tools/fastapply/types.d.ts +9 -4
  166. package/dist/tools/fastapply/types.js +1 -0
  167. package/dist/tools/fastapply/vercel.cjs +37 -905
  168. package/dist/tools/fastapply/vercel.d.ts +2 -0
  169. package/dist/tools/fastapply/vercel.js +15 -22
  170. package/dist/tools/index.cjs +56 -1052
  171. package/dist/tools/index.d.ts +2 -0
  172. package/dist/tools/index.js +18 -44
  173. package/dist/tools/pii/index.cjs +47 -0
  174. package/dist/tools/pii/index.d.ts +4 -0
  175. package/dist/tools/pii/index.js +6 -0
  176. package/dist/tools/pii/model.cjs +45 -0
  177. package/dist/tools/pii/model.d.ts +83 -0
  178. package/dist/tools/pii/model.js +4 -0
  179. package/dist/tools/pii/patterns.cjs +15 -0
  180. package/dist/tools/pii/patterns.d.ts +31 -0
  181. package/dist/tools/pii/patterns.js +2 -0
  182. package/dist/tools/pii/regex.cjs +32 -0
  183. package/dist/tools/pii/regex.d.ts +48 -0
  184. package/dist/tools/pii/regex.js +3 -0
  185. package/dist/tools/pii/types.cjs +2 -0
  186. package/dist/tools/pii/types.d.ts +108 -0
  187. package/dist/tools/pii/types.js +1 -0
  188. package/dist/tools/utils/resilience.cjs +15 -312
  189. package/dist/tools/utils/resilience.js +3 -12
  190. package/dist/tools/warp_grep/agent/config.cjs +16 -127
  191. package/dist/tools/warp_grep/agent/config.js +2 -11
  192. package/dist/tools/warp_grep/agent/formatter.cjs +12 -48
  193. package/dist/tools/warp_grep/agent/formatter.js +2 -9
  194. package/dist/tools/warp_grep/agent/parser.cjs +16 -83
  195. package/dist/tools/warp_grep/agent/parser.d.ts +2 -0
  196. package/dist/tools/warp_grep/agent/parser.js +2 -11
  197. package/dist/tools/warp_grep/agent/runner.cjs +19 -1081
  198. package/dist/tools/warp_grep/agent/runner.d.ts +2 -0
  199. package/dist/tools/warp_grep/agent/runner.js +11 -14
  200. package/dist/tools/warp_grep/agent/types.cjs +1 -17
  201. package/dist/tools/warp_grep/agent/types.d.ts +4 -0
  202. package/dist/tools/warp_grep/agent/types.js +1 -0
  203. package/dist/tools/warp_grep/anthropic.cjs +51 -2561
  204. package/dist/tools/warp_grep/anthropic.d.ts +3 -1
  205. package/dist/tools/warp_grep/anthropic.js +23 -35
  206. package/dist/tools/warp_grep/client.cjs +53 -2471
  207. package/dist/tools/warp_grep/client.d.ts +3 -1
  208. package/dist/tools/warp_grep/client.js +21 -34
  209. package/dist/tools/warp_grep/gemini.cjs +52 -2490
  210. package/dist/tools/warp_grep/gemini.d.ts +3 -1
  211. package/dist/tools/warp_grep/gemini.js +25 -41
  212. package/dist/tools/warp_grep/harness.cjs +81 -936
  213. package/dist/tools/warp_grep/harness.d.ts +2 -0
  214. package/dist/tools/warp_grep/harness.js +12 -51
  215. package/dist/tools/warp_grep/index.cjs +128 -2575
  216. package/dist/tools/warp_grep/index.d.ts +3 -1
  217. package/dist/tools/warp_grep/index.js +28 -87
  218. package/dist/tools/warp_grep/openai.cjs +57 -2575
  219. package/dist/tools/warp_grep/openai.d.ts +3 -1
  220. package/dist/tools/warp_grep/openai.js +23 -37
  221. package/dist/tools/warp_grep/providers/code_storage_http.cjs +12 -65
  222. package/dist/tools/warp_grep/providers/code_storage_http.d.ts +3 -1
  223. package/dist/tools/warp_grep/providers/code_storage_http.js +2 -9
  224. package/dist/tools/warp_grep/providers/local.cjs +10 -589
  225. package/dist/tools/warp_grep/providers/local.js +6 -11
  226. package/dist/tools/warp_grep/providers/remote.cjs +8 -331
  227. package/dist/tools/warp_grep/providers/remote.d.ts +3 -1
  228. package/dist/tools/warp_grep/providers/remote.js +3 -8
  229. package/dist/tools/warp_grep/providers/types.cjs +1 -17
  230. package/dist/tools/warp_grep/providers/types.js +1 -0
  231. package/dist/tools/warp_grep/utils/files.cjs +9 -42
  232. package/dist/tools/warp_grep/utils/files.js +2 -7
  233. package/dist/tools/warp_grep/utils/github.cjs +9 -43
  234. package/dist/tools/warp_grep/utils/github.js +2 -7
  235. package/dist/tools/warp_grep/utils/paths.cjs +28 -104
  236. package/dist/tools/warp_grep/utils/paths.js +2 -17
  237. package/dist/tools/warp_grep/utils/ripgrep.cjs +9 -103
  238. package/dist/tools/warp_grep/utils/ripgrep.js +2 -7
  239. package/dist/tools/warp_grep/vercel.cjs +57 -2557
  240. package/dist/tools/warp_grep/vercel.d.ts +3 -1
  241. package/dist/tools/warp_grep/vercel.js +23 -37
  242. package/dist/{types-DxZLPogx.d.ts → types-BKhXjDCB.d.ts} +6 -1
  243. package/dist/version.cjs +7 -225
  244. package/dist/version.js +2 -7
  245. package/package.json +11 -2
  246. package/dist/chunk-E6TL6MIH.js +0 -203
@@ -1,594 +1,15 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
29
2
 
30
- // tools/warp_grep/providers/local.ts
31
- var local_exports = {};
32
- __export(local_exports, {
33
- LocalRipgrepProvider: () => LocalRipgrepProvider
34
- });
35
- module.exports = __toCommonJS(local_exports);
36
- var import_promises2 = __toESM(require("fs/promises"), 1);
37
- var import_path2 = __toESM(require("path"), 1);
38
-
39
- // tools/warp_grep/utils/ripgrep.ts
40
- var import_child_process = require("child_process");
41
- var resolvedRgPath = null;
42
- var rgPathChecked = false;
43
- function spawnRg(rgBinary, args, opts) {
44
- return new Promise((resolve) => {
45
- const child = (0, import_child_process.spawn)(rgBinary, args, {
46
- cwd: opts?.cwd,
47
- env: { ...process.env, ...opts?.env || {} },
48
- stdio: ["ignore", "pipe", "pipe"]
49
- });
50
- let stdout = "";
51
- let stderr = "";
52
- child.stdout.on("data", (d) => stdout += d.toString());
53
- child.stderr.on("data", (d) => stderr += d.toString());
54
- child.on("close", (code) => {
55
- resolve({ stdout, stderr, exitCode: typeof code === "number" ? code : -1 });
56
- });
57
- child.on("error", () => {
58
- resolve({ stdout: "", stderr: "Failed to spawn ripgrep.", exitCode: -1 });
59
- });
60
- });
61
- }
62
- async function preferredRgPath() {
63
- try {
64
- return (await import("@vscode/ripgrep")).rgPath ?? "rg";
65
- } catch {
66
- return "rg";
67
- }
68
- }
69
- function isBinaryFailure(result) {
70
- if (result.exitCode === -1) return true;
71
- if (result.stderr.includes("jemalloc") || result.stderr.includes("Unsupported system page size")) return true;
72
- if (result.exitCode === 134) return true;
73
- return false;
74
- }
75
- async function runRipgrep(args, opts) {
76
- if (rgPathChecked && resolvedRgPath) {
77
- return spawnRg(resolvedRgPath, args, opts);
78
- }
79
- if (!rgPathChecked) {
80
- const rgPath = await preferredRgPath();
81
- const result = await spawnRg(rgPath, args, opts);
82
- if (!isBinaryFailure(result)) {
83
- resolvedRgPath = rgPath;
84
- rgPathChecked = true;
85
- return result;
86
- }
87
- const fallbackResult = await spawnRg("rg", args, opts);
88
- if (!isBinaryFailure(fallbackResult)) {
89
- resolvedRgPath = "rg";
90
- rgPathChecked = true;
91
- return fallbackResult;
92
- }
93
- rgPathChecked = true;
94
- return {
95
- stdout: "",
96
- stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
97
- exitCode: -1
98
- };
99
- }
100
- return {
101
- stdout: "",
102
- stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
103
- exitCode: -1
104
- };
105
- }
106
-
107
- // tools/warp_grep/utils/paths.ts
108
- var import_fs = __toESM(require("fs"), 1);
109
- var import_path = __toESM(require("path"), 1);
110
- function resolveUnderRepo(repoRoot, targetPath) {
111
- const absRoot = import_path.default.resolve(repoRoot);
112
- const resolved = import_path.default.resolve(absRoot, targetPath);
113
- ensureWithinRepo(absRoot, resolved);
114
- return resolved;
115
- }
116
- function ensureWithinRepo(repoRoot, absTarget) {
117
- const rel = import_path.default.relative(import_path.default.resolve(repoRoot), import_path.default.resolve(absTarget));
118
- if (rel.startsWith("..") || import_path.default.isAbsolute(rel)) {
119
- throw new Error(`Path outside repository root: ${absTarget}`);
120
- }
121
- }
122
- function toRepoRelative(repoRoot, absPath) {
123
- return import_path.default.relative(import_path.default.resolve(repoRoot), import_path.default.resolve(absPath));
124
- }
125
- function isSymlink(p) {
126
- try {
127
- const st = import_fs.default.lstatSync(p);
128
- return st.isSymbolicLink();
129
- } catch {
130
- return false;
131
- }
132
- }
133
- function fixPathRepetition(fullPath) {
134
- const segments = fullPath.split(import_path.default.sep).filter(Boolean);
135
- if (segments.length < 2) return null;
136
- for (let len = Math.floor(segments.length / 2); len >= 1; len--) {
137
- for (let i = 0; i <= segments.length - 2 * len; i++) {
138
- const first = segments.slice(i, i + len);
139
- const second = segments.slice(i + len, i + 2 * len);
140
- if (first.every((seg, idx) => seg === second[idx])) {
141
- const fixed = [...segments.slice(0, i), ...segments.slice(i + len)];
142
- return import_path.default.sep + fixed.join(import_path.default.sep);
143
- }
144
- }
145
- }
146
- return null;
147
- }
148
- function isTextualFile(filePath, maxBytes = 2e6) {
149
- try {
150
- const st = import_fs.default.statSync(filePath);
151
- if (!st.isFile()) return false;
152
- if (st.size > maxBytes) return false;
153
- const fd = import_fs.default.openSync(filePath, "r");
154
- const buf = Buffer.alloc(512);
155
- const read = import_fs.default.readSync(fd, buf, 0, buf.length, 0);
156
- import_fs.default.closeSync(fd);
157
- for (let i = 0; i < read; i++) {
158
- const c = buf[i];
159
- if (c === 0) return false;
160
- }
161
- return true;
162
- } catch {
163
- return false;
164
- }
165
- }
3
+ var chunkE6V75LI6_cjs = require('../../../chunk-E6V75LI6.cjs');
4
+ require('../../../chunk-NNKBKENK.cjs');
5
+ require('../../../chunk-QEEAIXL5.cjs');
6
+ require('../../../chunk-XE6D4J63.cjs');
7
+ require('../../../chunk-4EQQGUZ7.cjs');
8
+ require('../../../chunk-75ZPJI57.cjs');
166
9
 
167
- // tools/warp_grep/utils/files.ts
168
- var import_promises = __toESM(require("fs/promises"), 1);
169
- async function readAllLines(filePath) {
170
- const content = await import_promises.default.readFile(filePath, "utf8");
171
- return content.split(/\r?\n/);
172
- }
173
10
 
174
- // tools/warp_grep/agent/config.ts
175
- var parseEnvTimeout = (envValue, defaultMs) => {
176
- if (!envValue) return defaultMs;
177
- const parsed = parseInt(envValue, 10);
178
- return isNaN(parsed) || parsed <= 0 ? defaultMs : parsed;
179
- };
180
- var AGENT_CONFIG = {
181
- MAX_TURNS: 6,
182
- /** Default timeout for model calls. Can be overridden via MORPH_WARP_GREP_TIMEOUT env var (in ms) */
183
- TIMEOUT_MS: parseEnvTimeout(process.env.MORPH_WARP_GREP_TIMEOUT, 6e4),
184
- MAX_CONTEXT_CHARS: 321600,
185
- MAX_OUTPUT_LINES: 200,
186
- MAX_LIST_RESULTS: 500,
187
- MAX_READ_LINES: 800,
188
- MAX_LIST_DEPTH: 3,
189
- LIST_TIMEOUT_MS: 2e3
190
- };
191
- var BUILTIN_EXCLUDES = [
192
- // Version control
193
- ".git",
194
- ".svn",
195
- ".hg",
196
- ".bzr",
197
- // Dependencies
198
- "node_modules",
199
- "bower_components",
200
- ".pnpm",
201
- ".yarn",
202
- "vendor",
203
- "packages",
204
- "Pods",
205
- ".bundle",
206
- // Python
207
- "__pycache__",
208
- ".pytest_cache",
209
- ".mypy_cache",
210
- ".ruff_cache",
211
- ".venv",
212
- "venv",
213
- ".tox",
214
- ".nox",
215
- ".eggs",
216
- "*.egg-info",
217
- // Build outputs
218
- "dist",
219
- "build",
220
- "out",
221
- "output",
222
- "target",
223
- "_build",
224
- ".next",
225
- ".nuxt",
226
- ".output",
227
- ".vercel",
228
- ".netlify",
229
- // Cache directories
230
- ".cache",
231
- ".parcel-cache",
232
- ".turbo",
233
- ".nx",
234
- ".gradle",
235
- // IDE/Editor
236
- ".idea",
237
- ".vscode",
238
- ".vs",
239
- // Coverage
240
- "coverage",
241
- ".coverage",
242
- "htmlcov",
243
- ".nyc_output",
244
- // Temporary
245
- "tmp",
246
- "temp",
247
- ".tmp",
248
- ".temp",
249
- // Lock files
250
- "package-lock.json",
251
- "yarn.lock",
252
- "pnpm-lock.yaml",
253
- "bun.lockb",
254
- "Cargo.lock",
255
- "Gemfile.lock",
256
- "poetry.lock",
257
- // Binary/minified
258
- "*.min.js",
259
- "*.min.css",
260
- "*.bundle.js",
261
- "*.wasm",
262
- "*.so",
263
- "*.dll",
264
- "*.pyc",
265
- "*.map",
266
- "*.js.map",
267
- // Hidden directories catch-all
268
- ".*"
269
- ];
270
- var DEFAULT_EXCLUDES = (process.env.MORPH_WARP_GREP_EXCLUDE || "").split(",").map((s) => s.trim()).filter(Boolean).concat(BUILTIN_EXCLUDES);
271
11
 
272
- // tools/warp_grep/providers/local.ts
273
- var SKIP_NAMES = /* @__PURE__ */ new Set([
274
- // Version control
275
- ".git",
276
- ".svn",
277
- ".hg",
278
- ".bzr",
279
- // Dependencies
280
- "node_modules",
281
- "bower_components",
282
- ".pnpm",
283
- ".yarn",
284
- "vendor",
285
- "Pods",
286
- ".bundle",
287
- // Python
288
- "__pycache__",
289
- ".pytest_cache",
290
- ".mypy_cache",
291
- ".ruff_cache",
292
- ".venv",
293
- "venv",
294
- ".tox",
295
- ".nox",
296
- ".eggs",
297
- // Build outputs
298
- "dist",
299
- "build",
300
- "out",
301
- "output",
302
- "target",
303
- "_build",
304
- ".next",
305
- ".nuxt",
306
- ".output",
307
- ".vercel",
308
- ".netlify",
309
- // Cache
310
- ".cache",
311
- ".parcel-cache",
312
- ".turbo",
313
- ".nx",
314
- ".gradle",
315
- // IDE
316
- ".idea",
317
- ".vscode",
318
- ".vs",
319
- // Coverage
320
- "coverage",
321
- ".coverage",
322
- "htmlcov",
323
- ".nyc_output",
324
- // Temp
325
- "tmp",
326
- "temp",
327
- ".tmp",
328
- ".temp",
329
- // Lock files
330
- "package-lock.json",
331
- "yarn.lock",
332
- "pnpm-lock.yaml",
333
- "bun.lockb",
334
- "Cargo.lock",
335
- "Gemfile.lock",
336
- "poetry.lock"
337
- ]);
338
- var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
339
- ".min.js",
340
- ".min.css",
341
- ".bundle.js",
342
- ".wasm",
343
- ".so",
344
- ".dll",
345
- ".pyc",
346
- ".map",
347
- ".js.map"
348
- ]);
349
- function shouldSkip(name, allowNames) {
350
- if (allowNames?.has(name)) return false;
351
- if (SKIP_NAMES.has(name)) return true;
352
- if (name.startsWith(".")) return true;
353
- for (const ext of SKIP_EXTENSIONS) {
354
- if (name.endsWith(ext)) return true;
355
- }
356
- return false;
357
- }
358
- var LocalRipgrepProvider = class {
359
- constructor(repoRoot, excludes = DEFAULT_EXCLUDES, options) {
360
- this.repoRoot = repoRoot;
361
- this.excludes = excludes;
362
- if (options?.allowNames?.length) {
363
- this.allowNames = new Set(options.allowNames);
364
- }
365
- }
366
- allowNames;
367
- async grep(params) {
368
- let abs;
369
- try {
370
- abs = resolveUnderRepo(this.repoRoot, params.path);
371
- } catch (err) {
372
- return {
373
- lines: [],
374
- error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
375
- };
376
- }
377
- const stat = await import_promises2.default.stat(abs).catch(() => null);
378
- if (!stat) return { lines: [] };
379
- const targetArg = abs === import_path2.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
380
- const contextLines = params.context_lines !== void 0 ? String(params.context_lines) : "1";
381
- const args = [
382
- "--no-config",
383
- "--no-heading",
384
- "--with-filename",
385
- "--line-number",
386
- "--color=never",
387
- "--trim",
388
- "--max-columns=400",
389
- "-C",
390
- contextLines,
391
- ...params.case_sensitive === false ? ["--ignore-case"] : [],
392
- ...params.glob ? ["--glob", params.glob] : [],
393
- ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
394
- params.pattern,
395
- targetArg || "."
396
- ];
397
- const res = await runRipgrep(args, { cwd: this.repoRoot });
398
- if (res.exitCode === -1) {
399
- return {
400
- lines: [],
401
- error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required but failed to execute. Please install it:
402
- \u2022 macOS: brew install ripgrep
403
- \u2022 Ubuntu/Debian: apt install ripgrep
404
- \u2022 Windows: choco install ripgrep
405
- \u2022 Or visit: https://github.com/BurntSushi/ripgrep#installation
406
- Exit code: ${res.exitCode}${res.stderr ? `
407
- Details: ${res.stderr}` : ""}`
408
- };
409
- }
410
- if (res.exitCode !== 0 && res.exitCode !== 1) {
411
- return {
412
- lines: [],
413
- error: `[RIPGREP ERROR] grep failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}`
414
- };
415
- }
416
- const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
417
- if (lines.length > AGENT_CONFIG.MAX_OUTPUT_LINES) {
418
- const truncated = lines.slice(0, AGENT_CONFIG.MAX_OUTPUT_LINES);
419
- truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);
420
- return { lines: truncated };
421
- }
422
- return { lines };
423
- }
424
- async read(params) {
425
- let abs;
426
- try {
427
- abs = resolveUnderRepo(this.repoRoot, params.path);
428
- } catch (err) {
429
- return {
430
- lines: [],
431
- error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
432
- };
433
- }
434
- let stat = await import_promises2.default.stat(abs).catch(() => null);
435
- if (!stat || !stat.isFile()) {
436
- const fixedPath = fixPathRepetition(abs);
437
- if (fixedPath) {
438
- const fixedStat = await import_promises2.default.stat(fixedPath).catch(() => null);
439
- if (fixedStat?.isFile()) {
440
- abs = fixedPath;
441
- stat = fixedStat;
442
- }
443
- }
444
- }
445
- if (!stat || !stat.isFile()) {
446
- return {
447
- lines: [],
448
- error: `[FILE NOT FOUND] You tried to read "${params.path}" but there is no file at this path. Double-check the path exists and is spelled correctly.`
449
- };
450
- }
451
- if (isSymlink(abs)) {
452
- return {
453
- lines: [],
454
- error: `[SYMLINK] You tried to read "${params.path}" but this is a symlink. Try reading the actual file it points to instead.`
455
- };
456
- }
457
- if (!isTextualFile(abs)) {
458
- return {
459
- lines: [],
460
- error: `[UNREADABLE FILE] You tried to read "${params.path}" but this file is either too large or not a text file, so it cannot be read. Try a different file.`
461
- };
462
- }
463
- let lines;
464
- try {
465
- lines = await readAllLines(abs);
466
- } catch (err) {
467
- return {
468
- lines: [],
469
- error: `[READ ERROR] Failed to read "${params.path}": ${err instanceof Error ? err.message : String(err)}`
470
- };
471
- }
472
- const total = lines.length;
473
- const rawStart = params.start;
474
- const rawEnd = params.end;
475
- let s = 1;
476
- let e = total;
477
- const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
478
- const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
479
- if (startValid && endValid) {
480
- s = rawStart ?? 1;
481
- e = Math.min(rawEnd ?? total, total);
482
- if (s > total && total > 0 || s > e) {
483
- s = 1;
484
- e = total;
485
- }
486
- }
487
- const out = [];
488
- for (let i = s; i <= e; i += 1) {
489
- const content = lines[i - 1] ?? "";
490
- out.push(`${i}|${content}`);
491
- }
492
- if (out.length > AGENT_CONFIG.MAX_READ_LINES) {
493
- const truncated = out.slice(0, AGENT_CONFIG.MAX_READ_LINES);
494
- truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines)`);
495
- return { lines: truncated };
496
- }
497
- return { lines: out };
498
- }
499
- async listDirectory(params) {
500
- let abs;
501
- try {
502
- abs = resolveUnderRepo(this.repoRoot, params.path);
503
- } catch {
504
- return [];
505
- }
506
- const stat = await import_promises2.default.stat(abs).catch(() => null);
507
- if (!stat || !stat.isDirectory()) {
508
- return [];
509
- }
510
- const maxResults = params.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;
511
- const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
512
- const regex = params.pattern ? new RegExp(params.pattern) : null;
513
- const repoRoot = this.repoRoot;
514
- const allowNames = this.allowNames;
515
- const results = [];
516
- let timedOut = false;
517
- const startTime = Date.now();
518
- async function walk(dir, depth) {
519
- if (Date.now() - startTime > AGENT_CONFIG.LIST_TIMEOUT_MS) {
520
- timedOut = true;
521
- return;
522
- }
523
- if (depth > maxDepth || results.length >= maxResults) return;
524
- let entries;
525
- try {
526
- entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
527
- } catch {
528
- return;
529
- }
530
- for (const entry of entries) {
531
- if (timedOut || results.length >= maxResults) break;
532
- if (shouldSkip(entry.name, allowNames)) continue;
533
- if (regex && !regex.test(entry.name)) continue;
534
- const full = import_path2.default.join(dir, entry.name);
535
- const isDir = entry.isDirectory();
536
- results.push({
537
- name: entry.name,
538
- path: toRepoRelative(repoRoot, full),
539
- type: isDir ? "dir" : "file",
540
- depth
541
- });
542
- if (isDir) {
543
- await walk(full, depth + 1);
544
- }
545
- }
546
- }
547
- await walk(abs, 0);
548
- return results;
549
- }
550
- async glob(params) {
551
- let abs;
552
- try {
553
- abs = params.path ? resolveUnderRepo(this.repoRoot, params.path) : this.repoRoot;
554
- } catch (err) {
555
- return { files: [], searchDir: this.repoRoot, totalFound: 0, error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}` };
556
- }
557
- const stat = await import_promises2.default.stat(abs).catch(() => null);
558
- if (!stat || !stat.isDirectory()) {
559
- return { files: [], searchDir: abs, totalFound: 0, error: `[PATH ERROR] Directory not found: ${params.path || "."}` };
560
- }
561
- const targetArg = abs === import_path2.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
562
- const args = [
563
- "--no-config",
564
- "--files",
565
- "--color=never",
566
- "-g",
567
- params.pattern,
568
- ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
569
- targetArg || "."
570
- ];
571
- const res = await runRipgrep(args, { cwd: this.repoRoot });
572
- if (res.exitCode === -1) {
573
- return { files: [], searchDir: abs, totalFound: 0, error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required for glob search.` };
574
- }
575
- if (res.exitCode !== 0 && res.exitCode !== 1) {
576
- return { files: [], searchDir: abs, totalFound: 0, error: `[GLOB ERROR] glob failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}` };
577
- }
578
- const absRoot = import_path2.default.resolve(this.repoRoot);
579
- const relFiles = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
580
- const absFiles = relFiles.map((f) => import_path2.default.resolve(absRoot, f));
581
- const withMtime = [];
582
- for (const f of absFiles) {
583
- const s = await import_promises2.default.stat(f).catch(() => null);
584
- withMtime.push({ file: f, mtime: s?.mtimeMs ?? 0 });
585
- }
586
- withMtime.sort((a, b) => b.mtime - a.mtime);
587
- const totalFound = withMtime.length;
588
- return { files: withMtime.slice(0, 100).map((f) => f.file), searchDir: abs, totalFound };
589
- }
590
- };
591
- // Annotate the CommonJS export names for ESM import in node:
592
- 0 && (module.exports = {
593
- LocalRipgrepProvider
12
+ Object.defineProperty(exports, "LocalRipgrepProvider", {
13
+ enumerable: true,
14
+ get: function () { return chunkE6V75LI6_cjs.LocalRipgrepProvider; }
594
15
  });
@@ -1,11 +1,6 @@
1
- import {
2
- LocalRipgrepProvider
3
- } from "../../../chunk-OSL4CNSO.js";
4
- import "../../../chunk-MLPZKUCO.js";
5
- import "../../../chunk-6TZCVTW5.js";
6
- import "../../../chunk-ZSHVXDA2.js";
7
- import "../../../chunk-M34E2AMK.js";
8
- import "../../../chunk-MLKGABMK.js";
9
- export {
10
- LocalRipgrepProvider
11
- };
1
+ export { LocalRipgrepProvider } from '../../../chunk-TLMAMVAW.js';
2
+ import '../../../chunk-6TZCVTW5.js';
3
+ import '../../../chunk-ZSHVXDA2.js';
4
+ import '../../../chunk-MLPZKUCO.js';
5
+ import '../../../chunk-M34E2AMK.js';
6
+ import '../../../chunk-MLKGABMK.js';