import type { Context } from '@deepseek-ai/cordis'; import type { SessionEventLike, SessionLike, ToolClass, TurnState } from '../providers.js'; import type { ReconciliationStatus } from '../types.js'; import type { UserQuestionFacts } from './user-questions.js'; export interface Disposable { dispose(): void; } export interface DeepCanaryEvent { type: 'session/created' | 'session/event' | 'session/disposed'; session: unknown; event?: unknown; /** Authoritative state attached to synthetic startup/reconciliation events. */ snapshot?: SessionSnapshot; } export interface SessionSnapshot { sessionId: string; active: boolean; cwd?: string; startedAt: number; executionStartSeq?: number; currentTurn?: number; lastEventAt: number; /** Last event boundary that proves meaningful task progress. */ lastMeaningfulAt?: number; /** The exact last existing event sequence observed in the DSH session log. */ lastEventSeq?: number; /** Count of events in the authoritative snapshot; this is not a SessionSeq. */ eventCount?: number; running?: boolean; turnState?: TurnState; waitingForHuman?: boolean; activeToolCount?: number; toolClass?: ToolClass; humanNeededReason?: 'approval' | 'question'; humanNeededSeq?: number; humanWaits?: Array<{ humanActionRef: string; reason: 'approval' | 'question'; seq?: number; time: number; }>; /** Watermark-checked public timed-question projection, metadata only. */ userQuestions?: UserQuestionFacts; toolFailures?: number; sameToolFailures?: number; lastFailedToolName?: string; contextCompactions?: number; lastToolName?: string; } export interface RuntimeHealth { status: 'healthy' | 'degraded' | 'unreachable' | 'unknown'; authoritative: boolean; checkedAt: string; detail?: string; } /** Stable boundary between DSH runtime facts and DeepCanary interpretation. */ export interface DshAdapter { hostVersion: string; start(): Promise; reconcile(): Promise; getReconciliationStatus(): ReconciliationStatus; subscribe(listener: (event: DeepCanaryEvent) => void): Disposable; getSessionSnapshot(sessionId: string): Promise; getRuntimeHealth(): Promise; } interface DshAdapterOptions { hostVersion?: string; runtimeHealth?: () => Promise; sessionStore?: SessionStoreLike; } interface SessionStoreLike { list?: () => readonly unknown[] | Promise; } /** Context-backed adapter used by the plugin host; all DSH event wiring lives here. */ export declare class ContextDshAdapter implements DshAdapter { readonly hostVersion: string; private readonly ctx; private readonly listeners; private readonly snapshots; private readonly runtimeHealth; private readonly sessionStore; private started; private reconciling; private reconcileEpoch; private bufferedEvents; private reconciliationEventKeys; private bufferOverflowed; private reconciliationPromise; private startPromise; private reconciliationStatus; constructor(ctx: Context, options?: DshAdapterOptions); start(): Promise; reconcile(): Promise; getReconciliationStatus(): ReconciliationStatus; subscribe(listener: (event: DeepCanaryEvent) => void): Disposable; getSessionSnapshot(sessionId: string): Promise; getRuntimeHealth(): Promise; private publish; private publishLive; private attachQuestionFacts; private performReconcile; private emit; private drainBuffered; } export type { SessionEventLike, SessionLike }; //# sourceMappingURL=dsh.d.ts.map