@morphllm/morphsdk 0.2.18 → 0.2.19

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 (53) hide show
  1. package/dist/anthropic-CknfcMoO.d.ts +64 -0
  2. package/dist/{chunk-UFIIEUGW.js → chunk-OSJBHKA2.js} +9 -9
  3. package/dist/{chunk-VONZKK4S.js → chunk-YVGRWE7D.js} +1 -1
  4. package/dist/chunk-YVGRWE7D.js.map +1 -0
  5. package/dist/client.d.ts +114 -0
  6. package/dist/client.js +4 -4
  7. package/dist/git/client.d.ts +230 -0
  8. package/dist/git/config.d.ts +11 -0
  9. package/dist/git/index.d.ts +5 -0
  10. package/dist/git/types.d.ts +91 -0
  11. package/dist/index.d.ts +14 -0
  12. package/dist/index.js +10 -10
  13. package/dist/modelrouter/core.d.ts +56 -0
  14. package/dist/modelrouter/index.d.ts +2 -0
  15. package/dist/modelrouter/types.d.ts +35 -0
  16. package/dist/openai-BkKsS30n.d.ts +111 -0
  17. package/dist/tools/browser/anthropic.d.ts +51 -0
  18. package/dist/tools/browser/core.d.ts +196 -0
  19. package/dist/tools/browser/index.d.ts +72 -0
  20. package/dist/tools/browser/openai.d.ts +69 -0
  21. package/dist/tools/browser/prompts.d.ts +7 -0
  22. package/dist/tools/browser/types.d.ts +227 -0
  23. package/dist/tools/browser/vercel.cjs +1 -1
  24. package/dist/tools/browser/vercel.cjs.map +1 -1
  25. package/dist/tools/browser/vercel.d.ts +69 -0
  26. package/dist/tools/browser/vercel.js +1 -1
  27. package/dist/tools/browser/vercel.js.map +1 -1
  28. package/dist/tools/codebase_search/anthropic.d.ts +40 -0
  29. package/dist/tools/codebase_search/core.d.ts +40 -0
  30. package/dist/tools/codebase_search/index.cjs.map +1 -1
  31. package/dist/tools/codebase_search/index.d.ts +10 -0
  32. package/dist/tools/codebase_search/index.js +4 -4
  33. package/dist/tools/codebase_search/openai.d.ts +87 -0
  34. package/dist/tools/codebase_search/prompts.d.ts +7 -0
  35. package/dist/tools/codebase_search/types.d.ts +46 -0
  36. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  37. package/dist/tools/codebase_search/vercel.d.ts +65 -0
  38. package/dist/tools/codebase_search/vercel.js +1 -1
  39. package/dist/tools/fastapply/anthropic.d.ts +4 -0
  40. package/dist/tools/fastapply/core.d.ts +41 -0
  41. package/dist/tools/fastapply/index.d.ts +10 -0
  42. package/dist/tools/fastapply/index.js +3 -3
  43. package/dist/tools/fastapply/openai.d.ts +4 -0
  44. package/dist/tools/fastapply/prompts.d.ts +7 -0
  45. package/dist/tools/fastapply/types.d.ts +77 -0
  46. package/dist/tools/fastapply/vercel.d.ts +4 -0
  47. package/dist/tools/index.d.ts +10 -0
  48. package/dist/tools/index.js +3 -3
  49. package/dist/tools/utils/resilience.d.ts +58 -0
  50. package/dist/vercel-B1GZ_g9N.d.ts +69 -0
  51. package/package.json +1 -1
  52. package/dist/chunk-VONZKK4S.js.map +0 -1
  53. /package/dist/{chunk-UFIIEUGW.js.map → chunk-OSJBHKA2.js.map} +0 -0
