UNPKG

@code-yeongyu/senpi

Version:

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

93 lines • 6.51 kB
import type { ExtensionUIContext, SessionKind } from "../../core/extensions/types.ts"; import type { SecurityNoticeSnapshot, SecurityNoticeState } from "../../core/security-notices.ts"; import type { CanonicalControl } from "./compact-canonical-pairing.ts"; import { ConnectionDelegations, type LaunchProofSource } from "./delegated-connection.ts"; import type { DelegationDescriptor } from "./delegation-record.ts"; import type { MediaPersister } from "./media-placeholders.ts"; import type { SessionAcceptanceLane } from "./session-acceptance-lane.ts"; import type { SessionEventWriterConnection } from "./session-event-connection.ts"; import type { RpcRecord } from "./session-event-writer-compaction.ts"; import { SessionEventWriterLanes } from "./session-event-writer-lanes.ts"; import { type SocketClosingCode } from "./socket-closing.ts"; /** Connection registration, capabilities, security presentations and per-session delivery settings. */ export declare abstract class SessionEventWriterConnections extends SessionEventWriterLanes { /** Which connections act for someone else, and what they were granted (senpi#5632). */ readonly delegations: ConnectionDelegations; protected delegationDescriptorOf(id: string): DelegationDescriptor | undefined; protected isRemoteConnection(connection: string): boolean; protected isTargetedRecord(record: RpcRecord): boolean; isSessionSealed(sessionId: string): boolean; registerConnection(id: string, connection: SessionEventWriterConnection, options?: { readonly maxQueueBytes?: number; readonly stallMs?: number; readonly launchProof?: LaunchProofSource; }): void; unregisterConnection(id: string): void; attachConnectionToSession(id: string, sessionId: string, compact?: boolean): void; detachConnectionFromSession(id: string, sessionId: string): void; hasConnection(id: string): boolean; setConnectionCapabilities(id: string, capabilities: readonly string[]): void; clearConnectionCapabilities(id: string): void; bindSecurityPresentations(sessionId: string, durableId: string, notices: SecurityNoticeSnapshot, ui: ExtensionUIContext): (() => void) | undefined; acceptWorkerSecuritySnapshot(sessionId: string, snapshot: SecurityNoticeState): void; routeWorkerGrant(sessionId: string, requestId: string, preferred: string | undefined, capabilities: readonly string[], cancel: () => void, title?: string): { readonly accepted: boolean; readonly connection?: string; }; /** An in-process grant select is presented on the connection in context; the others see its notice. */ noticeGrantDialog(sessionId: string, id: string, title: string): void; acceptWorkerGrantResponse(sessionId: string, id: string, connection: string | undefined): boolean | undefined; settleGrantDialog(sessionId: string, id: string): void; hasRegisteredConnectionCapabilities(id: string): boolean; compactSelection(id: string): import("./compact-negotiation.ts").CompactSelection | undefined; getConnectionCapabilities(id: string): readonly string[] | undefined; /** * Records a session's visibility class. A worker session is machine-driven work that * only its attached connections track, so its lifecycle records are delivered to them * instead of broadcast; an interactive session keeps the broadcast every client (the * desktop mirror, the supervisor's idle observer) relies on. */ setSessionMedia(sessionId: string, persister: MediaPersister | undefined): void; /** A worker isolate frames a canonical-only unit; an in-process host folds block controls in its own lane. */ enqueueCanonical(_sessionId: string, _control: CanonicalControl): void; /** A worker isolate reports a lost canonical record to its host lane; an in-process binding tells its lane directly. */ canonicalUnavailable(_sessionId: string, _cause: unknown): void; /** The session's records reach `lane` before `enqueue`; sealing or forgetting the session retires it. */ registerAcceptance(sessionId: string, lane: SessionAcceptanceLane): void; protected abstract prepareDelivery(sessionId: string, record?: object): void; setSessionKind(sessionId: string, kind: SessionKind): void; /** * RULING-124: the host's own close of connection `id` (shutdown, handoff). A peer that selected compact events receives * `socket_closing` first and `close(true)` must then flush before it closes; every other peer gets `close(false)` at * once, exactly as before. */ closeConnection(id: string, code: SocketClosingCode, close: (announced: boolean) => void): Promise<void>; /** Drain just this connection before closing it after its last handoff park. */ flushConnection(id: string): Promise<void>; /** * omo-relay-daemon#307: a socket whose incarnations ran out is ended once its `detach_connection` answer is flushed * (engine_closed). `sinkOf` is the sink the socket host registered under that connection id; its `close` half-closes, * so the answer still buffered in the transport reaches a peer that reads late, instead of a destroy discarding it. */ endExhaustedConnections(sinkOf: (id: string) => { close?(): void; } | undefined): void; /** Execute a connection's command with its response destination in context. */ withConnection<T>(id: string, task: () => T): T; /** Connection id of the command currently being dispatched, when one owns it. */ currentConnection(): string | undefined; /** * Return worker credit once this session's destinations have ACCEPTED the record * into their bounded queues - never when the slowest peer's kernel has drained it. * A client that is merely busy would otherwise pace the producing worker into * session_worker_credit_timeout and force the dead-peer budget under * SESSION_WORKER_LIMITS.controlMs (#1774). Delivery stays bounded by each queue's * maxQueueBytes and its dead-peer cut. A destination that failed (byte overflow or * stall) was already cut and closed by the fanout's onFailure; it is a cut peer, * not a writer failure. The shared stdio lane keeps its stdout backpressure wait. */ waitForSessionBackpressure(sessionId: string): Promise<void>; /** Registered actors this session's records are delivered to, plus the caller's own. */ private sessionActors; } //# sourceMappingURL=session-event-writer-connections.d.ts.map