- Settings… lists the folders the agent may work in, with the system's folder dialog, remove, max mode and terminal, all through 'lembas remote … --json' (CLI 1.2.0). Turning the agent on with no folder opens it; the title bar says 'agent: no folders' instead of green. - The content webview's User-Agent carries LLeMbasDesktop/<v> (host=…), so the server can show this computer's device as Local. - The title bar menu pops up at the button (popup_menu_at): Wayland gave the pointer-less popup the middle of the window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
13 files changed
+419
-17
No files matched your search
@@ -20,13 +20,53 @@ function render(s) {
|
||||
$("version").textContent = s.version
|
||||
if (s.server && !$("address").value) $("address").value = s.server
|
||||
$("agent-section").hidden = !s.server
|
||||
const [text, cls] = (AGENT[s.agent.state] ?? AGENT.off)(s.agent.detail)
|
||||
const noFolders = s.remote && !(s.remote.enabled && s.remote.roots.length)
|
||||
const [text, cls] =
|
||||
s.agent.state === "running" && noFolders
|
||||
? ["The agent is connected, but may open no folder yet: add one below.", "is-error"]
|
||||
: (AGENT[s.agent.state] ?? AGENT.off)(s.agent.detail)
|
||||
const status = $("agent-status")
|
||||
status.textContent = text
|
||||
status.className = `status ${cls}`
|
||||
$("link").textContent = s.linked ? "Link again" : "Link this computer"
|
||||
$("toggle").textContent = s.agent_wanted ? "Stop the agent" : "Start the agent"
|
||||
$("toggle").disabled = !s.linked && !s.agent_wanted
|
||||
renderFolders(s)
|
||||
}
|
||||
|
||||
function renderFolders(s) {
|
||||
const r = s.remote
|
||||
$("folders-section").hidden = !s.server || !s.linked || !r
|
||||
if (!r) return
|
||||
const list = $("folders")
|
||||
list.replaceChildren()
|
||||
if (!r.enabled || !r.roots.length) {
|
||||
const li = document.createElement("li")
|
||||
li.className = "empty"
|
||||
li.textContent = "No folder yet: the agent can open nothing. Add the folder of a project."
|
||||
list.append(li)
|
||||
}
|
||||
for (const dir of r.enabled ? r.roots : []) {
|
||||
const li = document.createElement("li")
|
||||
const path = document.createElement("span")
|
||||
path.className = "path"
|
||||
path.title = dir
|
||||
const inner = document.createElement("bdi")
|
||||
inner.textContent = dir
|
||||
path.append(inner)
|
||||
const remove = document.createElement("button")
|
||||
remove.type = "button"
|
||||
remove.className = "btn"
|
||||
remove.textContent = "Remove"
|
||||
remove.setAttribute("aria-label", `Remove ${dir}`)
|
||||
remove.addEventListener("click", () => invoke("remote_remove", { dir }))
|
||||
li.append(path, remove)
|
||||
list.append(li)
|
||||
}
|
||||
if (r.max_mode) $("max-mode").value = r.max_mode
|
||||
$("terminal").checked = !!r.terminal
|
||||
$("folders-status").className = "status"
|
||||
$("folders-status").textContent = ""
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
@@ -70,5 +110,14 @@ $("open").addEventListener("click", async () => {
|
||||
if (s.server) await invoke("set_server", { address: s.server })
|
||||
})
|
||||
|
||||
$("add-folder").addEventListener("click", () => invoke("remote_add"))
|
||||
$("max-mode").addEventListener("change", (e) => invoke("remote_mode", { mode: e.target.value }))
|
||||
$("terminal").addEventListener("change", (e) => invoke("remote_terminal", { on: e.target.checked }))
|
||||
|
||||
listen("remote-error", (e) => {
|
||||
$("folders-status").className = "status is-error"
|
||||
$("folders-status").textContent = String(e.payload)
|
||||
})
|
||||
listen("status", (e) => render(e.payload))
|
||||
refresh()
|
||||
invoke("remote_refresh")
|
||||
Reference in new issue
Block a user