@@ -0,0 +1,64 @@
1
+ import { Tool } from '@anthropic-ai/sdk/resources/messages';
2
+ import { EditFileConfig, EditFileInput, EditFileResult } from './tools/fastapply/types.js';
3
+
4
+ /**
5
+ * Anthropic SDK adapter for edit_file tool
6
+ */
7
+
8
+ /**
9
+ * Anthropic-native tool definition for edit_file
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import Anthropic from '@anthropic-ai/sdk';
14
+ * import { editFileTool } from 'morphsdk/tools/anthropic';
15
+ *
16
+ * const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
17
+ *
18
+ * const response = await client.messages.create({
19
+ * model: "claude-sonnet-4-5-20250929",
20
+ * tools: [editFileTool],
21
+ * messages: [{ role: "user", content: "Fix the bug in app.ts" }]
22
+ * });
23
+ * ```
24
+ */
25
+ declare const editFileTool: Tool;
26
+ /**
27
+ * Create a custom edit_file tool with configuration
28
+ *
29
+ * @param config - Configuration options
30
+ * @returns Tool definition with execute and formatResult methods
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const tool = createEditFileTool({
35
+ * baseDir: './src',
36
+ * generateUdiff: true,
37
+ * morphApiKey: 'sk-...',
38
+ * description: 'Custom tool description for your use case'
39
+ * });
40
+ *
41
+ * // Use as Anthropic tool
42
+ * const response = await client.messages.create({
43
+ * tools: [tool], // tool itself is the Tool definition
44
+ * ...
45
+ * });
46
+ *
47
+ * // Execute and format
48
+ * const result = await tool.execute(toolUseBlock.input);
49
+ * const formatted = tool.formatResult(result);
50
+ * ```
51
+ */
52
+ declare function createEditFileTool(config?: EditFileConfig): Tool & {
53
+ execute: (input: EditFileInput) => Promise<EditFileResult>;
54
+ formatResult: (result: EditFileResult) => string;
55
+ getSystemPrompt: () => string;
56
+ };
57
+
58
+ declare const anthropic_createEditFileTool: typeof createEditFileTool;
59
+ declare const anthropic_editFileTool: typeof editFileTool;
60
+ declare namespace anthropic {
61
+ export { anthropic_createEditFileTool as createEditFileTool, anthropic_editFileTool as editFileTool };
62
+ }
63
+
64
+ export { anthropic as a, createEditFileTool as c, editFileTool as e };
@@ -1,20 +1,20 @@
1
1
  import {
2
- MorphGit
3
- } from "./chunk-5VQEQSJQ.js";
2
+ BrowserClient
3
+ } from "./chunk-GPFHYUKV.js";
4
+ import {
5
+ FastApplyClient
6
+ } from "./chunk-Q7USYY6R.js";
4
7
  import {
5
8
  CodebaseSearchClient
6
9
  } from "./chunk-VJK4PH5V.js";
10
+ import {
11
+ MorphGit
12
+ } from "./chunk-5VQEQSJQ.js";
7
13
  import {
8
14
  AnthropicRouter,
9
15
  GeminiRouter,
10
16
  OpenAIRouter
11
17
  } from "./chunk-AKVAAKRB.js";
12
- import {
13
- FastApplyClient
14
- } from "./chunk-Q7USYY6R.js";
15
- import {
16
- BrowserClient
17
- } from "./chunk-GPFHYUKV.js";
18
18
 
19
19
  // client.ts
