* super sketchy big merge with main * gitignore * gitignore * Delete cli/bin/air * Delete cli/bin directory * Delete cli/cline-host * Fix missing package.json in cli Copy the package JSON into the dist-standalone dir during compilation. Remove workaround for missing package.json * Update scripts/build-cli.sh Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Remove reference to watchservice, it has been removed * Update scripts/build-go-proto.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix timestamp to string conversion * diff.go ellipsis fix * COMMON_TYPES --------- Co-authored-by: Sarah Fortune <sarah.fortune@gmail.com> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
99 lines
2.5 KiB
Go
99 lines
2.5 KiB
Go
package hostbridge
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"github.com/cline/grpc-go/cline"
|
|
"github.com/cline/grpc-go/host"
|
|
)
|
|
|
|
// Global shutdown channel - simple approach
|
|
var globalShutdownCh chan struct{}
|
|
|
|
func init() {
|
|
globalShutdownCh = make(chan struct{})
|
|
}
|
|
|
|
// EnvService implements the host.EnvServiceServer interface
|
|
type EnvService struct {
|
|
host.UnimplementedEnvServiceServer
|
|
verbose bool
|
|
}
|
|
|
|
// NewEnvService creates a new EnvService
|
|
func NewEnvService(verbose bool) *EnvService {
|
|
return &EnvService{
|
|
verbose: verbose,
|
|
}
|
|
}
|
|
|
|
// ClipboardWriteText writes text to the system clipboard
|
|
func (s *EnvService) ClipboardWriteText(ctx context.Context, req *cline.StringRequest) (*cline.Empty, error) {
|
|
if s.verbose {
|
|
log.Printf("ClipboardWriteText called with: %s", req.GetValue())
|
|
}
|
|
|
|
// TODO: Implement actual clipboard functionality
|
|
// For now, just return success
|
|
return &cline.Empty{}, nil
|
|
}
|
|
|
|
// ClipboardReadText reads text from the system clipboard
|
|
func (s *EnvService) ClipboardReadText(ctx context.Context, req *cline.EmptyRequest) (*cline.String, error) {
|
|
if s.verbose {
|
|
log.Printf("ClipboardReadText called")
|
|
}
|
|
|
|
// TODO: Implement actual clipboard functionality
|
|
// For now, return empty string
|
|
return &cline.String{
|
|
Value: "",
|
|
}, nil
|
|
}
|
|
|
|
// GetMachineId returns a stable machine identifier for telemetry distinctId purposes
|
|
func (s *EnvService) GetMachineId(ctx context.Context, req *cline.EmptyRequest) (*cline.String, error) {
|
|
if s.verbose {
|
|
log.Printf("GetMachineId called")
|
|
}
|
|
|
|
// TODO: Implement actual machine ID functionality
|
|
// For now, return empty string
|
|
return &cline.String{
|
|
Value: "",
|
|
}, nil
|
|
}
|
|
|
|
// GetHostVersion returns the host platform name and version
|
|
func (s *EnvService) GetHostVersion(ctx context.Context, req *cline.EmptyRequest) (*host.GetHostVersionResponse, error) {
|
|
if s.verbose {
|
|
log.Printf("GetHostVersion called")
|
|
}
|
|
|
|
// TODO: Implement actual host version functionality
|
|
// For now, return empty response
|
|
return &host.GetHostVersionResponse{}, nil
|
|
}
|
|
|
|
// Shutdown initiates a graceful shutdown of the host bridge service
|
|
func (s *EnvService) Shutdown(ctx context.Context, req *cline.EmptyRequest) (*cline.Empty, error) {
|
|
if s.verbose {
|
|
log.Printf("Shutdown requested via RPC")
|
|
}
|
|
|
|
// Trigger global shutdown signal
|
|
select {
|
|
case globalShutdownCh <- struct{}{}:
|
|
if s.verbose {
|
|
log.Printf("Shutdown signal sent successfully")
|
|
}
|
|
default:
|
|
if s.verbose {
|
|
log.Printf("Shutdown signal already pending")
|
|
}
|
|
}
|
|
|
|
return &cline.Empty{}, nil
|
|
}
|