/** * Behavioral metrics extracted from a single user message. * * Pure, side-effect free. Designed for batch use during session ingestion * and standalone testing. */ export interface UserMessageMetrics { /** Total characters of analyzed text. */ chars: number; /** Whitespace-delimited word count. */ words: number; /** * Number of "yelling" sentences: sentences where more than half of the * alphabetic characters are uppercase (and there are enough letters to * make the ratio meaningful - short acronyms like "OK" don't count). */ yelling: number; /** Profanity hits (word-boundary, case-insensitive). */ profanity: number; /** * Catch-all "obviously upset" signal computed on a *prose-only* body * (code fences, XML/HTML tags, URLs, file mentions, and quoted lines * are stripped first; messages whose remaining prose is >=3 lines score * zero because formatted prompts aren't tantrums). * * Sum of: * - drama runs: 3+ `!` / `?` (with `1`-mishit fallout) * - elongated interjections: `noooo`, `ahhhh`, `ughhh`, `argh`, `stooop`, * `whyyy`, `fuuu(ck)`, `shiiit`, `wtfff`, `omggg`, `yessss`, `helpp`, * `goddd`, `dammm`, `bruhh` * - standalone `dude` * - dot runs: `..`, `...`, `....+` */ anguish: number; /** * Corrective negation: the user is telling us we got it wrong. * * Counted on the same prose-only body as {@link anguish}. * * - line-leading `no` / `nope` / `nah` / `nvm` / `wrong` / `incorrect` * (word-bounded, so `now`, `nobody`, `north` don't match) * - `that(?:'s)? not (what|right|it)` and `not what i (meant|asked|said|wanted)` */ negation: number; /** * The user is repeating themselves - strong signal the previous turn * missed the ask. Counts hits for: * * - `i (meant|said|asked|told you|already (said|told|did|asked|wrote))` * - `(like|as) i (said|told you|asked)` * - `still (doesn't|isn't|not|broken|wrong|fails|failing|the same|same)` * * Bare `still` / `again` are too ambiguous to count alone (they show up * in normal speech like "try again" or "still works"). */ repetition: number; /** * Direct second-person reproach pinned on the agent: * * - `you (didn't|did not|broke|missed|forgot|keep|always|never|still|ignored)` * - sentence-leading `stop ing` imperatives */ blame: number; } /** * Compute behavioral metrics for a user message. * * `text` may be empty or whitespace; in that case every metric is 0. */ export declare function computeUserMessageMetrics(text: string): UserMessageMetrics; /** Empty metrics constant for callers that need a default. */ export declare const EMPTY_USER_METRICS: UserMessageMetrics;