@morphllm/morphsdk 0.2.116 → 0.2.117
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-SITZC3U6.js → chunk-5IVVJMMX.js} +2 -2
- package/dist/{chunk-62OVBE6G.js → chunk-C3LJORIT.js} +2 -2
- package/dist/{chunk-QOEZARHG.js → chunk-EAT5W3SH.js} +2 -2
- package/dist/{chunk-25APYVON.js → chunk-PR44LEQQ.js} +2 -2
- package/dist/{chunk-Q6Y4R236.js → chunk-YTYCHRQ2.js} +7 -9
- package/dist/{chunk-Q6Y4R236.js.map → chunk-YTYCHRQ2.js.map} +1 -1
- package/dist/{chunk-4IOC2D5Y.js → chunk-ZYPLV3HP.js} +2 -2
- package/dist/client.cjs +6 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +3 -3
- package/dist/index.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/tools/browser/anthropic.js +3 -3
- package/dist/tools/browser/core.cjs +6 -8
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +2 -2
- package/dist/tools/browser/index.cjs +6 -8
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +5 -5
- package/dist/tools/browser/live.cjs +6 -8
- package/dist/tools/browser/live.cjs.map +1 -1
- package/dist/tools/browser/live.js +1 -1
- package/dist/tools/browser/openai.js +3 -3
- package/dist/tools/browser/vercel.js +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-SITZC3U6.js.map → chunk-5IVVJMMX.js.map} +0 -0
- /package/dist/{chunk-62OVBE6G.js.map → chunk-C3LJORIT.js.map} +0 -0
- /package/dist/{chunk-QOEZARHG.js.map → chunk-EAT5W3SH.js.map} +0 -0
- /package/dist/{chunk-25APYVON.js.map → chunk-PR44LEQQ.js.map} +0 -0
- /package/dist/{chunk-4IOC2D5Y.js.map → chunk-ZYPLV3HP.js.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openai_exports
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-5IVVJMMX.js";
|
|
4
4
|
import {
|
|
5
5
|
vercel_exports
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-PR44LEQQ.js";
|
|
7
7
|
import {
|
|
8
8
|
anthropic_exports
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-EAT5W3SH.js";
|
|
10
10
|
import {
|
|
11
11
|
BROWSER_SYSTEM_PROMPT,
|
|
12
12
|
BROWSER_TOOL_DESCRIPTION
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getRecording,
|
|
21
21
|
getWebp,
|
|
22
22
|
waitForRecording
|
|
23
|
-
} from "../../chunk-
|
|
23
|
+
} from "../../chunk-ZYPLV3HP.js";
|
|
24
24
|
import {
|
|
25
25
|
ProfilesClient
|
|
26
26
|
} from "../../chunk-SI2CKRKJ.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
buildEmbedCode,
|
|
41
41
|
buildLiveIframe,
|
|
42
42
|
buildLiveUrl
|
|
43
|
-
} from "../../chunk-
|
|
43
|
+
} from "../../chunk-YTYCHRQ2.js";
|
|
44
44
|
import "../../chunk-4VWJFZVS.js";
|
|
45
45
|
import {
|
|
46
46
|
__export
|
|
@@ -60,13 +60,14 @@ function buildLiveUrl(debugUrl, options = {}) {
|
|
|
60
60
|
}
|
|
61
61
|
return url.toString();
|
|
62
62
|
}
|
|
63
|
+
function cdpToHttps(wsUrl) {
|
|
64
|
+
return wsUrl.replace(/^wss:\/\//, "https://").replace(/^ws:\/\//, "http://");
|
|
65
|
+
}
|
|
63
66
|
function normalizeLiveUrl(debugUrl) {
|
|
64
67
|
const trimmed = debugUrl.trim();
|
|
65
|
-
if (!trimmed)
|
|
66
|
-
return trimmed;
|
|
67
|
-
}
|
|
68
|
+
if (!trimmed) return trimmed;
|
|
68
69
|
if (trimmed.startsWith("wss://") || trimmed.startsWith("ws://")) {
|
|
69
|
-
return `https://live.browser-use.com?wss=${encodeURIComponent(trimmed)}`;
|
|
70
|
+
return `https://live.browser-use.com?wss=${encodeURIComponent(cdpToHttps(trimmed))}`;
|
|
70
71
|
}
|
|
71
72
|
let url;
|
|
72
73
|
try {
|
|
@@ -74,12 +75,9 @@ function normalizeLiveUrl(debugUrl) {
|
|
|
74
75
|
} catch {
|
|
75
76
|
return trimmed;
|
|
76
77
|
}
|
|
77
|
-
if (url.protocol === "wss:" || url.protocol === "ws:") {
|
|
78
|
-
return `https://live.browser-use.com?wss=${encodeURIComponent(trimmed)}`;
|
|
79
|
-
}
|
|
80
78
|
const wssParam = url.searchParams.get("wss");
|
|
81
79
|
if (wssParam && (wssParam.startsWith("wss://") || wssParam.startsWith("ws://"))) {
|
|
82
|
-
url.searchParams.set("wss", wssParam);
|
|
80
|
+
url.searchParams.set("wss", cdpToHttps(wssParam));
|
|
83
81
|
}
|
|
84
82
|
return url.toString();
|
|
85
83
|
}
|
|
@@ -1 +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 normalized = normalizeLiveUrl(debugUrl);\n const url = new URL(normalized);\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\nfunction normalizeLiveUrl(debugUrl: string): string {\n const trimmed = debugUrl.trim();\n if (!trimmed)
|
|
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 normalized = normalizeLiveUrl(debugUrl);\n const url = new URL(normalized);\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 * Convert a CDP WebSocket scheme to HTTPS.\n *\n * Browser-use's live viewer expects `wss=https://UUID.cdpN.browser-use.com`\n * but CDP URLs use `wss://`. This swaps the scheme.\n */\nfunction cdpToHttps(wsUrl: string): string {\n return wsUrl.replace(/^wss:\\/\\//, 'https://').replace(/^ws:\\/\\//, 'http://');\n}\n\n/**\n * Normalize any debug URL into a valid browser-use live viewer URL.\n *\n * Handles three input formats:\n * 1. Already-correct `https://live.browser-use.com?wss=https://...` — pass through\n * 2. Already-correct but with wrong scheme `...?wss=wss://...` — fix the wss param\n * 3. Raw CDP URL `wss://UUID.cdpN.browser-use.com` — wrap into live viewer URL\n */\nfunction normalizeLiveUrl(debugUrl: string): string {\n const trimmed = debugUrl.trim();\n if (!trimmed) return trimmed;\n\n // Case 3: raw CDP WebSocket URL → wrap into live viewer\n if (trimmed.startsWith('wss://') || trimmed.startsWith('ws://')) {\n return `https://live.browser-use.com?wss=${encodeURIComponent(cdpToHttps(trimmed))}`;\n }\n\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return trimmed;\n }\n\n // Case 2: live viewer URL with wrong scheme in wss param → fix it\n const wssParam = url.searchParams.get('wss');\n if (wssParam && (wssParam.startsWith('wss://') || wssParam.startsWith('ws://'))) {\n url.searchParams.set('wss', cdpToHttps(wssParam));\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 `Un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UAAM,SAAS,aAAa,eAA4C;AACxE,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR,mBAAmB,eAAe,wBAAwB,OAAO,KAAK,YAAY,EAAE,KAAK,IAAI,CAAC;AAAA,MAChG;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
execute,
|
|
5
5
|
formatResult,
|
|
6
6
|
getSystemPrompt
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-5IVVJMMX.js";
|
|
8
8
|
import "../../chunk-2HMEZZKK.js";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-ZYPLV3HP.js";
|
|
10
10
|
import "../../chunk-SI2CKRKJ.js";
|
|
11
11
|
import "../../chunk-2AMEQAO2.js";
|
|
12
12
|
import "../../chunk-2VERUKO2.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-YTYCHRQ2.js";
|
|
14
14
|
import "../../chunk-4VWJFZVS.js";
|
|
15
15
|
import "../../chunk-PZ5AY32C.js";
|
|
16
16
|
export {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
browserTool,
|
|
3
3
|
createBrowserTool
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-PR44LEQQ.js";
|
|
5
5
|
import "../../chunk-2HMEZZKK.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-ZYPLV3HP.js";
|
|
7
7
|
import "../../chunk-SI2CKRKJ.js";
|
|
8
8
|
import "../../chunk-2AMEQAO2.js";
|
|
9
9
|
import "../../chunk-2VERUKO2.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-YTYCHRQ2.js";
|
|
11
11
|
import "../../chunk-4VWJFZVS.js";
|
|
12
12
|
import "../../chunk-PZ5AY32C.js";
|
|
13
13
|
export {
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|