Изменение выносит типы контента в :content-api и разделяет потоки событий.
This commit is contained in:
+19
-12
@@ -47,28 +47,35 @@ agentik
|
||||
## 3. `:proto` — интерфейсы
|
||||
|
||||
`Agent` (см. `proto/src/commonMain/.../Agent.kt`):
|
||||
- `id: String`
|
||||
- `id: String`, `info: AgentInfo`
|
||||
- read-only сторы: `journal: JournalStore`, `outbox: OutboxStore`,
|
||||
`onlineOutbox: OnlineOutbox`, `conversationStore: ConversationStore`
|
||||
- `createConversation(temp: Boolean): Conversation`
|
||||
- `suspend getConversation(id): Conversation?`
|
||||
- `suspend getConversations(offset, limit): List<Conversation>`
|
||||
- `getConversations(offset = 0): Flow<Conversation>` — cold-flow paging через suspend-версию, `PAGE_SIZE = 100`.
|
||||
- `events(after: Instant): Flow<AgentEvent>` — replay-free, бэкфилл через snapshot.
|
||||
- `deleteConversation(id): Boolean`
|
||||
- `suspend deleteConversation(id): Boolean`
|
||||
- `suspend renameConversation(id, title): Instant?`
|
||||
|
||||
`Conversation`:
|
||||
- `isSupportImageInput / Output / isTemporal: Boolean`
|
||||
- `isSupportImageInput / Output / isTemporal: Boolean`, `title: String?`
|
||||
- `updatedAt: Instant`
|
||||
- `send(content: List<Content>)` — write-only, ничего не возвращает.
|
||||
- `send(content: List<Content>, context: MessageContext? = null)` — write-only, ничего не возвращает.
|
||||
- `interrupt()` — отмена активного хода.
|
||||
- `events(after): Flow<Event>` — live, replay-free.
|
||||
- `getMessages(after, offset, limit)` + `getMessages(after): Flow<Message>` — paging.
|
||||
- `getMessages(after, offset, limit): List<Message>` — paging.
|
||||
- `rename(title)` — мутация, бампит `updatedAt`.
|
||||
- `AutoCloseable` — `close()` идемпотентен.
|
||||
|
||||
`Content = Text(body) | Image(data, mime)`.
|
||||
`Content = Text(body) | Image(data, mime)` — из `:content-api` (там же `MessageContext`/`MessageOrigin`/`TurnTokens`).
|
||||
`Message = UserMessage | AssistantMessage | ToolCall | ToolResult | Error`.
|
||||
`Event = StartReasoning | StartResponse | End | AppendText | AppendImage | ToolCall | ToolResult | Error`.
|
||||
`AgentEvent = Created(conversationId) | Deleted(id) | Renamed(id, title)`.
|
||||
|
||||
События разделены на два потока (оба в `:outbox-api`):
|
||||
- **durable** `Event` (`outbox.conversationEvents(after, id)`): `UserMessage |
|
||||
AssistantMessage | ToolCall | ToolResult | ToolFailed | Interrupted | Error |
|
||||
ConversationClosing | CompactionTriggered` — перезапрашиваются по курсору;
|
||||
- **online** `OnlineEvent` (`onlineOutbox.onlineEvents(id)`): `Working | End |
|
||||
StartReasoning | StartResponse | AppendText | AppendImage` — live-only,
|
||||
никогда не сохраняются.
|
||||
|
||||
`AgentEvent = Created(conversationId) | Deleted(id) | Renamed(id, title) | Touched(...)`.
|
||||
|
||||
Принцип: **агент — источник истины** для транскрипта и сессий. Клиент
|
||||
лишь рендерит Event-stream и кэширует историю.
|
||||
|
||||
Reference in New Issue
Block a user