# pranavsinghpatil/inlay-mware architecture

> Architecture diagram of the GitHub repository pranavsinghpatil/inlay-mware, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranavsinghpatil/inlay-mware
- Repository: https://github.com/pranavsinghpatil/inlay-mware

## Overview

Inlay is loopback middleware for transparently forwarding a coding harness’s provider requests while collecting bounded, content-free measurements. The main runtime path validates configuration, accepts and buffers requests, forwards them to the configured provider, streams responses back, and records process-local metrics. Optional structural, recurrence, and timeline observations enrich those records; explicitly loaded Pi adapters provide separate research capture of protocol or tool-action metadata. The README documents the transport boundary and measurement limits; sampled sources show the runtime and adapter calls, but not every route branch.

Main entry points: [`src/app.ts`](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/app.ts) (HTTP proxy), [`extensions/content-free-timeline.ts`](https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/content-free-timeline.ts) (Content-free timeline), [`src/server.ts`](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/server.ts) (Server startup), [`extensions/protocol-spike.ts`](https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/protocol-spike.ts) (Protocol spike)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Proxy runtime"]
  node_server["Server startup<br/>[server.ts]"]
  node_config["Proxy config<br/>[config.ts]"]
  node_proxy["HTTP proxy<br/>[app.ts]"]
  node_http_helpers["HTTP helpers<br/>[http.ts]"]
end

subgraph group_measurement["Transport measurement"]
  node_metrics[("Metrics window<br/>[metrics.ts]")]
  node_structure["Request structure<br/>[observation.ts]"]
  node_stream_observer["SSE observer<br/>[observation.ts]"]
  node_recurrence["Exact recurrence<br/>[observation.ts]"]
end

subgraph group_pi_research["Pi research adapters"]
  node_protocol_adapter["Protocol spike<br/>[protocol-spike.ts]"]
  node_action_adapter["Action feasibility"]
  node_timeline_adapter["Content-free timeline"]
end

subgraph group_capture["Local capture"]
  node_protocol_capture["Protocol capture"]
  node_action_recorder["Action recorder"]
end

node_harness(("Coding harness"))
node_provider["Existing provider"]
node_pi(("Pi harness"))

node_harness -->|"sends requests"| node_proxy
node_proxy -->|"forwards requests"| node_provider
node_provider -->|"streams responses"| node_proxy
node_proxy -->|"passes through"| node_harness
node_server -->|"loads"| node_config
node_server -->|"starts"| node_proxy
node_proxy -->|"reads and forwards"| node_http_helpers
node_proxy -->|"records metrics"| node_metrics
node_proxy -->|"derives structure"| node_structure
node_proxy -->|"observes stream"| node_stream_observer
node_proxy -->|"tracks recurrence"| node_recurrence
node_protocol_adapter -->|"appends events"| node_protocol_capture
node_action_adapter -->|"records actions"| node_action_recorder
node_timeline_adapter -->|"records timings"| node_action_recorder
node_pi -.->|"loads adapter"| node_protocol_adapter
node_pi -.->|"loads adapter"| node_action_adapter
node_pi -.->|"loads adapter"| node_timeline_adapter
node_timeline_adapter -->|"overrides base URL"| node_provider

click node_server "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/server.ts"
click node_config "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/config.ts"
click node_proxy "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/app.ts"
click node_http_helpers "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/http.ts"
click node_metrics "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/metrics.ts"
click node_structure "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts"
click node_stream_observer "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts"
click node_recurrence "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts"
click node_protocol_adapter "https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/protocol-spike.ts"
click node_protocol_capture "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/protocol-capture.ts"
click node_action_adapter "https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/action-fusion-feasibility.ts"
click node_timeline_adapter "https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/content-free-timeline.ts"
click node_action_recorder "https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/action-observation.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_config,node_proxy,node_http_helpers toneBlue
class node_metrics,node_structure,node_stream_observer,node_recurrence toneAmber
class node_protocol_adapter,node_action_adapter,node_timeline_adapter toneMint
class node_protocol_capture,node_action_recorder toneRose
class node_harness,node_provider,node_pi toneIndigo
```

## Components

### Proxy runtime

- [Server startup](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/server.ts): `src/server.ts`
- [Proxy config](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/config.ts): `src/config.ts`
- [HTTP proxy](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/app.ts): `src/app.ts`
- [HTTP helpers](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/http.ts): `src/http.ts`

### Transport measurement

- [Metrics window](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/metrics.ts): `src/metrics.ts`
- [Request structure](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts): `src/observation.ts`
- [SSE observer](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts): `src/observation.ts`
- [Exact recurrence](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/observation.ts): `src/observation.ts`

### Pi research adapters

- [Protocol spike](https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/protocol-spike.ts): `extensions/protocol-spike.ts`
- [Action feasibility](https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/action-fusion-feasibility.ts): `extensions/action-fusion-feasibility.ts`
- [Content-free timeline](https://github.com/pranavsinghpatil/inlay-mware/blob/main/extensions/content-free-timeline.ts): `extensions/content-free-timeline.ts`

### Local capture

- [Protocol capture](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/protocol-capture.ts): `src/protocol-capture.ts`
- [Action recorder](https://github.com/pranavsinghpatil/inlay-mware/blob/main/src/action-observation.ts): `src/action-observation.ts`

### Other components

- **Coding harness**
- **Existing provider**
- **Pi harness**

## Connections

- Coding harness → HTTP proxy: sends requests (evidence: `README.md`)
- HTTP proxy → Existing provider: forwards requests (evidence: `README.md`)
- Existing provider → HTTP proxy: streams responses (evidence: `README.md`)
- HTTP proxy → Coding harness: passes through (evidence: `README.md`)
- Server startup → Proxy config: loads (evidence: `src/server.ts`)
- Server startup → HTTP proxy: starts (evidence: `src/server.ts`)
- HTTP proxy → HTTP helpers: reads and forwards (evidence: `src/app.ts`)
- HTTP proxy → Metrics window: records metrics (evidence: `src/app.ts`)
- HTTP proxy → Request structure: derives structure (evidence: `src/app.ts`)
- HTTP proxy → SSE observer: observes stream (evidence: `src/app.ts`)
- HTTP proxy → Exact recurrence: tracks recurrence (evidence: `src/app.ts`)
- Protocol spike → Protocol capture: appends events (evidence: `extensions/protocol-spike.ts`)
- Action feasibility → Action recorder: records actions (evidence: `extensions/action-fusion-feasibility.ts`)
- Content-free timeline → Action recorder: records timings (evidence: `extensions/content-free-timeline.ts`)
- Pi harness → Protocol spike: loads adapter
- Pi harness → Action feasibility: loads adapter
- Pi harness → Content-free timeline: loads adapter
- Content-free timeline → Existing provider: overrides base URL (evidence: `extensions/content-free-timeline.ts`)
