@morphllm/morphsdk 0.2.21 → 0.2.23

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 (193) hide show
  1. package/dist/{chunk-BILUTNBC.js → chunk-4A7UBGLS.js} +2 -2
  2. package/dist/chunk-73RQWOQC.js +16 -0
  3. package/dist/chunk-73RQWOQC.js.map +1 -0
  4. package/dist/chunk-AFEPUNAO.js +15 -0
  5. package/dist/chunk-AFEPUNAO.js.map +1 -0
  6. package/dist/{chunk-VJK4PH5V.js → chunk-AG3ICTC5.js} +5 -2
  7. package/dist/chunk-AG3ICTC5.js.map +1 -0
  8. package/dist/chunk-EAA7D24N.js +201 -0
  9. package/dist/chunk-EAA7D24N.js.map +1 -0
  10. package/dist/chunk-EK7OQPWD.js +44 -0
  11. package/dist/chunk-EK7OQPWD.js.map +1 -0
  12. package/dist/chunk-G2RSY56Q.js +11 -0
  13. package/dist/chunk-G2RSY56Q.js.map +1 -0
  14. package/dist/chunk-GTOXMAF2.js +140 -0
  15. package/dist/chunk-GTOXMAF2.js.map +1 -0
  16. package/dist/chunk-HKZB23U7.js +85 -0
  17. package/dist/chunk-HKZB23U7.js.map +1 -0
  18. package/dist/{chunk-34F3D6JD.js → chunk-HWJN5AMA.js} +8 -8
  19. package/dist/chunk-LN4CTQZG.js +56 -0
  20. package/dist/chunk-LN4CTQZG.js.map +1 -0
  21. package/dist/chunk-NDZO5IPV.js +121 -0
  22. package/dist/chunk-NDZO5IPV.js.map +1 -0
  23. package/dist/chunk-RSLIOCOE.js +26 -0
  24. package/dist/chunk-RSLIOCOE.js.map +1 -0
  25. package/dist/chunk-S3GI7HNR.js +44 -0
  26. package/dist/chunk-S3GI7HNR.js.map +1 -0
  27. package/dist/chunk-SMGZ6A64.js +53 -0
  28. package/dist/chunk-SMGZ6A64.js.map +1 -0
  29. package/dist/chunk-TICMYDII.js +81 -0
  30. package/dist/chunk-TICMYDII.js.map +1 -0
  31. package/dist/chunk-UYBIKZPM.js +135 -0
  32. package/dist/chunk-UYBIKZPM.js.map +1 -0
  33. package/dist/chunk-VBBJGWHY.js +73 -0
  34. package/dist/chunk-VBBJGWHY.js.map +1 -0
  35. package/dist/chunk-W5CHJ6OX.js +53 -0
  36. package/dist/chunk-W5CHJ6OX.js.map +1 -0
  37. package/dist/{chunk-WXBUVKYL.js → chunk-WHZQDTM6.js} +2 -2
  38. package/dist/chunk-XYPMN4A3.js +1 -0
  39. package/dist/chunk-XYPMN4A3.js.map +1 -0
  40. package/dist/{chunk-YVGRWE7D.js → chunk-Y2IY7NYY.js} +2 -2
  41. package/dist/chunk-Z2FBMSNE.js +10 -0
  42. package/dist/chunk-Z2FBMSNE.js.map +1 -0
  43. package/dist/client.cjs +4 -1
  44. package/dist/client.cjs.map +1 -1
  45. package/dist/client.js +5 -5
  46. package/dist/index.cjs +4 -1
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.js +9 -9
  49. package/dist/tools/codebase_search/anthropic.cjs +4 -1
  50. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  51. package/dist/tools/codebase_search/anthropic.js +2 -2
  52. package/dist/tools/codebase_search/core.cjs +4 -1
  53. package/dist/tools/codebase_search/core.cjs.map +1 -1
  54. package/dist/tools/codebase_search/core.js +1 -1
  55. package/dist/tools/codebase_search/index.cjs +4 -1
  56. package/dist/tools/codebase_search/index.cjs.map +1 -1
  57. package/dist/tools/codebase_search/index.js +6 -6
  58. package/dist/tools/codebase_search/openai.cjs +4 -1
  59. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  60. package/dist/tools/codebase_search/openai.js +2 -2
  61. package/dist/tools/codebase_search/types.cjs.map +1 -1
  62. package/dist/tools/codebase_search/vercel.cjs +4 -1
  63. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  64. package/dist/tools/codebase_search/vercel.js +2 -2
  65. package/dist/tools/warp_grep/agent/config.cjs +41 -0
  66. package/dist/tools/warp_grep/agent/config.cjs.map +1 -0
  67. package/dist/tools/warp_grep/agent/config.js +12 -0
  68. package/dist/tools/warp_grep/agent/config.js.map +1 -0
  69. package/dist/tools/warp_grep/agent/formatter.cjs +106 -0
  70. package/dist/tools/warp_grep/agent/formatter.cjs.map +1 -0
  71. package/dist/tools/warp_grep/agent/formatter.js +10 -0
  72. package/dist/tools/warp_grep/agent/formatter.js.map +1 -0
  73. package/dist/tools/warp_grep/agent/grep_helpers.cjs +148 -0
  74. package/dist/tools/warp_grep/agent/grep_helpers.cjs.map +1 -0
  75. package/dist/tools/warp_grep/agent/grep_helpers.js +14 -0
  76. package/dist/tools/warp_grep/agent/grep_helpers.js.map +1 -0
  77. package/dist/tools/warp_grep/agent/parser.cjs +165 -0
  78. package/dist/tools/warp_grep/agent/parser.cjs.map +1 -0
  79. package/dist/tools/warp_grep/agent/parser.js +10 -0
  80. package/dist/tools/warp_grep/agent/parser.js.map +1 -0
  81. package/dist/tools/warp_grep/agent/prompt.cjs +110 -0
  82. package/dist/tools/warp_grep/agent/prompt.cjs.map +1 -0
  83. package/dist/tools/warp_grep/agent/prompt.js +10 -0
  84. package/dist/tools/warp_grep/agent/prompt.js.map +1 -0
  85. package/dist/tools/warp_grep/agent/runner.cjs +744 -0
  86. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -0
  87. package/dist/tools/warp_grep/agent/runner.js +17 -0
  88. package/dist/tools/warp_grep/agent/runner.js.map +1 -0
  89. package/dist/tools/warp_grep/agent/types.cjs +19 -0
  90. package/dist/tools/warp_grep/agent/types.cjs.map +1 -0
  91. package/dist/tools/warp_grep/agent/types.js +2 -0
  92. package/dist/tools/warp_grep/agent/types.js.map +1 -0
  93. package/dist/tools/warp_grep/anthropic.cjs +977 -0
  94. package/dist/tools/warp_grep/anthropic.cjs.map +1 -0
  95. package/dist/tools/warp_grep/anthropic.js +22 -0
  96. package/dist/tools/warp_grep/anthropic.js.map +1 -0
  97. package/dist/tools/warp_grep/index.cjs +1136 -0
  98. package/dist/tools/warp_grep/index.cjs.map +1 -0
  99. package/dist/tools/warp_grep/index.js +48 -0
  100. package/dist/tools/warp_grep/index.js.map +1 -0
  101. package/dist/tools/warp_grep/openai.cjs +980 -0
  102. package/dist/tools/warp_grep/openai.cjs.map +1 -0
  103. package/dist/tools/warp_grep/openai.js +22 -0
  104. package/dist/tools/warp_grep/openai.js.map +1 -0
  105. package/dist/tools/warp_grep/providers/command.cjs +98 -0
  106. package/dist/tools/warp_grep/providers/command.cjs.map +1 -0
  107. package/dist/tools/warp_grep/providers/command.js +9 -0
  108. package/dist/tools/warp_grep/providers/command.js.map +1 -0
  109. package/dist/tools/warp_grep/providers/local.cjs +232 -0
  110. package/dist/tools/warp_grep/providers/local.cjs.map +1 -0
  111. package/dist/tools/warp_grep/providers/local.js +12 -0
  112. package/dist/tools/warp_grep/providers/local.js.map +1 -0
  113. package/dist/tools/warp_grep/providers/types.cjs +19 -0
  114. package/dist/tools/warp_grep/providers/types.cjs.map +1 -0
  115. package/dist/tools/warp_grep/providers/types.js +1 -0
  116. package/dist/tools/warp_grep/providers/types.js.map +1 -0
  117. package/dist/tools/warp_grep/tools/analyse.cjs +40 -0
  118. package/dist/tools/warp_grep/tools/analyse.cjs.map +1 -0
  119. package/dist/tools/warp_grep/tools/analyse.js +8 -0
  120. package/dist/tools/warp_grep/tools/analyse.js.map +1 -0
  121. package/dist/tools/warp_grep/tools/finish.cjs +69 -0
  122. package/dist/tools/warp_grep/tools/finish.cjs.map +1 -0
  123. package/dist/tools/warp_grep/tools/finish.js +10 -0
  124. package/dist/tools/warp_grep/tools/finish.js.map +1 -0
  125. package/dist/tools/warp_grep/tools/grep.cjs +35 -0
  126. package/dist/tools/warp_grep/tools/grep.cjs.map +1 -0
  127. package/dist/tools/warp_grep/tools/grep.js +12 -0
  128. package/dist/tools/warp_grep/tools/grep.js.map +1 -0
  129. package/dist/tools/warp_grep/tools/read.cjs +34 -0
  130. package/dist/tools/warp_grep/tools/read.cjs.map +1 -0
  131. package/dist/tools/warp_grep/tools/read.js +8 -0
  132. package/dist/tools/warp_grep/tools/read.js.map +1 -0
  133. package/dist/tools/warp_grep/utils/files.cjs +45 -0
  134. package/dist/tools/warp_grep/utils/files.cjs.map +1 -0
  135. package/dist/tools/warp_grep/utils/files.js +8 -0
  136. package/dist/tools/warp_grep/utils/files.js.map +1 -0
  137. package/dist/tools/warp_grep/utils/format.cjs +42 -0
  138. package/dist/tools/warp_grep/utils/format.cjs.map +1 -0
  139. package/dist/tools/warp_grep/utils/format.js +18 -0
  140. package/dist/tools/warp_grep/utils/format.js.map +1 -0
  141. package/dist/tools/warp_grep/utils/paths.cjs +91 -0
  142. package/dist/tools/warp_grep/utils/paths.cjs.map +1 -0
  143. package/dist/tools/warp_grep/utils/paths.js +16 -0
  144. package/dist/tools/warp_grep/utils/paths.js.map +1 -0
  145. package/dist/tools/warp_grep/utils/ripgrep.cjs +50 -0
  146. package/dist/tools/warp_grep/utils/ripgrep.cjs.map +1 -0
  147. package/dist/tools/warp_grep/utils/ripgrep.js +8 -0
  148. package/dist/tools/warp_grep/utils/ripgrep.js.map +1 -0
  149. package/dist/tools/warp_grep/vercel.cjs +968 -0
  150. package/dist/tools/warp_grep/vercel.cjs.map +1 -0
  151. package/dist/tools/warp_grep/vercel.js +22 -0
  152. package/dist/tools/warp_grep/vercel.js.map +1 -0
  153. package/package.json +23 -3
  154. package/dist/anthropic-CknfcMoO.d.ts +0 -64
  155. package/dist/chunk-VJK4PH5V.js.map +0 -1
  156. package/dist/client.d.ts +0 -114
  157. package/dist/git/client.d.ts +0 -255
  158. package/dist/git/config.d.ts +0 -11
  159. package/dist/git/index.d.ts +0 -5
  160. package/dist/git/types.d.ts +0 -102
  161. package/dist/index.d.ts +0 -14
  162. package/dist/modelrouter/core.d.ts +0 -56
  163. package/dist/modelrouter/index.d.ts +0 -2
  164. package/dist/modelrouter/types.d.ts +0 -35
  165. package/dist/openai-BkKsS30n.d.ts +0 -111
  166. package/dist/tools/browser/anthropic.d.ts +0 -51
  167. package/dist/tools/browser/core.d.ts +0 -196
  168. package/dist/tools/browser/index.d.ts +0 -72
  169. package/dist/tools/browser/openai.d.ts +0 -69
  170. package/dist/tools/browser/prompts.d.ts +0 -7
  171. package/dist/tools/browser/types.d.ts +0 -227
  172. package/dist/tools/browser/vercel.d.ts +0 -69
  173. package/dist/tools/codebase_search/anthropic.d.ts +0 -40
  174. package/dist/tools/codebase_search/core.d.ts +0 -40
  175. package/dist/tools/codebase_search/index.d.ts +0 -10
  176. package/dist/tools/codebase_search/openai.d.ts +0 -87
  177. package/dist/tools/codebase_search/prompts.d.ts +0 -7
  178. package/dist/tools/codebase_search/types.d.ts +0 -46
  179. package/dist/tools/codebase_search/vercel.d.ts +0 -65
  180. package/dist/tools/fastapply/anthropic.d.ts +0 -4
  181. package/dist/tools/fastapply/core.d.ts +0 -41
  182. package/dist/tools/fastapply/index.d.ts +0 -10
  183. package/dist/tools/fastapply/openai.d.ts +0 -4
  184. package/dist/tools/fastapply/prompts.d.ts +0 -7
  185. package/dist/tools/fastapply/types.d.ts +0 -77
  186. package/dist/tools/fastapply/vercel.d.ts +0 -4
  187. package/dist/tools/index.d.ts +0 -10
  188. package/dist/tools/utils/resilience.d.ts +0 -58
  189. package/dist/vercel-B1GZ_g9N.d.ts +0 -69
  190. /package/dist/{chunk-BILUTNBC.js.map → chunk-4A7UBGLS.js.map} +0 -0
  191. /package/dist/{chunk-34F3D6JD.js.map → chunk-HWJN5AMA.js.map} +0 -0
  192. /package/dist/{chunk-WXBUVKYL.js.map → chunk-WHZQDTM6.js.map} +0 -0
  193. /package/dist/{chunk-YVGRWE7D.js.map → chunk-Y2IY7NYY.js.map} +0 -0
