# leshm0321/ai-jsunpack architecture

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

## Overview

AI JS Unpack is an authorized JavaScript build-artifact unpacking, audit, and runnable-reconstruction platform. Users submit a directory, script, or supported archive through the web workbench; the API manages the job and the worker analyzes its inputs, plans and runs agent stages, reconstructs a project, validates it, and packages downloadable results with evidence. The map includes the documented settings, audit, and runtime-comparison branches. Pipeline excerpts are partial, so links for unsampled orchestration are limited to documented behavior; the remote Browser Runner is optional.

Main entry points: [`apps/worker/worker/pipeline.py`](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/pipeline.py) (Job pipeline), [`apps/api/app/main.py`](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/main.py) (FastAPI service), [`apps/web/src/workbench.tsx`](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/workbench.tsx) (Job workbench), [`apps/web/src/api.ts`](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/api.ts) (Web API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web app<br/>[App.tsx]"]
  node_workbench["Job workbench<br/>[workbench.tsx]"]
  node_web_api["Web API client<br/>[api.ts]"]
  node_settings_ui["Settings center<br/>[settings.tsx]"]
end

subgraph group_api_state["API and state"]
  node_api["FastAPI service<br/>[main.py]"]
  node_job_store[("Metadata store<br/>[store.py]")]
  node_artifact_store[("Artifact store<br/>[artifact_store.py]")]
end

subgraph group_processing["Analysis and reconstruction"]
  node_worker_queue["Worker queue<br/>[queue.py]"]
  node_pipeline["Job pipeline<br/>[pipeline.py]"]
  node_core_bridge["Core bridge<br/>[core_bridge.py]"]
  node_core["Unpack and rebuild<br/>[index.ts]"]
  node_agents["Agent runtime<br/>[agent_runtime.py]"]
  node_agent_process["Agent process<br/>[agent_process.py]"]
  node_agent_backend["CrewAI backend"]
  node_knowledge["Evidence retrieval<br/>[retriever.py]"]
  node_memory["Project memory<br/>[service.py]"]
end

subgraph group_validation["Validation and delivery"]
  node_validation["Build validation"]
  node_runtime_smoke["Runtime comparison<br/>[runtime_smoke.py]"]
  node_browser_runner["Browser Runner<br/>[main.py]"]
  node_packaging["Result packaging<br/>[packaging.py]"]
  node_delivery["Result delivery<br/>[delivery.py]"]
end

node_user(("Authorized user"))
node_provider(("Model provider"))

node_user -->|"uses"| node_web
node_web -->|"routes to"| node_workbench
node_workbench -->|"submits jobs"| node_web_api
node_settings_ui -->|"reads and updates"| node_web_api
node_web_api -->|"calls"| node_api
node_api -->|"persists job state"| node_job_store
node_api -->|"reads and writes artifacts"| node_artifact_store
node_api -->|"dispatches jobs"| node_worker_queue
node_worker_queue -->|"runs jobs"| node_pipeline
node_pipeline -->|"invokes analysis"| node_core_bridge
node_core_bridge -->|"runs core"| node_core
node_pipeline -->|"retrieves evidence"| node_knowledge
node_pipeline -->|"runs agent stages"| node_agents
node_agents -->|"isolates execution"| node_agent_process
node_agent_process -->|"runs backend"| node_agent_backend
node_agent_backend -.->|"requests inference"| node_provider
node_pipeline -->|"creates memory"| node_memory
node_pipeline -->|"validates build"| node_validation
node_pipeline -->|"compares runtime"| node_runtime_smoke
node_runtime_smoke -.->|"delegates runs"| node_browser_runner
node_pipeline -->|"packages results"| node_packaging
node_pipeline -->|"delivers results"| node_delivery
node_delivery -->|"stores result package"| node_artifact_store
node_workbench -->|"retrieves job results"| node_api

click node_web "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/App.tsx"
click node_workbench "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/workbench.tsx"
click node_web_api "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/api.ts"
click node_settings_ui "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/settings.tsx"
click node_api "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/main.py"
click node_job_store "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/store.py"
click node_artifact_store "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/artifact_store.py"
click node_worker_queue "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/queue.py"
click node_pipeline "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/pipeline.py"
click node_core_bridge "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/core_bridge.py"
click node_core "https://github.com/leshm0321/ai-jsunpack/blob/main/packages/core/src/index.ts"
click node_agents "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_runtime.py"
click node_agent_process "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_process.py"
click node_agent_backend "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_process_worker.py"
click node_knowledge "https://github.com/leshm0321/ai-jsunpack/blob/main/packages/knowledge/retriever.py"
click node_memory "https://github.com/leshm0321/ai-jsunpack/blob/main/packages/memory/service.py"
click node_validation "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/build_validation.py"
click node_runtime_smoke "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/runtime_smoke.py"
click node_browser_runner "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/browser_runner/app/main.py"
click node_packaging "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/packaging.py"
click node_delivery "https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/delivery.py"

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_web,node_workbench,node_web_api,node_settings_ui,node_user toneBlue
class node_api,node_job_store,node_artifact_store toneAmber
class node_worker_queue,node_pipeline,node_core_bridge,node_core,node_agents,node_agent_process,node_agent_backend,node_knowledge,node_memory toneMint
class node_validation,node_runtime_smoke,node_browser_runner,node_packaging,node_delivery toneRose
class node_provider toneIndigo
```

## Components

### User experience

- [Web app](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Job workbench](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/workbench.tsx): `apps/web/src/workbench.tsx`
- [Web API client](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/api.ts): `apps/web/src/api.ts`
- [Settings center](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/web/src/settings.tsx): `apps/web/src/settings.tsx`

### API and state

- [FastAPI service](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/main.py): `apps/api/app/main.py`
- [Metadata store](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/store.py): `apps/api/app/store.py`
- [Artifact store](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/api/app/artifact_store.py): `apps/api/app/artifact_store.py`

### Analysis and reconstruction

- [Worker queue](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/queue.py): `apps/worker/worker/queue.py`
- [Job pipeline](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/pipeline.py): `apps/worker/worker/pipeline.py`
- [Core bridge](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/core_bridge.py): `apps/worker/worker/core_bridge.py`
- [Unpack and rebuild](https://github.com/leshm0321/ai-jsunpack/blob/main/packages/core/src/index.ts): `packages/core/src/index.ts`
- [Agent runtime](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_runtime.py): `apps/worker/worker/agent_runtime.py`
- [Agent process](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_process.py): `apps/worker/worker/agent_process.py`
- [CrewAI backend](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/agent_process_worker.py): `apps/worker/worker/agent_process_worker.py`
- [Evidence retrieval](https://github.com/leshm0321/ai-jsunpack/blob/main/packages/knowledge/retriever.py): `packages/knowledge/retriever.py`
- [Project memory](https://github.com/leshm0321/ai-jsunpack/blob/main/packages/memory/service.py): `packages/memory/service.py`

### Validation and delivery

- [Build validation](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/build_validation.py): `apps/worker/worker/build_validation.py`
- [Runtime comparison](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/runtime_smoke.py): `apps/worker/worker/runtime_smoke.py`
- [Browser Runner](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/browser_runner/app/main.py): `apps/browser_runner/app/main.py`
- [Result packaging](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/packaging.py): `apps/worker/worker/packaging.py`
- [Result delivery](https://github.com/leshm0321/ai-jsunpack/blob/main/apps/worker/worker/delivery.py): `apps/worker/worker/delivery.py`

### Other components

- **Authorized user**
- **Model provider**

## Connections

- Authorized user → Web app: uses
- Web app → Job workbench: routes to
- Job workbench → Web API client: submits jobs
- Settings center → Web API client: reads and updates
- Web API client → FastAPI service: calls
- FastAPI service → Metadata store: persists job state
- FastAPI service → Artifact store: reads and writes artifacts
- FastAPI service → Worker queue: dispatches jobs
- Worker queue → Job pipeline: runs jobs
- Job pipeline → Core bridge: invokes analysis
- Core bridge → Unpack and rebuild: runs core
- Job pipeline → Evidence retrieval: retrieves evidence
- Job pipeline → Agent runtime: runs agent stages
- Agent runtime → Agent process: isolates execution
- Agent process → CrewAI backend: runs backend
- CrewAI backend → Model provider: requests inference
- Job pipeline → Project memory: creates memory
- Job pipeline → Build validation: validates build
- Job pipeline → Runtime comparison: compares runtime
- Runtime comparison → Browser Runner: delegates runs
- Job pipeline → Result packaging: packages results
- Job pipeline → Result delivery: delivers results
- Result delivery → Artifact store: stores result package
- Job workbench → FastAPI service: retrieves job results
