Skip to content

Commit 973cdef

Browse files
committed
Document current rewrite progress
1 parent a5dbde0 commit 973cdef

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

docs/PURE_ZIG_REFACTOR.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,37 @@ Here, pure Zig means the core package and its dependencies contain no bundled
1717
C, C++, or Objective-C implementation. Calling the operating system through
1818
the Zig standard library and launching an installed browser remain in scope.
1919

20-
## Confirmed Baseline
20+
## Current Rewrite Status
21+
22+
Status snapshot: 2026-07-30, after commit `a5dbde0`.
23+
24+
The external-browser core is now implemented in Zig on top of pinned Linsang.
25+
The legacy wrapper, C API, compatibility files, and examples have been
26+
deleted.
27+
28+
| Area | Status |
29+
|---|---|
30+
| Server and security | HTTP, WebSocket, TLS, loopback/public policy, capabilities, Origin checks, cookies, and protocol limits are implemented. |
31+
| Browser bridge | Bindings, typed arguments and replies, events, deferred replies, JavaScript evaluation, raw data, navigation, and multiple clients are implemented. |
32+
| Content and lifecycle | HTML, directories, custom handlers, external URLs, runtime content replacement, default directories, favicons, directory monitoring, logging, and deterministic shutdown are implemented. |
33+
| Browser integration | Default URL opening, browser discovery, explicit browser selection, custom executables and argv, direct child tracking, replacement, and shutdown cleanup are implemented. |
34+
| Current validation | `zig build test`, native builds, Windows x86_64 builds, macOS aarch64 builds, and Windows/macOS test-module cross-compilation pass. |
35+
36+
Remaining work is limited to browser window controls and geometry, managed
37+
profiles and proxies, a portable parent-process numeric ID, server-side
38+
runtimes, optional native WebViews and handles, and the final parity validation
39+
gates. The coverage ledger below is the authoritative method-level list.
40+
41+
## Original Baseline
2142

2243
| Component | Status |
2344
|---|---|
24-
| zig-webui | `webui.zig` is about 1,334 lines and `c.zig` about 1,188 lines; most code forwards the C API |
25-
| Current WebUI version | `2.5.0-beta.4`, pinned to `dadf4175d6f2c4060b7a27a32e6e9e64e647116f` |
45+
| Original zig-webui | `webui.zig` was about 1,334 lines and `c.zig` about 1,188 lines; most code forwarded the C API |
46+
| Capability reference | WebUI `2.5.0-beta.4` at `337a183cea0a9c5daee16acb77eed2d5443bbbb0` |
2647
| Upstream WebUI | Its core is the roughly 14,500-line `src/webui.c`, mixing protocol, server, browser, WebView, and process management |
2748
| Browser bridge | About 1,006 lines of TypeScript using the 8-byte WebUI binary header |
2849
| Linsang | Zig 0.16 with HTTP/1.1, WebSocket, static files, TLS, and connection lifecycle support |
2950
| Linsang validation | All 101 tests pass at `3b50417e3ddb7a0651a8dd8b7154f26c4d4e5608` |
30-
| Current zig-webui validation | `zig build test` passes |
3151

3252
[Linsang issue #1](https://github.com/jinzhongjia/Linsang/issues/1) added a
3353
reference-counted `WebSocketPeer`, immediate cross-task sends, safe send/close
@@ -65,12 +85,13 @@ races, and synchronous access to the actual `port = 0` address through
6585
- Zig 0.14 or 0.15 compatibility. Zig 0.16 is the baseline.
6686
- Automatic self-signed certificate generation.
6787

68-
### Deferred capability parity
88+
### Remaining capability parity
6989

7090
- WebView2, GTK/WebKit, or WKWebView.
7191
- Deno, Node, or Bun server-side runtimes.
72-
- Automatic reload, proxies, or browser profile management.
73-
- Browser selection, managed processes, and window-control flags.
92+
- Browser window controls, geometry, and high-contrast control.
93+
- Browser profiles and proxy configuration.
94+
- A portable parent-process numeric ID accessor.
7495

7596
These do not block the external-browser core, but they are required before
7697
declaring complete upstream capability parity.
@@ -100,7 +121,7 @@ Only WebUI-specific behavior needs a Zig implementation:
100121

101122
## Protocol Strategy
102123

103-
The first phase keeps the existing WebUI bridge behavior and 8-byte header so
124+
The rewrite keeps the existing WebUI bridge behavior and 8-byte header so
104125
the front end and back end do not change simultaneously:
105126

106127
```text
@@ -145,10 +166,13 @@ try window.bind("sum", sum, null);
145166
var running = try app.start(io);
146167
defer running.stop() catch {};
147168
148-
try window.open(io, .{ .browser = .default });
169+
try window.open(io, &running);
149170
try running.wait();
150171
```
151172

173+
Use `window.openWithBrowser(&running, options)` when explicit browser
174+
selection, a custom executable, or additional argv is required.
175+
152176
Start with one explicit type-erased handler signature:
153177

154178
```zig

0 commit comments

Comments
 (0)