decouple Pane from PtySession so the web build compiles
test / unit + widget + golden + a11y (push) Failing after 37s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped

Pane is now a pure data class — id, kind, pid, argv, cwd, title,
isClosed. The daemon-side PaneRegistry holds a parallel map of
PtySession keyed on id; registry methods look up both sides when
writing / resizing / closing.

The `clide.dart` barrel no longer re-exports `src/pty/*`,
`src/panes/registry.dart`, or the `*_commands.dart` modules — all
three transitively import `dart:ffi` which isn't available when
compiling to WebAssembly. The daemon entrypoint (bin/clide.dart) +
core tests import them via deep paths now. Pane / PaneKind /
DaemonEventSink / RecordingEventSink stay in the barrel since
they're pure data the Flutter app references over IPC.

Verified: `dart analyze` clean, 53 core tests green, 174 app tests
green, `make ui-smoke` compiles + serves + Playwright smoke passes,
daemon boots + ping round-trips + SIGTERMs cleanly.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:01:06 +02:00
co-authored by Claude
parent b9fbcd43a2
commit 37108230f2
8 changed files with 44 additions and 27 deletions
+12 -14
View File
@@ -1,13 +1,11 @@
/// A single active pane in the daemon.
/// A single active pane. Pure data — no PTY coupling so this type
/// travels cleanly into the Flutter app (which can't depend on
/// `dart:ffi`-using code for the web build).
///
/// Owns a [PtySession] plus whatever pane-level metadata the UI +
/// CLI need. The `kind:` field distinguishes general-purpose terminal
/// panes from Claude panes (D-041, not yet landed) from whatever
/// future pane-shaped surface Tier 1+ grows.
/// The daemon's [PaneRegistry] keeps a parallel `PtySession` keyed on
/// [id] and mutates [isClosed] when the session exits.
library;
import '../pty/session.dart';
/// Kind of a pane. Keep this enum small and explicit — each kind
/// typically pairs with a bundled extension that manages its
/// lifecycle (`builtin.terminal`, `builtin.claude`).
@@ -25,28 +23,28 @@ enum PaneKind {
}
}
/// A live pane. Thin wrapper over [PtySession] — the registry is what
/// owns the session lifecycle; consumers of this class read state and
/// call [write] / [resize] via the session.
class Pane {
Pane({
required this.id,
required this.kind,
required this.session,
required this.pid,
required this.argv,
this.cwd,
this.title,
this.isClosed = false,
});
final String id;
final PaneKind kind;
final PtySession session;
final int pid;
final List<String> argv;
final String? cwd;
final String? title;
int get pid => session.pid;
bool get isClosed => session.isClosed;
/// Mutated by the registry when the child exits or the session
/// closes. Kept mutable so registry state doesn't need to replace
/// [Pane] instances on transition.
bool isClosed;
Map<String, Object?> toJson() => {
'id': id,