/** * Skip-tolerant session-query engine for this terminal. * * The upstream SqliteSessionQueryEngine reconciliation observes EVERY * persisted session before each search, and ONE unreadable source (for * example a pre-release session artifact the frozen format codecs reject) * fails the whole pass with SESSION_QUERY_PERSISTENCE_FAILED — every * cross-session search dies because of a single old file nobody opened * otherwise. This subclass overrides only the observation loop so an * unreadable source is skipped with a warning and the rest of the corpus * indexes normally; skipped sessions are retried on later reconciliations * and rejoin automatically once a host that can read them is installed. * * Vendored surface note: `_observeStable` and its module-local helpers are * private upstream; this file re-declares the observation loop against the * pinned @deepseek-ai line (see package.json peers) and must be re-checked * whenever that line moves. The engine class and the tool boundary also * share ONE physical parent-package instance through this bundle, which * restores instanceof-based typed error messages on the search path. */ import SqliteSessionQueryEngine, { type Config } from '@deepseek-ai/dsh-session-query-sqlite'; import { buildSessionEventSearchDocuments } from '@deepseek-ai/dsh-session-query'; import type { SessionEvent, SessionHeader, SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session'; import type { SessionPersistenceRevision, SessionPersistenceSnapshot } from '@deepseek-ai/dsh-session-persistence'; /** One observed session: detached header plus its derived search documents. */ interface ObservedSession { header: SessionHeader; inheritedEventCount: SessionLogOffset; documents: readonly ReturnType[number][]; fingerprint: string; } /** One persisted snapshot as the reconciliation sees it (loaded once readable). */ interface ObservedPersistedSession { header: SessionHeader; revision: SessionPersistenceRevision; loaded?: ObservedSession; /** Diagnosis for a cold read that failed; the session stays unindexed. */ unreadable?: string; } /** The engine-internal state the observation loop touches. */ export interface EngineSurface { readonly ctx: { sessions: { list(): readonly { header: SessionHeader; inheritedEventCount: SessionLogOffset; snapshotEvents(): readonly SessionEvent[]; id: SessionId; }[]; get(id: SessionId): unknown; }; logger?: { warn(format: string, ...args: readonly unknown[]): void; }; }; readonly _persistenceBinding: { readonly identity: symbol; readonly service?: { list(options?: { readonly signal?: AbortSignal; }): Promise; }; }; _lastPersistenceIdentity: symbol | undefined; } type ColdRead = (persistence: NonNullable, id: SessionId, signal: AbortSignal | undefined) => Promise<{ header: SessionHeader; inheritedEventCount: SessionLogOffset; events: readonly SessionEvent[]; }>; /** * The skip-tolerant observation pass: structurally the upstream loop, with * the per-source cold read wrapped so one unreadable session degrades to a * warning instead of failing every search. Exported for unit tests with an * injectable cold reader. */ export declare function observeStableWithSkip(engine: EngineSurface, indexed: ReadonlyMap, signal: AbortSignal | undefined, readCold?: ColdRead): Promise<{ persistenceBinding: EngineSurface['_persistenceBinding']; persisted: Map; live: Map; }>; /** * Assert the private override seam this compatibility engine relies on. * Harness keeps `_observeStable` private, so TypeScript cannot protect this * subclass when upstream renames the method or changes its call signature. * The exact-version launcher gate prevents unsupported hosts; this import-time * check additionally prevents a newly built bundle from silently mounting an * override the installed base will never call. * * @internal Exported for the compatibility regression. */ export declare function assertSessionQueryOverrideContract(candidate: unknown): void; declare const EngineBase: abstract new (ctx: never, config: Config) => EngineSurface & object; /** The engine this bundle mounts in place of the base `session-query-sqlite` row. */ export declare class SkipTolerantSessionQueryEngine extends EngineBase { _observeStable(indexed: ReadonlyMap, signal: AbortSignal | undefined): Promise; } declare const _default: typeof SqliteSessionQueryEngine; export default _default;