mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
* 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>
19 lines
660 B
TypeScript
19 lines
660 B
TypeScript
import { z } from 'zod'
|
|
import { DecryptedMessageSchema, SessionSchema } from './schemas'
|
|
|
|
export const HAPI_SESSION_EXPORT_SCHEMA_VERSION = 1
|
|
export const SESSION_EXPORT_MESSAGE_LIMIT = 20_000
|
|
|
|
export const HapiSessionExportSchema = z.object({
|
|
schemaVersion: z.literal(HAPI_SESSION_EXPORT_SCHEMA_VERSION),
|
|
exportedAt: z.number().int().nonnegative(),
|
|
session: SessionSchema,
|
|
messages: z.array(DecryptedMessageSchema)
|
|
})
|
|
|
|
export type HapiSessionExport = z.infer<typeof HapiSessionExportSchema>
|
|
|
|
export type HapiSessionExportResult =
|
|
| { type: 'success'; payload: HapiSessionExport }
|
|
| { type: 'too-large'; count: number; limit: number }
|