41659b2412
The skill half of the persona/skill pair, as a clean redesign (not a faithful lift of mort's 60-method skills.Storage kitchen sink): - skill.go/skill_version.go/validate.go/inputs.go/schedule.go moved clean; the only host couplings severed: llms.IsTierName -> model.IsTierName, and the chatbot DefaultChatbotInputName const localized. - store.go: a DELIBERATELY LEAN SkillStore — skill lifecycle (CRUD + visibility) + versioning + scheduling ONLY. The KV/file/quota sub-stores that were fused into mort's interface are the tools/ store seams; email/channel grants stay host concerns. - runnable.go: Skill.ToRunnable() lowers a skill into run.RunnableAgent (flat tool list, no palette — composition is a host concern); DueAt() helper. - memory.go: NewMemory() — zero-dep in-process SkillStore (visibility filters, newest-first versions). Tests: ToRunnable mapping, visibility (public/shared/private) listing, version ordering + lookup. No mort dependency (go.mod tidy clean); core imports ZERO from skill. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.8 KiB
Go
45 lines
1.8 KiB
Go
package skill
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
// ErrNotFound is returned when a skill (or version) lookup misses.
|
|
var ErrNotFound = errors.New("skill not found")
|
|
|
|
// SkillStore is the persistence seam for saved skills. This is the DELIBERATELY
|
|
// LEAN redesign of mort's 60-method skills.Storage: it carries only skill
|
|
// lifecycle (CRUD + visibility), versioning, and scheduling. The KV/file/quota
|
|
// sub-stores that were fused into mort's interface are NOT here — they are the
|
|
// tools/ store seams (KVStorage / FileStorage / QuotaProvider); email recipients
|
|
// and channel grants stay host concerns. A host backs this with its DB; Memory()
|
|
// is the zero-dependency default; contrib/store adds durable SQLite.
|
|
type SkillStore interface {
|
|
// Initialize prepares storage (idempotent).
|
|
Initialize(ctx context.Context) error
|
|
|
|
// --- lifecycle ---
|
|
Save(ctx context.Context, s *Skill) error
|
|
Get(ctx context.Context, id string) (*Skill, error)
|
|
GetByName(ctx context.Context, ownerID, name string) (*Skill, error)
|
|
Delete(ctx context.Context, id string) error
|
|
|
|
// --- listing / visibility ---
|
|
ListByOwner(ctx context.Context, ownerID string) ([]Skill, error)
|
|
ListPublic(ctx context.Context) ([]Skill, error)
|
|
ListSharedWith(ctx context.Context, memberID string) ([]Skill, error)
|
|
ListBuiltinByName(ctx context.Context, name string) (*Skill, error)
|
|
ListChatbotExposed(ctx context.Context) ([]Skill, error)
|
|
|
|
// --- scheduling ---
|
|
ListDueScheduled(ctx context.Context, now time.Time) ([]Skill, error)
|
|
MarkScheduledRun(ctx context.Context, skillID string, ranAt, nextAt time.Time) error
|
|
|
|
// --- versioning ---
|
|
AppendVersion(ctx context.Context, sv SkillVersion) error
|
|
ListVersionsBySkill(ctx context.Context, skillID string, limit int) ([]SkillVersion, error)
|
|
GetVersionByID(ctx context.Context, versionID string) (*SkillVersion, error)
|
|
}
|