supercompat 3.17.1 → 3.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +320 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +320 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3519,6 +3519,310 @@ var models9 = function(param) {
|
|
|
3519
3519
|
// src/adapters/client/googleClientAdapter/completions/post.ts
|
|
3520
3520
|
var import_cuid2 = require("@paralleldrive/cuid2");
|
|
3521
3521
|
var import_radash5 = require("radash");
|
|
3522
|
+
// src/adapters/client/googleClientAdapter/normalizeGeminiAction.ts
|
|
3523
|
+
var GEMINI_ACTION_NAMES = /* @__PURE__ */ new Set([
|
|
3524
|
+
"click_at",
|
|
3525
|
+
"single_click_at",
|
|
3526
|
+
"right_click_at",
|
|
3527
|
+
"double_click_at",
|
|
3528
|
+
"triple_click_at",
|
|
3529
|
+
"hover_at",
|
|
3530
|
+
"type_text_at",
|
|
3531
|
+
"key_combination",
|
|
3532
|
+
"scroll_at",
|
|
3533
|
+
"scroll_document",
|
|
3534
|
+
"drag_and_drop",
|
|
3535
|
+
"wait_5_seconds",
|
|
3536
|
+
"wait_for_load",
|
|
3537
|
+
"navigate",
|
|
3538
|
+
"go_back",
|
|
3539
|
+
"go_forward",
|
|
3540
|
+
"open_web_browser"
|
|
3541
|
+
]);
|
|
3542
|
+
var isGeminiAction = function(name) {
|
|
3543
|
+
return GEMINI_ACTION_NAMES.has(name);
|
|
3544
|
+
};
|
|
3545
|
+
var normalizeGeminiKey = function(key) {
|
|
3546
|
+
var lower = key.toLowerCase();
|
|
3547
|
+
switch(lower){
|
|
3548
|
+
case "control":
|
|
3549
|
+
return "ctrl";
|
|
3550
|
+
case "command":
|
|
3551
|
+
case "cmd":
|
|
3552
|
+
return "meta";
|
|
3553
|
+
case "option":
|
|
3554
|
+
return "alt";
|
|
3555
|
+
default:
|
|
3556
|
+
return lower;
|
|
3557
|
+
}
|
|
3558
|
+
};
|
|
3559
|
+
var scrollFromDirection = function(direction, amount) {
|
|
3560
|
+
if (!direction) return {
|
|
3561
|
+
scroll_x: 0,
|
|
3562
|
+
scroll_y: 0
|
|
3563
|
+
};
|
|
3564
|
+
switch(direction.toLowerCase()){
|
|
3565
|
+
case "up":
|
|
3566
|
+
return {
|
|
3567
|
+
scroll_x: 0,
|
|
3568
|
+
scroll_y: -amount
|
|
3569
|
+
};
|
|
3570
|
+
case "down":
|
|
3571
|
+
return {
|
|
3572
|
+
scroll_x: 0,
|
|
3573
|
+
scroll_y: amount
|
|
3574
|
+
};
|
|
3575
|
+
case "left":
|
|
3576
|
+
return {
|
|
3577
|
+
scroll_x: -amount,
|
|
3578
|
+
scroll_y: 0
|
|
3579
|
+
};
|
|
3580
|
+
case "right":
|
|
3581
|
+
return {
|
|
3582
|
+
scroll_x: amount,
|
|
3583
|
+
scroll_y: 0
|
|
3584
|
+
};
|
|
3585
|
+
default:
|
|
3586
|
+
return {
|
|
3587
|
+
scroll_x: 0,
|
|
3588
|
+
scroll_y: 0
|
|
3589
|
+
};
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
var normalizeGeminiAction = function(name, args) {
|
|
3593
|
+
var x = typeof args.x === "number" ? args.x : typeof args.coordinate_x === "number" ? args.coordinate_x : 0;
|
|
3594
|
+
var y = typeof args.y === "number" ? args.y : typeof args.coordinate_y === "number" ? args.coordinate_y : 0;
|
|
3595
|
+
switch(name){
|
|
3596
|
+
case "click_at":
|
|
3597
|
+
case "single_click_at":
|
|
3598
|
+
return {
|
|
3599
|
+
action: {
|
|
3600
|
+
type: "click",
|
|
3601
|
+
button: "left",
|
|
3602
|
+
x: x,
|
|
3603
|
+
y: y
|
|
3604
|
+
},
|
|
3605
|
+
pending_safety_checks: []
|
|
3606
|
+
};
|
|
3607
|
+
case "right_click_at":
|
|
3608
|
+
return {
|
|
3609
|
+
action: {
|
|
3610
|
+
type: "click",
|
|
3611
|
+
button: "right",
|
|
3612
|
+
x: x,
|
|
3613
|
+
y: y
|
|
3614
|
+
},
|
|
3615
|
+
pending_safety_checks: []
|
|
3616
|
+
};
|
|
3617
|
+
case "double_click_at":
|
|
3618
|
+
return {
|
|
3619
|
+
action: {
|
|
3620
|
+
type: "double_click",
|
|
3621
|
+
x: x,
|
|
3622
|
+
y: y
|
|
3623
|
+
},
|
|
3624
|
+
pending_safety_checks: []
|
|
3625
|
+
};
|
|
3626
|
+
case "triple_click_at":
|
|
3627
|
+
return {
|
|
3628
|
+
action: {
|
|
3629
|
+
type: "double_click",
|
|
3630
|
+
x: x,
|
|
3631
|
+
y: y,
|
|
3632
|
+
repetitions: 3
|
|
3633
|
+
},
|
|
3634
|
+
pending_safety_checks: []
|
|
3635
|
+
};
|
|
3636
|
+
case "hover_at":
|
|
3637
|
+
return {
|
|
3638
|
+
action: {
|
|
3639
|
+
type: "move",
|
|
3640
|
+
x: x,
|
|
3641
|
+
y: y
|
|
3642
|
+
},
|
|
3643
|
+
pending_safety_checks: []
|
|
3644
|
+
};
|
|
3645
|
+
case "type_text_at":
|
|
3646
|
+
{
|
|
3647
|
+
var text = typeof args.text === "string" ? args.text : "";
|
|
3648
|
+
var pendingActions = [
|
|
3649
|
+
{
|
|
3650
|
+
type: "type",
|
|
3651
|
+
text: text
|
|
3652
|
+
}
|
|
3653
|
+
];
|
|
3654
|
+
if (args.submit_after_type === true) {
|
|
3655
|
+
pendingActions.push({
|
|
3656
|
+
type: "keypress",
|
|
3657
|
+
keys: [
|
|
3658
|
+
"Return"
|
|
3659
|
+
]
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3662
|
+
return {
|
|
3663
|
+
action: {
|
|
3664
|
+
type: "click",
|
|
3665
|
+
button: "left",
|
|
3666
|
+
x: x,
|
|
3667
|
+
y: y,
|
|
3668
|
+
pending_actions: pendingActions
|
|
3669
|
+
},
|
|
3670
|
+
pending_safety_checks: []
|
|
3671
|
+
};
|
|
3672
|
+
}
|
|
3673
|
+
case "key_combination":
|
|
3674
|
+
{
|
|
3675
|
+
var rawKeys = args.keys;
|
|
3676
|
+
var keys;
|
|
3677
|
+
if (Array.isArray(rawKeys)) {
|
|
3678
|
+
keys = rawKeys.map(String).map(normalizeGeminiKey);
|
|
3679
|
+
} else if (typeof rawKeys === "string") {
|
|
3680
|
+
keys = rawKeys.split(/[+\s]+/).map(function(k) {
|
|
3681
|
+
return k.trim();
|
|
3682
|
+
}).filter(Boolean).map(normalizeGeminiKey);
|
|
3683
|
+
} else {
|
|
3684
|
+
keys = [];
|
|
3685
|
+
}
|
|
3686
|
+
return {
|
|
3687
|
+
action: {
|
|
3688
|
+
type: "keypress",
|
|
3689
|
+
keys: keys
|
|
3690
|
+
},
|
|
3691
|
+
pending_safety_checks: []
|
|
3692
|
+
};
|
|
3693
|
+
}
|
|
3694
|
+
case "scroll_at":
|
|
3695
|
+
{
|
|
3696
|
+
var direction = typeof args.direction === "string" ? args.direction : void 0;
|
|
3697
|
+
var amount = typeof args.amount === "number" ? args.amount : 3;
|
|
3698
|
+
var _scrollFromDirection = scrollFromDirection(direction, amount), scroll_x = _scrollFromDirection.scroll_x, scroll_y = _scrollFromDirection.scroll_y;
|
|
3699
|
+
return {
|
|
3700
|
+
action: {
|
|
3701
|
+
type: "scroll",
|
|
3702
|
+
x: x,
|
|
3703
|
+
y: y,
|
|
3704
|
+
scroll_x: scroll_x,
|
|
3705
|
+
scroll_y: scroll_y
|
|
3706
|
+
},
|
|
3707
|
+
pending_safety_checks: []
|
|
3708
|
+
};
|
|
3709
|
+
}
|
|
3710
|
+
case "scroll_document":
|
|
3711
|
+
{
|
|
3712
|
+
var direction1 = typeof args.direction === "string" ? args.direction : void 0;
|
|
3713
|
+
var amount1 = typeof args.amount === "number" ? args.amount : 3;
|
|
3714
|
+
var _scrollFromDirection1 = scrollFromDirection(direction1, amount1), scroll_x1 = _scrollFromDirection1.scroll_x, scroll_y1 = _scrollFromDirection1.scroll_y;
|
|
3715
|
+
return {
|
|
3716
|
+
action: {
|
|
3717
|
+
type: "scroll",
|
|
3718
|
+
x: 640,
|
|
3719
|
+
y: 360,
|
|
3720
|
+
scroll_x: scroll_x1,
|
|
3721
|
+
scroll_y: scroll_y1
|
|
3722
|
+
},
|
|
3723
|
+
pending_safety_checks: []
|
|
3724
|
+
};
|
|
3725
|
+
}
|
|
3726
|
+
case "drag_and_drop":
|
|
3727
|
+
{
|
|
3728
|
+
var destX = typeof args.destination_x === "number" ? args.destination_x : 0;
|
|
3729
|
+
var destY = typeof args.destination_y === "number" ? args.destination_y : 0;
|
|
3730
|
+
return {
|
|
3731
|
+
action: {
|
|
3732
|
+
type: "drag",
|
|
3733
|
+
path: [
|
|
3734
|
+
{
|
|
3735
|
+
x: x,
|
|
3736
|
+
y: y
|
|
3737
|
+
},
|
|
3738
|
+
{
|
|
3739
|
+
x: destX,
|
|
3740
|
+
y: destY
|
|
3741
|
+
}
|
|
3742
|
+
]
|
|
3743
|
+
},
|
|
3744
|
+
pending_safety_checks: []
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
case "wait_5_seconds":
|
|
3748
|
+
case "wait_for_load":
|
|
3749
|
+
return {
|
|
3750
|
+
action: {
|
|
3751
|
+
type: "wait"
|
|
3752
|
+
},
|
|
3753
|
+
pending_safety_checks: []
|
|
3754
|
+
};
|
|
3755
|
+
case "navigate":
|
|
3756
|
+
{
|
|
3757
|
+
var url = typeof args.url === "string" ? args.url : "";
|
|
3758
|
+
return {
|
|
3759
|
+
action: {
|
|
3760
|
+
type: "keypress",
|
|
3761
|
+
keys: [
|
|
3762
|
+
"ctrl",
|
|
3763
|
+
"l"
|
|
3764
|
+
],
|
|
3765
|
+
pending_actions: [
|
|
3766
|
+
{
|
|
3767
|
+
type: "wait"
|
|
3768
|
+
},
|
|
3769
|
+
{
|
|
3770
|
+
type: "type",
|
|
3771
|
+
text: url
|
|
3772
|
+
},
|
|
3773
|
+
{
|
|
3774
|
+
type: "keypress",
|
|
3775
|
+
keys: [
|
|
3776
|
+
"Return"
|
|
3777
|
+
]
|
|
3778
|
+
},
|
|
3779
|
+
{
|
|
3780
|
+
type: "wait"
|
|
3781
|
+
}
|
|
3782
|
+
]
|
|
3783
|
+
},
|
|
3784
|
+
pending_safety_checks: []
|
|
3785
|
+
};
|
|
3786
|
+
}
|
|
3787
|
+
case "go_back":
|
|
3788
|
+
return {
|
|
3789
|
+
action: {
|
|
3790
|
+
type: "keypress",
|
|
3791
|
+
keys: [
|
|
3792
|
+
"alt",
|
|
3793
|
+
"left"
|
|
3794
|
+
]
|
|
3795
|
+
},
|
|
3796
|
+
pending_safety_checks: []
|
|
3797
|
+
};
|
|
3798
|
+
case "go_forward":
|
|
3799
|
+
return {
|
|
3800
|
+
action: {
|
|
3801
|
+
type: "keypress",
|
|
3802
|
+
keys: [
|
|
3803
|
+
"alt",
|
|
3804
|
+
"right"
|
|
3805
|
+
]
|
|
3806
|
+
},
|
|
3807
|
+
pending_safety_checks: []
|
|
3808
|
+
};
|
|
3809
|
+
case "open_web_browser":
|
|
3810
|
+
return {
|
|
3811
|
+
action: {
|
|
3812
|
+
type: "screenshot"
|
|
3813
|
+
},
|
|
3814
|
+
pending_safety_checks: []
|
|
3815
|
+
};
|
|
3816
|
+
default:
|
|
3817
|
+
return {
|
|
3818
|
+
action: _object_spread({
|
|
3819
|
+
type: name
|
|
3820
|
+
}, args),
|
|
3821
|
+
pending_safety_checks: []
|
|
3822
|
+
};
|
|
3823
|
+
}
|
|
3824
|
+
};
|
|
3825
|
+
// src/adapters/client/googleClientAdapter/completions/post.ts
|
|
3522
3826
|
var stripFunctionPrefix = function(name) {
|
|
3523
3827
|
return name.replace(/^default_api:/, "");
|
|
3524
3828
|
};
|
|
@@ -3653,19 +3957,22 @@ var serializeMessages2 = function(messages5) {
|
|
|
3653
3957
|
var _tc_function1;
|
|
3654
3958
|
args = JSON.parse((_ref1 = (_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) !== null && _ref1 !== void 0 ? _ref1 : "{}");
|
|
3655
3959
|
} catch (unused) {}
|
|
3656
|
-
var geminiName = name;
|
|
3657
|
-
if (name === "computer_call" && args.action && _type_of(args.action) === "object") {
|
|
3658
|
-
var _args_action_type;
|
|
3659
|
-
geminiName = (_args_action_type = args.action.type) !== null && _args_action_type !== void 0 ? _args_action_type : name;
|
|
3660
|
-
}
|
|
3661
3960
|
var thoughtSignature = args._thoughtSignature;
|
|
3961
|
+
var geminiActionName = args._geminiAction;
|
|
3662
3962
|
var cleanArgs = _object_spread({}, args);
|
|
3663
3963
|
delete cleanArgs._thoughtSignature;
|
|
3964
|
+
delete cleanArgs._geminiAction;
|
|
3965
|
+
var geminiName = name;
|
|
3966
|
+
if (name === "computer_call" && args.action && _type_of(args.action) === "object") {
|
|
3967
|
+
var _ref2;
|
|
3968
|
+
geminiName = (_ref2 = geminiActionName !== null && geminiActionName !== void 0 ? geminiActionName : args.action.type) !== null && _ref2 !== void 0 ? _ref2 : name;
|
|
3969
|
+
}
|
|
3664
3970
|
var geminiArgs = void 0;
|
|
3665
3971
|
if (name === "computer_call" && cleanArgs.action && _type_of(cleanArgs.action) === "object") {
|
|
3666
3972
|
var action = cleanArgs.action;
|
|
3667
|
-
var _type = action.type, rest = _object_without_properties(action, [
|
|
3668
|
-
"type"
|
|
3973
|
+
var _type = action.type, _pa = action.pending_actions, rest = _object_without_properties(action, [
|
|
3974
|
+
"type",
|
|
3975
|
+
"pending_actions"
|
|
3669
3976
|
]);
|
|
3670
3977
|
geminiArgs = rest;
|
|
3671
3978
|
} else {
|
|
@@ -3922,6 +4229,8 @@ var denormalizeCoords = function(args, tools) {
|
|
|
3922
4229
|
denormY(result.end_coordinate[1])
|
|
3923
4230
|
];
|
|
3924
4231
|
}
|
|
4232
|
+
if (typeof result.destination_x === "number") result.destination_x = denormX(result.destination_x);
|
|
4233
|
+
if (typeof result.destination_y === "number") result.destination_y = denormY(result.destination_y);
|
|
3925
4234
|
return result;
|
|
3926
4235
|
};
|
|
3927
4236
|
var isComputerUseFunction = function(name, tools) {
|
|
@@ -3936,13 +4245,16 @@ var functionCallToToolCallDelta = function(fc, index, tools, thoughtSignature) {
|
|
|
3936
4245
|
if (isComputerUseFunction(name, tools)) {
|
|
3937
4246
|
var _fc_args1, _fc_id1;
|
|
3938
4247
|
var denormed = denormalizeCoords((_fc_args1 = fc.args) !== null && _fc_args1 !== void 0 ? _fc_args1 : {}, tools);
|
|
3939
|
-
var normalized = normalizeComputerToolCallPayload(_object_spread_props(_object_spread({}, denormed), {
|
|
4248
|
+
var normalized = isGeminiAction(name) ? normalizeGeminiAction(name, denormed) : normalizeComputerToolCallPayload(_object_spread_props(_object_spread({}, denormed), {
|
|
3940
4249
|
type: name
|
|
3941
4250
|
}));
|
|
3942
4251
|
var payload = _object_spread({}, normalized);
|
|
3943
4252
|
if (thoughtSignature) {
|
|
3944
4253
|
payload._thoughtSignature = thoughtSignature;
|
|
3945
4254
|
}
|
|
4255
|
+
if (isGeminiAction(name)) {
|
|
4256
|
+
payload._geminiAction = name;
|
|
4257
|
+
}
|
|
3946
4258
|
return {
|
|
3947
4259
|
index: index,
|
|
3948
4260
|
id: (_fc_id1 = fc.id) !== null && _fc_id1 !== void 0 ? _fc_id1 : "call_".concat((0, import_cuid2.createId)()),
|