Files
ai-agent/backend/schemas/skills.py
Gabriel Vidal a76cce0c71 feat(users): guest defaults — starting shortcuts + skills shared with guest runs
The owner sets, for every guest at once (users.json guestDefaults):
- promptShortcuts: what a guest's composer starts with. A guest who never
  saved settings gets them as the seed of their ai-agent-settings ui-state.
- sharedSkills: lab/project skills handed to every guest run. The scope
  carries them to the host sidecar, which symlinks them into a generated
  plugin and passes --plugin-dir: they show up as shared:<name>.

GET/PUT /api/guest-defaults (owner), GET /api/guest-skills (the composer's
mentions: shared + granted projects' skills), shareRef/sharedWithGuests on
the skills catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:20:10 +02:00

57 lines
2.0 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
# How the guest-sharing list names it: `name` (repo) or `<project>/<name>`.
# None for a built-in — there's no dir to hand a guest run.
shareRef: Optional[str] = None
sharedWithGuests: bool = False # in Settings → Users' shared-skills list
class SkillsTotals(Schema):
skills: int
used: int
invocations: int
contextCost: float
estSpend: float
class SkillsResponse(Schema):
skills: list[SkillSummary]
totals: SkillsTotals