okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
59d7370
main
1from typing import cast 2 3from albedo_api import Host ,PythonApi ,Record 4 5 6class SkillResources (Record ): 7"""resources.resources and resources["resources"] both work.""" 8 9resources :list [str ] 10truncated :bool 11diagnostics :list [str ] 12 13 14class SkillPage (Record ): 15"""page.content and page["content"] both work.""" 16 17path :str 18encoding :str 19content :str 20next_offset :int 21truncated :bool 22size :int 23 24 25host :Host 26 27 28class Skills : 29async def resources (self ,name :str )-> SkillResources : 30"""List resource names without reading or executing their contents.""" 31return SkillResources ( 32cast (dict ,await host ("skills.resources" , {"name" :name })) 33 ) 34 35async def read ( 36self , 37name :str , 38resource :str = "SKILL.md" , 39* , 40offset :int = 0 , 41limit :int = 16_384 , 42 )-> SkillPage : 43"""Read one bounded page from a cataloged skill resource.""" 44return SkillPage ( 45cast ( 46dict , 47await host ( 48"skills.read" , 49 { 50"name" :name , 51"resource" :resource , 52"offset" :offset , 53"limit" :limit , 54 }, 55 ), 56 ) 57 ) 58 59 60def setup (api :PythonApi )-> dict [str ,object ]: 61global host 62host = api .host 63return {"skills" :Skills (),"SkillsError" :api .HostError }