@@ -1,255 +0,0 @@
1
- import { MorphGitConfig, CloneOptions, PushOptions, PullOptions, AddOptions, CommitOptions, StatusOptions, LogOptions, CommitObject, CheckoutOptions, BranchOptions, StatusResult, CommitMetadata } from './types.js';
2
- import 'isomorphic-git';
3
- import 'isomorphic-git/http/node';
4
- import '../tools/utils/resilience.js';
5
-
6
- /**
7
- * Morph Git Client - Simple, high-level Git operations
8
- * Built on isomorphic-git with explicit configuration
9
- */
10
-
11
- /**
12
- * MorphGit - Git operations for AI agents with Morph backend
13
- *
14
- * @example
15
- * ```typescript
16
- * import { MorphGit } from 'morphsdk/git';
17
- *
18
- * const morphGit = new MorphGit({
19
- * apiKey: process.env.MORPH_API_KEY!,
20
- * proxyUrl: 'https://repos.morphllm.com' // Optional
21
- * });
22
- *
23
- * await morphGit.init({ repoId: 'my-project', dir: './my-project' });
24
- * await morphGit.push({ dir: './my-project' });
25
- * ```
26
- */
27
- declare class MorphGit {
28
- private readonly apiKey;
29
- private readonly proxyUrl;
30
- constructor(config: MorphGitConfig);
31
- /**
32
- * Get auth callback for isomorphic-git operations
33
- * @private
34
- */
35
- private getAuthCallback;
36
- /**
37
- * Initialize a new repository
38
- * Creates the repo in the database and in the git provider
39
- *
40
- * @example
41
- * ```ts
42
- * await morphGit.init({
43
- * repoId: 'my-project',
44
- * dir: './my-project',
45
- * defaultBranch: 'main'
46
- * });
47
- * ```
48
- */
49
- init(options: {
50
- repoId: string;
51
- dir: string;
52
- defaultBranch?: string;
53
- }): Promise<void>;
54
- /**
55
- * Clone a repository from Morph repos
56
- *
57
- * @example
58
- * ```ts
59
- * await morphGit.clone({
60
- * repoId: 'my-project',
61
- * dir: './my-project'
62
- * });
63
- * ```
64
- */
65
- clone(options: CloneOptions): Promise<void>;
66
- /**
67
- * Push changes to remote repository
68
- *
69
- * @example
70
- * ```ts
71
- * await morphGit.push({ dir: './my-project' });
72
- * ```
73
- */
74
- push(options: PushOptions): Promise<void>;
75
- /**
76
- * Pull changes from remote repository
77
- *
78
- * @example
79
- * ```ts
80
- * await morphGit.pull({ dir: './my-project' });
81
- * ```
82
- */
83
- pull(options: PullOptions): Promise<void>;
84
- /**
85
- * Stage a file for commit
86
- *
87
- * @example
88
- * ```ts
89
- * await morphGit.add({
90
- * dir: './my-project',
91
- * filepath: 'src/app.ts'
92
- * });
93
- * ```
94
- */
95
- add(options: AddOptions): Promise<void>;
96
- /**
97
- * Remove a file from staging
98
- *
99
- * @example
100
- * ```ts
101
- * await morphGit.remove({
102
- * dir: './my-project',
103
- * filepath: 'src/old-file.ts'
104
- * });
105
- * ```
106
- */
107
- remove(options: AddOptions): Promise<void>;
108
- /**
109
- * Commit staged changes
110
- *
111
- * @example
112
- * ```ts
113
- * await morphGit.commit({
114
- * dir: './my-project',
115
- * message: 'Add new feature',
116
- * author: {
117
- * name: 'AI Agent',
118
- * email: 'ai@example.com'
119
- * },
120
- * chatHistory: [
121
- * { role: 'user', content: 'Please add a new feature' },
122
- * { role: 'assistant', content: 'I will add that feature' }
123
- * ],
124
- * recordingId: 'rec_123'
125
- * });
126
- * ```
127
- */
128
- commit(options: CommitOptions): Promise<string>;
129
- /**
130
- * Get status of a file
131
- *
132
- * @example
133
- * ```ts
134
- * const status = await morphGit.status({
135
- * dir: './my-project',
136
- * filepath: 'src/app.ts'
137
- * });
138
- * console.log(status); // 'modified', '*added', etc.
139
- * ```
140
- */
141
- status(options: StatusOptions): Promise<string>;
142
- /**
143
- * Get commit history
144
- *
145
- * @example
146
- * ```ts
147
- * const commits = await morphGit.log({
148
- * dir: './my-project',
149
- * depth: 10
150
- * });
151
- * ```
152
- */
153
- log(options: LogOptions): Promise<CommitObject[]>;
154
- /**
155
- * Checkout a branch or commit
156
- *
157
- * @example
158
- * ```ts
159
- * await morphGit.checkout({
160
- * dir: './my-project',
161
- * ref: 'feature-branch'
162
- * });
163
- * ```
164
- */
165
- checkout(options: CheckoutOptions): Promise<void>;
166
- /**
167
- * Create a new branch
168
- *
169
- * @example
170
- * ```ts
171
- * await morphGit.branch({
172
- * dir: './my-project',
173
- * name: 'feature-branch',
174
- * checkout: true
175
- * });
176
- * ```
177
- */
178
- branch(options: BranchOptions): Promise<void>;
179
- /**
180
- * List all branches
181
- *
182
- * @example
183
- * ```ts
184
- * const branches = await morphGit.listBranches({
185
- * dir: './my-project'
186
- * });
187
- * ```
188
- */
189
- listBranches(options: {
190
- dir: string;
191
- }): Promise<string[]>;
192
- /**
193
- * Get the current branch name
194
- *
195
- * @example
196
- * ```ts
197
- * const branch = await morphGit.currentBranch({
198
- * dir: './my-project'
199
- * });
200
- * ```
201
- */
202
- currentBranch(options: {
203
- dir: string;
204
- }): Promise<string | undefined>;
205
- /**
206
- * Get list of changed files (similar to git diff --name-only)
207
- *
208
- * @example
209
- * ```ts
210
- * const changes = await morphGit.statusMatrix({
211
- * dir: './my-project'
212
- * });
213
- * ```
214
- */
215
- statusMatrix(options: {
216
- dir: string;
217
- }): Promise<StatusResult[]>;
218
- /**
219
- * Get the current commit hash
220
- *
221
- * @example
222
- * ```ts
223
- * const hash = await morphGit.resolveRef({
224
- * dir: './my-project',
225
- * ref: 'HEAD'
226
- * });
227
- * ```
228
- */
229
- resolveRef(options: {
230
- dir: string;
231
- ref: string;
232
- }): Promise<string>;
233
- /**
234
- * Get metadata (chat history, recording ID) attached to a commit
235
- *
236
- * @example
237
- * ```ts
238
- * const metadata = await morphGit.getCommitMetadata({
239
- * dir: './my-project',
240
- * commitSha: 'abc123...'
241
- * });
242
- *
243
- * if (metadata) {
244
- * console.log('Chat history:', metadata.chatHistory);
245
- * console.log('Recording ID:', metadata.recordingId);
246
- * }
247
- * ```
248
- */
249
- getCommitMetadata(options: {
250
- dir: string;
251
- commitSha: string;
252
- }): Promise<CommitMetadata | null>;
253
- }
254
-
255
- export { MorphGit };
@@ -1,11 +0,0 @@
1
- /**
2
- * Configuration constants for Morph Git SDK
3
- */
4
- /** Default proxy URL for Morph git operations */
5
- declare const DEFAULT_PROXY_URL = "https://repos.morphllm.com";
6
- /**
7
- * Validate API key format
8
- */
9
- declare function validateApiKey(apiKey: string): void;
10
-
11
- export { DEFAULT_PROXY_URL, validateApiKey };
@@ -1,5 +0,0 @@
1
- export { MorphGit } from './client.js';
2
- export { AddOptions, BranchOptions, ChatMessage, CheckoutOptions, CloneOptions, CommitMetadata, CommitObject, CommitOptions, DiffOptions, LogOptions, MorphGitConfig, PullOptions, PushOptions, StatusOptions, StatusResult } from './types.js';
3
- export { default as git } from 'isomorphic-git';
4
- export { default as http } from 'isomorphic-git/http/node';
5
- import '../tools/utils/resilience.js';
@@ -1,102 +0,0 @@
1
- import { RetryConfig } from '../tools/utils/resilience.js';
2
-
3
- /**
4
- * Types for Morph Git SDK
5
- */
6
-
7
- interface MorphGitConfig {
8
- apiKey?: string;
9
- proxyUrl?: string;
10
- /** Retry configuration for API calls */
11
- retryConfig?: RetryConfig;
12
- }
13
- interface CloneOptions {
14
- repoId: string;
15
- dir: string;
16
- branch?: string;
17
- depth?: number;
18
- singleBranch?: boolean;
19
- }
20
- interface PushOptions {
21
- dir: string;
22
- remote?: string;
23
- branch?: string;
24
- }
25
- interface PullOptions {
26
- dir: string;
27
- remote?: string;
28
- branch?: string;
29
- }
30
- interface AddOptions {
31
- dir: string;
32
- filepath: string;
33
- }
34
- interface ChatMessage {
35
- role: string;
36
- content: string;
37
- [key: string]: any;
38
- }
39
- interface CommitMetadata {
40
- chatHistory?: ChatMessage[];
41
- recordingId?: string;
42
- }
43
- interface CommitOptions {
44
- dir: string;
45
- message: string;
46
- author?: {
47
- name: string | "Morph AI Agent";
48
- email: string | "ai@morphllm.com";
49
- };
50
- chatHistory?: ChatMessage[];
51
- recordingId?: string;
52
- }
53
- interface StatusOptions {
54
- dir: string;
55
- filepath?: string;
56
- }
57
- interface LogOptions {
58
- dir: string;
59
- depth?: number;
60
- ref?: string;
61
- }
62
- interface CheckoutOptions {
63
- dir: string;
64
- ref: string;
65
- }
66
- interface BranchOptions {
67
- dir: string;
68
- name: string;
69
- checkout?: boolean;
70
- }
71
- interface DiffOptions {
72
- dir: string;
73
- ref1?: string;
74
- ref2?: string;
75
- filepath?: string;
76
- }
77
- interface GitUser {
78
- name: string;
79
- email: string;
80
- }
81
- interface CommitObject {
82
- oid: string;
83
- commit: {
84
- message: string;
85
- author: {
86
- name: string | "Morph AI Agent";
87
- email: string | "ai@morphllm.com";
88
- timestamp: number;
89
- };
90
- committer: {
91
- name: string | "Morph AI Agent";
92
- email: string | "ai@morphllm.com";
93
- timestamp: number;
94
- };
95
- };
96
- }
97
- interface StatusResult {
98
- filepath: string;
99
- status: 'unmodified' | 'modified' | '*modified' | 'added' | '*added' | 'deleted' | '*deleted' | 'absent';
100
- }
101
-
102
- export type { AddOptions, BranchOptions, ChatMessage, CheckoutOptions, CloneOptions, CommitMetadata, CommitObject, CommitOptions, DiffOptions, GitUser, LogOptions, MorphGitConfig, PullOptions, PushOptions, StatusOptions, StatusResult };
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export { MorphClient, MorphClientConfig } from './client.js';
2
- export { FastApplyClient } from './tools/fastapply/core.js';
3
- export { CodebaseSearchClient } from './tools/codebase_search/core.js';
4
- export { BrowserClient } from './tools/browser/core.js';
5
- export { MorphGit } from './git/client.js';
6
- export { MorphGitConfig } from './git/types.js';
7
- export { AnthropicRouter, GeminiRouter, OpenAIRouter } from './modelrouter/core.js';
8
- export { EditFileConfig, EditFileInput, EditFileResult } from './tools/fastapply/types.js';
9
- export { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
10
- export { BrowserConfig, BrowserError, BrowserTaskInput, BrowserTaskInputWithSchema, BrowserTaskResult, BrowserTaskWithPromise, BrowserTaskWithPromiseAndSchema, ErrorsResponse, RecordingStatus } from './tools/browser/types.js';
11
- export { ComplexityLevel, Provider, RouterConfig, RouterInput, RouterMode, RouterResult } from './modelrouter/types.js';
12
- export { RetryConfig } from './tools/utils/resilience.js';
13
- import 'isomorphic-git';
14
- import 'isomorphic-git/http/node';
@@ -1,56 +0,0 @@
1
- import { RouterConfig, Provider, RouterInput, RouterResult } from './types.js';
2
-
3
- /**
4
- * Core implementation for intelligent model routing
5
- */
6
-
7
- declare abstract class BaseRouter {
8
- protected config: Required<Omit<RouterConfig, 'apiKey' | 'retryConfig'>> & Pick<RouterConfig, 'apiKey' | 'retryConfig'>;
9
- protected provider: Provider;
10
- constructor(provider: Provider, config?: RouterConfig);
11
- /**
12
- * Select the optimal model for a given input and mode
13
- */
14
- selectModel(input: RouterInput): Promise<RouterResult>;
15
- }
16
- /**
17
- * OpenAI model router for GPT-5 series
18
- */
19
- declare class OpenAIRouter extends BaseRouter {
20
- constructor(config?: RouterConfig);
21
- /**
22
- * Select optimal GPT-5 model
23
- *
24
- * @param input - User input and mode
25
- * @returns Selected model name (gpt-5-mini | gpt-5-low | gpt-5-medium | gpt-5-high)
26
- */
27
- selectModel(input: RouterInput): Promise<RouterResult>;
28
- }
29
- /**
30
- * Anthropic model router for Claude 4.5 series
31
- */
32
- declare class AnthropicRouter extends BaseRouter {
33
- constructor(config?: RouterConfig);
34
- /**
35
- * Select optimal Claude model
36
- *
37
- * @param input - User input and mode
38
- * @returns Selected model name (claude-4.5-haiku | claude-4.5-sonnet)
39
- */
40
- selectModel(input: RouterInput): Promise<RouterResult>;
41
- }
42
- /**
43
- * Google Gemini model router
44
- */
45
- declare class GeminiRouter extends BaseRouter {
46
- constructor(config?: RouterConfig);
47
- /**
48
- * Select optimal Gemini model
49
- *
50
- * @param input - User input and mode
51
- * @returns Selected model name (gemini-2.5-flash | gemini-2.5-pro)
52
- */
53
- selectModel(input: RouterInput): Promise<RouterResult>;
54
- }
55
-
56
- export { AnthropicRouter, GeminiRouter, OpenAIRouter };
@@ -1,2 +0,0 @@
1
- export { AnthropicRouter, GeminiRouter, OpenAIRouter } from './core.js';
2
- export { ComplexityLevel, Provider, RouterConfig, RouterInput, RouterMode, RouterResult } from './types.js';
@@ -1,35 +0,0 @@
1
- /**
2
- * Model router types for intelligent model selection
3
- */
4
- type ComplexityLevel = 'easy' | 'medium' | 'hard' | 'needs-info';
5
- type RouterMode = 'balanced' | 'aggressive';
6
- type Provider = 'openai' | 'anthropic' | 'gemini';
7
- interface RouterConfig {
8
- /** Morph API key (defaults to MORPH_API_KEY env var) */
9
- apiKey?: string;
10
- /** Router API URL (defaults to https://api.morphllm.com) */
11
- apiUrl?: string;
12
- /** Request timeout in milliseconds (default: 10000) */
13
- timeout?: number;
14
- /** Enable debug logging */
15
- debug?: boolean;
16
- /** Retry configuration */
17
- retryConfig?: {
18
- maxRetries?: number;
19
- initialDelay?: number;
20
- maxDelay?: number;
21
- backoffMultiplier?: number;
22
- };
23
- }
24
- interface RouterInput {
25
- /** User input or task description */
26
- input: string;
27
- /** Routing mode: balanced (cheaper models) or aggressive (more capable models) */
28
- mode?: RouterMode;
29
- }
30
- interface RouterResult {
31
- /** Selected model name */
32
- model: string;
33
- }
34
-
35
- export type { ComplexityLevel, Provider, RouterConfig, RouterInput, RouterMode, RouterResult };
@@ -1,111 +0,0 @@
1
- import { ChatCompletionTool } from 'openai/resources/chat/completions';
2
- import { EditFileInput, EditFileConfig, EditFileResult } from './tools/fastapply/types.js';
3
-
4
- /**
5
- * OpenAI SDK adapter for edit_file tool
6
- */
7
-
8
- /**
9
- * OpenAI-native tool definition for edit_file
10
- *
11
- * @example
12
- * ```ts
13
- * import OpenAI from 'openai';
14
- * import { editFileTool } from 'morphsdk/tools/openai';
15
- *
16
- * const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
17
- *
18
- * const response = await client.chat.completions.create({
19
- * model: "gpt-4o",
20
- * tools: [editFileTool],
21
- * messages: [{ role: "user", content: "Fix the bug in app.ts" }]
22
- * });
23
- * ```
24
- */
25
- declare const editFileTool: ChatCompletionTool;
26
- /**
27
- * Execute an edit_file tool call
28
- *
29
- * @param input - The tool input from GPT (parsed from tool_calls)
30
- * @param config - Optional configuration
31
- * @returns The result of the edit operation
32
- *
33
- * @example
34
- * ```ts
35
- * const args = JSON.parse(toolCall.function.arguments);
36
- * const result = await execute(args);
37
- * console.log('Changes applied:', result.udiff);
38
- * ```
39
- */
40
- declare function execute(input: EditFileInput, config?: EditFileConfig): Promise<EditFileResult>;
41
- /**
42
- * Get the system prompt for edit_file usage
43
- *
44
- * Add this to your system message to guide GPT on using edit_file properly.
45
- *
46
- * @example
47
- * ```ts
48
- * const response = await client.chat.completions.create({
49
- * model: "gpt-4o",
50
- * messages: [
51
- * { role: "system", content: getSystemPrompt() },
52
- * { role: "user", content: "Fix bugs" }
53
- * ],
54
- * tools: [editFileTool]
55
- * });
56
- * ```
57
- */
58
- declare function getSystemPrompt(): string;
59
- /**
60
- * Format the result for passing back to GPT
61
- *
62
- * @param result - The edit result
63
- * @returns Formatted string for tool message
64
- */
65
- declare function formatResult(result: EditFileResult): string;
66
- /**
67
- * Create a custom edit_file tool with configuration and methods
68
- *
69
- * @param config - Configuration options
70
- * @returns Tool definition with execute and formatResult methods
71
- *
72
- * @example
73
- * ```ts
74
- * import OpenAI from 'openai';
75
- * import { createEditFileTool } from 'morphsdk/tools/fastapply/openai';
76
- *
77
- * const tool = createEditFileTool({
78
- * baseDir: './src',
79
- * generateUdiff: true,
80
- * description: 'Custom tool description for your use case'
81
- * });
82
- *
83
- * const client = new OpenAI();
84
- *
85
- * const response = await client.chat.completions.create({
86
- * model: 'gpt-4o',
87
- * tools: [tool], // tool itself is the ChatCompletionTool
88
- * messages: [{ role: 'user', content: 'Fix bug in app.ts' }]
89
- * });
90
- *
91
- * // Execute and format
92
- * const result = await tool.execute(toolCallArgs);
93
- * const formatted = tool.formatResult(result);
94
- * ```
95
- */
96
- declare function createEditFileTool(config?: EditFileConfig): ChatCompletionTool & {
97
- execute: (input: EditFileInput | string) => Promise<EditFileResult>;
98
- formatResult: (result: EditFileResult) => string;
99
- getSystemPrompt: () => string;
100
- };
101
-
102
- declare const openai_createEditFileTool: typeof createEditFileTool;
103
- declare const openai_editFileTool: typeof editFileTool;
104
- declare const openai_execute: typeof execute;
105
- declare const openai_formatResult: typeof formatResult;
106
- declare const openai_getSystemPrompt: typeof getSystemPrompt;
107
- declare namespace openai {
108
- export { openai_createEditFileTool as createEditFileTool, editFileTool as default, openai_editFileTool as editFileTool, openai_execute as execute, openai_formatResult as formatResult, openai_getSystemPrompt as getSystemPrompt };
109
- }
110
-
111
- export { execute as a, createEditFileTool as c, editFileTool as e, formatResult as f, getSystemPrompt as g, openai as o };
@@ -1,51 +0,0 @@
1
- import { Tool } from '@anthropic-ai/sdk/resources/messages.mjs';
2
- import { BrowserConfig, BrowserTaskInput, BrowserTaskResult } from './types.js';
3
- import '../utils/resilience.js';
4
-
5
- /**
6
- * Anthropic SDK adapter for browser automation tool
7
- */
8
-
9
- /**
10
- * Anthropic tool definition for browser automation
11
- */
12
- declare const browserTool: Tool;
13
- /**
14
- * Create a configured browser tool with execute and formatResult methods
15
- *
16
- * @param config - Browser worker configuration
17
- * @returns Tool definition with execute and formatResult methods
18
- *
19
- * @example
20
- * ```typescript
21
- * import Anthropic from '@anthropic-ai/sdk';
22
- * import { createBrowserTool } from 'morphsdk/tools/browser/anthropic';
23
- *
24
- * const tool = createBrowserTool({
25
- * apiKey: process.env.MORPH_API_KEY,
26
- * timeout: 180000
27
- * });
28
- *
29
- * const client = new Anthropic();
30
- *
31
- * const response = await client.messages.create({
32
- * model: 'claude-sonnet-4-5-20250929',
33
- * tools: [tool], // tool itself is the Tool definition
34
- * messages: [{
35
- * role: 'user',
36
- * content: 'Test the checkout flow at https://3000-abc.e2b.dev'
37
- * }]
38
- * });
39
- *
40
- * // Execute and format
41
- * const result = await tool.execute(toolUseBlock.input);
42
- * const formatted = tool.formatResult(result);
43
- * ```
44
- */
45
- declare function createBrowserTool(config?: BrowserConfig): Tool & {
46
- execute: (input: BrowserTaskInput) => Promise<BrowserTaskResult>;
47
- formatResult: (result: BrowserTaskResult) => string;
48
- getSystemPrompt: () => string;
49
- };
50
-
51
- export { browserTool, createBrowserTool };