@morphllm/morphsdk 0.2.16 → 0.2.18
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-UIEIJZA3.js → chunk-GPFHYUKV.js} +2 -1
- package/dist/chunk-GPFHYUKV.js.map +1 -0
- package/dist/{chunk-CDFM7C52.js → chunk-UFIIEUGW.js} +9 -9
- package/dist/{chunk-HGIFACNP.js → chunk-VONZKK4S.js} +2 -3
- package/dist/chunk-VONZKK4S.js.map +1 -0
- package/dist/{chunk-KP75GOQS.js → chunk-Y5RCNDLV.js} +3 -5
- package/dist/chunk-Y5RCNDLV.js.map +1 -0
- package/dist/client.cjs +1 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +5 -5
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -11
- package/dist/tools/browser/anthropic.cjs +1 -0
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +1 -1
- package/dist/tools/browser/core.cjs +1 -0
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +1 -1
- package/dist/tools/browser/index.cjs +1 -0
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +1 -1
- package/dist/tools/browser/openai.cjs +1 -0
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +1 -1
- package/dist/tools/browser/types.cjs.map +1 -1
- package/dist/tools/browser/vercel.cjs +1 -0
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +1 -1
- package/dist/tools/codebase_search/index.cjs +1 -2
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +4 -4
- package/dist/tools/codebase_search/vercel.cjs +1 -2
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +1 -1
- package/dist/tools/fastapply/index.cjs +2 -4
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +4 -4
- package/dist/tools/fastapply/vercel.cjs +2 -4
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +1 -1
- package/dist/tools/index.cjs +2 -4
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +4 -4
- package/package.json +2 -2
- package/dist/anthropic-CknfcMoO.d.ts +0 -64
- package/dist/chunk-HGIFACNP.js.map +0 -1
- package/dist/chunk-KP75GOQS.js.map +0 -1
- package/dist/chunk-UIEIJZA3.js.map +0 -1
- package/dist/client.d.ts +0 -114
- package/dist/git/client.d.ts +0 -230
- package/dist/git/config.d.ts +0 -11
- package/dist/git/index.d.ts +0 -5
- package/dist/git/types.d.ts +0 -91
- package/dist/index.d.ts +0 -14
- package/dist/modelrouter/core.d.ts +0 -56
- package/dist/modelrouter/index.d.ts +0 -2
- package/dist/modelrouter/types.d.ts +0 -35
- 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 -196
- package/dist/tools/browser/index.d.ts +0 -72
- package/dist/tools/browser/openai.d.ts +0 -69
- package/dist/tools/browser/prompts.d.ts +0 -7
- package/dist/tools/browser/types.d.ts +0 -225
- package/dist/tools/browser/vercel.d.ts +0 -128
- 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 -11
- 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 -46
- package/dist/tools/codebase_search/vercel.d.ts +0 -100
- 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 -11
- 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 -5
- package/dist/tools/index.d.ts +0 -11
- package/dist/tools/utils/resilience.d.ts +0 -58
- package/dist/vercel-Cd1wjuoK.d.ts +0 -108
- /package/dist/{chunk-CDFM7C52.js.map → chunk-UFIIEUGW.js.map} +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 // @ts-ignore - Vercel AI SDK tool() has execute runtime support but types are incomplete\n return tool({\n description: CODEBASE_SEARCH_DESCRIPTION,\n parameters: schema,\n // @ts-ignore\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;AAGD,SAAO,KAAK;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA;AAAA,IAEZ,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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/fastapply/vercel.ts"],"sourcesContent":["/**\n * Vercel AI SDK adapter for edit_file tool\n */\n\nimport { tool } from 'ai';\nimport { z } from 'zod';\nimport { executeEditFile } from './core.js';\nimport { EDIT_FILE_TOOL_DESCRIPTION, EDIT_FILE_SYSTEM_PROMPT } from './prompts.js';\nimport type { EditFileConfig } from './types.js';\n\n/**\n * Vercel AI SDK tool for edit_file\n * \n * @example\n * ```ts\n * import { generateText } from 'ai';\n * import { anthropic } from '@ai-sdk/anthropic';\n * import { editFileTool } from 'morphsdk/tools/vercel';\n * \n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * tools: { editFile: editFileTool },\n * prompt: \"Fix the bug in app.ts\"\n * });\n * ```\n */\nconst editFileSchema = z.object({\n target_filepath: z.string().describe('The path of the target file to modify'),\n instructions: z\n .string()\n .describe('A single sentence describing what you are changing (first person)'),\n code_edit: z\n .string()\n .describe('The lazy edit with // ... existing code ... markers'),\n});\n\n// @ts-ignore - Vercel AI SDK tool() has execute runtime support but types are incomplete\nexport const editFileTool = tool({\n description: EDIT_FILE_TOOL_DESCRIPTION,\n parameters: editFileSchema,\n // @ts-ignore\n execute: async (params) => {\n const result = await executeEditFile({\n target_filepath: params.target_filepath,\n instructions: params.instructions,\n code_edit: params.code_edit,\n });\n \n if (!result.success) {\n throw new Error(`Failed to edit file: ${result.error}`);\n }\n \n return {\n success: true,\n filepath: result.filepath,\n changes: result.changes,\n udiff: result.udiff,\n };\n },\n});\n\n/**\n * Get the system prompt for edit_file usage\n * \n * Add this to your system message to guide the model on using edit_file properly.\n * \n * @example\n * ```ts\n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * system: getSystemPrompt(),\n * tools: { editFile: editFileTool },\n * prompt: \"Fix bugs\"\n * });\n * ```\n */\nexport function getSystemPrompt(): string {\n return EDIT_FILE_SYSTEM_PROMPT;\n}\n\n/**\n * Create a custom edit_file tool with configuration\n * \n * @param config - Configuration options\n * @returns Vercel AI SDK tool with custom config\n * \n * @example\n * ```ts\n * const customEditTool = createEditFileTool({\n * baseDir: './src',\n * generateUdiff: true,\n * description: 'Custom tool description for your use case'\n * });\n * \n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * tools: { editFile: customEditTool },\n * prompt: \"Fix bugs\"\n * });\n * ```\n */\nexport function createEditFileTool(config: EditFileConfig = {}) {\n const schema = z.object({\n target_filepath: z.string().describe('The path of the target file to modify'),\n instructions: z\n .string()\n .describe('A single sentence describing what you are changing (first person)'),\n code_edit: z\n .string()\n .describe('The lazy edit with // ... existing code ... markers'),\n });\n\n // @ts-ignore - Vercel AI SDK tool() has execute runtime support but types are incomplete\n return tool({\n description: config.description || EDIT_FILE_TOOL_DESCRIPTION,\n parameters: schema,\n // @ts-ignore\n execute: async (params) => {\n const result = await executeEditFile(\n {\n target_filepath: params.target_filepath,\n instructions: params.instructions,\n code_edit: params.code_edit,\n },\n config\n );\n \n if (!result.success) {\n throw new Error(`Failed to edit file: ${result.error}`);\n }\n \n return {\n success: true,\n filepath: result.filepath,\n changes: result.changes,\n udiff: result.udiff,\n };\n },\n });\n}\n\n// Default export for convenience\nexport default editFileTool;\n\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,YAAY;AACrB,SAAS,SAAS;AAqBlB,IAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,iBAAiB,EAAE,OAAO,EAAE,SAAS,uCAAuC;AAAA,EAC5E,cAAc,EACX,OAAO,EACP,SAAS,mEAAmE;AAAA,EAC/E,WAAW,EACR,OAAO,EACP,SAAS,qDAAqD;AACnE,CAAC;AAGM,IAAM,eAAe,KAAK;AAAA,EAC/B,aAAa;AAAA,EACb,YAAY;AAAA;AAAA,EAEZ,SAAS,OAAO,WAAW;AACzB,UAAM,SAAS,MAAM,gBAAgB;AAAA,MACnC,iBAAiB,OAAO;AAAA,MACxB,cAAc,OAAO;AAAA,MACrB,WAAW,OAAO;AAAA,IACpB,CAAC;AAED,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,IAAI,MAAM,wBAAwB,OAAO,KAAK,EAAE;AAAA,IACxD;AAEA,WAAO;AAAA,MACL,SAAS;AAAA,MACT,UAAU,OAAO;AAAA,MACjB,SAAS,OAAO;AAAA,MAChB,OAAO,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAiBM,SAAS,kBAA0B;AACxC,SAAO;AACT;AAuBO,SAAS,mBAAmB,SAAyB,CAAC,GAAG;AAC9D,QAAM,SAAS,EAAE,OAAO;AAAA,IACtB,iBAAiB,EAAE,OAAO,EAAE,SAAS,uCAAuC;AAAA,IAC5E,cAAc,EACX,OAAO,EACP,SAAS,mEAAmE;AAAA,IAC/E,WAAW,EACR,OAAO,EACP,SAAS,qDAAqD;AAAA,EACnE,CAAC;AAGD,SAAO,KAAK;AAAA,IACV,aAAa,OAAO,eAAe;AAAA,IACnC,YAAY;AAAA;AAAA,IAEZ,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM;AAAA,QACnB;AAAA,UACE,iBAAiB,OAAO;AAAA,UACxB,cAAc,OAAO;AAAA,UACrB,WAAW,OAAO;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,IAAI,MAAM,wBAAwB,OAAO,KAAK,EAAE;AAAA,MACxD;AAEA,aAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU,OAAO;AAAA,QACjB,SAAS,OAAO;AAAA,QAChB,OAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/browser/live.ts","../tools/browser/core.ts"],"sourcesContent":["/**\n * Live session utilities for Morph browser sessions\n * \n * Provides helpers for embedding and sharing live browser sessions with WebRTC streaming.\n */\n\nimport type { LiveSessionOptions, IframeOptions } from './types.js';\n\n/**\n * Preset configurations for common use cases\n */\nexport const LIVE_PRESETS = {\n /** Read-only monitoring (no interaction) */\n readonly: { interactive: false } as LiveSessionOptions,\n /** Interactive control (human-in-the-loop) */\n interactive: { interactive: true } as LiveSessionOptions,\n /** Watch-only without controls */\n monitoring: { interactive: false, showControls: false } as LiveSessionOptions,\n} as const;\n\n/**\n * Build a live session URL with query parameters\n * \n * @param debugUrl - Live session debug URL (e.g., from task.debugUrl)\n * @param options - Live session configuration options\n * @returns URL with query parameters for iframe embedding\n * \n * @example\n * ```typescript\n * const url = buildLiveUrl(task.debugUrl, { interactive: true });\n * // Returns: https://example.com/sessions/abc?interactive=true\n * ```\n */\nexport function buildLiveUrl(\n debugUrl: string,\n options: LiveSessionOptions = {}\n): string {\n if (!debugUrl) {\n throw new Error(\n 'debugUrl is required. Ensure your backend returns debugUrl in the task response. ' +\n 'Contact support@morphllm.com if you need help.'\n );\n } \n\n const url = new URL(debugUrl);\n \n // Add query parameters for supported options\n if (options.interactive !== undefined) {\n url.searchParams.set('interactive', String(options.interactive));\n }\n \n if (options.theme) {\n url.searchParams.set('theme', options.theme);\n }\n \n if (options.showControls !== undefined) {\n url.searchParams.set('showControls', String(options.showControls));\n }\n \n if (options.pageId) {\n url.searchParams.set('pageId', options.pageId);\n }\n \n if (options.pageIndex) {\n url.searchParams.set('pageIndex', options.pageIndex);\n }\n \n return url.toString();\n}\n\n/**\n * Build iframe HTML for embedding a live session\n * \n * @param debugUrl - Live session debug URL\n * @param options - Iframe configuration including dimensions and session options\n * @returns HTML iframe element as string\n * \n * @example\n * ```typescript\n * const iframe = buildLiveIframe(task.debugUrl, {\n * interactive: true,\n * width: '100%',\n * height: '600px'\n * });\n * ```\n */\nexport function buildLiveIframe(\n debugUrl: string,\n options: IframeOptions = {}\n): string {\n const {\n width = '100%',\n height = '600px',\n style = '',\n className = '',\n ...sessionOptions\n } = options;\n\n const src = buildLiveUrl(debugUrl, sessionOptions);\n \n // Convert numeric dimensions to pixels\n const widthStr = typeof width === 'number' ? `${width}px` : width;\n const heightStr = typeof height === 'number' ? `${height}px` : height;\n \n // Build style attribute\n const baseStyle = `width: ${widthStr}; height: ${heightStr}; border: none;`;\n const fullStyle = style ? `${baseStyle} ${style}` : baseStyle;\n \n // Build iframe attributes\n const attributes = [\n `src=\"${src}\"`,\n `style=\"${fullStyle}\"`,\n ];\n \n if (className) {\n attributes.push(`class=\"${className}\"`);\n }\n \n return `<iframe ${attributes.join(' ')}></iframe>`;\n}\n\n/**\n * Build complete embed code with HTML snippet\n * \n * @param debugUrl - Live session debug URL\n * @param options - Iframe configuration\n * @returns Multi-line HTML snippet ready to copy-paste\n * \n * @example\n * ```typescript\n * const code = buildEmbedCode(task.debugUrl, { interactive: false });\n * console.log(code);\n * // <!-- Embed Morph Live Session -->\n * // <iframe src=\"...\" style=\"...\"></iframe>\n * ```\n */\nexport function buildEmbedCode(\n debugUrl: string,\n options: IframeOptions = {}\n): string {\n const iframe = buildLiveIframe(debugUrl, options);\n return `<!-- Embed Morph Live Session -->\\n${iframe}`;\n}\n\n/**\n * Get live session options from preset name or custom config\n * \n * @internal\n */\nexport function resolvePreset(\n optionsOrPreset?: string | IframeOptions\n): IframeOptions {\n if (!optionsOrPreset) {\n return {};\n }\n \n if (typeof optionsOrPreset === 'string') {\n const preset = LIVE_PRESETS[optionsOrPreset as keyof typeof LIVE_PRESETS];\n if (!preset) {\n throw new Error(\n `Unknown preset: ${optionsOrPreset}. Available presets: ${Object.keys(LIVE_PRESETS).join(', ')}`\n );\n }\n return preset;\n }\n \n return optionsOrPreset;\n}\n\n","/**\n * Core implementation for browser automation tasks\n */\n\nimport { fetchWithRetry, withTimeout } from '../utils/resilience.js';\nimport type {\n BrowserConfig,\n BrowserTaskInput,\n BrowserTaskInputWithSchema,\n BrowserTaskResult,\n BrowserTaskWithPromise,\n BrowserTaskWithPromiseAndSchema,\n RecordingStatus,\n ErrorsResponse,\n LiveSessionOptions,\n IframeOptions,\n} from './types.js';\nimport { buildLiveUrl, buildLiveIframe, buildEmbedCode, resolvePreset } from './live.js';\n\nconst DEFAULT_CONFIG = {\n apiUrl: process.env.MORPH_ENVIRONMENT === 'DEV' \n ? 'http://localhost:8000'\n : 'https://browser.morphllm.com',\n timeout: 120000, // 2 minutes for complex tasks\n debug: false,\n};\n\n/**\n * BrowserClient class for easier usage with instance configuration\n */\nexport class BrowserClient {\n private config: BrowserConfig;\n\n constructor(config: BrowserConfig = {}) {\n this.config = {\n ...DEFAULT_CONFIG,\n ...config,\n };\n }\n\n /**\n * Execute a browser automation task\n */\n async execute(input: BrowserTaskInput): Promise<BrowserTaskResult> {\n return executeBrowserTask(input, this.config);\n }\n\n async createTask(input: BrowserTaskInput): Promise<BrowserTaskWithPromise>;\n async createTask<T>(input: BrowserTaskInputWithSchema<T>): Promise<BrowserTaskWithPromiseAndSchema<T>>;\n async createTask<T>(\n input: BrowserTaskInput | BrowserTaskInputWithSchema<T>\n ): Promise<BrowserTaskWithPromise | BrowserTaskWithPromiseAndSchema<T>> {\n if ('schema' in input) {\n const taskInput: BrowserTaskInput = {\n ...input,\n structured_output: stringifyStructuredOutput(input.schema),\n };\n const result = await executeBrowserTask(taskInput, this.config);\n return wrapTaskResponseWithSchema(result, this.config, input.schema);\n } else {\n const result = await executeBrowserTask(input, this.config);\n return wrapTaskResponse(result, this.config);\n }\n }\n\n /**\n * Execute task with recording and wait for video to be ready\n */\n async executeWithRecording(\n input: BrowserTaskInput & { record_video: true }\n ): Promise<BrowserTaskResult & { recording?: RecordingStatus }> {\n return executeWithRecording(input, this.config);\n }\n\n /**\n * Get recording status and URLs\n */\n async getRecording(recordingId: string): Promise<RecordingStatus> {\n return getRecording(recordingId, this.config);\n }\n\n /**\n * Wait for recording to complete with automatic polling\n */\n async waitForRecording(\n recordingId: string,\n options?: { timeout?: number; pollInterval?: number }\n ): Promise<RecordingStatus> {\n return waitForRecording(recordingId, this.config, options);\n }\n\n /**\n * Get errors from recording with screenshots\n */\n async getErrors(recordingId: string): Promise<ErrorsResponse> {\n return getErrors(recordingId, this.config);\n }\n\n /**\n * Check if browser worker service is healthy\n */\n async checkHealth(): Promise<{\n ok: boolean;\n google_configured: boolean;\n database_configured: boolean;\n s3_configured: boolean;\n error?: string;\n }> {\n return checkHealth(this.config);\n }\n}\n\n/**\n * Execute a natural language browser automation task\n * \n * @param input - Task parameters\n * @param config - Optional configuration (apiKey, apiUrl to override default)\n * @returns Task result with success status and findings\n * \n * @example\n * ```typescript\n * const result = await executeBrowserTask(\n * {\n * task: \"Test checkout flow for buying a pineapple\",\n * url: \"https://3000-abc.e2b.dev\",\n * max_steps: 20,\n * repo_id: \"my-project\",\n * commit_id: \"uuid-here\"\n * },\n * {\n * apiKey: process.env.MORPH_API_KEY,\n * // apiUrl: 'http://localhost:8001' // Override for local testing\n * }\n * );\n * \n * if (result.success) {\n * console.log('Task completed:', result.result);\n * console.log('Replay:', result.replay_url);\n * }\n * ```\n */\nexport async function executeBrowserTask(\n input: BrowserTaskInput,\n config: BrowserConfig = {}\n): Promise<BrowserTaskResult> {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n const timeout = config.timeout || DEFAULT_CONFIG.timeout;\n const debug = config.debug || false;\n\n if (!input.task || input.task.trim().length === 0) {\n return { \n success: false, \n error: 'Task description is required. Example: \"Go to example.com and click the login button\"' \n };\n }\n\n if (input.max_steps !== undefined && (input.max_steps < 1 || input.max_steps > 50)) {\n return { \n success: false, \n error: 'max_steps must be between 1 and 50. Use more steps for complex multi-page flows.' \n };\n }\n\n if (debug) {\n console.log(`[Browser] Task: \"${input.task.slice(0, 60)}...\" url=${input.url || 'none'} maxSteps=${input.max_steps ?? 10}`);\n console.log(`[Browser] Recording: ${input.record_video ? 'yes' : 'no'} | Calling ${apiUrl}/browser-task`);\n }\n\n const startTime = Date.now();\n\n try {\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n if (config.apiKey) headers['Authorization'] = `Bearer ${config.apiKey}`;\n\n const fetchPromise = fetchWithRetry(\n `${apiUrl}/browser-task`,\n {\n method: 'POST',\n headers,\n body: JSON.stringify({\n task: input.task,\n url: input.url,\n max_steps: input.max_steps ?? 10,\n model: input.model ?? 'morph-computer-use-v0',\n viewport_width: input.viewport_width ?? 1280,\n viewport_height: input.viewport_height ?? 720,\n repo_id: input.repo_id,\n commit_id: input.commit_id,\n record_video: input.record_video ?? false,\n video_width: input.video_width ?? input.viewport_width ?? 1280,\n video_height: input.video_height ?? input.viewport_height ?? 720,\n structured_output: input.structured_output,\n }),\n },\n config.retryConfig\n );\n\n const response = await withTimeout(\n fetchPromise,\n timeout,\n `Browser task timed out after ${timeout}ms. Consider increasing timeout or reducing max_steps.`\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n if (debug) console.error(`[Browser] Error: ${response.status} - ${errorText}`);\n throw new Error(`HTTP ${response.status}: ${errorText}`);\n }\n\n const result: BrowserTaskResult = await response.json();\n const elapsed = Date.now() - startTime;\n \n if (debug) {\n console.log(`[Browser] ✅ ${result.success ? 'Success' : 'Failed'} in ${elapsed}ms | steps=${result.steps_taken ?? 0} recordingId=${result.recording_id ?? 'none'}`);\n }\n\n return result;\n\n } catch (error) {\n if (error instanceof Error) {\n // Handle network errors\n if (error.message.includes('ECONNREFUSED') || error.message.includes('fetch failed')) {\n return {\n success: false,\n error: `Cannot connect to browser worker at ${apiUrl}. Ensure the service is running and accessible. For local dev, set MORPH_ENVIRONMENT=DEV.`,\n };\n }\n\n return {\n success: false,\n error: error.message,\n };\n }\n\n return {\n success: false,\n error: String(error),\n };\n }\n}\n\n/**\n * Get recording status and video URL\n * \n * @param recordingId - Recording UUID from BrowserTaskResult\n * @param config - Configuration with apiKey\n * @returns Recording status with video URL when ready\n * \n * @example\n * ```typescript\n * const status = await getRecording('uuid-here', { apiKey: 'key' });\n * if (status.status === 'COMPLETED' && status.video_url) {\n * console.log('Video ready:', status.video_url);\n * }\n * ```\n */\nexport async function getRecording(\n recordingId: string,\n config: BrowserConfig = {}\n): Promise<RecordingStatus> {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n const debug = config.debug || false;\n\n if (!config.apiKey) {\n throw new Error('API key required for getRecording');\n }\n\n if (debug) console.log(`[Browser] getRecording: ${recordingId}`);\n\n const response = await fetch(`${apiUrl}/recordings/${recordingId}`, {\n method: 'GET',\n headers: { 'Authorization': `Bearer ${config.apiKey}` },\n });\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n if (debug) console.error(`[Browser] getRecording error: ${response.status} - ${errorText}`);\n throw new Error(`HTTP ${response.status}: ${errorText}`);\n }\n\n const recording = await response.json();\n if (debug) console.log(`[Browser] Recording status: ${recording.status}`);\n\n return recording;\n}\n\n/**\n * Wait for recording to complete with automatic polling\n * \n * @param recordingId - Recording UUID\n * @param config - Configuration with apiKey\n * @param options - Polling options\n * @returns Recording status when completed or errored\n * \n * @example\n * ```typescript\n * const result = await executeBrowserTask({ task: '...', record_video: true }, config);\n * if (result.recording_id) {\n * const recording = await waitForRecording(result.recording_id, config, {\n * timeout: 60000, // 1 minute\n * pollInterval: 2000 // Check every 2 seconds\n * });\n * console.log('Video URL:', recording.video_url);\n * }\n * ```\n */\nexport async function waitForRecording(\n recordingId: string,\n config: BrowserConfig = {},\n options: { timeout?: number; pollInterval?: number } = {}\n): Promise<RecordingStatus> {\n const timeout = options.timeout ?? 60000; // Default 1 minute\n const pollInterval = options.pollInterval ?? 2000; // Default 2 seconds\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n const status = await getRecording(recordingId, config);\n \n if (status.status === 'COMPLETED' || status.status === 'ERROR') {\n return status;\n }\n\n // Wait before next poll\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n }\n\n throw new Error(`Recording timeout after ${timeout}ms - status still pending`);\n}\n\n/**\n * Execute task with recording and wait for video to be ready\n * \n * @param input - Task parameters with record_video=true\n * @param config - Configuration with apiKey\n * @returns Task result with ready video URL\n * \n * @example\n * ```typescript\n * const result = await executeWithRecording(\n * {\n * task: \"Test checkout flow\",\n * url: \"https://example.com\",\n * record_video: true,\n * repo_id: \"my-project\"\n * },\n * { apiKey: process.env.MORPH_API_KEY }\n * );\n * \n * console.log('Task result:', result.result);\n * console.log('Video URL:', result.recording?.video_url);\n * ```\n */\nexport async function executeWithRecording(\n input: BrowserTaskInput & { record_video: true },\n config: BrowserConfig = {}\n): Promise<BrowserTaskResult & { recording?: RecordingStatus }> {\n // Execute task with recording\n const taskResult = await executeBrowserTask(input, config);\n\n // If recording was created, wait for it to complete\n if (taskResult.recording_id) {\n try {\n const recording = await waitForRecording(\n taskResult.recording_id,\n config,\n { timeout: 60000, pollInterval: 2000 }\n );\n return {\n ...taskResult,\n recording,\n };\n } catch (error) {\n // Return task result even if recording fails\n return {\n ...taskResult,\n recording: {\n id: taskResult.recording_id,\n status: 'ERROR',\n error: error instanceof Error ? error.message : String(error),\n created_at: new Date().toISOString(),\n },\n };\n }\n }\n\n return taskResult;\n}\n\n/**\n * Get errors from recording with screenshots\n * \n * Screenshots are captured in real-time (500ms after error occurs) during the browser session.\n * \n * @param recordingId - Recording UUID from BrowserTaskResult\n * @param config - Configuration with apiKey\n * @returns Errors with real-time screenshots\n * \n * @example\n * ```typescript\n * const { errors, total_errors } = await getErrors('uuid-here', { apiKey: 'key' });\n * \n * console.log(`Found ${total_errors} errors`);\n * \n * errors.forEach(err => {\n * console.log(`[${err.type}] ${err.message}`);\n * if (err.url) console.log(` URL: ${err.url}`);\n * if (err.screenshot_url) console.log(` Screenshot: ${err.screenshot_url}`);\n * \n * // Download screenshot\n * if (err.screenshot_url) {\n * const response = await fetch(err.screenshot_url);\n * const screenshot = await response.arrayBuffer();\n * // Save or process screenshot\n * }\n * });\n * ```\n */\nexport async function getErrors(\n recordingId: string,\n config: BrowserConfig = {}\n): Promise<ErrorsResponse> {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n const debug = config.debug || false;\n\n if (!config.apiKey) {\n throw new Error('API key required for getErrors');\n }\n\n if (debug) console.log(`[Browser] getErrors: ${recordingId}`);\n\n const response = await fetch(`${apiUrl}/recordings/${recordingId}/errors`, {\n method: 'GET',\n headers: { 'Authorization': `Bearer ${config.apiKey}` },\n });\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n if (debug) console.error(`[Browser] getErrors error: ${response.status} - ${errorText}`);\n throw new Error(`HTTP ${response.status}: ${errorText}`);\n }\n\n const errors = await response.json();\n if (debug) console.log(`[Browser] Found ${errors.total_errors} errors`);\n\n return errors;\n}\n\n/**\n * Helper to serialize Zod schema for API\n */\nfunction stringifyStructuredOutput(schema: any): string {\n try {\n return JSON.stringify({\n type: 'object',\n description: 'Zod schema definition (Zod v3)',\n zodDef: schema._def,\n });\n } catch (error) {\n console.warn('[Browser] Failed to serialize Zod schema:', error);\n return JSON.stringify({\n type: 'object',\n description: 'Schema serialization failed',\n });\n }\n}\n\n/**\n * Parse and validate structured task output\n */\nfunction parseStructuredTaskOutput<T>(\n result: BrowserTaskResult,\n schema: any\n): BrowserTaskResult & { parsed: T | null } {\n if (!result.output) {\n return { ...result, parsed: null };\n }\n\n try {\n const parsed = JSON.parse(result.output);\n const validated = schema.parse(parsed) as T;\n return { ...result, parsed: validated };\n } catch (error) {\n if (error instanceof SyntaxError) {\n return { ...result, parsed: null };\n }\n throw error;\n }\n}\n\n/**\n * Get current task status\n */\nasync function getTaskStatus(\n taskId: string,\n config: BrowserConfig\n): Promise<BrowserTaskResult> {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n const debug = config.debug || false;\n\n if (debug) console.log(`[Browser] getTaskStatus: ${taskId}`);\n\n const headers: Record<string, string> = {};\n if (config.apiKey) headers['Authorization'] = `Bearer ${config.apiKey}`;\n\n const response = await fetch(`${apiUrl}/tasks/${taskId}`, {\n method: 'GET',\n headers,\n });\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n if (debug) console.error(`[Browser] getTaskStatus error: ${response.status} - ${errorText}`);\n throw new Error(`HTTP ${response.status}: ${errorText}`);\n }\n\n const result: BrowserTaskResult = await response.json();\n if (debug) console.log(`[Browser] Task status: ${result.status}`);\n\n return result;\n}\n\n/**\n * Generate live URL for watching task execution in real-time\n */\nfunction generateLiveUrl(taskId: string, config: BrowserConfig): string {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n const baseUrl = apiUrl.replace('/api', '');\n return `${baseUrl}/tasks/${taskId}/live`;\n}\n\n/**\n * Poll task until completion\n */\nasync function pollTaskUntilComplete(\n taskId: string,\n config: BrowserConfig,\n pollConfig: { interval?: number; timeout?: number } = {}\n): Promise<BrowserTaskResult> {\n const interval = pollConfig.interval ?? 2000; // 2 seconds\n const timeout = pollConfig.timeout ?? 300000; // 5 minutes\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n const status = await getTaskStatus(taskId, config);\n \n if (status.status === 'completed' || status.status === 'failed') {\n return status;\n }\n\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n\n throw new Error(`Task polling timeout after ${timeout}ms`);\n}\n\n/**\n * Wrap task response with convenience methods\n */\nfunction wrapTaskResponse(\n result: BrowserTaskResult,\n config: BrowserConfig\n): BrowserTaskWithPromise {\n if (!result.task_id) {\n throw new Error('task_id is required to wrap response');\n }\n\n const wrapped: BrowserTaskWithPromise = {\n ...result,\n task_id: result.task_id,\n liveUrl: generateLiveUrl(result.task_id, config),\n complete: async (pollConfig?: { interval?: number; timeout?: number }) => {\n return pollTaskUntilComplete(result.task_id!, config, pollConfig);\n },\n // Add Steel live session helpers - either functional or error-throwing\n getLiveUrl: result.debugUrl\n ? (options?: LiveSessionOptions) => buildLiveUrl(result.debugUrl!, options)\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help.'\n );\n },\n getLiveIframe: result.debugUrl\n ? (optionsOrPreset?: string | IframeOptions) => {\n const options = resolvePreset(optionsOrPreset);\n return buildLiveIframe(result.debugUrl!, options);\n }\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help.'\n );\n },\n getEmbedCode: result.debugUrl\n ? () => buildEmbedCode(result.debugUrl!)\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. Contact support@morphllm.com if you need help.'\n );\n },\n };\n\n return wrapped;\n}\n\n/**\n * Wrap task response with schema validation\n */\nfunction wrapTaskResponseWithSchema<T>(\n result: BrowserTaskResult,\n config: BrowserConfig,\n schema: any\n): BrowserTaskWithPromiseAndSchema<T> {\n if (!result.task_id) {\n throw new Error('task_id is required to wrap response');\n }\n\n const parsed = result.output\n ? parseStructuredTaskOutput<T>(result, schema)\n : { ...result, parsed: null };\n\n const wrapped: BrowserTaskWithPromiseAndSchema<T> = {\n ...parsed,\n task_id: result.task_id,\n liveUrl: generateLiveUrl(result.task_id, config),\n complete: async (pollConfig?: { interval?: number; timeout?: number }) => {\n const finalResult = await pollTaskUntilComplete(result.task_id!, config, pollConfig);\n return parseStructuredTaskOutput<T>(finalResult, schema);\n },\n // Add Steel live session helpers - either functional or error-throwing\n getLiveUrl: result.debugUrl\n ? (options?: LiveSessionOptions) => buildLiveUrl(result.debugUrl!, options)\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. ' +\n 'Contact support@morphllm.com if you need help enabling live sessions. '\n );\n },\n getLiveIframe: result.debugUrl\n ? (optionsOrPreset?: string | IframeOptions) => {\n const options = resolvePreset(optionsOrPreset);\n return buildLiveIframe(result.debugUrl!, options);\n }\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. ' +\n 'Contact support@morphllm.com if you need help enabling live sessions.'\n );\n },\n getEmbedCode: result.debugUrl\n ? () => buildEmbedCode(result.debugUrl!)\n : () => {\n throw new Error(\n 'Live sessions not available. Your backend must return a debugUrl in the response. ' +\n 'Contact support@morphllm.com if you need help enabling live sessions.'\n );\n },\n };\n\n return wrapped;\n}\n\n/**\n * Check if browser worker service is healthy\n * \n * @param config - Optional configuration\n * @returns Health status\n */\nexport async function checkHealth(config: BrowserConfig = {}): Promise<{\n ok: boolean;\n google_configured: boolean;\n database_configured: boolean;\n s3_configured: boolean;\n error?: string;\n}> {\n const apiUrl = config.apiUrl || DEFAULT_CONFIG.apiUrl;\n\n try {\n const response = await fetch(`${apiUrl}/health`, {\n method: 'GET',\n headers: config.apiKey\n ? { 'Authorization': `Bearer ${config.apiKey}` }\n : {},\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}`);\n }\n\n const data = await response.json();\n return {\n ok: true,\n google_configured: data.google_configured ?? false,\n database_configured: data.database_configured ?? false,\n s3_configured: data.s3_configured ?? false,\n };\n } catch (error) {\n return {\n ok: false,\n google_configured: false,\n database_configured: false,\n s3_configured: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\n"],"mappings":";;;;;;AAWO,IAAM,eAAe;AAAA;AAAA,EAE1B,UAAU,EAAE,aAAa,MAAM;AAAA;AAAA,EAE/B,aAAa,EAAE,aAAa,KAAK;AAAA;AAAA,EAEjC,YAAY,EAAE,aAAa,OAAO,cAAc,MAAM;AACxD;AAeO,SAAS,aACd,UACA,UAA8B,CAAC,GACvB;AACR,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,QAAM,MAAM,IAAI,IAAI,QAAQ;AAG5B,MAAI,QAAQ,gBAAgB,QAAW;AACrC,QAAI,aAAa,IAAI,eAAe,OAAO,QAAQ,WAAW,CAAC;AAAA,EACjE;AAEA,MAAI,QAAQ,OAAO;AACjB,QAAI,aAAa,IAAI,SAAS,QAAQ,KAAK;AAAA,EAC7C;AAEA,MAAI,QAAQ,iBAAiB,QAAW;AACtC,QAAI,aAAa,IAAI,gBAAgB,OAAO,QAAQ,YAAY,CAAC;AAAA,EACnE;AAEA,MAAI,QAAQ,QAAQ;AAClB,QAAI,aAAa,IAAI,UAAU,QAAQ,MAAM;AAAA,EAC/C;AAEA,MAAI,QAAQ,WAAW;AACrB,QAAI,aAAa,IAAI,aAAa,QAAQ,SAAS;AAAA,EACrD;AAEA,SAAO,IAAI,SAAS;AACtB;AAkBO,SAAS,gBACd,UACA,UAAyB,CAAC,G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AAA,MAC7C,qBAAqB,KAAK,uBAAuB;AAAA,MACjD,eAAe,KAAK,iBAAiB;AAAA,IACvC;AAAA,EACF,SAAS,OAAO;AACd,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,MACrB,eAAe;AAAA,MACf,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,IAC9D;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,230 +0,0 @@
|
|
|
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 };
|
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, 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';
|
package/dist/git/types.d.ts
DELETED
|
@@ -1,91 +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 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.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';
|