Chat info: Session section with native id, resume command and export

The chat information sheet gains a Session section: the harness's native
session id (copy), harness, directory, a verified resume command (copy)
and Export conversation (Markdown), Export JSON and, for Claude Code,
Export native session (the JSONL transcript).

Server: chat_sessions rows carry resume_command and native_export; new
chat_export command builds Markdown/JSON from the same paged history
chat_messages serves (bounded at 8 MiB), refuses non-operator sessions.
App: exports go through the artifact file bridge (web download, share
sheet on phones).
This commit is contained in:
2026-11-03 10:59:41 +00:00
parent 6413fc5a90
commit 1de74f76bb
19 changed files with 1552 additions and 10 deletions
+41
View File
@@ -43,6 +43,12 @@ const (
// ChatRename records the operator's shared chat title on the server. Unlike
// a local override, every browser and device then lists the same name.
ChatRename = "chat_rename"
// ChatExport returns one operator chat as a file the client saves or
// shares. The body is ChatExportRequest and the reply carries
// ChatExportFile: a Markdown or JSON transcript built from the same history
// chat_messages serves, or the harness's own session file where one exists
// (ChatSession.NativeExport).
ChatExport = "chat_export"
// ChatBackends lists the installed chat harnesses the server can create a
// session on. The reply is a bounded array of backend names.
ChatBackends = "chat_backends"
@@ -280,6 +286,41 @@ type ChatSession struct {
// epoch-millisecond time it was set, 0 while unstarred.
Starred bool `json:"starred,omitempty"`
StarredAt int64 `json:"starred_at,omitempty"`
// ResumeCommand is the shell command that continues this session in a
// terminal on the server machine with the harness's own CLI, run in the
// session's directory. ID is the harness's native session id (Claude Code
// session UUID, Codex thread id, OpenCode ses_ id). Empty when the harness
// has no verified resume option.
ResumeCommand string `json:"resume_command,omitempty"`
// NativeExport says chat_export with format "native" can return the
// harness's own session file (today: Claude Code's JSONL transcript).
NativeExport bool `json:"native_export,omitempty"`
}
// Chat export formats accepted by chat_export.
const (
ChatExportMarkdown = "markdown"
ChatExportJSON = "json"
ChatExportNative = "native"
)
// ChatExportRequest is the chat_export body.
type ChatExportRequest struct {
SessionID string `json:"session_id"`
Format string `json:"format"`
}
// ChatExportFile is the chat_export reply: one named, typed text file. Messages
// counts the transcript messages included (0 for a native file). Truncated says
// older history was left out to keep the file within the server's bound.
type ChatExportFile struct {
SessionID string `json:"session_id"`
Format string `json:"format"`
Name string `json:"name"`
Mime string `json:"mime"`
Content string `json:"content"`
Messages int `json:"messages,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
// ChatCloseResult reports the outcome of a chat_close: the session id, the
+3
View File
@@ -203,6 +203,9 @@ type Message struct {
ChatAnswer *ChatAnswerRequest `json:"chat_answer,omitempty"`
// ChatRename is the chat_rename body; the reply echoes the updated session.
ChatRename *ChatRenameRequest `json:"chat_rename,omitempty"`
// ChatExport is the chat_export body and ChatExportFile its reply.
ChatExport *ChatExportRequest `json:"chat_export,omitempty"`
ChatExportFile *ChatExportFile `json:"chat_export_file,omitempty"`
// ChatBackends is the chat_backends reply: the installed harnesses a new
// chat can use.
ChatBackends []string `json:"chat_backends,omitempty"`