// Core shared types for the fewtok pipeline.
// Formerly re-exported from src/dict/types.ts (sigil/codec machinery removed 2026-06-16).

export type SessionId = string & { readonly __brand: "SessionId" };
export type FileHash = string & { readonly __brand: "FileHash" };
export function asSessionId(s: string): SessionId { return s as SessionId; }
export function asFileHash(s: string): FileHash { return s as FileHash; }

export type SavingEventKind =
  | "outbound"
  | "inbound"
  | "cache-hit"
  | "expand"
  | "elision"
  | "adapter";

export interface SavingEvent {
  layerId: string;
  kind: SavingEventKind;
  rawBytes: number;
  sentBytes: number;
  meta?: Record<string, unknown>;
}

export interface Layer {
  readonly id: string;
  init(): void | Promise<void>;
  outbound(reqBody: unknown): unknown | Promise<unknown>;
  inbound(resBody: unknown): unknown | Promise<unknown>;
  observe(): SavingEvent[];
  dispose(): void;
}
