style: format browser tool wiring
This commit is contained in:
@@ -626,9 +626,7 @@ export function createClawdbotCodingTools(options?: {
|
|||||||
createWhatsAppLoginTool(),
|
createWhatsAppLoginTool(),
|
||||||
...createClawdbotTools({
|
...createClawdbotTools({
|
||||||
browserControlUrl: sandbox?.browser?.controlUrl,
|
browserControlUrl: sandbox?.browser?.controlUrl,
|
||||||
allowHostBrowserControl: sandbox
|
allowHostBrowserControl: sandbox ? sandbox.browserAllowHostControl : true,
|
||||||
? sandbox.browserAllowHostControl
|
|
||||||
: true,
|
|
||||||
agentSessionKey: options?.sessionKey,
|
agentSessionKey: options?.sessionKey,
|
||||||
agentProvider: resolveGatewayMessageProvider(options?.messageProvider),
|
agentProvider: resolveGatewayMessageProvider(options?.messageProvider),
|
||||||
agentAccountId: options?.agentAccountId,
|
agentAccountId: options?.agentAccountId,
|
||||||
|
|||||||
@@ -143,21 +143,15 @@ function resolveBrowserBaseUrl(params: {
|
|||||||
const normalizedDefault = params.defaultControlUrl?.trim() ?? "";
|
const normalizedDefault = params.defaultControlUrl?.trim() ?? "";
|
||||||
const target =
|
const target =
|
||||||
params.target ??
|
params.target ??
|
||||||
(normalizedControlUrl
|
(normalizedControlUrl ? "custom" : normalizedDefault ? "sandbox" : "host");
|
||||||
? "custom"
|
|
||||||
: normalizedDefault
|
|
||||||
? "sandbox"
|
|
||||||
: "host");
|
|
||||||
|
|
||||||
if (target !== "custom" && params.target && normalizedControlUrl) {
|
if (target !== "custom" && params.target && normalizedControlUrl) {
|
||||||
throw new Error(
|
throw new Error('controlUrl is only supported with target="custom".');
|
||||||
'controlUrl is only supported with target="custom".',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target === "custom") {
|
if (target === "custom") {
|
||||||
if (!normalizedControlUrl) {
|
if (!normalizedControlUrl) {
|
||||||
throw new Error('Custom browser target requires controlUrl.');
|
throw new Error("Custom browser target requires controlUrl.");
|
||||||
}
|
}
|
||||||
return normalizedControlUrl.replace(/\/$/, "");
|
return normalizedControlUrl.replace(/\/$/, "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user