UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

34 lines (33 loc) • 1.47 kB
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs"; import { D as parseStrictPositiveInteger } from "./number-coercion-D6u-4YD8.mjs"; import "./string-coerce-runtime-BwAZZDf5.mjs"; import "./number-runtime-W4chuk8B.mjs"; import { n as ACT_MAX_VIEWPORT_DIMENSION } from "./act-policy-fWdzY2YP.mjs"; import { l as runBrowserCliRequest, t as BROWSER_TAB_REFERENCE_HELP } from "./browser-cli-shared-BEDAHNiM.mjs"; //#region extensions/browser/src/cli/browser-cli-resize.ts function parseBrowserViewportDimension(e, t) { const n = parseStrictPositiveInteger(e); if (n !== void 0 && n <= 8192) return n; const r = n === void 0 ? "must be a positive integer" : `maximum is ${ACT_MAX_VIEWPORT_DIMENSION}`; throw new Error(`Invalid ${t}: ${r}`); } function registerBrowserResizeCommand(e, t, n = false) { e.argument("<width>", "Viewport width").argument("<height>", "Viewport height").option("--target-id <id>", BROWSER_TAB_REFERENCE_HELP).action(async (e, r, i, a) => { const o = parseBrowserViewportDimension(e, "width"); const s = parseBrowserViewportDimension(r, "height"); await runBrowserCliRequest({ parent: t(a), path: "/act", body: { kind: "resize", width: o, height: s, targetId: normalizeOptionalString(i.targetId) }, successMessage: `${n ? "viewport set:" : "resized to"} ${o}x${s}`, errorPolicy: n ? "runtime" : "inline" }); }); } //#endregion export { registerBrowserResizeCommand as t };