Commit graph

295 commits

Author SHA1 Message Date
Hibryda
1d29100667 fix(electrobun): register agent listeners lazily (was no-op at module load before setAppRpc) 2026-03-26 02:16:16 +01:00
Hibryda
4a83472392 chore(electrobun): add parseMessage debug logging to trace agent message forwarding 2026-03-26 02:10:22 +01:00
Hibryda
a1a5467ef9 fix(electrobun): copy sidecar/dist into build output + fix runner path resolution 2026-03-26 02:06:39 +01:00
Hibryda
541b6eda46 fix(electrobun): sidecar runner path resolution for dev build output + debug logging 2026-03-26 02:04:02 +01:00
Hibryda
0eb4ba9396 style(electrobun): increase sidebar icon to 3rem 2026-03-26 01:56:05 +01:00
Hibryda
c2fbbdbf90 style(electrobun): increase sidebar icon size to 2.5rem 2026-03-26 01:54:15 +01:00
Hibryda
ad38a0ae17 refactor(electrobun): remove AGOR text, keep icon only in sidebar 2026-03-26 01:53:14 +01:00
Hibryda
02af115108 feat(electrobun): add AGOR icon above vertical title in sidebar 2026-03-26 01:47:59 +01:00
Hibryda
04034ab379 chore: add icon assets (SVG + PNG fallback) 2026-03-26 01:39:40 +01:00
Hibryda
c7d0c80d43 chore: add .desktop file for auto-move workspace support 2026-03-26 01:32:24 +01:00
Hibryda
c04eb58e85 fix: MCP agor-start uses spawn+detach instead of blocking execSync 2026-03-26 00:38:57 +01:00
Hibryda
370d4d55a0 fix: MCP agor-start uses spawn+detach instead of blocking execSync 2026-03-26 00:28:52 +01:00
Hibryda
e9d7356064 feat: agor-launcher MCP server + .mcp.json + updated Rule 56 2026-03-25 20:37:16 +01:00
Hibryda
58ac5e8c84 chore: update launch.sh for Electrobun (kill+clean+PTY+Vite+launch) 2026-03-25 20:32:24 +01:00
Hibryda
66dce7ebae fix(electrobun): 7 bug fixes + 3 partial features completed
Bugs fixed:
- Agent retry: clear dead session on failed start (was non-recoverable)
- seqId persist: save seq_id column in agent_messages, migrate existing DBs
- Window frame save: wire resize event listener to saveWindowFrame()
- Diagnostics counters: real RPC call counter via withRpcCounting() proxy

Partial features completed:
- Search auto-seed: rebuildIndex() on startup + indexMessage() on save
- Notifications: removed 3 hardcoded demo entries, start empty
- Agent cost streaming: emitCostIfChanged() on every message batch

New: src/bun/rpc-stats.ts (RPC call + dropped event counters)
2026-03-25 20:26:49 +01:00
Hibryda
0dd402e282 fix(electrobun): sidebar AGOR non-selectable, larger font, settings clickable
- AGOR title: pointer-events:none (clicks pass to drag zone), user-select:none,
  font-size 1.25rem→1.5rem (20% larger), removed cursor:grab
