UNPKG

@code-yeongyu/senpi

Version:

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

74 lines • 3.36 kB
export const TERMINAL_MONITOR_STATE_EVENT = "terminal_monitor_state"; export const TERMINAL_MONITOR_ENDED_EVENT = "terminal_monitor_ended"; export const WAKE_SOURCE_STATE_EVENT = "wake_source_state"; export const CONTINUATION_HOLD_STATE_EVENT = "continuation_hold_state"; /** Live widgets of a session's long background jobs; payload `JobWidgetState` (job-widgets/view-types.ts). */ export const JOB_WIDGET_STATE_EVENT = "job_widget_state"; export const MONITOR_NOTIFICATION_CUSTOM_TYPE = "senpi-monitor:notification"; /** A background terminal session's age notice or auto-reap; payload `TerminalBackgroundAgeEvent` (senpi#6201). */ export const TERMINAL_BACKGROUND_AGE_EVENT = "terminal_background_age"; /** True for a delivered monitor notification that carries a person's words (omo#10280). */ export function isHumanInputMonitorNotification(message) { if (typeof message !== "object" || message === null) return false; const candidate = message; if (candidate.role !== "custom" || candidate.customType !== MONITOR_NOTIFICATION_CUSTOM_TYPE) return false; const monitors = candidate.details?.monitors; return (Array.isArray(monitors) && monitors.some((monitor) => typeof monitor === "object" && monitor !== null && monitor.humanInput === true)); } /** * Deliberately validates only the shared cross-package fields. Emitters may add * source-specific details such as `channels` or `monitors`. */ export function isWakeSourceStateEvent(data) { return (typeof data === "object" && data !== null && "source" in data && typeof data.source === "string" && data.source.length > 0 && "activeCount" in data && typeof data.activeCount === "number" && Number.isFinite(data.activeCount)); } export function isContinuationHoldStateEvent(data) { return (typeof data === "object" && data !== null && "source" in data && typeof data.source === "string" && data.source.length > 0 && "active" in data && typeof data.active === "boolean"); } export function isTerminalMonitorStateEvent(data) { return (typeof data === "object" && data !== null && "activeCount" in data && typeof data.activeCount === "number" && Number.isInteger(data.activeCount) && data.activeCount >= 0); } export function isTerminalMonitorEndedEvent(data) { return (typeof data === "object" && data !== null && "id" in data && typeof data.id === "string" && "description" in data && typeof data.description === "string" && "startedAtMs" in data && typeof data.startedAtMs === "number" && Number.isFinite(data.startedAtMs) && "endedAtMs" in data && typeof data.endedAtMs === "number" && Number.isFinite(data.endedAtMs) && "exitCode" in data && (data.exitCode === null || (typeof data.exitCode === "number" && Number.isInteger(data.exitCode))) && "fireCount" in data && typeof data.fireCount === "number" && Number.isInteger(data.fireCount) && data.fireCount >= 0 && "reason" in data && (data.reason === "exit" || data.reason === "timeout" || data.reason === "killed" || data.reason === "disposed")); } //# sourceMappingURL=monitor-state-event.js.map