AssetSkillSource

Android implementation of SkillSource backed by an AssetManager.

Use this source when skills are packaged inside an APK's assets/ directory rather than unpacked to the filesystem. Prefer building instances via fromContext; the primary constructor is internal.

The implementation tolerates the differing semantics of AssetManager.list between real Android (returns immediate children, mixing files and subdirectories) and Robolectric (returns all descendant file paths relative to the queried directory). Helpers below derive direct children and recursive file listings in a way that works under both.

Parameters

assets

the AssetManager to load skill files from.

skillsBaseDir

the asset path that contains skill directories. May be "" to indicate that skills live directly under the assets root.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun listFrontmatters(): Result<List<Frontmatter>>

Returns the frontmatter for all available skills.

Link copied to clipboard
open suspend override fun listResources(skillName: String, resourceDirectoryPath: String): Result<List<String>>

Returns a list of resource paths within a specific directory for a given skill.

Link copied to clipboard
open suspend override fun loadFrontmatter(skillName: String): Result<Frontmatter>

Loads the frontmatter for a single skill by name.

Link copied to clipboard
open suspend override fun loadInstructions(skillName: String): Result<String>

Loads the instruction body for a single skill by name.

Link copied to clipboard
open suspend override fun loadResource(skillName: String, resourcePath: String): Result<ByteArray>

Loads a specific resource file for a given skill.