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>
346 lines
7.0 KiB
Python
346 lines
7.0 KiB
Python
"""Pydantic response models — the OpenAPI schema for the read endpoints.
|
|
|
|
These are **documentation-only**: they are attached to the routes via
|
|
``responses={200: {"model": …}}`` (see ``main.py``), never as ``response_model``.
|
|
FastAPI therefore serves them in ``/openapi.json`` but does **not** validate or
|
|
filter the actual returned dicts through them — so a model that drifts from the
|
|
real payload can only produce a wrong TypeScript type (caught by ``tsc``), never
|
|
a silent runtime regression.
|
|
|
|
They mirror ``frontend/src/types.ts`` field-for-field; fields are intentionally
|
|
**camelCase** (matching the JSON the handlers already emit) so Orval generates
|
|
property names identical to the hand-written types they replace. Class names
|
|
match the TS interface names so the generated model names line up 1:1.
|
|
|
|
The package has one module per section of the API (``conversations``,
|
|
``projects``, ``cron``, …); every model is re-exported here so handlers keep
|
|
writing ``schemas.ConversationDetail``.
|
|
"""
|
|
from .base import (
|
|
Schema,
|
|
AccountSplit,
|
|
)
|
|
from .files import (
|
|
FileKind,
|
|
FileEntry,
|
|
Pricing,
|
|
Totals,
|
|
Bundle,
|
|
SkillStat,
|
|
DashboardTotals,
|
|
TopFile,
|
|
Dashboard,
|
|
)
|
|
from .activity import (
|
|
ActivityDay,
|
|
ActivityModel,
|
|
ActivityTotals,
|
|
ActivityResponse,
|
|
)
|
|
from .skills import (
|
|
SkillSummary,
|
|
SkillsTotals,
|
|
SkillsResponse,
|
|
)
|
|
from .conversations import (
|
|
ToolUsage,
|
|
ConvNotification,
|
|
WorktreeInfo,
|
|
ForkedFrom,
|
|
CronRef,
|
|
AgentRunRef,
|
|
ConvMeta,
|
|
ConvSummary,
|
|
Usage,
|
|
SubagentRef,
|
|
SubagentListItem,
|
|
SubagentsResponse,
|
|
RunningAgent,
|
|
ParentConvRef,
|
|
Task,
|
|
ConversationSummary,
|
|
ThreadItem,
|
|
TurnUsage,
|
|
MemorySummary,
|
|
ArtefactItem,
|
|
PlanSummary,
|
|
ConversationDetail,
|
|
ConversationsResponse,
|
|
)
|
|
from .notifications import (
|
|
NotifConversation,
|
|
NotificationsResponse,
|
|
FeedNotification,
|
|
UnreadNotificationsResponse,
|
|
Webhook,
|
|
WebhooksResponse,
|
|
MailTriggerSendersResponse,
|
|
DeliveryStatus,
|
|
NotifyResult,
|
|
AskRecord,
|
|
NotifyLogEntry,
|
|
NotifyLogResponse,
|
|
)
|
|
from .forms import (
|
|
FormFieldOption,
|
|
FormField,
|
|
FormRecord,
|
|
FormsResponse,
|
|
)
|
|
from .search import (
|
|
SearchMsg,
|
|
SearchConv,
|
|
SearchIndexResponse,
|
|
MemoryConvRef,
|
|
MemoryDetail,
|
|
MemoriesResponse,
|
|
)
|
|
from .plans import (
|
|
PlanFile,
|
|
PlanStep,
|
|
PlanActual,
|
|
PlanConvRef,
|
|
PlanQuestionForm,
|
|
PlanDetail,
|
|
PlansResponse,
|
|
)
|
|
from .projects import (
|
|
ProjectCostSummary,
|
|
TokenTypeSpend,
|
|
ProjectByType,
|
|
ProjectCostDetail,
|
|
GoalSummary,
|
|
GoalChecklistItem,
|
|
GoalClaim,
|
|
GoalDetail,
|
|
GoalMilestone,
|
|
GoalTheme,
|
|
RunningConversation,
|
|
GoalBoardEntry,
|
|
GoalsResponse,
|
|
ProjectSummary,
|
|
IndexMeta,
|
|
OgImage,
|
|
KeyFile,
|
|
ProjectCommit,
|
|
ProjectDetail,
|
|
ProjectsResponse,
|
|
ProjectEnvVar,
|
|
ProjectEnvResponse,
|
|
TemplateSummary,
|
|
TemplateTreeNode,
|
|
TemplateDetail,
|
|
TemplatesResponse,
|
|
)
|
|
from .services import (
|
|
ServiceSummary,
|
|
ServiceVolume,
|
|
ServiceContainer,
|
|
ServiceRouter,
|
|
TraefikService,
|
|
ServiceTreeNode,
|
|
HomepageMeta,
|
|
ServiceDetail,
|
|
ServicesResponse,
|
|
)
|
|
from .misc import (
|
|
UiStateValue,
|
|
OkResponse,
|
|
ModelInfo,
|
|
ModelsResponse,
|
|
PendingLogin,
|
|
AccountStatus,
|
|
LoginCodeResult,
|
|
Account,
|
|
AccountsResponse,
|
|
Worker,
|
|
WorkersResponse,
|
|
OpenRouterModel,
|
|
OpenRouterModelsResponse,
|
|
SpawnResult,
|
|
InterruptResult,
|
|
UploadedFile,
|
|
UploadResult,
|
|
ConversationMetaResponse,
|
|
MetaUpdateResult,
|
|
ArchiveOldResult,
|
|
DeployStep,
|
|
DeployStatus,
|
|
)
|
|
from .diff import (
|
|
CommitRef,
|
|
ConversationCommits,
|
|
DiffLine,
|
|
DiffHunk,
|
|
FileDiff,
|
|
WorktreeRef,
|
|
DiffResult,
|
|
)
|
|
from .cron import (
|
|
CronRun,
|
|
CronRunConfig,
|
|
CronJob,
|
|
CronJobsResponse,
|
|
CronPromptFile,
|
|
)
|
|
from .agents import (
|
|
AgentSummary,
|
|
AgentsTotals,
|
|
AgentsResponse,
|
|
AgentRun,
|
|
AgentDay,
|
|
AgentDetail,
|
|
ClaudeHookEntry,
|
|
ClaudeHooksResponse,
|
|
)
|
|
|
|
__all__ = [
|
|
"Schema",
|
|
"AccountSplit",
|
|
"FileKind",
|
|
"FileEntry",
|
|
"Pricing",
|
|
"Totals",
|
|
"Bundle",
|
|
"SkillStat",
|
|
"DashboardTotals",
|
|
"TopFile",
|
|
"Dashboard",
|
|
"ActivityDay",
|
|
"ActivityModel",
|
|
"ActivityTotals",
|
|
"ActivityResponse",
|
|
"SkillSummary",
|
|
"SkillsTotals",
|
|
"SkillsResponse",
|
|
"ToolUsage",
|
|
"ConvNotification",
|
|
"WorktreeInfo",
|
|
"ForkedFrom",
|
|
"CronRef",
|
|
"AgentRunRef",
|
|
"ConvMeta",
|
|
"ConvSummary",
|
|
"Usage",
|
|
"SubagentRef",
|
|
"SubagentListItem",
|
|
"SubagentsResponse",
|
|
"RunningAgent",
|
|
"ParentConvRef",
|
|
"Task",
|
|
"ConversationSummary",
|
|
"ThreadItem",
|
|
"TurnUsage",
|
|
"MemorySummary",
|
|
"ArtefactItem",
|
|
"PlanSummary",
|
|
"ConversationDetail",
|
|
"ConversationsResponse",
|
|
"NotifConversation",
|
|
"NotificationsResponse",
|
|
"FeedNotification",
|
|
"UnreadNotificationsResponse",
|
|
"Webhook",
|
|
"WebhooksResponse",
|
|
"MailTriggerSendersResponse",
|
|
"DeliveryStatus",
|
|
"NotifyResult",
|
|
"AskRecord",
|
|
"NotifyLogEntry",
|
|
"NotifyLogResponse",
|
|
"FormFieldOption",
|
|
"FormField",
|
|
"FormRecord",
|
|
"FormsResponse",
|
|
"SearchMsg",
|
|
"SearchConv",
|
|
"SearchIndexResponse",
|
|
"MemoryConvRef",
|
|
"MemoryDetail",
|
|
"MemoriesResponse",
|
|
"PlanFile",
|
|
"PlanStep",
|
|
"PlanActual",
|
|
"PlanConvRef",
|
|
"PlanQuestionForm",
|
|
"PlanDetail",
|
|
"PlansResponse",
|
|
"ProjectCostSummary",
|
|
"TokenTypeSpend",
|
|
"ProjectByType",
|
|
"ProjectCostDetail",
|
|
"GoalSummary",
|
|
"GoalChecklistItem",
|
|
"GoalClaim",
|
|
"GoalDetail",
|
|
"GoalMilestone",
|
|
"GoalTheme",
|
|
"RunningConversation",
|
|
"GoalBoardEntry",
|
|
"GoalsResponse",
|
|
"ProjectSummary",
|
|
"IndexMeta",
|
|
"OgImage",
|
|
"KeyFile",
|
|
"ProjectCommit",
|
|
"ProjectDetail",
|
|
"ProjectsResponse",
|
|
"ProjectEnvVar",
|
|
"ProjectEnvResponse",
|
|
"TemplateSummary",
|
|
"TemplateTreeNode",
|
|
"TemplateDetail",
|
|
"TemplatesResponse",
|
|
"ServiceSummary",
|
|
"ServiceVolume",
|
|
"ServiceContainer",
|
|
"ServiceRouter",
|
|
"TraefikService",
|
|
"ServiceTreeNode",
|
|
"HomepageMeta",
|
|
"ServiceDetail",
|
|
"ServicesResponse",
|
|
"UiStateValue",
|
|
"OkResponse",
|
|
"ModelInfo",
|
|
"ModelsResponse",
|
|
"PendingLogin",
|
|
"AccountStatus",
|
|
"LoginCodeResult",
|
|
"Account",
|
|
"AccountsResponse",
|
|
"Worker",
|
|
"WorkersResponse",
|
|
"OpenRouterModel",
|
|
"OpenRouterModelsResponse",
|
|
"SpawnResult",
|
|
"InterruptResult",
|
|
"UploadedFile",
|
|
"UploadResult",
|
|
"ConversationMetaResponse",
|
|
"MetaUpdateResult",
|
|
"ArchiveOldResult",
|
|
"DeployStep",
|
|
"DeployStatus",
|
|
"CommitRef",
|
|
"ConversationCommits",
|
|
"DiffLine",
|
|
"DiffHunk",
|
|
"FileDiff",
|
|
"WorktreeRef",
|
|
"DiffResult",
|
|
"CronRun",
|
|
"CronRunConfig",
|
|
"CronJob",
|
|
"CronJobsResponse",
|
|
"CronPromptFile",
|
|
"AgentSummary",
|
|
"AgentsTotals",
|
|
"AgentsResponse",
|
|
"AgentRun",
|
|
"AgentDay",
|
|
"AgentDetail",
|
|
"ClaudeHookEntry",
|
|
"ClaudeHooksResponse",
|
|
]
|