/** * Versioned DTO rows for `gjc sdk session` semantic verbs (row DTO v1, DR-12). * * Every semantic verb renders its output through these rows so machine * consumers get one deterministic, versioned envelope per verb. Credentials * are never part of the row schema: broker `session.list` rows carry no * credentials, and pass-through host payloads are redacted recursively before * rendering. */ export declare const SESSION_ROWS_VERSION = 1; export type SdkSessionActivityState = "active" | "idle"; export interface SdkSessionActivityV1 { state: SdkSessionActivityState; at: number; } export interface SdkSessionRowV1 { sessionId: string; locator: { repo: string; stateRoot: string; }; endpointGeneration: number; /** Process-bound incarnation of the hosting process (C1); absent for legacy-provenance rows. */ hostIncarnation?: string; pid: number; live: boolean; /** Tombstone flag (C4): deleted sessions are excluded from list/endpoint/resumable surfaces. */ deleted: boolean; indexSeq: number; terminalUncertain?: boolean; lifecycleRequestId?: string; endpointMtimeMs?: number; /** Coalesced broker-owned heartbeat checkpoint (C2). */ activity?: SdkSessionActivityV1; /** Wall-clock timestamp of the latest admitted heartbeat, when one exists. */ lastHeartbeatAt?: number; /** "legacy" for v1/v2-era rows that predate process-incarnation identity. */ identityProvenance?: "composite" | "legacy"; /** True when the same sessionId maps to more than one stateRoot (cross-repo duplicate). */ ambiguous?: boolean; } export interface SdkCheckpointRecordV1 { revision: number; generation: number; seq: number; } export interface SdkRetentionGapV1 { code: "retention_gap"; missing?: { from: number; to: number; }; resync?: SdkCheckpointRecordV1; } /** One tail item: a retained transcript entry or a live event-ring event. */ export interface SdkTailItemV1 { /** "transcript" for retained transcript entries, otherwise the event-ring kind. */ kind: string; id?: string; generation?: number; seq?: number; payload: unknown; } export interface SdkTailEnvelopeV1 { version: typeof SESSION_ROWS_VERSION; source: "session" | "offline"; session: SdkSessionRowV1; checkpoint?: SdkCheckpointRecordV1; gap?: SdkRetentionGapV1; items: SdkTailItemV1[]; } /** Recursively removes secret-shaped fields (defense in depth for DTO output). */ export declare function stripSecretFields(value: unknown): unknown; /** * Projects one broker `session.list` row into the credential-free v1 row DTO. * The row is a superset-tolerant projection: identity fields introduced by * later index versions (hostIncarnation, activity, deleted) pass through when * present and are omitted otherwise, so the same mapper serves both v2 and v3 * index shapes. */ export declare function toSessionRowV1(value: unknown): SdkSessionRowV1; export declare function toCheckpointRecordV1(value: unknown): SdkCheckpointRecordV1 | undefined; export declare function toRetentionGapV1(value: unknown): SdkRetentionGapV1 | undefined; /** Projects a transcript entry or ring event into a tail item with dedupe keys. */ export declare function toTailItemV1(value: unknown, fallback: { kind: string; generation?: number; seq?: number; }): SdkTailItemV1;