import type { AgentEffect } from './effects.js'; export type ConfirmEntry = { id: string; variant: string; payload: unknown; intent: string; reason: string | null; proposedAt: number; status: 'pending' | 'approved' | 'rejected'; }; export type AgentConfirmState = { pending: ConfirmEntry[]; }; export type AgentConfirmMsg = /** * @humanOnly — internal: dispatched by `handleSendMessage` on the * @llui/dom side when an agent message is gated by @requiresConfirm. * Adds a pending entry to state; the user (not the agent) decides * with Approve / Reject. */ { type: 'Propose'; entry: ConfirmEntry; } /** @intent("Approve a pending agent action") */ | { type: 'Approve'; id: string; } /** @intent("Reject a pending agent action") */ | { type: 'Reject'; id: string; } /** * @humanOnly — internal: the host app dispatches this on a timer to * garbage-collect entries that have been pending past `maxAgeMs`. * Agents have no business poking at the timer wheel directly. */ | { type: 'ExpireStale'; now: number; maxAgeMs: number; }; export declare function init(): [AgentConfirmState, AgentEffect[]]; export declare function update(state: AgentConfirmState, msg: AgentConfirmMsg): [AgentConfirmState, AgentEffect[]]; import { type Send, type Signal } from '@llui/dom'; /** * Static prop bag with reactive (Signal-handle) values. See * agentConnect.ts for the rationale; spread directly into element * helpers and the LLui runtime re-evaluates handle-valued props on * dirty bits. * * Per-entry props are exposed as a function `entry(id)` that returns * a sub-bag whose values are themselves reactive Signal handles — * caller passes the id once, gets back a bag they can spread. */ export type ConnectBag = { root: { 'data-scope': 'agent-confirm'; }; /** * Resolves a per-entry sub-bag. The returned bag's handles look up * the entry by `id` lazily, so the bag stays valid even after * approve/reject mutates the entry's status. */ entry: (id: string) => { card: { 'data-part': 'entry'; 'data-status': Signal<'pending' | 'approved' | 'rejected' | 'missing'>; 'data-id': string; }; approveButton: { onClick: () => void; disabled: Signal; }; rejectButton: { onClick: () => void; disabled: Signal; }; intentText: Signal; reasonText: Signal; payloadText: Signal; }; empty: { 'data-part': 'empty'; 'data-visible': Signal; }; }; export declare function connect(state: Signal, send: Send): ConnectBag; //# sourceMappingURL=agentConfirm.d.ts.map