@morphllm/morphsdk 0.2.197 → 0.2.199
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/README.md +1 -147
- package/dist/{chunk-GE5MNVT7.js → chunk-5KQ2WRBU.js} +2 -2
- package/dist/{chunk-LKFZBBTD.js → chunk-5TOJD2C5.js} +1 -1
- package/dist/chunk-5TOJD2C5.js.map +1 -0
- package/dist/{chunk-PQCOBN7L.js → chunk-7UU4NF4G.js} +4 -10
- package/dist/chunk-7UU4NF4G.js.map +1 -0
- package/dist/{chunk-6YZCPCAY.js → chunk-BLCCGRKT.js} +2 -2
- package/dist/{chunk-2BT4UGKH.js → chunk-BTMMUG3E.js} +2 -2
- package/dist/{chunk-VJD6MF3M.js → chunk-CEXBKXWU.js} +4 -4
- package/dist/{chunk-UOS3XKJD.js → chunk-DP2PT36G.js} +2 -2
- package/dist/{chunk-CZ74CRGH.js → chunk-EMURAU6J.js} +4 -6
- package/dist/chunk-EMURAU6J.js.map +1 -0
- package/dist/chunk-GKRPR5PZ.js +322 -0
- package/dist/chunk-GKRPR5PZ.js.map +1 -0
- package/dist/{chunk-DNL4DMMS.js → chunk-GTV27THY.js} +2 -2
- package/dist/{chunk-ATAKRJQZ.js → chunk-IDMKQWQG.js} +1 -36
- package/dist/chunk-IDMKQWQG.js.map +1 -0
- package/dist/{chunk-EGI642TV.js → chunk-JOC3ZI56.js} +3 -39
- package/dist/chunk-JOC3ZI56.js.map +1 -0
- package/dist/{chunk-VGCPVDFP.js → chunk-K2JR2NFQ.js} +4 -4
- package/dist/{chunk-DHGXGVHC.js → chunk-KXEPBLVD.js} +8 -8
- package/dist/{chunk-SVD3YRWM.js → chunk-MEZTHMB2.js} +4 -4
- package/dist/{chunk-BECYWCEZ.js → chunk-O7LJEVZO.js} +2 -2
- package/dist/{chunk-7QOGUY4A.js → chunk-PKJ7ODTG.js} +4 -4
- package/dist/{chunk-2HXELZI5.js → chunk-PW6K6OJL.js} +2 -2
- package/dist/chunk-PW6K6OJL.js.map +1 -0
- package/dist/{chunk-YVKRPVOM.js → chunk-Q3NH3NPD.js} +2 -2
- package/dist/{chunk-ZA3UJRSE.js → chunk-RL3ZTXT3.js} +4 -4
- package/dist/{chunk-WN6YLBEH.js → chunk-ULHHMZRL.js} +4 -4
- package/dist/{chunk-TJUZAO7T.js → chunk-UT3NQLCF.js} +2 -2
- package/dist/{chunk-DW6ZIVCM.js → chunk-VS5F2ORN.js} +4 -4
- package/dist/{chunk-UZA2ODNU.js → chunk-W37OFBSG.js} +2 -2
- package/dist/{chunk-JU6TCHVI.js → chunk-WDBYAXZ5.js} +2 -2
- package/dist/{chunk-2XDSHAB5.js → chunk-YSFEKIYQ.js} +2 -2
- package/dist/{chunk-WDLDKJHT.js → chunk-ZHB57ORD.js} +6 -6
- package/dist/client-CGW0Cevz.d.ts +402 -0
- package/dist/client.cjs +195 -2068
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +3 -11
- package/dist/client.js +28 -35
- package/dist/core/client.cjs +2 -44
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.d.ts +2 -10
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -38
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.d.ts +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -44
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +5 -5
- package/dist/core/resource.cjs.map +1 -1
- package/dist/core/resource.d.ts +1 -1
- package/dist/core/resource.js +1 -1
- package/dist/edge.cjs +2 -44
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +8 -8
- package/dist/index.cjs +195 -2086
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -9
- package/dist/index.js +30 -58
- package/dist/modelrouter/core.cjs +2 -44
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +6 -6
- package/dist/modelrouter/index.cjs +2 -44
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +6 -6
- package/dist/subagents/anthropic.cjs +2 -44
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +12 -12
- package/dist/subagents/vercel.cjs +2 -44
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +12 -12
- package/dist/tools/codebase_search/anthropic.cjs +2 -44
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +7 -7
- package/dist/tools/codebase_search/core.cjs +2 -44
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +6 -6
- package/dist/tools/codebase_search/index.cjs +2 -44
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +11 -11
- package/dist/tools/codebase_search/openai.cjs +2 -44
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +7 -7
- package/dist/tools/codebase_search/vercel.cjs +2 -44
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +7 -7
- package/dist/tools/compact/core.cjs +2 -44
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +6 -6
- package/dist/tools/compact/index.cjs +2 -44
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +7 -7
- package/dist/tools/fastapply/anthropic.cjs +2 -38
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +8 -8
- package/dist/tools/fastapply/apply.cjs +2 -38
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -44
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +7 -7
- package/dist/tools/fastapply/index.cjs +2 -38
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +12 -12
- package/dist/tools/fastapply/openai.cjs +2 -38
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +8 -8
- package/dist/tools/fastapply/vercel.cjs +2 -38
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +8 -8
- package/dist/tools/index.cjs +2 -38
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +12 -12
- package/dist/tools/utils/resilience.cjs +2 -38
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +2 -38
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +2 -44
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +12 -12
- package/dist/tools/warp_grep/client.cjs +2 -44
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +11 -11
- package/dist/tools/warp_grep/gemini.cjs +2 -44
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +11 -11
- package/dist/tools/warp_grep/harness.js +7 -7
- package/dist/tools/warp_grep/index.cjs +2 -44
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +14 -14
- package/dist/tools/warp_grep/openai.cjs +2 -44
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +12 -12
- package/dist/tools/warp_grep/vercel.cjs +2 -44
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +12 -12
- package/dist/tracing/core.cjs +2 -34
- package/dist/tracing/core.cjs.map +1 -1
- package/dist/tracing/core.d.ts +1 -2
- package/dist/tracing/core.js +2 -2
- package/dist/tracing/index.cjs +4 -42
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.ts +0 -34
- package/dist/tracing/index.js +3 -10
- package/dist/tracing/interaction.cjs +0 -30
- package/dist/tracing/interaction.cjs.map +1 -1
- package/dist/tracing/interaction.js +1 -1
- package/dist/tracing/types.cjs.map +1 -1
- package/dist/tracing/types.d.ts +1 -27
- package/dist/version.cjs +2 -38
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -38
- package/dist/anthropic-B6my2oBx.d.ts +0 -56
- package/dist/chunk-2AMEQAO2.js +0 -46
- package/dist/chunk-2AMEQAO2.js.map +0 -1
- package/dist/chunk-2HMEZZKK.js +0 -44
- package/dist/chunk-2HMEZZKK.js.map +0 -1
- package/dist/chunk-2HXELZI5.js.map +0 -1
- package/dist/chunk-2VERUKO2.js +0 -177
- package/dist/chunk-2VERUKO2.js.map +0 -1
- package/dist/chunk-4FWK3CEH.js +0 -692
- package/dist/chunk-4FWK3CEH.js.map +0 -1
- package/dist/chunk-ATAKRJQZ.js.map +0 -1
- package/dist/chunk-CZ74CRGH.js.map +0 -1
- package/dist/chunk-EGI642TV.js.map +0 -1
- package/dist/chunk-FLWBVHDC.js +0 -622
- package/dist/chunk-FLWBVHDC.js.map +0 -1
- package/dist/chunk-JZJY2XFQ.js +0 -96
- package/dist/chunk-JZJY2XFQ.js.map +0 -1
- package/dist/chunk-LKFZBBTD.js.map +0 -1
- package/dist/chunk-LRHJVSSD.js +0 -57
- package/dist/chunk-LRHJVSSD.js.map +0 -1
- package/dist/chunk-NKFAMQF2.js +0 -202
- package/dist/chunk-NKFAMQF2.js.map +0 -1
- package/dist/chunk-PQCOBN7L.js.map +0 -1
- package/dist/chunk-TCCZBGG5.js +0 -46
- package/dist/chunk-TCCZBGG5.js.map +0 -1
- package/dist/chunk-W34BUTVR.js +0 -389
- package/dist/chunk-W34BUTVR.js.map +0 -1
- package/dist/chunk-WFOGTZF6.js +0 -80
- package/dist/chunk-WFOGTZF6.js.map +0 -1
- package/dist/chunk-YTYCHRQ2.js +0 -106
- package/dist/chunk-YTYCHRQ2.js.map +0 -1
- package/dist/client-B3fWTCcL.d.ts +0 -1021
- package/dist/openai-BQMeDFef.d.ts +0 -81
- package/dist/tools/browser/anthropic.cjs +0 -655
- package/dist/tools/browser/anthropic.cjs.map +0 -1
- package/dist/tools/browser/anthropic.d.ts +0 -4
- package/dist/tools/browser/anthropic.js +0 -22
- package/dist/tools/browser/anthropic.js.map +0 -1
- package/dist/tools/browser/core.cjs +0 -1831
- package/dist/tools/browser/core.cjs.map +0 -1
- package/dist/tools/browser/core.d.ts +0 -245
- package/dist/tools/browser/core.js +0 -32
- package/dist/tools/browser/core.js.map +0 -1
- package/dist/tools/browser/errors.cjs +0 -208
- package/dist/tools/browser/errors.cjs.map +0 -1
- package/dist/tools/browser/errors.d.ts +0 -158
- package/dist/tools/browser/errors.js +0 -22
- package/dist/tools/browser/errors.js.map +0 -1
- package/dist/tools/browser/index.cjs +0 -2169
- package/dist/tools/browser/index.cjs.map +0 -1
- package/dist/tools/browser/index.d.ts +0 -134
- package/dist/tools/browser/index.js +0 -163
- package/dist/tools/browser/index.js.map +0 -1
- package/dist/tools/browser/live.cjs +0 -134
- package/dist/tools/browser/live.cjs.map +0 -1
- package/dist/tools/browser/live.d.ts +0 -75
- package/dist/tools/browser/live.js +0 -16
- package/dist/tools/browser/live.js.map +0 -1
- package/dist/tools/browser/openai.cjs +0 -671
- package/dist/tools/browser/openai.cjs.map +0 -1
- package/dist/tools/browser/openai.d.ts +0 -4
- package/dist/tools/browser/openai.js +0 -28
- package/dist/tools/browser/openai.js.map +0 -1
- package/dist/tools/browser/profiles/core.cjs +0 -942
- package/dist/tools/browser/profiles/core.cjs.map +0 -1
- package/dist/tools/browser/profiles/core.d.ts +0 -187
- package/dist/tools/browser/profiles/core.js +0 -30
- package/dist/tools/browser/profiles/core.js.map +0 -1
- package/dist/tools/browser/profiles/index.cjs +0 -942
- package/dist/tools/browser/profiles/index.cjs.map +0 -1
- package/dist/tools/browser/profiles/index.d.ts +0 -4
- package/dist/tools/browser/profiles/index.js +0 -30
- package/dist/tools/browser/profiles/index.js.map +0 -1
- package/dist/tools/browser/profiles/types.cjs +0 -74
- package/dist/tools/browser/profiles/types.cjs.map +0 -1
- package/dist/tools/browser/profiles/types.d.ts +0 -195
- package/dist/tools/browser/profiles/types.js +0 -16
- package/dist/tools/browser/profiles/types.js.map +0 -1
- package/dist/tools/browser/prompts.cjs +0 -69
- package/dist/tools/browser/prompts.cjs.map +0 -1
- package/dist/tools/browser/prompts.d.ts +0 -7
- package/dist/tools/browser/prompts.js +0 -10
- package/dist/tools/browser/prompts.js.map +0 -1
- package/dist/tools/browser/types.cjs +0 -19
- package/dist/tools/browser/types.cjs.map +0 -1
- package/dist/tools/browser/types.d.ts +0 -338
- package/dist/tools/browser/types.js +0 -1
- package/dist/tools/browser/types.js.map +0 -1
- package/dist/tools/browser/vercel.cjs +0 -632
- package/dist/tools/browser/vercel.cjs.map +0 -1
- package/dist/tools/browser/vercel.d.ts +0 -4
- package/dist/tools/browser/vercel.js +0 -22
- package/dist/tools/browser/vercel.js.map +0 -1
- package/dist/tools/reflex/core.cjs +0 -756
- package/dist/tools/reflex/core.cjs.map +0 -1
- package/dist/tools/reflex/core.d.ts +0 -59
- package/dist/tools/reflex/core.js +0 -16
- package/dist/tools/reflex/core.js.map +0 -1
- package/dist/tools/reflex/index.cjs +0 -756
- package/dist/tools/reflex/index.cjs.map +0 -1
- package/dist/tools/reflex/index.d.ts +0 -5
- package/dist/tools/reflex/index.js +0 -16
- package/dist/tools/reflex/index.js.map +0 -1
- package/dist/tools/reflex/types.cjs +0 -19
- package/dist/tools/reflex/types.cjs.map +0 -1
- package/dist/tools/reflex/types.d.ts +0 -171
- package/dist/tools/reflex/types.js +0 -1
- package/dist/tools/reflex/types.js.map +0 -1
- package/dist/tools/traces/core.cjs +0 -76
- package/dist/tools/traces/core.cjs.map +0 -1
- package/dist/tools/traces/core.d.ts +0 -24
- package/dist/tools/traces/core.js +0 -9
- package/dist/tools/traces/core.js.map +0 -1
- package/dist/tools/traces/index.cjs +0 -76
- package/dist/tools/traces/index.cjs.map +0 -1
- package/dist/tools/traces/index.d.ts +0 -5
- package/dist/tools/traces/index.js +0 -9
- package/dist/tools/traces/index.js.map +0 -1
- package/dist/tools/traces/types.cjs +0 -19
- package/dist/tools/traces/types.cjs.map +0 -1
- package/dist/tools/traces/types.d.ts +0 -56
- package/dist/tools/traces/types.js +0 -1
- package/dist/tools/traces/types.js.map +0 -1
- package/dist/vercel-CVF27qFK.d.ts +0 -74
- /package/dist/{chunk-GE5MNVT7.js.map → chunk-5KQ2WRBU.js.map} +0 -0
- /package/dist/{chunk-6YZCPCAY.js.map → chunk-BLCCGRKT.js.map} +0 -0
- /package/dist/{chunk-2BT4UGKH.js.map → chunk-BTMMUG3E.js.map} +0 -0
- /package/dist/{chunk-VJD6MF3M.js.map → chunk-CEXBKXWU.js.map} +0 -0
- /package/dist/{chunk-UOS3XKJD.js.map → chunk-DP2PT36G.js.map} +0 -0
- /package/dist/{chunk-DNL4DMMS.js.map → chunk-GTV27THY.js.map} +0 -0
- /package/dist/{chunk-VGCPVDFP.js.map → chunk-K2JR2NFQ.js.map} +0 -0
- /package/dist/{chunk-DHGXGVHC.js.map → chunk-KXEPBLVD.js.map} +0 -0
- /package/dist/{chunk-SVD3YRWM.js.map → chunk-MEZTHMB2.js.map} +0 -0
- /package/dist/{chunk-BECYWCEZ.js.map → chunk-O7LJEVZO.js.map} +0 -0
- /package/dist/{chunk-7QOGUY4A.js.map → chunk-PKJ7ODTG.js.map} +0 -0
- /package/dist/{chunk-YVKRPVOM.js.map → chunk-Q3NH3NPD.js.map} +0 -0
- /package/dist/{chunk-ZA3UJRSE.js.map → chunk-RL3ZTXT3.js.map} +0 -0
- /package/dist/{chunk-WN6YLBEH.js.map → chunk-ULHHMZRL.js.map} +0 -0
- /package/dist/{chunk-TJUZAO7T.js.map → chunk-UT3NQLCF.js.map} +0 -0
- /package/dist/{chunk-DW6ZIVCM.js.map → chunk-VS5F2ORN.js.map} +0 -0
- /package/dist/{chunk-UZA2ODNU.js.map → chunk-W37OFBSG.js.map} +0 -0
- /package/dist/{chunk-JU6TCHVI.js.map → chunk-WDBYAXZ5.js.map} +0 -0
- /package/dist/{chunk-2XDSHAB5.js.map → chunk-YSFEKIYQ.js.map} +0 -0
- /package/dist/{chunk-WDLDKJHT.js.map → chunk-ZHB57ORD.js.map} +0 -0
package/dist/chunk-W34BUTVR.js
DELETED
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
transformCreateInput,
|
|
3
|
-
transformProfile,
|
|
4
|
-
transformSaveInput,
|
|
5
|
-
transformSession,
|
|
6
|
-
transformStateResponse
|
|
7
|
-
} from "./chunk-2AMEQAO2.js";
|
|
8
|
-
import {
|
|
9
|
-
MorphAuthenticationError,
|
|
10
|
-
MorphValidationError,
|
|
11
|
-
parseAPIError
|
|
12
|
-
} from "./chunk-2VERUKO2.js";
|
|
13
|
-
import {
|
|
14
|
-
fetchWithRetry
|
|
15
|
-
} from "./chunk-UOS3XKJD.js";
|
|
16
|
-
|
|
17
|
-
// tools/browser/profiles/core.ts
|
|
18
|
-
var DEFAULT_API_URL = process.env.MORPH_ENVIRONMENT === "DEV" ? "http://localhost:8000" : "https://browser.morphllm.com";
|
|
19
|
-
var ProfilesClient = class {
|
|
20
|
-
config;
|
|
21
|
-
constructor(config) {
|
|
22
|
-
this.config = config;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Create a new browser profile and immediately start a live session.
|
|
26
|
-
*
|
|
27
|
-
* @param input - Profile creation parameters
|
|
28
|
-
* @returns Profile setup handle with live URL + save()
|
|
29
|
-
* @throws {MorphValidationError} If input validation fails
|
|
30
|
-
* @throws {MorphProfileLimitError} If profile limit is exceeded
|
|
31
|
-
* @throws {MorphAuthenticationError} If API key is missing or invalid
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const setup = await morph.browser.profiles.createProfile({
|
|
36
|
-
* name: 'LinkedIn Production',
|
|
37
|
-
* repoId: 'owner/repo'
|
|
38
|
-
* });
|
|
39
|
-
* console.log(setup.session.debugUrl);
|
|
40
|
-
* await setup.save();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
async createProfile(input) {
|
|
44
|
-
return createProfile(input, this.config);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* List all profiles for the authenticated user.
|
|
48
|
-
*
|
|
49
|
-
* @param repoId - Optional repository ID to filter by
|
|
50
|
-
* @returns Array of profiles
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* // List all profiles
|
|
55
|
-
* const allProfiles = await morph.browser.profiles.listProfiles();
|
|
56
|
-
*
|
|
57
|
-
* // List profiles for a specific repo
|
|
58
|
-
* const repoProfiles = await morph.browser.profiles.listProfiles('owner/repo');
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
async listProfiles(repoId) {
|
|
62
|
-
return listProfiles(this.config, repoId);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get a profile by ID with convenience methods.
|
|
66
|
-
*
|
|
67
|
-
* @param id - Profile ID
|
|
68
|
-
* @returns Profile with attached methods
|
|
69
|
-
* @throws {MorphNotFoundError} If profile is not found
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* const profile = await morph.browser.profiles.getProfile('profile-id');
|
|
74
|
-
* const state = await profile.getState();
|
|
75
|
-
* await profile.delete();
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
async getProfile(id) {
|
|
79
|
-
return getProfile(id, this.config);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Update a profile by opening a live session (no rename).
|
|
83
|
-
*
|
|
84
|
-
* @param id - Profile ID
|
|
85
|
-
* @returns Profile setup handle with live URL + save()
|
|
86
|
-
*/
|
|
87
|
-
async updateProfile(id) {
|
|
88
|
-
return updateProfile(id, this.config);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Delete a profile.
|
|
92
|
-
*
|
|
93
|
-
* @param id - Profile ID
|
|
94
|
-
* @throws {MorphNotFoundError} If profile is not found
|
|
95
|
-
*/
|
|
96
|
-
async deleteProfile(id) {
|
|
97
|
-
return deleteProfile(id, this.config);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Start a browser session for profile setup.
|
|
101
|
-
*
|
|
102
|
-
* Returns a live URL where the user can sign into accounts.
|
|
103
|
-
* After signing in, call `saveSession` to persist the state.
|
|
104
|
-
*
|
|
105
|
-
* @param input - Optional session parameters
|
|
106
|
-
* @returns Session with debug URL
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* const session = await morph.browser.profiles.startSession();
|
|
111
|
-
* console.log('Sign in at:', session.debugUrl);
|
|
112
|
-
* // Open debugUrl in browser, user signs in...
|
|
113
|
-
* await morph.browser.profiles.saveSession(session.sessionId, profile.id);
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
async startSession(input) {
|
|
117
|
-
return startProfileSession(this.config, input);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Save browser state from a session to a profile.
|
|
121
|
-
*
|
|
122
|
-
* Call this after the user is done signing into accounts.
|
|
123
|
-
* Extracts cookies, localStorage, and sessionStorage.
|
|
124
|
-
*
|
|
125
|
-
* @param sessionId - Browser session ID from startSession
|
|
126
|
-
* @param profileId - Profile ID to save state to
|
|
127
|
-
* @returns Updated profile with cookie domains
|
|
128
|
-
*/
|
|
129
|
-
async saveSession(sessionId, profileId) {
|
|
130
|
-
return saveProfileSession({ sessionId, profileId }, this.config);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* List available repo IDs (discovery).
|
|
134
|
-
*
|
|
135
|
-
* @returns Repo summaries with profile counts
|
|
136
|
-
*/
|
|
137
|
-
async listRepos() {
|
|
138
|
-
return listRepos(this.config);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Get the presigned URL for a profile's state.
|
|
142
|
-
*
|
|
143
|
-
* Use this to download the raw state JSON for debugging
|
|
144
|
-
* or to restore state manually.
|
|
145
|
-
*
|
|
146
|
-
* @param profileId - Profile ID
|
|
147
|
-
* @returns State URL with expiry information
|
|
148
|
-
*/
|
|
149
|
-
async getProfileState(profileId) {
|
|
150
|
-
return getProfileState(profileId, this.config);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
function validateCreateInput(input) {
|
|
154
|
-
if (!input.name || typeof input.name !== "string") {
|
|
155
|
-
throw new MorphValidationError("name is required", "name");
|
|
156
|
-
}
|
|
157
|
-
const trimmedName = input.name.trim();
|
|
158
|
-
if (trimmedName.length === 0) {
|
|
159
|
-
throw new MorphValidationError("name cannot be empty", "name");
|
|
160
|
-
}
|
|
161
|
-
if (trimmedName.length > 100) {
|
|
162
|
-
throw new MorphValidationError("name must be 100 characters or less", "name");
|
|
163
|
-
}
|
|
164
|
-
if (!input.repoId || typeof input.repoId !== "string") {
|
|
165
|
-
throw new MorphValidationError("repoId is required", "repoId");
|
|
166
|
-
}
|
|
167
|
-
if (input.repoId.trim().length === 0) {
|
|
168
|
-
throw new MorphValidationError("repoId cannot be empty", "repoId");
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function validateId(id, fieldName) {
|
|
172
|
-
if (!id || typeof id !== "string") {
|
|
173
|
-
throw new MorphValidationError(`${fieldName} is required`, fieldName);
|
|
174
|
-
}
|
|
175
|
-
if (id.trim().length === 0) {
|
|
176
|
-
throw new MorphValidationError(`${fieldName} cannot be empty`, fieldName);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
async function createProfile(input, config = {}) {
|
|
180
|
-
validateCreateInput(input);
|
|
181
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
182
|
-
const headers = buildHeaders(config);
|
|
183
|
-
const response = await fetchWithRetry(
|
|
184
|
-
`${apiUrl}/profiles`,
|
|
185
|
-
{
|
|
186
|
-
method: "POST",
|
|
187
|
-
headers,
|
|
188
|
-
body: JSON.stringify(transformCreateInput(input))
|
|
189
|
-
},
|
|
190
|
-
config.retryConfig
|
|
191
|
-
);
|
|
192
|
-
if (!response.ok) {
|
|
193
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
194
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
195
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
196
|
-
}
|
|
197
|
-
const apiProfile = await response.json();
|
|
198
|
-
const profile = transformProfile(apiProfile);
|
|
199
|
-
const session = await startProfileSession(config, { profileId: profile.id });
|
|
200
|
-
return buildProfileSetup(profile, session, config);
|
|
201
|
-
}
|
|
202
|
-
async function listProfiles(config = {}, repoId) {
|
|
203
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
204
|
-
const headers = buildHeaders(config);
|
|
205
|
-
const url = repoId ? `${apiUrl}/profiles?repo_id=${encodeURIComponent(repoId)}` : `${apiUrl}/profiles`;
|
|
206
|
-
const response = await fetchWithRetry(
|
|
207
|
-
url,
|
|
208
|
-
{ method: "GET", headers },
|
|
209
|
-
config.retryConfig
|
|
210
|
-
);
|
|
211
|
-
if (!response.ok) {
|
|
212
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
213
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
214
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
215
|
-
}
|
|
216
|
-
const data = await response.json();
|
|
217
|
-
return data.profiles.map(transformProfile);
|
|
218
|
-
}
|
|
219
|
-
async function getProfile(id, config = {}) {
|
|
220
|
-
validateId(id, "id");
|
|
221
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
222
|
-
const headers = buildHeaders(config);
|
|
223
|
-
const response = await fetchWithRetry(
|
|
224
|
-
`${apiUrl}/profiles/${encodeURIComponent(id)}`,
|
|
225
|
-
{ method: "GET", headers },
|
|
226
|
-
config.retryConfig
|
|
227
|
-
);
|
|
228
|
-
if (!response.ok) {
|
|
229
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
230
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
231
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
232
|
-
}
|
|
233
|
-
const apiProfile = await response.json();
|
|
234
|
-
const profile = transformProfile(apiProfile);
|
|
235
|
-
return {
|
|
236
|
-
...profile,
|
|
237
|
-
getState: () => getProfileState(id, config),
|
|
238
|
-
delete: () => deleteProfile(id, config)
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
async function updateProfile(id, config = {}) {
|
|
242
|
-
validateId(id, "id");
|
|
243
|
-
const profile = await fetchProfile(id, config);
|
|
244
|
-
const session = await startProfileSession(config, { profileId: profile.id });
|
|
245
|
-
return buildProfileSetup(profile, session, config);
|
|
246
|
-
}
|
|
247
|
-
async function deleteProfile(id, config = {}) {
|
|
248
|
-
validateId(id, "id");
|
|
249
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
250
|
-
const headers = buildHeaders(config);
|
|
251
|
-
const response = await fetchWithRetry(
|
|
252
|
-
`${apiUrl}/profiles/${encodeURIComponent(id)}`,
|
|
253
|
-
{ method: "DELETE", headers },
|
|
254
|
-
config.retryConfig
|
|
255
|
-
);
|
|
256
|
-
if (!response.ok) {
|
|
257
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
258
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
259
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
async function startProfileSession(config = {}, input) {
|
|
263
|
-
if (!config.apiKey) {
|
|
264
|
-
throw new MorphAuthenticationError();
|
|
265
|
-
}
|
|
266
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
267
|
-
const headers = buildHeaders(config);
|
|
268
|
-
const body = input?.profileId ? { profile_id: input.profileId } : {};
|
|
269
|
-
const response = await fetchWithRetry(
|
|
270
|
-
`${apiUrl}/profiles/session/start`,
|
|
271
|
-
{
|
|
272
|
-
method: "POST",
|
|
273
|
-
headers,
|
|
274
|
-
body: JSON.stringify(body)
|
|
275
|
-
},
|
|
276
|
-
config.retryConfig
|
|
277
|
-
);
|
|
278
|
-
if (!response.ok) {
|
|
279
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
280
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
281
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
282
|
-
}
|
|
283
|
-
const apiSession = await response.json();
|
|
284
|
-
return transformSession(apiSession);
|
|
285
|
-
}
|
|
286
|
-
async function saveProfileSession(input, config = {}) {
|
|
287
|
-
validateId(input.sessionId, "sessionId");
|
|
288
|
-
validateId(input.profileId, "profileId");
|
|
289
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
290
|
-
const headers = buildHeaders(config);
|
|
291
|
-
const response = await fetchWithRetry(
|
|
292
|
-
`${apiUrl}/profiles/session/save`,
|
|
293
|
-
{
|
|
294
|
-
method: "POST",
|
|
295
|
-
headers,
|
|
296
|
-
body: JSON.stringify(transformSaveInput(input))
|
|
297
|
-
},
|
|
298
|
-
config.retryConfig
|
|
299
|
-
);
|
|
300
|
-
if (!response.ok) {
|
|
301
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
302
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
303
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
304
|
-
}
|
|
305
|
-
const apiProfile = await response.json();
|
|
306
|
-
return transformProfile(apiProfile);
|
|
307
|
-
}
|
|
308
|
-
async function listRepos(config = {}) {
|
|
309
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
310
|
-
const headers = buildHeaders(config);
|
|
311
|
-
const response = await fetchWithRetry(
|
|
312
|
-
`${apiUrl}/repos`,
|
|
313
|
-
{ method: "GET", headers },
|
|
314
|
-
config.retryConfig
|
|
315
|
-
);
|
|
316
|
-
if (!response.ok) {
|
|
317
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
318
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
319
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
320
|
-
}
|
|
321
|
-
const data = await response.json();
|
|
322
|
-
const repos = Array.isArray(data?.repos) ? data.repos : [];
|
|
323
|
-
return repos.map((repo) => ({
|
|
324
|
-
repoId: repo.repo_id,
|
|
325
|
-
repoFullName: repo.repo_full_name,
|
|
326
|
-
profileCount: repo.profile_count ?? 0
|
|
327
|
-
}));
|
|
328
|
-
}
|
|
329
|
-
async function getProfileState(profileId, config = {}) {
|
|
330
|
-
validateId(profileId, "profileId");
|
|
331
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
332
|
-
const headers = buildHeaders(config);
|
|
333
|
-
const response = await fetchWithRetry(
|
|
334
|
-
`${apiUrl}/profiles/${encodeURIComponent(profileId)}/state`,
|
|
335
|
-
{ method: "GET", headers },
|
|
336
|
-
config.retryConfig
|
|
337
|
-
);
|
|
338
|
-
if (!response.ok) {
|
|
339
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
340
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
341
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
342
|
-
}
|
|
343
|
-
const apiState = await response.json();
|
|
344
|
-
return transformStateResponse(apiState);
|
|
345
|
-
}
|
|
346
|
-
function buildHeaders(config) {
|
|
347
|
-
const headers = { "Content-Type": "application/json" };
|
|
348
|
-
if (config.apiKey) {
|
|
349
|
-
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
350
|
-
}
|
|
351
|
-
return headers;
|
|
352
|
-
}
|
|
353
|
-
async function fetchProfile(id, config) {
|
|
354
|
-
const apiUrl = config.apiUrl || DEFAULT_API_URL;
|
|
355
|
-
const headers = buildHeaders(config);
|
|
356
|
-
const response = await fetchWithRetry(
|
|
357
|
-
`${apiUrl}/profiles/${encodeURIComponent(id)}`,
|
|
358
|
-
{ method: "GET", headers },
|
|
359
|
-
config.retryConfig
|
|
360
|
-
);
|
|
361
|
-
if (!response.ok) {
|
|
362
|
-
const errorText = await response.text().catch(() => response.statusText);
|
|
363
|
-
const requestId = response.headers.get("x-request-id") || void 0;
|
|
364
|
-
throw parseAPIError(response.status, errorText, requestId);
|
|
365
|
-
}
|
|
366
|
-
const apiProfile = await response.json();
|
|
367
|
-
return transformProfile(apiProfile);
|
|
368
|
-
}
|
|
369
|
-
function buildProfileSetup(profile, session, config) {
|
|
370
|
-
return {
|
|
371
|
-
profile,
|
|
372
|
-
session,
|
|
373
|
-
save: () => saveProfileSession({ sessionId: session.sessionId, profileId: profile.id }, config)
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export {
|
|
378
|
-
ProfilesClient,
|
|
379
|
-
createProfile,
|
|
380
|
-
listProfiles,
|
|
381
|
-
getProfile,
|
|
382
|
-
updateProfile,
|
|
383
|
-
deleteProfile,
|
|
384
|
-
startProfileSession,
|
|
385
|
-
saveProfileSession,
|
|
386
|
-
listRepos,
|
|
387
|
-
getProfileState
|
|
388
|
-
};
|
|
389
|
-
//# sourceMappingURL=chunk-W34BUTVR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/browser/profiles/core.ts"],"sourcesContent":["/**\n * ProfilesClient - Manage browser profiles for storing login state.\n *\n * @example\n * ```typescript\n * const morph = new MorphClient({ apiKey: '...' });\n *\n * // Create a profile + live setup session\n * const setup = await morph.browser.profiles.createProfile({\n * name: 'LinkedIn',\n * repoId: 'owner/repo'\n * });\n *\n * console.log('Sign in at:', setup.session.debugUrl);\n * // User logs in, then explicitly save\n * await setup.save();\n *\n * // Use profile in browser tasks\n * await morph.browser.execute({\n * task: 'Check notifications',\n * url: 'https://linkedin.com',\n * profileId: profile.id\n * });\n * ```\n */\n\nimport { fetchWithRetry } from '../../utils/resilience.js';\nimport type { BrowserConfig } from '../types.js';\nimport {\n MorphValidationError,\n MorphAuthenticationError,\n parseAPIError,\n} from '../errors.js';\nimport type {\n Profile,\n ProfileSetup,\n ProfileWithMethods,\n CreateProfileInput,\n ProfileListResponse,\n ProfileSession,\n ProfileSessionInput,\n SaveProfileSessionInput,\n ProfileStateResponse,\n RepoSummary,\n RepoListResponse,\n APIProfile,\n APIProfileSession,\n APIProfileStateResponse,\n} from './types.js';\nimport {\n transformProfile,\n transformCreateInput,\n transformSession,\n transformSaveInput,\n transformStateResponse,\n} from './types.js';\n\nconst DEFAULT_API_URL = process.env.MORPH_ENVIRONMENT === 'DEV'\n ? 'http://localhost:8000'\n : 'https://browser.morphllm.com';\n\n/**\n * ProfilesClient class for managing browser profiles.\n *\n * Access via `morph.browser.profiles` on a MorphClient instance.\n */\nexport class ProfilesClient {\n private config: BrowserConfig;\n\n constructor(config: BrowserConfig) {\n this.config = config;\n }\n\n /**\n * Create a new browser profile and immediately start a live session.\n *\n * @param input - Profile creation parameters\n * @returns Profile setup handle with live URL + save()\n * @throws {MorphValidationError} If input validation fails\n * @throws {MorphProfileLimitError} If profile limit is exceeded\n * @throws {MorphAuthenticationError} If API key is missing or invalid\n *\n * @example\n * ```typescript\n * const setup = await morph.browser.profiles.createProfile({\n * name: 'LinkedIn Production',\n * repoId: 'owner/repo'\n * });\n * console.log(setup.session.debugUrl);\n * await setup.save();\n * ```\n */\n async createProfile(input: CreateProfileInput): Promise<ProfileSetup> {\n return createProfile(input, this.config);\n }\n\n /**\n * List all profiles for the authenticated user.\n *\n * @param repoId - Optional repository ID to filter by\n * @returns Array of profiles\n *\n * @example\n * ```typescript\n * // List all profiles\n * const allProfiles = await morph.browser.profiles.listProfiles();\n *\n * // List profiles for a specific repo\n * const repoProfiles = await morph.browser.profiles.listProfiles('owner/repo');\n * ```\n */\n async listProfiles(repoId?: string): Promise<Profile[]> {\n return listProfiles(this.config, repoId);\n }\n\n /**\n * Get a profile by ID with convenience methods.\n *\n * @param id - Profile ID\n * @returns Profile with attached methods\n * @throws {MorphNotFoundError} If profile is not found\n *\n * @example\n * ```typescript\n * const profile = await morph.browser.profiles.getProfile('profile-id');\n * const state = await profile.getState();\n * await profile.delete();\n * ```\n */\n async getProfile(id: string): Promise<ProfileWithMethods> {\n return getProfile(id, this.config);\n }\n\n /**\n * Update a profile by opening a live session (no rename).\n *\n * @param id - Profile ID\n * @returns Profile setup handle with live URL + save()\n */\n async updateProfile(id: string): Promise<ProfileSetup> {\n return updateProfile(id, this.config);\n }\n\n /**\n * Delete a profile.\n *\n * @param id - Profile ID\n * @throws {MorphNotFoundError} If profile is not found\n */\n async deleteProfile(id: string): Promise<void> {\n return deleteProfile(id, this.config);\n }\n\n /**\n * Start a browser session for profile setup.\n *\n * Returns a live URL where the user can sign into accounts.\n * After signing in, call `saveSession` to persist the state.\n *\n * @param input - Optional session parameters\n * @returns Session with debug URL\n *\n * @example\n * ```typescript\n * const session = await morph.browser.profiles.startSession();\n * console.log('Sign in at:', session.debugUrl);\n * // Open debugUrl in browser, user signs in...\n * await morph.browser.profiles.saveSession(session.sessionId, profile.id);\n * ```\n */\n async startSession(input?: ProfileSessionInput): Promise<ProfileSession> {\n return startProfileSession(this.config, input);\n }\n\n /**\n * Save browser state from a session to a profile.\n *\n * Call this after the user is done signing into accounts.\n * Extracts cookies, localStorage, and sessionStorage.\n *\n * @param sessionId - Browser session ID from startSession\n * @param profileId - Profile ID to save state to\n * @returns Updated profile with cookie domains\n */\n async saveSession(sessionId: string, profileId: string): Promise<Profile> {\n return saveProfileSession({ sessionId, profileId }, this.config);\n }\n\n /**\n * List available repo IDs (discovery).\n *\n * @returns Repo summaries with profile counts\n */\n async listRepos(): Promise<RepoSummary[]> {\n return listRepos(this.config);\n }\n\n /**\n * Get the presigned URL for a profile's state.\n *\n * Use this to download the raw state JSON for debugging\n * or to restore state manually.\n *\n * @param profileId - Profile ID\n * @returns State URL with expiry information\n */\n async getProfileState(profileId: string): Promise<ProfileStateResponse> {\n return getProfileState(profileId, this.config);\n }\n}\n\n// ============================================================================\n// Validation Helpers\n// ============================================================================\n\nfunction validateCreateInput(input: CreateProfileInput): void {\n if (!input.name || typeof input.name !== 'string') {\n throw new MorphValidationError('name is required', 'name');\n }\n\n const trimmedName = input.name.trim();\n if (trimmedName.length === 0) {\n throw new MorphValidationError('name cannot be empty', 'name');\n }\n\n if (trimmedName.length > 100) {\n throw new MorphValidationError('name must be 100 characters or less', 'name');\n }\n\n if (!input.repoId || typeof input.repoId !== 'string') {\n throw new MorphValidationError('repoId is required', 'repoId');\n }\n\n if (input.repoId.trim().length === 0) {\n throw new MorphValidationError('repoId cannot be empty', 'repoId');\n }\n}\n\nfunction validateId(id: string, fieldName: string): void {\n if (!id || typeof id !== 'string') {\n throw new MorphValidationError(`${fieldName} is required`, fieldName);\n }\n\n if (id.trim().length === 0) {\n throw new MorphValidationError(`${fieldName} cannot be empty`, fieldName);\n }\n}\n\n// ============================================================================\n// Standalone Functions\n// ============================================================================\n\n/**\n * Create a new browser profile.\n */\nexport async function createProfile(\n input: CreateProfileInput,\n config: BrowserConfig = {}\n): Promise<ProfileSetup> {\n validateCreateInput(input);\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles`,\n {\n method: 'POST',\n headers,\n body: JSON.stringify(transformCreateInput(input)),\n },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiProfile: APIProfile = await response.json();\n const profile = transformProfile(apiProfile);\n const session = await startProfileSession(config, { profileId: profile.id });\n return buildProfileSetup(profile, session, config);\n}\n\n/**\n * List all profiles for the authenticated user.\n */\nexport async function listProfiles(\n config: BrowserConfig = {},\n repoId?: string\n): Promise<Profile[]> {\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const url = repoId\n ? `${apiUrl}/profiles?repo_id=${encodeURIComponent(repoId)}`\n : `${apiUrl}/profiles`;\n\n const response = await fetchWithRetry(\n url,\n { method: 'GET', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const data: { profiles: APIProfile[] } = await response.json();\n return data.profiles.map(transformProfile);\n}\n\n/**\n * Get a profile by ID with convenience methods.\n */\nexport async function getProfile(\n id: string,\n config: BrowserConfig = {}\n): Promise<ProfileWithMethods> {\n validateId(id, 'id');\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/${encodeURIComponent(id)}`,\n { method: 'GET', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiProfile: APIProfile = await response.json();\n const profile = transformProfile(apiProfile);\n\n // Attach convenience methods\n return {\n ...profile,\n getState: () => getProfileState(id, config),\n delete: () => deleteProfile(id, config),\n };\n}\n\n/**\n * Update a profile.\n */\nexport async function updateProfile(\n id: string,\n config: BrowserConfig = {}\n): Promise<ProfileSetup> {\n validateId(id, 'id');\n const profile = await fetchProfile(id, config);\n const session = await startProfileSession(config, { profileId: profile.id });\n return buildProfileSetup(profile, session, config);\n}\n\n/**\n * Delete a profile.\n */\nexport async function deleteProfile(\n id: string,\n config: BrowserConfig = {}\n): Promise<void> {\n validateId(id, 'id');\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/${encodeURIComponent(id)}`,\n { method: 'DELETE', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n}\n\n/**\n * Start a browser session for profile setup.\n */\nexport async function startProfileSession(\n config: BrowserConfig = {},\n input?: ProfileSessionInput\n): Promise<ProfileSession> {\n if (!config.apiKey) {\n throw new MorphAuthenticationError();\n }\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n // Transform input if provided\n const body = input?.profileId\n ? { profile_id: input.profileId }\n : {};\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/session/start`,\n {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiSession: APIProfileSession = await response.json();\n return transformSession(apiSession);\n}\n\n/**\n * Save browser state from a session to a profile.\n */\nexport async function saveProfileSession(\n input: SaveProfileSessionInput,\n config: BrowserConfig = {}\n): Promise<Profile> {\n validateId(input.sessionId, 'sessionId');\n validateId(input.profileId, 'profileId');\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/session/save`,\n {\n method: 'POST',\n headers,\n body: JSON.stringify(transformSaveInput(input)),\n },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiProfile: APIProfile = await response.json();\n return transformProfile(apiProfile);\n}\n\n/**\n * List repo IDs available to the authenticated user/org.\n */\nexport async function listRepos(config: BrowserConfig = {}): Promise<RepoSummary[]> {\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/repos`,\n { method: 'GET', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const data = await response.json();\n const repos = Array.isArray(data?.repos) ? data.repos : [];\n\n return repos.map((repo: any) => ({\n repoId: repo.repo_id,\n repoFullName: repo.repo_full_name,\n profileCount: repo.profile_count ?? 0,\n })) satisfies RepoSummary[];\n}\n\n/**\n * Get the presigned URL for a profile's state.\n */\nexport async function getProfileState(\n profileId: string,\n config: BrowserConfig = {}\n): Promise<ProfileStateResponse> {\n validateId(profileId, 'profileId');\n\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/${encodeURIComponent(profileId)}/state`,\n { method: 'GET', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiState: APIProfileStateResponse = await response.json();\n return transformStateResponse(apiState);\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction buildHeaders(config: BrowserConfig): Record<string, string> {\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n if (config.apiKey) {\n headers['Authorization'] = `Bearer ${config.apiKey}`;\n }\n return headers;\n}\n\nasync function fetchProfile(id: string, config: BrowserConfig): Promise<Profile> {\n const apiUrl = config.apiUrl || DEFAULT_API_URL;\n const headers = buildHeaders(config);\n\n const response = await fetchWithRetry(\n `${apiUrl}/profiles/${encodeURIComponent(id)}`,\n { method: 'GET', headers },\n config.retryConfig\n );\n\n if (!response.ok) {\n const errorText = await response.text().catch(() => response.statusText);\n const requestId = response.headers.get('x-request-id') || undefined;\n throw parseAPIError(response.status, errorText, requestId);\n }\n\n const apiProfile: APIProfile = await response.json();\n return transformProfile(apiProfile);\n}\n\nfunction buildProfileSetup(profile: Profile, session: ProfileSession, config: BrowserConfig): ProfileSetup {\n return {\n profile,\n session,\n save: () => saveProfileSession({ sessionId: session.sessionId, profileId: profile.id }, config),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,IAAM,kBAAkB,QAAQ,IAAI,sBAAsB,QACtD,0BACA;AAOG,IAAM,iBAAN,MAAqB;AAAA,EAClB;AAAA,EAER,YAAY,QAAuB;AACjC,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,MAAM,cAAc,OAAkD;AACpE,WAAO,cAAc,OAAO,KAAK,MAAM;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,MAAM,aAAa,QAAqC;AACtD,WAAO,aAAa,KAAK,QAAQ,MAAM;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,WAAW,IAAyC;AACxD,WAAO,WAAW,IAAI,KAAK,MAAM;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,cAAc,IAAmC;AACrD,WAAO,cAAc,IAAI,KAAK,MAAM;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,cAAc,IAA2B;AAC7C,WAAO,cAAc,IAAI,KAAK,MAAM;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBA,MAAM,aAAa,OAAsD;AACvE,WAAO,oBAAoB,KAAK,QAAQ,KAAK;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA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
} from "./chunk-2HMEZZKK.js";
|
|
5
|
-
import {
|
|
6
|
-
executeBrowserTask
|
|
7
|
-
} from "./chunk-FLWBVHDC.js";
|
|
8
|
-
import {
|
|
9
|
-
__export
|
|
10
|
-
} from "./chunk-PZ5AY32C.js";
|
|
11
|
-
|
|
12
|
-
// tools/browser/anthropic.ts
|
|
13
|
-
var anthropic_exports = {};
|
|
14
|
-
__export(anthropic_exports, {
|
|
15
|
-
browserTool: () => browserTool,
|
|
16
|
-
createBrowserTool: () => createBrowserTool
|
|
17
|
-
});
|
|
18
|
-
var browserTool = {
|
|
19
|
-
name: "browser_task",
|
|
20
|
-
description: BROWSER_TOOL_DESCRIPTION,
|
|
21
|
-
input_schema: {
|
|
22
|
-
type: "object",
|
|
23
|
-
properties: {
|
|
24
|
-
task: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description: 'Natural language description of what to do (e.g., "Test checkout flow for buying a pineapple")'
|
|
27
|
-
},
|
|
28
|
-
url: {
|
|
29
|
-
type: "string",
|
|
30
|
-
description: "Starting URL (e.g., https://3000-xyz.e2b.dev). Required if navigating to a specific page."
|
|
31
|
-
},
|
|
32
|
-
maxSteps: {
|
|
33
|
-
type: "number",
|
|
34
|
-
description: "Maximum number of browser actions to take (1-50). Default: 10. Use 15-30 for complex flows.",
|
|
35
|
-
default: 10
|
|
36
|
-
},
|
|
37
|
-
region: {
|
|
38
|
-
type: "string",
|
|
39
|
-
enum: ["sfo", "lon"],
|
|
40
|
-
description: "Browserless region: sfo (US West Coast) or lon (Europe). Default: sfo.",
|
|
41
|
-
default: "sfo"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
required: ["task"]
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
function formatResult(result) {
|
|
48
|
-
if (result.success) {
|
|
49
|
-
const parts = [
|
|
50
|
-
"\u2705 Browser task completed successfully",
|
|
51
|
-
`Steps taken: ${result.stepsTaken ?? 0}`,
|
|
52
|
-
result.executionTimeMs ? `Execution time: ${result.executionTimeMs}ms` : null,
|
|
53
|
-
"",
|
|
54
|
-
"Result:",
|
|
55
|
-
result.result || "Task completed"
|
|
56
|
-
];
|
|
57
|
-
return parts.filter(Boolean).join("\n");
|
|
58
|
-
}
|
|
59
|
-
return `\u274C Browser task failed: ${result.error || "Unknown error"}`;
|
|
60
|
-
}
|
|
61
|
-
function createBrowserTool(config) {
|
|
62
|
-
return Object.assign({}, browserTool, {
|
|
63
|
-
execute: async (input) => {
|
|
64
|
-
return executeBrowserTask(input, config);
|
|
65
|
-
},
|
|
66
|
-
formatResult: (result) => {
|
|
67
|
-
return formatResult(result);
|
|
68
|
-
},
|
|
69
|
-
getSystemPrompt: () => {
|
|
70
|
-
return BROWSER_SYSTEM_PROMPT;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
browserTool,
|
|
77
|
-
createBrowserTool,
|
|
78
|
-
anthropic_exports
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=chunk-WFOGTZF6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/browser/anthropic.ts"],"sourcesContent":["/**\n * Anthropic SDK adapter for browser automation tool\n */\n\nimport type { Tool } from '@anthropic-ai/sdk/resources/messages.mjs';\nimport { executeBrowserTask } from './core.js';\nimport type {\n BrowserConfig,\n BrowserTaskInput,\n BrowserTaskResult,\n} from './types.js';\nimport { BROWSER_TOOL_DESCRIPTION, BROWSER_SYSTEM_PROMPT } from './prompts.js';\n\n/**\n * Anthropic tool definition for browser automation\n */\nexport const browserTool: Tool = {\n name: 'browser_task',\n description: BROWSER_TOOL_DESCRIPTION,\n input_schema: {\n type: 'object',\n properties: {\n task: {\n type: 'string',\n description: 'Natural language description of what to do (e.g., \"Test checkout flow for buying a pineapple\")',\n },\n url: {\n type: 'string',\n description: 'Starting URL (e.g., https://3000-xyz.e2b.dev). Required if navigating to a specific page.',\n },\n maxSteps: {\n type: 'number',\n description: 'Maximum number of browser actions to take (1-50). Default: 10. Use 15-30 for complex flows.',\n default: 10,\n },\n region: {\n type: 'string',\n enum: ['sfo', 'lon'],\n description: 'Browserless region: sfo (US West Coast) or lon (Europe). Default: sfo.',\n default: 'sfo',\n },\n },\n required: ['task'],\n },\n};\n\n/**\n * Format browser task result for Anthropic tool result\n * \n * Returns a concise summary suitable for agent context. The full result object\n * (with urls, errors, action_history, judgement, etc.) is available when calling\n * execute() directly, but this formatted string omits those details to save tokens.\n * \n * @param result - Browser task result with full history data\n * @returns Formatted string summary for tool result\n */\nfunction formatResult(result: BrowserTaskResult): string {\n if (result.success) {\n const parts = [\n '✅ Browser task completed successfully',\n `Steps taken: ${result.stepsTaken ?? 0}`,\n result.executionTimeMs ? `Execution time: ${result.executionTimeMs}ms` : null,\n '',\n 'Result:',\n result.result || 'Task completed',\n ];\n return parts.filter(Boolean).join('\\n');\n }\n\n return `❌ Browser task failed: ${result.error || 'Unknown error'}`;\n}\n\n/**\n * Create a configured browser tool with execute and formatResult methods\n * \n * @param config - Browser worker configuration\n * @returns Tool definition with execute and formatResult methods\n * \n * @example\n * ```typescript\n * import Anthropic from '@anthropic-ai/sdk';\n * import { createBrowserTool } from 'morphsdk/tools/browser/anthropic';\n * \n * const tool = createBrowserTool({\n * apiKey: process.env.MORPH_API_KEY,\n * timeout: 180000\n * });\n * \n * const client = new Anthropic();\n * \n * const response = await client.messages.create({\n * model: 'claude-sonnet-4-5-20250929',\n * tools: [tool], // tool itself is the Tool definition\n * messages: [{\n * role: 'user',\n * content: 'Test the checkout flow at https://3000-abc.e2b.dev'\n * }]\n * });\n * \n * // Execute and format\n * const result = await tool.execute(toolUseBlock.input);\n * const formatted = tool.formatResult(result);\n * ```\n */\nexport function createBrowserTool(config?: BrowserConfig) {\n return Object.assign({}, browserTool, {\n execute: async (input: BrowserTaskInput): Promise<BrowserTaskResult> => {\n return executeBrowserTask(input, config);\n },\n formatResult: (result: BrowserTaskResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return BROWSER_SYSTEM_PROMPT;\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,IAAM,cAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,KAAK;AAAA,QACH,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,QACb,SAAS;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,MAAM,CAAC,OAAO,KAAK;AAAA,QACnB,aAAa;AAAA,QACb,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,UAAU,CAAC,MAAM;AAAA,EACnB;AACF;AAYA,SAAS,aAAa,QAAmC;AACvD,MAAI,OAAO,SAAS;AAClB,UAAM,QAAQ;AAAA,MACZ;AAAA,MACA,gBAAgB,OAAO,cAAc,CAAC;AAAA,MACtC,OAAO,kBAAkB,mBAAmB,OAAO,eAAe,OAAO;AAAA,MACzE;AAAA,MACA;AAAA,MACA,OAAO,UAAU;AAAA,IACnB;AACA,WAAO,MAAM,OAAO,OAAO,EAAE,KAAK,IAAI;AAAA,EACxC;AAEA,SAAO,+BAA0B,OAAO,SAAS,eAAe;AAClE;AAkCO,SAAS,kBAAkB,QAAwB;AACxD,SAAO,OAAO,OAAO,CAAC,GAAG,aAAa;AAAA,IACpC,SAAS,OAAO,UAAwD;AACtE,aAAO,mBAAmB,OAAO,MAAM;AAAA,IACzC;AAAA,IACA,cAAc,CAAC,WAAsC;AACnD,aAAO,aAAa,MAAM;AAAA,IAC5B;AAAA,IACA,iBAAiB,MAAc;AAC7B,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/dist/chunk-YTYCHRQ2.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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 normalized = normalizeLiveUrl(debugUrl);
|
|
17
|
-
const url = new URL(normalized);
|
|
18
|
-
if (options.interactive !== void 0) {
|
|
19
|
-
url.searchParams.set("interactive", String(options.interactive));
|
|
20
|
-
}
|
|
21
|
-
if (options.theme) {
|
|
22
|
-
url.searchParams.set("theme", options.theme);
|
|
23
|
-
}
|
|
24
|
-
if (options.showControls !== void 0) {
|
|
25
|
-
url.searchParams.set("showControls", String(options.showControls));
|
|
26
|
-
}
|
|
27
|
-
if (options.pageId) {
|
|
28
|
-
url.searchParams.set("pageId", options.pageId);
|
|
29
|
-
}
|
|
30
|
-
if (options.pageIndex) {
|
|
31
|
-
url.searchParams.set("pageIndex", options.pageIndex);
|
|
32
|
-
}
|
|
33
|
-
return url.toString();
|
|
34
|
-
}
|
|
35
|
-
function cdpToHttps(wsUrl) {
|
|
36
|
-
return wsUrl.replace(/^wss:\/\//, "https://").replace(/^ws:\/\//, "http://");
|
|
37
|
-
}
|
|
38
|
-
function normalizeLiveUrl(debugUrl) {
|
|
39
|
-
const trimmed = debugUrl.trim();
|
|
40
|
-
if (!trimmed) return trimmed;
|
|
41
|
-
if (trimmed.startsWith("wss://") || trimmed.startsWith("ws://")) {
|
|
42
|
-
return `https://live.browser-use.com?wss=${encodeURIComponent(cdpToHttps(trimmed))}`;
|
|
43
|
-
}
|
|
44
|
-
let url;
|
|
45
|
-
try {
|
|
46
|
-
url = new URL(trimmed);
|
|
47
|
-
} catch {
|
|
48
|
-
return trimmed;
|
|
49
|
-
}
|
|
50
|
-
const wssParam = url.searchParams.get("wss");
|
|
51
|
-
if (wssParam && (wssParam.startsWith("wss://") || wssParam.startsWith("ws://"))) {
|
|
52
|
-
url.searchParams.set("wss", cdpToHttps(wssParam));
|
|
53
|
-
}
|
|
54
|
-
return url.toString();
|
|
55
|
-
}
|
|
56
|
-
function buildLiveIframe(debugUrl, options = {}) {
|
|
57
|
-
const {
|
|
58
|
-
width = "100%",
|
|
59
|
-
height = "600px",
|
|
60
|
-
style = "",
|
|
61
|
-
className = "",
|
|
62
|
-
...sessionOptions
|
|
63
|
-
} = options;
|
|
64
|
-
const src = buildLiveUrl(debugUrl, sessionOptions);
|
|
65
|
-
const widthStr = typeof width === "number" ? `${width}px` : width;
|
|
66
|
-
const heightStr = typeof height === "number" ? `${height}px` : height;
|
|
67
|
-
const baseStyle = `width: ${widthStr}; height: ${heightStr}; border: none;`;
|
|
68
|
-
const fullStyle = style ? `${baseStyle} ${style}` : baseStyle;
|
|
69
|
-
const attributes = [
|
|
70
|
-
`src="${src}"`,
|
|
71
|
-
`style="${fullStyle}"`
|
|
72
|
-
];
|
|
73
|
-
if (className) {
|
|
74
|
-
attributes.push(`class="${className}"`);
|
|
75
|
-
}
|
|
76
|
-
return `<iframe ${attributes.join(" ")}></iframe>`;
|
|
77
|
-
}
|
|
78
|
-
function buildEmbedCode(debugUrl, options = {}) {
|
|
79
|
-
const iframe = buildLiveIframe(debugUrl, options);
|
|
80
|
-
return `<!-- Embed Morph Live Session -->
|
|
81
|
-
${iframe}`;
|
|
82
|
-
}
|
|
83
|
-
function resolvePreset(optionsOrPreset) {
|
|
84
|
-
if (!optionsOrPreset) {
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
if (typeof optionsOrPreset === "string") {
|
|
88
|
-
const preset = LIVE_PRESETS[optionsOrPreset];
|
|
89
|
-
if (!preset) {
|
|
90
|
-
throw new Error(
|
|
91
|
-
`Unknown preset: ${optionsOrPreset}. Available presets: ${Object.keys(LIVE_PRESETS).join(", ")}`
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
return preset;
|
|
95
|
-
}
|
|
96
|
-
return optionsOrPreset;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
LIVE_PRESETS,
|
|
101
|
-
buildLiveUrl,
|
|
102
|
-
buildLiveIframe,
|
|
103
|
-
buildEmbedCode,
|
|
104
|
-
resolvePreset
|
|
105
|
-
};
|
|
106
|
-
//# sourceMappingURL=chunk-YTYCHRQ2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 `Unknown preset: ${optionsOrPreset}. Available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