Files
openswarm/backend/apps/skills/models.py
T

38 lines
1.2 KiB
Python

from pydantic import BaseModel, Field
from typing import Any, Optional
from uuid import uuid4
class Skill(BaseModel):
id: str = Field(default_factory=lambda: uuid4().hex)
name: str
description: str = ""
content: str
file_path: str = ""
command: str = ""
# Platform-shipped skills (e.g. App Builder): UI hides delete and DELETE returns 409, but content stays editable so users can tune them.
built_in: bool = False
# Multi-file skills live in ~/.claude/skills/<id>/ with a SKILL.md plus supporting files (scripts, templates). dir_path is set for those; empty for a legacy flat <id>.md skill. has_supporting_files flags extra files beyond SKILL.md so the prompt layer knows to point the agent at the folder for on-demand reading.
dir_path: str = ""
has_supporting_files: bool = False
class SkillCreate(BaseModel):
name: str
description: str = ""
content: str
command: str = ""
class SkillUpdate(BaseModel):
name: Optional[str] = None
description: Optional[str] = None
content: Optional[str] = None
command: Optional[str] = None
class SkillWorkspaceSeedRequest(BaseModel):
workspace_id: str
skill_content: Optional[str] = None
meta: Optional[dict[str, Any]] = None