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>
95 lines
1.9 KiB
Python
95 lines
1.9 KiB
Python
"""Workspace files / bundle and the files dashboard."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Literal, Optional
|
|
|
|
from .base import Schema
|
|
|
|
__all__ = [
|
|
"FileKind",
|
|
"FileEntry",
|
|
"Pricing",
|
|
"Totals",
|
|
"Bundle",
|
|
"SkillStat",
|
|
"DashboardTotals",
|
|
"TopFile",
|
|
"Dashboard",
|
|
]
|
|
|
|
|
|
FileKind = Literal["claude-md", "skill-md", "markdown", "script", "config", "other"]
|
|
|
|
|
|
# ── files / bundle ────────────────────────────────────────────────────────────
|
|
class FileEntry(Schema):
|
|
path: str
|
|
name: str
|
|
ext: str
|
|
kind: FileKind
|
|
isMarkdown: bool
|
|
bytes: int
|
|
words: int
|
|
chars: int
|
|
tokens: int
|
|
cost: float
|
|
estimated: bool
|
|
editable: bool
|
|
content: Optional[str] = None
|
|
|
|
|
|
class Pricing(Schema):
|
|
model: str
|
|
inputPerMTok: float
|
|
|
|
|
|
class Totals(Schema):
|
|
files: int
|
|
mdFiles: int
|
|
words: int
|
|
chars: int
|
|
tokens: int
|
|
cost: float
|
|
estimated: int
|
|
|
|
|
|
class Bundle(Schema):
|
|
workspace: str
|
|
totals: Totals
|
|
files: list[FileEntry]
|
|
pricing: Pricing
|
|
|
|
|
|
# ── dashboard ─────────────────────────────────────────────────────────────────
|
|
class SkillStat(Schema):
|
|
name: str
|
|
count: int
|
|
lastUsed: Optional[str] = None
|
|
contextTokens: Optional[int] = None
|
|
contextCost: Optional[float] = None
|
|
estSpend: Optional[float] = None
|
|
|
|
|
|
class DashboardTotals(Schema):
|
|
files: int
|
|
tokens: int
|
|
cost: float
|
|
estimated: int
|
|
skills: int
|
|
invocations: int
|
|
skillSpend: float
|
|
|
|
|
|
class TopFile(Schema):
|
|
path: str
|
|
tokens: int
|
|
cost: float
|
|
estimated: bool
|
|
|
|
|
|
class Dashboard(Schema):
|
|
pricing: Pricing
|
|
totals: DashboardTotals
|
|
skills: list[SkillStat]
|
|
topFiles: list[TopFile]
|