refactor(maestro): flatten web UI to a single host

Session tree nests by working directory only; the daemon chips in the
header become a session tally, and the spawn form loses its host picker.
API calls move from /api/daemons/:id/* to /api/dirs, /api/recent-dirs,
/api/gitroot, and /api/info.
This commit is contained in:
Miguel Palhas
2026-08-22 10:14:10 +01:00
parent 6790f41652
commit 1bb464be4b
14 changed files with 155 additions and 467 deletions
+13 -30
View File
@@ -12,7 +12,6 @@ export type ActivityState = "Active" | "Idle" | "AwaitingInput";
export interface Session {
id: Uuid;
daemon_id: string;
cwd: string;
command: string;
env: Record<string, string>;
@@ -32,17 +31,7 @@ export interface Session {
current_cwd?: string | null;
}
export interface DaemonInfo {
daemon_id: string;
hostname: string;
version: string;
daemon_url: string;
/** Home dir of the user the daemon runs as; used to prefill the spawn form's
* working directory. Empty/absent for older daemons. */
home_dir?: string;
}
/** One directory's immediate subdirectories on a daemon's host (NAP-329). */
/** One directory's immediate subdirectories (NAP-329). */
export interface DirListing {
/** Resolved absolute directory that was listed (after ~/relative expansion). */
path: string;
@@ -60,13 +49,14 @@ export interface SpawnPreset {
command: string;
}
/** `GET /api/web/info` — the connected daemon's identity plus its spawn presets
* (#26). Mirrors the daemon-side `WebInfo`. */
export interface WebInfo {
daemon_id: string;
/** `GET /api/info` — the daemon's identity plus its spawn presets (#26).
* Mirrors the daemon-side `DaemonInfo`. */
export interface DaemonInfo {
hostname: string;
version: string;
daemon_url: string;
/** Home dir of the user the daemon runs as; used to prefill the spawn form's
* working directory. Empty/absent for older daemons. */
home_dir?: string;
/** Command presets (claude/opencode/zsh + custom), config-resolved. */
presets: SpawnPreset[];
}
@@ -79,14 +69,14 @@ export interface RecentDir {
last_used: IsoTimestamp;
}
/** `GET /api/daemons/:id/recent-dirs` — a host's recent working dirs (#26). */
/** `GET /api/recent-dirs` — the daemon's recent working dirs (#26). */
export interface RecentDirs {
dirs: RecentDir[];
truncated?: boolean;
}
/** `GET /api/daemons/:id/gitroot?path=` — the enclosing repo toplevel of a path
* on a host, or absent when the path isn't inside a repo (#26). */
/** `GET /api/gitroot?path=` — the enclosing repo toplevel of a path, or absent
* when the path isn't inside a repo (#26). */
export interface GitRoot {
root?: string;
}
@@ -98,7 +88,6 @@ export interface WorktreeSpec {
}
export interface CreateSessionRequest {
daemon_id: string;
cwd: string;
command: string;
env?: Record<string, string>;
@@ -106,16 +95,10 @@ export interface CreateSessionRequest {
worktree?: WorktreeSpec;
}
export type RegistryEvent =
| {
type: "Snapshot";
daemons: DaemonInfo[];
sessions: Session[];
}
| { type: "DaemonAdded"; daemon: DaemonInfo }
| { type: "DaemonRemoved"; daemon_id: string }
export type CatalogEvent =
| { type: "Snapshot"; sessions: Session[] }
| { type: "SessionAdded"; session: Session }
| { type: "SessionRemoved"; daemon_id: string; id: Uuid }
| { type: "SessionRemoved"; id: Uuid }
| { type: "SessionUpdated"; session: Session }
| { type: "Lagged"; skipped: number };