Something went wrong. Try again.
small gleam coding and (not yet) persistent agent daemon with a detachable cli
Something went wrong. Try again.
1.4 kB · 57 lines
Python
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758from typing import cast
from albedo_api import Host, PythonApi, Record
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.""" return SkillPage(cast( dict, await host( "skills.read", { "name": name, "resource": resource, "offset": offset, "limit": limit, }, ), ))
def setup(api: PythonApi) -> dict[str, object]: global host host = api.host return {"skills": Skills(), "SkillsError": api.HostError}