/** * `src/services/observability/observability-schema.ts` * * The wire format for slice-topology observability events: the schema version, * the category and subagent-role vocabularies, the zod schema that is the * source of truth for a `slices.jsonl` record, the emit-side contract types * (`EmitOptions` / `EmitFailureReason` / `EmitResult`) and the * `OBSERVABILITY_CONSTANTS` roll-up over them. * * Extracted verbatim (wave-3C of the file-size cap campaign) from * `observability-service.ts`, which imports what it uses and re-exports every * PUBLIC name below, so importers keep resolving all of them from * `observability-service.js` unchanged. No emit or read logic lives here — the * writer and the reader stay in the service module. */ import { z } from 'zod'; export declare const OBSERVABILITY_SCHEMA_VERSION: 1; export declare const OBSERVABILITY_CATEGORIES: readonly ["slice-transition", "dispatch", "checkpoint", "mode-gate", "context-trigger", "post-compact", "cycle", "token-usage", "monotonic-trigger", "lease"]; export type ObservabilityCategory = (typeof OBSERVABILITY_CATEGORIES)[number]; export declare const OBSERVABILITY_SUBAGENT_ROLES: readonly ["rd", "qa", "code-reviewer", "karpathy-reviewer", "peaks-security-audit", "peaks-perf-audit"]; export type ObservabilitySubagentRole = (typeof OBSERVABILITY_SUBAGENT_ROLES)[number]; export declare const ObservabilityEventSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; ts: z.ZodString; sessionId: z.ZodString; category: z.ZodEnum<{ "slice-transition": "slice-transition"; dispatch: "dispatch"; checkpoint: "checkpoint"; "mode-gate": "mode-gate"; "context-trigger": "context-trigger"; "post-compact": "post-compact"; cycle: "cycle"; "token-usage": "token-usage"; "monotonic-trigger": "monotonic-trigger"; lease: "lease"; }>; sliceRid: z.ZodOptional; role: z.ZodOptional>; detail: z.ZodRecord; }, z.core.$strip>; export type ObservabilityEvent = z.infer; export type EmitOptions = { /** Absolute path to the project root (where `.peaks/_runtime/` lives). */ projectRoot: string; }; export type EmitFailureReason = 'invalid-schema' | 'write-failed' | 'invalid-session-id'; export type EmitResult = { /** True when the JSONL line was appended; false on any error path. */ written: boolean; /** * Absolute path to the metrics file the event was written to (or would * be). Empty string when the session id named no session directory — * there is no path to report, and `reason` says so. */ path: string; /** Set only when `written` is false. */ reason?: EmitFailureReason; }; export declare const OBSERVABILITY_CONSTANTS: { readonly SCHEMA_VERSION: 1; readonly CATEGORIES: readonly ["slice-transition", "dispatch", "checkpoint", "mode-gate", "context-trigger", "post-compact", "cycle", "token-usage", "monotonic-trigger", "lease"]; readonly SUBAGENT_ROLES: readonly ["rd", "qa", "code-reviewer", "karpathy-reviewer", "peaks-security-audit", "peaks-perf-audit"]; };