Skip to content

Commit b0a87f5

Browse files
committed
build(mobile): bump vendored GhosttyKit
- Update GhosttyKit binaries and headers - Document the new Ghostty revision and build toolchain
1 parent b21d872 commit b0a87f5

31 files changed

Lines changed: 206 additions & 4130 deletions

File tree

‎apps/mobile/modules/t3-terminal/README.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The JavaScript contract is intentionally small:
88
- resize from the native surface is emitted as `{ cols: number, rows: number }`
99
- remote PTY output is delivered by the existing `WsRpcClient.terminal` RPC stream
1010

11-
The iOS implementation uses the vendored `GhosttyKit.xcframework` built from the Ghostty custom-I/O
12-
fork, with T3's iOS 16 compatibility patch applied. `T3TerminalView` owns a `libghostty` surface and
13-
uses that callback I/O model:
11+
The iOS implementation uses the vendored `GhosttyKit.xcframework` built from VVTerm's Ghostty
12+
custom-I/O and live-padding branch. `T3TerminalView` owns a `libghostty` surface and uses that
13+
callback I/O model:
1414

1515
1. initialize libghostty once for the process
1616
2. create one Ghostty app and surface per native view
@@ -26,14 +26,17 @@ Vendored Ghostty revision and license details are in `THIRD_PARTY_NOTICES.md`.
2626

2727
## Rebuilding GhosttyKit
2828

29-
The checked-in `GhosttyKit.xcframework` is built from the Ghostty custom-I/O fork (https://github.com/Yash-Singh1/ghostty/tree/custom-io).
30-
Set the directory to the cloned repository checked out on the `custom-io` branch to `GHOSTTY_SOURCE_DIR`.
29+
The checked-in `GhosttyKit.xcframework` is built from Yash Singh's Ghostty fork at revision
30+
`cf8edc23f3a6a87a96e41a90013e89e987d34980`. Set `GHOSTTY_SOURCE_DIR` to a clone of
31+
https://github.com/Yash-Singh1/ghostty checked out at that revision (the
32+
`t3code/custom-io-ordered-feed` branch when vendored, based on VVTerm's
33+
`vvterm/custom-io-padding` branch).
3134

3235
```bash
3336
apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh
3437
```
3538

36-
The script builds Ghostty with Zig 0.15.2, strips the iOS archives, and replaces only the
39+
The script builds Ghostty with Zig 0.16.0, strips the iOS archives, and replaces only the
3740
`ios-arm64` and `ios-arm64-simulator` slices. Xcode's Metal toolchain must be installed; if `metal`
3841
fails, run `xcodebuild -downloadComponent MetalToolchain`.
3942

‎apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Ghostty / libghostty
44

5-
The iOS terminal renderer vendors `GhosttyKit.xcframework`, a libghostty build produced from T3's
6-
iOS 16 support fork. That fork was created from VVTerm's custom-I/O Ghostty fork.
5+
The iOS terminal renderer vendors `GhosttyKit.xcframework`, a libghostty build produced from
6+
VVTerm's custom-I/O and live-padding Ghostty branch.
77

88
- Upstream project: https://github.com/ghostty-org/ghostty
9-
- Custom-I/O base fork: https://github.com/wiedymi/ghostty/tree/custom-io
10-
- Vendored source fork: https://github.com/Yash-Singh1/ghostty/tree/custom-io
11-
- Vendored revision: `d36c3b8dffd0d756dd5e5f4933962f774a0e6753`
9+
- Vendored source branch: https://github.com/Yash-Singh1/ghostty/tree/t3code/custom-io-ordered-feed
10+
- Vendored revision: `cf8edc23f3a6a87a96e41a90013e89e987d34980`
11+
- Based on: https://github.com/wiedymi/ghostty/tree/vvterm/custom-io-padding
1212
- Reference integration: https://github.com/vivy-company/vvterm
1313
- License: MIT
1414

‎apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty.h‎

Lines changed: 92 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
// Ghostty embedding API. The documentation for the embedding API is
2-
// only within the Zig source files that define the implementations. This
3-
// isn't meant to be a general purpose embedding API (yet) so there hasn't
4-
// been documentation or example work beyond that.
1+
// Ghostty's internal embedder API, a.k.a. "libghostty-internal".
52
//
6-
// The only consumer of this API is the macOS app, but the API is built to
7-
// be more general purpose.
3+
// The only consumer of this API is the macOS app, and while it is fairly
4+
// comprehensive, it is tailored to the needs of the macOS app and not designed
5+
// for external use, hence why most functions are undocumented and some are
6+
// macOS-specific (e.g. ones dealing with the Metal graphics API).
7+
//
8+
// External embedders should instead use `libghostty-vt` or other related
9+
// packages, which are extensively documented and designed from the ground up
10+
// to be used in other software. Header files for which can be found in
11+
// `include/ghostty/`.
812
#ifndef GHOSTTY_H
913
#define GHOSTTY_H
1014

