@morphllm/morphsdk 0.2.14 → 0.2.16

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 (80) hide show
  1. package/dist/anthropic-CknfcMoO.d.ts +64 -0
  2. package/dist/{chunk-C2TYLJRK.js → chunk-CDFM7C52.js} +6 -6
  3. package/dist/{chunk-IUCGXKTX.js → chunk-KP75GOQS.js} +2 -2
  4. package/dist/{chunk-QFUHDWGY.js → chunk-OZMHDB6O.js} +2 -2
  5. package/dist/{chunk-4V46N27D.js → chunk-Q7USYY6R.js} +1 -1
  6. package/dist/chunk-Q7USYY6R.js.map +1 -0
  7. package/dist/{chunk-7NG7SI6M.js → chunk-S3HTYGYF.js} +2 -2
  8. package/dist/{chunk-OWXIAZUZ.js → chunk-UIEIJZA3.js} +25 -43
  9. package/dist/{chunk-OWXIAZUZ.js.map → chunk-UIEIJZA3.js.map} +1 -1
  10. package/dist/client.cjs +24 -42
  11. package/dist/client.cjs.map +1 -1
  12. package/dist/client.d.ts +114 -0
  13. package/dist/client.js +5 -5
  14. package/dist/git/client.d.ts +230 -0
  15. package/dist/git/config.d.ts +11 -0
  16. package/dist/git/index.d.ts +5 -0
  17. package/dist/git/types.d.ts +91 -0
  18. package/dist/index.cjs +24 -42
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +14 -0
  21. package/dist/index.js +7 -7
  22. package/dist/modelrouter/core.d.ts +56 -0
  23. package/dist/modelrouter/index.d.ts +2 -0
  24. package/dist/modelrouter/types.d.ts +35 -0
  25. package/dist/openai-BkKsS30n.d.ts +111 -0
  26. package/dist/tools/browser/anthropic.cjs.map +1 -1
  27. package/dist/tools/browser/anthropic.d.ts +51 -0
  28. package/dist/tools/browser/anthropic.js +1 -1
  29. package/dist/tools/browser/core.cjs +24 -42
  30. package/dist/tools/browser/core.cjs.map +1 -1
  31. package/dist/tools/browser/core.d.ts +196 -0
  32. package/dist/tools/browser/core.js +1 -1
  33. package/dist/tools/browser/index.cjs +24 -42
  34. package/dist/tools/browser/index.cjs.map +1 -1
  35. package/dist/tools/browser/index.d.ts +72 -0
  36. package/dist/tools/browser/index.js +1 -1
  37. package/dist/tools/browser/openai.cjs.map +1 -1
  38. package/dist/tools/browser/openai.d.ts +69 -0
  39. package/dist/tools/browser/openai.js +1 -1
  40. package/dist/tools/browser/prompts.d.ts +7 -0
  41. package/dist/tools/browser/types.d.ts +225 -0
  42. package/dist/tools/browser/vercel.cjs.map +1 -1
  43. package/dist/tools/browser/vercel.d.ts +128 -0
  44. package/dist/tools/browser/vercel.js +1 -1
  45. package/dist/tools/codebase_search/anthropic.d.ts +40 -0
  46. package/dist/tools/codebase_search/core.d.ts +40 -0
  47. package/dist/tools/codebase_search/index.d.ts +11 -0
  48. package/dist/tools/codebase_search/openai.d.ts +87 -0
  49. package/dist/tools/codebase_search/prompts.d.ts +7 -0
  50. package/dist/tools/codebase_search/types.cjs.map +1 -1
  51. package/dist/tools/codebase_search/types.d.ts +46 -0
  52. package/dist/tools/codebase_search/vercel.d.ts +100 -0
  53. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  54. package/dist/tools/fastapply/anthropic.d.ts +4 -0
  55. package/dist/tools/fastapply/anthropic.js +2 -2
  56. package/dist/tools/fastapply/core.cjs.map +1 -1
  57. package/dist/tools/fastapply/core.d.ts +41 -0
  58. package/dist/tools/fastapply/core.js +1 -1
  59. package/dist/tools/fastapply/index.cjs.map +1 -1
  60. package/dist/tools/fastapply/index.d.ts +11 -0
  61. package/dist/tools/fastapply/index.js +4 -4
  62. package/dist/tools/fastapply/openai.cjs.map +1 -1
  63. package/dist/tools/fastapply/openai.d.ts +4 -0
  64. package/dist/tools/fastapply/openai.js +2 -2
  65. package/dist/tools/fastapply/prompts.d.ts +7 -0
  66. package/dist/tools/fastapply/types.d.ts +77 -0
  67. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  68. package/dist/tools/fastapply/vercel.d.ts +5 -0
  69. package/dist/tools/fastapply/vercel.js +2 -2
  70. package/dist/tools/index.cjs.map +1 -1
  71. package/dist/tools/index.d.ts +11 -0
  72. package/dist/tools/index.js +4 -4
  73. package/dist/tools/utils/resilience.d.ts +58 -0
  74. package/dist/vercel-Cd1wjuoK.d.ts +108 -0
  75. package/package.json +2 -2
  76. package/dist/chunk-4V46N27D.js.map +0 -1
  77. /package/dist/{chunk-C2TYLJRK.js.map → chunk-CDFM7C52.js.map} +0 -0
  78. /package/dist/{chunk-IUCGXKTX.js.map → chunk-KP75GOQS.js.map} +0 -0
  79. /package/dist/{chunk-QFUHDWGY.js.map → chunk-OZMHDB6O.js.map} +0 -0
  80. /package/dist/{chunk-7NG7SI6M.js.map → chunk-S3HTYGYF.js.map} +0 -0
