zettelkasten.dashboard.backend.routes.outline¶
zettelkasten.dashboard.backend.routes.outline ¶
Outline build/stream, violation-fix, and review-outline CRUD routes.
Split out of the former flat routes.py; behaviour is unchanged.
BuildOutlineRequest ¶
Bases: BaseModel
Optional body for the outline build endpoints (all fields default).
Mirrors the build_outline engine signature so a thin POST delegates the
full scope through: name (defaults to the graph/project), the exact
claim_ids to outline (else all claims), an as_of trend replay year,
force to redraft past an unchanged cached signature, and peek for a
cost-free read-only staleness probe (never gathers/drafts/writes).
Source code in zettelkasten/dashboard/backend/routes/outline.py
FixViolationRequest ¶
Bases: BaseModel
Body for POST /reviews/{name}/outline/fix-violation.
Identifies ONE integrity violation in a built scaffold (its kind /
offending ref / 1-based line) and the action to take. "remove"
strips the offending span; "fix" resolves it in place (a chip is
fuzzy-resolved to a real material unit, a quote is replaced with a
verbatim passage re-extracted + re-verified from the section's sources).
outline_id selects which of the review's outlines to edit (empty = the
manifest-backed default).
Source code in zettelkasten/dashboard/backend/routes/outline.py
CreateOutlineRequest ¶
Bases: BaseModel
Body for POST /reviews/{name}/outlines — create an additional outline.
Source code in zettelkasten/dashboard/backend/routes/outline.py
EditOutlineRequest ¶
Bases: BaseModel
Body for PATCH /reviews/{name}/outlines/{outline_id} (all optional).
Source code in zettelkasten/dashboard/backend/routes/outline.py
graph_outline ¶
graph_outline(name: str, req: BuildOutlineRequest | None = None) -> dict
Build the grounded writing-scaffold outline for a single source graph.
Runs GATHER→DRAFT→integrity→durable write via outline.build_outline and
returns {markdown, artifact_path, signature, violations, cached}. The
artifact is a regenerable derived _reviews/<name>.md (the durable
authored state stays the _reviews/<name>.yaml overlay). Federated targets
are a read-only overlay → 403 before any write (mirrors the review POST/PUT).
Source code in zettelkasten/dashboard/backend/routes/outline.py
project_outline ¶
project_outline(name: str, req: BuildOutlineRequest | None = None) -> dict
Build the grounded writing-scaffold outline across a project's sources.
The project companion to graph_outline: resolves the project via
_load_project_or_404 (404 missing / 422 corrupt manifest), then runs
GATHER→DRAFT→integrity→durable write via outline.build_outline and
returns {markdown, artifact_path, signature, violations, cached}.
Federated targets are read-only → 403 before any write.
Source code in zettelkasten/dashboard/backend/routes/outline.py
graph_outline_stream ¶
graph_outline_stream(name: str, req: BuildOutlineRequest | None = None)
Streaming twin of graph_outline (SSE: stage/token/result frames).
The Regenerate path uses this so the scaffold draft streams in live. Guards match the JSON route: 404 unknown source, 403 federated (read-only).
Source code in zettelkasten/dashboard/backend/routes/outline.py
project_outline_stream ¶
project_outline_stream(name: str, req: BuildOutlineRequest | None = None)
Streaming twin of project_outline (SSE: stage/token/result frames).
Source code in zettelkasten/dashboard/backend/routes/outline.py
graph_outline_build
async
¶
graph_outline_build(name: str, req: BuildOutlineRequest | None = None) -> dict
Schedule a durable background outline build for a source graph (fire-and-poll).
Declared async so scheduling never takes the single web-threadpool token.
Guards match the stream route: 404 unknown source, 403 federated (read-only).
Source code in zettelkasten/dashboard/backend/routes/outline.py
project_outline_build
async
¶
project_outline_build(name: str, req: BuildOutlineRequest | None = None) -> dict
Schedule a durable background outline build across a project's sources.
Source code in zettelkasten/dashboard/backend/routes/outline.py
fix_outline_violation_route ¶
fix_outline_violation_route(name: str, req: FixViolationRequest) -> dict
Resolve one integrity violation in a review's scaffold and persist the draft.
The actionable side of the integrity banner: applies a per-violation Fix /
Remove via outline.fix_outline_violation and returns the refreshed
{markdown, violations, resolved, message, …} so the dashboard swaps the
document in exactly like a regenerate/deepen result. Scope is taken from the
review manifest's project/graph. The only write is the durable
artifact write (the same crash-safe path the build uses); a FIX never
fabricates (re-verified against the source), and an unresolved FIX leaves the
draft untouched. Federated (read-only) review → 403; missing → 404 / corrupt
→ 422; a bad action/kind → 400.
Source code in zettelkasten/dashboard/backend/routes/outline.py
list_review_outlines ¶
List a review's outlines (default first, then additional). Read-only.
Source code in zettelkasten/dashboard/backend/routes/outline.py
create_review_outline ¶
create_review_outline(name: str, req: CreateOutlineRequest) -> dict
Create an additional outline under a review (never the default).
Federated targets are read-only → 403. The new outline's ordering is
seeded from the review's projection (themes then claims), mirroring review
creation. Returns the new outline record.
Source code in zettelkasten/dashboard/backend/routes/outline.py
edit_review_outline ¶
edit_review_outline(name: str, outline_id: str, req: EditOutlineRequest) -> dict
Rename and/or re-question an outline (default → patches the review).
Federated targets are read-only → 403. An unknown outline id → 404.
Source code in zettelkasten/dashboard/backend/routes/outline.py
delete_review_outline ¶
Delete an additional outline (the default outline cannot be deleted).
Federated targets are read-only → 403; deleting the default → 400; an unknown id → 404.