/** * Algorithmic short descriptor for a pattern, derived from its tokenized * (underscored) form. Replaces the previous "tokenized name as * description" leak — that string is machine identity, unusable as a * human label. * * Strategy: pack as many DISTINCT tokens as fit in `maxChars`, deduping * repeats, then codepoint-safe mid-ellipsis the result. Deterministic and * never synthesizes content — every token shown is verbatim from the * engine-extracted pattern. * * This is the df-LESS fallback used wherever a per-env document-frequency * context is not threaded in (pattern-diff, commitment-report at-risk * rollups, top_patterns incident detection). The discriminator-first * `display_name` (lib/pattern-df.ts `buildDisplayName`) is the richer, * vendor-neutral naming used on the primary surfaces (top_patterns rows, * pattern_detail header) where the env df-map IS available. Boilerplate is * learned from cross-pattern frequency in pattern-df.ts, not from a * strip-list: a hardcoded OTel/vendor prefix denylist is OTel-only and * silently wrong for Java/MDC, k8s, Datadog, and arbitrary apps. * * Falls back to the sample event's first chars if the tokenized pattern * is empty. */ export declare function patternDescriptor(messagePattern: string, sampleLog?: string, maxChars?: number): string; export declare function descriptorFromSample(logJson: Record | null | undefined, maxChars?: number): string | null; /** * Canonical pattern display for HUMAN-facing output across the whole MCP. * One helper so every tool shows a pattern the same way (the inconsistency * fix). `title` is a readable description — from the sample event's content * when a sample is available (best), else the algorithmic token descriptor — * NEVER the raw snake_case token. `identity` is the raw token (+ hash when * known): the machine handle, to be demoted to a small `id:` line or the * agent-only channel, not the human headline. */ /** * One-line plain-English gloss for `tenx_hash`, shown the FIRST time the hash * is surfaced to a human in an action context (pattern_mitigate, * pattern_examples). In survey contexts (top_patterns) the bare hash is * demoted to the agent-only channel instead of glossed. Keep the wording in * one place so it stays consistent across tools. */ export declare const TENX_HASH_GLOSS = "`tenx_hash` is a stable fingerprint for this exact log pattern; dropping or correlating by it is precise and survives wording changes (unlike a text match)."; export declare function patternDisplay(pattern: string, opts?: { sampleJson?: Record | null; sampleLine?: string; hash?: string; maxChars?: number; }): { title: string; identity: string; }; export interface IdentityDescriptor { pattern_hash: string; symbol_message: string; severities: string[]; first_seen_age_seconds: number | null; services: ServiceIdentity[]; } export interface ServiceIdentity { name: string; severity: string; } export interface RawPatternServiceRow { symbolMessage: string; service: string; severity: string; } export interface GroupedPattern { pattern_hash: string; symbol_message: string; severities: string[]; first_seen_age_seconds: number | null; rows_by_service: Map; } /** * Group per-(pattern, service) raw rows into per-pattern groups. Pure * transformation: pattern_hash is derived locally via tenxHash(symbolMessage), * severities are the unique set across the group, first_seen_age_seconds * comes from the supplied batch. */ export declare function groupRowsByPattern(rows: R[], firstSeenByHash: Map): GroupedPattern[];