UNPKG

@code-yeongyu/senpi

Version:

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

55 lines • 2.73 kB
import type { ExtensionContext } from "../../types.ts"; import type { TerminalBackgroundAgeEvent } from "../monitor-state-event.ts"; import type { NotifyMode } from "./settings.ts"; import type { TerminalExitView } from "./tools/context.ts"; /** Modes that never wake the agent: one-shot, non-interactive runs. */ export declare const NON_INTERACTIVE_MODES: Set<string>; export declare const TERMINAL_NOTIFICATION_CUSTOM_TYPE = "senpi-terminal:notification"; export interface TerminalNotifierDeps { /** Deliver a model-visible notification without rendering synthetic user input. */ readonly sendMessage: (message: { customType: string; content: string; display: boolean; details?: unknown; }, options: { triggerTurn: boolean; deliverAs: "steer" | "followUp" | "nextTurn"; }) => void; readonly getContext: () => ExtensionContext | undefined; readonly getMode: () => NotifyMode; /** On a hand (`pi.isLoopRemote()`), the loop that receives a notice applies the session guards, not this side. */ readonly loopRemote?: () => boolean; } /** Max chars of sanitized final output embedded in a completion notification. */ export declare const NOTICE_TAIL_MAX_CHARS = 2000; export interface TerminalNotificationDelivery { readonly send: (content: string, options?: { readonly forceWake?: boolean; readonly nextTurn?: boolean; readonly details?: unknown; }) => void; } /** Shared terminal-notification guard and notify-mode mapping. */ export declare function getTerminalNotificationDelivery(deps: TerminalNotifierDeps, customType?: string): TerminalNotificationDelivery | undefined; /** One plain sentence (or two) for the TUI and the model: which session, how old, and how it stops. */ export declare function describeBackgroundAge(event: TerminalBackgroundAgeEvent): string; /** * Notifies an interactive agent once when a background session completes. * * Guards (todo 23): never wakes in one-shot `-p`/`--print`/`--mode json` runs; never wakes * without an active model (would spin an auth-less turn); `notify:"off"` suppresses entirely; * each session id fires at most once. `wake` steers immediately; `next-turn` queues a follow-up. */ export declare class TerminalNotifier { private readonly notified; private readonly deps; private retired; constructor(deps: TerminalNotifierDeps); notifyCompletion(id: string, runtime: TerminalExitView): void; /** A still-running session's age notice (senpi#6201), delivered like a completion notice. */ notifyAge(event: TerminalBackgroundAgeEvent): void; private retire; private deliverCompletion; } //# sourceMappingURL=notify.d.ts.map