- Settings button: z-index:1 (above drag zone), clickable again
- Group buttons: z-index:1 (above drag zone)
- Drag zone stays z-index:0 as catch-all behind interactive elements
2026-03-25 19:41:04 +01:00
Hibryda
d9a2ea6500 fix(electrobun): replace sidebar onmousedown with inset drag zone (10px from edges) 2026-03-25 19:09:20 +01:00
Hibryda
561bca1133 fix(electrobun): 10px left padding on sidebar to avoid resize edge overlap 2026-03-25 18:59:33 +01:00
Hibryda
94a8e4072d fix(electrobun): skip window drag when click is within 8px resize border zone 2026-03-25 18:54:51 +01:00
Hibryda
a814e39410 fix(electrobun): set GTK window background to black (prevents white host flash) 2026-03-25 18:37:48 +01:00
Hibryda
fbb18d1d42 fix(electrobun): black background on html+body (prevents white flash) 2026-03-25 18:31:08 +01:00
Hibryda
61466b53c6 chore(electrobun): revert to real app mode (resize test flags disabled) 2026-03-25 18:11:59 +01:00
Hibryda
8f4ec379ee fix(electrobun): clear min-size in configure handler during resize (prevents GTK bounce-back) 2026-03-25 18:06:06 +01:00
Hibryda
6d0a65eb65 fix(electrobun): disable WebView during resize drag in C (prevents grab theft) 2026-03-25 17:59:32 +01:00
Hibryda
7af94fd4bd fix(electrobun): clear min-size in C before begin_resize_drag + configure logging 2026-03-25 17:51:57 +01:00
Hibryda
683013d704 fix(electrobun): connect resize signals on WebKitWebView, not GtkWindow
KEY FIX: WebKit's GdkWindow receives all pointer events. Connecting
button-press-event on the GtkWindow never fires. Must connect on the
WebKitWebView widget itself (the Wails pattern).

C library now:
- Walks widget tree to find deepest child (WebKitWebView)
- Connects button-press + motion-notify on the WebView
- Does hit-test in C (8px border zone)
- Calls gtk_window_begin_resize_drag with real event data
- Returns TRUE to consume border clicks, FALSE for interior
2026-03-25 17:40:16 +01:00
Hibryda
f97eaa1c36 fix(electrobun): update stub HTML + 800x600 test window size 2026-03-25 17:33:33 +01:00
Hibryda
7971ffe859 fix(electrobun): simplified stub page — no RPC, relies on native C resize only 2026-03-25 17:24:55 +01:00
Hibryda
e5125e6e6e fix(electrobun): enable stub page + deferred native resize for testing 2026-03-25 17:18:09 +01:00
Hibryda
449fa3dcae feat(electrobun): native C resize lib + stub test page + deferred init
- agor_resize.c: C library with GTK signal handlers for resize
- native-resize.ts: Bun FFI wrapper for libagor-resize.so
- resize-test.html: minimal stub for isolating resize behavior
- index.ts: native resize disabled pending stability testing
- RESIZE_TEST env var for loading stub page via Vite
2026-03-25 17:01:11 +01:00
Hibryda
178e560068 feat(electrobun): native C resize library (Wails pattern)
New: agor-pty/native/agor_resize.c — C shared library that:
- Connects button-press-event on GtkWindow + WebView children in C
- Stores mouseButton, xroot, yroot, dragTime from real GTK events
- Exports agor_resize_start(edge) for Bun FFI

Build: gcc -shared -fPIC -o libagor-resize.so agor_resize.c $(pkg-config --cflags --libs gtk+-3.0)

New: ui-electrobun/src/bun/native-resize.ts — Bun FFI wrapper
App.svelte: simplified to just edge detection + RPC call
2026-03-25 16:44:51 +01:00
Hibryda
de40bcbcac fix(electrobun): disable all GTK FFI, JS-only resize via setFrame RPC
Bun segfaults (address 0x10) from prior GTK widget tree modifications
(wrapWebViewInScrolledWindow corrupted the tree). Disabled all GTK FFI
except begin_move_drag (which works). JS handles capture mouse events,
compute delta, and call window.setFrame RPC.

Clean build required: rm -rf ui-electrobun/build/

Status: resize outward works, resize inward blocked by WebView min-size.
Next: need C shared library for proper GTK signal connection.
2026-03-25 16:26:00 +01:00
Hibryda
b9169ec046 Revert "fix(electrobun): connect button-press on WebView child too (events go to deepest child)"
This reverts commit 74ec191ce9.
2026-03-25 16:15:55 +01:00
Hibryda
74ec191ce9 fix(electrobun): connect button-press on WebView child too (events go to deepest child) 2026-03-25 16:13:37 +01:00
Hibryda
e563da2b3b fix(electrobun): re-enable CSS resize handles + GTK button-press only
Motion handler crashes in Bun's JSCallback FFI bridge — disabled.
CSS handles provide cursor feedback. GTK button-press-event handles
actual resize via begin_resize_drag with real event timestamp.

