skills

package
v0.1.113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Dir               = types.DirNameSkills // S3 prefix (no leading slash)
	ManifestFile      = "SKILL.md"          // manifest filename
	InstalledMetaFile = ".installed.json"   // install state file
)

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(manifest *SkillManifest, skillContent string) string

BuildPrompt constructs the task prompt from a SKILL.md file's instructions. The prompt includes the skill name and the full instruction body so the agent has complete context when the hook triggers.

func DeleteManagedSourceSkill added in v0.1.71

func DeleteManagedSourceSkill(ctx context.Context, storage ManagedSkillStorage, workspaceExternalID string, integration string) error

func ExistsInWorkspace added in v0.1.103

func ExistsInWorkspace(ctx context.Context, storage workspaceSkillStore, workspaceExternalID, skillName string) (bool, error)

func ExtractInstructions

func ExtractInstructions(data []byte) string

ExtractInstructions returns everything after the frontmatter block.

func FindSkillMD

func FindSkillMD(dir string) (string, error)

FindSkillMD looks for a SKILL.md file in a directory.

func KeyToName

func KeyToName(key string) string

KeyToName extracts skill name from S3 key like "skills/email-triage/SKILL.md".

func ManagedSourceSkillName added in v0.1.71

func ManagedSourceSkillName(integration string) string

func ManagedSourceSkillSource added in v0.1.71

func ManagedSourceSkillSource(integration string) string

func ManifestKey

func ManifestKey(name string) string

ManifestKey returns the S3 key for a skill's manifest: "skills/{name}/SKILL.md"

func NameToPath

func NameToPath(name string) string

NameToPath converts a skill name to airstore path: "/skills/{name}"

func PathToName

func PathToName(path string) string

PathToName extracts skill name from an airstore path like "/skills/email-triage".

func SkillNameFromPath

func SkillNameFromPath(path string) string

SkillNameFromPath derives a skill name from a directory path. e.g., "./email-triage/" → "email-triage"

func UpsertManagedSourceSkill added in v0.1.71

func UpsertManagedSourceSkill(ctx context.Context, storage ManagedSkillStorage, workspaceExternalID string, integration string) error

func ValidateContent added in v0.1.97

func ValidateContent(content string) error

ValidateContent checks if a skill content string is a valid SKILL.md.

func WriteInstalledMeta

func WriteInstalledMeta(skillDir string, meta *InstalledSkill) error

WriteInstalledMeta saves installed skill metadata to a directory.

Types

type AirstoreSkillMeta

type AirstoreSkillMeta struct {
	Needs  []string // integration names (gmail, slack, github, etc.)
	Writes []string // output paths (created on install)
}

AirstoreSkillMeta holds Airstore-specific metadata extensions.

type Copilot added in v0.1.97

type Copilot struct {
	// contains filtered or unexported fields
}

func NewCopilot added in v0.1.97

func NewCopilot(s2 *common.S2Client, storage *clients.StorageClient) *Copilot

func (*Copilot) CreateDraft added in v0.1.97

func (c *Copilot) CreateDraft(workspaceID string) *Draft

func (*Copilot) Generate added in v0.1.97

func (c *Copilot) Generate(ctx context.Context, draft *Draft, userMessage string) (*types.SkillDraftResponse, error)

Generate calls the BAML WriteSkill function and returns the response. It also persists messages and skill content to S2.

func (*Copilot) GenerateStream added in v0.1.97

func (c *Copilot) GenerateStream(
	ctx context.Context,
	draft *Draft,
	userMessage string,
	onChunk func(partial *PartialSkillDraftResponse),
) (*types.SkillDraftResponse, error)

GenerateStream calls the BAML WriteSkill function with streaming and sends partial results to the provided callback. Returns the final response.

func (*Copilot) IndexDraftCreated added in v0.1.97

func (c *Copilot) IndexDraftCreated(ctx context.Context, workspaceID, draftID, description, skillName string) error

func (*Copilot) IndexDraftInstalled added in v0.1.97

func (c *Copilot) IndexDraftInstalled(ctx context.Context, workspaceID, draftID, skillName string) error

func (*Copilot) InstallDraft added in v0.1.97

func (c *Copilot) InstallDraft(ctx context.Context, draft *Draft) (*SkillManifest, error)

InstallDraft validates and installs the current draft skill content.

func (*Copilot) ListDrafts added in v0.1.97

func (c *Copilot) ListDrafts(ctx context.Context, workspaceID string) ([]DraftSummary, error)

ListDrafts returns summaries of all drafts for a workspace.

func (*Copilot) LoadDraft added in v0.1.97

func (c *Copilot) LoadDraft(ctx context.Context, workspaceID, draftID string) (*Draft, error)

func (*Copilot) PersistMessage added in v0.1.97

