import type { GatewayMethodCatalog } from '../method-catalog.js'; import type { GatewayMethodHandler } from '../method-catalog-shared.js'; import type { WorkspaceCheckpointManager } from '../../workspace/checkpoint/manager.js'; import type { WorkspaceEvent } from '../../../events/workspace.js'; import { RestoreTokenStore } from './checkpoint-restore-tokens.js'; /** Sink for the checkpoints.revertHunk receipt event (adapted onto the RuntimeEventBus by the registrar). */ export type CheckpointsEventSink = (event: WorkspaceEvent, sessionId: string) => void; /** Structural deps, the read/write surface `checkpoints.*` + `sessions.changes.get` needs. */ export type CheckpointsGatewayManager = Pick; export declare function createCheckpointsListHandler(manager: CheckpointsGatewayManager): GatewayMethodHandler; /** * `sessions.changes.get`, the aggregate workspace file changes a session made, * joined over its sessionId-stamped checkpoints (see * WorkspaceCheckpointManager.sessionChanges). A session with no stamped * checkpoints returns checkpointCount:0 with an empty diff, not an error. */ export declare function createSessionChangesHandler(manager: CheckpointsGatewayManager): GatewayMethodHandler; export declare function createCheckpointsCreateHandler(manager: CheckpointsGatewayManager): GatewayMethodHandler; export declare function createCheckpointsDiffHandler(manager: CheckpointsGatewayManager): GatewayMethodHandler; /** * Build a preview of what restoring checkpoint `id` would change: the label, * the affected-path count and a bounded sample, and the diffstat, all from the * manager's own diff against the live working tree (no workspace mutation). An * unknown/gc'd id surfaces as the same honest 404 `diff`/`restore` already use. */ export declare function createCheckpointsRestorePreviewHandler(manager: CheckpointsGatewayManager, tokens: RestoreTokenStore): GatewayMethodHandler; export declare function createCheckpointsRestoreHandler(manager: CheckpointsGatewayManager, tokens: RestoreTokenStore): GatewayMethodHandler; /** * `checkpoints.revertHunkPreview`, read-only: does reverse-applying this one * unified-diff hunk to its file apply cleanly right now? A stale/drifted hunk is * `applies:false` with a human-readable `conflict` and a null token (honest, not * an error); a clean hunk mints a single-use token bound to this exact (path, * hunk) that the matching checkpoints.revertHunk consumes. */ export declare function createCheckpointsRevertHunkPreviewHandler(manager: CheckpointsGatewayManager, tokens: RestoreTokenStore): GatewayMethodHandler; /** * `checkpoints.revertHunk`, confirm-gated reverse-apply of ONE hunk to the live * working tree, following the checkpoints.restore / rewind.apply confirm idiom: * an unconfirmed call is a non-error refusal, a bad token is a 400, and a hunk * that no longer applies cleanly is a 409 conflict (never a partial write). The * apply snapshots the whole tree first (the undo point) and emits a HUNK_REVERTED * receipt event when an event sink is wired. */ export declare function createCheckpointsRevertHunkHandler(manager: CheckpointsGatewayManager, tokens: RestoreTokenStore, emit?: CheckpointsEventSink): GatewayMethodHandler; /** * Attach the `checkpoints.*` handlers to the descriptors already registered * (without a handler) from ../method-catalog-control-core.ts's static * builtin array. Call once, at RuntimeServices construction time, after * `workspaceCheckpointManager` exists. A missing descriptor is a silent * no-op, see routes/fleet.ts's `registerFleetGatewayMethods` for the same * rationale. */ export declare function registerCheckpointGatewayMethods(catalog: GatewayMethodCatalog, manager: CheckpointsGatewayManager, emit?: CheckpointsEventSink): void; //# sourceMappingURL=checkpoints.d.ts.map