@gacua/backend
Version:
GACUA Backend
54 lines • 1.8 kB
JavaScript
/**
* @license
* Copyright 2025 MuleRun
* SPDX-License-Identifier: Apache-2.0
*/
import { BaseGroundableTool, } from './groundable-tool.js';
export class ComputerKey extends BaseGroundableTool {
functionDeclaration = {
name: 'computer_key',
parametersJsonSchema: {
properties: {
keys: {
description: 'List of keys to press or hold.',
type: 'array',
items: {
description: 'Key name does not contain spaces.',
type: 'string',
},
},
hold_duration: {
description: 'The duration to hold the keys in seconds. Optional if only pressing keys.',
type: 'number',
minimum: 0,
},
},
required: ['keys'],
type: 'object',
},
};
async ground(args, _screenshot, _croppedScreenshotParts, _detectElement) {
async function getDescription(_saveImage) {
let description = '';
if (args.hold_duration && args.hold_duration > 0) {
description = `Hold ${args.keys.join(' + ')} for ${args.hold_duration} seconds`;
}
else {
description = `Press ${args.keys.join(' + ')}`;
}
return [{ text: description }];
}
function value() {
return {
name: '.computer',
args: {
action: 'key',
keys: args.keys,
hold_duration: args.hold_duration,
},
};
}
return { getDescription, value };
}
}
//# sourceMappingURL=key.js.map