sequenceDiagram
  participant S as LSP Server
  participant P as Proxy
  participant C as InterceptorChain
  participant Cap as CappingInterceptor
  participant D as DiagnosticsCompressor
  participant CO as CompletionCompressor
  participant H as HoverCompressor
  participant SYM as SymbolCompressor
  participant LOC as LocationCompressor
  participant WS as WSymbolCompressor
  participant WD as WDiagCompressor
  participant Client as Client

  S->>P: Server→Client message (raw JSON)
  P->>P: parse Content-Length frame, extract method + params
  P->>C: process(method, params, ServerToClient)

  Note over C: Config gates each interceptor at runtime

  C->>Cap: applies_to?
  alt Capping enabled & matches
    Cap-->>C: truncated params
  end

  alt method = publishDiagnostics
    C->>D: intercept(params)
    D-->>C: Ok(Some(compacted))
  else method = completion
    C->>CO: intercept(params)
    CO-->>C: Ok(Some(compacted))
  else method = hover
    C->>H: intercept(params)
    H-->>C: Ok(Some(compacted))
  else method = documentSymbol
    C->>SYM: intercept(params)
    SYM-->>C: Ok(Some(compacted))
  else method = references/definition/impl/typeDef
    C->>LOC: intercept(params)
    LOC-->>C: Ok(Some(compacted))
  else method = workspace/symbol
    C->>WS: intercept(params)
    WS-->>C: Ok(Some(compacted))
  else method = workspace/diagnostic
    C->>WD: intercept(params)
    WD-->>C: Ok(Some(compacted))
  else unmatched method
    Note over C: passthrough (no interceptor)
  end

  alt Success
    C-->>P: Ok(Some(transformed_params))
    P->>P: TOON or JSON output (per config)
    P->>Client: transformed message
  else Error (any interceptor)
    C-->>P: Ok(original_params) [fail-open]
    P->>Client: original message (transparent forward)
  end
