feat(maestro): live directory autocomplete in spawn form (NAP-329)
ci / rust (push) Failing after 5m3s

Adds api.listDir + a reusable dirAutocomplete widget (live dropdown,
Tab/Enter completion, /-drill-in, per-(daemon,dir) cache) wired onto the
cwd and worktree base-repo fields, with matching dropdown styling.
This commit is contained in:
2026-06-15 21:20:36 +00:00
parent 498cb471b7
commit 3aedd7a0a5
5 changed files with 88 additions and 2 deletions
+16 -1
View File
@@ -1,4 +1,11 @@
import type { ApiError, CreateSessionRequest, DaemonInfo, Session, Uuid } from "./types.js";
import type {
ApiError,
CreateSessionRequest,
DaemonInfo,
DirListing,
Session,
Uuid,
} from "./types.js";
async function jsonOrError<T>(res: Response): Promise<T> {
if (res.ok) {
@@ -43,6 +50,14 @@ export async function killSession(id: Uuid): Promise<void> {
);
}
/** List one directory's immediate subdirectories on `daemonId`'s host (NAP-329).
* `path` may be empty, `~`, relative, or absolute — the daemon resolves it
* against its own home dir. */
export async function listDir(daemonId: string, path: string): Promise<DirListing> {
const url = `/api/daemons/${encodeURIComponent(daemonId)}/dirs?path=${encodeURIComponent(path)}`;
return jsonOrError(await fetch(url, { credentials: "same-origin" }));
}
export function eventsWsUrl(): string {
const proto = location.protocol === "https:" ? "wss:" : "ws:";
return `${proto}//${location.host}/api/events`;