func (c *Copilot) PersistMessage(ctx context.Context, draftID, role, content string) error

func (*Copilot) PersistMeta added in v0.1.97

func (c *Copilot) PersistMeta(ctx context.Context, draft *Draft) error

func (*Copilot) PersistSkill added in v0.1.97

func (c *Copilot) PersistSkill(ctx context.Context, draftID, content string) error

func (*Copilot) PersistStatus added in v0.1.97

func (c *Copilot) PersistStatus(ctx context.Context, draftID, status string) error

type Draft added in v0.1.97

type Draft struct {
	ID           string         `json:"id"`
	WorkspaceID  string         `json:"workspace_id"`
	Status       string         `json:"status"` // "active", "installed", "discarded"
	SkillContent string         `json:"skill_content"`
	Messages     []DraftMessage `json:"messages"`
	CreatedAt    int64          `json:"created_at"`
	UpdatedAt    int64          `json:"updated_at"`
}

type DraftIndexEntry added in v0.1.97

type DraftIndexEntry struct {
	Type        string `json:"type"` // "created" or "installed"
	DraftID     string `json:"draft_id"`
	Description string `json:"description,omitempty"`
	SkillName   string `json:"skill_name,omitempty"`
	Timestamp   int64  `json:"ts"`
}

DraftIndexEntry is appended to the workspace-level index stream.

type DraftMessage added in v0.1.97

type DraftMessage struct {
	Role      string `json:"role"` // "user" or "assistant"
	Content   string `json:"content"`
	Timestamp int64  `json:"ts"`
}

type DraftSummary added in v0.1.97

type DraftSummary struct {
	ID          string `json:"id"`
	Status      string `json:"status"`
	SkillName   string `json:"skill_name,omitempty"`
	Description string `json:"description,omitempty"`
	CreatedAt   int64  `json:"created_at"`
	UpdatedAt   int64  `json:"updated_at"`
}

DraftSummary is the API representation of a draft for listing.

type InstalledSkill

type InstalledSkill struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Needs       []string `json:"needs"`
	Source      string   `json:"source"` // where the skill was installed from (airstore://, github.com/, or local path)
}

InstalledSkill holds runtime info about an installed skill.

func ReadInstalledMeta

func ReadInstalledMeta(skillDir string) (*InstalledSkill, error)

ReadInstalledMeta loads the installed skill metadata from a directory.

type ManagedSkillStorage added in v0.1.71

type ManagedSkillStorage interface {
	WorkspaceBucketName(workspaceExternalId string) string
	Upload(ctx context.Context, bucket, key string, data []byte) error
	ListObjects(ctx context.Context, bucket, prefix string, maxKeys int32) (*s3.ListObjectsV2Output, error)
	Delete(ctx context.Context, bucket, key string) error
}

type PartialSkillDraftResponse added in v0.1.97

type PartialSkillDraftResponse struct {
	Message      string
	SkillContent string
}

PartialSkillDraftResponse is a simplified view of a streaming chunk for API consumers.

type SkillManifest

type SkillManifest struct {
	Name          string         `yaml:"name"`
	Description   string         `yaml:"description"`
	License       string         `yaml:"license,omitempty"`
	Compatibility string         `yaml:"compatibility,omitempty"`
	Metadata      map[string]any `yaml:"metadata,omitempty"`
	AllowedTools  string         `yaml:"allowed-tools,omitempty"`
}

SkillManifest represents the parsed frontmatter of a SKILL.md file, aligned with the Agent Skills specification (https://agentskills.io/specification).

func InstallContent added in v0.1.103

func InstallContent(
	ctx context.Context,
	storage workspaceSkillStore,
	workspaceExternalID string,
	requestedName string,
	content []byte,
) (*SkillManifest, string, error)

func Parse

func Parse(data []byte) (*SkillManifest, error)

Parse extracts a SkillManifest from the YAML frontmatter of a SKILL.md file.

The format follows the Agent Skills specification (https://agentskills.io/specification):

---
name: email-triage
description: Categorizes emails by urgency. Use when processing Gmail inbox.
license: MIT
metadata:
  author: beam-cloud
  version: "1.0"
  airstore:
    needs:
      - gmail
    writes:
      - /reports/email-triage/
---

# Instructions
...

func ParseFile

func ParseFile(path string) (*SkillManifest, string, error)

ParseFile reads a SKILL.md file and returns its manifest and full content.

func ResolveInstallName added in v0.1.103

func ResolveInstallName(requestedName string, content []byte) (*SkillManifest, string, error)

func (*SkillManifest) AirstoreMetadata

func (m *SkillManifest) AirstoreMetadata() *AirstoreSkillMeta

AirstoreMetadata returns Airstore-specific extensions from metadata.airstore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL