This commit is contained in:
@@ -140,6 +140,7 @@ History search (`q`) notes:
|
||||
|
||||
### `GET /v1/chats`
|
||||
- Response: `{ "chats": ChatSummary[] }`
|
||||
- Optional `limit` (1–100) and opaque `cursor` return `{ "chats": ChatSummary[], "nextCursor": string | null }` in `updatedAt` descending order. Follow `nextCursor` until `null` to list all ordinary chats; paged results omit chat system-prompt/tool settings.
|
||||
|
||||
### `POST /v1/chats`
|
||||
- Body:
|
||||
@@ -233,6 +234,11 @@ Behavior notes:
|
||||
### `GET /v1/chats/:chatId`
|
||||
- Response: `{ "chat": ChatDetail }`
|
||||
|
||||
### `GET /v1/chats/:chatId/messages`
|
||||
- Requires the same authenticated owner/admin credential as other chat routes. Responses use `Cache-Control: no-store`.
|
||||
- Optional `limit` (1–100, default 50) and opaque `cursor` return `{ "chatId": string, "messages": VisibleChatMessage[], "nextCursor": string | null }`. Follow `nextCursor` until `null`; pages use ascending `(createdAt, id)` order and advance across hidden rows.
|
||||
- `VisibleChatMessage` includes only user/assistant `id`, `createdAt`, `role`, `content`, optional `name`, full supported `attachments`, and `agentAside: true` when the backend marked that row as an Agent aside. System messages, tool messages/call logs, and unrelated message metadata are excluded. Image data and full text attachment content are retained.
|
||||
|
||||
### `POST /v1/chats/:chatId/messages`
|
||||
- Body:
|
||||
```json
|
||||
@@ -275,10 +281,12 @@ Notes:
|
||||
```json
|
||||
{
|
||||
"chatId": "optional-chat-id",
|
||||
"clientRequestId": "optional-client-generated-id",
|
||||
"provider": "openai|anthropic|xai|gemini|hermes-agent",
|
||||
"model": "string",
|
||||
"messages": [
|
||||
{
|
||||
"id": "optional-existing-message-id",
|
||||
"role": "system|user|assistant|tool",
|
||||
"content": "string",
|
||||
"name": "optional",
|
||||
@@ -323,6 +331,12 @@ Notes:
|
||||
|
||||
Behavior notes:
|
||||
- If `chatId` is present, server validates chat existence.
|
||||
- `clientRequestId` is an optional stable identifier for retries of a persisted inline Agent completion.
|
||||
- For a persisted ordinary chat, a literal case-insensitive `@sybil` token in the latest user message invokes the existing persistent Sybil Agent instead of the selected provider for that turn. Email addresses, code spans/fences, indented code, and Markdown quote lines do not trigger it. The message and Agent reply remain visible in the chat; both are marked as Agent asides and are excluded by the backend from later selected-provider conversation history. The Agent root request is not projected into the visible Agent transcript.
|
||||
- The completion response identifies an inline Agent reply with `provider: "hermes-agent"`, `model: "sybil-agent"`, and `message.name: "Sybil Agent"`, `message.agentAside: true`.
|
||||
- Agent asides are identified by backend-stored `metadata.agentAside`, not client-supplied metadata. The ordinary-chat list/history APIs above support Agent tools reading the complete visible thread, including prior asides and attachment data, with cursor pagination.
|
||||
- Before the Agent is invoked, the backend paginates and supplies the complete safe visible-thread projection as required initial context; the Agent does not have to choose `read_chat_history` for the current thread. User/assistant asides and full supported attachment representations are included, while system/tool rows and unrelated metadata are excluded. Historical content remains untrusted context, not new authority.
|
||||
- The initial context transfer is limited to 30 MiB. A stored text attachment marked truncated, incomplete history, or a transfer/provider context-limit failure returns an explicit error and no answer from partial history; providers may reject a complete thread that exceeds their model context window.
|
||||
- For `chatId` calls, server stores only *new* non-assistant messages from provided history to avoid duplicates.
|
||||
- `additionalSystemPrompt`, when present directly or loaded from stored chat settings, is prepended to the provider request as a `system` message and is not inserted into the persisted chat transcript by this endpoint.
|
||||
- `enabledTools` limits Sybil-managed tools for this request. When omitted for a saved chat, the stored chat setting is used; otherwise all available tools are enabled by default. An empty array disables Sybil-managed tools.
|
||||
|
||||
@@ -28,6 +28,7 @@ Authentication:
|
||||
"model": "string",
|
||||
"messages": [
|
||||
{
|
||||
"id": "optional-existing-message-id",
|
||||
"role": "system|user|assistant|tool",
|
||||
"content": "string",
|
||||
"name": "optional",
|
||||
@@ -72,6 +73,9 @@ Notes:
|
||||
- `enabledTools` limits Sybil-managed tools for this request. When omitted for a saved chat, the stored chat setting is used; otherwise all available tools are enabled by default. An empty array disables Sybil-managed tools.
|
||||
- `maxTokens` is optional. For `anthropic`, when omitted the backend requests the selected model's maximum output token limit from Anthropic's Models API and uses that as `max_tokens`; if the model limit cannot be loaded, the fallback is 128000. For other providers, omitted `maxTokens` is not sent as an explicit cap.
|
||||
- Attachments are optional and are persisted under `message.metadata.attachments` on stored user messages when `persist` is `true`.
|
||||
- For a persisted ordinary chat, a literal case-insensitive `@sybil` token in the latest user message invokes the existing persistent Sybil Agent instead of the selected provider. Email addresses, code spans/fences, indented code, and Markdown quote lines do not trigger it. The visible user message and inline Agent reply remain in the ordinary chat and are marked with backend-owned `metadata.agentAside`; the backend excludes both from later selected-provider context without deleting the visible rows. This routing does not apply to the special Agent tab or Quick Questions.
|
||||
- The `meta` event for an inline Agent reply contains `provider: "hermes-agent"`, `model: "sybil-agent"`, and `agentAside: true`. The selected ordinary provider is not run for that turn. Clients should render the response with the existing Sybil Agent identity and retain aside metadata on the optimistic streaming message until the canonical REST refresh.
|
||||
- Before the Agent request starts, the backend loads every page of the safe visible thread and sends it as required initial context, including previous asides and supported attachment contents. This is not an optional `read_chat_history` tool call. Hidden system/tool rows and unrelated metadata are excluded; transcript data is untrusted context. If history/attachment projection is incomplete or exceeds the 30 MiB transfer limit, or the Agent model rejects the complete context, the stream reports an error and emits no partial-context answer.
|
||||
|
||||
Persisted chat streams with a `chatId` are backend-owned active runs:
|
||||
- Once started, the backend keeps the stream running even if the HTTP client disconnects or refreshes.
|
||||
|
||||
Reference in New Issue
Block a user