feat(chat): add the chat module to the archie binary (#2018)

Conversations are the chat module's own tables. A turn is stored before it
is acknowledged, runs after the turns before it in its session, and records
everything it streams, so a reader replays it from a cursor. The agent uses
the configured agent model, the same connector tools as a run and the
dashboard's own reads; every action is judged, and one judgement holds is
put to people through approvals and run once when approved. A restart fails
the turns it interrupted visibly and never restarts a started action.

Conversation memory is a set of notes in the memory module. The chat
prompts are copied from internal/prompts (chat-system.tmpl, soul.md,
session-title.md) into internal/platform/prompts while the gateway still
reads them; the tool parameter redaction is copied from
internal/domain/messaging/tool_parameters.go.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
samandCopilot committed 2026-11-19 19:40:44 +11:00
1 parent a0d14090ef
commit cbfcd43018
21 files changed
+2863 -8

No files matched your search

+437
View File
@@ -76,6 +76,183 @@ components:
truncated:
type: boolean
type: object
ChatActionDone:
additionalProperties: false
properties:
request_id:
type: string
result:
type: string
state:
type: string
required:
- request_id
- state
type: object
ChatApproval:
additionalProperties: false
properties:
action:
type: string
deadline:
format: date-time
type: string
level:
type: string
request_id:
type: string
summary:
type: string
required:
- request_id
- action
- summary
- level
- deadline
type: object
ChatNavigation:
additionalProperties: false
properties:
label:
type: string
path:
type: string
required:
- path
- label
type: object
ChatSession:
additionalProperties: false
properties:
created_at:
format: date-time
type: string
session_id:
type: string
title:
type: string
updated_at:
format: date-time
type: string
required:
- session_id
- title
- created_at
- updated_at
type: object
ChatSessions:
additionalProperties: false
properties:
active_model:
type: string
model_error:
type: string
sessions:
items:
$ref: "#/components/schemas/ChatSession"
type:
- array
- "null"
required:
- sessions
- active_model
type: object
ChatToolCall:
additionalProperties: false
properties:
duration_ms:
format: int64
type: integer
failed:
type: boolean
id:
type: string
name:
type: string
parameters:
type: string
text:
type: string
text_offset:
format: int64
type: integer
required:
- id
- name
- parameters
- text
- duration_ms
- text_offset
type: object
ChatTurn:
additionalProperties: false
properties:
actions:
items:
$ref: "#/components/schemas/ChatActionDone"
type:
- array
- "null"
approvals:
items:
$ref: "#/components/schemas/ChatApproval"
type:
- array
- "null"
created_at:
format: date-time
type: string
error:
type: string
finished_at:
format: date-time
type:
- string
- "null"
id:
type: string
navigate:
items:
$ref: "#/components/schemas/ChatNavigation"
type:
- array
- "null"
page:
type: string
page_label:
type: string
reasoning:
type: string
reply:
type: string
seq:
format: int64
type: integer
session_id:
type: string
state:
type: string
text:
type: string
tool_calls:
items:
$ref: "#/components/schemas/ChatToolCall"
type:
- array
- "null"
required:
- id
- session_id
- seq
- state
- text
- reply
- tool_calls
- approvals
- actions
- navigate
- created_at
type: object
ConnectorsAcceptRequest:
additionalProperties: false
properties:
@@ -1438,6 +1615,15 @@ components:
required:
- body
type: object
RenameInputBody:
additionalProperties: false
properties:
title:
maxLength: 120
type: string
required:
- title
type: object
RunsActionTrail:
additionalProperties: false
properties:
@@ -1889,6 +2075,21 @@ components:
writeOnly:
type: boolean
type: object
SendInputBody:
additionalProperties: false
properties:
page:
maxLength: 500
type: string
page_label:
maxLength: 200
type: string
text:
minLength: 1
type: string
required:
- text
type: object
SystemAdminToken:
additionalProperties: false
properties:
@@ -2029,6 +2230,242 @@ paths:
summary: Approve or refuse an action as the bootstrap admin
tags:
- Approvals
/api/chat/sessions:
get:
operationId: list-chat-sessions
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatSessions"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List conversations, most recently active first, with the model that answers
tags:
- Chat
post:
operationId: create-chat-session
responses:
"201":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatSession"
description: Created
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Start a conversation
tags:
- Chat
/api/chat/sessions/{id}:
delete:
operationId: delete-chat-session
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Delete a conversation and its turns
tags:
- Chat
patch:
operationId: rename-chat-session
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RenameInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatSession"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Rename a conversation
tags:
- Chat
/api/chat/sessions/{id}/turns:
get:
operationId: list-chat-turns
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
"200":
content:
application/json:
schema:
items:
$ref: "#/components/schemas/ChatTurn"
type:
- array
- "null"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List a conversation's turns with what each did
tags:
- Chat
post:
operationId: send-chat-turn
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SendInputBody"
required: true
responses:
"202":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatTurn"
description: Accepted
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Send a message; it is stored, then answered after the turns before it
tags:
- Chat
/api/chat/turns/{id}:
get:
operationId: get-chat-turn
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatTurn"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Get one turn with what it did
tags:
- Chat
/api/chat/turns/{id}/cancel:
post:
operationId: cancel-chat-turn
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ChatTurn"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Stop a turn that is queued or running
tags:
- Chat
/api/chat/turns/{id}/events:
get:
operationId: stream-chat-turn
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
- description: Only events after this seq; every event by default
explode: false
in: query
name: after
schema:
description: Only events after this seq; every event by default
type: string
responses:
"200":
content:
text/event-stream:
schema:
type: string
description: "Server-sent events, one data frame per recorded event: {\"seq\", \"type\", ...}. Types are reasoning, delta, tool, navigate, approval, action, done, error and cancelled; the stream ends after done, error or cancelled."
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Stream what a turn records, from a cursor, until it ends
tags:
- Chat
/api/classes:
get:
operationId: list-classes