Bundler issue resolved: syntax error in /* */ comment was preventing
Electrobun's bundler from compiling gtk-resize.ts.
2026-03-25 16:12:15 +01:00
Hibryda
828e97276a fix(electrobun): fix gtk-resize.ts syntax error + Buffer-based FFI pointers
Fixed malformed block comment that prevented bun bundler from compiling.
Switched from TypedArray.buffer to Buffer.alloc for FFI output pointers.
Disabled motion handler to isolate button-press resize.

NOTE: Electrobun's dev command rebuilds the bundle on every run, overwriting
manual builds. To test changes, run: bun build src/bun/index.ts --outfile
build/.../app/bun/index.js --target=bun --external=electrobun AFTER
electrobun dev finishes building, then restart the app.
2026-03-25 15:59:51 +01:00
Hibryda
e9fcd8401e feat(electrobun): native GTK resize via button-press-event signal (tao pattern)
All previous approaches failed because they initiated resize from JS
(too late, wrong timestamp, WebKit steals grab). The correct approach
(proven by Tauri/tao) is to connect button-press-event DIRECTLY on the
GtkWindow at the GTK level, BEFORE WebKitGTK processes events.

New: gtk-resize.ts
- JSCallback for button-press-event + motion-notify-event
- Hit-test in 8px border zone (same as tao's 5*scale_factor)
- begin_resize_drag with REAL event timestamp (not GDK_CURRENT_TIME)
- Returns TRUE to STOP propagation (WebKit never sees the press)
- Cursor updates on motion-notify in border zone

Removed: all JS resize handles (divs, mousemove, mouseup, RPC calls)
2026-03-25 15:25:25 +01:00
Hibryda
c4d06ca999 fix(electrobun): use window.resizeTo/moveTo for resize (proven in Chromium)
Replaced entire FFI chain (XMoveResizeWindow, begin_resize_drag,
XUngrabPointer) with standard browser APIs window.resizeTo + window.moveTo.

Proven to work in Chromium --app mode with same JS resize logic.
Frame captured synchronously via window.screenX/Y + outerWidth/Height.
Zero RPC, zero FFI, zero GTK involvement.
2026-03-25 15:07:49 +01:00
Hibryda
0e6408a447 fix(electrobun): X11 XMoveResizeWindow bypass for resize (no GTK involvement)
begin_resize_drag + XUngrabPointer still fails because GTK's layout
cycle re-asserts WebView preferred size, fighting the WM resize.

New approach: JS mousemove → XMoveResizeWindow via libX11.so.6 FFI.
Completely bypasses GTK size negotiation. GTK only receives
ConfigureNotify after the X server has already resized the window.

Added: x11SetFrame() using gdk_x11_display_get_xdisplay +
gdk_x11_window_get_xid + XMoveResizeWindow.
2026-03-25 14:19:27 +01:00
Hibryda
058ae563d5 fix(electrobun): XUngrabPointer before begin_resize_drag (SDL2 pattern)
Root cause confirmed via X11 research: WebKitGTK holds an implicit X11
pointer grab from button-press. GTK's gdk_seat_ungrab targets the wrong
device, leaving the grab active. Mutter gets AlreadyGrabbed and gives up.

Fix: call XUngrabPointer(xdisplay, CurrentTime) + XFlush directly via
libX11.so.6 FFI before begin_resize_drag. This releases ALL grabs on
the display connection, matching SDL2's proven approach.

Removed failed approaches: WebView sensitivity toggle, findWebView cache.
2026-03-25 14:06:45 +01:00
Hibryda
7bb08697d6 fix(electrobun): disable WebView sensitivity during resize to prevent grab loss
Codex review #3 identified: the issue is NOT min-size but pointer grab
conflict. WebKitGTK steals the WM's X11 pointer grab when cursor enters
the WebView during inward resize.

Fix: gtk_widget_set_sensitive(webview, false) before begin_resize_drag,
re-enable after 5s. Also added findWebView() to cache the deepest
GtkBin child pointer for fast access.
2026-03-25 13:47:05 +01:00
Hibryda
300bd30ca3 fix(electrobun): wrap WebView in GtkScrolledWindow for resize-in
Codex review #2 found: set_size_request only controls minimum, not
natural/preferred size. WebView still reports content size as natural,
causing rubber-band effect during shrink.

Fix: reparent WebKitWebView into GtkScrolledWindow via FFI with
propagate-natural-width/height=FALSE and min-content=1x1. This
decouples WebView content size from window size negotiation.

Also reverted to native begin_resize_drag (WM handles everything).
2026-03-25 13:38:29 +01:00
Hibryda
d1583f8ce4 fix(electrobun): set_size_request(1,1) not (-1,-1) + revert to begin_resize_drag
Codex review found: set_size_request(-1,-1) means "use preferred size"
which RE-ENABLES WebView content-based minimum. Using (1,1) FORCES a
1x1 minimum, actually overriding the preferred size.

Reverted to native begin_resize_drag (WM handles resize smoothly).
Fixed onResizeStart sync: e.stopPropagation() now runs BEFORE any async
work, preventing sidebar drag handler from intercepting.

Removed JS mousemove resize loop — native GTK resize is correct approach.
2026-03-25 13:24:41 +01:00
Hibryda
fd2f626c20 fix(electrobun): GTK FFI direct resize via gtk_window_resize/move
Electrobun's setSize respects WebView min-size constraint. Bypass it
with direct gtk_window_resize() + gtk_window_move() FFI calls.
clearMinSizeTree() runs on every resize frame to suppress WebView
re-propagation. gtkSetFrame() exported as new RPC endpoint.
2026-03-25 13:16:39 +01:00
Hibryda
e6635e436c fix(electrobun): JS-based window resize replaces GTK begin_resize_drag
GTK begin_resize_drag loses grip when cursor moves inward past the 6px
handle zone. Replaced with document-level mousemove/mouseup listeners
that compute delta from initial frame and call setPosition+setSize.

- clearMinSize RPC clears WebView min-size before resize starts
- Cursor locks to resize direction during drag (body.style.cursor)
- user-select disabled during drag to prevent text selection
- Frame captured async before resize starts (no race condition)
2026-03-25 13:09:15 +01:00
Hibryda
290ae8ef86 fix(electrobun): clear min-size before each resize drag (enables shrink)
WebKitWebView re-propagates content size as minimum on every layout cycle,
overriding the one-time init fix. Now clearMinSizeTree() runs right before
each gtk_window_begin_resize_drag call, allowing resize-in (shrink).

Also removed red debug background from resize handles.
2026-03-25 13:00:11 +01:00
Hibryda
d84feb6c67 fix(electrobun): enable window resize via recursive GTK min-size override
Root cause: WebKitWebView requests min_size = content_size (5120x1387 on
ultrawide), which GTK propagates to WM_NORMAL_HINTS, blocking all resize.

Fix: recursively walk the GTK widget tree (GtkWindow → GtkBin → WebView)
and call gtk_widget_set_size_request(-1, -1) on every widget. Then set
gtk_window_set_geometry_hints with min=400x300.

Result: WM_NORMAL_HINTS now shows min=10x10, window is fully resizable.
2026-03-25 12:53:24 +01:00
Hibryda
9da9d96ebd feat(electrobun): native GTK drag/resize via gtk_window_begin_resize_drag
- gtk-window.ts: FFI wrapper calling libgtk-3.so.0 directly via bun:ffi
- begin_resize_drag: delegates resize to window manager (zero CPU, smooth)
- begin_move_drag: delegates move to window manager (replaces JS drag)
- Removed all JavaScript-based drag/resize logic (no mousemove/mouseup)
- RPC: window.beginResize + window.beginMove
- Resize handles: 4px edges + 8px corners with proper cursors
2026-03-25 02:23:24 +01:00
Hibryda
48d32f6f28 fix(electrobun): use setPosition+setSize instead of setFrame, add resize throttle 2026-03-25 02:09:54 +01:00
Hibryda
cfb7dafa17 fix(electrobun): setFrame takes positional args, not object — was causing resize jump 2026-03-25 02:02:36 +01:00