openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1,010 lines • 78.2 kB
JavaScript
import { t as closedObject } from "./closed-object-B-B1FwhS.mjs";
import { Type } from "typebox";
//#region src/plugins/computer-use-schemas.ts
const COMPUTER_EXECUTION_ID_PATTERN = "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
const COMPUTER_USE_V2_ACTION_NAMES = [
"screenshot",
"left_click",
"right_click",
"middle_click",
"double_click",
"triple_click",
"mouse_move",
"left_click_drag",
"left_mouse_down",
"left_mouse_up",
"scroll",
"type",
"key",
"hold_key",
"wait",
"list_apps",
"list_windows",
"get_accessibility_tree",
"get_cursor_position",
"get_window_state",
"launch_app",
"kill_app",
"bring_to_front",
"set_value",
"zoom",
"get_browser_state",
"browser_prepare",
"browser_navigate",
"browser_click",
"browser_type",
"browser_dialog",
"browser_set_input_files",
"browser_download",
"browser_pointer",
"escalate_scope",
"get_recording_state",
"start_recording",
"stop_recording",
"replay_trajectory",
"invoke_menu"
];
const COMPUTER_USE_V1_ACTION_NAMES = COMPUTER_USE_V2_ACTION_NAMES.slice(0, 15);
const COMPUTER_ACT_V1_ACTION_NAMES = COMPUTER_USE_V2_ACTION_NAMES.slice(1, 14);
const COMPUTER_CONTRACT_MISMATCH = "COMPUTER_CONTRACT_MISMATCH";
const COMPUTER_STALE_OBSERVATION = "COMPUTER_STALE_OBSERVATION";
const COMPUTER_SCROLL_DIRECTIONS = [
"up",
"down",
"left",
"right"
];
const DELIVERY_MODES = ["background", "foreground"];
const COMPUTER_ESCALATION_REASONS = [
"ax_tree_pixel_mismatch",
"background_delivery_failed",
"foreground_ineffective",
"no_window_target",
"other"
];
const COMPUTER_RESOURCE_HANDLE_PATTERN = "^openclaw:computer-resource:v1:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
const optionalScreenFields = {
screenIndex: Type.Optional(Type.Integer({ minimum: 0 })),
refWidth: Type.Optional(Type.Integer({ minimum: 1 }))
};
const optionalReferenceFields = {
windowRef: Type.Optional(Type.String({ minLength: 1 })),
elementRef: Type.Optional(Type.String({ minLength: 1 })),
observationId: Type.Optional(Type.String({ minLength: 1 })),
deliveryMode: Type.Optional(Type.Enum(DELIVERY_MODES, { type: "string" }))
};
const optionalPointerFields = {
displayFrameId: Type.Optional(Type.String()),
x: Type.Optional(Type.Number({ minimum: 0 })),
y: Type.Optional(Type.Number({ minimum: 0 }))
};
const browserTargetFields = {
browserRef: Type.String({ minLength: 1 }),
pageRef: Type.String({ minLength: 1 })
};
const observedBrowserTargetFields = {
...browserTargetFields,
observationId: Type.String({ minLength: 1 })
};
function actionObject(e, t) {
return closedObject({
action: Type.Enum(e, { type: "string" }),
executionId: Type.Optional(Type.String({ pattern: COMPUTER_EXECUTION_ID_PATTERN })),
...t
});
}
const ComputerActV1ParamsSchema = Type.Union([
actionObject([
"left_click",
"right_click",
"middle_click",
"double_click",
"triple_click",
"mouse_move"
], {
...optionalPointerFields,
modifiers: Type.Optional(Type.String()),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["left_click_drag"], {
...optionalPointerFields,
fromX: Type.Optional(Type.Number({ minimum: 0 })),
fromY: Type.Optional(Type.Number({ minimum: 0 })),
durationMs: Type.Optional(Type.Integer({ minimum: 0 })),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["left_mouse_down", "left_mouse_up"], {
...optionalPointerFields,
modifiers: Type.Optional(Type.String()),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["scroll"], {
...optionalPointerFields,
modifiers: Type.Optional(Type.String()),
scrollDirection: Type.Optional(Type.Enum(COMPUTER_SCROLL_DIRECTIONS, { type: "string" })),
scrollAmount: Type.Optional(Type.Integer({ minimum: 1 })),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["type"], {
text: Type.Optional(Type.String()),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["key"], {
keys: Type.Optional(Type.String()),
...optionalScreenFields,
...optionalReferenceFields
}),
actionObject(["hold_key"], {
keys: Type.Optional(Type.String()),
durationMs: Type.Optional(Type.Integer({ minimum: 0 })),
...optionalScreenFields,
...optionalReferenceFields
})
]);
/** Canonical inner payload accepted by the `computer.act` node command. */
const ComputerActParamsSchema = Type.Union([
...ComputerActV1ParamsSchema.anyOf,
actionObject([
"list_apps",
"list_windows",
"get_cursor_position"
], {}),
actionObject(["get_accessibility_tree"], {
windowRef: Type.Optional(Type.String({ minLength: 1 })),
query: Type.Optional(Type.String()),
depth: Type.Optional(Type.Integer({
minimum: 0,
maximum: 64
})),
maxElements: Type.Optional(Type.Integer({
minimum: 1,
maximum: 2e3
}))
}),
actionObject(["get_window_state"], {
windowRef: Type.String({ minLength: 1 }),
includeScreenshot: Type.Optional(Type.Boolean()),
query: Type.Optional(Type.String()),
depth: Type.Optional(Type.Integer({
minimum: 0,
maximum: 64
})),
maxElements: Type.Optional(Type.Integer({
minimum: 1,
maximum: 2e3
}))
}),
actionObject(["launch_app", "kill_app"], { app: Type.String({ minLength: 1 }) }),
actionObject(["bring_to_front"], { windowRef: Type.String({ minLength: 1 }) }),
actionObject(["set_value"], {
windowRef: Type.String({ minLength: 1 }),
elementRef: Type.String({ minLength: 1 }),
observationId: Type.String({ minLength: 1 }),
value: Type.String(),
deliveryMode: Type.Optional(Type.Enum(DELIVERY_MODES, { type: "string" }))
}),
actionObject(["invoke_menu"], {
windowRef: Type.String({ minLength: 1 }),
path: Type.Array(Type.String({
minLength: 1,
maxLength: 200
}), {
minItems: 1,
maxItems: 16
}),
deliveryMode: Type.Optional(Type.Enum(DELIVERY_MODES, { type: "string" }))
}),
actionObject(["zoom"], {
windowRef: Type.String({ minLength: 1 }),
observationId: Type.String({ minLength: 1 }),
x1: Type.Number({ minimum: 0 }),
y1: Type.Number({ minimum: 0 }),
x2: Type.Number({ minimum: 0 }),
y2: Type.Number({ minimum: 0 })
}),
actionObject(["get_browser_state"], { windowRef: Type.String({ minLength: 1 }) }),
actionObject(["get_browser_state"], {
...browserTargetFields,
snapshotFormat: Type.Optional(Type.Enum(["dom_refs_v1", "semantic_v2"], { type: "string" })),
elementRef: Type.Optional(Type.String({ minLength: 1 })),
observationId: Type.Optional(Type.String({ minLength: 1 })),
query: Type.Optional(Type.String()),
continuation: Type.Optional(Type.String({ minLength: 1 })),
includeScreenshot: Type.Optional(Type.Boolean())
}),
actionObject(["browser_prepare"], {
windowRef: Type.String({ minLength: 1 }),
profile: Type.Optional(Type.Enum(["isolated_new", "isolated_named"], { type: "string" })),
profileName: Type.Optional(Type.String({
minLength: 1,
maxLength: 64,
pattern: "^[A-Za-z0-9._-]+$"
}))
}),
actionObject(["browser_navigate"], {
...browserTargetFields,
url: Type.String({ minLength: 1 })
}),
actionObject(["browser_click"], {
...observedBrowserTargetFields,
elementRef: Type.Optional(Type.String({ minLength: 1 })),
x: Type.Optional(Type.Number({ minimum: 0 })),
y: Type.Optional(Type.Number({ minimum: 0 })),
inputRoute: Type.Optional(Type.Enum(["trusted", "dom_event"], { type: "string" }))
}),
actionObject(["browser_type"], {
...observedBrowserTargetFields,
elementRef: Type.String({ minLength: 1 }),
text: Type.String(),
mode: Type.Optional(Type.Enum(["insert_text", "keystrokes"], { type: "string" })),
replace: Type.Optional(Type.Boolean())
}),
actionObject(["browser_dialog"], {
...browserTargetFields,
dialogAction: Type.Literal("inspect")
}),
actionObject(["browser_dialog"], {
...browserTargetFields,
dialogAction: Type.Literal("accept"),
dialogRef: Type.String({ minLength: 1 }),
promptText: Type.Optional(Type.String()),
deliveryMode: Type.Optional(Type.Enum(DELIVERY_MODES, { type: "string" }))
}),
actionObject(["browser_dialog"], {
...browserTargetFields,
dialogAction: Type.Literal("dismiss"),
dialogRef: Type.String({ minLength: 1 }),
deliveryMode: Type.Optional(Type.Enum(DELIVERY_MODES, { type: "string" }))
}),
actionObject(["browser_set_input_files"], {
...observedBrowserTargetFields,
elementRef: Type.String({ minLength: 1 }),
resourceHandles: Type.Array(Type.String({ pattern: COMPUTER_RESOURCE_HANDLE_PATTERN }), {
minItems: 1,
maxItems: 32
})
}),
actionObject(["browser_download"], {
...observedBrowserTargetFields,
elementRef: Type.String({ minLength: 1 })
}),
actionObject(["browser_pointer"], {
...observedBrowserTargetFields,
pointerAction: Type.Enum([
"hover",
"right_click",
"double_click",
"scroll",
"drag"
], { type: "string" }),
inputRoute: Type.Optional(Type.Enum(["trusted", "dom_event"], { type: "string" })),
elementRef: Type.Optional(Type.String({ minLength: 1 })),
x: Type.Optional(Type.Number({ minimum: 0 })),
y: Type.Optional(Type.Number({ minimum: 0 })),
destinationElementRef: Type.Optional(Type.String({ minLength: 1 })),
toX: Type.Optional(Type.Number({ minimum: 0 })),
toY: Type.Optional(Type.Number({ minimum: 0 })),
deltaX: Type.Optional(Type.Number()),
deltaY: Type.Optional(Type.Number())
}),
actionObject(["escalate_scope"], { reason: Type.Enum(COMPUTER_ESCALATION_REASONS, { type: "string" }) }),
actionObject(["get_recording_state", "stop_recording"], {}),
actionObject(["start_recording"], { recordVideo: Type.Optional(Type.Boolean()) }),
actionObject(["replay_trajectory"], {
resourceHandle: Type.String({ pattern: COMPUTER_RESOURCE_HANDLE_PATTERN }),
delayMs: Type.Optional(Type.Integer({
minimum: 0,
maximum: 1e4
})),
stopOnError: Type.Optional(Type.Boolean())
})
]);
const COMPUTER_ACT_RESULT_MAX_ELEMENTS = 2e3;
const COMPUTER_ACT_RESULT_MAX_DETAIL_KEYS = 64;
const ComputerBoundsSchema = closedObject({
x: Type.Number(),
y: Type.Number(),
width: Type.Number({ minimum: 0 }),
height: Type.Number({ minimum: 0 })
});
const ComputerObservationSchema = closedObject({
kind: Type.Enum([
"window",
"screen",
"browser"
], { type: "string" }),
base64: Type.Optional(Type.String()),
format: Type.Optional(Type.Enum(["jpeg", "png"], { type: "string" })),
width: Type.Optional(Type.Integer({ minimum: 1 })),
height: Type.Optional(Type.Integer({ minimum: 1 })),
observationId: Type.Optional(Type.String({ minLength: 1 })),
elements: Type.Optional(Type.Array(closedObject({
elementRef: Type.String({ minLength: 1 }),
role: Type.String({ minLength: 1 }),
label: Type.Optional(Type.String()),
value: Type.Optional(Type.String()),
bounds: ComputerBoundsSchema
}), { maxItems: COMPUTER_ACT_RESULT_MAX_ELEMENTS }))
});
const ComputerActResultSchema = closedObject({
ok: Type.Boolean(),
cursorX: Type.Optional(Type.Number()),
cursorY: Type.Optional(Type.Number()),
effect: Type.Optional(Type.Enum([
"confirmed",
"unverifiable",
"suspected_noop"
], { type: "string" })),
observation: Type.Optional(ComputerObservationSchema),
escalation: Type.Optional(closedObject({
recommended: Type.Enum([
"window-pixel",
"foreground",
"desktop"
], { type: "string" }),
reasonCode: Type.String({ minLength: 1 })
})),
details: Type.Optional(Type.Record(Type.String({
minLength: 1,
maxLength: 128
}), Type.Unknown(), { maxProperties: COMPUTER_ACT_RESULT_MAX_DETAIL_KEYS }))
});
const ComputerUseCapabilityDescriptorSchema = closedObject({
contractVersion: Type.Literal(2),
provider: closedObject({
id: Type.String({
minLength: 1,
maxLength: 128
}),
label: Type.String({
minLength: 1,
maxLength: 256
}),
generation: Type.String({
minLength: 1,
maxLength: 256
})
}),
actions: Type.Array(Type.Enum(COMPUTER_USE_V2_ACTION_NAMES, { type: "string" }), {
maxItems: COMPUTER_USE_V2_ACTION_NAMES.length,
uniqueItems: true
}),
targets: Type.Array(Type.Enum([
"screen",
"window",
"element",
"browser"
]), {
maxItems: 4,
uniqueItems: true
}),
deliveryModes: Type.Array(Type.Enum(DELIVERY_MODES, { type: "string" }), {
maxItems: DELIVERY_MODES.length,
uniqueItems: true
}),
observations: Type.Array(Type.Enum([
"image",
"accessibility",
"browser"
], { type: "string" }), {
maxItems: 3,
uniqueItems: true
}),
features: closedObject({
recording: Type.Boolean(),
agentCursor: Type.Boolean(),
multiDisplay: Type.Boolean()
})
});
/** Canonical inner payload accepted by the `screen.snapshot` node command. */
const ScreenSnapshotParamsSchema = closedObject({
executionId: Type.Optional(Type.String({ pattern: COMPUTER_EXECUTION_ID_PATTERN })),
screenIndex: Type.Optional(Type.Integer({ minimum: 0 })),
maxWidth: Type.Optional(Type.Integer({ minimum: 1 })),
quality: Type.Optional(Type.Number()),
format: Type.Optional(Type.Enum(["jpeg", "png"], { type: "string" }))
});
/** Canonical inner payload returned by the `screen.snapshot` node command. */
const ScreenSnapshotResultSchema = Type.Object({
format: Type.Enum(["jpeg", "png"], { type: "string" }),
base64: Type.String({ minLength: 1 }),
displayFrameId: Type.Optional(Type.String()),
screenIndex: Type.Optional(Type.Number()),
width: Type.Optional(Type.Number()),
height: Type.Optional(Type.Number()),
capturedAtMs: Type.Optional(Type.Integer({ minimum: 0 }))
});
//#endregion
//#region src/plugins/computer-use-validators.generated.js
/*!
TypeBox
The MIT License (MIT)
Copyright (c) 2017-2026 Haydn Paterson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var __defProp = Object.defineProperty;
var __export = (e, t) => {
for (var n in t) __defProp(e, n, {
get: t[n],
enumerable: !0
});
};
function CodePointCount(e) {
let t = 0, n = 0, r = 0;
for (; n < e.length;) {
let i = e.charCodeAt(n++) >> 10;
t += +((r << 8 | i) !== 13879), r = i;
}
return t;
}
function IsMaxLength(e, t) {
return e.length <= t || e.length <= t << 1 && CodePointCount(e) <= t;
}
function IsMinLength(e, t) {
return e.length >= t << 1 || e.length >= t && CodePointCount(e) >= t;
}
function Unreachable() {
throw new Error("Unreachable");
}
var guard_exports = {};
__export(guard_exports, {
CodePointCount: () => CodePointCount2,
Counted: () => Counted,
Entries: () => Entries,
EntriesRegExp: () => EntriesRegExp,
Every: () => Every,
EveryAll: () => EveryAll,
GraphemeCount: () => GraphemeCount2,
HasPropertyKey: () => HasPropertyKey,
IsArray: () => IsArray,
IsBigInt: () => IsBigInt,
IsBoolean: () => IsBoolean,
IsClassInstance: () => IsClassInstance,
IsConstructor: () => IsConstructor,
IsDeepEqual: () => IsDeepEqual,
IsEqual: () => IsEqual,
IsFunction: () => IsFunction,
IsGreaterEqualThan: () => IsGreaterEqualThan,
IsGreaterThan: () => IsGreaterThan,
IsInteger: () => IsInteger,
IsLessEqualThan: () => IsLessEqualThan,
IsLessThan: () => IsLessThan,
IsMaxLength: () => IsMaxLength2,
IsMinLength: () => IsMinLength2,
IsMultipleOf: () => IsMultipleOf,
IsNull: () => IsNull,
IsNumber: () => IsNumber,
IsObject: () => IsObject,
IsObjectNotArray: () => IsObjectNotArray,
IsString: () => IsString,
IsSymbol: () => IsSymbol,
IsUndefined: () => IsUndefined,
IsUnsafePropertyKey: () => IsUnsafePropertyKey,
IsValueLike: () => IsValueLike,
Keys: () => Keys,
ShiftLeft: () => ShiftLeft,
Some: () => Some,
SomeAll: () => SomeAll,
Symbols: () => Symbols,
Values: () => Values
});
function IsBetween(e, t, n) {
return e >= t && e <= n;
}
function IsZeroWidthJoiner(e) {
return e === 8205;
}
function IsRegionalIndicator(e) {
return IsBetween(e, 127462, 127487);
}
function IsVariationSelector(e) {
return IsBetween(e, 65024, 65039);
}
function IsCombiningMark(e) {
return IsBetween(e, 768, 879) || IsBetween(e, 6832, 6911) || IsBetween(e, 7616, 7679) || IsBetween(e, 65056, 65071);
}
function CodePointLength(e) {
return e > 65535 ? 2 : 1;
}
function ConsumeModifiers(e, t) {
for (; t < e.length;) {
let n = e.codePointAt(t);
if (IsCombiningMark(n) || IsVariationSelector(n)) t += CodePointLength(n);
else break;
}
return t;
}
function NextGraphemeClusterIndex(e, t) {
let n = e.codePointAt(t), r = t + CodePointLength(n);
for (r = ConsumeModifiers(e, r); r < e.length - 1 && IsZeroWidthJoiner(e.codePointAt(r));) {
let t = e.codePointAt(r + 1);
r += 1 + CodePointLength(t), r = ConsumeModifiers(e, r);
}
return IsRegionalIndicator(n) && r < e.length && IsRegionalIndicator(e.codePointAt(r)) && (r += CodePointLength(e.codePointAt(r))), r;
}
function GraphemeCount(e) {
let t = 0, n = 0;
for (; n < e.length;) n = NextGraphemeClusterIndex(e, n), t++;
return t;
}
function IsArray(e) {
return Array.isArray(e);
}
function IsBigInt(e) {
return IsEqual(typeof e, "bigint");
}
function IsBoolean(e) {
return IsEqual(typeof e, "boolean");
}
function IsConstructor(e) {
if (IsUndefined(e) || !IsFunction(e)) return !1;
let t = Function.prototype.toString.call(e);
return !!(/^class\s/.test(t) || /\[native code\]/.test(t));
}
function IsFunction(e) {
return IsEqual(typeof e, "function");
}
function IsInteger(e) {
return Number.isInteger(e);
}
function IsNull(e) {
return IsEqual(e, null);
}
function IsNumber(e) {
return Number.isFinite(e);
}
function IsObjectNotArray(e) {
return IsObject(e) && !IsArray(e);
}
function IsObject(e) {
return IsEqual(typeof e, "object") && !IsNull(e);
}
function IsString(e) {
return IsEqual(typeof e, "string");
}
function IsSymbol(e) {
return IsEqual(typeof e, "symbol");
}
function IsUndefined(e) {
return IsEqual(e, void 0);
}
function IsEqual(e, t) {
return e === t;
}
function IsGreaterThan(e, t) {
return e > t;
}
function IsLessThan(e, t) {
return e < t;
}
function IsLessEqualThan(e, t) {
return e <= t;
}
function IsGreaterEqualThan(e, t) {
return e >= t;
}
function IsMultipleOf(e, t) {
if (IsBigInt(e) || IsBigInt(t)) return BigInt(e) % BigInt(t) === 0n;
let n = 1e-10;
if (!IsNumber(e) || IsInteger(e) && 1 / t % 1 === 0) return !0;
let r = e % t;
return Math.min(Math.abs(r), Math.abs(r - t), Math.abs(r + t)) < n;
}
function IsClassInstance(e) {
if (!IsObject(e)) return !1;
let t = globalThis.Object.getPrototypeOf(e);
return IsNull(t) ? !1 : IsEqual(typeof t.constructor, "function") && !(IsEqual(t.constructor, globalThis.Object) || IsEqual(t.constructor.name, "Object"));
}
function IsValueLike(e) {
return IsBigInt(e) || IsBoolean(e) || IsNull(e) || IsNumber(e) || IsString(e) || IsUndefined(e);
}
function GraphemeCount2(e) {
return GraphemeCount(e);
}
function CodePointCount2(e) {
return CodePointCount(e);
}
function IsMaxLength2(e, t) {
return IsMaxLength(e, t);
}
function IsMinLength2(e, t) {
return IsMinLength(e, t);
}
function Every(e, t, n) {
return e.every((e, r) => r < t || n(e, r));
}
function EveryAll(e, t, n) {
let r = !0;
return e.forEach((e, i) => {
i >= t && !n(e, i) && (r = !1);
}), r;
}
function Some(e, t) {
return e.some((e, n) => t(e, n));
}
function SomeAll(e, t) {
let n = !1;
return e.forEach((e, r) => {
t(e, r) && (n = !0);
}), n;
}
function Counted(e, t) {
return e.reduce((e, n, r) => t(n, r) ? ++e : e, 0);
}
function ShiftLeft(e, t, n) {
return IsEqual(e.length, 0) ? n() : t(e[0], e.slice(1));
}
function IsUnsafePropertyKey(e) {
return IsEqual(e, "__proto__") || IsEqual(e, "constructor") || IsEqual(e, "prototype");
}
function HasPropertyKey(e, t) {
return IsUnsafePropertyKey(t) ? Object.prototype.hasOwnProperty.call(e, t) : t in e;
}
function EntriesRegExp(e) {
return Keys(e).map((t) => [new RegExp(`^${t}$`), e[t]]);
}
function Entries(e) {
return Object.entries(e);
}
function Keys(e) {
return Object.getOwnPropertyNames(e);
}
function Symbols(e) {
return Object.getOwnPropertySymbols(e);
}
function Values(e) {
return Object.values(e);
}
function DeepEqualObject(e, t) {
if (!IsObject(t)) return !1;
let n = Keys(e);
return IsEqual(n.length, Keys(t).length) && n.every((n) => IsDeepEqual(e[n], t[n]));
}
function DeepEqualArray(e, t) {
return IsArray(t) && IsEqual(e.length, t.length) && e.every((n, r) => IsDeepEqual(e[r], t[r]));
}
function IsDeepEqual(e, t) {
return IsArray(e) ? DeepEqualArray(e, t) : IsObject(e) ? DeepEqualObject(e, t) : IsEqual(e, t);
}
var globals_exports = {};
__export(globals_exports, {
IsBigInt64Array: () => IsBigInt64Array,
IsBigUint64Array: () => IsBigUint64Array,
IsBoolean: () => IsBoolean2,
IsDate: () => IsDate,
IsFloat32Array: () => IsFloat32Array,
IsFloat64Array: () => IsFloat64Array,
IsInt16Array: () => IsInt16Array,
IsInt32Array: () => IsInt32Array,
IsInt8Array: () => IsInt8Array,
IsMap: () => IsMap,
IsNumber: () => IsNumber2,
IsRegExp: () => IsRegExp,
IsSet: () => IsSet,
IsString: () => IsString2,
IsTypeArray: () => IsTypeArray,
IsUint16Array: () => IsUint16Array,
IsUint32Array: () => IsUint32Array,
IsUint8Array: () => IsUint8Array,
IsUint8ClampedArray: () => IsUint8ClampedArray
});
function IsBoolean2(e) {
return e instanceof Boolean;
}
function IsNumber2(e) {
return e instanceof Number;
}
function IsString2(e) {
return e instanceof String;
}
function IsTypeArray(e) {
return globalThis.ArrayBuffer.isView(e);
}
function IsInt8Array(e) {
return e instanceof globalThis.Int8Array;
}
function IsUint8Array(e) {
return e instanceof globalThis.Uint8Array;
}
function IsUint8ClampedArray(e) {
return e instanceof globalThis.Uint8ClampedArray;
}
function IsInt16Array(e) {
return e instanceof globalThis.Int16Array;
}
function IsUint16Array(e) {
return e instanceof globalThis.Uint16Array;
}
function IsInt32Array(e) {
return e instanceof globalThis.Int32Array;
}
function IsUint32Array(e) {
return e instanceof globalThis.Uint32Array;
}
function IsFloat32Array(e) {
return e instanceof globalThis.Float32Array;
}
function IsFloat64Array(e) {
return e instanceof globalThis.Float64Array;
}
function IsBigInt64Array(e) {
return e instanceof globalThis.BigInt64Array;
}
function IsBigUint64Array(e) {
return e instanceof globalThis.BigUint64Array;
}
function IsRegExp(e) {
return e instanceof globalThis.RegExp;
}
function IsDate(e) {
return e instanceof globalThis.Date;
}
function IsSet(e) {
return e instanceof globalThis.Set;
}
function IsMap(e) {
return e instanceof globalThis.Map;
}
function InstanceKeys(e) {
let t = /* @__PURE__ */ new Set(), n = e;
for (; n && n !== Object.prototype;) {
for (let e of Reflect.ownKeys(n)) e !== "constructor" && typeof e != "symbol" && t.add(e);
n = Object.getPrototypeOf(n);
}
return [...t];
}
function IsIEEE754(e) {
return typeof e == "number";
}
var ByteMarker = {
Array: 0,
BigInt: 1,
Boolean: 2,
Date: 3,
Constructor: 4,
Function: 5,
Null: 6,
Number: 7,
Object: 8,
RegExp: 9,
String: 10,
Symbol: 11,
TypeArray: 12,
Undefined: 13
};
var A0 = 8997;
var A1 = 33826;
var A2 = 40164;
var A3 = 52210;
var F64 = /* @__PURE__ */ new Float64Array(1);
var F64In = new DataView(F64.buffer);
var F64Out = new Uint8Array(F64.buffer);
function FNV1A64_OP(e) {
let t = A0 ^ e, n = t * 435, r = A1 * 435 + (n >>> 16), i = A2 * 435 + (r >>> 16) + (t << 8), a = A3 * 435 + (i >>> 16) + (A1 << 8);
A0 = n & 65535, A1 = r & 65535, A2 = i & 65535, A3 = a & 65535;
}
function FromArray(e) {
FNV1A64_OP(ByteMarker.Array);
for (let t of e) FromValue(t);
}
function FromBigInt(e) {
FNV1A64_OP(ByteMarker.BigInt), F64In.setBigInt64(0, e);
for (let e of F64Out) FNV1A64_OP(e);
}
function FromBoolean(e) {
FNV1A64_OP(ByteMarker.Boolean), FNV1A64_OP(e ? 1 : 0);
}
function FromConstructor(e) {
FNV1A64_OP(ByteMarker.Constructor), FromValue(e.toString());
}
function FromDate(e) {
FNV1A64_OP(ByteMarker.Date), FromValue(e.getTime());
}
function FromFunction(e) {
FNV1A64_OP(ByteMarker.Function), FromValue(e.toString());
}
function FromNull(e) {
FNV1A64_OP(ByteMarker.Null);
}
function FromNumber(e) {
FNV1A64_OP(ByteMarker.Number), F64In.setFloat64(0, e, !0);
for (let e of F64Out) FNV1A64_OP(e);
}
function FromObject(e) {
FNV1A64_OP(ByteMarker.Object);
for (let t of InstanceKeys(e).sort()) FromValue(t), FromValue(e[t]);
}
function FromRegExp(e) {
FNV1A64_OP(ByteMarker.RegExp), FromString(e.toString());
}
var encoder = new TextEncoder();
function FromString(e) {
FNV1A64_OP(ByteMarker.String);
for (let t = 0; t < e.length; t++) {
let n = e.charCodeAt(t);
if (n > 127) {
for (let n of encoder.encode(e.slice(t))) FNV1A64_OP(n);
return;
}
FNV1A64_OP(n);
}
}
function FromSymbol(e) {
FNV1A64_OP(ByteMarker.Symbol), FromValue(e.toString());
}
function FromTypeArray(e) {
FNV1A64_OP(ByteMarker.TypeArray);
let t = new Uint8Array(e.buffer);
for (let e = 0; e < t.length; e++) FNV1A64_OP(t[e]);
}
function FromUndefined(e) {
return FNV1A64_OP(ByteMarker.Undefined);
}
function FromValue(e) {
return globals_exports.IsTypeArray(e) ? FromTypeArray(e) : globals_exports.IsDate(e) ? FromDate(e) : globals_exports.IsRegExp(e) ? FromRegExp(e) : globals_exports.IsBoolean(e) ? FromBoolean(e.valueOf()) : globals_exports.IsString(e) ? FromString(e.valueOf()) : globals_exports.IsNumber(e) ? FromNumber(e.valueOf()) : IsIEEE754(e) ? FromNumber(e) : guard_exports.IsArray(e) ? FromArray(e) : guard_exports.IsBoolean(e) ? FromBoolean(e) : guard_exports.IsBigInt(e) ? FromBigInt(e) : guard_exports.IsConstructor(e) ? FromConstructor(e) : guard_exports.IsNull(e) ? FromNull(e) : guard_exports.IsObject(e) ? FromObject(e) : guard_exports.IsString(e) ? FromString(e) : guard_exports.IsSymbol(e) ? FromSymbol(e) : guard_exports.IsUndefined(e) ? FromUndefined(e) : guard_exports.IsFunction(e) ? FromFunction(e) : Unreachable();
}
function Hex(e) {
return e.toString(16).padStart(4, "0");
}
function Hash(e) {
return A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210, FromValue(e), `${Hex(A3)}${Hex(A2)}${Hex(A1)}${Hex(A0)}`;
}
var validateComputerActParams = (() => {
let e = [
/(^action$|^executionId$|^displayFrameId$|^x$|^y$|^modifiers$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^displayFrameId$|^x$|^y$|^fromX$|^fromY$|^durationMs$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^displayFrameId$|^x$|^y$|^modifiers$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^displayFrameId$|^x$|^y$|^modifiers$|^scrollDirection$|^scrollAmount$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^text$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^keys$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^keys$|^durationMs$|^screenIndex$|^refWidth$|^windowRef$|^elementRef$|^observationId$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^query$|^depth$|^maxElements$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^includeScreenshot$|^query$|^depth$|^maxElements$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^app$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^elementRef$|^observationId$|^value$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^path$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^observationId$|^x1$|^y1$|^x2$|^y2$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^snapshotFormat$|^elementRef$|^observationId$|^query$|^continuation$|^includeScreenshot$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^windowRef$|^profile$|^profileName$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/^[A-Za-z0-9._-]+$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^url$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^observationId$|^elementRef$|^x$|^y$|^inputRoute$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^observationId$|^elementRef$|^text$|^mode$|^replace$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^dialogAction$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^dialogAction$|^dialogRef$|^promptText$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^dialogAction$|^dialogRef$|^deliveryMode$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^observationId$|^elementRef$|^resourceHandles$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/^openclaw:computer-resource:v1:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^observationId$|^elementRef$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^browserRef$|^pageRef$|^observationId$|^pointerAction$|^inputRoute$|^elementRef$|^x$|^y$|^destinationElementRef$|^toX$|^toY$|^deltaX$|^deltaY$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^reason$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^recordVideo$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/(^action$|^executionId$|^resourceHandle$|^delayMs$|^stopOnError$)/u,
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,
/^openclaw:computer-resource:v1:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u
], check_0 = (t) => typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[0].test(t) || !1) && typeof t.action == "string" && (t.action === "left_click" || t.action === "right_click" || t.action === "middle_click" || t.action === "double_click" || t.action === "triple_click" || t.action === "mouse_move") && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[1].test(t.executionId)) && (t.displayFrameId === void 0 || !("displayFrameId" in t) || typeof t.displayFrameId == "string") && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.modifiers === void 0 || !("modifiers" in t) || typeof t.modifiers == "string") && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[2].test(t) || !1) && typeof t.action == "string" && t.action === "left_click_drag" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[3].test(t.executionId)) && (t.displayFrameId === void 0 || !("displayFrameId" in t) || typeof t.displayFrameId == "string") && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.fromX === void 0 || !("fromX" in t) || Number.isFinite(t.fromX) && t.fromX >= 0) && (t.fromY === void 0 || !("fromY" in t) || Number.isFinite(t.fromY) && t.fromY >= 0) && (t.durationMs === void 0 || !("durationMs" in t) || Number.isInteger(t.durationMs) && (!(Number.isFinite(t.durationMs) || typeof t.durationMs == "bigint") || t.durationMs >= 0)) && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[4].test(t) || !1) && typeof t.action == "string" && (t.action === "left_mouse_down" || t.action === "left_mouse_up") && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[5].test(t.executionId)) && (t.displayFrameId === void 0 || !("displayFrameId" in t) || typeof t.displayFrameId == "string") && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.modifiers === void 0 || !("modifiers" in t) || typeof t.modifiers == "string") && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[6].test(t) || !1) && typeof t.action == "string" && t.action === "scroll" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[7].test(t.executionId)) && (t.displayFrameId === void 0 || !("displayFrameId" in t) || typeof t.displayFrameId == "string") && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.modifiers === void 0 || !("modifiers" in t) || typeof t.modifiers == "string") && (t.scrollDirection === void 0 || !("scrollDirection" in t) || typeof t.scrollDirection == "string" && (t.scrollDirection === "up" || t.scrollDirection === "down" || t.scrollDirection === "left" || t.scrollDirection === "right")) && (t.scrollAmount === void 0 || !("scrollAmount" in t) || Number.isInteger(t.scrollAmount) && (!(Number.isFinite(t.scrollAmount) || typeof t.scrollAmount == "bigint") || t.scrollAmount >= 1)) && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[8].test(t) || !1) && typeof t.action == "string" && t.action === "type" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[9].test(t.executionId)) && (t.text === void 0 || !("text" in t) || typeof t.text == "string") && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[10].test(t) || !1) && typeof t.action == "string" && t.action === "key" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[11].test(t.executionId)) && (t.keys === void 0 || !("keys" in t) || typeof t.keys == "string") && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[12].test(t) || !1) && typeof t.action == "string" && t.action === "hold_key" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[13].test(t.executionId)) && (t.keys === void 0 || !("keys" in t) || typeof t.keys == "string") && (t.durationMs === void 0 || !("durationMs" in t) || Number.isInteger(t.durationMs) && (!(Number.isFinite(t.durationMs) || typeof t.durationMs == "bigint") || t.durationMs >= 0)) && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.refWidth === void 0 || !("refWidth" in t) || Number.isInteger(t.refWidth) && (!(Number.isFinite(t.refWidth) || typeof t.refWidth == "bigint") || t.refWidth >= 1)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[14].test(t) || !1) && typeof t.action == "string" && (t.action === "list_apps" || t.action === "list_windows" || t.action === "get_cursor_position") && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[15].test(t.executionId)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[16].test(t) || !1) && typeof t.action == "string" && t.action === "get_accessibility_tree" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[17].test(t.executionId)) && (t.windowRef === void 0 || !("windowRef" in t) || typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1)) && (t.query === void 0 || !("query" in t) || typeof t.query == "string") && (t.depth === void 0 || !("depth" in t) || Number.isInteger(t.depth) && (!(Number.isFinite(t.depth) || typeof t.depth == "bigint") || t.depth >= 0 && t.depth <= 64)) && (t.maxElements === void 0 || !("maxElements" in t) || Number.isInteger(t.maxElements) && (!(Number.isFinite(t.maxElements) || typeof t.maxElements == "bigint") || t.maxElements >= 1 && t.maxElements <= 2e3)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[18].test(t) || !1) && typeof t.action == "string" && t.action === "get_window_state" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[19].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) && (t.includeScreenshot === void 0 || !("includeScreenshot" in t) || typeof t.includeScreenshot == "boolean") && (t.query === void 0 || !("query" in t) || typeof t.query == "string") && (t.depth === void 0 || !("depth" in t) || Number.isInteger(t.depth) && (!(Number.isFinite(t.depth) || typeof t.depth == "bigint") || t.depth >= 0 && t.depth <= 64)) && (t.maxElements === void 0 || !("maxElements" in t) || Number.isInteger(t.maxElements) && (!(Number.isFinite(t.maxElements) || typeof t.maxElements == "bigint") || t.maxElements >= 1 && t.maxElements <= 2e3)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "app" in t && Object.getOwnPropertyNames(t).every((t, n) => e[20].test(t) || !1) && typeof t.action == "string" && (t.action === "launch_app" || t.action === "kill_app") && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[21].test(t.executionId)) && typeof t.app == "string" && (t.app.length >= 2 || t.app.length >= 1 && CodePointCount(t.app) >= 1) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[22].test(t) || !1) && typeof t.action == "string" && t.action === "bring_to_front" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[23].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && "elementRef" in t && "observationId" in t && "value" in t && Object.getOwnPropertyNames(t).every((t, n) => e[24].test(t) || !1) && typeof t.action == "string" && t.action === "set_value" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[25].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) && typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && typeof t.value == "string" && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && "path" in t && Object.getOwnPropertyNames(t).every((t, n) => e[26].test(t) || !1) && typeof t.action == "string" && t.action === "invoke_menu" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[27].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) && Array.isArray(t.path) && t.path.every((e, t) => typeof e == "string" && (e.length >= 2 || e.length >= 1 && CodePointCount(e) >= 1) && (e.length <= 200 || e.length <= 400 && CodePointCount(e) <= 200)) && t.path.length >= 1 && t.path.length <= 16 && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && "observationId" in t && "x1" in t && "y1" in t && "x2" in t && "y2" in t && Object.getOwnPropertyNames(t).every((t, n) => e[28].test(t) || !1) && typeof t.action == "string" && t.action === "zoom" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[29].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && Number.isFinite(t.x1) && t.x1 >= 0 && Number.isFinite(t.y1) && t.y1 >= 0 && Number.isFinite(t.x2) && t.x2 >= 0 && Number.isFinite(t.y2) && t.y2 >= 0 || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[30].test(t) || !1) && typeof t.action == "string" && t.action === "get_browser_state" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[31].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[32].test(t) || !1) && typeof t.action == "string" && t.action === "get_browser_state" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[33].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && (t.snapshotFormat === void 0 || !("snapshotFormat" in t) || typeof t.snapshotFormat == "string" && (t.snapshotFormat === "dom_refs_v1" || t.snapshotFormat === "semantic_v2")) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.observationId === void 0 || !("observationId" in t) || typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1)) && (t.query === void 0 || !("query" in t) || typeof t.query == "string") && (t.continuation === void 0 || !("continuation" in t) || typeof t.continuation == "string" && (t.continuation.length >= 2 || t.continuation.length >= 1 && CodePointCount(t.continuation) >= 1)) && (t.includeScreenshot === void 0 || !("includeScreenshot" in t) || typeof t.includeScreenshot == "boolean") || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "windowRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[34].test(t) || !1) && typeof t.action == "string" && t.action === "browser_prepare" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[35].test(t.executionId)) && typeof t.windowRef == "string" && (t.windowRef.length >= 2 || t.windowRef.length >= 1 && CodePointCount(t.windowRef) >= 1) && (t.profile === void 0 || !("profile" in t) || typeof t.profile == "string" && (t.profile === "isolated_new" || t.profile === "isolated_named")) && (t.profileName === void 0 || !("profileName" in t) || typeof t.profileName == "string" && (t.profileName.length >= 2 || t.profileName.length >= 1 && CodePointCount(t.profileName) >= 1) && (t.profileName.length <= 64 || t.profileName.length <= 128 && CodePointCount(t.profileName) <= 64) && e[36].test(t.profileName)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "url" in t && Object.getOwnPropertyNames(t).every((t, n) => e[37].test(t) || !1) && typeof t.action == "string" && t.action === "browser_navigate" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[38].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.url == "string" && (t.url.length >= 2 || t.url.length >= 1 && CodePointCount(t.url) >= 1) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "observationId" in t && Object.getOwnPropertyNames(t).every((t, n) => e[39].test(t) || !1) && typeof t.action == "string" && t.action === "browser_click" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[40].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.inputRoute === void 0 || !("inputRoute" in t) || typeof t.inputRoute == "string" && (t.inputRoute === "trusted" || t.inputRoute === "dom_event")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "observationId" in t && "elementRef" in t && "text" in t && Object.getOwnPropertyNames(t).every((t, n) => e[41].test(t) || !1) && typeof t.action == "string" && t.action === "browser_type" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[42].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1) && typeof t.text == "string" && (t.mode === void 0 || !("mode" in t) || typeof t.mode == "string" && (t.mode === "insert_text" || t.mode === "keystrokes")) && (t.replace === void 0 || !("replace" in t) || typeof t.replace == "boolean") || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "dialogAction" in t && Object.getOwnPropertyNames(t).every((t, n) => e[43].test(t) || !1) && typeof t.action == "string" && t.action === "browser_dialog" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[44].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.dialogAction == "string" && t.dialogAction === "inspect" || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "dialogAction" in t && "dialogRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[45].test(t) || !1) && typeof t.action == "string" && t.action === "browser_dialog" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[46].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.dialogAction == "string" && t.dialogAction === "accept" && typeof t.dialogRef == "string" && (t.dialogRef.length >= 2 || t.dialogRef.length >= 1 && CodePointCount(t.dialogRef) >= 1) && (t.promptText === void 0 || !("promptText" in t) || typeof t.promptText == "string") && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "dialogAction" in t && "dialogRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[47].test(t) || !1) && typeof t.action == "string" && t.action === "browser_dialog" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[48].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.dialogAction == "string" && t.dialogAction === "dismiss" && typeof t.dialogRef == "string" && (t.dialogRef.length >= 2 || t.dialogRef.length >= 1 && CodePointCount(t.dialogRef) >= 1) && (t.deliveryMode === void 0 || !("deliveryMode" in t) || typeof t.deliveryMode == "string" && (t.deliveryMode === "background" || t.deliveryMode === "foreground")) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "observationId" in t && "elementRef" in t && "resourceHandles" in t && Object.getOwnPropertyNames(t).every((t, n) => e[49].test(t) || !1) && typeof t.action == "string" && t.action === "browser_set_input_files" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[50].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1) && Array.isArray(t.resourceHandles) && t.resourceHandles.every((t, n) => typeof t == "string" && e[51].test(t)) && t.resourceHandles.length >= 1 && t.resourceHandles.length <= 32 || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "observationId" in t && "elementRef" in t && Object.getOwnPropertyNames(t).every((t, n) => e[52].test(t) || !1) && typeof t.action == "string" && t.action === "browser_download" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[53].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "browserRef" in t && "pageRef" in t && "observationId" in t && "pointerAction" in t && Object.getOwnPropertyNames(t).every((t, n) => e[54].test(t) || !1) && typeof t.action == "string" && t.action === "browser_pointer" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[55].test(t.executionId)) && typeof t.browserRef == "string" && (t.browserRef.length >= 2 || t.browserRef.length >= 1 && CodePointCount(t.browserRef) >= 1) && typeof t.pageRef == "string" && (t.pageRef.length >= 2 || t.pageRef.length >= 1 && CodePointCount(t.pageRef) >= 1) && typeof t.observationId == "string" && (t.observationId.length >= 2 || t.observationId.length >= 1 && CodePointCount(t.observationId) >= 1) && typeof t.pointerAction == "string" && (t.pointerAction === "hover" || t.pointerAction === "right_click" || t.pointerAction === "double_click" || t.pointerAction === "scroll" || t.pointerAction === "drag") && (t.inputRoute === void 0 || !("inputRoute" in t) || typeof t.inputRoute == "string" && (t.inputRoute === "trusted" || t.inputRoute === "dom_event")) && (t.elementRef === void 0 || !("elementRef" in t) || typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1)) && (t.x === void 0 || !("x" in t) || Number.isFinite(t.x) && t.x >= 0) && (t.y === void 0 || !("y" in t) || Number.isFinite(t.y) && t.y >= 0) && (t.destinationElementRef === void 0 || !("destinationElementRef" in t) || typeof t.destinationElementRef == "string" && (t.destinationElementRef.length >= 2 || t.destinationElementRef.length >= 1 && CodePointCount(t.destinationElementRef) >= 1)) && (t.toX === void 0 || !("toX" in t) || Number.isFinite(t.toX) && t.toX >= 0) && (t.toY === void 0 || !("toY" in t) || Number.isFinite(t.toY) && t.toY >= 0) && (t.deltaX === void 0 || !("deltaX" in t) || Number.isFinite(t.deltaX)) && (t.deltaY === void 0 || !("deltaY" in t) || Number.isFinite(t.deltaY)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "reason" in t && Object.getOwnPropertyNames(t).every((t, n) => e[56].test(t) || !1) && typeof t.action == "string" && t.action === "escalate_scope" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[57].test(t.executionId)) && typeof t.reason == "string" && (t.reason === "ax_tree_pixel_mismatch" || t.reason === "background_delivery_failed" || t.reason === "foreground_ineffective" || t.reason === "no_window_target" || t.reason === "other") || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[58].test(t) || !1) && typeof t.action == "string" && (t.action === "get_recording_state" || t.action === "stop_recording") && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[59].test(t.executionId)) || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && Object.getOwnPropertyNames(t).every((t, n) => e[60].test(t) || !1) && typeof t.action == "string" && t.action === "start_recording" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[61].test(t.executionId)) && (t.recordVideo === void 0 || !("recordVideo" in t) || typeof t.recordVideo == "boolean") || typeof t == "object" && t !== null && !Array.isArray(t) && "action" in t && "resourceHandle" in t && Object.getOwnPropertyNames(t).every((t, n) => e[62].test(t) || !1) && typeof t.action == "string" && t.action === "replay_trajectory" && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[63].test(t.executionId)) && typeof t.resourceHandle == "string" && e[64].test(t.resourceHandle) && (t.delayMs === void 0 || !("delayMs" in t) || Number.isInteger(t.delayMs) && (!(Number.isFinite(t.delayMs) || typeof t.delayMs == "bigint") || t.delayMs >= 0 && t.delayMs <= 1e4)) && (t.stopOnError === void 0 || !("stopOnError" in t) || typeof t.stopOnError == "boolean");
return (e) => check_0(e);
})();
var validateComputerActResult = (() => {
let e = [
/(^ok$|^cursorX$|^cursorY$|^effect$|^observation$|^escalation$|^details$)/u,
/(^kind$|^base64$|^format$|^width$|^height$|^observationId$|^elements$)/u,
/(^elementRef$|^role$|^label$|^value$|^bounds$)/u,
/^.*$/u
], check_0 = (t) => typeof t == "object" && t !== null && !Array.isArray(t) && "ok" in t && Object.getOwnPropertyNames(t).every((t, n) => e[0].test(t) || !1) && typeof t.ok == "boolean" && (t.cursorX === void 0 || !("cursorX" in t) || Number.isFinite(t.cursorX)) && (t.cursorY === void 0 || !("cursorY" in t) || Number.isFinite(t.cursorY)) && (t.effect === void 0 || !("effect" in t) || typeof t.effect == "string" && (t.effect === "confirmed" || t.effect === "unverifiable" || t.effect === "suspected_noop")) && (t.observation === void 0 || !("observation" in t) || typeof t.observation == "object" && t.observation !== null && !Array.isArray(t.observation) && "kind" in t.observation && Object.getOwnPropertyNames(t.observation).every((t, n) => e[1].test(t) || !1) && typeof t.observation.kind == "string" && (t.observation.kind === "window" || t.observation.kind === "screen" || t.observation.kind === "browser") && (t.observation.base64 === void 0 || !("base64" in t.observation) || typeof t.observation.base64 == "string") && (t.observation.format === void 0 || !("format" in t.observation) || typeof t.observation.format == "string" && (t.observation.format === "jpeg" || t.observation.format === "png")) && (t.observation.width === void 0 || !("width" in t.observation) || Number.isInteger(t.observation.width) && (!(Number.isFinite(t.observation.width) || typeof t.observation.width == "bigint") || t.observation.width >= 1)) && (t.observation.height === void 0 || !("height" in t.observation) || Number.isInteger(t.observation.height) && (!(Number.isFinite(t.observation.height) || typeof t.observation.height == "bigint") || t.observation.height >= 1)) && (t.observation.observationId === void 0 || !("observationId" in t.observation) || typeof t.observation.observationId == "string" && (t.observation.observationId.length >= 2 || t.observation.observationId.length >= 1 && CodePointCount(t.observation.observationId) >= 1)) && (t.observation.elements === void 0 || !("elements" in t.observation) || Array.isArray(t.observation.elements) && t.observation.elements.every((t, n) => typeof t == "object" && t !== null && !Array.isArray(t) && "elementRef" in t && "role" in t && "bounds" in t && Object.getOwnPropertyNames(t).every((t, n) => e[2].test(t) || !1) && typeof t.elementRef == "string" && (t.elementRef.length >= 2 || t.elementRef.length >= 1 && CodePointCount(t.elementRef) >= 1) && typeof t.role == "string" && (t.role.length >= 2 || t.role.length >= 1 && CodePointCount(t.role) >= 1) && (t.label === void 0 || !("label" in t) || typeof t.label == "string") && (t.value === void 0 || !("value" in t) || typeof t.value == "string") && typeof t.bounds == "object" && t.bounds !== null && !Array.isArray(t.bounds) && "x" in t.bounds && "y" in t.bounds && "width" in t.bounds && "height" in t.bounds && Object.getOwnPropertyNames(t.bounds).length === 4 && Number.isFinite(t.bounds.x) && Number.isFinite(t.bounds.y) && Number.isFinite(t.bounds.width) && t.bounds.width >= 0 && Number.isFinite(t.bounds.height) && t.bounds.height >= 0) && t.observation.elements.length <= 2e3)) && (t.escalation === void 0 || !("escalation" in t) || typeof t.escalation == "object" && t.escalation !== null && !Array.isArray(t.escalation) && "recommended" in t.escalation && "reasonCode" in t.escalation && Object.getOwnPropertyNames(t.escalation).length === 2 && typeof t.escalation.recommended == "string" && (t.escalation.recommended === "window-pixel" || t.escalation.recommended === "foreground" || t.escalation.recommended === "desktop") && typeof t.escalation.reasonCode == "string" && (t.escalation.reasonCode.length >= 2 || t.escalation.reasonCode.length >= 1 && CodePointCount(t.escalation.reasonCode) >= 1)) && (t.details === void 0 || !("details" in t) || typeof t.details == "object" && t.details !== null && !Array.isArray(t.details) && Object.entries(t.details).every(([t, n], r) => !e[3].test(t) || !0) && Object.getOwnPropertyNames(t.details).length <= 64);
return (e) => check_0(e);
})();
var validateComputerUseCapabilityDescriptor = (() => {
let check_0 = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "contractVersion" in e && "provider" in e && "actions" in e && "targets" in e && "deliveryModes" in e && "observations" in e && "features" in e && Object.getOwnPropertyNames(e).length === 7 && Number.isFinite(e.contractVersion) && e.contractVersion === 2 && typeof e.provider == "object" && e.provider !== null && !Array.isArray(e.provider) && "id" in e.provider && "label" in e.provider && "generation" in e.provider && Object.getOwnPropertyNames(e.provider).length === 3 && typeof e.provider.id == "string" && (e.provider.id.length >= 2 || e.provider.id.length >= 1 && CodePointCount(e.provider.id) >= 1) && (e.provider.id.length <= 128 || e.provider.id.length <= 256 && CodePointCount(e.provider.id) <= 128) && typeof e.provider.label == "string" && (e.provider.label.length >= 2 || e.provider.label.length >= 1 && CodePointCount(e.provider.label) >= 1) && (e.provider.label.length <= 256 || e.provider.label.length <= 512 && CodePointCount(e.provider.label) <= 256) && typeof e.provider.generation == "string" && (e.provider.generation.length >= 2 || e.provider.generation.length >= 1 && CodePointCount(e.provider.generation) >= 1) && (e.provider.generation.length <= 256 || e.provider.generation.length <= 512 && CodePointCount(e.provider.generation) <= 256) && Array.isArray(e.actions) && e.actions.every((e, t) => typeof e == "string" && (e === "screenshot" || e === "left_click" || e === "right_click" || e === "middle_click" || e === "double_click" || e === "triple_click" || e === "mouse_move" || e === "left_click_drag" || e === "left_mouse_down" || e === "left_mouse_up" || e === "scroll" || e === "type" || e === "key" || e === "hold_key" || e === "wait" || e === "list_apps" || e === "list_windows" || e === "get_accessibility_tree" || e === "get_cursor_position" || e === "get_window_state" || e === "launch_app" || e === "kill_app" || e === "bring_to_front" || e === "set_value" || e === "zoom" || e === "get_browser_state" || e === "browser_prepare" || e === "browser_navigate" || e === "browser_click" || e === "browser_type" || e === "browser_dialog" || e === "browser_set_input_files" || e === "browser_download" || e === "browser_pointer" || e === "escalate_scope" || e === "get_recording_state" || e === "start_recording" || e === "stop_recording" || e === "replay_trajectory" || e === "invoke_menu")) && e.actions.length <= 40 && new Set(e.actions.map(Hash)).size === e.actions.length && Array.isArray(e.targets) && e.targets.every((e, t) => e === "screen" || e === "window" || e === "element" || e === "browser") && e.targets.length <= 4 && new Set(e.targets.map(Hash)).size === e.targets.length && Array.isArray(e.deliveryModes) && e.deliveryModes.every((e, t) => typeof e == "string" && (e === "background" || e === "foreground")) && e.deliveryModes.length <= 2 && new Set(e.deliveryModes.map(Hash)).size === e.deliveryModes.length && Array.isArray(e.observations) && e.observations.every((e, t) => typeof e == "string" && (e === "image" || e === "accessibility" || e === "browser")) && e.observations.length <= 3 && new Set(e.observations.map(Hash)).size === e.observations.length && typeof e.features == "object" && e.features !== null && !Array.isArray(e.features) && "recording" in e.features && "agentCursor" in e.features && "multiDisplay" in e.features && Object.getOwnPropertyNames(e.features).length === 3 && typeof e.features.recording == "boolean" && typeof e.features.agentCursor == "boolean" && typeof e.features.multiDisplay == "boolean";
return (e) => check_0(e);
})();
var validateScreenSnapshotParams = (() => {
let e = [/(^executionId$|^screenIndex$|^maxWidth$|^quality$|^format$)/u, /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u], check_0 = (t) => typeof t == "object" && t !== null && !Array.isArray(t) && Object.getOwnPropertyNames(t).every((t, n) => e[0].test(t) || !1) && (t.executionId === void 0 || !("executionId" in t) || typeof t.executionId == "string" && e[1].test(t.executionId)) && (t.screenIndex === void 0 || !("screenIndex" in t) || Number.isInteger(t.screenIndex) && (!(Number.isFinite(t.screenIndex) || typeof t.screenIndex == "bigint") || t.screenIndex >= 0)) && (t.maxWidth === void 0 || !("maxWidth" in t) || Number.isInteger(t.maxWidth) && (!(Number.isFinite(t.maxWidth) || typeof t.maxWidth == "bigint") || t.maxWidth >= 1)) && (t.quality === void 0 || !("quality" in t) || Number.isFinite(t.quality)) && (t.format === void 0 || !("format" in t) || typeof t.format == "string" && (t.format === "jpeg" || t.format === "png"));
return (e) => check_0(e);
})();
var validateScreenSnapshotResult = (() => {
let check_0 = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "format" in e && "base64" in e && typeof e.format == "string" && (e.format === "jpeg" || e.format === "png") && typeof e.base64 == "string" && (e.base64.length >= 2 || e.base64.length >= 1 && CodePointCount(e.base64) >= 1) && (e.displayFrameId === void 0 || !("displayFrameId" in e) || typeof e.displayFrameId == "string") && (e.screenIndex === void 0 || !("screenIndex" in e) || Number.isFinite(e.screenIndex)) && (e.width === void 0 || !("width" in e) || Number.isFinite(e.width)) && (e.height === void 0 || !("height" in e) || Number.isFinite(e.height)) && (e.capturedAtMs === void 0 || !("capturedAtMs" in e) || Number.isInteger(e.capturedAtMs) && (!(Number.isFinite(e.capturedAtMs) || typeof e.capturedAtMs == "bigint") || e.capturedAtMs >= 0));
return (e) => check_0(e);
})();
//#endregion
//#region src/plugins/computer-use-contract.ts
function parseParamsJSON(e, t) {
let n;
try {
n = JSON.parse(e ?? "{}");
} catch {
throw new Error("COMPUTER_INVALID_REQUEST: params must be valid JSON");
}
if (!t(n)) throw new Error("COMPUTER_INVALID_REQUEST: invalid params");
return n;
}
function parseComputerActParamsJSON(e) {
return parseParamsJSON(e, validateComputerActParams);
}
function parseScreenSnapshotParamsJSON(e) {
return parseParamsJSON(e, validateScreenSnapshotParams);
}
/** Validate one provider result envelope. */
function parseComputerActResult(e) {
if (!validateComputerActResult(e)) throw new Error(`${COMPUTER_CONTRACT_MISMATCH}: invalid computer.act result`);
return e;
}
/** Validate one bounded Computer Use declaration carried by a node connect. */
function parseComputerUseCapabilityDescriptor(e) {
if (!validateComputerUseCapabilityDescriptor(e)) throw new Error(`${COMPUTER_CONTRACT_MISMATCH}: invalid capability descriptor`);
return e;
}
/** Validate and project a `screen.snapshot` result without retaining unknown fields. */
function parseScreenSnapshotResult(e) {
if (!validateScreenSnapshotResult(e)) throw new Error("invalid screen.snapshot payload");
return {
format: e.format,
base64: e.base64,
...e.displayFrameId ? { displayFrameId: e.displayFrameId } : {},
...e.screenIndex !== void 0 ? { screenIndex: e.screenIndex } : {},
...e.width !== void 0 ? { width: e.width } : {},
...e.height !== void 0 ? { height: e.height } : {},
...e.capturedAtMs !== void 0 ? { capturedAtMs: e.capturedAtMs } : {}
};
}
//#endregion
export { ScreenSnapshotParamsSchema as _, parseScreenSnapshotResult as a, COMPUTER_ESCALATION_REASONS as c, COMPUTER_STALE_OBSERVATION as d, COMPUTER_USE_V1_ACTION_NAMES as f, ComputerUseCapabilityDescriptorSchema as g, ComputerActResultSchema as h, parseScreenSnapshotParamsJSON as i, COMPUTER_EXECUTION_ID_PATTERN as l, ComputerActParamsSchema as m, parseComputerActResult as n, COMPUTER_ACT_V1_ACTION_NAMES as o, COMPUTER_USE_V2_ACTION_NAMES as p, parseComputerUseCapabilityDescriptor as r, COMPUTER_CONTRACT_MISMATCH as s, parseComputerActParamsJSON as t, COMPUTER_SCROLL_DIRECTIONS as u, ScreenSnapshotResultSchema as v };