From 179a8dff6e9dd0ba2dc3ac6d3982964e6b22f616 Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Thu, 18 Jun 2026 01:04:20 -0700 Subject: [PATCH] =?UTF-8?q?feat(#17):=20web=20bind=20UI=20=E2=80=94=20plan?= =?UTF-8?q?e=20selector=20+=20bound-state=20indicator=20(slice=203c=20UI)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes slice 3c: the browser-facing trigger for the web bind. A 'Bifrost binding' + +
+ +
@@ -734,19 +742,35 @@ async function startSession() { try { // end_user_id is server-configured (RATATOSKR_END_USER_ID) — not sent // from the browser; the server ignores any end_user_id in this body. + // Issue #17: the browser selects only the PLANE; the consumer key + host + // are server-held (the key never reaches the browser). + const plane = $("bifrost-plane").value; + const reqBody = { agent_id: agentId }; + if (plane) reqBody.bifrost_plane = plane; const r = await fetch("/api/sessions", { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ agent_id: agentId }), + body: JSON.stringify(reqBody), }); if (r.status !== 201) { - $("setup-err").textContent = "create session failed: HTTP " + r.status; + let detail = "HTTP " + r.status; + try { + const err = await r.json(); + if (err && err.error_code) { + detail = err.error_code + (err.bifrost_error ? " (" + err.bifrost_error + ")" : ""); + } + } catch (_) { /* non-JSON body */ } + $("setup-err").textContent = "create session failed: " + detail; $("start-btn").disabled = false; return; } const info = await r.json(); state.sessionId = info.session_id; + // Issue #17 bound-state indicator: plane + endpoint (never the key). + const boundTag = info.bifrost + ? ` · ⇄ ${esc(info.bifrost.plane)} ${esc(info.bifrost.endpoint)}` + : ""; $("identity").innerHTML = - `${esc(agentId)} · …${esc(info.session_id.slice(-8))}`; + `${esc(agentId)} · …${esc(info.session_id.slice(-8))}${boundTag}`; setConn("idle", "connected"); $("setup").style.display = "none"; $("workspace").classList.add("live"); diff --git a/uv.lock b/uv.lock index 907c63a..e41d344 100644 --- a/uv.lock +++ b/uv.lock @@ -1052,7 +1052,7 @@ wheels = [ [[package]] name = "ratatoskr" -version = "0.17.12" +version = "0.17.13" source = { editable = "." } dependencies = [ { name = "httpx" },