feat(web,hub): export session conversation (#808)

* test: reproduce issue #793

* fix: add session conversation export (closes #793)

* fix(hub): sort session export by display time for invoked scheduled messages

Export now uses COALESCE(invoked_at, created_at) ordering so JSON/Markdown
exports match the visible chat chronology after scheduled messages are invoked.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web): escape newlines in session export YAML front matter

Prevent session metadata containing newlines or quotes from breaking
Markdown export front matter.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SSU-WEI HUANG
2026-06-05 21:40:59 +08:00
committed by GitHub
co-authored by Cursor
parent dbc9646d06
commit f086949a8a
18 changed files with 901 additions and 3 deletions
+8
View File
@@ -19,6 +19,7 @@ import type {
SkillsResponse,
SpawnResponse,
VisibilityPayload,
HapiSessionExport,
SessionResponse,
SessionsResponse
} from '@/types/api'
@@ -241,6 +242,13 @@ export class ApiClient {
return await this.request<SessionResponse>(`/api/sessions/${encodeURIComponent(sessionId)}`)
}
async getSessionExport(sessionId: string, options?: { signal?: AbortSignal }): Promise<HapiSessionExport> {
return await this.request<HapiSessionExport>(
`/api/sessions/${encodeURIComponent(sessionId)}/export`,
{ signal: options?.signal }
)
}
async getMessages(
sessionId: string,
options: {