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>
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
"""The two transcript indexes: full-text search and memories."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Literal, Optional
|
|
|
|
from .base import Schema
|
|
from .conversations import ConvMeta, MemorySummary
|
|
|
|
__all__ = [
|
|
"SearchMsg",
|
|
"SearchConv",
|
|
"SearchIndexResponse",
|
|
"MemoryConvRef",
|
|
"MemoryDetail",
|
|
"MemoriesResponse",
|
|
]
|
|
|
|
|
|
# ── full-text search index ────────────────────────────────────────────────────
|
|
class SearchMsg(Schema):
|
|
i: int
|
|
role: Literal["user", "assistant"]
|
|
text: str
|
|
|
|
|
|
class SearchConv(Schema):
|
|
id: str
|
|
title: str
|
|
project: Optional[str] = None
|
|
model: str
|
|
endedAt: Optional[str] = None
|
|
msgs: list[SearchMsg]
|
|
|
|
|
|
class SearchIndexResponse(Schema):
|
|
conversations: list[SearchConv]
|
|
count: Optional[int] = None
|
|
|
|
|
|
# ── memories ──────────────────────────────────────────────────────────────────
|
|
class MemoryConvRef(Schema):
|
|
id: str
|
|
sessionId: Optional[str] = None
|
|
title: Optional[str] = None
|
|
model: Optional[str] = None
|
|
endedAt: Optional[str] = None
|
|
cost: Optional[float] = None
|
|
tokens: Optional[int] = None
|
|
meta: Optional[ConvMeta] = None
|
|
|
|
|
|
class MemoryDetail(MemorySummary):
|
|
content: str
|
|
createdIn: list[MemoryConvRef]
|
|
readIn: list[MemoryConvRef]
|
|
|
|
|
|
class MemoriesResponse(Schema):
|
|
memories: list[MemorySummary]
|