@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
55 lines • 2.72 kB
TypeScript
/**
* Rpc watches as a monitor source: each record owns one `RpcMonitorWatch` and reports its lines through
* the registry's one sink, so the fire stats, pause/rearm and the ended observer work as for command and
* file watches. A paused watch counts the lines it drops; a line identical to the previous one is
* dropped (consecutive dedupe), on top of the notifier's same-batch rule.
*/
import { type MonitorEndedReason, type MonitorRecordBase, type MonitorSourceHost } from "./monitor-types.ts";
import type { RpcEvents, RpcTarget } from "./rpc-monitor-targets.ts";
import { type RpcMonitorCheckpoint, RpcMonitorWatch } from "./rpc-monitor-watch.ts";
import type { RpcRemoteSource } from "./rpc-remote-source.ts";
export interface RegisterRpcMonitorOptions {
readonly description: string;
readonly target: RpcTarget;
/** The target as the caller wrote it (what the manifest records). */
readonly targetText: string;
readonly events: RpcEvents;
readonly exclude: readonly string[];
readonly filter?: RegExp;
readonly persistent: boolean;
readonly timeoutMs?: number;
readonly expiresAt?: number;
readonly monitorId?: string;
readonly agentDir: string;
/** Endpoint discovery override (tests); defaults to the endpoints registered under `agentDir`. */
readonly endpoints?: () => Promise<readonly string[]>;
/** Remote source override (tests); defaults to the one an extension registered. */
readonly remoteSource?: RpcRemoteSource;
/** A restore's saved view: the lines for what changed are injected once the watch has joined. */
readonly restoredFrom?: RpcMonitorCheckpoint;
readonly onCheckpoint?: (monitorId: string, checkpoint: RpcMonitorCheckpoint) => void;
}
export interface RpcMonitorRecord extends MonitorRecordBase {
readonly rpcWatch: RpcMonitorWatch;
readonly targetText: string;
mutedDropped: number;
lastLine: string | undefined;
readonly deadline: ReturnType<typeof setTimeout> | undefined;
}
export declare class RpcMonitorSource {
#private;
constructor(host: MonitorSourceHost);
get(id: string): RpcMonitorRecord | undefined;
values(): IterableIterator<RpcMonitorRecord>;
keys(): IterableIterator<string>;
/** Arms the watch; resolves to its runtime id, stable id and the arm-time session rows. */
register(options: RegisterRpcMonitorOptions): Promise<{
id: string;
monitorId: string;
rows: string[];
}>;
/** Ends one watch; false when the id is not a live rpc watch. */
settle(id: string, summary: string, reason?: MonitorEndedReason): boolean;
settleAll(summary: string): number;
}
//# sourceMappingURL=rpc-monitor-source.d.ts.map