@morphllm/morphsdk 0.2.198 → 0.2.199

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 (243) hide show
  1. package/README.md +1 -147
  2. package/dist/{chunk-CAFREMIT.js → chunk-5KQ2WRBU.js} +2 -2
  3. package/dist/{chunk-FUYX2MNM.js → chunk-7UU4NF4G.js} +4 -10
  4. package/dist/chunk-7UU4NF4G.js.map +1 -0
  5. package/dist/{chunk-XTFRHVCW.js → chunk-BLCCGRKT.js} +2 -2
  6. package/dist/{chunk-6XFL2NER.js → chunk-BTMMUG3E.js} +2 -2
  7. package/dist/{chunk-4JUIEYAH.js → chunk-CEXBKXWU.js} +3 -3
  8. package/dist/{chunk-FESO6TDQ.js → chunk-DP2PT36G.js} +2 -2
  9. package/dist/chunk-GKRPR5PZ.js +322 -0
  10. package/dist/chunk-GKRPR5PZ.js.map +1 -0
  11. package/dist/{chunk-ZQNTXHBQ.js → chunk-GTV27THY.js} +2 -2
  12. package/dist/{chunk-ZU5YYGBJ.js → chunk-JOC3ZI56.js} +3 -29
  13. package/dist/chunk-JOC3ZI56.js.map +1 -0
  14. package/dist/{chunk-WLMPQFER.js → chunk-K2JR2NFQ.js} +4 -4
  15. package/dist/{chunk-YQ2G5YLI.js → chunk-KXEPBLVD.js} +10 -10
  16. package/dist/{chunk-T6TXYTKH.js → chunk-MEZTHMB2.js} +4 -4
  17. package/dist/{chunk-ZGERT23F.js → chunk-O7LJEVZO.js} +2 -2
  18. package/dist/{chunk-LN7GNFET.js → chunk-OPNTDMHH.js} +4 -4
  19. package/dist/{chunk-QKNGVBE2.js → chunk-PKJ7ODTG.js} +3 -3
  20. package/dist/{chunk-4DNEBVGV.js → chunk-PW6K6OJL.js} +2 -2
  21. package/dist/{chunk-PV6EF6NG.js → chunk-Q3NH3NPD.js} +2 -2
  22. package/dist/{chunk-O5264GI4.js → chunk-RL3ZTXT3.js} +4 -4
  23. package/dist/{chunk-D2RFP6R2.js → chunk-ULHHMZRL.js} +3 -3
  24. package/dist/{chunk-PEFXG5M6.js → chunk-UT3NQLCF.js} +2 -2
  25. package/dist/{chunk-VBZ7BG47.js → chunk-VS5F2ORN.js} +3 -3
  26. package/dist/{chunk-YUH3MTP3.js → chunk-W37OFBSG.js} +2 -2
  27. package/dist/{chunk-SKN2L5CE.js → chunk-WDBYAXZ5.js} +2 -2
  28. package/dist/{chunk-XK3PQZW6.js → chunk-YSFEKIYQ.js} +2 -2
  29. package/dist/{chunk-3XS5P5XH.js → chunk-ZHB57ORD.js} +6 -6
  30. package/dist/client-CGW0Cevz.d.ts +402 -0
  31. package/dist/client.cjs +12 -1644
  32. package/dist/client.cjs.map +1 -1
  33. package/dist/client.d.ts +3 -7
  34. package/dist/client.js +27 -32
  35. package/dist/core/client.cjs +2 -34
  36. package/dist/core/client.cjs.map +1 -1
  37. package/dist/core/client.d.ts +0 -8
  38. package/dist/core/client.js +4 -4
  39. package/dist/core/error.cjs +2 -28
  40. package/dist/core/error.cjs.map +1 -1
  41. package/dist/core/error.js +3 -3
  42. package/dist/core/index.cjs +2 -34
  43. package/dist/core/index.cjs.map +1 -1
  44. package/dist/core/index.js +4 -4
  45. package/dist/edge.cjs +2 -34
  46. package/dist/edge.cjs.map +1 -1
  47. package/dist/edge.js +7 -7
  48. package/dist/index.cjs +12 -1656
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.ts +1 -5
  51. package/dist/index.js +31 -49
  52. package/dist/modelrouter/core.cjs +2 -34
  53. package/dist/modelrouter/core.cjs.map +1 -1
  54. package/dist/modelrouter/core.js +5 -5
  55. package/dist/modelrouter/index.cjs +2 -34
  56. package/dist/modelrouter/index.cjs.map +1 -1
  57. package/dist/modelrouter/index.js +5 -5
  58. package/dist/subagents/anthropic.cjs +2 -34
  59. package/dist/subagents/anthropic.cjs.map +1 -1
  60. package/dist/subagents/anthropic.js +11 -11
  61. package/dist/subagents/vercel.cjs +2 -34
  62. package/dist/subagents/vercel.cjs.map +1 -1
  63. package/dist/subagents/vercel.js +11 -11
  64. package/dist/tools/codebase_search/anthropic.cjs +2 -34
  65. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  66. package/dist/tools/codebase_search/anthropic.js +6 -6
  67. package/dist/tools/codebase_search/core.cjs +2 -34
  68. package/dist/tools/codebase_search/core.cjs.map +1 -1
  69. package/dist/tools/codebase_search/core.js +5 -5
  70. package/dist/tools/codebase_search/index.cjs +2 -34
  71. package/dist/tools/codebase_search/index.cjs.map +1 -1
  72. package/dist/tools/codebase_search/index.js +10 -10
  73. package/dist/tools/codebase_search/openai.cjs +2 -34
  74. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  75. package/dist/tools/codebase_search/openai.js +6 -6
  76. package/dist/tools/codebase_search/vercel.cjs +2 -34
  77. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  78. package/dist/tools/codebase_search/vercel.js +6 -6
  79. package/dist/tools/compact/core.cjs +2 -34
  80. package/dist/tools/compact/core.cjs.map +1 -1
  81. package/dist/tools/compact/core.js +5 -5
  82. package/dist/tools/compact/index.cjs +2 -34
  83. package/dist/tools/compact/index.cjs.map +1 -1
  84. package/dist/tools/compact/index.js +6 -6
  85. package/dist/tools/fastapply/anthropic.cjs +2 -28
  86. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  87. package/dist/tools/fastapply/anthropic.js +7 -7
  88. package/dist/tools/fastapply/apply.cjs +2 -28
  89. package/dist/tools/fastapply/apply.cjs.map +1 -1
  90. package/dist/tools/fastapply/apply.js +2 -2
  91. package/dist/tools/fastapply/core.cjs +2 -34
  92. package/dist/tools/fastapply/core.cjs.map +1 -1
  93. package/dist/tools/fastapply/core.js +6 -6
  94. package/dist/tools/fastapply/index.cjs +2 -28
  95. package/dist/tools/fastapply/index.cjs.map +1 -1
  96. package/dist/tools/fastapply/index.js +11 -11
  97. package/dist/tools/fastapply/openai.cjs +2 -28
  98. package/dist/tools/fastapply/openai.cjs.map +1 -1
  99. package/dist/tools/fastapply/openai.js +7 -7
  100. package/dist/tools/fastapply/vercel.cjs +2 -28
  101. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  102. package/dist/tools/fastapply/vercel.js +7 -7
  103. package/dist/tools/index.cjs +2 -28
  104. package/dist/tools/index.cjs.map +1 -1
  105. package/dist/tools/index.js +11 -11
  106. package/dist/tools/utils/resilience.cjs +2 -28
  107. package/dist/tools/utils/resilience.cjs.map +1 -1
  108. package/dist/tools/utils/resilience.js +2 -2
  109. package/dist/tools/warp_grep/agent/runner.cjs +2 -28
  110. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  111. package/dist/tools/warp_grep/agent/runner.js +3 -3
  112. package/dist/tools/warp_grep/anthropic.cjs +2 -34
  113. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  114. package/dist/tools/warp_grep/anthropic.js +11 -11
  115. package/dist/tools/warp_grep/client.cjs +2 -34
  116. package/dist/tools/warp_grep/client.cjs.map +1 -1
  117. package/dist/tools/warp_grep/client.js +10 -10
  118. package/dist/tools/warp_grep/gemini.cjs +2 -34
  119. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  120. package/dist/tools/warp_grep/gemini.js +10 -10
  121. package/dist/tools/warp_grep/harness.js +9 -9
  122. package/dist/tools/warp_grep/index.cjs +2 -34
  123. package/dist/tools/warp_grep/index.cjs.map +1 -1
  124. package/dist/tools/warp_grep/index.js +16 -16
  125. package/dist/tools/warp_grep/openai.cjs +2 -34
  126. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  127. package/dist/tools/warp_grep/openai.js +11 -11
  128. package/dist/tools/warp_grep/providers/local.js +2 -2
  129. package/dist/tools/warp_grep/vercel.cjs +2 -34
  130. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  131. package/dist/tools/warp_grep/vercel.js +11 -11
  132. package/dist/version.cjs +2 -28
  133. package/dist/version.cjs.map +1 -1
  134. package/dist/version.js +1 -1
  135. package/package.json +2 -28
  136. package/dist/anthropic-B6my2oBx.d.ts +0 -56
  137. package/dist/chunk-2AMEQAO2.js +0 -46
  138. package/dist/chunk-2AMEQAO2.js.map +0 -1
  139. package/dist/chunk-2HMEZZKK.js +0 -44
  140. package/dist/chunk-2HMEZZKK.js.map +0 -1
  141. package/dist/chunk-2VERUKO2.js +0 -177
  142. package/dist/chunk-2VERUKO2.js.map +0 -1
  143. package/dist/chunk-FUYX2MNM.js.map +0 -1
  144. package/dist/chunk-GJ42MYUU.js +0 -57
  145. package/dist/chunk-GJ42MYUU.js.map +0 -1
  146. package/dist/chunk-KQKLQHJF.js +0 -96
  147. package/dist/chunk-KQKLQHJF.js.map +0 -1
  148. package/dist/chunk-PIIXU2H3.js +0 -389
  149. package/dist/chunk-PIIXU2H3.js.map +0 -1
  150. package/dist/chunk-XH6KJJDI.js +0 -80
  151. package/dist/chunk-XH6KJJDI.js.map +0 -1
  152. package/dist/chunk-YD6TNDR4.js +0 -622
  153. package/dist/chunk-YD6TNDR4.js.map +0 -1
  154. package/dist/chunk-YHZJYCOU.js +0 -680
  155. package/dist/chunk-YHZJYCOU.js.map +0 -1
  156. package/dist/chunk-YTYCHRQ2.js +0 -106
  157. package/dist/chunk-YTYCHRQ2.js.map +0 -1
  158. package/dist/chunk-ZU5YYGBJ.js.map +0 -1
  159. package/dist/client-DCeydotn.d.ts +0 -1015
  160. package/dist/openai-BQMeDFef.d.ts +0 -81
  161. package/dist/tools/browser/anthropic.cjs +0 -645
  162. package/dist/tools/browser/anthropic.cjs.map +0 -1
  163. package/dist/tools/browser/anthropic.d.ts +0 -4
  164. package/dist/tools/browser/anthropic.js +0 -22
  165. package/dist/tools/browser/anthropic.js.map +0 -1
  166. package/dist/tools/browser/core.cjs +0 -1821
  167. package/dist/tools/browser/core.cjs.map +0 -1
  168. package/dist/tools/browser/core.d.ts +0 -245
  169. package/dist/tools/browser/core.js +0 -32
  170. package/dist/tools/browser/core.js.map +0 -1
  171. package/dist/tools/browser/errors.cjs +0 -208
  172. package/dist/tools/browser/errors.cjs.map +0 -1
  173. package/dist/tools/browser/errors.d.ts +0 -158
  174. package/dist/tools/browser/errors.js +0 -22
  175. package/dist/tools/browser/errors.js.map +0 -1
  176. package/dist/tools/browser/index.cjs +0 -2159
  177. package/dist/tools/browser/index.cjs.map +0 -1
  178. package/dist/tools/browser/index.d.ts +0 -134
  179. package/dist/tools/browser/index.js +0 -163
  180. package/dist/tools/browser/index.js.map +0 -1
  181. package/dist/tools/browser/live.cjs +0 -134
  182. package/dist/tools/browser/live.cjs.map +0 -1
  183. package/dist/tools/browser/live.d.ts +0 -75
  184. package/dist/tools/browser/live.js +0 -16
  185. package/dist/tools/browser/live.js.map +0 -1
  186. package/dist/tools/browser/openai.cjs +0 -661
  187. package/dist/tools/browser/openai.cjs.map +0 -1
  188. package/dist/tools/browser/openai.d.ts +0 -4
  189. package/dist/tools/browser/openai.js +0 -28
  190. package/dist/tools/browser/openai.js.map +0 -1
  191. package/dist/tools/browser/profiles/core.cjs +0 -932
  192. package/dist/tools/browser/profiles/core.cjs.map +0 -1
  193. package/dist/tools/browser/profiles/core.d.ts +0 -187
  194. package/dist/tools/browser/profiles/core.js +0 -30
  195. package/dist/tools/browser/profiles/core.js.map +0 -1
  196. package/dist/tools/browser/profiles/index.cjs +0 -932
  197. package/dist/tools/browser/profiles/index.cjs.map +0 -1
  198. package/dist/tools/browser/profiles/index.d.ts +0 -4
  199. package/dist/tools/browser/profiles/index.js +0 -30
  200. package/dist/tools/browser/profiles/index.js.map +0 -1
  201. package/dist/tools/browser/profiles/types.cjs +0 -74
  202. package/dist/tools/browser/profiles/types.cjs.map +0 -1
  203. package/dist/tools/browser/profiles/types.d.ts +0 -195
  204. package/dist/tools/browser/profiles/types.js +0 -16
  205. package/dist/tools/browser/profiles/types.js.map +0 -1
  206. package/dist/tools/browser/prompts.cjs +0 -69
  207. package/dist/tools/browser/prompts.cjs.map +0 -1
  208. package/dist/tools/browser/prompts.d.ts +0 -7
  209. package/dist/tools/browser/prompts.js +0 -10
  210. package/dist/tools/browser/prompts.js.map +0 -1
  211. package/dist/tools/browser/types.cjs +0 -19
  212. package/dist/tools/browser/types.cjs.map +0 -1
  213. package/dist/tools/browser/types.d.ts +0 -338
  214. package/dist/tools/browser/types.js +0 -1
  215. package/dist/tools/browser/types.js.map +0 -1
  216. package/dist/tools/browser/vercel.cjs +0 -622
  217. package/dist/tools/browser/vercel.cjs.map +0 -1
  218. package/dist/tools/browser/vercel.d.ts +0 -4
  219. package/dist/tools/browser/vercel.js +0 -22
  220. package/dist/tools/browser/vercel.js.map +0 -1
  221. package/dist/vercel-CVF27qFK.d.ts +0 -74
  222. /package/dist/{chunk-CAFREMIT.js.map → chunk-5KQ2WRBU.js.map} +0 -0
  223. /package/dist/{chunk-XTFRHVCW.js.map → chunk-BLCCGRKT.js.map} +0 -0
  224. /package/dist/{chunk-6XFL2NER.js.map → chunk-BTMMUG3E.js.map} +0 -0
  225. /package/dist/{chunk-4JUIEYAH.js.map → chunk-CEXBKXWU.js.map} +0 -0
  226. /package/dist/{chunk-FESO6TDQ.js.map → chunk-DP2PT36G.js.map} +0 -0
  227. /package/dist/{chunk-ZQNTXHBQ.js.map → chunk-GTV27THY.js.map} +0 -0
  228. /package/dist/{chunk-WLMPQFER.js.map → chunk-K2JR2NFQ.js.map} +0 -0
  229. /package/dist/{chunk-YQ2G5YLI.js.map → chunk-KXEPBLVD.js.map} +0 -0
  230. /package/dist/{chunk-T6TXYTKH.js.map → chunk-MEZTHMB2.js.map} +0 -0
  231. /package/dist/{chunk-ZGERT23F.js.map → chunk-O7LJEVZO.js.map} +0 -0
  232. /package/dist/{chunk-LN7GNFET.js.map → chunk-OPNTDMHH.js.map} +0 -0
  233. /package/dist/{chunk-QKNGVBE2.js.map → chunk-PKJ7ODTG.js.map} +0 -0
  234. /package/dist/{chunk-4DNEBVGV.js.map → chunk-PW6K6OJL.js.map} +0 -0
  235. /package/dist/{chunk-PV6EF6NG.js.map → chunk-Q3NH3NPD.js.map} +0 -0
  236. /package/dist/{chunk-O5264GI4.js.map → chunk-RL3ZTXT3.js.map} +0 -0
  237. /package/dist/{chunk-D2RFP6R2.js.map → chunk-ULHHMZRL.js.map} +0 -0
  238. /package/dist/{chunk-PEFXG5M6.js.map → chunk-UT3NQLCF.js.map} +0 -0
  239. /package/dist/{chunk-VBZ7BG47.js.map → chunk-VS5F2ORN.js.map} +0 -0
  240. /package/dist/{chunk-YUH3MTP3.js.map → chunk-W37OFBSG.js.map} +0 -0
  241. /package/dist/{chunk-SKN2L5CE.js.map → chunk-WDBYAXZ5.js.map} +0 -0
  242. /package/dist/{chunk-XK3PQZW6.js.map → chunk-YSFEKIYQ.js.map} +0 -0
  243. /package/dist/{chunk-3XS5P5XH.js.map → chunk-ZHB57ORD.js.map} +0 -0
