/** * Raw Claude Code hook payload -> normalized AnalyticsEvent. * * `userId` / `machineId` / `harness` are never present on the hook payload * itself (Claude Code has no idea it's running inside the harness) — they're * injected from server-side context resolved by the caller (the session * registry, auth state, machine-id file). */ import type { AnalyticsEvent, HarnessKind } from "../../shared/types.js"; /** The six hook names Claude Code invokes; see claude-settings.ts. */ export type ClaudeHookEvent = "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SessionEnd"; /** Loose on purpose — hook payloads vary by event and Claude Code version. */ export type RawHookPayload = Record; export interface NormalizeContext { userId: string | null; tenantId: string | null; machineId: string; harnessSessionId: string; harness: HarnessKind; /** Already-known agent session id, if the registry has resolved one yet. */ agentSessionId: string | null; /** Per-harnessSessionId monotonic counter, assigned by the caller (see core/collector/seq.ts). */ seq: number; } /** Stringify + truncate a value so a giant tool payload can't blow up storage. */ export declare function truncateForPayload(value: unknown, maxLength?: number): string; /** * The suffix {@link truncateForPayload} leaves behind, with the omitted count * captured. Exported so every consumer that has to recognize truncated text — * the record fold's `responseTruncated`, the archive's re-clip — tests for the * same marker this function writes, instead of keeping its own copy of the * format. No `g` flag: callers use `test`/`exec` freely. */ export declare const PAYLOAD_TRUNCATION_MARKER: RegExp; /** * Normalize one Claude Code hook invocation into an AnalyticsEvent, or * `null` when the hook doesn't map to an analytics event (PreToolUse, or an * unrecognized hook name). */ export declare function normalizeHookEvent(hookEvent: string, hookPayload: RawHookPayload, context: NormalizeContext): AnalyticsEvent | null; //# sourceMappingURL=normalizer.d.ts.map