@morphllm/morphsdk 0.2.40 → 0.2.41
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/anthropic-DpEAqqZF.d.ts +88 -0
- package/dist/{chunk-NCVWIW7L.js → chunk-EYHXBQQX.js} +7 -81
- package/dist/chunk-EYHXBQQX.js.map +1 -0
- package/dist/{chunk-LUI7APXX.js → chunk-FP7INILQ.js} +2 -2
- package/dist/{chunk-4WIBODS7.js → chunk-GDR65N2J.js} +1 -1
- package/dist/chunk-GDR65N2J.js.map +1 -0
- package/dist/{chunk-JSZQVUSE.js → chunk-GGBB2HDM.js} +2 -2
- package/dist/{chunk-7MCSSJJA.js → chunk-GU3SULV5.js} +2 -2
- package/dist/{chunk-Y2IY7NYY.js → chunk-O5DA5V5S.js} +2 -2
- package/dist/{chunk-4A7UBGLS.js → chunk-OUEJ6XEO.js} +2 -2
- package/dist/chunk-SQN4DUQS.js +84 -0
- package/dist/chunk-SQN4DUQS.js.map +1 -0
- package/dist/{chunk-N5654KQR.js → chunk-W3XLPMV3.js} +15 -15
- package/dist/{chunk-DIWNR3UP.js → chunk-W7NRFNLI.js} +4 -4
- package/dist/{chunk-AG3ICTC5.js → chunk-WM77HRKO.js} +4 -7
- package/dist/chunk-WM77HRKO.js.map +1 -0
- package/dist/{chunk-WHZQDTM6.js → chunk-ZRLEAPZV.js} +2 -2
- package/dist/client.cjs +3 -6
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +114 -0
- package/dist/client.js +5 -4
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.d.ts +275 -0
- package/dist/git/client.js +1 -1
- package/dist/git/config.d.ts +11 -0
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.d.ts +5 -0
- package/dist/git/index.js +1 -1
- package/dist/git/types.d.ts +115 -0
- package/dist/index.cjs +3 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +5 -4
- package/dist/modelrouter/core.d.ts +69 -0
- package/dist/modelrouter/index.d.ts +2 -0
- package/dist/modelrouter/types.d.ts +39 -0
- package/dist/openai-BkKsS30n.d.ts +111 -0
- package/dist/tools/browser/anthropic.d.ts +51 -0
- package/dist/tools/browser/anthropic.js +2 -1
- package/dist/tools/browser/anthropic.js.map +1 -1
- package/dist/tools/browser/core.d.ts +203 -0
- package/dist/tools/browser/core.js +2 -1
- package/dist/tools/browser/index.d.ts +5 -0
- package/dist/tools/browser/index.js +7 -5
- package/dist/tools/browser/live.cjs +112 -0
- package/dist/tools/browser/live.cjs.map +1 -0
- package/dist/tools/browser/live.d.ts +75 -0
- package/dist/tools/browser/live.js +16 -0
- package/dist/tools/browser/live.js.map +1 -0
- package/dist/tools/browser/openai.d.ts +73 -0
- package/dist/tools/browser/openai.js +2 -1
- package/dist/tools/browser/openai.js.map +1 -1
- package/dist/tools/browser/prompts.d.ts +7 -0
- package/dist/tools/browser/types.d.ts +255 -0
- package/dist/tools/browser/vercel.d.ts +69 -0
- package/dist/tools/browser/vercel.js +2 -1
- package/dist/tools/browser/vercel.js.map +1 -1
- package/dist/tools/codebase_search/anthropic.cjs +2 -5
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.d.ts +40 -0
- package/dist/tools/codebase_search/anthropic.js +2 -2
- package/dist/tools/codebase_search/core.cjs +3 -6
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.d.ts +40 -0
- package/dist/tools/codebase_search/core.js +1 -1
- package/dist/tools/codebase_search/index.cjs +2 -5
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.d.ts +10 -0
- package/dist/tools/codebase_search/index.js +6 -6
- package/dist/tools/codebase_search/openai.cjs +2 -5
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.d.ts +87 -0
- package/dist/tools/codebase_search/openai.js +2 -2
- package/dist/tools/codebase_search/prompts.d.ts +7 -0
- package/dist/tools/codebase_search/types.d.ts +50 -0
- package/dist/tools/codebase_search/vercel.cjs +2 -5
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.d.ts +65 -0
- package/dist/tools/codebase_search/vercel.js +2 -2
- package/dist/tools/fastapply/anthropic.d.ts +4 -0
- package/dist/tools/fastapply/core.d.ts +41 -0
- package/dist/tools/fastapply/index.d.ts +10 -0
- package/dist/tools/fastapply/openai.d.ts +4 -0
- package/dist/tools/fastapply/prompts.d.ts +7 -0
- package/dist/tools/fastapply/types.d.ts +77 -0
- package/dist/tools/fastapply/vercel.d.ts +4 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/utils/resilience.d.ts +58 -0
- package/dist/tools/warp_grep/agent/config.d.ts +8 -0
- package/dist/tools/warp_grep/agent/formatter.d.ts +14 -0
- package/dist/tools/warp_grep/agent/grep_helpers.d.ts +16 -0
- package/dist/tools/warp_grep/agent/parser.d.ts +16 -0
- package/dist/tools/warp_grep/agent/prompt.d.ts +4 -0
- package/dist/tools/warp_grep/agent/runner.d.ts +10 -0
- package/dist/tools/warp_grep/agent/runner.js +6 -6
- package/dist/tools/warp_grep/agent/types.d.ts +44 -0
- package/dist/tools/warp_grep/anthropic.d.ts +14 -0
- package/dist/tools/warp_grep/anthropic.js +7 -7
- package/dist/tools/warp_grep/index.d.ts +11 -0
- package/dist/tools/warp_grep/index.js +9 -9
- package/dist/tools/warp_grep/openai.d.ts +33 -0
- package/dist/tools/warp_grep/openai.js +7 -7
- package/dist/tools/warp_grep/providers/command.d.ts +48 -0
- package/dist/tools/warp_grep/providers/local.d.ts +30 -0
- package/dist/tools/warp_grep/providers/types.d.ts +49 -0
- package/dist/tools/warp_grep/tools/analyse.d.ts +10 -0
- package/dist/tools/warp_grep/tools/finish.d.ts +10 -0
- package/dist/tools/warp_grep/tools/grep.d.ts +8 -0
- package/dist/tools/warp_grep/tools/read.d.ts +9 -0
- package/dist/tools/warp_grep/utils/files.d.ts +3 -0
- package/dist/tools/warp_grep/utils/format.d.ts +4 -0
- package/dist/tools/warp_grep/utils/paths.d.ts +7 -0
- package/dist/tools/warp_grep/utils/ripgrep.d.ts +11 -0
- package/dist/tools/warp_grep/vercel.d.ts +33 -0
- package/dist/tools/warp_grep/vercel.js +7 -7
- package/dist/vercel-B1GZ_g9N.d.ts +69 -0
- package/package.json +2 -3
- package/dist/chunk-4WIBODS7.js.map +0 -1
- package/dist/chunk-AG3ICTC5.js.map +0 -1
- package/dist/chunk-NCVWIW7L.js.map +0 -1
- /package/dist/{chunk-LUI7APXX.js.map → chunk-FP7INILQ.js.map} +0 -0
- /package/dist/{chunk-JSZQVUSE.js.map → chunk-GGBB2HDM.js.map} +0 -0
- /package/dist/{chunk-7MCSSJJA.js.map → chunk-GU3SULV5.js.map} +0 -0
- /package/dist/{chunk-Y2IY7NYY.js.map → chunk-O5DA5V5S.js.map} +0 -0
- /package/dist/{chunk-4A7UBGLS.js.map → chunk-OUEJ6XEO.js.map} +0 -0
- /package/dist/{chunk-N5654KQR.js.map → chunk-W3XLPMV3.js.map} +0 -0
- /package/dist/{chunk-DIWNR3UP.js.map → chunk-W7NRFNLI.js.map} +0 -0
- /package/dist/{chunk-WHZQDTM6.js.map → chunk-ZRLEAPZV.js.map} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
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,84 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildEmbedCode,
|
|
3
|
+
buildLiveIframe,
|
|
4
|
+
buildLiveUrl,
|
|
5
|
+
resolvePreset
|
|
6
|
+
} from "./chunk-SQN4DUQS.js";
|
|
1
7
|
import {
|
|
2
8
|
fetchWithRetry,
|
|
3
9
|
withTimeout
|
|
4
10
|
} from "./chunk-4VWJFZVS.js";
|
|
5
11
|
|
|
6
|
-
// tools/browser/live.ts
|
|
7
|
-
var LIVE_PRESETS = {
|
|
8
|
-
/** Read-only monitoring (no interaction) */
|
|
9
|
-
readonly: { interactive: false },
|
|
10
|
-
/** Interactive control (human-in-the-loop) */
|
|
11
|
-
interactive: { interactive: true },
|
|
12
|
-
/** Watch-only without controls */
|
|
13
|
-
monitoring: { interactive: false, showControls: false }
|
|
14
|
-
};
|
|
15
|
-
function buildLiveUrl(debugUrl, options = {}) {
|
|
16
|
-
if (!debugUrl) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
"debugUrl is required. Ensure your backend returns debugUrl in the task response. Contact support@morphllm.com if you need help."
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
const url = new URL(debugUrl);
|
|
22
|
-
if (options.interactive !== void 0) {
|
|
23
|
-
url.searchParams.set("interactive", String(options.interactive));
|
|
24
|
-
}
|
|
25
|
-
if (options.theme) {
|
|
26
|
-
url.searchParams.set("theme", options.theme);
|
|
27
|
-
}
|
|
28
|
-
if (options.showControls !== void 0) {
|
|
29
|
-
url.searchParams.set("showControls", String(options.showControls));
|
|
30
|
-
}
|
|
31
|
-
if (options.pageId) {
|
|
32
|
-
url.searchParams.set("pageId", options.pageId);
|
|
33
|
-
}
|
|
34
|
-
if (options.pageIndex) {
|
|
35
|
-
url.searchParams.set("pageIndex", options.pageIndex);
|
|
36
|
-
}
|
|
37
|
-
return url.toString();
|
|
38
|
-
}
|
|
39
|
-
function buildLiveIframe(debugUrl, options = {}) {
|
|
40
|
-
const {
|
|
41
|
-
width = "100%",
|
|
42
|
-
height = "600px",
|
|
43
|
-
style = "",
|
|
44
|
-
className = "",
|
|
45
|
-
...sessionOptions
|
|
46
|
-
} = options;
|
|
47
|
-
const src = buildLiveUrl(debugUrl, sessionOptions);
|
|
48
|
-
const widthStr = typeof width === "number" ? `${width}px` : width;
|
|
49
|
-
const heightStr = typeof height === "number" ? `${height}px` : height;
|
|
50
|
-
const baseStyle = `width: ${widthStr}; height: ${heightStr}; border: none;`;
|
|
51
|
-
const fullStyle = style ? `${baseStyle} ${style}` : baseStyle;
|
|
52
|
-
const attributes = [
|
|
53
|
-
`src="${src}"`,
|
|
54
|
-
`style="${fullStyle}"`
|
|
55
|
-
];
|
|
56
|
-
if (className) {
|
|
57
|
-
attributes.push(`class="${className}"`);
|
|
58
|
-
}
|
|
59
|
-
return `<iframe ${attributes.join(" ")}></iframe>`;
|
|
60
|
-
}
|
|
61
|
-
function buildEmbedCode(debugUrl, options = {}) {
|
|
62
|
-
const iframe = buildLiveIframe(debugUrl, options);
|
|
63
|
-
return `<!-- Embed Morph Live Session -->
|
|
64
|
-
${iframe}`;
|
|
65
|
-
}
|
|
66
|
-
function resolvePreset(optionsOrPreset) {
|
|
67
|
-
if (!optionsOrPreset) {
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
if (typeof optionsOrPreset === "string") {
|
|
71
|
-
const preset = LIVE_PRESETS[optionsOrPreset];
|
|
72
|
-
if (!preset) {
|
|
73
|
-
throw new Error(
|
|
74
|
-
`Unknown preset: ${optionsOrPreset}. Available presets: ${Object.keys(LIVE_PRESETS).join(", ")}`
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return preset;
|
|
78
|
-
}
|
|
79
|
-
return optionsOrPreset;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
12
|
// tools/browser/core.ts
|
|
83
13
|
var DEFAULT_CONFIG = {
|
|
84
14
|
apiUrl: process.env.MORPH_ENVIRONMENT === "DEV" ? "http://localhost:8000" : "https://browser.morphllm.com",
|
|
@@ -464,10 +394,6 @@ async function checkHealth(config = {}) {
|
|
|
464
394
|
}
|
|
465
395
|
|
|
466
396
|
export {
|
|
467
|
-
LIVE_PRESETS,
|
|
468
|
-
buildLiveUrl,
|
|
469
|
-
buildLiveIframe,
|
|
470
|
-
buildEmbedCode,
|
|
471
397
|
BrowserClient,
|
|
472
398
|
executeBrowserTask,
|
|
473
399
|
getRecording,
|
|
@@ -476,4 +402,4 @@ export {
|
|
|
476
402
|
getErrors,
|
|
477
403
|
checkHealth
|
|
478
404
|
};
|
|
479
|
-
//# sourceMappingURL=chunk-
|
|
405
|
+
//# sourceMappingURL=chunk-EYHXBQQX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/browser/core.ts"],"sourcesContent":["/**\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: 1000000, // 10 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 * Returns the full task result including rich agent history data (urls, errors, \n * action_history, judgement, etc.). When using this as an agent tool, use the\n * formatResult() functions from the SDK adapters to return a concise summary.\n * \n * @param input - Task parameters\n * @param config - Optional configuration (apiKey, apiUrl to override default)\n * @returns Task result with success status, findings, and comprehensive execution history\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('URLs visited:', result.urls);\n * console.log('Actions taken:', result.action_names);\n * console.log('Has errors:', result.has_errors);\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 external_id: input.external_id,\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 const wrapped: BrowserTaskWithPromise = {\n ...result,\n task_id: result.task_id || '',\n liveUrl: result.task_id \n ? generateLiveUrl(result.task_id, config)\n : result.debugUrl || '',\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 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: result.task_id\n ? generateLiveUrl(result.task_id, config)\n : result.debugUrl || '',\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":";;;;;;;;;;;;AAmBA,IAAM,iBAAiB;AAAA,EACrB,QAAQ,QAAQ,IAAI,sBAAsB,QACtC,0BACA;AAAA,EACJ,SAAS;AAAA;AAAA,EACT,OAAO;AACT;AAKO,IAAM,gBAAN,MAAoB;AAAA,EACjB;A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,KAAK,qBAAqB;AAAA,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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWarpGrep
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3XLPMV3.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalRipgrepProvider
|
|
6
6
|
} from "./chunk-UYBIKZPM.js";
|
|
@@ -41,4 +41,4 @@ function createMorphWarpGrepTool(config) {
|
|
|
41
41
|
export {
|
|
42
42
|
createMorphWarpGrepTool
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-FP7INILQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 WaitForEmbeddingsOptions,\n EmbeddingProgress,\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, waitForEmbeddings } = 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 // Get commit hash and repoId before pushing (for waitForEmbeddings)\n let commitHash: string | undefined;\n let repoId: string | undefined;\n \n if (waitForEmbeddings) {\n commitHash = await git.resolveRef({ fs, dir, ref: 'HEAD' });\n \n // Get repoId from git remote URL\n const remotes = await git.listRemotes({ fs, dir });\n const originRemote = remotes.find(r => r.remote === remote);\n if (originRemote) {\n // Extract repoId from URL: https://repos.morphllm.com/v1/repos/{repoId}\n const match = originRemote.url.match(/\\/repos\\/([^\\/]+)$/);\n if (match) {\n repoId = match[1];\n }\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 // Wait for embeddings if requested\n if (waitForEmbeddings && repoId && commitHash) {\n await this.waitForEmbeddings({ repoId, commitHash });\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 * Wait for embeddings to complete after push.\n * Polls status endpoint until embeddings are done.\n * \n * @example\n * ```ts\n * await morphGit.push({ dir: './my-project', branch: 'main' });\n * await morphGit.waitForEmbeddings({\n * repoId: 'my-project',\n * onProgress: (p) => console.log(`${p.filesProcessed}/${p.totalFiles}`)\n * });\n * ```\n */\n async waitForEmbeddings(options: WaitForEmbeddingsOptions): Promise<void> {\n const { repoId, commitHash, timeout = 120000, onProgress } = options;\n const startTime = Date.now();\n const pollInterval = 1000; // Poll every 1s\n \n while (Date.now() - startTime < timeout) {\n const statusUrl = `${this.proxyUrl}/v1/repos/${repoId}/embedding-status` +\n (commitHash ? `?commit_hash=${commitHash}` : '');\n \n const response = await fetch(statusUrl, {\n headers: { 'Authorization': `Bearer ${this.apiKey}` }\n });\n \n if (response.status === 404) {\n // No job found yet - might still be creating\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n continue;\n }\n \n if (!response.ok) {\n throw new Error(`Failed to get embedding status: ${response.status}`);\n }\n \n const status = await response.json();\n \n if (onProgress && status.progress) {\n onProgress(status.progress);\n }\n \n if (status.status === 'completed') {\n return; // Done!\n }\n \n if (status.status === 'failed') {\n throw new Error(`Embeddings failed: ${status.error || 'Unknown error'}`);\n }\n \n // Still processing (queued or processing), wait and poll again\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n }\n \n throw new Error(`Embeddings timed out after ${timeout}ms`);\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"],"mappings":";AAKA,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;AAoBf,IAAM,oBAAoB;AAkBnB,IAAM,WAAN,MAAe;AAAA,EACH;AAAA,EACA;AAAA,EAEjB,YAAY,QAAwB;AAElC,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,gEAAgE;AAAA,IAClF;AAEA,QAAI,CAAC,OAAO,OAAO,WAAW,KAAK,KAAK,CAAC,OAAO,OAAO,WAAW,QAAQ,GAAG;AAC3E,YAAM,IAAI,MAAM,uDA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,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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWarpGrep
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3XLPMV3.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalRipgrepProvider
|
|
6
6
|
} from "./chunk-UYBIKZPM.js";
|
|
@@ -50,4 +50,4 @@ function createMorphWarpGrepTool(config) {
|
|
|
50
50
|
export {
|
|
51
51
|
createMorphWarpGrepTool
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-GGBB2HDM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWarpGrep
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3XLPMV3.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalRipgrepProvider
|
|
6
6
|
} from "./chunk-UYBIKZPM.js";
|
|
@@ -53,4 +53,4 @@ function createMorphWarpGrepTool(config) {
|
|
|
53
53
|
export {
|
|
54
54
|
createMorphWarpGrepTool
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-GU3SULV5.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQMPVJ2L.js";
|
|
4
4
|
import {
|
|
5
5
|
executeCodebaseSearch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WM77HRKO.js";
|
|
7
7
|
|
|
8
8
|
// tools/codebase_search/vercel.ts
|
|
9
9
|
import { tool } from "ai";
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
getSystemPrompt,
|
|
56
56
|
vercel_default
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-O5DA5V5S.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-YQMPVJ2L.js";
|
|
5
5
|
import {
|
|
6
6
|
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WM77HRKO.js";
|
|
8
8
|
|
|
9
9
|
// tools/codebase_search/anthropic.ts
|
|
10
10
|
function createCodebaseSearchTool(config) {
|
|
@@ -80,4 +80,4 @@ function formatResult(result) {
|
|
|
80
80
|
export {
|
|
81
81
|
createCodebaseSearchTool
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-OUEJ6XEO.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// tools/browser/live.ts
|
|
2
|
+
var LIVE_PRESETS = {
|
|
3
|
+
/** Read-only monitoring (no interaction) */
|
|
4
|
+
readonly: { interactive: false },
|
|
5
|
+
/** Interactive control (human-in-the-loop) */
|
|
6
|
+
interactive: { interactive: true },
|
|
7
|
+
/** Watch-only without controls */
|
|
8
|
+
monitoring: { interactive: false, showControls: false }
|
|
9
|
+
};
|
|
10
|
+
function buildLiveUrl(debugUrl, options = {}) {
|
|
11
|
+
if (!debugUrl) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"debugUrl is required. Ensure your backend returns debugUrl in the task response. Contact support@morphllm.com if you need help."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
const url = new URL(debugUrl);
|
|
17
|
+
if (options.interactive !== void 0) {
|
|
18
|
+
url.searchParams.set("interactive", String(options.interactive));
|
|
19
|
+
}
|
|
20
|
+
if (options.theme) {
|
|
21
|
+
url.searchParams.set("theme", options.theme);
|
|
22
|
+
}
|
|
23
|
+
if (options.showControls !== void 0) {
|
|
24
|
+
url.searchParams.set("showControls", String(options.showControls));
|
|
25
|
+
}
|
|
26
|
+
if (options.pageId) {
|
|
27
|
+
url.searchParams.set("pageId", options.pageId);
|
|
28
|
+
}
|
|
29
|
+
if (options.pageIndex) {
|
|
30
|
+
url.searchParams.set("pageIndex", options.pageIndex);
|
|
31
|
+
}
|
|
32
|
+
return url.toString();
|
|
33
|
+
}
|
|
34
|
+
function buildLiveIframe(debugUrl, options = {}) {
|
|
35
|
+
const {
|
|
36
|
+
width = "100%",
|
|
37
|
+
height = "600px",
|
|
38
|
+
style = "",
|
|
39
|
+
className = "",
|
|
40
|
+
...sessionOptions
|
|
41
|
+
} = options;
|
|
42
|
+
const src = buildLiveUrl(debugUrl, sessionOptions);
|
|
43
|
+
const widthStr = typeof width === "number" ? `${width}px` : width;
|
|
44
|
+
const heightStr = typeof height === "number" ? `${height}px` : height;
|
|
45
|
+
const baseStyle = `width: ${widthStr}; height: ${heightStr}; border: none;`;
|
|
46
|
+
const fullStyle = style ? `${baseStyle} ${style}` : baseStyle;
|
|
47
|
+
const attributes = [
|
|
48
|
+
`src="${src}"`,
|
|
49
|
+
`style="${fullStyle}"`
|
|
50
|
+
];
|
|
51
|
+
if (className) {
|
|
52
|
+
attributes.push(`class="${className}"`);
|
|
53
|
+
}
|
|
54
|
+
return `<iframe ${attributes.join(" ")}></iframe>`;
|
|
55
|
+
}
|
|
56
|
+
function buildEmbedCode(debugUrl, options = {}) {
|
|
57
|
+
const iframe = buildLiveIframe(debugUrl, options);
|
|
58
|
+
return `<!-- Embed Morph Live Session -->
|
|
59
|
+
${iframe}`;
|
|
60
|
+
}
|
|
61
|
+
function resolvePreset(optionsOrPreset) {
|
|
62
|
+
if (!optionsOrPreset) {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
if (typeof optionsOrPreset === "string") {
|
|
66
|
+
const preset = LIVE_PRESETS[optionsOrPreset];
|
|
67
|
+
if (!preset) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Unknown preset: ${optionsOrPreset}. Available presets: ${Object.keys(LIVE_PRESETS).join(", ")}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return preset;
|
|
73
|
+
}
|
|
74
|
+
return optionsOrPreset;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
LIVE_PRESETS,
|
|
79
|
+
buildLiveUrl,
|
|
80
|
+
buildLiveIframe,
|
|
81
|
+
buildEmbedCode,
|
|
82
|
+
resolvePreset
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=chunk-SQN4DUQS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/browser/live.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"],"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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|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-AFEPUNAO.js";
|
|
5
|
-
import {
|
|
6
|
-
formatAgentToolOutput
|
|
7
|
-
} from "./chunk-TICMYDII.js";
|
|
2
|
+
readFinishFiles
|
|
3
|
+
} from "./chunk-EK7OQPWD.js";
|
|
8
4
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parseAndFilterGrepOutput
|
|
12
|
-
} from "./chunk-NDZO5IPV.js";
|
|
5
|
+
toolRead
|
|
6
|
+
} from "./chunk-Z2FBMSNE.js";
|
|
13
7
|
import {
|
|
14
8
|
LLMResponseParser
|
|
15
9
|
} from "./chunk-GTOXMAF2.js";
|
|
@@ -20,11 +14,17 @@ import {
|
|
|
20
14
|
toolAnalyse
|
|
21
15
|
} from "./chunk-73RQWOQC.js";
|
|
22
16
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
AGENT_CONFIG,
|
|
18
|
+
DEFAULT_MODEL
|
|
19
|
+
} from "./chunk-AFEPUNAO.js";
|
|
25
20
|
import {
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
21
|
+
formatAgentToolOutput
|
|
22
|
+
} from "./chunk-TICMYDII.js";
|
|
23
|
+
import {
|
|
24
|
+
GrepState,
|
|
25
|
+
formatTurnGrepOutput,
|
|
26
|
+
parseAndFilterGrepOutput
|
|
27
|
+
} from "./chunk-NDZO5IPV.js";
|
|
28
28
|
import {
|
|
29
29
|
fetchWithRetry,
|
|
30
30
|
withTimeout
|
|
@@ -198,4 +198,4 @@ async function runWarpGrep(config) {
|
|
|
198
198
|
export {
|
|
199
199
|
runWarpGrep
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-W3XLPMV3.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CodebaseSearchClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WM77HRKO.js";
|
|
4
4
|
import {
|
|
5
5
|
FastApplyClient
|
|
6
6
|
} from "./chunk-Q7USYY6R.js";
|
|
7
7
|
import {
|
|
8
8
|
BrowserClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EYHXBQQX.js";
|
|
10
10
|
import {
|
|
11
11
|
MorphGit
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GDR65N2J.js";
|
|
13
13
|
import {
|
|
14
14
|
AnthropicRouter,
|
|
15
15
|
GeminiRouter,
|
|
@@ -94,4 +94,4 @@ var MorphClient = class {
|
|
|
94
94
|
export {
|
|
95
95
|
MorphClient
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-W7NRFNLI.js.map
|
|
@@ -9,7 +9,7 @@ var CodebaseSearchClient = class {
|
|
|
9
9
|
constructor(config = {}) {
|
|
10
10
|
this.config = {
|
|
11
11
|
apiKey: config.apiKey,
|
|
12
|
-
searchUrl: process.env.MORPH_SEARCH_URL || "
|
|
12
|
+
searchUrl: process.env.MORPH_SEARCH_URL || "https://repos.morphllm.com",
|
|
13
13
|
debug: config.debug,
|
|
14
14
|
timeout: config.timeout || 3e4,
|
|
15
15
|
retryConfig: config.retryConfig
|
|
@@ -39,12 +39,11 @@ async function executeCodebaseSearch(input, config) {
|
|
|
39
39
|
if (!apiKey) {
|
|
40
40
|
throw new Error("MORPH_API_KEY not found. Set environment variable or pass in config");
|
|
41
41
|
}
|
|
42
|
-
const searchUrl = config.searchUrl || process.env.MORPH_SEARCH_URL || "
|
|
42
|
+
const searchUrl = config.searchUrl || process.env.MORPH_SEARCH_URL || "https://repos.morphllm.com";
|
|
43
43
|
const timeout = config.timeout || 3e4;
|
|
44
44
|
const debug = config.debug || false;
|
|
45
45
|
if (debug) {
|
|
46
|
-
|
|
47
|
-
console.log(`[CodebaseSearch] Query: "${input.query.slice(0, 60)}..." repo=${config.repoId} (${ref})`);
|
|
46
|
+
console.log(`[CodebaseSearch] Query: "${input.query.slice(0, 60)}..." repo=${config.repoId}`);
|
|
48
47
|
console.log(`[CodebaseSearch] URL: ${searchUrl}/v1/codebase_search`);
|
|
49
48
|
}
|
|
50
49
|
const startTime = Date.now();
|
|
@@ -60,8 +59,6 @@ async function executeCodebaseSearch(input, config) {
|
|
|
60
59
|
body: JSON.stringify({
|
|
61
60
|
query: input.query,
|
|
62
61
|
repoId: config.repoId,
|
|
63
|
-
branch: config.branch,
|
|
64
|
-
commitHash: config.commitHash,
|
|
65
62
|
targetDirectories: input.target_directories || [],
|
|
66
63
|
limit: input.limit || 10,
|
|
67
64
|
candidateLimit: 50
|
|
@@ -105,4 +102,4 @@ export {
|
|
|
105
102
|
CodebaseSearchClient,
|
|
106
103
|
executeCodebaseSearch
|
|
107
104
|
};
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-WM77HRKO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/codebase_search/core.ts"],"sourcesContent":["/**\n * Core implementation for codebase search\n * Calls Morph rerank service for two-stage semantic search\n */\n\nimport { fetchWithRetry, withTimeout } from '../utils/resilience.js';\nimport type { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './types.js';\n\n/**\n * CodebaseSearch client for programmatic semantic search\n */\nexport class CodebaseSearchClient {\n private config: { \n apiKey?: string; \n searchUrl?: string; \n debug?: boolean; \n timeout?: number; \n retryConfig?: any;\n };\n\n constructor(config: { apiKey?: string; debug?: boolean; timeout?: number; retryConfig?: any } = {}) {\n this.config = {\n apiKey: config.apiKey,\n searchUrl: process.env.MORPH_SEARCH_URL || 'https://repos.morphllm.com',\n debug: config.debug,\n timeout: config.timeout || 30000,\n retryConfig: config.retryConfig,\n };\n }\n\n /**\n * Execute a semantic code search\n * \n * @param input - Search parameters including query, repoId, and target directories\n * @param overrides - Optional config overrides for this operation\n * @returns Search results with ranked code matches\n */\n async search(\n input: { query: string; repoId: string; target_directories?: string[]; explanation?: string; limit?: number },\n overrides?: any\n ): Promise<CodebaseSearchResult> {\n return executeCodebaseSearch(\n {\n query: input.query,\n target_directories: input.target_directories,\n explanation: input.explanation,\n limit: input.limit,\n },\n { ...this.config, repoId: input.repoId, ...overrides }\n );\n }\n}\n\n/**\n * Execute semantic code search\n */\nexport async function executeCodebaseSearch(\n input: CodebaseSearchInput,\n config: CodebaseSearchConfig\n): Promise<CodebaseSearchResult> {\n const apiKey = config.apiKey || process.env.MORPH_API_KEY;\n if (!apiKey) {\n throw new Error('MORPH_API_KEY not found. Set environment variable or pass in config');\n }\n\n const searchUrl = config.searchUrl || process.env.MORPH_SEARCH_URL || 'https://repos.morphllm.com';\n const timeout = config.timeout || 30000;\n const debug = config.debug || false;\n\n if (debug) {\n console.log(`[CodebaseSearch] Query: \"${input.query.slice(0, 60)}...\" repo=${config.repoId}`);\n console.log(`[CodebaseSearch] URL: ${searchUrl}/v1/codebase_search`);\n }\n\n const startTime = Date.now();\n\n try {\n const fetchPromise = fetchWithRetry(\n `${searchUrl}/v1/codebase_search`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n query: input.query,\n repoId: config.repoId,\n targetDirectories: input.target_directories || [],\n limit: input.limit || 10,\n candidateLimit: 50,\n }),\n },\n config.retryConfig\n );\n\n const response = await withTimeout(fetchPromise, timeout, `Codebase search timed out after ${timeout}ms`);\n\n if (!response.ok) {\n const errorText = await response.text();\n if (debug) console.error(`[CodebaseSearch] Error: ${response.status} - ${errorText}`);\n return {\n success: false,\n results: [],\n stats: { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: 0 },\n error: `Search failed (${response.status}): ${errorText}`,\n };\n }\n\n const data = await response.json();\n const elapsed = Date.now() - startTime;\n\n if (debug) {\n console.log(`[CodebaseSearch] ✅ ${data.results?.length || 0} results in ${elapsed}ms`);\n }\n\n return {\n success: true,\n results: data.results || [],\n stats: data.stats || { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: elapsed },\n };\n\n } catch (error) {\n if (debug) console.error(`[CodebaseSearch] Exception: ${error instanceof Error ? error.message : error}`);\n return {\n success: false,\n results: [],\n stats: { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: 0 },\n error: error instanceof Error ? error.message : 'Unknown error',\n };\n }\n}\n\n"],"mappings":";;;;;;AAWO,IAAM,uBAAN,MAA2B;AAAA,EACxB;AAAA,EAQR,YAAY,SAAoF,CAAC,GAAG;AAClG,SAAK,SAAS;AAAA,MACZ,QAAQ,OAAO;AAAA,MACf,WAAW,QAAQ,IAAI,oBAAoB;AAAA,MAC3C,OAAO,OAAO;AAAA,MACd,SAAS,OAAO,WAAW;AAAA,MAC3B,aAAa,OAAO;AAAA,IACtB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OACJ,OACA,WAC+B;AAC/B,WAAO;AAAA,MACL;AAAA,QACE,OAAO,MAAM;AAAA,QACb,oBAAoB,MAAM;AAAA,QAC1B,aAAa,MAAM;AAAA,QACnB,OAAO,MAAM;AAAA,MACf;AAAA,MACA,EAAE,GAAG,KAAK,QAAQ,QAAQ,MAAM,QAAQ,GAAG,UAAU;AAAA,IACvD;AAAA,EACF;AACF;AAKA,eAAsB,sBACpB,OACA,QAC+B;AAC/B,QAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AAEA,QAAM,YAAY,OAAO,aAAa,QAAQ,IAAI,oBAAoB;AACtE,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,QAAQ,OAAO,SAAS;AAE9B,MAAI,OAAO;AACT,YAAQ,IAAI,4BAA4B,MAAM,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,OAAO,MAAM,EAAE;AAC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