UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

26 lines (25 loc) • 2.16 kB
import type { TaskNotificationPayload } from "./task-notification.js"; import { type RegistryCore, type RegisterMonitorInput, type MonitorTaskHandle, type UnifiedTaskResult } from "./task-registry-shared.js"; export declare function registerMonitorLane(core: RegistryCore, input: RegisterMonitorInput): string; /** ONE absorption arithmetic for a monitor poll — env-side-loss accounting * (RB-238), the spool roll (registry memory bound) and the completed-line split — shared by the * watcher tick and the stop-time final drain. A hand-copied twin in stopMonitor is how half-fixes * happen: any change to the roll/line rules must reach both consumers through this method. Returns * the COMPLETE lines (the newline-less tail stays in `lineBuf` for the next poll / terminal flush). */ export declare function absorbMonitorPollLane(handle: MonitorTaskHandle, v: { stdout: string; stderr: string; truncated?: boolean; bytesDroppedBeforeCursor?: number; }): string[]; /** The swallow-guarded event sink, shared by the watcher's emits and the stop-time drain. */ export declare function emitMonitorEventLane(handle: MonitorTaskHandle, n: TaskNotificationPayload): void; /** The monitor watcher tick loop. Same zombie-proofing discipline as {@link startBashWatcher} * (re-entrancy guard / stop on eviction / stop on vanished shell / stop on a throwing adapter), * plus the three monitor-only exits: watcher-enforced timeout, event-storm auto-stop, and the * line→batched-event emission path. All time reads go through the INJECTED clock (design/87). */ export declare function startMonitorWatcherLane(core: RegistryCore, id: string): void; /** design/135 G2: TaskOutput over a monitor — a RE-READABLE spool snapshot (the watcher owns the env * cursor, exactly the bash G2b spool posture): repeated polls return the same accumulated output. */ export declare function pollMonitorLane(handle: MonitorTaskHandle, filter: string | undefined, deadline?: number, signal?: AbortSignal): Promise<UnifiedTaskResult>; export declare function stopMonitorLane(core: RegistryCore, handle: MonitorTaskHandle): Promise<UnifiedTaskResult>;