@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
88 lines • 5.5 kB
TypeScript
import type { TranscriptTransition } from "../../core/session-transcript-journal.ts";
import type { CallFold } from "./compact-call-fold.ts";
import type { CompactColdOutcome } from "./compact-cold-operations.ts";
import { type CanonicalUnit } from "./compact-lane-transitions.ts";
import { CompactSessionState, type CompactSessionStateOptions, type CutStorageUse } from "./compact-session-state.ts";
import type { CompactSettledMessages } from "./compact-settled-messages.ts";
import type { FrozenCompactState } from "./compact-state-view.ts";
import type { CompactPersistence } from "./compact-transition.ts";
/**
* The lane's compact current state for one epoch (S03b-3): folded inside the lane's own acceptance step at the
* lane's sequence, accepting only that epoch's registry nonce (RULING-39). A rejected fold makes it unavailable for the
* rest of the epoch (legacy delivery is unaffected), so a cut never holds a partial or silently stale state.
*/
export declare class CompactLaneCurrent {
private state;
private cleanup;
private coldChain;
private readonly owners;
private refused;
/**
* Records refused at the protocol depth limit over this lane's lifetime, one per session event, whether or not the
* epoch's compact state is still live: a real loss ends the state, never the count. The legacy path (`admits`) and
* the canonical path (`fail`) follow this one rule (RULING-59 C).
*/
get refusedRecords(): number;
/** Open broadcast questions now; undefined once this epoch's compact state is unavailable. */
get openBroadcastDialogs(): number | undefined;
bootstrap(options: CompactSessionStateOptions & {
readonly epoch: string;
}): void;
/**
* The one protocol depth check of a legacy record a compact fold would clone or serialize (the call and component
* folds, the settled terminal of a `message_end`), run before any of them (RULING-59 C). A refused record is counted
* and reported here, once, under the `refusedRecords` rule (live or retired state alike); a cycle ends the current
* state. Either way the record must change no compact component.
*/
admits(record: object, type: string): boolean;
fold(unit: CanonicalUnit, sequence: number, turnId?: string | null): void;
/** A host-origin lifecycle, run-state or dialog record, taken at the same JSON boundary as canonical records. */
foldComponent(record: object, sequence: number): void;
/** An execution, hook or boundary record for the calls component (S06); undefined once the state is unavailable. */
foldCall(record: object, sequence: number, turnId: string | null, callKey?: string): CallFold | undefined;
/** The call whose block a `toolcall_*` update streams (RULING-123); undefined once the state is unavailable. */
callOwning(messageId: string, contentIndex: number): import("./compact-call-model.ts").OutstandingCall | undefined;
/**
* The cold work of one accepted transcript transition: an owned append makes its message appended, and the flow a
* real producer committed (edit, context-edit removal, compaction, branch) maps through this epoch's settled joins.
*/
transcript(transition: TranscriptTransition, settled: CompactSettledMessages, epoch: string): void;
/** Persistence from the transcript join: a message this state never held, or one still live, keeps its status. */
status(messageId: string, persistence: CompactPersistence): void;
/**
* Cold work ordered after acceptance (RULING-33 cond. 2): steps run one at a time in acceptance order, each against
* the epoch it was accepted in; an outcome the store failed to write stops that epoch's compact state.
*/
cold(step: (state: CompactSessionState) => Promise<CompactColdOutcome | readonly CompactColdOutcome[] | undefined>): void;
/** Never throws: building the transition from a worker frame's record is part of the fold that may fail. */
private apply;
freeze(): FrozenCompactState | undefined;
release(cut: FrozenCompactState | undefined): void;
read(cut: FrozenCompactState | undefined): Promise<{
sequence: number;
messages: import("./compact-text-view.ts").CompactMessageView[];
}>;
readComponents(cut: FrozenCompactState | undefined): Promise<{
runState: import("./compact-current-components.ts").CompactRunState;
lifecycle: unknown;
dialogs: import("./compact-current-components.ts").CompactDialog[];
dialogCounts: {
readonly broadcast: number;
readonly targeted: number;
};
}>;
readActive(cut: FrozenCompactState | undefined): Promise<import("./compact-state-view.ts").ActiveMessageView[]>;
readCalls(cut: FrozenCompactState | undefined): Promise<import("./compact-call-view.ts").CallsView>;
cutStorage<T>(cut: FrozenCompactState | undefined, use: CutStorageUse<T>): Promise<T>;
private owned;
retire(): void;
idle(): Promise<void>;
/**
* The epoch's compact component stops here: a fold failed, or a canonical record never reached this lane. A record
* refused at the protocol depth limit is the exception (RULING-59 C): it was refused before anything was cloned or
* folded, so it is counted and reported, also once the state is already gone, and a live state stays available.
*/
fail(cause: unknown): void;
private refuse;
}
//# sourceMappingURL=compact-lane-current.d.ts.map