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>
78 lines
2.0 KiB
Python
78 lines
2.0 KiB
Python
"""Plans (``data/plans/``, written by the ``plan`` skill). ``PlanSummary`` is
|
|
defined in ``conversations.py`` (see there) and re-exported from the package."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Optional
|
|
|
|
from .base import Schema
|
|
from .conversations import ConvMeta, PlanSummary
|
|
from .forms import FormField
|
|
|
|
__all__ = [
|
|
"PlanFile",
|
|
"PlanStep",
|
|
"PlanActual",
|
|
"PlanConvRef",
|
|
"PlanQuestionForm",
|
|
"PlanDetail",
|
|
"PlansResponse",
|
|
]
|
|
|
|
|
|
class PlanFile(Schema):
|
|
file: str
|
|
change: str
|
|
|
|
|
|
class PlanStep(Schema):
|
|
title: str
|
|
detail: str
|
|
|
|
|
|
class PlanActual(Schema):
|
|
cost: float
|
|
tokens: int
|
|
durationMs: Optional[int] = None
|
|
# {account id: cost} — which Claude account(s) the implementation ran on.
|
|
byAccount: Optional[dict[str, float]] = None
|
|
|
|
|
|
class PlanConvRef(Schema):
|
|
id: str
|
|
sessionId: Optional[str] = None
|
|
title: Optional[str] = None
|
|
model: Optional[str] = None
|
|
startedAt: Optional[str] = None
|
|
endedAt: Optional[str] = None
|
|
cost: Optional[float] = None
|
|
tokens: Optional[int] = None
|
|
durationMs: Optional[int] = None
|
|
meta: Optional[ConvMeta] = None
|
|
|
|
|
|
class PlanQuestionForm(Schema):
|
|
"""The plan's open questions, as an ask-form field spec (the ``## Questions``
|
|
section's fenced JSON). Answered client-side on the plan page — answers live
|
|
in the browser and feed the "implement this plan" prompt."""
|
|
title: str
|
|
description: str
|
|
fields: list[FormField]
|
|
|
|
|
|
class PlanDetail(PlanSummary):
|
|
content: str
|
|
fileList: list[PlanFile]
|
|
stepList: list[PlanStep]
|
|
conversations: list[PlanConvRef]
|
|
actual: Optional[PlanActual] = None
|
|
questionForm: Optional[PlanQuestionForm] = None
|
|
# Persisted question answers (newest submitted plan form for this slug) —
|
|
# also folded into the file's ## Answers section at submit time.
|
|
answers: Optional[dict[str, Any]] = None
|
|
answersAt: Optional[str] = None
|
|
answersFormId: Optional[str] = None
|
|
|
|
|
|
class PlansResponse(Schema):
|
|
plans: list[PlanSummary]
|