@@ -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 };
package/dist/index.cjs CHANGED
@@ -748,36 +748,27 @@ function wrapTaskResponse(result, config) {
748
748
  liveUrl: generateLiveUrl(result.task_id, config),
749
749
  complete: async (pollConfig) => {
750
750
  return pollTaskUntilComplete(result.task_id, config, pollConfig);
751
- }
752
- };
753
- if (result.debugUrl) {
754
- wrapped.getLiveUrl = (options) => {
755
- return buildLiveUrl(result.debugUrl, options);
756
- };
757
- wrapped.getLiveIframe = (optionsOrPreset) => {
758
- const options = resolvePreset(optionsOrPreset);
759
- return buildLiveIframe(result.debugUrl, options);
760
- };
761
- wrapped.getEmbedCode = () => {
762
- return buildEmbedCode(result.debugUrl);
763
- };
764
- } else {
765
- wrapped.getLiveUrl = () => {
751
+ },
752
+ // Add Steel live session helpers - either functional or error-throwing
753
+ getLiveUrl: result.debugUrl ? (options) => buildLiveUrl(result.debugUrl, options) : () => {
766
754
  throw new Error(
767
755
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help."
768
756
  );
769
- };
770
- wrapped.getLiveIframe = () => {
757
+ },
758
+ getLiveIframe: result.debugUrl ? (optionsOrPreset) => {
759
+ const options = resolvePreset(optionsOrPreset);
760
+ return buildLiveIframe(result.debugUrl, options);
761
+ } : () => {
771
762
  throw new Error(
772
763
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help."
773
764
  );
774
- };
775
- wrapped.getEmbedCode = () => {
765
+ },
766
+ getEmbedCode: result.debugUrl ? () => buildEmbedCode(result.debugUrl) : () => {
776
767
  throw new Error(
777
768
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help."
778
769
  );
779
- };
780
- }
770
+ }
771
+ };
781
772
  return wrapped;
782
773
  }
783
774
  function wrapTaskResponseWithSchema(result, config, schema) {
@@ -792,36 +783,27 @@ function wrapTaskResponseWithSchema(result, config, schema) {
792
783
  complete: async (pollConfig) => {
793
784
  const finalResult = await pollTaskUntilComplete(result.task_id, config, pollConfig);
794
785
  return parseStructuredTaskOutput(finalResult, schema);
795
- }
796
- };
797
- if (result.debugUrl) {
798
- wrapped.getLiveUrl = (options) => {
799
- return buildLiveUrl(result.debugUrl, options);
800
- };
801
- wrapped.getLiveIframe = (optionsOrPreset) => {
802
- const options = resolvePreset(optionsOrPreset);
803
- return buildLiveIframe(result.debugUrl, options);
804
- };
805
- wrapped.getEmbedCode = () => {
806
- return buildEmbedCode(result.debugUrl);
807
- };
808
- } else {
809
- wrapped.getLiveUrl = () => {
786
+ },
787
+ // Add Steel live session helpers - either functional or error-throwing
788
+ getLiveUrl: result.debugUrl ? (options) => buildLiveUrl(result.debugUrl, options) : () => {
810
789
  throw new Error(
811
790
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help enabling live sessions. "
812
791
  );
813
- };
814
- wrapped.getLiveIframe = () => {
792
+ },
793
+ getLiveIframe: result.debugUrl ? (optionsOrPreset) => {
794
+ const options = resolvePreset(optionsOrPreset);
795
+ return buildLiveIframe(result.debugUrl, options);
796
+ } : () => {
815
797
  throw new Error(
816
798
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help enabling live sessions."
817
799
  );
818
- };
819
- wrapped.getEmbedCode = () => {
800
+ },
801
+ getEmbedCode: result.debugUrl ? () => buildEmbedCode(result.debugUrl) : () => {
820
802
  throw new Error(
821
803
  "Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help enabling live sessions."
822
804
  );
823
- };
824
- }
805
+ }
806
+ };
825
807
  return wrapped;
826
808
  }
827
809
  async function checkHealth(config = {}) {