import { Source, CatalogSource, SessionScope } from './sdk-common.js'; export * from './sdk-common.js'; export * from './delivery.js'; export * from './history-export.js'; export { NATIVE_CONTRACT_VERSION, runtimePlatform, validateNativeContract } from './native.js'; export * from './git.js'; export * from './contracts.js'; import type { HistoryEntry, HistoryPage, SearchMatch, SearchPage, ListOptions, SearchOptions, SessionOptions, CatalogSession, ListCatalogOptions, SessionCatalogPage, DiscoverSessionsOptions, DiscoverResult, HydrateSessionOptions, HydrateSessionResult, EventsPageOptions, SessionEventsPage, GetSessionRelationshipsOptions, SessionRelationships, GetSessionTreeOptions, SessionTree, SessionChildrenPage, GetSessionChildrenPageOptions, EvidencePageOptions, SessionToolCallsPage, SessionFileEditsPage, RequestPageOptions, SessionRequestsPage, SessionUsage, SessionUsageOptions, UserTurnsPageOptions, SessionUserTurnsPage, SessionMarkersPage, SourceCapabilities, ChangesPage, ChangesPageOptions, CommitChangesOptions, CommittedCursor, Watermark, Stats, StatsOptions, SyncOptions, SyncResult } from './contracts.js'; import { combineHydration } from './normalization.js'; export { validateNativeLocation, validateNativeScope, parseStoredJson } from './normalization.js'; export declare function nativeBuildProfile(): Promise; /** * Full-text search over indexed prompts and session events: the same * contract, filters and `(timestampMs, id)` order as `ai-hist search`. Each * match says where it was found (`matchSource`) and, for an event, its `role` * and `kind`. */ export declare function search(query: string, options?: SearchOptions): Promise; /** * One page of `search`. Pass the returned `nextCursor` back as `after` to * continue; it is `null` once no further match exists. Pages never skip or * repeat a match among rows present for the whole walk; rows committed * meanwhile appear wherever their `(timestampMs, id)` places them. */ export declare function searchPage(query: string, options?: SearchOptions): Promise; export declare function recent(options?: ListOptions): Promise; /** One page of `recent`, with the same cursor contract as `searchPage`. */ export declare function recentPage(options?: ListOptions): Promise; export declare function getSession(sessionId: string, options?: SessionOptions): Promise; export declare function listSessionCatalog(options?: ListCatalogOptions): Promise; export declare function listSessionCatalogPage(options?: ListCatalogOptions): Promise; export declare function discoverSessions(options?: DiscoverSessionsOptions): Promise; export declare function hydrateSession(options: HydrateSessionOptions): Promise; export declare function getSessionEventsPage(sessionId: string, options?: EventsPageOptions): Promise; /** * Direct delegation relationships for one session, in both directions. A * missing database returns an empty, well-formed result whose `capabilities` * still describe what the provider is able to record. */ export declare function getSessionRelationships(options: GetSessionRelationshipsOptions): Promise; export declare function getSessionToolCallsPage(source: Source, sessionId: string, options?: EvidencePageOptions): Promise; /** * One bounded page of a session's model requests, oldest first. * * A request is one API call: Claude's per-content-block copies of * `message.usage` are collapsed into it, so summing these pages counts each * call once where summing raw events would not. */ export declare function getSessionRequestsPage(source: Source, sessionId: string, options?: RequestPageOptions): Promise; /** * Provider-neutral usage rollup for one session. * * `usage` is null when the session carries no usage evidence at all. Cost is * never estimated here; `reportedCostUsd` is populated only when the source * data itself carried one. */ export declare function getSessionUsage(source: Source, sessionId: string, options?: SessionUsageOptions): Promise; /** * One bounded page of user turns for one session, oldest first. * * Each turn carries the ordered blocks a provider attached to one user * message — the human's own text and the tool results that came back with it, * each with its measured payload size. Derived from the indexed events, so it * cannot disagree with the transcript it came from. */ export declare function getSessionUserTurnsPage(source: Source, sessionId: string, options?: UserTurnsPageOptions): Promise; /** * One bounded page of a session's markers, oldest first — the records a * provider wrote that the normalized event model cannot carry: compaction and * summary boundaries, provider `system` rows, non-text content blocks, agent * lifecycle events. Same `(tsMs IS NULL, tsMs, id)` keyset as tool calls and * file edits, so an undated marker pages last through a null-timestamp cursor. * A missing database is an empty page. */ export declare function getSessionMarkersPage(source: Source, sessionId: string, options?: EvidencePageOptions): Promise; /** * One bounded page of the revision-stamped change feed * (`SessionStore::changes_since`): every row write and delete across the * store, in `(revision, kind, recordKey)` order, each with the row as stored. * Pass the page's `position` back as `from` for the next page. A named * `consumer` resumes from its cursor inside the store, which moves only on * `commitChanges`, so a page that was read but not applied is served again. * A missing database is an empty, finished feed and is not created. */ export declare function getChangesPage(options?: ChangesPageOptions): Promise; /** * Acknowledge everything up to `position` for a named cursor. Forward-only: a * commit behind the stored cursor leaves it where it is, and the answer says * where that is. The kind set must be the one the cursor was first committed * for (`CONSUMER_KINDS_MISMATCH` otherwise). Needs a writable database. */ export declare function commitChanges(consumer: string, position: Watermark, options?: CommitChangesOptions): Promise; /** * What one provider's parser can record. Answered from RelayHistory's own * capability tables, never from a database, so it does not depend on what has * been synced: `evidenceKinds` is the `coverage` a hydration of this source * reports, and `relationships` is what its records establish about delegation. */ export declare function getSourceCapabilities(source: CatalogSource): Promise; /** * The complete descendant delegation tree for one session: pre-order, * cycle-safe, and bounded by `maxDepth` and `maxNodes`. Child events keep * their own session identity and are never flattened into the root. */ export declare function getSessionTree(options: GetSessionTreeOptions): Promise; export declare function getSessionFileEditsPage(source: Source, sessionId: string, options?: EvidencePageOptions): Promise; /** * One bounded page of a session's direct children, in the same total order * the tree traversal uses: `(spawnedAtMs, relationshipUid)`, nulls last. */ export declare function getSessionChildrenPage(options: GetSessionChildrenPageOptions): Promise; export declare function stats(options?: StatsOptions): Promise; export declare function sync(options?: SyncOptions): Promise; export interface FormatSessionRowOptions { /** Opt in to ANSI colour. Default false for logs and SDK consumers. */ color?: boolean; nowMs?: number; maxPromptLength?: number; } /** Format a catalog session for a terminal without reading providers or the DB. */ export declare function formatSessionRow(session: CatalogSession, options?: FormatSessionRowOptions): string; export interface BootstrapLocalOptions { dbPath?: string; /** Maximum sessions to discover and index on first use. Default 20. */ limit?: number; } export interface BootstrapLocalResult { status: 'ready' | 'empty' | 'partial'; alreadyIndexed: boolean; indexedPrompts: number; hydratedSessions: number; discovery: DiscoverResult | null; diagnostics: Array<{ source: string; sessionId: string; code: string; message: string; }>; } /** * Prepare a first local search with the native discovery and hydration APIs. * Existing searchable databases are left alone; use sync() for a full refresh. * Discovery is bounded and related sessions are excluded from first-touch work. */ export declare function bootstrapLocal(options?: BootstrapLocalOptions): Promise; /** * `ready` — the store answers queries. `empty` — bootstrap ran and this machine * has no local coding-agent history at all. `unbuilt` — bootstrap was declined, * so nothing is indexed yet and that is not the same as having no history. * `skipped` — the caller is not reading the local store. */ export type LocalStoreStatus = 'ready' | 'empty' | 'unbuilt' | 'skipped'; export interface LocalStoreReadiness { status: LocalStoreStatus; indexedPrompts: number; /** The bootstrap that ran on this call, or null when none did. */ bootstrap: BootstrapLocalResult | null; } /** * Listen for schema migrations this process runs on an existing database. * * A migration after an upgrade can take minutes on a large history. `listener` * hears `started` when an open takes the write lock to migrate, then * `finished` when it commits or `failed` when it rolls back, each with the * database's path -- never for a new or current * database, or for a call that is rejected before it opens -- so a front end * announces exactly the work that happens. Events arrive asynchronously, so * the last one can land just after the migrating call settles. One listener per * process: resolves false when one is already registered. */ export declare function onStoreMigration(listener: (event: 'started' | 'finished' | 'failed', dbPath: string | null) => void): Promise; /** Run any outstanding schema migration now, creating the database if it does not exist. */ export declare function migrateStore(options?: { dbPath?: string; }): Promise; export interface EnsureLocalStoreOptions { dbPath?: string; /** Only `local` and `all` read the local database; `remote` skips the check. */ scope?: SessionScope; /** False for `--no-bootstrap`: report the store as it stands, build nothing. */ bootstrap?: boolean; } /** * The single first-use decision behind every local read. Callers must not each * choose whether to bootstrap: a fresh install has to answer the same way * whichever command the user happens to type first, and a store that was never * built has to be distinguishable from one that holds no match. */ export declare function ensureLocalStore(options?: EnsureLocalStoreOptions): Promise; export declare function resumeCommand(entry: Pick): string | null; /** Internals reachable from this package's own tests. Not public API. */ export declare const __testing: { combineHydration: typeof combineHydration; }; //# sourceMappingURL=operations.d.ts.map