remote-exec-grpc 0.2.1__py3-none-any.whl
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.
- remote_exec/__init__.py +10 -0
- remote_exec/claude_skill.md +118 -0
- remote_exec/client.py +242 -0
- remote_exec/client_cli.py +226 -0
- remote_exec/cmdlog.py +159 -0
- remote_exec/config.py +202 -0
- remote_exec/executor.py +287 -0
- remote_exec/policy.py +420 -0
- remote_exec/security.py +178 -0
- remote_exec/server.py +292 -0
- remote_exec/server_cli.py +219 -0
- remote_exec/skill.py +39 -0
- remote_exec/v1/__init__.py +1 -0
- remote_exec/v1/remote_exec_pb2.py +57 -0
- remote_exec/v1/remote_exec_pb2.pyi +108 -0
- remote_exec/v1/remote_exec_pb2_grpc.py +142 -0
- remote_exec_grpc-0.2.1.dist-info/METADATA +539 -0
- remote_exec_grpc-0.2.1.dist-info/RECORD +20 -0
- remote_exec_grpc-0.2.1.dist-info/WHEEL +4 -0
- remote_exec_grpc-0.2.1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
|
|
3
|
+
from google.protobuf import timestamp_pb2 as _timestamp_pb2
|
|
4
|
+
from google.protobuf.internal import containers as _containers
|
|
5
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import message as _message
|
|
8
|
+
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
|
9
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
10
|
+
|
|
11
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
12
|
+
|
|
13
|
+
class ExecuteRequest(_message.Message):
|
|
14
|
+
__slots__ = ("command", "working_directory", "environment", "timeout_seconds")
|
|
15
|
+
class EnvironmentEntry(_message.Message):
|
|
16
|
+
__slots__ = ("key", "value")
|
|
17
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
18
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
19
|
+
key: str
|
|
20
|
+
value: str
|
|
21
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
22
|
+
COMMAND_FIELD_NUMBER: _ClassVar[int]
|
|
23
|
+
WORKING_DIRECTORY_FIELD_NUMBER: _ClassVar[int]
|
|
24
|
+
ENVIRONMENT_FIELD_NUMBER: _ClassVar[int]
|
|
25
|
+
TIMEOUT_SECONDS_FIELD_NUMBER: _ClassVar[int]
|
|
26
|
+
command: str
|
|
27
|
+
working_directory: str
|
|
28
|
+
environment: _containers.ScalarMap[str, str]
|
|
29
|
+
timeout_seconds: float
|
|
30
|
+
def __init__(self, command: _Optional[str] = ..., working_directory: _Optional[str] = ..., environment: _Optional[_Mapping[str, str]] = ..., timeout_seconds: _Optional[float] = ...) -> None: ...
|
|
31
|
+
|
|
32
|
+
class ExecuteEvent(_message.Message):
|
|
33
|
+
__slots__ = ("started", "stdout", "stderr", "finished")
|
|
34
|
+
STARTED_FIELD_NUMBER: _ClassVar[int]
|
|
35
|
+
STDOUT_FIELD_NUMBER: _ClassVar[int]
|
|
36
|
+
STDERR_FIELD_NUMBER: _ClassVar[int]
|
|
37
|
+
FINISHED_FIELD_NUMBER: _ClassVar[int]
|
|
38
|
+
started: Started
|
|
39
|
+
stdout: OutputChunk
|
|
40
|
+
stderr: OutputChunk
|
|
41
|
+
finished: Finished
|
|
42
|
+
def __init__(self, started: _Optional[_Union[Started, _Mapping]] = ..., stdout: _Optional[_Union[OutputChunk, _Mapping]] = ..., stderr: _Optional[_Union[OutputChunk, _Mapping]] = ..., finished: _Optional[_Union[Finished, _Mapping]] = ...) -> None: ...
|
|
43
|
+
|
|
44
|
+
class Started(_message.Message):
|
|
45
|
+
__slots__ = ("execution_id", "pid", "start_time", "hostname")
|
|
46
|
+
EXECUTION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
47
|
+
PID_FIELD_NUMBER: _ClassVar[int]
|
|
48
|
+
START_TIME_FIELD_NUMBER: _ClassVar[int]
|
|
49
|
+
HOSTNAME_FIELD_NUMBER: _ClassVar[int]
|
|
50
|
+
execution_id: str
|
|
51
|
+
pid: int
|
|
52
|
+
start_time: _timestamp_pb2.Timestamp
|
|
53
|
+
hostname: str
|
|
54
|
+
def __init__(self, execution_id: _Optional[str] = ..., pid: _Optional[int] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., hostname: _Optional[str] = ...) -> None: ...
|
|
55
|
+
|
|
56
|
+
class OutputChunk(_message.Message):
|
|
57
|
+
__slots__ = ("data",)
|
|
58
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
|
59
|
+
data: bytes
|
|
60
|
+
def __init__(self, data: _Optional[bytes] = ...) -> None: ...
|
|
61
|
+
|
|
62
|
+
class Finished(_message.Message):
|
|
63
|
+
__slots__ = ("status", "exit_code", "signal", "start_time", "end_time", "message", "execution_id")
|
|
64
|
+
class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
65
|
+
__slots__ = ()
|
|
66
|
+
STATUS_UNSPECIFIED: _ClassVar[Finished.Status]
|
|
67
|
+
EXITED: _ClassVar[Finished.Status]
|
|
68
|
+
TIMEOUT: _ClassVar[Finished.Status]
|
|
69
|
+
ERROR: _ClassVar[Finished.Status]
|
|
70
|
+
STATUS_UNSPECIFIED: Finished.Status
|
|
71
|
+
EXITED: Finished.Status
|
|
72
|
+
TIMEOUT: Finished.Status
|
|
73
|
+
ERROR: Finished.Status
|
|
74
|
+
STATUS_FIELD_NUMBER: _ClassVar[int]
|
|
75
|
+
EXIT_CODE_FIELD_NUMBER: _ClassVar[int]
|
|
76
|
+
SIGNAL_FIELD_NUMBER: _ClassVar[int]
|
|
77
|
+
START_TIME_FIELD_NUMBER: _ClassVar[int]
|
|
78
|
+
END_TIME_FIELD_NUMBER: _ClassVar[int]
|
|
79
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
80
|
+
EXECUTION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
81
|
+
status: Finished.Status
|
|
82
|
+
exit_code: int
|
|
83
|
+
signal: int
|
|
84
|
+
start_time: _timestamp_pb2.Timestamp
|
|
85
|
+
end_time: _timestamp_pb2.Timestamp
|
|
86
|
+
message: str
|
|
87
|
+
execution_id: str
|
|
88
|
+
def __init__(self, status: _Optional[_Union[Finished.Status, str]] = ..., exit_code: _Optional[int] = ..., signal: _Optional[int] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., end_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., message: _Optional[str] = ..., execution_id: _Optional[str] = ...) -> None: ...
|
|
89
|
+
|
|
90
|
+
class GetServerInfoRequest(_message.Message):
|
|
91
|
+
__slots__ = ()
|
|
92
|
+
def __init__(self) -> None: ...
|
|
93
|
+
|
|
94
|
+
class ServerInfo(_message.Message):
|
|
95
|
+
__slots__ = ("hostname", "version", "user", "shell", "allowed_tools", "denied_tools")
|
|
96
|
+
HOSTNAME_FIELD_NUMBER: _ClassVar[int]
|
|
97
|
+
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
98
|
+
USER_FIELD_NUMBER: _ClassVar[int]
|
|
99
|
+
SHELL_FIELD_NUMBER: _ClassVar[int]
|
|
100
|
+
ALLOWED_TOOLS_FIELD_NUMBER: _ClassVar[int]
|
|
101
|
+
DENIED_TOOLS_FIELD_NUMBER: _ClassVar[int]
|
|
102
|
+
hostname: str
|
|
103
|
+
version: str
|
|
104
|
+
user: str
|
|
105
|
+
shell: str
|
|
106
|
+
allowed_tools: _containers.RepeatedScalarFieldContainer[str]
|
|
107
|
+
denied_tools: _containers.RepeatedScalarFieldContainer[str]
|
|
108
|
+
def __init__(self, hostname: _Optional[str] = ..., version: _Optional[str] = ..., user: _Optional[str] = ..., shell: _Optional[str] = ..., allowed_tools: _Optional[_Iterable[str]] = ..., denied_tools: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from remote_exec.v1 import remote_exec_pb2 as remote__exec_dot_v1_dot_remote__exec__pb2
|
|
7
|
+
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.84.0'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
_version_not_supported = False
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from grpc._utilities import first_version_is_lower
|
|
14
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
15
|
+
except ImportError:
|
|
16
|
+
_version_not_supported = True
|
|
17
|
+
|
|
18
|
+
if _version_not_supported:
|
|
19
|
+
raise RuntimeError(
|
|
20
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
+
+ ' but the generated code in remote_exec/v1/remote_exec_pb2_grpc.py depends on'
|
|
22
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
23
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
24
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RemoteExecutorStub:
|
|
29
|
+
"""Missing associated documentation comment in .proto file."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, channel):
|
|
32
|
+
"""Constructor.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
channel: A grpc.Channel.
|
|
36
|
+
"""
|
|
37
|
+
self.Execute = channel.unary_stream(
|
|
38
|
+
'/remote_exec.v1.RemoteExecutor/Execute',
|
|
39
|
+
request_serializer=remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteRequest.SerializeToString,
|
|
40
|
+
response_deserializer=remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteEvent.FromString,
|
|
41
|
+
_registered_method=True)
|
|
42
|
+
self.GetServerInfo = channel.unary_unary(
|
|
43
|
+
'/remote_exec.v1.RemoteExecutor/GetServerInfo',
|
|
44
|
+
request_serializer=remote__exec_dot_v1_dot_remote__exec__pb2.GetServerInfoRequest.SerializeToString,
|
|
45
|
+
response_deserializer=remote__exec_dot_v1_dot_remote__exec__pb2.ServerInfo.FromString,
|
|
46
|
+
_registered_method=True)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class RemoteExecutorServicer:
|
|
50
|
+
"""Missing associated documentation comment in .proto file."""
|
|
51
|
+
|
|
52
|
+
def Execute(self, request, context):
|
|
53
|
+
"""Run a command and stream its output until it finishes.
|
|
54
|
+
"""
|
|
55
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
56
|
+
context.set_details('Method not implemented!')
|
|
57
|
+
raise NotImplementedError('Method not implemented!')
|
|
58
|
+
|
|
59
|
+
def GetServerInfo(self, request, context):
|
|
60
|
+
"""Lightweight health / identity check.
|
|
61
|
+
"""
|
|
62
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
63
|
+
context.set_details('Method not implemented!')
|
|
64
|
+
raise NotImplementedError('Method not implemented!')
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def add_RemoteExecutorServicer_to_server(servicer, server):
|
|
68
|
+
rpc_method_handlers = {
|
|
69
|
+
'Execute': grpc.unary_stream_rpc_method_handler(
|
|
70
|
+
servicer.Execute,
|
|
71
|
+
request_deserializer=remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteRequest.FromString,
|
|
72
|
+
response_serializer=remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteEvent.SerializeToString,
|
|
73
|
+
),
|
|
74
|
+
'GetServerInfo': grpc.unary_unary_rpc_method_handler(
|
|
75
|
+
servicer.GetServerInfo,
|
|
76
|
+
request_deserializer=remote__exec_dot_v1_dot_remote__exec__pb2.GetServerInfoRequest.FromString,
|
|
77
|
+
response_serializer=remote__exec_dot_v1_dot_remote__exec__pb2.ServerInfo.SerializeToString,
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
81
|
+
'remote_exec.v1.RemoteExecutor', rpc_method_handlers)
|
|
82
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
83
|
+
server.add_registered_method_handlers('remote_exec.v1.RemoteExecutor', rpc_method_handlers)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# This class is part of an EXPERIMENTAL API.
|
|
87
|
+
class RemoteExecutor:
|
|
88
|
+
"""Missing associated documentation comment in .proto file."""
|
|
89
|
+
|
|
90
|
+
@staticmethod
|
|
91
|
+
def Execute(request,
|
|
92
|
+
target,
|
|
93
|
+
options=(),
|
|
94
|
+
channel_credentials=None,
|
|
95
|
+
call_credentials=None,
|
|
96
|
+
insecure=False,
|
|
97
|
+
compression=None,
|
|
98
|
+
wait_for_ready=None,
|
|
99
|
+
timeout=None,
|
|
100
|
+
metadata=None):
|
|
101
|
+
return grpc.experimental.unary_stream(
|
|
102
|
+
request,
|
|
103
|
+
target,
|
|
104
|
+
'/remote_exec.v1.RemoteExecutor/Execute',
|
|
105
|
+
remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteRequest.SerializeToString,
|
|
106
|
+
remote__exec_dot_v1_dot_remote__exec__pb2.ExecuteEvent.FromString,
|
|
107
|
+
options,
|
|
108
|
+
channel_credentials,
|
|
109
|
+
insecure,
|
|
110
|
+
call_credentials,
|
|
111
|
+
compression,
|
|
112
|
+
wait_for_ready,
|
|
113
|
+
timeout,
|
|
114
|
+
metadata,
|
|
115
|
+
_registered_method=True)
|
|
116
|
+
|
|
117
|
+
@staticmethod
|
|
118
|
+
def GetServerInfo(request,
|
|
119
|
+
target,
|
|
120
|
+
options=(),
|
|
121
|
+
channel_credentials=None,
|
|
122
|
+
call_credentials=None,
|
|
123
|
+
insecure=False,
|
|
124
|
+
compression=None,
|
|
125
|
+
wait_for_ready=None,
|
|
126
|
+
timeout=None,
|
|
127
|
+
metadata=None):
|
|
128
|
+
return grpc.experimental.unary_unary(
|
|
129
|
+
request,
|
|
130
|
+
target,
|
|
131
|
+
'/remote_exec.v1.RemoteExecutor/GetServerInfo',
|
|
132
|
+
remote__exec_dot_v1_dot_remote__exec__pb2.GetServerInfoRequest.SerializeToString,
|
|
133
|
+
remote__exec_dot_v1_dot_remote__exec__pb2.ServerInfo.FromString,
|
|
134
|
+
options,
|
|
135
|
+
channel_credentials,
|
|
136
|
+
insecure,
|
|
137
|
+
call_credentials,
|
|
138
|
+
compression,
|
|
139
|
+
wait_for_ready,
|
|
140
|
+
timeout,
|
|
141
|
+
metadata,
|
|
142
|
+
_registered_method=True)
|