Skip to content

@sqlrooms/ai / CompositeSkillStorage

Class: CompositeSkillStorage

A SkillStorage that priority-merges an ordered array of children (highest priority first). Children must own disjoint rootIds — the composite does not validate this; violating it makes dispatch ambiguous.

Implements

Constructors

Constructor

new CompositeSkillStorage(children): CompositeSkillStorage

Parameters

ParameterType
childrenreadonly SkillStorage[]

Returns

CompositeSkillStorage

Methods

listRoots()

listRoots(): Promise<SkillRoot[]>

Enumerate all roots known to this storage, in priority order (highest priority first).

Returns

Promise<SkillRoot[]>

Implementation of

SkillStorage.listRoots


listSkills()

listSkills(rootId?): Promise<SkillListing[]>

List skills. If rootId is provided, returns only skills from that root. When called without a rootId, returns skills from every root; duplicates (same id in multiple roots) are included so callers can render conflict indicators.

Parameters

ParameterType
rootId?string

Returns

Promise<SkillListing[]>

Implementation of

SkillStorage.listSkills


readSkill()

readSkill(ref): Promise<SkillRecord>

Read the full record for a single skill.

Parameters

ParameterType
refSkillRef

Returns

Promise<SkillRecord>

Throws

a SkillNotFoundError if the ref does not resolve.

Throws

a SkillManifestError if the skill's skill.yaml fails to parse or validate.

Implementation of

SkillStorage.readSkill


writeSkill()

writeSkill(rootId, id, content): Promise<SkillRef>

Create or overwrite a skill in the given root. Returns the resulting ref.

Parameters

ParameterType
rootIdstring
idstring
contentSkillWriteContent

Returns

Promise<SkillRef>

Throws

a SkillRootReadOnlyError if the target root is not writable.

Implementation of

SkillStorage.writeSkill


deleteSkill()

deleteSkill(ref): Promise<void>

Remove a skill from its root.

Parameters

ParameterType
refSkillRef

Returns

Promise<void>

Throws

a SkillRootReadOnlyError if the ref's root is not writable.

Throws

a SkillNotFoundError if the ref does not resolve.

Implementation of

SkillStorage.deleteSkill


resolveSkillId()

resolveSkillId(id): Promise<SkillRef | null>

Given a bare skill id, return the highest-priority SkillRef that holds it, or null if no root has the id.

Parameters

ParameterType
idstring

Returns

Promise<SkillRef | null>

Implementation of

SkillStorage.resolveSkillId


subscribe()

subscribe(listener): () => void

Always implemented so consumers can call it unconditionally. Fans out to children that expose subscribe?; if none do, this is a noop returning a noop unsubscribe.

Parameters

ParameterType
listener() => void

Returns

() => void

Implementation of

SkillStorage.subscribe