Files
ai-agent/backend/schemas/skills.py
Gabriel Vidal 2119af66d5 refactor(schemas): split backend/schemas.py into a schemas/ package
One module per API area (base, files, activity, skills, conversations,
notifications, forms, search, plans, projects, services, misc, diff, cron,
agents) on a shared base.Schema; __init__.py re-exports every model so
handlers keep writing schemas.<Name>. OpenAPI output is byte-identical.
PlanSummary lives in conversations.py to keep the module graph a DAG.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 23:55:47 +02:00

53 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""The skills catalog (``backend/skills.py``)."""
from __future__ import annotations
from typing import Optional
from .base import Schema
__all__ = [
"SkillSummary",
"SkillsTotals",
"SkillsResponse",
]
class SkillSummary(Schema):
"""One skill card: what it is on disk + what its use has cost."""
name: str # the invocation name (its dir name)
title: str # frontmatter `name:`, falls back to `name`
description: str
# None for a built-in/plugin skill: nothing of it lives in this repo, so
# there is no file to link into the editor.
dir: Optional[str] = None
path: Optional[str] = None
source: str # "repo" | <project dir-name> | "builtin"
sourceKind: str # "repo" | "project" | "builtin"
# Frontmatter `trigger_words:` — the words that make the composer's
# auto-tag suggest this skill. Empty for a built-in (no SKILL.md here) and
# for a skill deliberately kept out of auto-tag.
triggerWords: list[str] = []
files: int
updatedAt: Optional[str] = None
count: int # total invocations across all transcripts
lastUsed: Optional[str] = None
conversations: int # distinct conversations that invoked it
contextTokens: Optional[int] = None
contextCost: Optional[float] = None
estSpend: Optional[float] = None # contextCost × count
sessionCost: float # total spend of the conversations using it
sessionTokens: int
class SkillsTotals(Schema):
skills: int
used: int
invocations: int
contextCost: float
estSpend: float
class SkillsResponse(Schema):
skills: list[SkillSummary]
totals: SkillsTotals