Files
zeekay ea80dc3638 feat: Add new Dockerfiles and improve containerization
- Add main Dockerfile for production builds
- Add Dockerfile.runtime for secure code execution
- Add Dockerfile.runtime.fixed with improved configuration
- Include .dockerignore for build optimization
- Add integration documentation and publishing guides
- Update API and CLI components for better runtime support
- Enhance sandbox and container management features
2025-08-16 23:03:39 -05:00

56 lines
1.2 KiB
Go

// Copyright 2025 Hanzo Industries Inc.
// SPDX-License-Identifier: AGPL-3.0
package computeruse
import (
"fmt"
"strings"
"github.com/hanzoai/daemon/pkg/toolbox/computeruse"
"github.com/go-vgo/robotgo"
)
func (u *ComputerUse) TypeText(req *computeruse.TypeTextRequest) (*computeruse.Empty, error) {
if req.Delay > 0 {
robotgo.TypeStr(req.Text, req.Delay)
} else {
robotgo.TypeStr(req.Text)
}
return new(computeruse.Empty), nil
}
func (u *ComputerUse) PressKey(req *computeruse.PressKeyRequest) (*computeruse.Empty, error) {
if len(req.Modifiers) > 0 {
err := robotgo.KeyTap(req.Key, req.Modifiers)
if err != nil {
return nil, err
}
} else {
err := robotgo.KeyTap(req.Key)
if err != nil {
return nil, err
}
}
return new(computeruse.Empty), nil
}
func (u *ComputerUse) PressHotkey(req *computeruse.PressHotkeyRequest) (*computeruse.Empty, error) {
keys := strings.Split(req.Keys, "+")
if len(keys) < 2 {
return nil, fmt.Errorf("invalid hotkey format")
}
mainKey := keys[len(keys)-1]
modifiers := keys[:len(keys)-1]
err := robotgo.KeyTap(mainKey, modifiers)
if err != nil {
return nil, err
}
return new(computeruse.Empty), nil
}