/** * FeltDB Runtime Observation Contract * * The single observation model shared by every runtime that reports into a * FeltDB Development Workspace. The browser runtime in `@feltdb/core` produces * these records, the workspace persists them durably, investigations are * created from them, and verification is evaluated against them. * * This module is browser-safe: it must not import Node built-ins. */ import type { CorrelatedRuntimeEvent, RuntimeObservationCorrelation, RuntimeRequestObservation } from './workspace-types.js'; /** Workspace collection holding durable runtime observations. */ export declare const RUNTIME_OBSERVATION_COLLECTION = "runtime_observation"; /** * Query parameter names whose values are replaced before an observation is * persisted. Matching is case-insensitive and substring-based so that * `access_token`, `apiKey`, and `X-Session` are all covered. */ export declare const REDACTED_PARAMETER_PATTERNS: string[]; /** Placeholder substituted for a redacted value. */ export declare const REDACTION_PLACEHOLDER = "[redacted]"; /** * Redact sensitive values from a URL while preserving the parts verification * depends on: origin, pathname, and the set of query parameter names. * * FeltDB never captures request or response bodies, and never captures * `Authorization` or `Cookie` headers, so URL redaction is the only place * where credential material can reach a persisted observation. */ export declare function redactUrl(url: string): string; /** Redact a free-text runtime message that may embed a URL or credential. */ export declare function redactMessage(message: string): string; /** Browser family and engine derived from a user agent string. */ export declare function describeBrowser(userAgent: string): { browser: string; engine: string; }; /** * Whether an observation represents an actionable runtime defect. * * FeltDB does not open an investigation for every request. Only these * qualify: * - a server-error response (HTTP >= 500) * - a request that produced no response at all (network failure) * - a client-error response correlated with a runtime or console error * * Successful requests, redirects, and bare 4xx responses (which are usually * intentional application behavior) do not open investigations. */ export declare function isActionableRuntimeDefect(observation: RuntimeRequestObservation): boolean; /** Human-readable reason an observation was treated as actionable. */ export declare function describeDefect(observation: RuntimeRequestObservation): string; /** Generate a workspace-unique observation identifier. */ export declare function createObservationId(): string; /** Generate a correlation identifier for a single in-flight request. */ export declare function createCorrelationId(): string; export interface RuntimeObservationInput { method: string; url: string; status: number; startedAt: number; completedAt: number; workspaceId?: string; sessionId?: string; runtimeInstanceId?: string; correlation?: RuntimeObservationCorrelation; page?: string; userAgent?: string; correlationId?: string; correlatedEvents?: CorrelatedRuntimeEvent[]; networkFailure?: boolean; requestCharacteristics?: Record; responseCharacteristics?: Record; } /** * Build a redacted runtime observation. * * All redaction is applied here so that no caller can persist an unredacted * observation by accident. */ export declare function createRuntimeObservation(input: RuntimeObservationInput): RuntimeRequestObservation; //# sourceMappingURL=runtime-observation.d.ts.map