@@ -68,27 +72,64 @@ typedef enum {
6872
GHOSTTY_PLATFORM_IOS,
6973
} ghostty_platform_e;
7074

71-
// Callback for custom I/O write handler.
75+
// Callback for custom surface I/O writes.
7276
typedef void (*ghostty_surface_write_fn)(void* userdata,
7377
const uint8_t* data,
7478
size_t len);
7579

7680
typedef enum {
7781
GHOSTTY_CLIPBOARD_STANDARD,
7882
GHOSTTY_CLIPBOARD_SELECTION,
83+
GHOSTTY_CLIPBOARD_PRIMARY,
7984
} ghostty_clipboard_e;
8085

86+
// One representation of clipboard contents. The data is binary-safe with
87+
// an explicit length; it is not necessarily null-terminated.
8188
typedef struct {
8289
const char *mime;
8390
const char *data;
91+
size_t len;
8492
} ghostty_clipboard_content_s;
8593

94+
// The payload for completing a clipboard read request. See
95+
// ghostty_surface_complete_clipboard_request.
96+
typedef struct {
97+
const ghostty_clipboard_content_s *contents;
98+
size_t contents_len;
99+
const char *const *available;
100+
size_t available_len;
101+
bool confirmed;
102+
bool remember;
103+
} ghostty_clipboard_complete_s;
104+
105+
// The payload of a clipboard read confirmation request: the would-be
106+
// completion contents plus the information shown in the permission
107+
// prompt. See ghostty_runtime_confirm_read_clipboard_cb.
108+
typedef struct {
109+
const ghostty_clipboard_content_s *contents;
110+
size_t contents_len;
111+
const char *const *available;
112+
size_t available_len;
113+
const char *name;
114+
bool can_remember;
115+
} ghostty_clipboard_confirm_s;
116+
86117
typedef enum {
87118
GHOSTTY_CLIPBOARD_REQUEST_PASTE,
88119
GHOSTTY_CLIPBOARD_REQUEST_OSC_52_READ,
89120
GHOSTTY_CLIPBOARD_REQUEST_OSC_52_WRITE,
121+
GHOSTTY_CLIPBOARD_REQUEST_KITTY_READ,
122+
GHOSTTY_CLIPBOARD_REQUEST_KITTY_WRITE,
123+
GHOSTTY_CLIPBOARD_REQUEST_LIST,
90124
} ghostty_clipboard_request_e;
91125

