Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132"""Opt-in global Extensions UI checks against a disposable kit daemon.
Run after settings_check has installed its no-credential settings-test profile.The HTTP suite cannot catch accidental session controls in the global view."""
from __future__ import annotations
from pathlib import Path
import kit
async def check(ui: kit.Review) -> None: """Edit global defaults without selecting, creating or reloading a session.""" assert ui.home.resolve() != (Path.home() / ".albedo").resolve() await ui.size(1440, 1000) await ui.page.goto(ui.url)
async def node(role: str, name: str): await ui.js( "() => new Promise(done => requestAnimationFrame(() => requestAnimationFrame(done)))" ) return await ui.page.wait_for(role=role, name=name, exact=True)
async def click(name: str) -> None: await ui.page.click(await node("button", name))
async def api(method: str, path: str, body=None): return await ui.js( """async (method, path, body) => { const headers = {accept:'application/json'}; if (body !== null) headers['content-type'] = 'application/merge-patch+json'; if (method === 'PATCH') headers['if-match'] = (await fetch('/api'+path)).headers.get('etag'); const response = await fetch('/api'+path,{method,headers,...(body === null ? {} : {body:JSON.stringify(body)})}); if (!response.ok) throw new Error(await response.text()); return response.json(); }""", method, path, body, )
before = await api("GET", "/sessions?scope=roots&limit=200") original = await api("GET", "/settings?group=extensions") await ui.key(",", kit.CTRL) await click("extensions") await node("switch", "skills for all sessions") assert not await ui.js( "!!document.querySelector('[aria-label=\"Extension selection\"] .segments')" ) assert not await ui.js( "[...document.querySelectorAll('[aria-label=\"Extension selection\"] .column')].some(el => el.textContent.includes('this session'))" ) assert await api("GET", "/sessions?scope=roots&limit=200") == before print("PASS global inventory loads without session columns or sessions") view = await ui.js( "document.querySelector('.svelte-flow__viewport').style.transform" ) wheel = await ui.js("""() => { const list = document.querySelector('.extensions .scroll'); list.scrollTop = 0; const r = list.getBoundingClientRect(); return [r.x + r.width / 2, r.y + r.height / 2]; }""") await ui.wheel(wheel[0], wheel[1], 0, 180) assert await ui.js("document.querySelector('.extensions .scroll').scrollTop") > 0 await ui.js( "const c = document.querySelector('.extensions .scroll'); c.scrollTop = c.scrollHeight" ) await ui.wheel(wheel[0], wheel[1], 0, 180) assert ( await ui.js("document.querySelector('.svelte-flow__viewport').style.transform") == view ) await ui.wheel(wheel[0], wheel[1], 0, -100, mods=kit.CTRL) assert ( await ui.js("document.querySelector('.svelte-flow__viewport').style.transform") != view ) await ui.js("document.activeElement.blur()") await ui.key("0", kit.SHIFT) print( "PASS the list scrolls without panning the canvas, including at edges; pinch still zooms" )
async def feedback(text: str) -> bool: return await ui.js( "(text) => [...document.querySelectorAll('.extensions .feedback p')].some(el => el.textContent.includes(text))", text, )
await ui.page.fill(await node("searchbox", "search extensions"), "skills") try: await click("skills for all sessions") await click("confirm") await node("switch", "skills for all sessions") assert (await api("GET", "/settings?group=extensions"))["defaults"][ "skills" ] is False assert await api("GET", "/sessions?scope=roots&limit=200") == before print("PASS toggles change only global defaults")
await api("PATCH", "/settings?group=extensions", {"defaults": {"skills": True}}) await click("skills for all sessions") await click("confirm") await node("switch", "skills for all sessions") assert await feedback("configuration changed") assert (await api("GET", "/settings?group=extensions"))["defaults"][ "skills" ] is True print("PASS stale writes refresh rather than overwrite global choices")
await ui.page.fill(await node("searchbox", "search extensions"), "python") await click("python for all sessions") await click("confirm") await node("switch", "python for all sessions") assert await ui.js( "[...document.querySelectorAll('.extensions .error')].some(el => /requir|depend/i.test(el.textContent))" ) assert ( "python" not in (await api("GET", "/settings?group=extensions"))["defaults"] ) print("PASS dependency refusal leaves the global selection unchanged") assert not await ui.errors(), await ui.errors() finally: await api( "PATCH", "/settings?group=extensions", {"defaults": {"skills": original["defaults"].get("skills")}}, )