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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263from typing import cast
from albedo_api import Host, PythonApi, Recordimport albedo_trace
class SkillResources(Record): """resources.resources and resources["resources"] both work."""
resources: list[str] truncated: bool diagnostics: list[str]
class SkillPage(Record): """page.content and page["content"] both work."""
path: str encoding: str content: str next_offset: int truncated: bool size: int
host: Host
class Skills: async def resources(self, name: str) -> SkillResources: """List resource names without reading or executing their contents.""" return SkillResources( cast(dict, await host("skills.resources", {"name": name})) )
async def read( self, name: str, resource: str = "SKILL.md", *, offset: int = 0, limit: int = 16_384, ) -> SkillPage: """Read one bounded page from a cataloged skill resource.""" page = cast( dict, await host( "skills.read", {"name": name, "resource": resource, "offset": offset, "limit": limit}, ), ) # the daemon names the skill when this read loads it loaded = page.pop("skill", None) if loaded is not None: albedo_trace.skill(loaded) return SkillPage(page)
def setup(api: PythonApi) -> dict[str, object]: global host host = api.host return {"skills": Skills(), "SkillsError": api.HostError}