import { EvidenceKind, CatalogSource, SessionScope, SessionLocation } from './sdk-common.js'; import type { ChangeKind, ChangesPage, CommittedCursor, FeedChange, Watermark, HistoryEntry, HistoryCursor, SearchMatch, CatalogCursor, CatalogSession, HydrateSessionResult, SessionEvent, SessionUserTurn, SessionUserTurnBlock, ProjectKeyMethod, RelationshipType, IdentityStatus, StableChildIdentity, SessionRelationship, RelationshipCapabilities, RelationshipDiagnostic, GetSessionRelationshipsOptions, SessionTreeNode, RelationshipCursor, JsonValue, SessionToolCall, SessionFileEdit, EvidenceCursor, EvidenceCursorInput, NormalizedUsage, UsageAccounting, UsageDiagnostic, RequestKeySource, SessionRequest, RequestCursor, SessionMarker, SourceCapabilities } from './contracts.js'; export type UnknownRecord = Record; /** Delegation kinds: one session started another thread of work. */ export declare const DELEGATION_RELATIONSHIP_TYPES: readonly string[]; /** Continuity kinds: one conversation carrying on as another. */ export declare const CONTINUITY_RELATIONSHIP_TYPES: readonly string[]; export declare const RELATIONSHIP_TYPES: readonly string[]; export declare const DEFAULT_TREE_MAX_DEPTH = 32; export declare const MAX_TREE_MAX_DEPTH = 64; export declare const DEFAULT_TREE_MAX_NODES = 1000; export declare const MAX_TREE_MAX_NODES = 10000; export declare function nullableString(value: unknown): string | null; export declare function historyEntry(value: UnknownRecord): HistoryEntry; export declare function historyCursor(value: unknown): HistoryCursor | null; /** * The native boundary takes an absent `matchSource`, not an explicit null. Any * other value, an empty string included, goes through so native validation * rejects it instead of it silently paging as `history`. */ export declare function nativeHistoryCursor(after: HistoryCursor | undefined): object | undefined; export declare function searchMatch(value: UnknownRecord): SearchMatch; export declare function catalogCursor(value: unknown): CatalogCursor | null; /** * Narrow a native `projectKeyMethod` to the documented set. * * An unrecognized value becomes null rather than being passed through: a * consumer branching on `'remote'` must not be handed a fourth case it has * never seen, and a silently widened union is exactly the shape a contract * mismatch takes. */ export declare function projectKeyMethod(value: unknown): ProjectKeyMethod | null; export declare function catalogSession(value: UnknownRecord): CatalogSession; export declare function validateNativeLocation(value: unknown): SessionLocation; export declare function validateNativeScope(value: unknown): SessionScope; export declare function assertCatalogContract(value: number): void; export declare function tokenUsage(raw: unknown): Record | null; export declare function sessionEvent(value: UnknownRecord): SessionEvent; export declare function sessionUserTurnBlock(value: UnknownRecord): SessionUserTurnBlock; export declare function sessionUserTurn(value: UnknownRecord): SessionUserTurn; export declare function assertRelationshipContract(value: number): void; /** * Provider JSON is stored as the raw string the provider wrote. A row whose * string cannot be parsed still belongs in its page, so parsing yields null * and the caller reads the raw companion field instead of losing the row. */ export declare function parseStoredJson(raw: unknown): JsonValue | null; export declare function nullableNumber(value: unknown): number | null; export declare function nullableBoolean(value: unknown): boolean | null; export declare function sessionToolCall(value: UnknownRecord): SessionToolCall; export declare function sessionFileEdit(value: UnknownRecord): SessionFileEdit; /** * A Codex `usage_snapshot` stores its `info` object -- bounded like every * marker payload (strings at 128 characters, containers at 32 entries, * numbers never altered) -- compactly, as `[total, last, window, other]` * (see the crate's `usage_snapshot` module); this is the object it was * stored from. A payload that is not that form is returned as stored, as the * Rust reader does. */ export declare function usageSnapshotInfo(stored: JsonValue | null): JsonValue | null; export declare function sessionMarker(value: UnknownRecord): SessionMarker; /** * Validate a list of evidence kinds rather than cast it: an unknown kind is a * native contract mismatch, not a value to hand a caller that will branch on * it. `what` names the field in the error. */ export declare function evidenceKindList(value: unknown, what: string): EvidenceKind[]; export declare function sourceCapabilities(value: UnknownRecord): SourceCapabilities; export declare function evidenceCursor(value: unknown): EvidenceCursor | null; /** * The native boundary reads an absent `tsMs` as "inside the undated tail" but * cannot convert an explicit `null` into its integer field, so the cursor this * SDK hands back — `tsMs: null` for an undated row — has to be normalized * before it goes back in. The catalog cursor is normalized the same way. */ export declare function nativeEvidenceCursor(after: EvidenceCursorInput | undefined): object | undefined; export declare function assertUsageContract(value: number): void; /** * An out-of-contract label reaches the caller as a contract mismatch rather * than as a lie about the shape of the typed API — the same rule the * relationship enums follow. */ export declare function usageAccounting(value: unknown): UsageAccounting; export declare function requestKeySource(value: unknown): RequestKeySource; export declare function usageDiagnostics(value: unknown): UsageDiagnostic[]; export declare function normalizedUsage(value: unknown): NormalizedUsage | null; export declare function sessionRequest(value: UnknownRecord): SessionRequest; export declare function requestCursor(value: unknown): RequestCursor | null; export declare function assertEvidenceContract(value: number): void; export declare function catalogSource(value: unknown): CatalogSource; export declare function relationshipType(value: unknown): RelationshipType; export declare function identityStatus(value: unknown): IdentityStatus; export declare function stableChildIdentity(value: unknown): StableChildIdentity; export declare function relationship(value: UnknownRecord): SessionRelationship; export declare function relationships(value: unknown): SessionRelationship[]; export declare function relationshipCapabilities(value: unknown): RelationshipCapabilities; export declare function relationshipDiagnostics(value: unknown): RelationshipDiagnostic[]; export declare function treeNode(value: UnknownRecord): SessionTreeNode; export declare function relationshipCursor(value: unknown): RelationshipCursor | null; export declare function validateSessionRef(options: GetSessionRelationshipsOptions, operation: string): void; /** * Both halves of an evidence page's identity, checked before the call. * * `source` is half of the identity here, not a filter that narrows a wider * result, so an id this build has no provider for cannot mean "no rows" — it * means the caller named something that does not exist, and an empty page * would report that as an empty session. `hydrateSession` rejects the same * mistake for the same reason. */ export declare function evidenceIdentity(source: unknown, sessionId: unknown, operation: string): void; /** * The capability a merged hydration result is entitled to claim. * * `capability` is *defined* by `coverage` -- `full` exactly when every kind in * `FULL_SESSION_KINDS` is covered -- so a merge has to recompute it. Two * connectors that complement each other can cover all five kinds while neither * is `full` alone, and carrying an input's `partial` through would rank * complete merged evidence below a single full result. `shallow_only` survives * only when nothing was covered and nothing claimed otherwise: a `partial` * over empty coverage would imply some kind was indexed. */ export declare function mergedHydrationCapability(coverage: readonly EvidenceKind[], parts: readonly HydrateSessionResult[]): HydrateSessionResult['capability']; /** The `FULL_SESSION_KINDS` a coverage set leaves out, in canonical order. */ export declare function missingHydrationCoverage(coverage: readonly EvidenceKind[]): EvidenceKind[]; /** * The capability a coverage set entitles a single result to claim — the same * rule the Rust producer applies (`capability_for` in `hydrate.rs`). Covering * nothing is `shallow_only`, not `partial`: `partial` implies some kind was * indexed. * * A *merge* is a different question and uses {@link mergedHydrationCapability}, * which additionally keeps `shallow_only` only when every input claimed it. */ export declare function expectedHydrationCapability(coverage: readonly EvidenceKind[]): HydrateSessionResult['capability']; /** * Fold one more presence's hydration result into the running one. * * Evidence counts take the maximum and coverage takes the union, because the * merged result reports what *either* presence indexed; the remaining * scalar fields come from the presence that performed the strongest work; * equal statuses select the richer presence. This keeps `status`, `presence` * and `indexedThrough` describing the same acquisition. */ export declare function combineHydration(previous: HydrateSessionResult | undefined, next: HydrateSessionResult): HydrateSessionResult; export declare function assertHydrationContract(contractVersion: number): void; export declare function normalizeHydration(value: UnknownRecord): HydrateSessionResult; /** A feed position, validated: the epoch stays a hex string, never a number. */ export declare function watermark(value: unknown): Watermark; export declare function changeKind(value: unknown): ChangeKind; export declare function feedChange(value: UnknownRecord): FeedChange; export declare function changesPage(value: UnknownRecord): ChangesPage; export declare function committedCursor(value: UnknownRecord): CommittedCursor; //# sourceMappingURL=normalization.d.ts.map