20
20
  var MorphClient = class {
@@ -94,4 +94,4 @@ var MorphClient = class {
94
94
  export {
95
95
  MorphClient
96
96
  };
97
- //# sourceMappingURL=chunk-UFIIEUGW.js.map
97
+ //# sourceMappingURL=chunk-OSJBHKA2.js.map
@@ -55,4 +55,4 @@ export {
55
55
  getSystemPrompt,
56
56
  vercel_default
57
57
  };
58
- //# sourceMappingURL=chunk-VONZKK4S.js.map
58
+ //# sourceMappingURL=chunk-YVGRWE7D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/codebase_search/vercel.ts"],"sourcesContent":["/**\n * Vercel AI SDK adapter for codebase_search tool\n */\n\nimport { tool } from 'ai';\nimport { z } from 'zod';\nimport { executeCodebaseSearch } from './core.js';\nimport { CODEBASE_SEARCH_DESCRIPTION } from './prompts.js';\nimport type { CodebaseSearchConfig } from './types.js';\n\n/**\n * Create Vercel AI SDK codebase_search tool\n * \n * @param config - Configuration with repoId\n * @returns Vercel AI SDK tool definition (execution built-in)\n * \n * @example\n * ```ts\n * import { generateText } from 'ai';\n * import { anthropic } from '@ai-sdk/anthropic';\n * import { createCodebaseSearchTool } from 'morphsdk/tools/codebase-search/vercel';\n * \n * const tool = createCodebaseSearchTool({ repoId: 'my-project' });\n * \n * const result = await generateText({\n * model: anthropic('claude-3-5-sonnet-20241022'),\n * tools: { codebaseSearch: tool },\n * prompt: \"Find authentication code\",\n * maxSteps: 5\n * });\n * \n * // Vercel AI SDK automatically executes and handles results\n * console.log(result.text);\n * ```\n */\nexport function createCodebaseSearchTool(config: CodebaseSearchConfig) {\n const schema = z.object({\n query: z.string().describe('A complete question about what you want to understand. Ask as if talking to a colleague: \"How does X work?\", \"What happens when Y?\", \"Where is Z handled?\"'),\n target_directories: z.array(z.string()).describe('Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo.'),\n explanation: z.string().describe('One sentence explanation as to why this tool is being used, and how it contributes to the goal.'),\n limit: z.number().optional().describe('Max results to return (default: 10)'),\n });\n\n return tool({\n description: CODEBASE_SEARCH_DESCRIPTION,\n inputSchema: schema,\n execute: async (params) => {\n const { query, target_directories, explanation, limit } = params;\n const result = await executeCodebaseSearch(\n { query, target_directories, explanation, limit },\n config\n );\n\n if (!result.success) {\n return {\n error: result.error,\n results: [],\n };\n }\n\n // Format results for Vercel AI SDK\n return {\n found: result.results.length,\n searchTime: `${result.stats.searchTimeMs}ms`,\n results: result.results.map(r => ({\n file: r.filepath,\n symbol: r.symbolPath,\n lines: `${r.startLine}-${r.endLine}`,\n language: r.language,\n relevance: `${(r.rerankScore * 100).toFixed(1)}%`,\n code: r.content,\n })),\n };\n },\n });\n}\n\n/**\n * Get system prompt for Vercel AI SDK\n */\nexport function getSystemPrompt(): string {\n return CODEBASE_SEARCH_DESCRIPTION;\n}\n\n/**\n * Default export\n */\nexport default { createCodebaseSearchTool, getSystemPrompt };\n\n"],"mappings":";;;;;;;;AAIA,SAAS,YAAY;AACrB,SAAS,SAAS;AA8BX,SAAS,yBAAyB,QAA8B;AACrE,QAAM,SAAS,EAAE,OAAO;AAAA,IACtB,OAAO,EAAE,OAAO,EAAE,SAAS,4JAA4J;AAAA,IACvL,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,uHAAuH;AAAA,IACxK,aAAa,EAAE,OAAO,EAAE,SAAS,iGAAiG;AAAA,IAClI,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,qCAAqC;AAAA,EAC7E,CAAC;AAED,SAAO,KAAK;AAAA,IACV,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS,OAAO,WAAW;AACzB,YAAM,EAAE,OAAO,oBAAoB,aAAa,MAAM,IAAI;AAC1D,YAAM,SAAS,MAAM;AAAA,QACnB,EAAE,OAAO,oBAAoB,aAAa,MAAM;AAAA,QAChD;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,SAAS;AACnB,eAAO;AAAA,UACL,OAAO,OAAO;AAAA,UACd,SAAS,CAAC;AAAA,QACZ;AAAA,MACF;AAGA,aAAO;AAAA,QACL,OAAO,OAAO,QAAQ;AAAA,QACtB,YAAY,GAAG,OAAO,MAAM,YAAY;AAAA,QACxC,SAAS,OAAO,QAAQ,IAAI,QAAM;AAAA,UAChC,MAAM,EAAE;AAAA,UACR,QAAQ,EAAE;AAAA,UACV,OAAO,GAAG,EAAE,SAAS,IAAI,EAAE,OAAO;AAAA,UAClC,UAAU,EAAE;AAAA,UACZ,WAAW,IAAI,EAAE,cAAc,KAAK,QAAQ,CAAC,CAAC;AAAA,UAC9C,MAAM,EAAE;AAAA,QACV,EAAE;AAAA,MACJ;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAKO,SAAS,kBAA0B;AACxC,SAAO;AACT;AAKA,IAAO,iBAAQ,EAAE,0BAA0B,gBAAgB;","names":[]}
@@ -0,0 +1,114 @@
1
+ import { RetryConfig } from './tools/utils/resilience.js';
2
+ import { FastApplyClient } from './tools/fastapply/core.js';
3
+ import { CodebaseSearchClient } from './tools/codebase_search/core.js';
4
+ import { BrowserClient } from './tools/browser/core.js';
5
+ import { MorphGit } from './git/client.js';
6
+ import { OpenAIRouter, AnthropicRouter, GeminiRouter } from './modelrouter/core.js';
7
+ import './git/types.js';
8
+ import './tools/fastapply/types.js';
9
+ import './tools/codebase_search/types.js';
10
+ import './tools/browser/types.js';
11
+ import './modelrouter/types.js';
12
+ import 'isomorphic-git';
13
+ import 'isomorphic-git/http/node';
14
+
15
+ /**
16
+ * Unified Morph SDK Client
17
+ *
18
+ * Provides access to all Morph tools through a single interface
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { MorphClient } from '@cuda_oom/morphsdk';
23
+ *
24
+ * const morph = new MorphClient({
25
+ * apiKey: process.env.MORPH_API_KEY,
26
+ * debug: true,
27
+ * timeout: 60000
28
+ * });
29
+ *
30
+ * // Use FastApply
31
+ * const editResult = await morph.fastApply.execute({
32
+ * target_filepath: 'src/index.ts',
33
+ * instructions: 'Add error handling',
34
+ * code_edit: 'try { ... } catch (e) { ... }'
35
+ * });
36
+ *
37
+ * // Use CodebaseSearch
38
+ * const searchResult = await morph.codebaseSearch.search({
39
+ * query: 'authentication logic',
40
+ * repoId: 'my-project'
41
+ * });
42
+ *
43
+ * // Use Browser automation
44
+ * const browserResult = await morph.browser.execute({
45
+ * task: 'Test the checkout flow',
46
+ * url: 'https://example.com'
47
+ * });
48
+ *
49
+ * // Use Model Router
50
+ * const { model } = await morph.routers.openai.selectModel({
51
+ * input: 'Complex refactoring task',
52
+ * mode: 'balanced'
53
+ * });
54
+ * ```
55
+ */
56
+
57
+ /**
58
+ * Configuration for the MorphClient
59
+ */
60
+ interface MorphClientConfig {
61
+ /** Morph API key for authentication (defaults to MORPH_API_KEY env var) */
62
+ apiKey?: string;
63
+ /** Enable debug logging across all tools */
64
+ debug?: boolean;
65
+ /** Default timeout in milliseconds for API requests */
66
+ timeout?: number;
67
+ /** Retry configuration for failed requests */
68
+ retryConfig?: RetryConfig;
69
+ }
70
+ /**
71
+ * Unified Morph SDK Client
72
+ *
73
+ * Provides access to all Morph tools through a single interface:
74
+ * - fastApply: AI-powered file editing with intelligent merging
75
+ * - codebaseSearch: Semantic code search
76
+ * - browser: AI-powered browser automation
77
+ * - git: Version control operations
78
+ * - routers: Intelligent model selection (OpenAI, Anthropic, Gemini)
79
+ */
80
+ declare class MorphClient {
81
+ /** Client configuration */
82
+ config: MorphClientConfig;
83
+ /** FastApply tool for editing files with AI-powered merge */
84
+ fastApply: FastApplyClient;
85
+ /** CodebaseSearch tool for semantic code search */
86
+ codebaseSearch: CodebaseSearchClient;
87
+ /** Browser tool for AI-powered browser automation */
88
+ browser: BrowserClient;
89
+ /** Git tool for version control operations */
90
+ git: MorphGit;
91
+ /** Model routers for intelligent model selection */
92
+ routers: {
93
+ openai: OpenAIRouter;
94
+ anthropic: AnthropicRouter;
95
+ gemini: GeminiRouter;
96
+ };
97
+ /**
98
+ * Create a new Morph SDK client
99
+ *
100
+ * @param config - Client configuration (apiKey, debug, timeout, retryConfig)
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const morph = new MorphClient({
105
+ * apiKey: process.env.MORPH_API_KEY,
106
+ * debug: true,
107
+ * timeout: 60000
108
+ * });
109
+ * ```
110
+ */
111
+ constructor(config?: MorphClientConfig);
112
+ }
113
+
114
+ export { MorphClient, type MorphClientConfig };
package/dist/client.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-UFIIEUGW.js";
3
+ } from "./chunk-OSJBHKA2.js";
4
+ import "./chunk-GPFHYUKV.js";
5
+ import "./chunk-Q7USYY6R.js";
6
+ import "./chunk-VJK4PH5V.js";
4
7
  import "./chunk-74ZHKB54.js";
5
8
  import "./chunk-5VQEQSJQ.js";
6
- import "./chunk-VJK4PH5V.js";
7
9
  import "./chunk-AKVAAKRB.js";
8
- import "./chunk-Q7USYY6R.js";
9
- import "./chunk-GPFHYUKV.js";
10
10
  import "./chunk-4VWJFZVS.js";
11
11
  import "./chunk-PZ5AY32C.js";
12
12
  export {
@@ -0,0 +1,230 @@
1
+ import { MorphGitConfig, CloneOptions, PushOptions, PullOptions, AddOptions, CommitOptions, StatusOptions, LogOptions, CommitObject, CheckoutOptions, BranchOptions, StatusResult } 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
+ * });
121
+ * ```
122
+ */
123
+ commit(options: CommitOptions): Promise<string>;
124
+ /**
125
+ * Get status of a file
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * const status = await morphGit.status({
130
+ * dir: './my-project',
131
+ * filepath: 'src/app.ts'
132
+ * });
133
+ * console.log(status); // 'modified', '*added', etc.
134
+ * ```
135
+ */
136
+ status(options: StatusOptions): Promise<string>;
137
+ /**
138
+ * Get commit history
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const commits = await morphGit.log({
143
+ * dir: './my-project',
144
+ * depth: 10
145
+ * });
146
+ * ```
147
+ */
148
+ log(options: LogOptions): Promise<CommitObject[]>;
149
+ /**
150
+ * Checkout a branch or commit
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * await morphGit.checkout({
155
+ * dir: './my-project',
156
+ * ref: 'feature-branch'
157
+ * });
158
+ * ```
159
+ */
160
+ checkout(options: CheckoutOptions): Promise<void>;
161
+ /**
162
+ * Create a new branch
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * await morphGit.branch({
167
+ * dir: './my-project',
168
+ * name: 'feature-branch',
169
+ * checkout: true
170
+ * });
171
+ * ```
172
+ */
173
+ branch(options: BranchOptions): Promise<void>;
174
+ /**
175
+ * List all branches
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * const branches = await morphGit.listBranches({
180
+ * dir: './my-project'
181
+ * });
182
+ * ```
183
+ */
184
+ listBranches(options: {
185
+ dir: string;
186
+ }): Promise<string[]>;
187
+ /**
188
+ * Get the current branch name
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * const branch = await morphGit.currentBranch({
193
+ * dir: './my-project'
194
+ * });
195
+ * ```
196
+ */
197
+ currentBranch(options: {
198
+ dir: string;
199
+ }): Promise<string | undefined>;
200
+ /**
201
+ * Get list of changed files (similar to git diff --name-only)
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * const changes = await morphGit.statusMatrix({
206
+ * dir: './my-project'
207
+ * });
208
+ * ```
209
+ */
210
+ statusMatrix(options: {
211
+ dir: string;
212
+ }): Promise<StatusResult[]>;
213
+ /**
214
+ * Get the current commit hash
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * const hash = await morphGit.resolveRef({
219
+ * dir: './my-project',
220
+ * ref: 'HEAD'
221
+ * });
222
+ * ```
223
+ */
224
+ resolveRef(options: {
225
+ dir: string;
226
+ ref: string;
227
+ }): Promise<string>;
228
+ }
229
+
230
+ export { MorphGit };
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,5 @@
1
+ export { MorphGit } from './client.js';
2
+ export { AddOptions, BranchOptions, CheckoutOptions, CloneOptions, 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';
@@ -0,0 +1,91 @@
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 CommitOptions {
35
+ dir: string;
36
+ message: string;
37
+ author?: {
38
+ name: string | "Morph AI Agent";
39
+ email: string | "ai@morphllm.com";
40
+ };
41
+ }
42
+ interface StatusOptions {
43
+ dir: string;
44
+ filepath?: string;
45
+ }
46
+ interface LogOptions {
47
+ dir: string;
48
+ depth?: number;
49
+ ref?: string;
50
+ }
51
+ interface CheckoutOptions {
52
+ dir: string;
53
+ ref: string;
54
+ }
55
+ interface BranchOptions {
56
+ dir: string;
57
+ name: string;
58
+ checkout?: boolean;
59
+ }
60
+ interface DiffOptions {
61
+ dir: string;
62
+ ref1?: string;
63
+ ref2?: string;
64
+ filepath?: string;
65
+ }
66
+ interface GitUser {
67
+ name: string;
68
+ email: string;
69
+ }
70
+ interface CommitObject {
71
+ oid: string;
72
+ commit: {
73
+ message: string;
74
+ author: {
75
+ name: string | "Morph AI Agent";
76
+ email: string | "ai@morphllm.com";
77
+ timestamp: number;
78
+ };
79
+ committer: {
80
+ name: string | "Morph AI Agent";
81
+ email: string | "ai@morphllm.com";
82
+ timestamp: number;
83
+ };
84
+ };
85
+ }
86
+ interface StatusResult {
87
+ filepath: string;
88
+ status: 'unmodified' | 'modified' | '*modified' | 'added' | '*added' | 'deleted' | '*deleted' | 'absent';
89
+ }
90
+
91
+ export type { AddOptions, BranchOptions, CheckoutOptions, CloneOptions, CommitObject, CommitOptions, DiffOptions, GitUser, LogOptions, MorphGitConfig, PullOptions, PushOptions, StatusOptions, StatusResult };
@@ -0,0 +1,14 @@
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';
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-UFIIEUGW.js";
4
- import "./chunk-74ZHKB54.js";
3
+ } from "./chunk-OSJBHKA2.js";
5
4
  import {
6
- MorphGit
7
- } from "./chunk-5VQEQSJQ.js";
5
+ BrowserClient
6
+ } from "./chunk-GPFHYUKV.js";
7
+ import {
8
+ FastApplyClient
9
+ } from "./chunk-Q7USYY6R.js";
8
10
  import {
9
11
  CodebaseSearchClient
10
12
  } from "./chunk-VJK4PH5V.js";
13
+ import "./chunk-74ZHKB54.js";
14
+ import {
15
+ MorphGit
16
+ } from "./chunk-5VQEQSJQ.js";
11
17
  import {
12
18
  AnthropicRouter,
13
19
  GeminiRouter,
14
20
  OpenAIRouter
15
21
  } from "./chunk-AKVAAKRB.js";
16
- import {
17
- FastApplyClient
18
- } from "./chunk-Q7USYY6R.js";
19
- import {
20
- BrowserClient
21
- } from "./chunk-GPFHYUKV.js";
22
22
  import "./chunk-4VWJFZVS.js";
23
23
  import "./chunk-PZ5AY32C.js";
24
24
  export {
@@ -0,0 +1,56 @@
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 };