126+
// apprt.ClipboardReadResult
127+
typedef enum {
128+
GHOSTTY_CLIPBOARD_READ_STARTED,
129+
GHOSTTY_CLIPBOARD_READ_UNAVAILABLE,
130+
GHOSTTY_CLIPBOARD_READ_UNSUPPORTED,
131+
} ghostty_clipboard_read_result_e;
132+
92133
typedef enum {
93134
GHOSTTY_MOUSE_RELEASE,
94135
GHOSTTY_MOUSE_PRESS,
@@ -369,7 +410,6 @@ typedef enum {
369410
} ghostty_input_trigger_tag_e;
370411

371412
typedef union {
372-
ghostty_input_key_e translated;
373413
ghostty_input_key_e physical;
374414
uint32_t unicode;
375415
// catch_all has no payload
@@ -652,6 +692,12 @@ typedef enum {
652692
GHOSTTY_INSPECTOR_HIDE,
653693
} ghostty_action_inspector_e;
654694

695+
// apprt.action.ExportTerminalIO.C
696+
typedef struct {
697+
const char* contents;
698+
size_t len;
699+
} ghostty_action_export_terminal_io_s;
700+
655701
// apprt.action.QuitTimer
656702
typedef enum {
657703
GHOSTTY_QUIT_TIMER_START,
@@ -679,13 +725,22 @@ typedef struct {
679725
typedef enum {
680726
GHOSTTY_PROMPT_TITLE_SURFACE,
681727
GHOSTTY_PROMPT_TITLE_TAB,
728+
GHOSTTY_PROMPT_TITLE_WINDOW,
682729
} ghostty_action_prompt_title_e;
683730

684731
// apprt.action.Pwd.C
685732
typedef struct {
686733
const char* pwd;
687734
} ghostty_action_pwd_s;
688735

736+
// apprt.action.OpenConfig
737+
typedef enum {
738+
// Open the config in the OS default editor.
739+
GHOSTTY_ACTION_OPEN_CONFIG_OS_OPEN,
740+
// Open the config in a new window using $EDITOR or $VISUAL
741+
GHOSTTY_ACTION_OPEN_CONFIG_NEW_WINDOW,
742+
} ghostty_action_open_config_e;
743+
689744
// terminal.MouseShape
690745
typedef enum {
691746
GHOSTTY_MOUSE_SHAPE_DEFAULT,
@@ -819,6 +874,7 @@ typedef enum {
819874
GHOSTTY_ACTION_OPEN_URL_KIND_UNKNOWN,
820875
GHOSTTY_ACTION_OPEN_URL_KIND_TEXT,
821876
GHOSTTY_ACTION_OPEN_URL_KIND_HTML,
877+
GHOSTTY_ACTION_OPEN_URL_KIND_OSC8,
822878
} ghostty_action_open_url_kind_e;
823879

824880
// apprt.action.OpenUrl.C
@@ -921,9 +977,11 @@ typedef enum {
921977
GHOSTTY_ACTION_INSPECTOR,
922978
GHOSTTY_ACTION_SHOW_GTK_INSPECTOR,
923979
GHOSTTY_ACTION_RENDER_INSPECTOR,
980+
GHOSTTY_ACTION_EXPORT_TERMINAL_IO,
924981
GHOSTTY_ACTION_DESKTOP_NOTIFICATION,
925982
GHOSTTY_ACTION_SET_TITLE,
926983
GHOSTTY_ACTION_SET_TAB_TITLE,
984+
GHOSTTY_ACTION_SET_WINDOW_TITLE,
927985
GHOSTTY_ACTION_PROMPT_TITLE,
928986
GHOSTTY_ACTION_PWD,
929987
GHOSTTY_ACTION_MOUSE_SHAPE,
@@ -941,6 +999,7 @@ typedef enum {
941999
GHOSTTY_ACTION_CONFIG_CHANGE,
9421000
GHOSTTY_ACTION_CLOSE_WINDOW,
9431001
GHOSTTY_ACTION_RING_BELL,
1002+
GHOSTTY_ACTION_SELECTION_CHANGED,
9441003
GHOSTTY_ACTION_UNDO,
9451004
GHOSTTY_ACTION_REDO,
9461005
GHOSTTY_ACTION_CHECK_FOR_UPDATES,
@@ -955,6 +1014,7 @@ typedef enum {
9551014
GHOSTTY_ACTION_SEARCH_SELECTED,
9561015
GHOSTTY_ACTION_READONLY,
9571016
GHOSTTY_ACTION_COPY_TITLE_TO_CLIPBOARD,
1017+
GHOSTTY_ACTION_MOVE_TAB_TO_NEW_WINDOW,
9581018
} ghostty_action_tag_e;
9591019

9601020
typedef union {
@@ -970,6 +1030,7 @@ typedef union {
9701030
ghostty_action_cell_size_s cell_size;
9711031
ghostty_action_scrollbar_s scrollbar;
9721032
ghostty_action_inspector_e inspector;
1033+
ghostty_action_export_terminal_io_s export_terminal_io;
9731034
ghostty_action_desktop_notification_s desktop_notification;
9741035
ghostty_action_set_title_s set_title;
9751036
ghostty_action_set_title_s set_tab_title;
@@ -996,6 +1057,7 @@ typedef union {
9961057
ghostty_action_search_total_s search_total;
9971058
ghostty_action_search_selected_s search_selected;
9981059
ghostty_action_readonly_e readonly;
1060+
ghostty_action_open_config_e open_config;
9991061
} ghostty_action_u;
10001062

10011063
typedef struct {
@@ -1004,12 +1066,16 @@ typedef struct {
10041066
} ghostty_action_s;
10051067

10061068
typedef void (*ghostty_runtime_wakeup_cb)(void*);
1007-
typedef bool (*ghostty_runtime_read_clipboard_cb)(void*,
1008-
ghostty_clipboard_e,
1009-
void*);
1069+
typedef ghostty_clipboard_read_result_e (*ghostty_runtime_read_clipboard_cb)(
1070+
void*,
1071+
ghostty_clipboard_e,
1072+
void*,
1073+
const char* const*,
1074+
size_t,
1075+
bool);
10101076
typedef void (*ghostty_runtime_confirm_read_clipboard_cb)(
10111077
void*,
1012-
const char*,
1078+
const ghostty_clipboard_confirm_s*,
10131079
void*,
10141080
ghostty_clipboard_request_e);
10151081
typedef void (*ghostty_runtime_write_clipboard_cb)(void*,
@@ -1061,6 +1127,8 @@ typedef union {
10611127
// apprt.ipc.Action.Key
10621128
typedef enum {
10631129
GHOSTTY_IPC_ACTION_NEW_WINDOW,
1130+
GHOSTTY_IPC_ACTION_NEW_TAB,
1131+
GHOSTTY_IPC_ACTION_TOGGLE_QUICK_TERMINAL,
10641132
} ghostty_ipc_action_tag_e;
10651133

10661134
//-------------------------------------------------------------------
@@ -1084,6 +1152,7 @@ GHOSTTY_API bool ghostty_config_get(ghostty_config_t, void*, const char*, uintpt
10841152
GHOSTTY_API ghostty_input_trigger_s ghostty_config_trigger(ghostty_config_t,
10851153
const char*,
10861154
uintptr_t);
1155+
GHOSTTY_API bool ghostty_config_key_is_binding(ghostty_config_t, ghostty_input_key_s);
10871156
GHOSTTY_API uint32_t ghostty_config_diagnostics_count(ghostty_config_t);
10881157
GHOSTTY_API ghostty_diagnostic_s ghostty_config_get_diagnostic(ghostty_config_t, uint32_t);
10891158
GHOSTTY_API ghostty_string_s ghostty_config_open_path(void);
@@ -1095,7 +1164,6 @@ GHOSTTY_API void ghostty_app_tick(ghostty_app_t);
10951164
GHOSTTY_API void* ghostty_app_userdata(ghostty_app_t);
10961165
GHOSTTY_API void ghostty_app_set_focus(ghostty_app_t, bool);
10971166
GHOSTTY_API bool ghostty_app_key(ghostty_app_t, ghostty_input_key_s);
1098-
GHOSTTY_API bool ghostty_app_key_is_binding(ghostty_app_t, ghostty_input_key_s);
10991167
GHOSTTY_API void ghostty_app_keyboard_changed(ghostty_app_t);
11001168
GHOSTTY_API void ghostty_app_open_config(ghostty_app_t);
11011169
GHOSTTY_API void ghostty_app_update_config(ghostty_app_t, ghostty_config_t);
@@ -1116,10 +1184,12 @@ GHOSTTY_API bool ghostty_surface_needs_confirm_quit(ghostty_surface_t);
11161184
GHOSTTY_API bool ghostty_surface_process_exited(ghostty_surface_t);
11171185
GHOSTTY_API void ghostty_surface_refresh(ghostty_surface_t);
11181186
GHOSTTY_API void ghostty_surface_draw(ghostty_surface_t);
1119-
GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t, const uint8_t*, size_t);
1187+
GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t,
1188+
const uint8_t*,
1189+
size_t);
11201190
GHOSTTY_API void ghostty_surface_set_write_callback(ghostty_surface_t,
1121-
ghostty_surface_write_fn,
1122-
void*);
1191+
ghostty_surface_write_fn,
1192+
void*);
11231193
GHOSTTY_API void ghostty_surface_set_content_scale(ghostty_surface_t, double, double);
11241194
GHOSTTY_API void ghostty_surface_set_focus(ghostty_surface_t, bool);
11251195
GHOSTTY_API void ghostty_surface_set_occlusion(ghostty_surface_t, bool);
@@ -1161,10 +1231,12 @@ GHOSTTY_API void ghostty_surface_split_resize(ghostty_surface_t,
11611231
uint16_t);
11621232
GHOSTTY_API void ghostty_surface_split_equalize(ghostty_surface_t);
11631233
GHOSTTY_API bool ghostty_surface_binding_action(ghostty_surface_t, const char*, uintptr_t);
1164-
GHOSTTY_API void ghostty_surface_complete_clipboard_request(ghostty_surface_t,
1165-
const char*,
1166-
void*,
1167-
bool);
1234+
GHOSTTY_API void ghostty_surface_complete_clipboard_request(
1235+
ghostty_surface_t,
1236+
const ghostty_clipboard_complete_s*,
1237+
void*);
1238+
GHOSTTY_API void ghostty_surface_deny_clipboard_request(ghostty_surface_t,
1239+
void*);
11681240
GHOSTTY_API bool ghostty_surface_has_selection(ghostty_surface_t);
11691241
GHOSTTY_API bool ghostty_surface_read_selection(ghostty_surface_t, ghostty_text_s*);
11701242
GHOSTTY_API bool ghostty_surface_read_text(ghostty_surface_t,

0 commit comments

Comments
 (0)