UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

69 lines • 2.89 kB
import type { CompactionReason, CompactionRejectionCause } from "../extensions/types.ts"; export interface CompactionModelRef { readonly provider: string; readonly id: string; } interface CompactionOperation { readonly generation: number; readonly operationId: string; readonly stage: "feedback" | "execution"; readonly reason: CompactionReason; readonly model?: CompactionModelRef; readonly startedRevision: number; } export type CompactionLifecycleState = { readonly status: "idle"; readonly generation: 0; } | (CompactionOperation & { readonly status: "running"; }) | (CompactionOperation & { readonly status: "completed"; readonly endedRevision: number; }) | (CompactionOperation & { readonly status: "failed"; readonly endedRevision: number; readonly rejectionCause?: CompactionRejectionCause; readonly errorMessage?: string; }) | (CompactionOperation & { readonly status: "aborted"; readonly endedRevision: number; readonly errorMessage?: string; }); export interface BeginCompactionOperation { readonly operationId: string; readonly stage: "feedback" | "execution"; readonly reason: CompactionReason; readonly model?: CompactionModelRef; readonly startedRevision: number; } export interface FinishCompactionOperation { readonly operationId: string; readonly status: "completed" | "failed" | "aborted"; readonly endedRevision: number; readonly rejectionCause?: CompactionRejectionCause; readonly errorMessage?: string; } export declare function initialCompactionLifecycleState(): CompactionLifecycleState; export declare function beginCompactionOperation(state: CompactionLifecycleState, operation: BeginCompactionOperation): CompactionLifecycleState; export declare function promoteCompactionOperation(state: CompactionLifecycleState, operationId: string): CompactionLifecycleState; export declare function finishCompactionOperation(state: CompactionLifecycleState, event: FinishCompactionOperation): CompactionLifecycleState; /** * Couples lifecycle reducer transitions with the controller that owns the * active generation. AgentSession owns event emission and durable work; this * coordinator only protects state transitions from stale callers. */ export declare class CompactionLifecycleCoordinator { private _state; private _controller; get state(): CompactionLifecycleState; begin(operation: BeginCompactionOperation, controller: AbortController): string; isCurrent(operationId: string, controller: AbortController): boolean; hasCurrentSignal(signal: AbortSignal): boolean; finish(event: FinishCompactionOperation): boolean; abort(endedRevision: number): { readonly reason: CompactionReason; readonly stage: "feedback" | "execution"; } | undefined; } export {}; //# sourceMappingURL=lifecycle.d.ts.map