/** * Refusals — why a tool could not do what was asked, and the row that reports one. * * `telemetry.ts` next door is the session wire; this is the refusal vocabulary that * `error-recovery.ts` is graded against. `NoSessionReason` has its own module because it refines * exactly one member of the enum below. */ import { z } from 'zod'; /** * WHY a tool could not do what was asked. * * Derived from the refusal paths that actually exist rather than invented: every member below is a * bucket over `error-recovery.ts`'s recovery table, which is the single place a thrown message is * turned into a next action. That table is the vocabulary; this is its coarse grouping, and a new * entry there cannot compile without being classified here. * * The five that matter belong to four different owners, which is the whole reason for splitting * them: `no_session` is the install's second half never happening, `bad_args` is the agent's own * call, `not_ready` is the environment, and `no_match` / `unsupported` are the app and Reticle's * own capability surface. One undifferentiated "the agent stopped" number cannot be acted on by anyone. */ export declare const RefusalReason: { /** There was no app to reach: nothing connected, no session by that id, or several with none named. */ readonly NO_SESSION: "no_session"; /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */ readonly NO_MATCH: "no_match"; /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */ readonly UNSUPPORTED: "unsupported"; /** The call did not match the schema, or named a value our own validators reject. */ readonly BAD_ARGS: "bad_args"; /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */ readonly NOT_READY: "not_ready"; /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */ readonly OTHER: "other"; }; export type RefusalReason = (typeof RefusalReason)[keyof typeof RefusalReason]; /** One tool call that could not be served. */ export declare const ToolRefusalSchema: z.ZodObject<{ /** Which tool. A name from our own fixed namespace, never app data. */ tool: z.ZodString; reason: z.ZodNativeEnum<{ /** There was no app to reach: nothing connected, no session by that id, or several with none named. */ readonly NO_SESSION: "no_session"; /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */ readonly NO_MATCH: "no_match"; /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */ readonly UNSUPPORTED: "unsupported"; /** The call did not match the schema, or named a value our own validators reject. */ readonly BAD_ARGS: "bad_args"; /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */ readonly NOT_READY: "not_ready"; /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */ readonly OTHER: "other"; }>; /** * For `no_session` only: WHICH no-session situation, from core's closed `NoSessionReason`. * * Rides the refusal rather than the profile because this is where the diagnosis is actually * COMPUTED - `project_profiled` fires once at daemon start, before any tool call has failed, so * it cannot carry a reason that does not exist yet. Absent on every other refusal reason. */ noSessionReason: z.ZodOptional>; /** * TRUE when the call immediately before this one was the SAME tool, also refused. * * Reported on the RETRY rather than on the first refusal, because the first refusal has to be sent * at the moment it happens: deferring it until the next call is known would lose it entirely for * the agent that gives up, and that agent is the whole population this event exists to describe. * So count `retried: true` for retries; the ratio against all refusals is whether the diagnosis * gets anybody unstuck. */ retried: z.ZodBoolean; }, "strip", z.ZodTypeAny, { tool: string; reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready"; retried: boolean; noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined; }, { tool: string; reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready"; retried: boolean; noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined; }>; export type ToolRefusal = z.infer;