@morphllm/morphsdk 0.2.196 → 0.2.198

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 (274) hide show
  1. package/dist/{chunk-35CF3OUB.js → chunk-3XS5P5XH.js} +6 -6
  2. package/dist/{chunk-2VTN7TKZ.js → chunk-4DNEBVGV.js} +2 -2
  3. package/dist/chunk-4DNEBVGV.js.map +1 -0
  4. package/dist/{chunk-OQVHJMRJ.js → chunk-4JUIEYAH.js} +4 -4
  5. package/dist/{chunk-LKFZBBTD.js → chunk-5TOJD2C5.js} +1 -1
  6. package/dist/chunk-5TOJD2C5.js.map +1 -0
  7. package/dist/{chunk-2JY7TZCP.js → chunk-6XFL2NER.js} +2 -2
  8. package/dist/{chunk-4ULSZFQP.js → chunk-CAFREMIT.js} +2 -2
  9. package/dist/{chunk-ZLLY7O4B.js → chunk-D2RFP6R2.js} +4 -4
  10. package/dist/{chunk-CZ74CRGH.js → chunk-EMURAU6J.js} +4 -6
  11. package/dist/chunk-EMURAU6J.js.map +1 -0
  12. package/dist/{chunk-R4XIWBIL.js → chunk-FESO6TDQ.js} +2 -2
  13. package/dist/{chunk-P47MJ3IW.js → chunk-FUYX2MNM.js} +4 -4
  14. package/dist/chunk-FUYX2MNM.js.map +1 -0
  15. package/dist/{chunk-UALXVIF2.js → chunk-GJ42MYUU.js} +2 -2
  16. package/dist/{chunk-ATAKRJQZ.js → chunk-IDMKQWQG.js} +1 -36
  17. package/dist/chunk-IDMKQWQG.js.map +1 -0
  18. package/dist/{chunk-F7MGS2FO.js → chunk-KQKLQHJF.js} +2 -2
  19. package/dist/{chunk-VLZ6PNAD.js → chunk-LN7GNFET.js} +7 -7
  20. package/dist/{chunk-I62NJUD2.js → chunk-O5264GI4.js} +2 -2
  21. package/dist/{chunk-E2ICGQI6.js → chunk-PEFXG5M6.js} +2 -2
  22. package/dist/{chunk-AGOQL5HV.js → chunk-PIIXU2H3.js} +2 -2
  23. package/dist/{chunk-HU62MINA.js → chunk-PV6EF6NG.js} +4 -4
  24. package/dist/{chunk-4MNM35CI.js → chunk-QKNGVBE2.js} +4 -4
  25. package/dist/{chunk-WHDQBPXO.js → chunk-SKN2L5CE.js} +2 -2
  26. package/dist/{chunk-XBOM427X.js → chunk-T6TXYTKH.js} +2 -2
  27. package/dist/{chunk-K5J5VRY2.js → chunk-VBZ7BG47.js} +4 -4
  28. package/dist/{chunk-KOUAORQW.js → chunk-WLMPQFER.js} +2 -2
  29. package/dist/{chunk-K7RNGQ7S.js → chunk-XH6KJJDI.js} +2 -2
  30. package/dist/{chunk-YH3GCNXJ.js → chunk-XK3PQZW6.js} +2 -2
  31. package/dist/{chunk-ZQDR653M.js → chunk-XTFRHVCW.js} +4 -4
  32. package/dist/{chunk-F6NHRM2W.js → chunk-YD6TNDR4.js} +5 -5
  33. package/dist/{chunk-5VAIYZKB.js → chunk-YHZJYCOU.js} +29 -47
  34. package/dist/{chunk-5VAIYZKB.js.map → chunk-YHZJYCOU.js.map} +1 -1
  35. package/dist/{chunk-W3XDECC2.js → chunk-YQ2G5YLI.js} +11 -11
  36. package/dist/{chunk-RNQAXIUA.js → chunk-YUH3MTP3.js} +2 -2
  37. package/dist/{chunk-FEIAMQNC.js → chunk-ZGERT23F.js} +4 -4
  38. package/dist/{chunk-7O44XTVM.js → chunk-ZQNTXHBQ.js} +2 -2
  39. package/dist/{chunk-HBCNZDKW.js → chunk-ZU5YYGBJ.js} +3 -19
  40. package/dist/chunk-ZU5YYGBJ.js.map +1 -0
  41. package/dist/{client-Rn1zymAl.d.ts → client-DCeydotn.d.ts} +0 -9
  42. package/dist/client.cjs +7 -811
  43. package/dist/client.cjs.map +1 -1
  44. package/dist/client.d.ts +1 -9
  45. package/dist/client.js +30 -34
  46. package/dist/core/client.cjs +2 -18
  47. package/dist/core/client.cjs.map +1 -1
  48. package/dist/core/client.d.ts +2 -2
  49. package/dist/core/client.js +4 -4
  50. package/dist/core/error.cjs +2 -18
  51. package/dist/core/error.cjs.map +1 -1
  52. package/dist/core/error.d.ts +1 -1
  53. package/dist/core/error.js +3 -3
  54. package/dist/core/index.cjs +2 -18
  55. package/dist/core/index.cjs.map +1 -1
  56. package/dist/core/index.js +5 -5
  57. package/dist/core/resource.cjs.map +1 -1
  58. package/dist/core/resource.d.ts +1 -1
  59. package/dist/core/resource.js +1 -1
  60. package/dist/edge.cjs +2 -18
  61. package/dist/edge.cjs.map +1 -1
  62. package/dist/edge.js +8 -8
  63. package/dist/index.cjs +7 -819
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.ts +1 -9
  66. package/dist/index.js +34 -49
  67. package/dist/modelrouter/core.cjs +2 -18
  68. package/dist/modelrouter/core.cjs.map +1 -1
  69. package/dist/modelrouter/core.js +6 -6
  70. package/dist/modelrouter/index.cjs +2 -18
  71. package/dist/modelrouter/index.cjs.map +1 -1
  72. package/dist/modelrouter/index.js +6 -6
  73. package/dist/subagents/anthropic.cjs +2 -18
  74. package/dist/subagents/anthropic.cjs.map +1 -1
  75. package/dist/subagents/anthropic.js +12 -12
  76. package/dist/subagents/vercel.cjs +2 -18
  77. package/dist/subagents/vercel.cjs.map +1 -1
  78. package/dist/subagents/vercel.js +12 -12
  79. package/dist/tools/browser/anthropic.cjs +2 -18
  80. package/dist/tools/browser/anthropic.cjs.map +1 -1
  81. package/dist/tools/browser/anthropic.js +8 -8
  82. package/dist/tools/browser/core.cjs +2 -18
  83. package/dist/tools/browser/core.cjs.map +1 -1
  84. package/dist/tools/browser/core.js +7 -7
  85. package/dist/tools/browser/index.cjs +2 -18
  86. package/dist/tools/browser/index.cjs.map +1 -1
  87. package/dist/tools/browser/index.js +12 -12
  88. package/dist/tools/browser/openai.cjs +2 -18
  89. package/dist/tools/browser/openai.cjs.map +1 -1
  90. package/dist/tools/browser/openai.js +8 -8
  91. package/dist/tools/browser/profiles/core.cjs +2 -18
  92. package/dist/tools/browser/profiles/core.cjs.map +1 -1
  93. package/dist/tools/browser/profiles/core.js +3 -3
  94. package/dist/tools/browser/profiles/index.cjs +2 -18
  95. package/dist/tools/browser/profiles/index.cjs.map +1 -1
  96. package/dist/tools/browser/profiles/index.js +3 -3
  97. package/dist/tools/browser/vercel.cjs +2 -18
  98. package/dist/tools/browser/vercel.cjs.map +1 -1
  99. package/dist/tools/browser/vercel.js +8 -8
  100. package/dist/tools/codebase_search/anthropic.cjs +2 -18
  101. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  102. package/dist/tools/codebase_search/anthropic.js +7 -7
  103. package/dist/tools/codebase_search/core.cjs +2 -18
  104. package/dist/tools/codebase_search/core.cjs.map +1 -1
  105. package/dist/tools/codebase_search/core.js +6 -6
  106. package/dist/tools/codebase_search/index.cjs +2 -18
  107. package/dist/tools/codebase_search/index.cjs.map +1 -1
  108. package/dist/tools/codebase_search/index.js +11 -11
  109. package/dist/tools/codebase_search/openai.cjs +2 -18
  110. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  111. package/dist/tools/codebase_search/openai.js +7 -7
  112. package/dist/tools/codebase_search/vercel.cjs +2 -18
  113. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  114. package/dist/tools/codebase_search/vercel.js +7 -7
  115. package/dist/tools/compact/core.cjs +2 -18
  116. package/dist/tools/compact/core.cjs.map +1 -1
  117. package/dist/tools/compact/core.js +6 -6
  118. package/dist/tools/compact/index.cjs +2 -18
  119. package/dist/tools/compact/index.cjs.map +1 -1
  120. package/dist/tools/compact/index.js +7 -7
  121. package/dist/tools/fastapply/anthropic.cjs +2 -18
  122. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  123. package/dist/tools/fastapply/anthropic.js +8 -8
  124. package/dist/tools/fastapply/apply.cjs +2 -18
  125. package/dist/tools/fastapply/apply.cjs.map +1 -1
  126. package/dist/tools/fastapply/apply.js +2 -2
  127. package/dist/tools/fastapply/core.cjs +2 -18
  128. package/dist/tools/fastapply/core.cjs.map +1 -1
  129. package/dist/tools/fastapply/core.js +7 -7
  130. package/dist/tools/fastapply/index.cjs +2 -18
  131. package/dist/tools/fastapply/index.cjs.map +1 -1
  132. package/dist/tools/fastapply/index.js +14 -14
  133. package/dist/tools/fastapply/openai.cjs +2 -18
  134. package/dist/tools/fastapply/openai.cjs.map +1 -1
  135. package/dist/tools/fastapply/openai.js +8 -8
  136. package/dist/tools/fastapply/vercel.cjs +2 -18
  137. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  138. package/dist/tools/fastapply/vercel.js +8 -8
  139. package/dist/tools/index.cjs +2 -18
  140. package/dist/tools/index.cjs.map +1 -1
  141. package/dist/tools/index.js +14 -14
  142. package/dist/tools/utils/resilience.cjs +2 -18
  143. package/dist/tools/utils/resilience.cjs.map +1 -1
  144. package/dist/tools/utils/resilience.js +2 -2
  145. package/dist/tools/warp_grep/agent/runner.cjs +2 -18
  146. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  147. package/dist/tools/warp_grep/agent/runner.js +3 -3
  148. package/dist/tools/warp_grep/anthropic.cjs +2 -18
  149. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  150. package/dist/tools/warp_grep/anthropic.js +12 -12
  151. package/dist/tools/warp_grep/client.cjs +2 -18
  152. package/dist/tools/warp_grep/client.cjs.map +1 -1
  153. package/dist/tools/warp_grep/client.js +11 -11
  154. package/dist/tools/warp_grep/gemini.cjs +2 -18
  155. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  156. package/dist/tools/warp_grep/gemini.js +11 -11
  157. package/dist/tools/warp_grep/harness.js +6 -6
  158. package/dist/tools/warp_grep/index.cjs +2 -18
  159. package/dist/tools/warp_grep/index.cjs.map +1 -1
  160. package/dist/tools/warp_grep/index.js +17 -17
  161. package/dist/tools/warp_grep/openai.cjs +2 -18
  162. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  163. package/dist/tools/warp_grep/openai.js +12 -12
  164. package/dist/tools/warp_grep/providers/local.js +2 -2
  165. package/dist/tools/warp_grep/vercel.cjs +2 -18
  166. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  167. package/dist/tools/warp_grep/vercel.js +12 -12
  168. package/dist/tracing/core.cjs +2 -34
  169. package/dist/tracing/core.cjs.map +1 -1
  170. package/dist/tracing/core.d.ts +1 -2
  171. package/dist/tracing/core.js +2 -2
  172. package/dist/tracing/index.cjs +4 -42
  173. package/dist/tracing/index.cjs.map +1 -1
  174. package/dist/tracing/index.d.ts +0 -34
  175. package/dist/tracing/index.js +3 -10
  176. package/dist/tracing/interaction.cjs +0 -30
  177. package/dist/tracing/interaction.cjs.map +1 -1
  178. package/dist/tracing/interaction.js +1 -1
  179. package/dist/tracing/types.cjs.map +1 -1
  180. package/dist/tracing/types.d.ts +1 -27
  181. package/dist/version.cjs +2 -18
  182. package/dist/version.cjs.map +1 -1
  183. package/dist/version.js +1 -1
  184. package/package.json +2 -18
  185. package/dist/chunk-2VTN7TKZ.js.map +0 -1
  186. package/dist/chunk-ATAKRJQZ.js.map +0 -1
  187. package/dist/chunk-CZ74CRGH.js.map +0 -1
  188. package/dist/chunk-GZMUGMOZ.js +0 -9
  189. package/dist/chunk-GZMUGMOZ.js.map +0 -1
  190. package/dist/chunk-HBCNZDKW.js.map +0 -1
  191. package/dist/chunk-JD6LOSNX.js +0 -202
  192. package/dist/chunk-JD6LOSNX.js.map +0 -1
  193. package/dist/chunk-LKFZBBTD.js.map +0 -1
  194. package/dist/chunk-P47MJ3IW.js.map +0 -1
  195. package/dist/chunk-TCCZBGG5.js +0 -46
  196. package/dist/chunk-TCCZBGG5.js.map +0 -1
  197. package/dist/chunk-XOZELE7Y.js +0 -561
  198. package/dist/chunk-XOZELE7Y.js.map +0 -1
  199. package/dist/git/client.cjs +0 -1123
  200. package/dist/git/client.cjs.map +0 -1
  201. package/dist/git/client.d.ts +0 -290
  202. package/dist/git/client.js +0 -14
  203. package/dist/git/client.js.map +0 -1
  204. package/dist/git/config.cjs +0 -41
  205. package/dist/git/config.cjs.map +0 -1
  206. package/dist/git/config.d.ts +0 -11
  207. package/dist/git/config.js +0 -17
  208. package/dist/git/config.js.map +0 -1
  209. package/dist/git/index.cjs +0 -1133
  210. package/dist/git/index.cjs.map +0 -1
  211. package/dist/git/index.d.ts +0 -7
  212. package/dist/git/index.js +0 -20
  213. package/dist/git/index.js.map +0 -1
  214. package/dist/git/types.cjs +0 -19
  215. package/dist/git/types.cjs.map +0 -1
  216. package/dist/git/types.d.ts +0 -133
  217. package/dist/git/types.js +0 -1
  218. package/dist/git/types.js.map +0 -1
  219. package/dist/tools/reflex/core.cjs +0 -762
  220. package/dist/tools/reflex/core.cjs.map +0 -1
  221. package/dist/tools/reflex/core.d.ts +0 -59
  222. package/dist/tools/reflex/core.js +0 -16
  223. package/dist/tools/reflex/core.js.map +0 -1
  224. package/dist/tools/reflex/index.cjs +0 -762
  225. package/dist/tools/reflex/index.cjs.map +0 -1
  226. package/dist/tools/reflex/index.d.ts +0 -5
  227. package/dist/tools/reflex/index.js +0 -16
  228. package/dist/tools/reflex/index.js.map +0 -1
  229. package/dist/tools/reflex/types.cjs +0 -19
  230. package/dist/tools/reflex/types.cjs.map +0 -1
  231. package/dist/tools/reflex/types.d.ts +0 -171
  232. package/dist/tools/reflex/types.js +0 -1
  233. package/dist/tools/reflex/types.js.map +0 -1
  234. package/dist/tools/traces/core.cjs +0 -76
  235. package/dist/tools/traces/core.cjs.map +0 -1
  236. package/dist/tools/traces/core.d.ts +0 -24
  237. package/dist/tools/traces/core.js +0 -9
  238. package/dist/tools/traces/core.js.map +0 -1
  239. package/dist/tools/traces/index.cjs +0 -76
  240. package/dist/tools/traces/index.cjs.map +0 -1
  241. package/dist/tools/traces/index.d.ts +0 -5
  242. package/dist/tools/traces/index.js +0 -9
  243. package/dist/tools/traces/index.js.map +0 -1
  244. package/dist/tools/traces/types.cjs +0 -19
  245. package/dist/tools/traces/types.cjs.map +0 -1
  246. package/dist/tools/traces/types.d.ts +0 -56
  247. package/dist/tools/traces/types.js +0 -1
  248. package/dist/tools/traces/types.js.map +0 -1
  249. /package/dist/{chunk-35CF3OUB.js.map → chunk-3XS5P5XH.js.map} +0 -0
  250. /package/dist/{chunk-OQVHJMRJ.js.map → chunk-4JUIEYAH.js.map} +0 -0
  251. /package/dist/{chunk-2JY7TZCP.js.map → chunk-6XFL2NER.js.map} +0 -0
  252. /package/dist/{chunk-4ULSZFQP.js.map → chunk-CAFREMIT.js.map} +0 -0
  253. /package/dist/{chunk-ZLLY7O4B.js.map → chunk-D2RFP6R2.js.map} +0 -0
  254. /package/dist/{chunk-R4XIWBIL.js.map → chunk-FESO6TDQ.js.map} +0 -0
  255. /package/dist/{chunk-UALXVIF2.js.map → chunk-GJ42MYUU.js.map} +0 -0
  256. /package/dist/{chunk-F7MGS2FO.js.map → chunk-KQKLQHJF.js.map} +0 -0
  257. /package/dist/{chunk-VLZ6PNAD.js.map → chunk-LN7GNFET.js.map} +0 -0
  258. /package/dist/{chunk-I62NJUD2.js.map → chunk-O5264GI4.js.map} +0 -0
  259. /package/dist/{chunk-E2ICGQI6.js.map → chunk-PEFXG5M6.js.map} +0 -0
  260. /package/dist/{chunk-AGOQL5HV.js.map → chunk-PIIXU2H3.js.map} +0 -0
  261. /package/dist/{chunk-HU62MINA.js.map → chunk-PV6EF6NG.js.map} +0 -0
  262. /package/dist/{chunk-4MNM35CI.js.map → chunk-QKNGVBE2.js.map} +0 -0
  263. /package/dist/{chunk-WHDQBPXO.js.map → chunk-SKN2L5CE.js.map} +0 -0
  264. /package/dist/{chunk-XBOM427X.js.map → chunk-T6TXYTKH.js.map} +0 -0
  265. /package/dist/{chunk-K5J5VRY2.js.map → chunk-VBZ7BG47.js.map} +0 -0
  266. /package/dist/{chunk-KOUAORQW.js.map → chunk-WLMPQFER.js.map} +0 -0
  267. /package/dist/{chunk-K7RNGQ7S.js.map → chunk-XH6KJJDI.js.map} +0 -0
  268. /package/dist/{chunk-YH3GCNXJ.js.map → chunk-XK3PQZW6.js.map} +0 -0
  269. /package/dist/{chunk-ZQDR653M.js.map → chunk-XTFRHVCW.js.map} +0 -0
  270. /package/dist/{chunk-F6NHRM2W.js.map → chunk-YD6TNDR4.js.map} +0 -0
  271. /package/dist/{chunk-W3XDECC2.js.map → chunk-YQ2G5YLI.js.map} +0 -0
  272. /package/dist/{chunk-RNQAXIUA.js.map → chunk-YUH3MTP3.js.map} +0 -0
  273. /package/dist/{chunk-FEIAMQNC.js.map → chunk-ZGERT23F.js.map} +0 -0
  274. /package/dist/{chunk-7O44XTVM.js.map → chunk-ZQNTXHBQ.js.map} +0 -0
