-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathlocal.proto
391 lines (314 loc) · 8.57 KB
/
local.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
syntax = "proto3";
package local;
import "fig_common.proto";
message LocalMessage {
oneof type {
Command command = 2; // expect a response from the host app
Hook hook = 3; // one way update only, no response expected
}
}
message Command {
reserved 110;
optional int64 id = 1;
optional bool no_response = 2; // opt-out of response from host app
oneof command {
TerminalIntegrationCommand terminal_integration = 100;
ListTerminalIntegrationsCommand list_terminal_integrations = 101;
LogoutCommand logout = 102;
RestartCommand restart = 103;
QuitCommand quit = 104;
UpdateCommand update = 105;
DiagnosticsCommand diagnostics = 106;
ReportWindowCommand report_window = 107;
RestartSettingsListenerCommand restart_settings_listener = 108;
RunInstallScriptCommand run_install_script = 109;
OpenUiElementCommand open_ui_element = 111;
ResetCacheCommand reset_cache = 112;
DebugModeCommand debug_mode = 113;
PromptAccessibilityCommand prompt_accessibility = 114;
InputMethodCommand input_method = 115;
OpenBrowserCommand open_browser = 117;
// A request to set the desktops's log level
LogLevelCommand log_level = 118;
DumpStateCommand dump_state = 119;
DevtoolsCommand devtools = 120;
LoginCommand login = 121;
ConnectToIBusCommand connect_to_ibus = 122;
BundleMetadataCommand bundle_metadata = 123;
}
reserved 116;
}
message Hook {
oneof hook {
EditBufferHook edit_buffer = 100;
InitHook init = 101;
PromptHook prompt = 102;
PreExecHook pre_exec = 103;
PostExecHook post_exec = 104;
KeyboardFocusChangedHook keyboard_focus_changed = 105;
TmuxPaneChangedHook tmux_pane_changed = 106;
OpenedSSHConnectionHook opened_ssh_connection = 107;
CallbackHook callback = 108;
IntegrationReadyHook integration_ready = 109;
HideHook hide = 110;
EventHook event = 111;
FileChangedHook file_changed = 112;
CaretPositionHook caret_position = 113;
FocusChangeHook focus_change = 114;
InterceptedKeyHook intercepted_key = 115;
FocusedWindowDataHook focused_window_data = 116;
ClearAutocompleteCacheHook clear_autocomplete_cache = 117;
}
}
// == Commands ==
enum IntegrationAction {
INTEGRATION_ACTION_INSTALL = 0;
INTEGRATION_ACTION_VERIFY_INSTALL = 1;
INTEGRATION_ACTION_UNINSTALL = 2;
}
message TerminalIntegrationCommand {
string identifier = 1;
IntegrationAction action = 2;
}
message ListTerminalIntegrationsCommand {}
message LoginCommand {}
message LogoutCommand {}
message RestartCommand {}
message QuitCommand {}
message UninstallCommand {}
message UpdateCommand {
bool force = 1;
}
message DiagnosticsCommand {}
message ReportWindowCommand {
string report = 1;
string path = 2;
string fig_env_var = 3;
string terminal = 4;
}
message RestartSettingsListenerCommand {}
message RunInstallScriptCommand {}
enum UiElement {
UI_ELEMENT_MENU_BAR = 0;
UI_ELEMENT_SETTINGS = 1;
UI_ELEMENT_MISSION_CONTROL = 2;
UI_ELEMENT_INPUT_METHOD_PROMPT = 3;
}
message OpenUiElementCommand {
UiElement element = 1;
optional string route = 2;
}
message ResetCacheCommand {}
message DebugModeCommand {
optional bool set_debug_mode = 1; // Set debug mode to true or false
optional bool toggle_debug_mode = 2; // Toggle debug mode
}
// Note: enum values must be unique
enum InputMethodAction {
INPUT_METHOD_ACTION_INSTALL = 0;
INPUT_METHOD_ACTION_UNINSTALL = 1;
INPUT_METHOD_ACTION_ENABLE = 2;
INPUT_METHOD_ACTION_DISABLE = 3;
INPUT_METHOD_ACTION_SELECT = 4;
INPUT_METHOD_ACTION_DESELECT = 5;
INPUT_METHOD_ACTION_REGISTER = 6;
INPUT_METHOD_ACTION_STATUS_OF = 7;
}
message InputMethodCommand {
optional InputMethodAction actions = 1;
}
message PromptAccessibilityCommand {}
message OpenBrowserCommand {
string url = 1;
}
message LogLevelCommand {
string level = 1;
}
message DumpStateCommand {
enum Type {
TYPE_DUMP_STATE_FIGTERM = 0;
TYPE_DUMP_STATE_WEB_NOTIFICATIONS = 1;
TYPE_DUMP_STATE_PLATFORM = 2;
}
Type type = 1;
}
message DevtoolsCommand {
enum Window {
WINDOW_DEVTOOLS_AUTOCOMPLETE = 0;
WINDOW_DEVTOOLS_DASHBOARD = 1;
}
Window window = 1;
}
message ConnectToIBusCommand {}
message BundleMetadataCommand {}
// == Hooks ==
message TerminalCursorCoordinates {
int32 x = 1;
int32 y = 2;
int32 xpixel = 3;
int32 ypixel = 4;
}
message EditBufferHook {
fig_common.ShellContext context = 1;
string text = 2;
int64 cursor = 3;
int64 histno = 4;
optional TerminalCursorCoordinates terminal_cursor_coordinates = 5;
}
message InitHook {
fig_common.ShellContext context = 1;
bool called_direct = 2;
string bundle = 3;
map<string, string> env = 100;
}
message PromptHook {
fig_common.ShellContext context = 1;
}
message PreExecHook {
fig_common.ShellContext context = 1;
optional string command = 2; // the full command that was run in the shell
}
message PostExecHook {
fig_common.ShellContext context = 1;
optional string command = 2; // the full command that was run in the shell
optional int32 exit_code = 3; // the exit code of the command
}
message KeyboardFocusChangedHook {
string app_identifier = 1;
string focused_session_id = 2; // a unique identifier associated with the pane
// or tab that is currently focused
}
message TmuxPaneChangedHook {
int32 pane_identifier = 1;
}
message OpenedSSHConnectionHook {
fig_common.ShellContext context = 1;
string control_path = 2;
string remote_hostname = 3;
}
message CallbackHook {
string handler_id = 1;
string filepath = 2;
string exit_code = 3;
}
message IntegrationReadyHook {
string identifier = 1;
}
message HideHook {}
message EventHook {
string event_name = 1;
optional string payload = 2;
repeated string apps = 3;
}
message FileChangedHook {
enum FileChanged {
FILE_CHANGED_SETTINGS = 0;
FILE_CHANGED_STATE = 1;
}
FileChanged file_changed = 1;
optional string filepath = 2;
}
message CaretPositionHook {
enum Origin {
ORIGIN_TOP_LEFT = 0;
ORIGIN_BOTTOM_LEFT = 1;
}
// TODO(grant): support physical size
double x = 1;
double y = 2;
double width = 3;
double height = 4;
optional Origin origin = 5;
}
message FocusChangeHook {}
message InterceptedKeyHook {
fig_common.ShellContext context = 1;
string key = 2;
string action = 3;
}
message BoundingBox {
int32 x = 1;
int32 y = 2;
int32 width = 3;
int32 height = 4;
}
message FocusedWindowDataHook {
string source = 1;
string id = 2;
BoundingBox inner = 3;
BoundingBox outer = 4;
optional bool hide = 5;
float scale = 6;
}
message ClearAutocompleteCacheHook {
repeated string clis = 1;
}
// == Responses ==
message ErrorResponse {
optional int32 exit_code = 1;
optional string message = 2;
}
message SuccessResponse {
optional string message = 1;
}
message TerminalIntegration {
string bundle_identifier = 1;
string name = 2;
optional string status = 3;
}
message TerminalIntegrationsListResponse {
repeated TerminalIntegration integrations = 1;
}
message DiagnosticsResponse {
string distribution = 1;
bool beta = 2;
bool debug_autocomplete = 3;
bool developer_mode_enabled = 4;
string current_layout_name = 5;
bool is_running_on_read_only_volume = 6;
string path_to_bundle = 7;
string accessibility = 8;
string keypath = 9;
string docker = 10;
string symlinked = 11;
string onlytab = 12;
string installscript = 13;
string pseudoterminal_path = 14;
string securekeyboard = 15;
string securekeyboard_path = 16;
string current_process = 17;
string current_window_identifier = 18;
bool autocomplete = 19;
bool unix_socket_server_exists = 20;
string current_session = 21;
optional bool autocomplete_active = 22;
// The best guess attempt at most recent terminal session data
optional string edit_buffer_string = 23;
optional int64 edit_buffer_cursor = 24;
optional fig_common.ShellContext shell_context = 25;
optional bool intercept_enabled = 26;
optional bool intercept_global_enabled = 27;
}
message LogLevelResponse {
optional string old_level = 1;
}
message DumpStateResponse {
string json = 1;
}
message BundleMetadataResponse {
optional string json = 1;
}
message CommandResponse {
optional int64 id = 1;
oneof response {
ErrorResponse error = 2;
SuccessResponse success = 3;
// ... add structured responses for specific commands, as necessary
TerminalIntegrationsListResponse integration_list = 100;
DiagnosticsResponse diagnostics = 101;
// A response to a log level command
LogLevelResponse log_level = 102;
DumpStateResponse dump_state = 103;
BundleMetadataResponse bundle_metadata = 104;
}
}