@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
74 lines • 5 kB
TypeScript
import { ConnectionRoles } from "./connection-roles.ts";
import { CompactAdmissions } from "./compact-admissions.ts";
import type { InheritedHandover } from "./host-handover-reopen.ts";
import type { RpcHostKernelMemory } from "./rpc-types.ts";
import { createRpcSessionBinding, type RpcSessionBinding } from "./session-binding.ts";
import type { SessionEventWriter } from "./session-event-writer.ts";
import type { RpcSessionRegistry } from "./session-registry.ts";
import { SessionAttachOrder } from "./session-attach-order.ts";
import type { RpcHostSessionDefaults, RpcSessionIdlePolicy } from "./session-router-types.ts";
import { HostParkLedger } from "./host-park-ledger.ts";
import { PredecessorRoutes } from "./predecessor-routes.ts";
export declare class RouterContext {
readonly routes: PredecessorRoutes;
readonly parks: HostParkLedger;
readonly admissions: CompactAdmissions | undefined;
readonly bindings: Map<string, RpcSessionBinding>;
readonly stopLimitBroadcast: () => void;
/** Session handles opened by each connection, with one count per attachment. */
readonly sessionsByConnection: Map<string, Map<string, number>>;
/** When each connection first attached to each session: relocation asks the earliest offerer (senpi#3994). */
readonly attachOrder: SessionAttachOrder;
/** Opens currently awaiting runtime/binding setup, keyed by connection. */
readonly opensByConnection: Map<string, Set<Promise<void>>>;
/** Connections whose socket has already been detached. */
readonly releasedConnections: Set<string>;
readonly registry: Pick<RpcSessionRegistry, "openSession" | "peek" | "getForCommand" | "beginClose" | "close" | "closeMarked" | "list" | "size" | "warm" | "closeGraceMs"> & Partial<Pick<RpcSessionRegistry, "supportsCompact" | "supportsParkClaim" | "claimPark" | "holderPids" | "attachSession" | "agentDir" | "reserveHandle">>;
readonly writer: SessionEventWriter;
readonly defaults: RpcHostSessionDefaults;
readonly createBinding: typeof createRpcSessionBinding;
readonly connectionOptions: Parameters<typeof createRpcSessionBinding>[4];
readonly pendingCapabilities: Map<string, string[]>;
/** Roles each connection declared through set_client_info (senpi#3811). */
readonly connectionRoles: ConnectionRoles;
readonly finalizations: Map<string, {
promise: Promise<void>;
resolve: () => void;
}>;
readonly idleNow: () => number;
readonly idleEvictionMs: number;
readonly emptyExitMs: number;
readonly onEmptyExit?: () => void;
readonly canExitWhenEmpty?: () => boolean;
sweepTimer: ReturnType<typeof setInterval> | undefined;
uninstallEffectSink: (() => void) | undefined;
drainTimer: ReturnType<typeof setInterval> | undefined;
draining: boolean;
handoffParks: number;
drainExitRequested: boolean;
readonly handoffClosed: Set<string>;
/** Sessions whose automatic turns this draining generation already held (senpi#3114, `session-drain-hold.ts`). */
readonly drainHeldSessions: Set<string>;
readonly activeRequests: Map<string | undefined, number>;
/** Called after any request for that session settles; a release waits here for the others to finish. */
readonly requestSettledListeners: Map<string, Set<() => void>>;
readonly onHandoffParked?: RpcSessionIdlePolicy["onHandoffParked"];
readonly handoverParkedDir?: string;
emptySince: number | undefined;
/** Halves the idle window while the host reports memory pressure; never refuses work. */
memoryPressure: boolean;
/** senpi#7020: what this host is still taking over from a predecessor; `list_sessions` reports it as `handover`. */
inheritedHandover: InheritedHandover | undefined;
/** A compact recovery token belongs to one physical acceptance lane. Negotiate legacy JSONL during overlap. */
awaitingPredecessorScan: boolean;
/** The release_session teardown; the router installs its own member here, so it owns the step. */
releaseTeardown: (sessionId: string, sessionPath: string) => Promise<boolean>;
/** Live kernel view the host injects; absent until start, and a session with no kernel reads zeros. */
hostMemoryView: {
readonly mainHeapBytes: () => number;
readonly kernels: () => readonly RpcHostKernelMemory[];
} | undefined;
constructor(registry: Pick<RpcSessionRegistry, "openSession" | "peek" | "getForCommand" | "beginClose" | "close" | "closeMarked" | "list" | "size" | "warm" | "closeGraceMs"> & Partial<Pick<RpcSessionRegistry, "supportsCompact" | "supportsParkClaim" | "claimPark" | "holderPids" | "attachSession" | "agentDir" | "reserveHandle">>, writer: SessionEventWriter, defaults: RpcHostSessionDefaults, createBinding?: typeof createRpcSessionBinding, connectionOptions?: Parameters<typeof createRpcSessionBinding>[4], idle?: RpcSessionIdlePolicy);
compactAvailable(): boolean;
}
//# sourceMappingURL=session-router-context.d.ts.map