# leshm0321/dsh-plugin-local-agent-bridge architecture

> Architecture diagram of the GitHub repository leshm0321/dsh-plugin-local-agent-bridge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leshm0321/dsh-plugin-local-agent-bridge
- Repository: https://github.com/leshm0321/dsh-plugin-local-agent-bridge

## Overview

Local Agent Bridge adds a Harness browser panel for driving already-authenticated Claude Code and Codex installations on the Host. The primary flow is: choose a working directory and provider, send a prompt, review streamed/redacted events and any approval requests, then inspect the session and workspace changes. The README also documents native-session continuation, file completion, uploads, repository/diff views, and optional workspace publishing and editing. The graph reflects documented capabilities where implementation was not sampled; wiring is omitted when source excerpts do not establish it.

Main entry points: [`src/core/session-engine.ts`](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/session-engine.ts) (Session engine), [`src/index.ts`](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/index.ts) (Host plugin service), [`src/client/index.tsx`](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/index.tsx) (Local Agents panel), [`src/core/provider.ts`](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/provider.ts) (Provider interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Browser panel"]
  node_browser_panel["Local Agents panel<br/>[index.tsx]"]
  node_panel_views["Conversation and views<br/>[index.tsx]"]
  node_markdown["Markdown rendering<br/>[markdown.tsx]"]
  node_privacy_ui["Privacy controls<br/>[lock.tsx]"]
end

subgraph group_api["Bridge API"]
  node_remote_client["Remote client API"]
  node_shared_protocol["Validated message shapes<br/>[typert.shared.ts]"]
  node_host_plugin["Host plugin service<br/>[index.ts]"]
end

subgraph group_runtime["Session runtime"]
  node_session_engine["Session engine<br/>[session-engine.ts]"]
  node_persistence[("Session persistence<br/>[persistence.ts]")]
  node_privacy["Redaction and privacy<br/>[privacy.ts]"]
end

subgraph group_providers["Provider adapters"]
  node_provider_contract["Provider interface<br/>[provider.ts]"]
  node_claude_adapter["Claude adapter<br/>[claude.ts]"]
  node_codex_adapter["Codex adapter<br/>[codex.ts]"]
end

subgraph group_workspace["Workspace services"]
  node_file_search["File completion<br/>[file-search.ts]"]
  node_workspace_files["Workspace file operations<br/>[workspace-files.ts]"]
  node_workspace_diff["Workspace diffs<br/>[workspace-diff.ts]"]
  node_repository["Repository status<br/>[repository.ts]"]
  node_host_browse["Host directory browsing<br/>[host-browse.ts]"]
  node_uploads["Image uploads<br/>[uploads.ts]"]
end

node_operator(("Operator"))
node_harness["DeepSeek Harness"]
node_claude_cli["Claude Code"]
node_codex_cli["Codex app-server"]

node_operator -->|"uses"| node_browser_panel
node_harness -->|"hosts panel"| node_browser_panel
node_browser_panel -->|"sends requests"| node_remote_client
node_browser_panel -->|"renders sessions"| node_panel_views
node_panel_views -->|"renders text"| node_markdown
node_browser_panel -->|"offers controls"| node_privacy_ui
node_remote_client -->|"calls remotes"| node_host_plugin
node_host_plugin -->|"validates messages"| node_shared_protocol
node_host_plugin -->|"dispatches sessions"| node_session_engine
node_session_engine -->|"loads and saves"| node_persistence
node_session_engine -->|"dispatches turns"| node_provider_contract
node_claude_adapter -->|"implements"| node_provider_contract
node_codex_adapter -->|"implements"| node_provider_contract
node_claude_adapter -->|"launches SDK"| node_claude_cli
node_codex_adapter -->|"uses stdio"| node_codex_cli
node_session_engine -->|"searches files"| node_file_search
node_session_engine -->|"writes files"| node_workspace_files
node_session_engine -->|"receives images"| node_uploads
node_host_plugin -->|"lists directories"| node_host_browse
node_host_plugin -->|"reads diffs"| node_workspace_diff
node_host_plugin -->|"reads status"| node_repository
node_session_engine -->|"uses privacy gate"| node_privacy

click node_browser_panel "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/index.tsx"
click node_panel_views "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/index.tsx"
click node_markdown "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/markdown.tsx"
click node_privacy_ui "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/lock.tsx"
click node_remote_client "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/typert.remote-client.ts"
click node_shared_protocol "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/typert.shared.ts"
click node_host_plugin "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/index.ts"
click node_session_engine "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/session-engine.ts"
click node_persistence "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/persistence.ts"
click node_privacy "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/privacy.ts"
click node_provider_contract "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/provider.ts"
click node_claude_adapter "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/providers/claude.ts"
click node_codex_adapter "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/providers/codex.ts"
click node_file_search "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/file-search.ts"
click node_workspace_files "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/workspace-files.ts"
click node_workspace_diff "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/workspace-diff.ts"
click node_repository "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/repository.ts"
click node_host_browse "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/host-browse.ts"
click node_uploads "https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/uploads.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_browser_panel,node_panel_views,node_markdown,node_privacy_ui toneBlue
class node_remote_client,node_shared_protocol,node_host_plugin toneAmber
class node_session_engine,node_persistence,node_privacy,node_codex_cli toneMint
class node_provider_contract,node_claude_adapter,node_codex_adapter toneRose
class node_file_search,node_workspace_files,node_workspace_diff,node_repository,node_host_browse,node_uploads,node_operator,node_harness,node_claude_cli toneIndigo
```

## Components

### Browser panel

- [Local Agents panel](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/index.tsx): `src/client/index.tsx`
- [Conversation and views](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/index.tsx): `src/client/index.tsx`
- [Markdown rendering](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/markdown.tsx): `src/client/markdown.tsx`
- [Privacy controls](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/client/lock.tsx): `src/client/lock.tsx`

### Bridge API

- [Remote client API](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/typert.remote-client.ts): `src/typert.remote-client.ts`
- [Validated message shapes](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/typert.shared.ts): `src/typert.shared.ts`
- [Host plugin service](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/index.ts): `src/index.ts`

### Session runtime

- [Session engine](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/session-engine.ts): `src/core/session-engine.ts`
- [Session persistence](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/persistence.ts): `src/core/persistence.ts`
- [Redaction and privacy](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/privacy.ts): `src/core/privacy.ts`

### Provider adapters

- [Provider interface](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/provider.ts): `src/core/provider.ts`
- [Claude adapter](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/providers/claude.ts): `src/providers/claude.ts`
- [Codex adapter](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/providers/codex.ts): `src/providers/codex.ts`

### Workspace services

- [File completion](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/file-search.ts): `src/core/file-search.ts`
- [Workspace file operations](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/workspace-files.ts): `src/core/workspace-files.ts`
- [Workspace diffs](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/workspace-diff.ts): `src/core/workspace-diff.ts`
- [Repository status](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/repository.ts): `src/core/repository.ts`
- [Host directory browsing](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/host-browse.ts): `src/core/host-browse.ts`
- [Image uploads](https://github.com/leshm0321/dsh-plugin-local-agent-bridge/blob/main/src/core/uploads.ts): `src/core/uploads.ts`

### Other components

- **Operator**
- **DeepSeek Harness**
- **Claude Code**
- **Codex app-server**

## Connections

- Operator → Local Agents panel: uses
- DeepSeek Harness → Local Agents panel: hosts panel
- Local Agents panel → Remote client API: sends requests
- Local Agents panel → Conversation and views: renders sessions
- Conversation and views → Markdown rendering: renders text
- Local Agents panel → Privacy controls: offers controls
- Remote client API → Host plugin service: calls remotes
- Host plugin service → Validated message shapes: validates messages
- Host plugin service → Session engine: dispatches sessions
- Session engine → Session persistence: loads and saves
- Session engine → Provider interface: dispatches turns
- Claude adapter → Provider interface: implements
- Codex adapter → Provider interface: implements
- Claude adapter → Claude Code: launches SDK
- Codex adapter → Codex app-server: uses stdio
- Session engine → File completion: searches files
- Session engine → Workspace file operations: writes files
- Session engine → Image uploads: receives images
- Host plugin service → Host directory browsing: lists directories
- Host plugin service → Workspace diffs: reads diffs
- Host plugin service → Repository status: reads status
- Session engine → Redaction and privacy: uses privacy gate
