@memohai/cloud-runtime 0.1.0
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/LICENSE +661 -0
- package/README.md +35 -0
- package/dist/bridge.proto +188 -0
- package/dist/cli.mjs +29978 -0
- package/package.json +37 -0
- package/scripts/build.mjs +191 -0
- package/src/bootstrap.ts +29 -0
- package/src/build-info.ts +40 -0
- package/src/cli.ts +7 -0
- package/src/cloud.ts +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @memohai/cloud-runtime
|
|
2
|
+
|
|
3
|
+
Connects your machine to [Memoh Cloud](https://app.memoh.net) as a remote
|
|
4
|
+
runtime. This is the Cloud distribution of the open-source
|
|
5
|
+
[`@memohai/runtime`](https://github.com/memohai/Memoh/tree/main/packages/runtime)
|
|
6
|
+
CLI: identical behaviour, with the Cloud endpoint preconfigured.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
Paste the command shown in the Memoh Cloud runtimes page, or run:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx --yes @memohai/cloud-runtime --key mrk_... --team-id <uuid>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Flag | |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `--key` | team-scoped runtime key (`mrk_...`), issued by Memoh Cloud |
|
|
19
|
+
| `--team-id` | tenant UUID issued alongside the key |
|
|
20
|
+
| `--server` | endpoint override; defaults to `https://app.memoh.net/api/memoh` |
|
|
21
|
+
| `--insecure-localhost` | allow `ws://` for localhost development only |
|
|
22
|
+
| `--version` | print this build and the upstream runtime bundled into it |
|
|
23
|
+
|
|
24
|
+
Endpoint precedence: `--server` > `MEMOH_RUNTIME_SERVER` > the Cloud default.
|
|
25
|
+
`MEMOH_RUNTIME_KEY` and `MEMOH_RUNTIME_TEAM_ID` are read as flag fallbacks,
|
|
26
|
+
same as upstream.
|
|
27
|
+
|
|
28
|
+
## License and source
|
|
29
|
+
|
|
30
|
+
AGPL-3.0-only. The published artifact bundles the upstream runtime
|
|
31
|
+
implementation from [memohai/Memoh](https://github.com/memohai/Memoh);
|
|
32
|
+
`memoh-cloud-runtime --version` prints the exact upstream commit inside your
|
|
33
|
+
build. The Cloud overlay (`src/`) and the build script (`scripts/`) ship in
|
|
34
|
+
this tarball; building from source requires the Memoh monorepo checked out
|
|
35
|
+
next to it.
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package bridgepb;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/memohai/memoh/internal/workspace/bridgepb";
|
|
6
|
+
|
|
7
|
+
service ContainerService {
|
|
8
|
+
rpc ReadFile(ReadFileRequest) returns (ReadFileResponse);
|
|
9
|
+
rpc WriteFile(WriteFileRequest) returns (WriteFileResponse);
|
|
10
|
+
rpc ListDir(ListDirRequest) returns (ListDirResponse);
|
|
11
|
+
rpc Stat(StatRequest) returns (StatResponse);
|
|
12
|
+
rpc Mkdir(MkdirRequest) returns (MkdirResponse);
|
|
13
|
+
rpc Rename(RenameRequest) returns (RenameResponse);
|
|
14
|
+
rpc Exec(stream ExecInput) returns (stream ExecOutput);
|
|
15
|
+
rpc Tunnel(stream TunnelFrame) returns (stream TunnelFrame);
|
|
16
|
+
rpc ReverseHTTP(stream ReverseHTTPFrame) returns (stream ReverseHTTPFrame);
|
|
17
|
+
rpc ReadRaw(ReadRawRequest) returns (stream DataChunk);
|
|
18
|
+
rpc WriteRaw(stream WriteRawChunk) returns (WriteRawResponse);
|
|
19
|
+
rpc DeleteFile(DeleteFileRequest) returns (DeleteFileResponse);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message ReadFileRequest {
|
|
23
|
+
string path = 1;
|
|
24
|
+
int32 line_offset = 2;
|
|
25
|
+
int32 n_lines = 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message ReadFileResponse {
|
|
29
|
+
string content = 1;
|
|
30
|
+
int32 total_lines = 2;
|
|
31
|
+
bool binary = 3;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message WriteFileRequest {
|
|
35
|
+
string path = 1;
|
|
36
|
+
bytes content = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message WriteFileResponse {}
|
|
40
|
+
|
|
41
|
+
message ListDirRequest {
|
|
42
|
+
string path = 1;
|
|
43
|
+
bool recursive = 2;
|
|
44
|
+
int32 offset = 3;
|
|
45
|
+
int32 limit = 4;
|
|
46
|
+
int32 collapse_threshold = 5;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message FileEntry {
|
|
50
|
+
string path = 1;
|
|
51
|
+
bool is_dir = 2;
|
|
52
|
+
int64 size = 3;
|
|
53
|
+
string mode = 4;
|
|
54
|
+
string mod_time = 5;
|
|
55
|
+
string summary = 6;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message ListDirResponse {
|
|
59
|
+
repeated FileEntry entries = 1;
|
|
60
|
+
int32 total_count = 2;
|
|
61
|
+
bool truncated = 3;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
message ExecInput {
|
|
65
|
+
string command = 1;
|
|
66
|
+
string work_dir = 2;
|
|
67
|
+
repeated string env = 3;
|
|
68
|
+
int32 timeout_seconds = 4;
|
|
69
|
+
bytes stdin_data = 5;
|
|
70
|
+
bool pty = 6;
|
|
71
|
+
TerminalResize resize = 7;
|
|
72
|
+
bool clean_env = 8;
|
|
73
|
+
repeated string unset_env = 9;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
message TerminalResize {
|
|
77
|
+
uint32 cols = 1;
|
|
78
|
+
uint32 rows = 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
message ExecOutput {
|
|
82
|
+
enum Stream {
|
|
83
|
+
STDOUT = 0;
|
|
84
|
+
STDERR = 1;
|
|
85
|
+
EXIT = 2;
|
|
86
|
+
}
|
|
87
|
+
Stream stream = 1;
|
|
88
|
+
bytes data = 2;
|
|
89
|
+
int32 exit_code = 3;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message TunnelOpen {
|
|
93
|
+
string address = 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message TunnelData {
|
|
97
|
+
bytes data = 1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message TunnelClose {
|
|
101
|
+
string error = 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
message TunnelFrame {
|
|
105
|
+
oneof frame {
|
|
106
|
+
TunnelOpen open = 1;
|
|
107
|
+
TunnelData data = 2;
|
|
108
|
+
TunnelClose close = 3;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
message HTTPHeader {
|
|
113
|
+
string name = 1;
|
|
114
|
+
repeated string values = 2;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
message ReverseHTTPRequest {
|
|
118
|
+
string id = 1;
|
|
119
|
+
string method = 2;
|
|
120
|
+
string url = 3;
|
|
121
|
+
repeated HTTPHeader headers = 4;
|
|
122
|
+
bytes body = 5;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
message ReverseHTTPResponse {
|
|
126
|
+
string id = 1;
|
|
127
|
+
int32 status_code = 2;
|
|
128
|
+
repeated HTTPHeader headers = 3;
|
|
129
|
+
bytes body = 4;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
message ReverseHTTPError {
|
|
133
|
+
string id = 1;
|
|
134
|
+
string error = 2;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
message ReverseHTTPFrame {
|
|
138
|
+
oneof frame {
|
|
139
|
+
ReverseHTTPRequest request = 1;
|
|
140
|
+
ReverseHTTPResponse response = 2;
|
|
141
|
+
ReverseHTTPError error = 3;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
message ReadRawRequest {
|
|
146
|
+
string path = 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
message DataChunk {
|
|
150
|
+
bytes data = 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
message WriteRawChunk {
|
|
154
|
+
string path = 1;
|
|
155
|
+
bytes data = 2;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
message WriteRawResponse {
|
|
159
|
+
int64 bytes_written = 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
message DeleteFileRequest {
|
|
163
|
+
string path = 1;
|
|
164
|
+
bool recursive = 2;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
message DeleteFileResponse {}
|
|
168
|
+
|
|
169
|
+
message StatRequest {
|
|
170
|
+
string path = 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
message StatResponse {
|
|
174
|
+
FileEntry entry = 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
message MkdirRequest {
|
|
178
|
+
string path = 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message MkdirResponse {}
|
|
182
|
+
|
|
183
|
+
message RenameRequest {
|
|
184
|
+
string old_path = 1;
|
|
185
|
+
string new_path = 2;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
message RenameResponse {}
|