@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
67 lines • 3.97 kB
TypeScript
import type { SessionRetryFallbackProfile } from "../../core/agent-session-runtime.ts";
import type { BrowserEngine } from "../../core/browser-engine.ts";
import type { PromptSurface } from "../../core/dynamic-prompt/types.ts";
import type { SessionContext, SessionKind } from "../../core/extensions/types.ts";
import { type SessionEnv } from "./session-caller-env.ts";
import { type SessionContextOverlay } from "./session-context-patch.ts";
import { type ResidentWriter } from "./host-handover-resident-writer.ts";
export interface HandoverParkedEntry {
readonly sessionPath: string;
readonly durableSessionId?: string;
readonly retainOnDisconnect: boolean;
readonly cwd?: string;
readonly model?: {
readonly provider: string;
readonly modelId: string;
};
readonly thinkingLevel?: string;
/**
* The session's launch-profile choices a client-less reopen has no other source for: without them
* the successor opens the session under the host defaults, and an `ask` session runs gated tools
* without asking (senpi#3364).
*/
readonly permissionPreset?: string;
readonly promptSurface?: PromptSurface;
readonly browserEngine?: BrowserEngine;
/**
* The rest of the client's `open_session` choices, so the successor reopens the session through
* the same open as any client would (senpi#3368): its visibility class (a worker stays invisible by
* default, I4), the CLIENT part of its context (the host-owned keys are the successor's own and
* are re-merged on open), its auto-titling and its retry fallback.
*/
readonly sessionKind?: SessionKind;
readonly sessionContext?: SessionContext;
readonly contextOverlay?: SessionContextOverlay;
readonly autoTitle?: boolean;
readonly retryFallback?: SessionRetryFallbackProfile;
/** The session's own caller env (senpi#4381); it follows the session, never the generation's process. */
readonly sessionEnv?: SessionEnv;
/**
* The host instance that wrote the park. Its own reopen watch skips it: the park is for the NEXT
* generation, and a host reopening what it just idle-parked races the client's reopen (senpi#3485).
* Absent on entries an older generation wrote, which every reader treats as a predecessor's park.
*/
readonly parkedBy?: string;
/**
* Present while the session is open on its host (senpi#6190); a park drops it. A successor reopens a stamped
* entry only once that writer process is gone, so it never opens a session its live predecessor still holds.
*/
readonly residentWriter?: ResidentWriter;
/**
* The session was loaded when the host that wrote this entry ended (senpi#7020): resident, parked by a handoff
* drain, or parked by a clean stop. A successor reopens a live session as that host left it, releasing only the hold
* the restart caused; an entry without it (an idle-sweep park, an unload, an older host) reopens dormant.
*/
readonly live?: true;
}
export declare function isHandoverParkedEntry(value: unknown): value is HandoverParkedEntry;
export declare function recordHandoverParkedSession(daemonDir: string, entry: HandoverParkedEntry): Promise<void>;
export declare function readHandoverParkedSessions(daemonDir: string): Promise<readonly HandoverParkedEntry[]>;
export declare function clearHandoverParkedSession(daemonDir: string, sessionPath: string): Promise<void>;
/**
* Clears an inherited entry after its reopen, unless the reopen re-recorded it as resident on
* `holder` (a retained session is recorded by the host it is open on, so the next start reopens it).
*/
export declare function clearInheritedParkedSession(daemonDir: string, sessionPath: string, holder: string | undefined): Promise<void>;
export declare function dropHandoverParkedSessionIfFileGone(daemonDir: string, sessionPath: string): Promise<void>;
//# sourceMappingURL=host-handover-parked.d.ts.map