@@ -1,1015 +0,0 @@
1
- import { RetryConfig } from './tools/utils/resilience.js';
2
- import { MorphAPIClient } from './core/client.js';
3
- import { FastApplyClient } from './tools/fastapply/core.js';
4
- import { CodebaseSearchClient } from './tools/codebase_search/core.js';
5
- import { BrowserClient } from './tools/browser/core.js';
6
- import { WarpGrepClient } from './tools/warp_grep/client.js';
7
- import { APIResource } from './core/resource.js';
8
- import { CompactClient } from './tools/compact/core.js';
9
- import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter, RouterClassifier } from './modelrouter/core.js';
10
- import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
11
- import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
12
- import { d as WarpGrepToolConfig, b as WarpGrepResult, g as GitHubSearchToolConfig, c as WarpGrepContext } from './types-qwD753FR.js';
13
- import * as openai_resources_index_mjs from 'openai/resources/index.mjs';
14
- import { ExploreSubagentConfig, ExploreResult, ExploreSession, ExploreEvent } from './subagents/types.js';
15
- import * as _anthropic_ai_sdk_resources_messages_mjs from '@anthropic-ai/sdk/resources/messages.mjs';
16
- import * as ai from 'ai';
17
- import { LanguageModel } from 'ai';
18
- import { WarpGrepToolInput } from './tools/warp_grep/vercel.js';
19
-
20
- /**
21
- * GitHub SDK Types
22
- *
23
- * Type definitions for the Morph GitHub integration.
24
- * Users connect GitHub in the Morph dashboard, then use these
25
- * types to interact with their GitHub repos through the SDK.
26
- */
27
- /**
28
- * Configuration for the GitHub client
29
- */
30
- interface GitHubClientConfig {
31
- /** Morph API key (defaults to MORPH_API_KEY env var) */
32
- apiKey?: string;
33
- /** Default installation ID to use (optional, can be specified per-request) */
34
- installationId?: string;
35
- /** Base URL for the Morph API (defaults to https://api.morphllm.com) */
36
- baseUrl?: string;
37
- /** Request timeout in milliseconds */
38
- timeout?: number;
39
- /** Enable debug logging */
40
- debug?: boolean;
41
- }
42
- /**
43
- * A GitHub App installation (connected GitHub account)
44
- */
45
- interface Installation {
46
- /** Installation ID (use this for subsequent requests) */
47
- id: string;
48
- /** GitHub account login (username or org name) */
49
- accountLogin: string;
50
- /** Account type */
51
- accountType: "User" | "Organization";
52
- /** Custom display name (set in Morph dashboard) */
53
- displayName?: string;
54
- /** Whether check runs are disabled (only PR comments posted) */
55
- disableCheckRun: boolean;
56
- /** Whether to keep all previous PR comments (vs. replacing with latest) */
57
- keepCommentHistory: boolean;
58
- /** Browser automation model used for preview tests */
59
- model: string;
60
- }
61
- /**
62
- * Input for updating installation settings
63
- */
64
- interface UpdateInstallationInput {
65
- /** Installation ID to update */
66
- installationId: string;
67
- /** Custom display name */
68
- displayName?: string;
69
- /** Whether to disable check runs */
70
- disableCheckRun?: boolean;
71
- /** Whether to keep comment history */
72
- keepCommentHistory?: boolean;
73
- /** Browser automation model */
74
- model?: string;
75
- }
76
- /**
77
- * Site authentication credentials for a repo or project
78
- */
79
- interface SiteAuth {
80
- /** Login username or email */
81
- username: string | null;
82
- /** Login password */
83
- password: string | null;
84
- }
85
- /**
86
- * A repository with its Morph configuration
87
- */
88
- interface RepoConfig {
89
- /** Database UUID — use this for update/remove operations */
90
- id: string;
91
- /** GitHub's numeric repo ID */
92
- githubId: number;
93
- /** Full name including owner (e.g., "acme/app") */
94
- fullName: string;
95
- /** Repository name (e.g., "app") */
96
- name: string;
97
- /** Whether Morph tests are enabled */
98
- enabled: boolean;
99
- /** Whether to also test on mobile viewport */
100
- testMobile: boolean;
101
- /** Path filter — only trigger tests when files match this prefix */
102
- pathFilter: string | null;
103
- /** Custom instructions for the AI agent */
104
- customInstructions: string | null;
105
- /** Site authentication credentials */
106
- auth: SiteAuth | null;
107
- }
108
- /**
109
- * Input for updating a repo's configuration
110
- */
111
- interface UpdateRepoInput {
112
- /** Repo DB ID (from RepoConfig.id) */
113
- repoId: string;
114
- /** Whether Morph tests are enabled */
115
- enabled?: boolean;
116
- /** Whether to also test on mobile viewport */
117
- testMobile?: boolean;
118
- /** Path filter for conditional triggers */
119
- pathFilter?: string | null;
120
- /** Custom instructions for the AI agent */
121
- customInstructions?: string | null;
122
- /** Site auth credentials (null to clear) */
123
- auth?: {
124
- username?: string;
125
- password?: string;
126
- cookies?: unknown;
127
- } | null;
128
- }
129
- /**
130
- * Input for syncing repos from GitHub
131
- */
132
- interface SyncReposInput {
133
- /** Installation ID to sync repos for */
134
- installationId: string;
135
- }
136
- /**
137
- * A monorepo sub-project scoped under a repo
138
- */
139
- interface Project {
140
- /** Project DB UUID */
141
- id: string;
142
- /** Parent repo DB UUID */
143
- repoId: string;
144
- /** Project name */
145
- name: string;
146
- /** Path filter within the repo */
147
- pathFilter: string | null;
148
- /** Whether tests are enabled */
149
- enabled: boolean;
150
- /** Whether to test on mobile viewport */
151
- testMobile: boolean;
152
- /** Custom instructions for the AI agent */
153
- customInstructions: string | null;
154
- /** Site authentication credentials */
155
- auth: SiteAuth | null;
156
- /** Creation timestamp (ISO 8601) */
157
- createdAt: string;
158
- }
159
- /**
160
- * Input for creating a project
161
- */
162
- interface CreateProjectInput {
163
- /** Parent repo DB ID */
164
- repoId: string;
165
- /** Project name (must be unique within the repo) */
166
- name: string;
167
- /** Path filter within the repo (e.g., "packages/web/") */
168
- pathFilter: string;
169
- /** Custom instructions for the AI agent */
170
- customInstructions?: string;
171
- }
172
- /**
173
- * Input for updating a project
174
- */
175
- interface UpdateProjectInput {
176
- /** Project DB ID */
177
- projectId: string;
178
- /** Whether tests are enabled */
179
- enabled?: boolean;
180
- /** Whether to test on mobile viewport */
181
- testMobile?: boolean;
182
- /** Path filter within the repo */
183
- pathFilter?: string | null;
184
- /** Custom instructions for the AI agent */
185
- customInstructions?: string | null;
186
- /** Site auth credentials (null to clear) */
187
- auth?: {
188
- username?: string;
189
- password?: string;
190
- cookies?: unknown;
191
- } | null;
192
- }
193
- /**
194
- * Input for listing projects
195
- */
196
- interface ListProjectsInput {
197
- /** Parent repo DB ID */
198
- repoId: string;
199
- }
200
- /**
201
- * A GitHub repository
202
- */
203
- interface Repo {
204
- /** GitHub's numeric repo ID */
205
- id: number;
206
- /** Repository name (e.g., "app") */
207
- name: string;
208
- /** Full name including owner (e.g., "acme/app") */
209
- fullName: string;
210
- /** Whether the repo is private */
211
- private: boolean;
212
- /** Default branch name */
213
- defaultBranch?: string;
214
- }
215
- /**
216
- * A pull request (basic info)
217
- */
218
- interface PullRequest {
219
- /** PR number */
220
- number: number;
221
- /** PR title */
222
- title: string;
223
- /** PR description/body */
224
- body: string | null;
225
- /** PR state */
226
- state: "open" | "closed";
227
- /** Author's GitHub username */
228
- author: string;
229
- /** HEAD commit SHA */
230
- headSha: string;
231
- /** Base branch name */
232
- baseBranch: string;
233
- /** HEAD branch name */
234
- headBranch: string;
235
- /** Creation timestamp (ISO 8601) */
236
- createdAt: string;
237
- /** Last update timestamp (ISO 8601) */
238
- updatedAt: string;
239
- }
240
- /**
241
- * A pull request with full context (diff and files)
242
- */
243
- interface PullRequestWithContext extends PullRequest {
244
- /** Full unified diff */
245
- diff: string;
246
- /** List of changed files with patches */
247
- files: FileChange[];
248
- }
249
- /**
250
- * A file changed in a pull request
251
- */
252
- interface FileChange {
253
- /** File path */
254
- filename: string;
255
- /** Change status */
256
- status: "added" | "removed" | "modified" | "renamed";
257
- /** Number of lines added */
258
- additions: number;
259
- /** Number of lines deleted */
260
- deletions: number;
261
- /** Unified diff patch for this file */
262
- patch?: string;
263
- }
264
- /**
265
- * A deployment (e.g., Vercel preview)
266
- */
267
- interface Deployment {
268
- /** Deployment ID */
269
- id: number;
270
- /** Commit SHA this deployment is for */
271
- sha: string;
272
- /** Environment name (e.g., "preview", "production") */
273
- environment: string;
274
- /** Deployment state */
275
- state: "pending" | "success" | "failure" | "error" | "inactive" | "in_progress" | "queued";
276
- /** Preview/deployment URL (if available) */
277
- url: string | null;
278
- /** Creation timestamp (ISO 8601) */
279
- createdAt: string;
280
- }
281
- /**
282
- * A comment on a PR/issue
283
- */
284
- interface Comment {
285
- /** Comment ID */
286
- id: number;
287
- /** Comment body/content */
288
- body: string;
289
- /** Author's GitHub username */
290
- author: string;
291
- /** Creation timestamp (ISO 8601) */
292
- createdAt: string;
293
- /** Last update timestamp (ISO 8601) */
294
- updatedAt: string;
295
- }
296
- /**
297
- * A GitHub check run (CI status)
298
- */
299
- interface CheckRun {
300
- /** Check run ID */
301
- id: number;
302
- /** Check run name */
303
- name: string;
304
- /** Current status */
305
- status: "queued" | "in_progress" | "completed";
306
- /** Conclusion (only set when status is "completed") */
307
- conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required";
308
- /** Start timestamp (ISO 8601) */
309
- startedAt?: string;
310
- /** Completion timestamp (ISO 8601) */
311
- completedAt?: string;
312
- }
313
- /**
314
- * Input for listing repositories
315
- */
316
- interface ListReposInput {
317
- /** Installation ID to list repos for */
318
- installationId: string;
319
- }
320
- /**
321
- * Input for listing pull requests
322
- */
323
- interface ListPullRequestsInput {
324
- /** Repository owner */
325
- owner: string;
326
- /** Repository name */
327
- repo: string;
328
- /** Filter by PR state (default: "open") */
329
- state?: "open" | "closed" | "all";
330
- /** Installation ID (uses default if not specified) */
331
- installationId?: string;
332
- }
333
- /**
334
- * Input for getting a single pull request
335
- */
336
- interface GetPullRequestInput {
337
- /** Repository owner */
338
- owner: string;
339
- /** Repository name */
340
- repo: string;
341
- /** PR number */
342
- number: number;
343
- /** Installation ID (uses default if not specified) */
344
- installationId?: string;
345
- }
346
- /**
347
- * Input for listing deployments
348
- */
349
- interface ListDeploymentsInput {
350
- /** Repository owner */
351
- owner: string;
352
- /** Repository name */
353
- repo: string;
354
- /** Filter by commit SHA */
355
- sha?: string;
356
- /** Filter by environment name */
357
- environment?: string;
358
- /** Installation ID (uses default if not specified) */
359
- installationId?: string;
360
- }
361
- /**
362
- * Input for listing comments on a PR
363
- */
364
- interface ListCommentsInput {
365
- /** Repository owner */
366
- owner: string;
367
- /** Repository name */
368
- repo: string;
369
- /** PR number */
370
- pr: number;
371
- /** Installation ID (uses default if not specified) */
372
- installationId?: string;
373
- }
374
- /**
375
- * Input for creating a comment
376
- */
377
- interface CreateCommentInput {
378
- /** Repository owner */
379
- owner: string;
380
- /** Repository name */
381
- repo: string;
382
- /** PR number */
383
- pr: number;
384
- /** Comment body (Markdown supported) */
385
- body: string;
386
- /** Installation ID (uses default if not specified) */
387
- installationId?: string;
388
- }
389
- /**
390
- * Input for updating a comment
391
- */
392
- interface UpdateCommentInput {
393
- /** Repository owner */
394
- owner: string;
395
- /** Repository name */
396
- repo: string;
397
- /** Comment ID to update */
398
- commentId: number;
399
- /** New comment body */
400
- body: string;
401
- /** Installation ID (uses default if not specified) */
402
- installationId?: string;
403
- }
404
- /**
405
- * Input for deleting a comment
406
- */
407
- interface DeleteCommentInput {
408
- /** Repository owner */
409
- owner: string;
410
- /** Repository name */
411
- repo: string;
412
- /** Comment ID to delete */
413
- commentId: number;
414
- /** Installation ID (uses default if not specified) */
415
- installationId?: string;
416
- }
417
- /**
418
- * Input for creating a check run
419
- */
420
- interface CreateCheckRunInput {
421
- /** Repository owner */
422
- owner: string;
423
- /** Repository name */
424
- repo: string;
425
- /** Commit SHA to create check run for */
426
- sha: string;
427
- /** Check run name (e.g., "Preview Test") */
428
- name: string;
429
- /** Initial status */
430
- status: "queued" | "in_progress";
431
- /** Output title */
432
- title?: string;
433
- /** Output summary (Markdown supported) */
434
- summary?: string;
435
- /** Installation ID (uses default if not specified) */
436
- installationId?: string;
437
- }
438
- /**
439
- * Input for updating a check run
440
- */
441
- interface UpdateCheckRunInput {
442
- /** Repository owner */
443
- owner: string;
444
- /** Repository name */
445
- repo: string;
446
- /** Check run ID to update */
447
- checkRunId: number;
448
- /** New status */
449
- status?: "queued" | "in_progress" | "completed";
450
- /** Conclusion (required if status is "completed") */
451
- conclusion?: CheckRun["conclusion"];
452
- /** Output title */
453
- title?: string;
454
- /** Output summary (Markdown supported) */
455
- summary?: string;
456
- /** Output text (detailed info, Markdown supported) */
457
- text?: string;
458
- /** Installation ID (uses default if not specified) */
459
- installationId?: string;
460
- }
461
- /**
462
- * Error thrown by GitHub operations
463
- */
464
- declare class GitHubError extends Error {
465
- /** HTTP status code */
466
- status: number;
467
- /** Error code from API */
468
- code?: string;
469
- constructor(message: string, status: number, code?: string);
470
- }
471
- /**
472
- * Error thrown when no installation is found or specified
473
- */
474
- declare class NoInstallationError extends GitHubError {
475
- constructor(message?: string);
476
- }
477
- /**
478
- * Error thrown when resource is not found
479
- */
480
- declare class NotFoundError extends GitHubError {
481
- constructor(resource: string);
482
- }
483
- /**
484
- * Error thrown when user lacks permission
485
- */
486
- declare class PermissionError extends GitHubError {
487
- constructor(message?: string);
488
- }
489
-
490
- /**
491
- * GitHub SDK Client
492
- *
493
- * Provides access to GitHub repositories, pull requests, deployments,
494
- * comments, and check runs through the user's connected GitHub account.
495
- *
496
- * All operations are proxied through the Morph API - installation tokens
497
- * are never exposed to the client.
498
- */
499
-
500
- /**
501
- * GitHub SDK Client
502
- *
503
- * @example
504
- * ```typescript
505
- * import { MorphClient } from '@morphllm/morphsdk';
506
- *
507
- * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
508
- *
509
- * // List installations
510
- * const installations = await morph.github.installations.list();
511
- *
512
- * // Get PR with context
513
- * const pr = await morph.github.pullRequests.get({
514
- * owner: "acme",
515
- * repo: "app",
516
- * number: 42
517
- * });
518
- * ```
519
- *
520
- * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).github`).
521
- * Standalone clients remain only for backwards compatibility and may be removed in a future
522
- * major version — do not use them in new code.
523
- */
524
- declare class GitHubClient extends APIResource {
525
- private timeout;
526
- private debug;
527
- private defaultInstallationId?;
528
- /** Installation operations */
529
- installations: {
530
- list: () => Promise<Installation[]>;
531
- get: (installationId: string) => Promise<Installation>;
532
- update: (input: UpdateInstallationInput) => Promise<Installation>;
533
- disconnect: (installationId: string) => Promise<{
534
- success: boolean;
535
- alreadyDeleted: boolean;
536
- }>;
537
- };
538
- /** Repository operations */
539
- repos: {
540
- list: (input: ListReposInput) => Promise<RepoConfig[]>;
541
- get: (repoId: string) => Promise<RepoConfig>;
542
- update: (input: UpdateRepoInput) => Promise<RepoConfig>;
543
- remove: (repoId: string) => Promise<{
544
- success: boolean;
545
- alreadyRemoved: boolean;
546
- }>;
547
- sync: (input: SyncReposInput) => Promise<{
548
- count: number;
549
- }>;
550
- };
551
- /** Project operations (monorepo sub-projects) */
552
- projects: {
553
- list: (input: ListProjectsInput) => Promise<Project[]>;
554
- create: (input: CreateProjectInput) => Promise<Project>;
555
- update: (input: UpdateProjectInput) => Promise<Project>;
556
- delete: (projectId: string) => Promise<{
557
- success: boolean;
558
- }>;
559
- };
560
- /** Pull request operations */
561
- pullRequests: {
562
- list: (input: ListPullRequestsInput) => Promise<PullRequest[]>;
563
- get: (input: GetPullRequestInput) => Promise<PullRequestWithContext>;
564
- };
565
- /** Deployment operations */
566
- deployments: {
567
- list: (input: ListDeploymentsInput) => Promise<Deployment[]>;
568
- };
569
- /** Comment operations */
570
- comments: {
571
- list: (input: ListCommentsInput) => Promise<Comment[]>;
572
- create: (input: CreateCommentInput) => Promise<Comment>;
573
- update: (input: UpdateCommentInput) => Promise<Comment>;
574
- delete: (input: DeleteCommentInput) => Promise<void>;
575
- };
576
- /** Check run operations */
577
- checkRuns: {
578
- create: (input: CreateCheckRunInput) => Promise<CheckRun>;
579
- update: (input: UpdateCheckRunInput) => Promise<CheckRun>;
580
- };
581
- /**
582
- * Get the GitHub App installation URL.
583
- * Users visit this URL once to install the Morph GitHub App on their account/org.
584
- */
585
- getInstallUrl(): string;
586
- constructor(clientOrConfig?: MorphAPIClient | GitHubClientConfig, options?: {
587
- installationId?: string;
588
- });
589
- /**
590
- * Make an authenticated API request
591
- */
592
- private request;
593
- /**
594
- * Get the installation ID to use for a request
595
- */
596
- private getInstallationId;
597
- private listInstallations;
598
- private getInstallation;
599
- private updateInstallation;
600
- private disconnectInstallation;
601
- private listRepos;
602
- private getRepo;
603
- private updateRepo;
604
- private removeRepo;
605
- private syncRepos;
606
- private listProjects;
607
- private createProject;
608
- private updateProject;
609
- private deleteProject;
610
- private listPullRequests;
611
- private getPullRequest;
612
- private listDeployments;
613
- private listComments;
614
- private createComment;
615
- private updateComment;
616
- private deleteComment;
617
- private createCheckRun;
618
- private updateCheckRun;
619
- }
620
-
621
- /**
622
- * Factory for creating OpenAI-compatible tools with inherited API key
623
- *
624
- * @example
625
- * ```typescript
626
- * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
627
- *
628
- * const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
629
- * const searchTool = morph.openai.createCodebaseSearchTool({ repoId: 'my-project' });
630
- * const editTool = morph.openai.createEditFileTool({ baseDir: './src' });
631
- *
632
- * // Use with OpenAI client
633
- * const response = await openai.chat.completions.create({
634
- * model: 'gpt-4o',
635
- * tools: [grepTool, searchTool, editTool],
636
- * messages: [{ role: 'user', content: 'Find and fix the bug' }]
637
- * });
638
- * ```
639
- */
640
- declare class OpenAIToolFactory {
641
- private config;
642
- constructor(config: MorphClientConfig);
643
- /**
644
- * Create an OpenAI-compatible warp grep tool
645
- *
646
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
647
- * @returns OpenAI ChatCompletionTool with execute and formatResult methods
648
- */
649
- createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
650
- execute: (input: unknown) => Promise<WarpGrepResult>;
651
- formatResult: (result: WarpGrepResult) => string;
652
- };
653
- /**
654
- * Create an OpenAI-compatible codebase search tool
655
- *
656
- * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
657
- * @returns OpenAI ChatCompletionTool with execute and formatResult methods
658
- */
659
- createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
660
- execute: (input: CodebaseSearchInput | string) => Promise<CodebaseSearchResult>;
661
- formatResult: (result: CodebaseSearchResult) => string;
662
- getSystemPrompt: () => string;
663
- };
664
- /**
665
- * Create an OpenAI-compatible edit file tool
666
- *
667
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
668
- * @returns OpenAI ChatCompletionTool with execute and formatResult methods
669
- */
670
- createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
671
- execute: (input: EditFileInput | string) => Promise<EditFileResult>;
672
- formatResult: (result: EditFileResult) => string;
673
- getSystemPrompt: () => string;
674
- };
675
- /**
676
- * Create an OpenAI-compatible GitHub search tool
677
- *
678
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
679
- * @returns OpenAI ChatCompletionTool with execute and formatResult methods
680
- */
681
- createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
682
- execute: (input: {
683
- search_term: string;
684
- github_url?: string;
685
- owner_repo?: string;
686
- branch?: string;
687
- }) => Promise<WarpGrepResult>;
688
- formatResult: (result: WarpGrepResult) => string;
689
- };
690
- }
691
-
692
- /**
693
- * Factory for creating Anthropic-compatible tools with inherited API key
694
- *
695
- * @example
696
- * ```typescript
697
- * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
698
- *
699
- * const grepTool = morph.anthropic.createWarpGrepTool({ repoRoot: '.' });
700
- * const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'my-project' });
701
- * const editTool = morph.anthropic.createEditFileTool({ baseDir: './src' });
702
- *
703
- * // Use with Anthropic client
704
- * const response = await anthropic.messages.create({
705
- * model: 'claude-sonnet-4-5-20250929',
706
- * tools: [grepTool, searchTool, editTool],
707
- * messages: [{ role: 'user', content: 'Find and fix the bug' }]
708
- * });
709
- * ```
710
- */
711
- declare class AnthropicToolFactory {
712
- private config;
713
- constructor(config: MorphClientConfig);
714
- /**
715
- * Create an Anthropic-compatible warp grep tool
716
- *
717
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
718
- * @returns Anthropic Tool with execute and formatResult methods
719
- */
720
- createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
721
- execute: (input: unknown) => Promise<WarpGrepResult>;
722
- formatResult: (result: WarpGrepResult) => string;
723
- };
724
- /**
725
- * Create an Anthropic-compatible codebase search tool
726
- *
727
- * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
728
- * @returns Anthropic Tool with execute and formatResult methods
729
- */
730
- createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
731
- execute: (input: CodebaseSearchInput) => Promise<CodebaseSearchResult>;
732
- formatResult: (result: CodebaseSearchResult) => string;
733
- getSystemPrompt: () => string;
734
- };
735
- /**
736
- * Create an Anthropic-compatible edit file tool
737
- *
738
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
739
- * @returns Anthropic Tool with execute and formatResult methods
740
- */
741
- createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
742
- execute: (input: EditFileInput) => Promise<EditFileResult>;
743
- formatResult: (result: EditFileResult) => string;
744
- getSystemPrompt: () => string;
745
- };
746
- /**
747
- * Create an Anthropic-compatible GitHub search tool
748
- *
749
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
750
- * @returns Anthropic Tool with execute and formatResult methods
751
- */
752
- createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
753
- execute: (input: {
754
- search_term: string;
755
- github_url?: string;
756
- owner_repo?: string;
757
- branch?: string;
758
- }) => Promise<WarpGrepResult>;
759
- formatResult: (result: WarpGrepResult) => string;
760
- };
761
- /**
762
- * Create an Explore subagent that searches the codebase and returns summaries
763
- *
764
- * @param config - Subagent configuration including client and model (morphApiKey inherited from MorphClient)
765
- * @returns Explore subagent with .tool, .run(), and .stream() methods
766
- */
767
- createExploreSubagent(config: Omit<ExploreSubagentConfig, 'morphApiKey'> & {
768
- client: any;
769
- model: string;
770
- }): {
771
- tool: _anthropic_ai_sdk_resources_messages_mjs.Tool & {
772
- execute: (input: {
773
- searchRequest: string;
774
- }) => Promise<ExploreResult>;
775
- formatResult: (result: ExploreResult) => string;
776
- };
777
- run(prompt: string): ExploreSession;
778
- stream(prompt: string): AsyncGenerator<ExploreEvent, ExploreResult, undefined>;
779
- };
780
- }
781
-
782
- /**
783
- * Factory for creating Vercel AI SDK-compatible tools with inherited API key
784
- *
785
- * @example
786
- * ```typescript
787
- * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
788
- *
789
- * const grepTool = morph.vercel.createWarpGrepTool({ repoRoot: '.' });
790
- * const searchTool = morph.vercel.createCodebaseSearchTool({ repoId: 'my-project' });
791
- * const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
792
- *
793
- * // Use with Vercel AI SDK
794
- * const result = await generateText({
795
- * model: anthropic('claude-sonnet-4-5-20250929'),
796
- * tools: { grep: grepTool, search: searchTool, edit: editTool },
797
- * prompt: 'Find and fix the bug'
798
- * });
799
- * ```
800
- */
801
- declare class VercelToolFactory {
802
- private config;
803
- constructor(config: MorphClientConfig);
804
- /**
805
- * Create a Vercel AI SDK-compatible warp grep tool
806
- *
807
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
808
- * @returns Vercel AI SDK tool
809
- */
810
- createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): ai.Tool<WarpGrepToolInput, {
811
- success: boolean;
812
- contexts: WarpGrepContext[] | undefined;
813
- summary: string | undefined;
814
- progress: {
815
- turn: number;
816
- toolCalls: {
817
- name: string;
818
- arguments: Record<string, unknown>;
819
- }[];
820
- } | undefined;
821
- }>;
822
- /**
823
- * Create a Vercel AI SDK-compatible codebase search tool
824
- *
825
- * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
826
- * @returns Vercel AI SDK tool
827
- */
828
- createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): ai.Tool<{
829
- query: string;
830
- target_directories: string[];
831
- explanation: string;
832
- limit?: number | undefined;
833
- }, {
834
- error: string | undefined;
835
- results: never[];
836
- found?: undefined;
837
- searchTime?: undefined;
838
- } | {
839
- found: number;
840
- searchTime: string;
841
- results: {
842
- file: string;
843
- symbol: string;
844
- lines: string;
845
- language: string;
846
- relevance: string;
847
- code: string;
848
- }[];
849
- error?: undefined;
850
- }>;
851
- /**
852
- * Create a Vercel AI SDK-compatible edit file tool
853
- *
854
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
855
- * @returns Vercel AI SDK tool
856
- */
857
- createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): ai.Tool<{
858
- target_filepath: string;
859
- instruction: string;
860
- code_edit: string;
861
- }, {
862
- success: boolean;
863
- filepath: string;
864
- changes: EditChanges;
865
- udiff: string | undefined;
866
- }>;
867
- /**
868
- * Create a Vercel AI SDK-compatible GitHub search tool
869
- *
870
- * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
871
- * @returns Vercel AI SDK tool
872
- */
873
- createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): ai.Tool<{
874
- search_term: string;
875
- branch?: string | undefined;
876
- owner_repo?: string | undefined;
877
- github_url?: string | undefined;
878
- }, {
879
- success: boolean;
880
- contexts: WarpGrepContext[] | undefined;
881
- summary: string | undefined;
882
- }>;
883
- /**
884
- * Create an Explore subagent that searches the codebase and returns summaries
885
- *
886
- * @param config - Subagent configuration including model (morphApiKey inherited from MorphClient)
887
- * @returns Explore subagent with .tool, .run(), and .stream() methods
888
- */
889
- createExploreSubagent(config: Omit<ExploreSubagentConfig, 'morphApiKey'> & {
890
- model: LanguageModel;
891
- }): {
892
- tool: ai.Tool<{
893
- searchRequest: string;
894
- }, {
895
- success: boolean;
896
- summary: string;
897
- searchCount: number;
898
- error: string | undefined;
899
- }>;
900
- run(prompt: string): ExploreSession;
901
- stream(prompt: string): AsyncGenerator<ExploreEvent, ExploreResult, undefined>;
902
- };
903
- }
904
-
905
- /**
906
- * Unified Morph SDK Client
907
- *
908
- * Provides access to all Morph tools through a single interface
909
- *
910
- * @example
911
- * ```typescript
912
- * import { MorphClient } from '@morphllm/morphsdk';
913
- *
914
- * const morph = new MorphClient({
915
- * apiKey: process.env.MORPH_API_KEY,
916
- * debug: true,
917
- * timeout: 60000
918
- * });
919
- *
920
- * // Direct execution
921
- * await morph.fastApply.execute({ target_filepath: 'src/index.ts', ... });
922
- * await morph.warpGrep.execute({ query: 'Find auth', repoRoot: '.' });
923
- * await morph.codebaseSearch.search({ query: 'auth logic', repoId: 'x' });
924
- *
925
- * // Tool creation for AI agents (API key inherited)
926
- * const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
927
- * const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'x' });
928
- * const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
929
- *
930
- * // Use tools with OpenAI
931
- * const response = await openai.chat.completions.create({
932
- * model: 'gpt-4o',
933
- * tools: [grepTool],
934
- * messages: [{ role: 'user', content: 'Find the bug' }]
935
- * });
936
- * ```
937
- */
938
-
939
- /**
940
- * Configuration for the MorphClient
941
- */
942
- interface MorphClientConfig {
943
- /** Morph API key for authentication (defaults to MORPH_API_KEY env var) */
944
- apiKey?: string;
945
- /** Enable debug logging across all tools */
946
- debug?: boolean;
947
- /** Default timeout in milliseconds for API requests */
948
- timeout?: number;
949
- /** Retry configuration for failed requests */
950
- retryConfig?: RetryConfig;
951
- /** GitHub-specific configuration */
952
- github?: {
953
- /** Default installation ID for GitHub operations */
954
- installationId?: string;
955
- };
956
- }
957
- /**
958
- * Unified Morph SDK Client
959
- *
960
- * Provides access to all Morph tools through a single interface:
961
- * - fastApply: AI-powered file editing with intelligent merging
962
- * - codebaseSearch: Semantic code search
963
- * - warpGrep: Fast code search with ripgrep
964
- * - browser: AI-powered browser automation
965
- * - git: Version control operations
966
- * - routers: Intelligent model selection (OpenAI, Anthropic, Gemini)
967
- * - openai/anthropic/vercel: Tool factories for agent frameworks
968
- */
969
- declare class MorphClient extends MorphAPIClient {
970
- /** Client configuration */
971
- config: MorphClientConfig;
972
- /** FastApply tool for editing files with AI-powered merge */
973
- fastApply: FastApplyClient;
974
- /** CodebaseSearch tool for semantic code search */
975
- codebaseSearch: CodebaseSearchClient;
976
- /** WarpGrep tool for fast code search using ripgrep */
977
- warpGrep: WarpGrepClient;
978
- /** Browser tool for AI-powered browser automation */
979
- browser: BrowserClient;
980
- /** GitHub tool for PR context, comments, and check runs */
981
- github: GitHubClient;
982
- /** Model routers for intelligent model selection */
983
- routers: {
984
- openai: OpenAIRouter;
985
- anthropic: AnthropicRouter;
986
- gemini: GeminiRouter;
987
- raw: RawRouter;
988
- classify: RouterClassifier;
989
- };
990
- /** OpenAI-compatible tool factories */
991
- openai: OpenAIToolFactory;
992
- /** Anthropic-compatible tool factories */
993
- anthropic: AnthropicToolFactory;
994
- /** Vercel AI SDK tool factories */
995
- vercel: VercelToolFactory;
996
- /** Compact context with line ranges */
997
- compact: CompactClient['compact'];
998
- /**
999
- * Create a new Morph SDK client
1000
- *
1001
- * @param config - Client configuration (apiKey, debug, timeout, retryConfig)
1002
- *
1003
- * @example
1004
- * ```typescript
1005
- * const morph = new MorphClient({
1006
- * apiKey: process.env.MORPH_API_KEY,
1007
- * debug: true,
1008
- * timeout: 60000
1009
- * });
1010
- * ```
1011
- */
1012
- constructor(config?: MorphClientConfig);
1013
- }
1014
-
1015
- export { AnthropicToolFactory as A, type Comment as C, type Deployment as D, type FileChange as F, GitHubClient as G, type Installation as I, type ListReposInput as L, MorphClient as M, NoInstallationError as N, OpenAIToolFactory as O, type Project as P, type Repo as R, type SiteAuth as S, type UpdateCommentInput as U, VercelToolFactory as V, type MorphClientConfig as a, type GitHubClientConfig as b, type RepoConfig as c, type PullRequest as d, type PullRequestWithContext as e, type CheckRun as f, type ListPullRequestsInput as g, type GetPullRequestInput as h, type ListDeploymentsInput as i, type ListCommentsInput as j, type CreateCommentInput as k, type DeleteCommentInput as l, type CreateCheckRunInput as m, type UpdateCheckRunInput as n, type UpdateInstallationInput as o, type UpdateRepoInput as p, type SyncReposInput as q, type CreateProjectInput as r, type UpdateProjectInput as s, type ListProjectsInput as t, GitHubError as u, NotFoundError as v, PermissionError as w };