@@ -1,1123 +0,0 @@
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);
29
-
30
- // git/client.ts
31
- var client_exports = {};
32
- __export(client_exports, {
33
- MorphGit: () => MorphGit
34
- });
35
- module.exports = __toCommonJS(client_exports);
36
- var import_isomorphic_git = __toESM(require("isomorphic-git"), 1);
37
- var import_node = __toESM(require("isomorphic-git/http/node"), 1);
38
- var import_fs = __toESM(require("fs"), 1);
39
-
40
- // package.json
41
- var package_default = {
42
- name: "@morphllm/morphsdk",
43
- version: "0.2.196",
44
- description: "TypeScript SDK and CLI for Morph Fast Apply integration",
45
- type: "module",
46
- main: "./dist/index.cjs",
47
- module: "./dist/index.js",
48
- types: "./dist/index.d.ts",
49
- exports: {
50
- ".": {
51
- types: "./dist/index.d.ts",
52
- import: "./dist/index.js",
53
- require: "./dist/index.cjs"
54
- },
55
- "./logger": {
56
- types: "./dist/logger.d.ts",
57
- import: "./dist/logger.js",
58
- require: "./dist/logger.cjs"
59
- },
60
- "./edge": {
61
- types: "./dist/edge.d.ts",
62
- import: "./dist/edge.js",
63
- require: "./dist/edge.cjs"
64
- },
65
- "./tools/warp-grep": {
66
- types: "./dist/tools/warp_grep/index.d.ts",
67
- import: "./dist/tools/warp_grep/index.js",
68
- require: "./dist/tools/warp_grep/index.cjs"
69
- },
70
- "./tools/warp-grep/openai": {
71
- types: "./dist/tools/warp_grep/openai.d.ts",
72
- import: "./dist/tools/warp_grep/openai.js",
73
- require: "./dist/tools/warp_grep/openai.cjs"
74
- },
75
- "./tools/warp-grep/anthropic": {
76
- types: "./dist/tools/warp_grep/anthropic.d.ts",
77
- import: "./dist/tools/warp_grep/anthropic.js",
78
- require: "./dist/tools/warp_grep/anthropic.cjs"
79
- },
80
- "./tools/warp-grep/vercel": {
81
- types: "./dist/tools/warp_grep/vercel.d.ts",
82
- import: "./dist/tools/warp_grep/vercel.js",
83
- require: "./dist/tools/warp_grep/vercel.cjs"
84
- },
85
- "./tools/warp-grep/client": {
86
- types: "./dist/tools/warp_grep/client.d.ts",
87
- import: "./dist/tools/warp_grep/client.js",
88
- require: "./dist/tools/warp_grep/client.cjs"
89
- },
90
- "./tools/warp-grep/gemini": {
91
- types: "./dist/tools/warp_grep/gemini.d.ts",
92
- import: "./dist/tools/warp_grep/gemini.js",
93
- require: "./dist/tools/warp_grep/gemini.cjs"
94
- },
95
- "./tools/warp-grep/harness": {
96
- types: "./dist/tools/warp_grep/harness.d.ts",
97
- import: "./dist/tools/warp_grep/harness.js",
98
- require: "./dist/tools/warp_grep/harness.cjs"
99
- },
100
- "./tracing": {
101
- types: "./dist/tracing/index.d.ts",
102
- import: "./dist/tracing/index.js",
103
- require: "./dist/tracing/index.cjs"
104
- },
105
- "./tracing/otel": {
106
- types: "./dist/tracing/otel.d.ts",
107
- import: "./dist/tracing/otel.js",
108
- require: "./dist/tracing/otel.cjs"
109
- },
110
- "./tools/fastapply": {
111
- types: "./dist/tools/fastapply/index.d.ts",
112
- import: "./dist/tools/fastapply/index.js",
113
- require: "./dist/tools/fastapply/index.cjs"
114
- },
115
- "./tools/fastapply/anthropic": {
116
- types: "./dist/tools/fastapply/anthropic.d.ts",
117
- import: "./dist/tools/fastapply/anthropic.js",
118
- require: "./dist/tools/fastapply/anthropic.cjs"
119
- },
120
- "./tools/fastapply/openai": {
121
- types: "./dist/tools/fastapply/openai.d.ts",
122
- import: "./dist/tools/fastapply/openai.js",
123
- require: "./dist/tools/fastapply/openai.cjs"
124
- },
125
- "./tools/fastapply/vercel": {
126
- types: "./dist/tools/fastapply/vercel.d.ts",
127
- import: "./dist/tools/fastapply/vercel.js",
128
- require: "./dist/tools/fastapply/vercel.cjs"
129
- },
130
- "./tools/codebase-search": {
131
- types: "./dist/tools/codebase_search/index.d.ts",
132
- import: "./dist/tools/codebase_search/index.js",
133
- require: "./dist/tools/codebase_search/index.cjs"
134
- },
135
- "./tools/codebase-search/anthropic": {
136
- types: "./dist/tools/codebase_search/anthropic.d.ts",
137
- import: "./dist/tools/codebase_search/anthropic.js",
138
- require: "./dist/tools/codebase_search/anthropic.cjs"
139
- },
140
- "./tools/codebase-search/openai": {
141
- types: "./dist/tools/codebase_search/openai.d.ts",
142
- import: "./dist/tools/codebase_search/openai.js",
143
- require: "./dist/tools/codebase_search/openai.cjs"
144
- },
145
- "./tools/codebase-search/vercel": {
146
- types: "./dist/tools/codebase_search/vercel.d.ts",
147
- import: "./dist/tools/codebase_search/vercel.js",
148
- require: "./dist/tools/codebase_search/vercel.cjs"
149
- },
150
- "./tools/git": {
151
- types: "./dist/git/index.d.ts",
152
- import: "./dist/git/index.js",
153
- require: "./dist/git/index.cjs"
154
- },
155
- "./tools/browser": {
156
- types: "./dist/tools/browser/index.d.ts",
157
- import: "./dist/tools/browser/index.js",
158
- require: "./dist/tools/browser/index.cjs"
159
- },
160
- "./tools/browser/anthropic": {
161
- types: "./dist/tools/browser/anthropic.d.ts",
162
- import: "./dist/tools/browser/anthropic.js",
163
- require: "./dist/tools/browser/anthropic.cjs"
164
- },
165
- "./tools/browser/openai": {
166
- types: "./dist/tools/browser/openai.d.ts",
167
- import: "./dist/tools/browser/openai.js",
168
- require: "./dist/tools/browser/openai.cjs"
169
- },
170
- "./tools/browser/vercel": {
171
- types: "./dist/tools/browser/vercel.d.ts",
172
- import: "./dist/tools/browser/vercel.js",
173
- require: "./dist/tools/browser/vercel.cjs"
174
- },
175
- "./tools/browser/profiles": {
176
- types: "./dist/tools/browser/profiles/index.d.ts",
177
- import: "./dist/tools/browser/profiles/index.js",
178
- require: "./dist/tools/browser/profiles/index.cjs"
179
- },
180
- "./modelrouter": {
181
- types: "./dist/modelrouter/index.d.ts",
182
- import: "./dist/modelrouter/index.js",
183
- require: "./dist/modelrouter/index.cjs"
184
- },
185
- "./tools/compact": {
186
- types: "./dist/tools/compact/index.d.ts",
187
- import: "./dist/tools/compact/index.js",
188
- require: "./dist/tools/compact/index.cjs"
189
- },
190
- "./tools/reflex": {
191
- types: "./dist/tools/reflex/index.d.ts",
192
- import: "./dist/tools/reflex/index.js",
193
- require: "./dist/tools/reflex/index.cjs"
194
- },
195
- "./tools/traces": {
196
- types: "./dist/tools/traces/index.d.ts",
197
- import: "./dist/tools/traces/index.js",
198
- require: "./dist/tools/traces/index.cjs"
199
- },
200
- "./subagents": {
201
- types: "./dist/subagents/index.d.ts",
202
- import: "./dist/subagents/index.js",
203
- require: "./dist/subagents/index.cjs"
204
- },
205
- "./subagents/vercel": {
206
- types: "./dist/subagents/vercel.d.ts",
207
- import: "./dist/subagents/vercel.js",
208
- require: "./dist/subagents/vercel.cjs"
209
- },
210
- "./subagents/anthropic": {
211
- types: "./dist/subagents/anthropic.d.ts",
212
- import: "./dist/subagents/anthropic.js",
213
- require: "./dist/subagents/anthropic.cjs"
214
- },
215
- "./ai-sdk": {
216
- types: "./dist/ai-sdk/index.d.ts",
217
- import: "./dist/ai-sdk/index.js",
218
- require: "./dist/ai-sdk/index.cjs"
219
- }
220
- },
221
- files: [
222
- "dist/**/*.js",
223
- "dist/**/*.cjs",
224
- "dist/**/*.d.ts",
225
- "dist/**/*.map",
226
- "!dist/**/__tests__/**",
227
- "!dist/**/*.test.*"
228
- ],
229
- scripts: {
230
- build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/traces/index.ts tools/traces/core.ts tools/traces/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve && tsup ai-sdk/index.ts --format esm,cjs --sourcemap --dts --no-clean --out-dir dist/ai-sdk",
231
- prepare: "npm run build",
232
- typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
233
- lint: "eslint .",
234
- test: "vitest run",
235
- "test:watch": "vitest watch",
236
- "test:anthropic": "vitest run anthropic",
237
- "test:openai": "vitest run openai",
238
- "test:vercel": "vitest run vercel",
239
- "test:git": "vitest run git",
240
- "test:browser": "vitest run browser",
241
- "test:agent": "npx tsx tests/fullAgentTest.ts",
242
- "test:integration": "npx tsx tests/fullIntegrationTest.ts",
243
- "test:e2e": "vitest run --config vitest.e2e.config.ts",
244
- "release:patch": "npm version patch && npm publish",
245
- "release:minor": "npm version minor && npm publish",
246
- "release:major": "npm version major && npm publish"
247
- },
248
- keywords: [
249
- "morph",
250
- "fast-apply",
251
- "cli",
252
- "sdk",
253
- "edit-file"
254
- ],
255
- engines: {
256
- node: ">=18"
257
- },
258
- license: "MIT",
259
- dependencies: {
260
- "@opentelemetry/api": "^1.9.0",
261
- "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
262
- "@opentelemetry/sdk-trace-base": "^2.7.1",
263
- "@traceloop/node-server-sdk": "^0.27.0",
264
- "@vscode/ripgrep": "^1.17.0",
265
- ai: ">=5.0.0",
266
- diff: "^7.0.0",
267
- "isomorphic-git": "^1.25.10",
268
- openai: "^4.52.7",
269
- zod: ">=3.23.0"
270
- },
271
- devDependencies: {
272
- "@ai-sdk/anthropic": "^2.0.70",
273
- "@ai-sdk/openai": "^2.0.35",
274
- "@anthropic-ai/sdk": "^0.30.1",
275
- "@google/generative-ai": "^0.24.1",
276
- "@types/diff": "^7.0.2",
277
- "@types/node": "^20.14.10",
278
- "@typescript-eslint/eslint-plugin": "^7.18.0",
279
- "@typescript-eslint/parser": "^7.18.0",
280
- dotenv: "^16.4.5",
281
- eslint: "^8.57.0",
282
- shx: "^0.3.4",
283
- tsup: "^8.5.0",
284
- tsx: "^4.16.2",
285
- typescript: "^5.5.4",
286
- vitest: "^2.1.6"
287
- },
288
- peerDependencies: {
289
- "@ai-sdk/openai-compatible": ">=2.0.74 <4",
290
- "@anthropic-ai/sdk": ">=0.25.0",
291
- "@google/generative-ai": ">=0.21.0",
292
- ai: ">=5.0.0",
293
- zod: ">=3.23.0"
294
- },
295
- peerDependenciesMeta: {
296
- "@anthropic-ai/sdk": {
297
- optional: true
298
- },
299
- "@google/generative-ai": {
300
- optional: true
301
- },
302
- ai: {
303
- optional: true
304
- },
305
- zod: {
306
- optional: true
307
- }
308
- },
309
- publishConfig: {
310
- access: "public"
311
- }
312
- };
313
-
314
- // version.ts
315
- var SDK_VERSION = package_default.version;
316
-
317
- // tools/utils/resilience.ts
318
- var DEFAULT_RETRY_CONFIG = {
319
- maxRetries: 3,
320
- initialDelay: 1e3,
321
- maxDelay: 3e4,
322
- backoffMultiplier: 2,
323
- retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
324
- };
325
- async function fetchWithRetry(url, options, retryConfig = {}) {
326
- const {
327
- maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
328
- initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
329
- maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
330
- backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
331
- retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
332
- onRetry
333
- } = retryConfig;
334
- let lastError = null;
335
- let delay = initialDelay;
336
- options = { ...options, headers: { "X-Morph-SDK-Version": SDK_VERSION, ...options.headers } };
337
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
338
- try {
339
- const response = await fetch(url, options);
340
- if (response.status === 429 || response.status === 503) {
341
- if (attempt < maxRetries) {
342
- const retryAfter = response.headers.get("Retry-After");
343
- const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
344
- const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
345
- if (onRetry) {
346
- onRetry(attempt + 1, error);
347
- }
348
- await sleep(waitTime);
349
- delay *= backoffMultiplier;
350
- continue;
351
- }
352
- }
353
- return response;
354
- } catch (error) {
355
- lastError = error;
356
- const isRetryable = retryableErrors.some(
357
- (errType) => lastError?.message?.includes(errType)
358
- );
359
- if (!isRetryable || attempt === maxRetries) {
360
- throw lastError;
361
- }
362
- const waitTime = Math.min(delay, maxDelay);
363
- if (onRetry) {
364
- onRetry(attempt + 1, lastError);
365
- }
366
- await sleep(waitTime);
367
- delay *= backoffMultiplier;
368
- }
369
- }
370
- throw lastError || new Error("Max retries exceeded");
371
- }
372
- async function withTimeout(promise, timeoutMs, errorMessage) {
373
- let timeoutId;
374
- const timeoutPromise = new Promise((_, reject) => {
375
- timeoutId = setTimeout(() => {
376
- reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
377
- }, timeoutMs);
378
- });
379
- try {
380
- const result = await Promise.race([promise, timeoutPromise]);
381
- clearTimeout(timeoutId);
382
- return result;
383
- } catch (error) {
384
- clearTimeout(timeoutId);
385
- throw error;
386
- }
387
- }
388
- function sleep(ms) {
389
- return new Promise((resolve) => setTimeout(resolve, ms));
390
- }
391
- var MorphError = class extends Error {
392
- constructor(message, code, statusCode, retryable = false) {
393
- super(message);
394
- this.code = code;
395
- this.statusCode = statusCode;
396
- this.retryable = retryable;
397
- this.name = "MorphError";
398
- }
399
- };
400
-
401
- // logger.ts
402
- var MorphLogger = class {
403
- enabled;
404
- fileStream;
405
- /** Resolves once the file stream is initialized (or immediately if no file logging). */
406
- ready;
407
- constructor() {
408
- this.enabled = typeof process !== "undefined" && (process.env.MORPH_DEBUG === "1" || !!process.env.MORPH_LOG_FILE);
409
- this.fileStream = null;
410
- const f = typeof process !== "undefined" ? process.env.MORPH_LOG_FILE : void 0;
411
- if (f) {
412
- this.ready = import("fs").then((fs2) => {
413
- this.fileStream = fs2.createWriteStream(f, { flags: "a" });
414
- }).catch(() => {
415
- });
416
- } else {
417
- this.ready = Promise.resolve();
418
- }
419
- }
420
- debug(component, msg, data) {
421
- this._log("debug", component, msg, data);
422
- }
423
- info(component, msg, data) {
424
- this._log("info", component, msg, data);
425
- }
426
- warn(component, msg, data) {
427
- this._log("warn", component, msg, data);
428
- }
429
- error(component, msg, data) {
430
- this._log("error", component, msg, data);
431
- }
432
- enable() {
433
- this.enabled = true;
434
- }
435
- get isEnabled() {
436
- return this.enabled;
437
- }
438
- _log(level, component, msg, data) {
439
- if (level !== "error" && !this.enabled) return;
440
- const ts = (/* @__PURE__ */ new Date()).toISOString();
441
- const prefix = `[${ts}] [${level.toUpperCase()}] [${component}]`;
442
- console.error(data ? `${prefix} ${msg} ${JSON.stringify(data)}` : `${prefix} ${msg}`);
443
- this.fileStream?.write(JSON.stringify({ ts, level, component, msg, ...data && { data } }) + "\n");
444
- }
445
- };
446
- var logger = new MorphLogger();
447
-
448
- // core/error.ts
449
- async function toMorphError(response) {
450
- let message = `Morph API request failed (${response.status})`;
451
- let code = "api_error";
452
- try {
453
- const body = await response.json();
454
- message = body.error?.message ?? body.message ?? message;
455
- code = body.error?.code ?? body.error?.type ?? code;
456
- } catch {
457
- }
458
- if (response.status === 401) code = "authentication_error";
459
- if (response.status === 429) code = "rate_limit_exceeded";
460
- const retryable = response.status === 429 || response.status === 503;
461
- return new MorphError(message, code, response.status, retryable);
462
- }
463
-
464
- // core/client.ts
465
- var DEFAULT_BASE_URL = "https://api.morphllm.com";
466
- var DEFAULT_REPOS_URL = "https://repos.morphllm.com";
467
- var DEFAULT_BROWSER_URL = "https://browser.morphllm.com";
468
- var DEFAULT_TIMEOUT = 6e4;
469
- var env = (name) => typeof process !== "undefined" ? process.env?.[name] : void 0;
470
- var stripTrailingSlash = (url) => url.replace(/\/+$/, "");
471
- var MorphAPIClient = class {
472
- /** Explicit key as provided; resolved against env at request time. */
473
- apiKey;
474
- baseURL;
475
- reposURL;
476
- browserURL;
477
- /** Explicit default timeout (ms), if set. The request default is applied lazily so
478
- * resources can read an undefined value and supply their own fallback. */
479
- timeout;
480
- retryConfig;
481
- debug;
482
- constructor(options = {}) {
483
- this.apiKey = options.apiKey;
484
- this.baseURL = stripTrailingSlash(options.baseURL ?? DEFAULT_BASE_URL);
485
- this.reposURL = stripTrailingSlash(options.reposURL ?? env("MORPH_SEARCH_URL") ?? DEFAULT_REPOS_URL);
486
- this.browserURL = stripTrailingSlash(
487
- options.browserURL ?? (env("MORPH_ENVIRONMENT") === "DEV" ? "http://localhost:8000" : DEFAULT_BROWSER_URL)
488
- );
489
- this.timeout = options.timeout;
490
- this.retryConfig = options.retryConfig;
491
- this.debug = options.debug ?? false;
492
- if (this.debug) logger.enable();
493
- }
494
- /** The key actually used for requests: explicit, else `MORPH_API_KEY`. */
495
- resolveApiKey() {
496
- return this.apiKey ?? env("MORPH_API_KEY");
497
- }
498
- /** Headers shared with tools that bring their own HTTP client (FastApply/WarpGrep via the `openai` package). */
499
- defaultHeaders() {
500
- return { "X-Morph-SDK-Version": SDK_VERSION };
501
- }
502
- buildURL(path, baseURL) {
503
- if (/^https?:\/\//i.test(path)) return path;
504
- const base = stripTrailingSlash(baseURL ?? this.baseURL);
505
- return `${base}${path.startsWith("/") ? "" : "/"}${path}`;
506
- }
507
- buildHeaders(apiKey, extra) {
508
- return {
509
- "Content-Type": "application/json",
510
- "X-Morph-SDK-Version": SDK_VERSION,
511
- Authorization: `Bearer ${apiKey}`,
512
- ...extra
513
- };
514
- }
515
- applyQuery(url, query) {
516
- if (!query) return url;
517
- const params = new URLSearchParams();
518
- for (const [key, value] of Object.entries(query)) {
519
- if (value !== void 0 && value !== null) params.set(key, String(value));
520
- }
521
- const qs = params.toString();
522
- return qs ? `${url}${url.includes("?") ? "&" : "?"}${qs}` : url;
523
- }
524
- async request(method, path, opts = {}) {
525
- const apiKey = this.resolveApiKey();
526
- if (!apiKey) {
527
- throw new MorphError(
528
- "Morph API key not found. Set the MORPH_API_KEY environment variable or pass apiKey in config.",
529
- "missing_api_key",
530
- 401
531
- );
532
- }
533
- const url = this.applyQuery(this.buildURL(path, opts.baseURL), opts.query);
534
- const timeout = opts.timeout ?? this.timeout ?? DEFAULT_TIMEOUT;
535
- const init = {
536
- method,
537
- headers: this.buildHeaders(apiKey, opts.headers),
538
- ...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {},
539
- ...opts.signal ? { signal: opts.signal } : {}
540
- };
541
- logger.debug("MorphAPIClient", "request", { method, url });
542
- const response = await withTimeout(
543
- fetchWithRetry(url, init, this.retryConfig ?? {}),
544
- timeout,
545
- `Morph request to ${url} timed out after ${timeout}ms`
546
- );
547
- if (opts.raw) return response;
548
- if (!response.ok) throw await toMorphError(response);
549
- if (opts.stream) return response;
550
- if (response.status === 204) return void 0;
551
- const text = await response.text();
552
- return text ? JSON.parse(text) : void 0;
553
- }
554
- get(path, opts) {
555
- return this.request("GET", path, opts);
556
- }
557
- post(path, opts) {
558
- return this.request("POST", path, opts);
559
- }
560
- delete(path, opts) {
561
- return this.request("DELETE", path, opts);
562
- }
563
- };
564
-
565
- // core/resource.ts
566
- var APIResource = class {
567
- _client;
568
- constructor(client) {
569
- this._client = client;
570
- }
571
- };
572
-
573
- // git/client.ts
574
- var DEFAULT_PROXY_URL = "https://repos.morphllm.com";
575
- var MorphGit = class extends APIResource {
576
- apiKey;
577
- proxyUrl;
578
- constructor(clientOrConfig) {
579
- const isClient = clientOrConfig instanceof MorphAPIClient;
580
- if (!isClient) {
581
- if (!clientOrConfig.apiKey) {
582
- throw new Error("API key is required. Get one at https://morphllm.com/dashboard");
583
- }
584
- if (!clientOrConfig.apiKey.startsWith("sk-") && !clientOrConfig.apiKey.startsWith("morph-")) {
585
- throw new Error("Invalid API key format. Expected: sk-... or morph-...");
586
- }
587
- }
588
- super(
589
- isClient ? clientOrConfig : new MorphAPIClient({
590
- apiKey: clientOrConfig.apiKey,
591
- reposURL: clientOrConfig.proxyUrl,
592
- retryConfig: clientOrConfig.retryConfig
593
- })
594
- );
595
- this.apiKey = this._client.resolveApiKey() ?? "";
596
- this.proxyUrl = isClient ? this._client.reposURL : clientOrConfig.proxyUrl || DEFAULT_PROXY_URL;
597
- }
598
- /**
599
- * Get auth callback for isomorphic-git operations
600
- * @private
601
- */
602
- getAuthCallback() {
603
- return () => ({
604
- username: "morph",
605
- password: this.apiKey
606
- });
607
- }
608
- /**
609
- * Initialize a new repository
610
- * Creates the repo in the database and in the git provider
611
- *
612
- * @example
613
- * ```ts
614
- * await morphGit.init({
615
- * repoId: 'my-project',
616
- * dir: './my-project',
617
- * defaultBranch: 'main'
618
- * });
619
- * ```
620
- */
621
- async init(options) {
622
- const { repoId, dir, defaultBranch = "main" } = options;
623
- const response = await fetch(`${this.proxyUrl}/v1/repos`, {
624
- method: "POST",
625
- headers: {
626
- "Authorization": `Bearer ${this.apiKey}`,
627
- "Content-Type": "application/json"
628
- },
629
- body: JSON.stringify({
630
- repoId,
631
- name: repoId,
632
- defaultBranch
633
- })
634
- });
635
- if (!response.ok) {
636
- const error = await response.text();
637
- throw new Error(`Failed to create repository: ${error}`);
638
- }
639
- await import_isomorphic_git.default.init({
640
- fs: import_fs.default,
641
- dir,
642
- defaultBranch
643
- });
644
- await import_isomorphic_git.default.addRemote({
645
- fs: import_fs.default,
646
- dir,
647
- remote: "origin",
648
- url: `${this.proxyUrl}/v1/repos/${repoId}`
649
- });
650
- console.log(`\u2713 Repository '${repoId}' initialized`);
651
- }
652
- /**
653
- * Clone a repository from Morph repos
654
- *
655
- * @example
656
- * ```ts
657
- * await morphGit.clone({
658
- * repoId: 'my-project',
659
- * dir: './my-project'
660
- * });
661
- * ```
662
- */
663
- async clone(options) {
664
- const { repoId, dir, branch = "main", depth, singleBranch = true } = options;
665
- await import_isomorphic_git.default.clone({
666
- fs: import_fs.default,
667
- http: import_node.default,
668
- dir,
669
- url: `${this.proxyUrl}/v1/repos/${repoId}`,
670
- ref: branch,
671
- singleBranch,
672
- depth,
673
- onAuth: this.getAuthCallback()
674
- });
675
- }
676
- /**
677
- * Push changes to remote repository
678
- *
679
- * @example
680
- * ```ts
681
- * await morphGit.push({
682
- * dir: './my-project',
683
- * branch: 'main', // Required: explicit branch name
684
- * index: true // Optional: generate embeddings for semantic search
685
- * });
686
- * ```
687
- */
688
- async push(options) {
689
- const { dir, remote = "origin", branch, waitForEmbeddings, index = false } = options;
690
- if (!branch) {
691
- throw new Error(
692
- 'branch is required for push operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
693
- );
694
- }
695
- const commitHash = await import_isomorphic_git.default.resolveRef({ fs: import_fs.default, dir, ref: "HEAD" });
696
- let repoId;
697
- const remotes = await import_isomorphic_git.default.listRemotes({ fs: import_fs.default, dir });
698
- const originRemote = remotes.find((r) => r.remote === remote);
699
- if (originRemote) {
700
- const match = originRemote.url.match(/\/repos\/([^\/]+)$/);
701
- if (match) {
702
- repoId = match[1];
703
- }
704
- }
705
- await import_isomorphic_git.default.push({
706
- fs: import_fs.default,
707
- http: import_node.default,
708
- dir,
709
- remote,
710
- ref: branch,
711
- onAuth: this.getAuthCallback()
712
- });
713
- if (repoId && commitHash) {
714
- await this.configureCommit({ repoId, commitHash, branch, index });
715
- }
716
- if (waitForEmbeddings && repoId && commitHash && index) {
717
- await this.waitForEmbeddings({ repoId, commitHash });
718
- }
719
- }
720
- /**
721
- * Configure commit settings on the backend after push.
722
- * Sets the index flag to control embedding generation.
723
- * @private
724
- */
725
- async configureCommit(options) {
726
- const { repoId, commitHash, branch, index } = options;
727
- const response = await fetch(
728
- `${this.proxyUrl}/v1/repos/${repoId}/commits/${commitHash}/config`,
729
- {
730
- method: "POST",
731
- headers: {
732
- "Authorization": `Bearer ${this.apiKey}`,
733
- "Content-Type": "application/json"
734
- },
735
- body: JSON.stringify({ index, branch })
736
- }
737
- );
738
- if (!response.ok) {
739
- console.warn(`Failed to configure commit: ${response.status}`);
740
- }
741
- }
742
- /**
743
- * Pull changes from remote repository
744
- *
745
- * @example
746
- * ```ts
747
- * await morphGit.pull({
748
- * dir: './my-project',
749
- * branch: 'main' // Required: explicit branch name
750
- * });
751
- * ```
752
- */
753
- async pull(options) {
754
- const { dir, remote = "origin", branch } = options;
755
- if (!branch) {
756
- throw new Error(
757
- 'branch is required for pull operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
758
- );
759
- }
760
- await import_isomorphic_git.default.pull({
761
- fs: import_fs.default,
762
- http: import_node.default,
763
- dir,
764
- remote,
765
- ref: branch,
766
- onAuth: this.getAuthCallback(),
767
- author: {
768
- name: "Morph Agent",
769
- email: "agent@morph.com"
770
- }
771
- });
772
- }
773
- /**
774
- * Wait for embeddings to complete after push.
775
- * Polls status endpoint until embeddings are done.
776
- *
777
- * @example
778
- * ```ts
779
- * await morphGit.push({ dir: './my-project', branch: 'main' });
780
- * await morphGit.waitForEmbeddings({
781
- * repoId: 'my-project',
782
- * onProgress: (p) => console.log(`${p.filesProcessed}/${p.totalFiles}`)
783
- * });
784
- * ```
785
- */
786
- async waitForEmbeddings(options) {
787
- const { repoId, commitHash, timeout = 12e4, onProgress } = options;
788
- const startTime = Date.now();
789
- const pollInterval = 1e3;
790
- while (Date.now() - startTime < timeout) {
791
- const statusUrl = `${this.proxyUrl}/v1/repos/${repoId}/embedding-status` + (commitHash ? `?commit_hash=${commitHash}` : "");
792
- const response = await fetch(statusUrl, {
793
- headers: { "Authorization": `Bearer ${this.apiKey}` }
794
- });
795
- if (response.status === 404) {
796
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
797
- continue;
798
- }
799
- if (!response.ok) {
800
- throw new Error(`Failed to get embedding status: ${response.status}`);
801
- }
802
- const status = await response.json();
803
- if (onProgress && status.progress) {
804
- onProgress(status.progress);
805
- }
806
- if (status.status === "completed") {
807
- return;
808
- }
809
- if (status.status === "failed") {
810
- throw new Error(`Embeddings failed: ${status.error || "Unknown error"}`);
811
- }
812
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
813
- }
814
- throw new Error(`Embeddings timed out after ${timeout}ms`);
815
- }
816
- /**
817
- * Stage a file for commit
818
- *
819
- * @example
820
- * ```ts
821
- * await morphGit.add({
822
- * dir: './my-project',
823
- * filepath: 'src/app.ts'
824
- * });
825
- * ```
826
- */
827
- async add(options) {
828
- const { dir, filepath } = options;
829
- await import_isomorphic_git.default.add({
830
- fs: import_fs.default,
831
- dir,
832
- filepath
833
- });
834
- }
835
- /**
836
- * Remove a file from staging
837
- *
838
- * @example
839
- * ```ts
840
- * await morphGit.remove({
841
- * dir: './my-project',
842
- * filepath: 'src/old-file.ts'
843
- * });
844
- * ```
845
- */
846
- async remove(options) {
847
- const { dir, filepath } = options;
848
- await import_isomorphic_git.default.remove({
849
- fs: import_fs.default,
850
- dir,
851
- filepath
852
- });
853
- }
854
- /**
855
- * Commit staged changes
856
- *
857
- * @example
858
- * ```ts
859
- * await morphGit.commit({
860
- * dir: './my-project',
861
- * message: 'Add new feature',
862
- * author: {
863
- * name: 'AI Agent',
864
- * email: 'ai@example.com'
865
- * },
866
- * metadata: { issueId: 'PROJ-123', source: 'agent' },
867
- * chatHistory: [
868
- * { role: 'user', content: 'Please add a new feature' },
869
- * { role: 'assistant', content: 'I will add that feature' }
870
- * ],
871
- * recordingId: 'rec_123'
872
- * });
873
- * ```
874
- */
875
- async commit(options) {
876
- const { dir, message, author, metadata, chatHistory, recordingId } = options;
877
- const commitAuthor = author || {
878
- name: "Morph SDK",
879
- email: "sdk@morphllm.com"
880
- };
881
- const sha = await import_isomorphic_git.default.commit({
882
- fs: import_fs.default,
883
- dir,
884
- message,
885
- author: commitAuthor
886
- });
887
- if (metadata || chatHistory || recordingId) {
888
- const notes = {
889
- metadata,
890
- chatHistory,
891
- recordingId,
892
- _version: 1
893
- };
894
- await import_isomorphic_git.default.addNote({
895
- fs: import_fs.default,
896
- dir,
897
- ref: "refs/notes/morph-metadata",
898
- oid: sha,
899
- note: JSON.stringify(notes, null, 2),
900
- author: commitAuthor
901
- });
902
- }
903
- return sha;
904
- }
905
- /**
906
- * Get status of a file
907
- *
908
- * @example
909
- * ```ts
910
- * const status = await morphGit.status({
911
- * dir: './my-project',
912
- * filepath: 'src/app.ts'
913
- * });
914
- * console.log(status); // 'modified', '*added', etc.
915
- * ```
916
- */
917
- async status(options) {
918
- const { dir, filepath } = options;
919
- if (!filepath) {
920
- throw new Error("filepath is required for status check");
921
- }
922
- const status = await import_isomorphic_git.default.status({
923
- fs: import_fs.default,
924
- dir,
925
- filepath
926
- });
927
- return status;
928
- }
929
- /**
930
- * Get commit history
931
- *
932
- * @example
933
- * ```ts
934
- * const commits = await morphGit.log({
935
- * dir: './my-project',
936
- * depth: 10
937
- * });
938
- * ```
939
- */
940
- async log(options) {
941
- const { dir, depth, ref } = options;
942
- const commits = await import_isomorphic_git.default.log({
943
- fs: import_fs.default,
944
- dir,
945
- depth,
946
- ref
947
- });
948
- return commits;
949
- }
950
- /**
951
- * Checkout a branch or commit
952
- *
953
- * @example
954
- * ```ts
955
- * await morphGit.checkout({
956
- * dir: './my-project',
957
- * ref: 'feature-branch'
958
- * });
959
- * ```
960
- */
961
- async checkout(options) {
962
- const { dir, ref } = options;
963
- await import_isomorphic_git.default.checkout({
964
- fs: import_fs.default,
965
- dir,
966
- ref
967
- });
968
- }
969
- /**
970
- * Create a new branch
971
- *
972
- * @example
973
- * ```ts
974
- * await morphGit.branch({
975
- * dir: './my-project',
976
- * name: 'feature-branch',
977
- * checkout: true
978
- * });
979
- * ```
980
- */
981
- async branch(options) {
982
- const { dir, name, checkout = false } = options;
983
- await import_isomorphic_git.default.branch({
984
- fs: import_fs.default,
985
- dir,
986
- ref: name,
987
- checkout
988
- });
989
- }
990
- /**
991
- * List all branches
992
- *
993
- * @example
994
- * ```ts
995
- * const branches = await morphGit.listBranches({
996
- * dir: './my-project'
997
- * });
998
- * ```
999
- */
1000
- async listBranches(options) {
1001
- const { dir } = options;
1002
- const branches = await import_isomorphic_git.default.listBranches({
1003
- fs: import_fs.default,
1004
- dir
1005
- });
1006
- return branches;
1007
- }
1008
- /**
1009
- * Get the current branch name
1010
- *
1011
- * @example
1012
- * ```ts
1013
- * const branch = await morphGit.currentBranch({
1014
- * dir: './my-project'
1015
- * });
1016
- * ```
1017
- */
1018
- async currentBranch(options) {
1019
- const { dir } = options;
1020
- const branch = await import_isomorphic_git.default.currentBranch({
1021
- fs: import_fs.default,
1022
- dir
1023
- });
1024
- return branch || void 0;
1025
- }
1026
- /**
1027
- * Get list of changed files (similar to git diff --name-only)
1028
- *
1029
- * @example
1030
- * ```ts
1031
- * const changes = await morphGit.statusMatrix({
1032
- * dir: './my-project'
1033
- * });
1034
- * ```
1035
- */
1036
- async statusMatrix(options) {
1037
- const { dir } = options;
1038
- const matrix = await import_isomorphic_git.default.statusMatrix({
1039
- fs: import_fs.default,
1040
- dir
1041
- });
1042
- return matrix.map(([filepath, HEADStatus, workdirStatus, stageStatus]) => {
1043
- let status = "unmodified";
1044
- if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 2) {
1045
- status = "modified";
1046
- } else if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 1) {
1047
- status = "*modified";
1048
- } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 2) {
1049
- status = "added";
1050
- } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 0) {
1051
- status = "*added";
1052
- } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 0) {
1053
- status = "deleted";
1054
- } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 1) {
1055
- status = "*deleted";
1056
- } else if (HEADStatus === 1 && workdirStatus === 1 && stageStatus === 1) {
1057
- status = "unmodified";
1058
- } else if (HEADStatus === 0 && workdirStatus === 0 && stageStatus === 0) {
1059
- status = "absent";
1060
- }
1061
- return {
1062
- filepath,
1063
- status
1064
- };
1065
- });
1066
- }
1067
- /**
1068
- * Get the current commit hash
1069
- *
1070
- * @example
1071
- * ```ts
1072
- * const hash = await morphGit.resolveRef({
1073
- * dir: './my-project',
1074
- * ref: 'HEAD'
1075
- * });
1076
- * ```
1077
- */
1078
- async resolveRef(options) {
1079
- const { dir, ref } = options;
1080
- const oid = await import_isomorphic_git.default.resolveRef({
1081
- fs: import_fs.default,
1082
- dir,
1083
- ref
1084
- });
1085
- return oid;
1086
- }
1087
- /**
1088
- * Get notes (metadata, chat history, recording ID) attached to a commit
1089
- *
1090
- * @example
1091
- * ```ts
1092
- * const notes = await morphGit.getCommitMetadata({
1093
- * dir: './my-project',
1094
- * commitSha: 'abc123...'
1095
- * });
1096
- *
1097
- * if (notes) {
1098
- * console.log('Metadata:', notes.metadata);
1099
- * console.log('Chat history:', notes.chatHistory);
1100
- * console.log('Recording ID:', notes.recordingId);
1101
- * }
1102
- * ```
1103
- */
1104
- async getCommitMetadata(options) {
1105
- try {
1106
- const note = await import_isomorphic_git.default.readNote({
1107
- fs: import_fs.default,
1108
- dir: options.dir,
1109
- ref: "refs/notes/morph-metadata",
1110
- oid: options.commitSha
1111
- });
1112
- const notes = JSON.parse(new TextDecoder().decode(note));
1113
- return notes;
1114
- } catch (err) {
1115
- return null;
1116
- }
1117
- }
1118
- };
1119
- // Annotate the CommonJS export names for ESM import in node:
1120
- 0 && (module.exports = {
1121
- MorphGit
1122
- });
1123
- //# sourceMappingURL=client.cjs.map