资产技能来源(Source)

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.

类型

Link copied to clipboard
object Companion

函数

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

返回所有可用技能的前置内容(即技能介绍或相关说明)。

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

返回指定技能所在目录内的一系列资源路径。

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

根据名称加载某个特定技能的前置内容(即该技能的简介或介绍信息)。

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

根据名称加载特定技能的指令内容。

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

为指定的技能加载特定的资源文件。