Skip to main content

plexus_core/plexus/
middleware.rs

1//! DEPRECATED: Stream-based guidance replaces middleware
2//!
3//! This module is kept for historical reference only. Error guidance is now
4//! provided via `PlexusStreamEvent::Guidance` events in error streams.
5//!
6//! **Migration:** Frontends should handle guidance events instead of parsing
7//! JSON-RPC error data. See the frontend migration guide at:
8//! `docs/architecture/16680880693241553663_frontend-guidance-migration.md`
9//!
10//! **Architecture:** See stream-based guidance design at:
11//! `docs/architecture/16680881573410764543_guidance-stream-based-errors.md`
12
13#![allow(dead_code)]
14
15use std::sync::Arc;
16
17/// Activation info needed for generating guided errors (DEPRECATED - kept for backwards compat)
18#[derive(Clone, Debug)]
19pub struct ActivationRegistry {
20    /// List of available activation namespaces
21    pub activations: Vec<String>,
22}
23
24impl ActivationRegistry {
25    pub fn new(activations: Vec<String>) -> Self {
26        Self { activations }
27    }
28}
29
30/// Middleware that enriches error responses with guided `try` suggestions (DEPRECATED - no-op)
31#[derive(Clone)]
32pub struct GuidedErrorMiddleware<S> {
33    inner: S,
34    _registry: Arc<ActivationRegistry>,
35}
36
37impl<S> GuidedErrorMiddleware<S> {
38    pub fn new(inner: S, registry: Arc<ActivationRegistry>) -> Self {
39        Self { inner, _registry: registry }
40    }
41}