Commit Graph

63 Commits

Author SHA1 Message Date
vasyansk bd36a83db2 feat(daemon): per-surface JSON snapshot store (atomic write, corrupt-tolerant)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 15:36:21 +07:00
vasyansk bb5edb941c feat(core): Snapshot derives Deserialize + PartialEq for disk persistence
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 15:30:16 +07:00
vasyansk 4419f5660e wip: in-progress changes (grid, config, wizard, settings, pty) before session-persistence
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 15:28:19 +07:00
vasyansk f9a565a712 feat(app): clear all events from the Event Center (red trash icon)
Adds Cmd::ClearEvents + Evt::EventsCleared: the daemon drops the persistent
event log (keeping next_id monotonic), persists, and broadcasts so every
client empties its list. A red trash icon next to 'Mark all read' triggers it;
disabled when the list is empty. Threaded through proto, the daemon handler,
the Tauri bridge, and socketBridge. Includes an EventLog::clear test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 13:38:35 +07:00
vasyansk cf7410b46a feat(app): version handshake — GUI restarts a stale running daemon
The daemon outlives the GUI, so after an update an OLD daemon can keep serving
the socket and the new GUI just connects to it (stale code — e.g. the missing
TERM fix). Both binaries are now stamped with the git build id (build.rs):
the daemon reports it in `health.build`, and on connect the bridge compares it
to the GUI's own SPACESH_BUILD; on mismatch it shuts the daemon down and lets
ensure_daemon respawn the bundled (matching) one. No-op for unstamped dev
builds or daemons too old to report a build. Build id is shown in Settings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 12:39:46 +07:00
vasyansk 07cf7f9ed4 fix(pty): always set TERM/COLORTERM for spawned shells
A GUI/launchd-spawned daemon has no TERM in its environment, so child shells
inherited none and tput/zsh/ncurses failed ('tput: No value for $TERM').
The PTY now defaults TERM=xterm-256color and COLORTERM=truecolor (matching
xterm.js) unless the caller already provides them. Adds a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:47:21 +07:00
vasyansk ad29665352 feat(spaceshd): GetConfig/SetConfig handlers with live ConfigChanged broadcast 2026-06-14 09:35:27 +07:00
vasyansk c4746f9864 feat(proto): GetConfig/SetConfig commands and ConfigChanged event 2026-06-14 09:22:39 +07:00
vasyansk e990e694b5 feat(proto): ConfigView wire type 2026-06-14 09:21:22 +07:00
vasyansk 80113da066 feat(spaceshd): config terminal+appearance sections and save 2026-06-14 09:20:24 +07:00
vasyansk 7b47052a6f feat(spaceshd): pinned workspace field
Add a `pinned` bool to the workspace model, threaded through proto
(Workspace + WorkspaceView + SetWorkspaceMeta), the registry, the
set_workspace_meta handler, persistence, the CLI mapping, and the Tauri
bridge. serde(default) keeps existing state.json compatible (pinned=false).
Backs the sidebar Favorites section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 08:56:09 +07:00
vasyansk a30ec1cc7f fix(spaceshd): lazy PTY spawn so prompts render at the correct size
A new surface spawned its shell immediately at the default 80x24, so the
shell (e.g. zsh + powerlevel10k) printed its first prompt before the GUI
fit-resized the panel. The post-print resize reflowed the grid, leaving the
prompt invisible until Enter and shifted by a line.

