ci / rust (push) Failing after 8m45s
Browser now opens ws://{host}/api/attach/:id directly — maestro-web
reverse-proxies it to the home daemon's broker, which short-circuits to
the local PTY (NAP-243) or, once NAP-247 lands, brokers to a peer over T2.
Drops the old getConnectInfo + daemon_url path: the browser no longer
knows or cares which daemon owns a session. ConnectInfo type and the
helper are gone.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
// Mirror of `maestro-protocol` JSON shapes. Keep in sync with
|
|
// crates/maestro-protocol/src/lib.rs.
|
|
|
|
export type Uuid = string;
|
|
export type IsoTimestamp = string;
|
|
|
|
export type SessionStatus = "Running" | "Dead";
|
|
|
|
export interface Session {
|
|
id: Uuid;
|
|
daemon_id: string;
|
|
cwd: string;
|
|
command: string;
|
|
env: Record<string, string>;
|
|
metadata: Record<string, unknown>;
|
|
status: SessionStatus;
|
|
created_at: IsoTimestamp;
|
|
}
|
|
|
|
export interface DaemonInfo {
|
|
daemon_id: string;
|
|
hostname: string;
|
|
version: string;
|
|
daemon_url: string;
|
|
}
|
|
|
|
export interface WorktreeSpec {
|
|
base_repo: string;
|
|
branch: string;
|
|
cleanup_on_kill?: boolean;
|
|
}
|
|
|
|
export interface CreateSessionRequest {
|
|
daemon_id: string;
|
|
cwd: string;
|
|
command: string;
|
|
env?: Record<string, string>;
|
|
metadata?: Record<string, unknown>;
|
|
worktree?: WorktreeSpec;
|
|
}
|
|
|
|
export type RegistryEvent =
|
|
| {
|
|
type: "Snapshot";
|
|
daemons: DaemonInfo[];
|
|
sessions: Session[];
|
|
}
|
|
| { type: "DaemonAdded"; daemon: DaemonInfo }
|
|
| { type: "DaemonRemoved"; daemon_id: string }
|
|
| { type: "SessionAdded"; session: Session }
|
|
| { type: "SessionRemoved"; daemon_id: string; id: Uuid }
|
|
| { type: "SessionUpdated"; session: Session }
|
|
| { type: "Lagged"; skipped: number };
|
|
|
|
export type ClientControl =
|
|
| { type: "Resize"; cols: number; rows: number }
|
|
| { type: "Ping" }
|
|
| { type: "Pong" }
|
|
| { type: "Error"; code: string; message: string };
|
|
|
|
export interface ApiError {
|
|
error: { code: string; message: string };
|
|
}
|
|
|
|
export function sessionName(s: Session): string {
|
|
const meta = s.metadata as Record<string, unknown>;
|
|
const name = meta?.name;
|
|
if (typeof name === "string" && name.length > 0) return name;
|
|
return s.command;
|
|
}
|
|
|
|
export function sessionLabel(s: Session): string | undefined {
|
|
const meta = s.metadata as Record<string, unknown>;
|
|
const label = meta?.label;
|
|
return typeof label === "string" ? label : undefined;
|
|
}
|