1123Javayanglei/vscode-chat-proxy/monitor does not have a README file

    Flow

    pub(all) struct Flow {
    id : Int
    start_ms : UInt64
    client_addr : String
    http_method : String
    target : String
    request_headers : Array[(String, String)]
    request_size : Int
    intercepted : Bool
    upstream : String
    request_body : Bytes
    request_truncated : Bool
    injected : Bool
    upstream_body : Bytes?
    upstream_truncated : Bool
    status : Int
    reason : String
    response_headers : Array[(String, String)]
    response_body : Bytes
    response_size : Int
    response_truncated : Bool
    end_ms : UInt64
    error : String?
    finished : Bool
    persisted : Bool
    }

    One proxied request/response pair, as shown in the monitor UI.

    Flow::detail

    Full detail for the flow detail API (shared contract type).

    Flow::summary

    Summary row for the flow list API (shared contract type).

    FlowStore

    pub struct FlowStore {
    db :
    SqliteDriver

    dir : String
    capacity : Int
    active : Array[Flow]
    next_id : Int
    total : Int
    injected_total : Int
    }

    SQLite-backed flow store. One monitor.sqlite file lives in the system temp directory (see default_store_dir); FlowStore::new opens an in-memory database for tests.

    The store is bounded: after every insert/update at most capacity rows are kept (DELETE oldest + auto_vacuum). Only in-flight flows keep bodies in memory; finished rows are read back from SQLite.

    FlowStore::begin

    fn FlowStore::begin(self : FlowStore, client_addr~ : String, http_method~ : String, target~ : String, request_headers~ : Array[(String, String)], request_body~ : Bytes, intercepted~ : Bool, upstream~ : String) -> Flow

    Register a new flow (request fully read, response pending). The row is inserted immediately so a crash leaves a visible (stale) record.

    FlowStore::clear

    fn FlowStore::clear(self : FlowStore) -> Unit

    Clear the list, the database rows and the counters.

    FlowStore::close

    fn FlowStore::close(self : FlowStore) -> Unit

    Close the underlying database (mainly for tests and orderly shutdown).

    FlowStore::data_dir

    fn FlowStore::data_dir(self : FlowStore) -> String

    Directory currently backing this store; empty means the in-memory store.

    FlowStore::detail

    Full detail of one flow: from memory while it is in flight, from SQLite once it has been persisted.

    FlowStore::find

    fn FlowStore::find(self : FlowStore, id : Int) -> Flow?

    FlowStore::finish

    fn FlowStore::finish(self : FlowStore, flow : Flow) -> Unit

    Mark a flow complete (idempotent), update its row and release bodies.

    FlowStore::list_response

    Flow list API payload (newest first, shared contract type).

    FlowStore::new

    fn FlowStore::new(capacity? : Int) -> FlowStore

    In-memory store (tests, and the fallback when the temp directory is not writable). Same schema and SQL as the file-backed store.

    FlowStore::open

    async fn FlowStore::open(dir : String, capacity? : Int) -> FlowStore

    Open (or create) the monitor directory and its SQLite database. I/O failures degrade gracefully to an in-memory store so the proxy itself is never taken down by the monitor.

    body_capture_limit

    let body_capture_limit : Int

    Max bytes stored per body (request or response) in the monitor.

    cap_bytes

    fn cap_bytes(b : Bytes) -> (Bytes, Bool)

    Store at most body_capture_limit bytes of a body.

    decode_chunked_body

    fn decode_chunked_body(raw : Bytes) -> Bytes

    Best-effort decode of a complete chunked body (for display only; the bytes forwarded to the client are never touched). Falls back to the raw bytes when the input is not valid chunked framing.

    default_store_dir

    fn default_store_dir(port~ : Int) -> String

    Default on-disk location for monitor data: a stable subdirectory of the system temp directory, one per monitor port so separate proxy instances do not overwrite each other's database.

    MONITOR_DIR / VSCODE_CHAT_PROXY_MONITOR_DIR override the location. The OS may clean the temp directory at any time; losing this file only loses monitor history, never proxy correctness.

    run_web_server

    async fn run_web_server(host : String, port : Int, store : FlowStore) -> Unit

    Serve the monitor UI and JSON API on host:port.