# oneprolabs/sourcelens architecture

> Architecture diagram of the GitHub repository oneprolabs/sourcelens, 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/oneprolabs/sourcelens
- Repository: https://github.com/oneprolabs/sourcelens

## Overview

SourceLens is a shared, browser-accessible agentic RAG product: users ask an assistant about governed company data, and a sandboxed coding-agent harness reads and reasons over files on demand rather than relying on embeddings or pre-indexing. The main path runs from chat through the backend to a LensNode runtime and returns source-traceable answers. The graph also preserves account governance, datasource management, extensible tools, and public Q&A. Sampled excerpts are partial, so some subsystem links are omitted where invocation details are unverified.

Main entry points: [`lensnode/lensnode/agent_runtime/runtime.py`](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/agent_runtime/runtime.py) (Agent harness), [`lensnode/lensnode/main.py`](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/main.py) (LensNode worker), [`backend/lens/services.py`](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/services.py) (Run services), [`frontend/src/api/lens.js`](https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/api/lens.js) (Lens API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_chat["Assistant chat<br/>[Chat.vue]"]
  node_webapi["Lens API client<br/>[lens.js]"]
  node_publicqa["Public Q&amp;A pages<br/>[PublicQa.vue]"]
end

subgraph group_control["Backend control"]
  node_gateway["Lens gateway<br/>[gateway.py]"]
  node_execution["Run services<br/>[services.py]"]
  node_runstore[("Run and session state<br/>[models.py]")]
end

subgraph group_runtime["Agent runtime"]
  node_lensnode["LensNode worker<br/>[main.py]"]
  node_agent["Agent harness<br/>[runtime.py]"]
  node_routing["Capability routing<br/>[routing.py]"]
end

subgraph group_resources["Data and tools"]
  node_workspace["Sandbox workspace<br/>[workspace.py]"]
  node_datasources["Datasource control<br/>[services.py]"]
  node_connectors["Source connectors"]
  node_plugins["Plugin integrations<br/>[plugin_runtime.py]"]
  node_skills["Skills and packages<br/>[skill_packages.py]"]
  node_mcp["MCP tools<br/>[mcp_tools.py]"]
end

subgraph group_governance["Access and sharing"]
  node_accounts["Accounts and access<br/>[permissions.py]"]
  node_assistants["Assistant configuration<br/>[assistants.py]"]
  node_sharing["Shared Q&amp;A<br/>[shares.py]"]
end

node_user(("User"))
node_model{{"Chat and vision models"}}

node_user -->|"asks question"| node_chat
node_chat -->|"submits prompt"| node_webapi
node_webapi -->|"calls API"| node_gateway
node_gateway -->|"handles run"| node_execution
node_execution -->|"persists run"| node_runstore
node_execution -->|"dispatches work"| node_lensnode
node_lensnode -->|"runs harness"| node_agent
node_agent -->|"classifies request"| node_routing
node_agent -->|"requests inference"| node_model
node_agent -->|"reads files"| node_workspace
node_datasources -->|"sends commands"| node_lensnode
node_lensnode -->|"syncs sources"| node_connectors
node_connectors -->|"updates files"| node_workspace
node_agent -->|"uses tools"| node_plugins
node_agent -.->|"uses tools"| node_mcp
node_agent -.->|"uses skills"| node_skills
node_accounts -->|"authorizes requests"| node_gateway
node_assistants -->|"configures sources"| node_datasources
node_assistants -->|"configures skills"| node_skills
node_user -->|"views shared answers"| node_publicqa
node_publicqa -->|"loads Q&amp;A"| node_webapi
node_sharing -->|"shares answers"| node_runstore

click node_chat "https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/pages/lens/Chat.vue"
click node_webapi "https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/api/lens.js"
click node_gateway "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/gateway.py"
click node_execution "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/services.py"
click node_runstore "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/models.py"
click node_lensnode "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/main.py"
click node_agent "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/agent_runtime/runtime.py"
click node_routing "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/agent_runtime/routing.py"
click node_workspace "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/workspace.py"
click node_datasources "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/datasource/services.py"
click node_connectors "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/datasource_adapters.py"
click node_plugins "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/plugin_runtime.py"
click node_skills "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/skill_packages.py"
click node_mcp "https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/mcp_tools.py"
click node_accounts "https://github.com/oneprolabs/sourcelens/blob/main/backend/accounts/permissions.py"
click node_assistants "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/assistants.py"
click node_sharing "https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/shares.py"
click node_publicqa "https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/pages/lens/PublicQa.vue"

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_chat,node_webapi,node_publicqa,node_user toneBlue
class node_gateway,node_execution,node_runstore toneAmber
class node_lensnode,node_agent,node_routing toneMint
class node_workspace,node_datasources,node_connectors,node_plugins,node_skills,node_mcp toneRose
class node_accounts,node_assistants,node_sharing,node_model toneIndigo
```

## Components

### User experience

- [Assistant chat](https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/pages/lens/Chat.vue): `frontend/src/pages/lens/Chat.vue`
- [Lens API client](https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/api/lens.js): `frontend/src/api/lens.js`
- [Public Q&A pages](https://github.com/oneprolabs/sourcelens/blob/main/frontend/src/pages/lens/PublicQa.vue): `frontend/src/pages/lens/PublicQa.vue`

### Backend control

- [Lens gateway](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/gateway.py): `backend/lens/views/gateway.py`
- [Run services](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/services.py): `backend/lens/services.py`
- [Run and session state](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/models.py): `backend/lens/models.py`

### Agent runtime

- [LensNode worker](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/main.py): `lensnode/lensnode/main.py`
- [Agent harness](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/agent_runtime/runtime.py): `lensnode/lensnode/agent_runtime/runtime.py`
- [Capability routing](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/agent_runtime/routing.py): `lensnode/lensnode/agent_runtime/routing.py`

### Data and tools

- [Sandbox workspace](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/workspace.py): `lensnode/lensnode/workspace.py`
- [Datasource control](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/datasource/services.py): `backend/lens/datasource/services.py`
- [Source connectors](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/datasource_adapters.py): `lensnode/lensnode/datasource_adapters.py`
- [Plugin integrations](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/plugin_runtime.py): `lensnode/lensnode/plugin_runtime.py`
- [Skills and packages](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/skill_packages.py): `backend/lens/skill_packages.py`
- [MCP tools](https://github.com/oneprolabs/sourcelens/blob/main/lensnode/lensnode/mcp_tools.py): `lensnode/lensnode/mcp_tools.py`

### Access and sharing

- [Accounts and access](https://github.com/oneprolabs/sourcelens/blob/main/backend/accounts/permissions.py): `backend/accounts/permissions.py`
- [Assistant configuration](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/assistants.py): `backend/lens/views/assistants.py`
- [Shared Q&A](https://github.com/oneprolabs/sourcelens/blob/main/backend/lens/views/shares.py): `backend/lens/views/shares.py`

### Other components

- **User**
- **Chat and vision models**

## Connections

- User → Assistant chat: asks question
- Assistant chat → Lens API client: submits prompt
- Lens API client → Lens gateway: calls API
- Lens gateway → Run services: handles run
- Run services → Run and session state: persists run
- Run services → LensNode worker: dispatches work
- LensNode worker → Agent harness: runs harness
- Agent harness → Capability routing: classifies request
- Agent harness → Chat and vision models: requests inference
- Agent harness → Sandbox workspace: reads files
- Datasource control → LensNode worker: sends commands
- LensNode worker → Source connectors: syncs sources
- Source connectors → Sandbox workspace: updates files
- Agent harness → Plugin integrations: uses tools
- Agent harness → MCP tools: uses tools
- Agent harness → Skills and packages: uses skills
- Accounts and access → Lens gateway: authorizes requests
- Assistant configuration → Datasource control: configures sources
- Assistant configuration → Skills and packages: configures skills
- User → Public Q&A pages: views shared answers
- Public Q&A pages → Lens API client: loads Q&A
- Shared Q&A → Run and session state: shares answers
