Files
ai-agent/backend/schemas/__init__.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

374 lines
7.5 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 .users import (
ProjectGrant,
NotifyPrefs,
Me,
GuestUser,
UsersResponse,
LoginLink,
ShareCandidate,
GuestShortcut,
GuestDefaults,
GuestSkill,
GuestSkillsResponse,
ConversationShare,
)
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,
TurnAuthor,
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",
"TurnAuthor",
"ProjectGrant",
"NotifyPrefs",
"Me",
"GuestUser",
"UsersResponse",
"LoginLink",
"ShareCandidate",
"ConversationShare",
"GuestShortcut",
"GuestDefaults",
"GuestSkill",
"GuestSkillsResponse",
"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",
]