The surface actor now defers the child spawn: it waits for the first Resize
(spawning at that geometry) or, for headless/CLI surfaces that never attach a
GUI, falls back to the spec geometry after 250ms. Attaches received before
the spawn get an empty-grid snapshot plus a live subscription; pre-spawn
input is buffered and replayed. Adds two deterministic tests via `stty size`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 08:34:28 +07:00
vasyansk 6a3875670a feat(spaceshd): configurable default shell
Add a config.rs module that loads optional ~/.spacesh/config.toml and a
default_shell() resolver: SPACESH_SHELL env -> config.toml default_shell ->
login shell from the passwd DB -> $SHELL -> /bin/sh. The passwd lookup
matters under launchd where $SHELL is absent. All plain-panel spawn sites in
server.rs now use the resolver. Adds toml + libc deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 08:01:04 +07:00
vasyansk 21180ae9e0 fix(spaceshd): isolate instance-lock test via SPACESH_LOCK
lock_is_exclusive_within_process acquired the global ~/.spacesh/daemon.lock,
so it flaked whenever a real daemon was running. Add a SPACESH_LOCK env
override to lock_path() and point the test at a private temp file under a
serial() guard, making the suite deterministic regardless of a live daemon.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 08:00:35 +07:00
vasyansk 2b1ccaf31d feat: persisted per-workspace panel zoom (proto + daemon, auto-clear on removal)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 12:24:23 +07:00
vasyansk f7763a84fc feat: Health command — version, pid, started_at (proto + daemon) 2026-06-10 12:06:38 +07:00
vasyansk 615b90e887 test(daemon): event log survives cold daemon restart
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 08:35:38 +07:00
vasyansk 21fe1308cc feat(daemon): EventLog/MarkRead commands; Focus marks surface read
Wire Cmd::EventLog and Cmd::MarkRead to the live EventLog (replacing
NOT_IMPLEMENTED stubs). Cmd::Focus now calls mark_read for the surface,
persists the updated snapshot, and broadcasts Evt::EventsRead.
Add integration tests: event_log_query_and_mark_read and
focus_marks_surface_events_read.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 08:13:50 +07:00
vasyansk e83524a076 feat(daemon): record done/wait/error/exit into the event log
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 08:02:03 +07:00
vasyansk f7bf9fc5c6 wire(daemon): thread EventLog + EventPersister through serve/router
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 07:40:54 +07:00
vasyansk ac2d5ca1db feat(daemon): JsonEventStore + debounced EventPersister
Adds disk persistence for the event log: atomic temp+fsync+rename write,
corrupt-file backup, and a debounced coalescing persister task mirroring
state_store/persist patterns. 4 tests: round-trip, missing, corrupt, burst.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 07:27:23 +07:00
vasyansk 56ba1723b9 feat(daemon): EventLog ring model with read-flags
Add event_log.rs with EventLog (capped VecDeque, monotonic ids, mark_read,
snapshot/restore) and EventLogState. Register mod in main.rs. Stub
Cmd::EventLog and Cmd::MarkRead arms in server.rs to keep the exhaustive
match compiling; full wiring follows in Task 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 07:21:26 +07:00
vasyansk 5a8596dd0b feat(proto): EventLog/MarkRead commands and Event/EventsRead events
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 06:59:27 +07:00
vasyansk fc13e4340c feat(proto): EventKind, EventRecord, MarkReadTarget 2026-06-10 06:52:35 +07:00
vasyansk c35585755e feat(daemon): actor OSC133/fallback detection → set_state, hook/shell spawn env, cleanup
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 23:05:18 +07:00
vasyansk 4396ad7909 feat(daemon): zsh OSC 133 shell integration via per-surface ZDOTDIR
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 23:00:48 +07:00
vasyansk 255fa27271 feat(daemon): versioned Claude Code hook adapter (per-surface CLAUDE_CONFIG_DIR)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 23:00:40 +07:00
vasyansk 4ec7dc1a78 feat(core): Osc133Scanner + FallbackScanner status detectors + grid tail_text
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:59:24 +07:00
vasyansk 6fc099bb6f test(daemon): serialize SPACESH_SOCK-mutating lifecycle tests to fix env race
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:23:41 +07:00
vasyansk 6f2e7885a4 test(cli): wire-level integration tests via SPACESH_SOCK mock daemon
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:20:26 +07:00
vasyansk 3c3a8039f3 feat(cli): command dispatch, human/--json rendering, status table, completions
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:17:53 +07:00
vasyansk a9fa1bf77b feat(cli): spacesh-cli scaffold — clap tree, one-shot client, command mapping
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:17:15 +07:00
vasyansk 635f9f4356 feat(daemon): per-surface status (set_state/state), idle-on-spawn, SPACESH_SOCK override
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:13:50 +07:00
vasyansk 4bd4aa4a36 feat(proto): SurfaceState + SetState command + State event + SurfaceView.state
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:10:54 +07:00
vasyansk 0328797bce chore(daemon): remove unused imports and dead placeholders
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:39:43 +07:00
vasyansk 62a65b691d feat(daemon): M2 command dispatch, layout events, cold-start restore, persistence wiring
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:25:35 +07:00
vasyansk b72f4cb3a5 feat(daemon): spawn_from_spec to (re)start surfaces from a persisted spec
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:22:29 +07:00
vasyansk d516414ac9 feat(daemon): registry owns workspaces/groups/trees + running/stopped surfaces
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:21:47 +07:00
vasyansk 7515516699 feat(daemon): debounced persist scheduler coalescing bursts into one save
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:20:58 +07:00
vasyansk 4f7ed2a5a3 feat(daemon): StateStore trait + atomic JSON store with corrupt-file backup
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:20:51 +07:00
vasyansk 9927046c7e feat(core): 10 layout preset generators
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:17:35 +07:00
vasyansk 28d0e05763 feat(core): n-ary tree ops — split, remove+collapse, ratios, move
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:17:35 +07:00
vasyansk 2723d40ff9 feat(proto): M2 commands (split/ratios/move/preset/restart/groups/meta) and events
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:13:33 +07:00
vasyansk c8ba401023 feat(proto): SurfaceSpec, Group, Workspace, status view types
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:12:29 +07:00
vasyansk 114922aaf8 feat(proto): GroupId, Orient, n-ary LayoutNode with external-tagged serde
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 21:11:51 +07:00
vasyansk f1630633e5 test(daemon): serialize heavy socket/PTY integration tests
Process-wide serial lock around the socket-binding and PTY-spawning
integration tests in spaceshd. Running several at once on a many-core
box starved each other's async tasks and tripped timing assumptions,
causing ~1/10 flakes under cargo test --workspace. Unit tests stay
parallel. 0/20 spaceshd + 0/5 workspace runs after the change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 20:39:24 +07:00
vasyansk 77dfc69bd9 fix(daemon): remove pending broadcast on attach to prevent reattach double-render
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 20:33:11 +07:00
vasyansk a56d8d0fea test(daemon): harden reattach test with pre-connect socket guard
Add wait_for_socket before second client connect to handle scheduling
jitter when tests run in parallel under cargo test --workspace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 20:16:18 +07:00
vasyansk 18ac699951 feat(daemon): launchd user-agent install with KeepAlive
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 20:14:00 +07:00
vasyansk f49fc41cd1 test(daemon): reattach after disconnect repaints prior output from snapshot
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 20:13:32 +07:00