repositories / will
will
owned by bugabinga
src/shared/api.ts
RawFile outline
- TimelineRow line 15
- seq line 16
- id line 17
- ts line 18
- kind line 19
- sessionId line 20
- provenance line 21
- payload line 22
- archived line 23
- ChatViewRow line 26
- id line 27
- chatId line 28
- messageId line 29
- direction line 30
- ts line 31
- senderId line 32
- senderName line 33
- replyToMessageId line 34
- triggerReason line 35
- text line 36
- media line 37
- hidden line 38
- archived line 39
- IngestResult line 42
- accepted line 43
- duplicates line 44
- insertedSeqs line 45
- RecallKind line 48
- RecallQuery line 50
- kind line 51
- since line 52
- until line 53
- q line 54
- digest line 55
- limit line 56
- RecallResponse line 59
- rows line 60
- cold line 61
- ServiceStatus line 64
- ready line 65
- schemaVersion line 66
- lastAuditSeq line 67
- counts line 68
- dbSizeBytes line 69
- storage line 70
- storageState line 71
- lastQuickCheck line 72
- MAINTENANCE_OPS line 76
- MaintenanceOp line 77
- ArchiveCycleResult line 79
- exportedAudit line 80
- exportedChat line 81
- segments line 82
import type {
AnalysisRecord,
AuditEvent,
ChatDirection,
ChatMessageIn,
DeploymentEventMirror,
MediaMeta,
MediaRef,
ReleaseProvenance,
TombstoneIn,
TriggerReason,
} from './events.ts'
/** Public timeline row; archived rows have no seq and are flagged cold. */
export interface TimelineRow {
seq?: number | undefined
id: string
ts: string
kind: string
sessionId?: string | undefined
provenance?: ReleaseProvenance | undefined
payload: unknown
archived: boolean
}
export interface ChatViewRow {
id: string
chatId: number
messageId: number
direction: ChatDirection
ts: string
senderId?: string | undefined
senderName?: string | undefined
replyToMessageId?: number | undefined
triggerReason?: TriggerReason | undefined
text?: string | undefined
media?: MediaRef[] | undefined
hidden: boolean
archived: boolean
}
export interface IngestResult {
accepted: number
duplicates: number
insertedSeqs: number[]
}
export type RecallKind = 'audit' | 'chat' | 'deploy' | 'analysis'
export interface RecallQuery {
kind: RecallKind
since?: string
until?: string
q?: string
digest?: string
limit?: number
}
export interface RecallResponse {
rows: unknown[]
cold: boolean
}
export interface ServiceStatus {
ready: boolean
schemaVersion: number
lastAuditSeq: number
counts: { audit: number; chat: number; deployments: number; media: number }
dbSizeBytes: number
storage: { freeBytes: number; totalBytes: number; freePct: number }
storageState: 'ok' | 'warn' | 'stop'
lastQuickCheck?: string
}
/** Internal maintenance op names (typed API surface, no arbitrary SQL). */
export const MAINTENANCE_OPS = ['quick_check', 'archive_cycle', 'vacuum', 'reconcile'] as const
export type MaintenanceOp = (typeof MAINTENANCE_OPS)[number]
export interface ArchiveCycleResult {
exportedAudit: number
exportedChat: number
segments: number
}
/* ---- wire helpers shared by service routes and the agent client ---- */
export type {
AnalysisRecord,
AuditEvent,
ChatMessageIn,
DeploymentEventMirror,
MediaMeta,
TombstoneIn,
}