/**
 * The process-wide home of every session's job-widget registry, and the public API hosts use: the
 * terminal registers its background sessions here, omo registers task jobs and its cheap-model
 * route. A registry outlives one extension generation (a reload parks it and the next generation
 * re-binds it), so it is keyed by session id rather than held by an extension instance.
 */
import type { Api, Model } from "@earendil-works/pi-ai/compat";
import type { ExtensionContext } from "../../types.ts";
import type { JobWidgetObfuscator } from "./author-redact.ts";
import type { JobWidgetAuthor } from "./author-types.ts";
import { type JobWidgetSourceHandle } from "./registry.ts";
import type { JobWidgetJobInput } from "./registry-job.ts";
import type { JobWidgetState } from "./view-types.ts";
/** A host's route to the model that writes widget specs (omo: its `quick` category). */
export type JobWidgetHostModelResolver = (ctx: ExtensionContext) => Model<Api> | undefined;
export interface JobWidgetSourceRegistration extends JobWidgetJobInput {
    /** The agent session the job belongs to (`ctx.sessionManager.getSessionId()`). */
    readonly sessionId: string;
}
export interface JobWidgetSessionOptions {
    readonly authorAfterMs: number;
    readonly author: JobWidgetAuthor;
    readonly publish: (state: JobWidgetState) => void;
    readonly obfuscate?: JobWidgetObfuscator;
}
/** A session's widgets started (`open`) or went away (`!open`); a re-bind after a reload is neither. */
export type JobWidgetSessionListener = (sessionId: string, open: boolean) => void;
/**
 * Hosts that keep jobs across a reload hear when a session's widgets start or stop: a stop leaves
 * their handles inert (drop them), a start after one is when to offer their running jobs again.
 */
export declare function onJobWidgetSessionChange(listener: JobWidgetSessionListener): () => void;
/** Starts (or re-binds after a reload, with the settings read again) the job widgets of one session. */
export declare function openJobWidgetSession(sessionId: string, options: JobWidgetSessionOptions): void;
/**
 * Sends the session's current state again for a listener that just subscribed (an RPC client that
 * declared `extension_events`), when there is a job to show; an empty state tells it nothing.
 */
export declare function resendJobWidgetState(sessionId: string): void;
/** Holds a session's state across a reload: jobs keep their taps, nothing is sent until re-bound. */
export declare function parkJobWidgetSession(sessionId: string): void;
export declare function closeJobWidgetSession(sessionId: string): void;
/**
 * Offers a job to the session's widgets. Returns `undefined` when the session has no widgets (the
 * setting is off, or the job-widgets extension is not loaded): the host then taps nothing.
 */
export declare function registerJobWidgetSource(registration: JobWidgetSourceRegistration): JobWidgetSourceHandle | undefined;
/** The session's current widget state (views redacted), or `undefined` when the session has no widgets. */
export declare function getJobWidgetState(sessionId: string): JobWidgetState | undefined;
/**
 * Installs the host's model route for every session, ahead of the session's own model and behind an
 * explicit `jobWidgets.model` setting. Returns a function that removes it again (when still current).
 */
export declare function setJobWidgetAuthorResolver(resolver: JobWidgetHostModelResolver | undefined): () => void;
export declare function jobWidgetHostResolver(): JobWidgetHostModelResolver | undefined;
//# sourceMappingURL=session-host.d.ts.map