Add a per-user lead agent and make the right pane task-focused

This commit is contained in:
Ian Gulliver
2026-10-15 09:40:30 -07:00
parent d212590cdc
commit bdd1ae48f0
68 changed files with 3332 additions and 1364 deletions
+11 -14
View File
@@ -1,14 +1,15 @@
import { post } from "./api.js";
import { errorText, h, replace, showAlert } from "./dom.js";
import { openTranscript } from "./panes.js";
import { activeTasks, currentSession, findTask, lastVisits, onEach, state } from "./state.js";
export function mountNavbar(root, show) {
import { openSettings } from "./settings.js";
import { activeTasks, currentSession, findTask, focusTask, lastVisits, onEach, state } from "./state.js";
import { openStatus } from "./status.js";
export function mountNavbar(root) {
const crumb = h("button", { class: "crumb", title: "Switch task (⌘K)" });
crumb.onclick = openSwitcher;
const inbox = h("button", { class: "inbox-count" });
inbox.onclick = () => show("inbox");
const admin = h("button", { class: "nav-link" }, "Admin");
admin.onclick = () => show("admin");
const status = h("button", { class: "nav-link" }, "Status");
status.onclick = openStatus;
const settings = h("button", { class: "nav-link" }, "Settings");
settings.onclick = openSettings;
const conn = h("span", { class: "connection down", title: "connecting" });
const connLabel = h("span", { class: "connection-label" }, "reconnecting…");
const me = h("span", { class: "me" });
@@ -16,16 +17,13 @@ export function mountNavbar(root, show) {
const task = state.selectedTaskId ? findTask(state.selectedTaskId) : undefined;
const project = task ? state.projects.find((p) => p.id === task.project_id) : undefined;
replace(crumb, task ? `${project?.name ?? ""} ▸ ${task.title}` : "No task", " ▾");
const blocked = state.inbox.filter((i) => i.priority === "blocked").length;
inbox.className = blocked > 0 ? "inbox-count urgent" : "inbox-count";
replace(inbox, `Inbox ${state.inbox.length}`, blocked > 0 && h("span", { class: "blocked-count" }, ` · ${blocked} blocked`));
conn.className = state.connected ? "connection up" : "connection down";
conn.title = state.connected ? "live" : "reconnecting";
connLabel.hidden = state.connected;
replace(me, state.me?.display_name ?? "");
};
onEach(["me", "projects", "tasks", "inbox", "selection", "connection"], render);
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), inbox, admin, connLabel, conn, me);
onEach(["me", "projects", "tasks", "selection", "connection"], render);
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), status, settings, connLabel, conn, me);
render();
addEventListener("keydown", (e) => {
if (e.key === "k" && (e.metaKey || e.ctrlKey) && !document.querySelector("dialog[open]")) {
@@ -62,8 +60,7 @@ function openSwitcher() {
};
const go = (taskId) => {
close();
location.hash = `#/task/${taskId}`;
openTranscript();
focusTask(taskId);
};
const create = async (projectId, title) => {
close();