UNPKG

@code-yeongyu/senpi

Version:

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

86 lines • 5.32 kB
import type { McpFormBinding } from "../../core/mcp-form-types.ts"; import type { McpPresenterAuthority, McpPresenterConnection } from "./mcp-presenter-authority.ts"; import { LegacyRecordRefusals } from "./legacy-record-depth.ts"; import type { MediaPersister } from "./media-placeholders.ts"; import type { DelegationDescriptor } from "./delegation-record.ts"; import type { ConnectionLocality } from "./raiser-notices.ts"; import type { RpcRemoteOrigin } from "./remote-origin.ts"; import { SecretInputPresentations } from "./secret-input-presentations.ts"; import { RpcSecurityPresentations } from "./security-presentations.ts"; import { SessionEventFanout } from "./session-event-fanout.ts"; import { SessionConnectionContext } from "./session-connection-context.ts"; import { SessionOpenTurns } from "./session-open-turns.ts"; import { type QueueNode, type RecordQueue, SessionRecordAccounting } from "./session-record-accounting.ts"; import { SessionStatusStream } from "./session-status-stream.ts"; import { SessionStructuredLanes } from "./session-structured-lanes.ts"; import { SurfaceDigestDedupe } from "./session-surface-dedupe.ts"; import type { SocketEventSinkActor } from "./socket-event-fanout.ts"; export type RawWriter = (chunk: string) => void; export type BackpressureWaiter = () => Promise<void>; export type FlushScheduler = (flush: () => Promise<void>) => void; /** * Every field of the session event writer, in its original declaration order, and its constructor. * The writer's behaviour is split across the layers that extend this one (session-event-writer.ts). */ export declare abstract class SessionEventWriterState { protected readonly secretPresentations: SecretInputPresentations; readonly structuredLanes: SessionStructuredLanes; /** Records refused at the engine's JSON depth limit on the legacy wire (RULING-68). */ readonly legacyRefusals: LegacyRecordRefusals; protected presenterAuthority?: McpPresenterAuthority; protected readonly presenterConnections: Map<string, McpPresenterConnection>; protected readonly presenterBindings: Map<string, McpFormBinding>; protected readonly records: SessionRecordAccounting; protected readonly queues: Map<string, RecordQueue>; protected readonly fanout: SessionEventFanout; readonly connectionContext: SessionConnectionContext; /** Set by the host wiring: the remote device a connection declared it speaks for (`set_client_info.remoteOrigin`). */ originOf?: (connection: string) => RpcRemoteOrigin | undefined; protected readonly locality: ConnectionLocality; protected readonly securityPresentations: RpcSecurityPresentations; readonly workerSecurityBridge: boolean; protected readonly controlQueue: RecordQueue; protected readonly readyQueues: RecordQueue[]; protected readonly sealedSessions: Set<string>; /** Sessions whose lifecycle records stay on their attached connections (`kind: "worker"`). */ protected readonly workerSessions: Set<string>; protected readonly openTurns: SessionOpenTurns; /** Host-level `subscribe_sessions` subscriptions; publishes ride each subscriber's own FIFO actor. */ readonly status: SessionStatusStream; /** F13 surface dedupe: one notice per connection per inventory transition, tracked per session. */ protected readonly surfaceDedupe: SurfaceDigestDedupe; /** * Set by the host wiring: drains the session's pending effect transitions. Invoked after every * record this writer publishes for the session, so an `effect_status` always lands after its cause. */ afterRecord?: (sessionId: string) => void; /** Per-session image persisters: bytes reach disk before the placeholder that names them is emitted. */ protected readonly mediaPersisters: Map<string, MediaPersister>; protected readonly writeRaw: RawWriter; protected readonly waitForBackpressure?: BackpressureWaiter; protected readonly scheduleFlush: FlushScheduler; protected flushScheduled: boolean; protected drainPromise?: Promise<void>; protected inFlight?: { queue: RecordQueue; node: QueueNode; }; protected failure?: unknown; protected controlOverflowReported: boolean; protected closeOverflowReported: boolean; protected readonly closeOverflowActors: WeakSet<SocketEventSinkActor>; protected reservedCloseRecords: number; protected reservedCloseBytes: number; get pendingCloseRecordCount(): number; get pendingCloseByteLength(): number; constructor(writeRaw: RawWriter, scheduleFlush?: FlushScheduler); constructor(writeRaw: RawWriter, waitForBackpressure: BackpressureWaiter, scheduleFlush?: FlushScheduler); abstract withConnection<T>(id: string, task: () => T): T; abstract currentConnection(): string | undefined; /** Delegated (senpi#5632) or declared remote: never a background route for a secret or grant select (D11 S3-5). */ protected abstract isRemoteConnection(connection: string): boolean; /** The delegation a line of connection `id` captures at its start (omo-relay-daemon#307). */ protected abstract delegationDescriptorOf(id: string): DelegationDescriptor | undefined; protected abstract requestFlush(): void; } //# sourceMappingURL=session-event-writer-state.d.ts.map