/** * Personal-information safety for the browser agent. * * The NEVER-ANSWER prompt addendum, the per-run skip ledgers and the * field annotation that marks personal/human-only inputs. * * fieldSafety / skippedFields / skippedOsFields are module-level mutable * state shared with the main loop on purpose (same process, one run). * * Extracted from src/cli/commands/browse.ts (line budget) - pure code * motion, no behaviour change. */ import { type FieldSignals, type PersonalClassification } from '../browser/personal-fields'; import type { ElementInfo } from './browse-types'; /** * Field-safety addendum appended to every system prompt (main loop, custom / * optimization passes, stealth loop). The loop may not answer questions that * ask about the human behind the browser. */ export declare const PERSONAL_SAFETY_RULES = "\nPERSONAL QUESTIONS - NEVER ANSWER THEM:\n- Some questions ask about YOU (the human operating the browser), not about the\n task. NEVER answer them with an invented value.\n- Never type: names, email addresses, phone numbers, postal addresses, dates of\n birth or age, government IDs (SSN/NIN/passport/driving licence/tax id),\n passwords, one-time codes, card or bank details, salary or compensation,\n notice periods, work-authorization/visa/sponsorship answers, or personal\n profile links (LinkedIn, GitHub, portfolio, personal website).\n- Fields marked \"[NEVER ANSWER: ...]\" or \"[PERSONAL: ...]\" in the element list\n MUST be left untouched - do not click them, do not type into them.\n- Leaving a personal field EMPTY is correct and expected. A personal field is\n NOT an unanswered question: never treat it as one, and never delay \"done\"\n because of it.\n- If every remaining question is personal, return done.\n- Demographics and free-text personal questions (gender, marital status, \"tell\n us about yourself\") are the human's to answer: prefer to skip them too.\n"; export type SkipKind = 'personal' | 'human'; export interface FieldSafetyConfig { stopOnUserInput: boolean; allowPersonal: boolean; } export declare const fieldSafety: FieldSafetyConfig; /** fieldKey -> why the field must not be typed into for the rest of the run. */ export declare const skippedFields: Map; /** * Stealth mode has no DOM, so fields are identified by the focused OS control * (AutomationId|ClassName|Name) instead of a field key. */ export declare const skippedOsFields: Map; export declare function signalsOf(el: ElementInfo): FieldSignals; export declare function classificationOf(el: ElementInfo): PersonalClassification; /** * Classify every typable element and stamp its stable field key. Elements are * annotated in place so the gate below never re-parses the DOM. */ export declare function annotateFieldSafety(elements: ElementInfo[]): void; export declare function shortLabel(el: ElementInfo): string; /** * Returns a human-readable reason when this element must not be typed into, * or null when it is fine to type. */ export declare function fieldGate(el: ElementInfo | undefined): string | null; /** Record a field the human took over mid-typing; it is never typed again. */ export declare function noteHumanTookOver(el: ElementInfo | undefined, reason: string): void; /** * Drop every HUMAN skip and return how many were cleared. A "you answered this * one yourself" skip is screen-scoped: on the next screen the field is a * different question, so the agent must be free to answer it — and a manual * navigation therefore doubles as the retry trigger a user reaches for when * they cannot leave the screen. PERSONAL skips are deliberately kept: a * personal field is personal for the whole run. */ export declare function clearHumanSkips(): number; export declare function personalSkipSummary(): { personal: number; human: number; };