2026-03-22 15:34:01 +02:00
|
|
|
from typing import Any, Literal, Optional
|
2026-03-14 09:42:05 +00:00
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
2026-03-15 15:51:18 +00:00
|
|
|
MAX_MEMORY_CHARS = 800
|
|
|
|
|
|
|
|
|
|
|
2026-03-14 09:42:05 +00:00
|
|
|
class MemoryStore(BaseModel):
|
2026-03-15 15:51:18 +00:00
|
|
|
content: str = Field(..., max_length=MAX_MEMORY_CHARS)
|
2026-03-14 09:42:05 +00:00
|
|
|
category: str = "facts"
|
|
|
|
|
tags: str = ""
|
|
|
|
|
expanded_keywords: str = ""
|
|
|
|
|
importance: float = Field(default=0.5, ge=0.0, le=1.0)
|
|
|
|
|
force_sensitive: bool = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemoryRecall(BaseModel):
|
|
|
|
|
context: str
|
|
|
|
|
expanded_query: str = ""
|
|
|
|
|
category: Optional[str] = None
|
|
|
|
|
sort_by: str = "importance"
|
|
|
|
|
limit: int = 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemoryResponse(BaseModel):
|
|
|
|
|
id: int
|
|
|
|
|
category: str
|
|
|
|
|
importance: float
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SecretResponse(BaseModel):
|
|
|
|
|
id: int
|
|
|
|
|
content: str
|
|
|
|
|
source: str # "vault", "encrypted", "plaintext"
|
2026-03-14 12:42:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class SyncResponse(BaseModel):
|
|
|
|
|
memories: list[dict[str, Any]]
|
|
|
|
|
server_time: str
|
2026-03-22 15:34:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class ShareMemory(BaseModel):
|
|
|
|
|
shared_with: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
permission: Literal["read", "write"] = "read"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ShareTag(BaseModel):
|
|
|
|
|
tag: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
shared_with: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
permission: Literal["read", "write"] = "read"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnshareTag(BaseModel):
|
|
|
|
|
tag: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
shared_with: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemoryUpdate(BaseModel):
|
|
|
|
|
content: Optional[str] = Field(None, max_length=MAX_MEMORY_CHARS)
|
|
|
|
|
tags: Optional[str] = None
|
|
|
|
|
importance: Optional[float] = Field(None, ge=0.0, le=1.0)
|
|
|
|
|
expanded_keywords: Optional[str] = None
|