@morphllm/morphsdk 0.2.39 → 0.2.40
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.
- package/dist/{chunk-OKCGU7UD.js → chunk-4WIBODS7.js} +61 -2
- package/dist/chunk-4WIBODS7.js.map +1 -0
- package/dist/{chunk-LN4CTQZG.js → chunk-7MCSSJJA.js} +2 -2
- package/dist/{chunk-I7WWUHEC.js → chunk-DIWNR3UP.js} +2 -2
- package/dist/{chunk-W5CHJ6OX.js → chunk-JSZQVUSE.js} +2 -2
- package/dist/{chunk-YSBSDU75.js → chunk-LUI7APXX.js} +2 -2
- package/dist/{chunk-EAA7D24N.js → chunk-N5654KQR.js} +13 -13
- package/dist/client.cjs +60 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +2 -2
- package/dist/git/client.cjs +60 -1
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.js +1 -1
- package/dist/git/index.cjs +60 -1
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.js +1 -1
- package/dist/git/types.cjs.map +1 -1
- package/dist/index.cjs +60 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/tools/warp_grep/agent/runner.js +5 -5
- package/dist/tools/warp_grep/anthropic.js +6 -6
- package/dist/tools/warp_grep/index.js +8 -8
- package/dist/tools/warp_grep/openai.js +6 -6
- package/dist/tools/warp_grep/vercel.js +6 -6
- package/package.json +1 -1
- package/dist/anthropic-DpEAqqZF.d.ts +0 -88
- package/dist/chunk-OKCGU7UD.js.map +0 -1
- package/dist/client.d.ts +0 -114
- package/dist/git/client.d.ts +0 -261
- package/dist/git/config.d.ts +0 -11
- package/dist/git/index.d.ts +0 -5
- package/dist/git/types.d.ts +0 -102
- package/dist/index.d.ts +0 -14
- package/dist/modelrouter/core.d.ts +0 -69
- package/dist/modelrouter/index.d.ts +0 -2
- package/dist/modelrouter/types.d.ts +0 -39
- package/dist/openai-BkKsS30n.d.ts +0 -111
- package/dist/tools/browser/anthropic.d.ts +0 -51
- package/dist/tools/browser/core.d.ts +0 -203
- package/dist/tools/browser/index.d.ts +0 -72
- package/dist/tools/browser/openai.d.ts +0 -73
- package/dist/tools/browser/prompts.d.ts +0 -7
- package/dist/tools/browser/types.d.ts +0 -255
- package/dist/tools/browser/vercel.d.ts +0 -69
- package/dist/tools/codebase_search/anthropic.d.ts +0 -40
- package/dist/tools/codebase_search/core.d.ts +0 -40
- package/dist/tools/codebase_search/index.d.ts +0 -10
- package/dist/tools/codebase_search/openai.d.ts +0 -87
- package/dist/tools/codebase_search/prompts.d.ts +0 -7
- package/dist/tools/codebase_search/types.d.ts +0 -50
- package/dist/tools/codebase_search/vercel.d.ts +0 -65
- package/dist/tools/fastapply/anthropic.d.ts +0 -4
- package/dist/tools/fastapply/core.d.ts +0 -41
- package/dist/tools/fastapply/index.d.ts +0 -10
- package/dist/tools/fastapply/openai.d.ts +0 -4
- package/dist/tools/fastapply/prompts.d.ts +0 -7
- package/dist/tools/fastapply/types.d.ts +0 -77
- package/dist/tools/fastapply/vercel.d.ts +0 -4
- package/dist/tools/index.d.ts +0 -10
- package/dist/tools/utils/resilience.d.ts +0 -58
- package/dist/tools/warp_grep/agent/config.d.ts +0 -8
- package/dist/tools/warp_grep/agent/formatter.d.ts +0 -14
- package/dist/tools/warp_grep/agent/grep_helpers.d.ts +0 -16
- package/dist/tools/warp_grep/agent/parser.d.ts +0 -16
- package/dist/tools/warp_grep/agent/prompt.d.ts +0 -4
- package/dist/tools/warp_grep/agent/runner.d.ts +0 -10
- package/dist/tools/warp_grep/agent/types.d.ts +0 -44
- package/dist/tools/warp_grep/anthropic.d.ts +0 -14
- package/dist/tools/warp_grep/index.d.ts +0 -11
- package/dist/tools/warp_grep/openai.d.ts +0 -33
- package/dist/tools/warp_grep/providers/command.d.ts +0 -48
- package/dist/tools/warp_grep/providers/local.d.ts +0 -30
- package/dist/tools/warp_grep/providers/types.d.ts +0 -49
- package/dist/tools/warp_grep/tools/analyse.d.ts +0 -10
- package/dist/tools/warp_grep/tools/finish.d.ts +0 -10
- package/dist/tools/warp_grep/tools/grep.d.ts +0 -8
- package/dist/tools/warp_grep/tools/read.d.ts +0 -9
- package/dist/tools/warp_grep/utils/files.d.ts +0 -3
- package/dist/tools/warp_grep/utils/format.d.ts +0 -4
- package/dist/tools/warp_grep/utils/paths.d.ts +0 -7
- package/dist/tools/warp_grep/utils/ripgrep.d.ts +0 -11
- package/dist/tools/warp_grep/vercel.d.ts +0 -33
- package/dist/vercel-B1GZ_g9N.d.ts +0 -69
- /package/dist/{chunk-LN4CTQZG.js.map → chunk-7MCSSJJA.js.map} +0 -0
- /package/dist/{chunk-I7WWUHEC.js.map → chunk-DIWNR3UP.js.map} +0 -0
- /package/dist/{chunk-W5CHJ6OX.js.map → chunk-JSZQVUSE.js.map} +0 -0
- /package/dist/{chunk-YSBSDU75.js.map → chunk-LUI7APXX.js.map} +0 -0
- /package/dist/{chunk-EAA7D24N.js.map → chunk-N5654KQR.js.map} +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMorphWarpGrepTool
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-Z2FBMSNE.js";
|
|
6
|
-
import "../../chunk-HKZB23U7.js";
|
|
3
|
+
} from "../../chunk-7MCSSJJA.js";
|
|
4
|
+
import "../../chunk-N5654KQR.js";
|
|
7
5
|
import "../../chunk-UYBIKZPM.js";
|
|
8
6
|
import "../../chunk-G2RSY56Q.js";
|
|
9
7
|
import "../../chunk-SMGZ6A64.js";
|
|
10
8
|
import "../../chunk-RSLIOCOE.js";
|
|
11
|
-
import "../../chunk-73RQWOQC.js";
|
|
12
|
-
import "../../chunk-EK7OQPWD.js";
|
|
13
9
|
import "../../chunk-AFEPUNAO.js";
|
|
14
10
|
import "../../chunk-TICMYDII.js";
|
|
15
11
|
import "../../chunk-NDZO5IPV.js";
|
|
16
12
|
import "../../chunk-GTOXMAF2.js";
|
|
13
|
+
import "../../chunk-HKZB23U7.js";
|
|
14
|
+
import "../../chunk-73RQWOQC.js";
|
|
15
|
+
import "../../chunk-EK7OQPWD.js";
|
|
16
|
+
import "../../chunk-Z2FBMSNE.js";
|
|
17
17
|
import "../../chunk-4VWJFZVS.js";
|
|
18
18
|
import "../../chunk-PZ5AY32C.js";
|
|
19
19
|
export {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMorphWarpGrepTool
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-Z2FBMSNE.js";
|
|
6
|
-
import "../../chunk-HKZB23U7.js";
|
|
3
|
+
} from "../../chunk-LUI7APXX.js";
|
|
4
|
+
import "../../chunk-N5654KQR.js";
|
|
7
5
|
import "../../chunk-UYBIKZPM.js";
|
|
8
6
|
import "../../chunk-G2RSY56Q.js";
|
|
9
7
|
import "../../chunk-SMGZ6A64.js";
|
|
10
8
|
import "../../chunk-RSLIOCOE.js";
|
|
11
|
-
import "../../chunk-73RQWOQC.js";
|
|
12
|
-
import "../../chunk-EK7OQPWD.js";
|
|
13
9
|
import "../../chunk-AFEPUNAO.js";
|
|
14
10
|
import "../../chunk-TICMYDII.js";
|
|
15
11
|
import "../../chunk-NDZO5IPV.js";
|
|
16
12
|
import "../../chunk-GTOXMAF2.js";
|
|
13
|
+
import "../../chunk-HKZB23U7.js";
|
|
14
|
+
import "../../chunk-73RQWOQC.js";
|
|
15
|
+
import "../../chunk-EK7OQPWD.js";
|
|
16
|
+
import "../../chunk-Z2FBMSNE.js";
|
|
17
17
|
import "../../chunk-4VWJFZVS.js";
|
|
18
18
|
import "../../chunk-PZ5AY32C.js";
|
|
19
19
|
export {
|
package/package.json
CHANGED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Tool } from '@anthropic-ai/sdk/resources/messages';
|
|
2
|
-
import { EditFileResult, EditFileConfig, EditFileInput } 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
|
-
* Format the result for passing back to Claude
|
|
28
|
-
*
|
|
29
|
-
* @param result - The edit result
|
|
30
|
-
* @returns Formatted string for tool_result
|
|
31
|
-
*/
|
|
32
|
-
declare function formatResult(result: EditFileResult): string;
|
|
33
|
-
/**
|
|
34
|
-
* Create a custom edit_file tool with configuration
|
|
35
|
-
*
|
|
36
|
-
* @param config - Configuration options
|
|
37
|
-
* @returns Tool definition with execute and formatResult methods
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const tool = createEditFileTool({
|
|
42
|
-
* baseDir: './src',
|
|
43
|
-
* generateUdiff: true,
|
|
44
|
-
* morphApiKey: 'sk-...',
|
|
45
|
-
* description: 'Custom tool description for your use case'
|
|
46
|
-
* });
|
|
47
|
-
*
|
|
48
|
-
* // Use as Anthropic tool
|
|
49
|
-
* const response = await client.messages.create({
|
|
50
|
-
* tools: [tool], // tool itself is the Tool definition
|
|
51
|
-
* ...
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* // Execute and format
|
|
55
|
-
* const result = await tool.execute(toolUseBlock.input);
|
|
56
|
-
* const formatted = tool.formatResult(result);
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
declare function createEditFileTool(config?: EditFileConfig): Tool & {
|
|
60
|
-
execute: (input: EditFileInput) => Promise<EditFileResult>;
|
|
61
|
-
formatResult: (result: EditFileResult) => string;
|
|
62
|
-
getSystemPrompt: () => string;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Execute the edit_file tool with raw input
|
|
66
|
-
*
|
|
67
|
-
* @param input - Tool input from Claude's tool_use
|
|
68
|
-
* @param config - Configuration for Fast Apply
|
|
69
|
-
* @returns Tool result to send back to Claude
|
|
70
|
-
*/
|
|
71
|
-
declare function execute(input: EditFileInput, config?: EditFileConfig): Promise<EditFileResult>;
|
|
72
|
-
/**
|
|
73
|
-
* Get the system prompt for the edit_file tool
|
|
74
|
-
*
|
|
75
|
-
* @returns System prompt string
|
|
76
|
-
*/
|
|
77
|
-
declare function getSystemPrompt(): string;
|
|
78
|
-
|
|
79
|
-
declare const anthropic_createEditFileTool: typeof createEditFileTool;
|
|
80
|
-
declare const anthropic_editFileTool: typeof editFileTool;
|
|
81
|
-
declare const anthropic_execute: typeof execute;
|
|
82
|
-
declare const anthropic_formatResult: typeof formatResult;
|
|
83
|
-
declare const anthropic_getSystemPrompt: typeof getSystemPrompt;
|
|
84
|
-
declare namespace anthropic {
|
|
85
|
-
export { anthropic_createEditFileTool as createEditFileTool, anthropic_editFileTool as editFileTool, anthropic_execute as execute, anthropic_formatResult as formatResult, anthropic_getSystemPrompt as getSystemPrompt };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { anthropic as a, execute as b, createEditFileTool as c, editFileTool as e, formatResult as f, getSystemPrompt as g };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../git/client.ts"],"sourcesContent":["/**\n * Morph Git Client - Simple, high-level Git operations\n * Built on isomorphic-git with explicit configuration\n */\n\nimport git from 'isomorphic-git';\nimport http from 'isomorphic-git/http/node';\nimport fs from 'fs';\nimport type {\n CloneOptions,\n PushOptions,\n PullOptions,\n AddOptions,\n CommitOptions,\n StatusOptions,\n LogOptions,\n CheckoutOptions,\n BranchOptions,\n DiffOptions,\n CommitObject,\n StatusResult,\n MorphGitConfig,\n CommitMetadata,\n} from './types.js';\n\nconst DEFAULT_PROXY_URL = 'https://repos.morphllm.com';\n\n/**\n * MorphGit - Git operations for AI agents with Morph backend\n * \n * @example\n * ```typescript\n * import { MorphGit } from 'morphsdk/git';\n * \n * const morphGit = new MorphGit({\n * apiKey: process.env.MORPH_API_KEY!,\n * proxyUrl: 'https://repos.morphllm.com' // Optional\n * });\n * \n * await morphGit.init({ repoId: 'my-project', dir: './my-project' });\n * await morphGit.push({ dir: './my-project' });\n * ```\n */\nexport class MorphGit {\n private readonly apiKey: string;\n private readonly proxyUrl: string;\n\n constructor(config: MorphGitConfig) {\n // Validate API key\n if (!config.apiKey) {\n throw new Error('API key is required. Get one at https://morphllm.com/dashboard');\n }\n \n if (!config.apiKey.startsWith('sk-') && !config.apiKey.startsWith('morph-')) {\n throw new Error('Invalid API key format. Expected: sk-... or morph-...');\n }\n \n this.apiKey = config.apiKey;\n this.proxyUrl = config.proxyUrl || DEFAULT_PROXY_URL;\n }\n \n /**\n * Get auth callback for isomorphic-git operations\n * @private\n */\n private getAuthCallback() {\n return () => ({\n username: 'morph',\n password: this.apiKey,\n });\n }\n\n /**\n * Initialize a new repository\n * Creates the repo in the database and in the git provider\n * \n * @example\n * ```ts\n * await morphGit.init({\n * repoId: 'my-project',\n * dir: './my-project',\n * defaultBranch: 'main'\n * });\n * ```\n */\n async init(options: {\n repoId: string;\n dir: string;\n defaultBranch?: string;\n }): Promise<void> {\n const { repoId, dir, defaultBranch = 'main' } = options;\n\n // Call backend API to create repository\n const response = await fetch(`${this.proxyUrl}/v1/repos`, {\n method: 'POST',\n headers: {\n 'Authorization': `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n repoId,\n name: repoId,\n defaultBranch,\n }),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Failed to create repository: ${error}`);\n }\n\n // Initialize local git repository (industry standard: no clone needed)\n await git.init({\n fs,\n dir,\n defaultBranch,\n });\n\n // Add remote pointing to Morph git-proxy\n await git.addRemote({\n fs,\n dir,\n remote: 'origin',\n url: `${this.proxyUrl}/v1/repos/${repoId}`,\n });\n\n console.log(`✓ Repository '${repoId}' initialized`);\n }\n\n /**\n * Clone a repository from Morph repos\n * \n * @example\n * ```ts\n * await morphGit.clone({\n * repoId: 'my-project',\n * dir: './my-project'\n * });\n * ```\n */\n async clone(options: CloneOptions): Promise<void> {\n const { repoId, dir, branch = 'main', depth, singleBranch = true } = options;\n\n await git.clone({\n fs,\n http,\n dir,\n url: `${this.proxyUrl}/v1/repos/${repoId}`,\n ref: branch,\n singleBranch,\n depth,\n onAuth: this.getAuthCallback(),\n });\n }\n\n /**\n * Push changes to remote repository\n * \n * @example\n * ```ts\n * await morphGit.push({ \n * dir: './my-project',\n * branch: 'main' // Required: explicit branch name\n * });\n * ```\n */\n async push(options: PushOptions): Promise<void> {\n const { dir, remote = 'origin', branch } = options;\n\n if (!branch) {\n throw new Error(\n 'branch is required for push operations. ' +\n 'Specify the branch explicitly: { dir: \"./my-project\", branch: \"main\" }'\n );\n }\n\n await git.push({\n fs,\n http,\n dir,\n remote,\n ref: branch,\n onAuth: this.getAuthCallback(),\n });\n }\n\n /**\n * Pull changes from remote repository\n * \n * @example\n * ```ts\n * await morphGit.pull({ \n * dir: './my-project',\n * branch: 'main' // Required: explicit branch name\n * });\n * ```\n */\n async pull(options: PullOptions): Promise<void> {\n const { dir, remote = 'origin', branch } = options;\n\n if (!branch) {\n throw new Error(\n 'branch is required for pull operations. ' +\n 'Specify the branch explicitly: { dir: \"./my-project\", branch: \"main\" }'\n );\n }\n\n await git.pull({\n fs,\n http,\n dir,\n remote,\n ref: branch,\n onAuth: this.getAuthCallback(),\n author: {\n name: 'Morph Agent',\n email: 'agent@morph.com',\n },\n });\n }\n\n /**\n * Stage a file for commit\n * \n * @example\n * ```ts\n * await morphGit.add({\n * dir: './my-project',\n * filepath: 'src/app.ts'\n * });\n * ```\n */\n async add(options: AddOptions): Promise<void> {\n const { dir, filepath } = options;\n\n await git.add({\n fs,\n dir,\n filepath,\n });\n }\n\n /**\n * Remove a file from staging\n * \n * @example\n * ```ts\n * await morphGit.remove({\n * dir: './my-project',\n * filepath: 'src/old-file.ts'\n * });\n * ```\n */\n async remove(options: AddOptions): Promise<void> {\n const { dir, filepath } = options;\n\n await git.remove({\n fs,\n dir,\n filepath,\n });\n }\n\n /**\n * Commit staged changes\n * \n * @example\n * ```ts\n * await morphGit.commit({\n * dir: './my-project',\n * message: 'Add new feature',\n * author: {\n * name: 'AI Agent',\n * email: 'ai@example.com'\n * },\n * chatHistory: [\n * { role: 'user', content: 'Please add a new feature' },\n * { role: 'assistant', content: 'I will add that feature' }\n * ],\n * recordingId: 'rec_123'\n * });\n * ```\n */\n async commit(options: CommitOptions): Promise<string> {\n const { dir, message, author, chatHistory, recordingId } = options;\n\n // Provide default author if not specified\n const commitAuthor = author || {\n name: 'Morph SDK',\n email: 'sdk@morphllm.com'\n };\n\n const sha = await git.commit({\n fs,\n dir,\n message,\n author: commitAuthor,\n });\n\n // Store metadata as git note if provided\n if (chatHistory || recordingId) {\n const metadata: CommitMetadata = {\n chatHistory,\n recordingId\n };\n \n await git.addNote({\n fs,\n dir,\n ref: 'refs/notes/morph-metadata',\n oid: sha,\n note: JSON.stringify(metadata, null, 2),\n author: commitAuthor\n });\n }\n\n return sha;\n }\n\n /**\n * Get status of a file\n * \n * @example\n * ```ts\n * const status = await morphGit.status({\n * dir: './my-project',\n * filepath: 'src/app.ts'\n * });\n * console.log(status); // 'modified', '*added', etc.\n * ```\n */\n async status(options: StatusOptions): Promise<string> {\n const { dir, filepath } = options;\n\n if (!filepath) {\n throw new Error('filepath is required for status check');\n }\n\n const status = await git.status({\n fs,\n dir,\n filepath,\n });\n\n return status;\n }\n\n /**\n * Get commit history\n * \n * @example\n * ```ts\n * const commits = await morphGit.log({\n * dir: './my-project',\n * depth: 10\n * });\n * ```\n */\n async log(options: LogOptions): Promise<CommitObject[]> {\n const { dir, depth, ref } = options;\n\n const commits = await git.log({\n fs,\n dir,\n depth,\n ref,\n });\n\n return commits as CommitObject[];\n }\n\n /**\n * Checkout a branch or commit\n * \n * @example\n * ```ts\n * await morphGit.checkout({\n * dir: './my-project',\n * ref: 'feature-branch'\n * });\n * ```\n */\n async checkout(options: CheckoutOptions): Promise<void> {\n const { dir, ref } = options;\n\n await git.checkout({\n fs,\n dir,\n ref,\n });\n }\n\n /**\n * Create a new branch\n * \n * @example\n * ```ts\n * await morphGit.branch({\n * dir: './my-project',\n * name: 'feature-branch',\n * checkout: true\n * });\n * ```\n */\n async branch(options: BranchOptions): Promise<void> {\n const { dir, name, checkout = false } = options;\n\n await git.branch({\n fs,\n dir,\n ref: name,\n checkout,\n });\n }\n\n /**\n * List all branches\n * \n * @example\n * ```ts\n * const branches = await morphGit.listBranches({\n * dir: './my-project'\n * });\n * ```\n */\n async listBranches(options: { dir: string }): Promise<string[]> {\n const { dir } = options;\n\n const branches = await git.listBranches({\n fs,\n dir,\n });\n\n return branches;\n }\n\n /**\n * Get the current branch name\n * \n * @example\n * ```ts\n * const branch = await morphGit.currentBranch({\n * dir: './my-project'\n * });\n * ```\n */\n async currentBranch(options: { dir: string }): Promise<string | undefined> {\n const { dir } = options;\n\n const branch = await git.currentBranch({\n fs,\n dir,\n });\n\n return branch || undefined;\n }\n\n /**\n * Get list of changed files (similar to git diff --name-only)\n * \n * @example\n * ```ts\n * const changes = await morphGit.statusMatrix({\n * dir: './my-project'\n * });\n * ```\n */\n async statusMatrix(options: { dir: string }): Promise<StatusResult[]> {\n const { dir } = options;\n\n const matrix = await git.statusMatrix({\n fs,\n dir,\n });\n\n return matrix.map(([filepath, HEADStatus, workdirStatus, stageStatus]) => {\n let status: StatusResult['status'] = 'unmodified';\n\n // Determine status based on statusMatrix values\n if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 2) {\n status = 'modified';\n } else if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 1) {\n status = '*modified';\n } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 2) {\n status = 'added';\n } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 0) {\n status = '*added';\n } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 0) {\n status = 'deleted';\n } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 1) {\n status = '*deleted';\n } else if (HEADStatus === 1 && workdirStatus === 1 && stageStatus === 1) {\n status = 'unmodified';\n } else if (HEADStatus === 0 && workdirStatus === 0 && stageStatus === 0) {\n status = 'absent';\n }\n\n return {\n filepath,\n status,\n };\n });\n }\n\n /**\n * Get the current commit hash\n * \n * @example\n * ```ts\n * const hash = await morphGit.resolveRef({\n * dir: './my-project',\n * ref: 'HEAD'\n * });\n * ```\n */\n async resolveRef(options: { dir: string; ref: string }): Promise<string> {\n const { dir, ref } = options;\n\n const oid = await git.resolveRef({\n fs,\n dir,\n ref,\n });\n\n return oid;\n }\n\n /**\n * Get metadata (chat history, recording ID) attached to a commit\n * \n * @example\n * ```ts\n * const metadata = await morphGit.getCommitMetadata({\n * dir: './my-project',\n * commitSha: 'abc123...'\n * });\n * \n * if (metadata) {\n * console.log('Chat history:', metadata.chatHistory);\n * console.log('Recording ID:', metadata.recordingId);\n * }\n * ```\n */\n async getCommitMetadata(options: {\n dir: string;\n commitSha: string;\n }): Promise<CommitMetadata | null> {\n try {\n const note = await git.readNote({\n fs,\n dir: options.dir,\n ref: 'refs/notes/morph-metadata',\n oid: options.commitSha\n });\n \n const metadata = JSON.parse(new TextDecoder().decode(note));\n return metadata;\n } catch (err) {\n // No metadata found for this commit\n return null;\n }\n }\n}\n\n"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WAAW,SAAwD;AACvE,UAAM,EAAE,KAAK,IAAI,IAAI;AAErB,UAAM,MAAM,MAAM,IAAI,WAAW;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,MAAM,kBAAkB,SAGW;AACjC,QAAI;AACF,YAAM,OAAO,MAAM,IAAI,SAAS;AAAA,QAC9B;AAAA,QACA,KAAK,QAAQ;AAAA,QACb,KAAK;AAAA,QACL,KAAK,QAAQ;AAAA,MACf,CAAC;AAED,YAAM,WAAW,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,IAAI,CAAC;AAC1D,aAAO;AAAA,IACT,SAAS,KAAK;AAEZ,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/dist/client.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
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/git/client.d.ts
DELETED
|
@@ -1,261 +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({
|
|
72
|
-
* dir: './my-project',
|
|
73
|
-
* branch: 'main' // Required: explicit branch name
|
|
74
|
-
* });
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
push(options: PushOptions): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Pull changes from remote repository
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```ts
|
|
83
|
-
* await morphGit.pull({
|
|
84
|
-
* dir: './my-project',
|
|
85
|
-
* branch: 'main' // Required: explicit branch name
|
|
86
|
-
* });
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
pull(options: PullOptions): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Stage a file for commit
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```ts
|
|
95
|
-
* await morphGit.add({
|
|
96
|
-
* dir: './my-project',
|
|
97
|
-
* filepath: 'src/app.ts'
|
|
98
|
-
* });
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
add(options: AddOptions): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Remove a file from staging
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```ts
|
|
107
|
-
* await morphGit.remove({
|
|
108
|
-
* dir: './my-project',
|
|
109
|
-
* filepath: 'src/old-file.ts'
|
|
110
|
-
* });
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
remove(options: AddOptions): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Commit staged changes
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```ts
|
|
119
|
-
* await morphGit.commit({
|
|
120
|
-
* dir: './my-project',
|
|
121
|
-
* message: 'Add new feature',
|
|
122
|
-
* author: {
|
|
123
|
-
* name: 'AI Agent',
|
|
124
|
-
* email: 'ai@example.com'
|
|
125
|
-
* },
|
|
126
|
-
* chatHistory: [
|
|
127
|
-
* { role: 'user', content: 'Please add a new feature' },
|
|
128
|
-
* { role: 'assistant', content: 'I will add that feature' }
|
|
129
|
-
* ],
|
|
130
|
-
* recordingId: 'rec_123'
|
|
131
|
-
* });
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
commit(options: CommitOptions): Promise<string>;
|
|
135
|
-
/**
|
|
136
|
-
* Get status of a file
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```ts
|
|
140
|
-
* const status = await morphGit.status({
|
|
141
|
-
* dir: './my-project',
|
|
142
|
-
* filepath: 'src/app.ts'
|
|
143
|
-
* });
|
|
144
|
-
* console.log(status); // 'modified', '*added', etc.
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
status(options: StatusOptions): Promise<string>;
|
|
148
|
-
/**
|
|
149
|
-
* Get commit history
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```ts
|
|
153
|
-
* const commits = await morphGit.log({
|
|
154
|
-
* dir: './my-project',
|
|
155
|
-
* depth: 10
|
|
156
|
-
* });
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
log(options: LogOptions): Promise<CommitObject[]>;
|
|
160
|
-
/**
|
|
161
|
-
* Checkout a branch or commit
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```ts
|
|
165
|
-
* await morphGit.checkout({
|
|
166
|
-
* dir: './my-project',
|
|
167
|
-
* ref: 'feature-branch'
|
|
168
|
-
* });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
checkout(options: CheckoutOptions): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Create a new branch
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```ts
|
|
177
|
-
* await morphGit.branch({
|
|
178
|
-
* dir: './my-project',
|
|
179
|
-
* name: 'feature-branch',
|
|
180
|
-
* checkout: true
|
|
181
|
-
* });
|
|
182
|
-
* ```
|
|
183
|
-
*/
|
|
184
|
-
branch(options: BranchOptions): Promise<void>;
|
|
185
|
-
/**
|
|
186
|
-
* List all branches
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```ts
|
|
190
|
-
* const branches = await morphGit.listBranches({
|
|
191
|
-
* dir: './my-project'
|
|
192
|
-
* });
|
|
193
|
-
* ```
|
|
194
|
-
*/
|
|
195
|
-
listBranches(options: {
|
|
196
|
-
dir: string;
|
|
197
|
-
}): Promise<string[]>;
|
|
198
|
-
/**
|
|
199
|
-
* Get the current branch name
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* ```ts
|
|
203
|
-
* const branch = await morphGit.currentBranch({
|
|
204
|
-
* dir: './my-project'
|
|
205
|
-
* });
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
currentBranch(options: {
|
|
209
|
-
dir: string;
|
|
210
|
-
}): Promise<string | undefined>;
|
|
211
|
-
/**
|
|
212
|
-
* Get list of changed files (similar to git diff --name-only)
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* ```ts
|
|
216
|
-
* const changes = await morphGit.statusMatrix({
|
|
217
|
-
* dir: './my-project'
|
|
218
|
-
* });
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
statusMatrix(options: {
|
|
222
|
-
dir: string;
|
|
223
|
-
}): Promise<StatusResult[]>;
|
|
224
|
-
/**
|
|
225
|
-
* Get the current commit hash
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```ts
|
|
229
|
-
* const hash = await morphGit.resolveRef({
|
|
230
|
-
* dir: './my-project',
|
|
231
|
-
* ref: 'HEAD'
|
|
232
|
-
* });
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
resolveRef(options: {
|
|
236
|
-
dir: string;
|
|
237
|
-
ref: string;
|
|
238
|
-
}): Promise<string>;
|
|
239
|
-
/**
|
|
240
|
-
* Get metadata (chat history, recording ID) attached to a commit
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```ts
|
|
244
|
-
* const metadata = await morphGit.getCommitMetadata({
|
|
245
|
-
* dir: './my-project',
|
|
246
|
-
* commitSha: 'abc123...'
|
|
247
|
-
* });
|
|
248
|
-
*
|
|
249
|
-
* if (metadata) {
|
|
250
|
-
* console.log('Chat history:', metadata.chatHistory);
|
|
251
|
-
* console.log('Recording ID:', metadata.recordingId);
|
|
252
|
-
* }
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
getCommitMetadata(options: {
|
|
256
|
-
dir: string;
|
|
257
|
-
commitSha: string;
|
|
258
|
-
}): Promise<CommitMetadata | null>;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export { MorphGit };
|
package/dist/git/config.d.ts
DELETED
|
@@ -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 };
|
package/dist/git/index.d.ts
DELETED
|
@@ -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';
|
package/dist/git/types.d.ts
DELETED
|
@@ -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 };
|