# truongv2905/mlops-pipeline-plugin architecture

> Architecture diagram of the GitHub repository truongv2905/mlops-pipeline-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/truongv2905/mlops-pipeline-plugin
- Repository: https://github.com/truongv2905/mlops-pipeline-plugin

## Overview

This is a workspace-oriented MLOps pipeline plugin: a host/CLI creates and advances runs, while guarded tool execution moves image data through triage, dataset approval/audit, training, and evaluation/reporting. The TypeScript core provides workspace isolation, approvals, Python process execution, events, and SQLite state; token management supports routing, handoffs, budgets, and usage tracking. The README documents several capabilities whose implementation was not sampled, so those links are shown only where explicitly documented; unsampled Python stages are represented at the existing tools/ directory.

Main entry points: [`src/registry.ts`](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/registry.ts) (Tool registry), [`src/orchestrator.ts`](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/orchestrator.ts) (Run orchestrator), [`src/state-store.ts`](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/state-store.ts) (SQLite state), [`src/index.ts`](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/index.ts) (Plugin core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Host integration"]
  node_dsh["DSH host<br/>[dsh.ts]"]
  node_cli["Trusted CLI<br/>[cli.ts]"]
end

subgraph group_control["Run control"]
  node_core["Plugin core<br/>[index.ts]"]
  node_orchestrator["Run orchestrator<br/>[orchestrator.ts]"]
  node_registry["Tool registry<br/>[registry.ts]"]
  node_approval["Approval gate<br/>[approval_gate.ts]"]
  node_workspace["Workspace registry<br/>[workspace.ts]"]
  node_guards["Path guards<br/>[workspace_guard.ts]"]
  node_store[("SQLite state<br/>[state-store.ts]")]
  node_events["Event bus<br/>[events.ts]"]
  node_pythonrunner["Python runner<br/>[python-runner.ts]"]
  node_contracts["Runtime contracts<br/>[contracts.ts]"]
  node_schema["Schema validator"]
  node_catalog["Tool catalog<br/>[tool-catalog.ts]"]
end

subgraph group_data["Data pipeline"]
  node_watchers["Workspace watchers"]
  node_ingest["Image ingest"]
  node_triage["Vision triage<br/>[vision_triage.py]"]
  node_dataset["Dataset preparation"]
  node_audit["Dataset audit<br/>[audit_dataset.py]"]
  node_cloud["Drive and Roboflow"]
end

subgraph group_model["Model lifecycle"]
  node_train["Model training<br/>[train_yolo.py]"]
  node_evaluate["Model evaluation"]
end

subgraph group_support["Runtime support"]
  node_env["Environment loader<br/>[env-file.ts]"]
  node_redaction["Secret redaction<br/>[redaction.ts]"]
  node_token["Token services<br/>[index.ts]"]
  node_estimation["Token estimation<br/>[estimation.ts]"]
  node_usage["Usage tracking<br/>[usage-tracker.ts]"]
  node_common["Python tool support<br/>[common.py]"]
end

node_operator(("Operator"))
node_external_services["Cloud SDKs"]

node_operator -->|"invokes plugin"| node_dsh
node_dsh -->|"creates core"| node_core
node_operator -.->|"issues commands"| node_cli
node_cli -.->|"advances runs"| node_orchestrator
node_core -->|"creates registry"| node_workspace
node_core -->|"loads environment"| node_env
node_core -->|"configures runtime"| node_pythonrunner
node_orchestrator -->|"dispatches tools"| node_registry
node_orchestrator -->|"reads run state"| node_store
node_orchestrator -->|"emits handoffs"| node_events
node_orchestrator -->|"routes and hands off"| node_token
node_registry -->|"validates inputs"| node_schema
node_registry -->|"checks approvals"| node_approval
node_registry -->|"resolves workspace"| node_workspace
node_registry -->|"loads tool environment"| node_env
node_registry -->|"spawns tools"| node_pythonrunner
node_registry -->|"records tool events"| node_events
node_registry -->|"uses definitions"| node_catalog
node_approval -->|"persists approvals"| node_store
node_workspace -->|"guards paths"| node_guards
node_events -->|"persists events"| node_store
node_events -->|"redacts payloads"| node_redaction
node_pythonrunner -.->|"runs Python tools"| node_common
node_watchers -->|"records workspace state"| node_store
node_watchers -->|"resolves workspace"| node_workspace
node_common -->|"supports execution"| node_triage
node_common -->|"supports execution"| node_train
node_common -->|"supports execution"| node_cloud
node_ingest -.->|"prepares images"| node_dataset
node_dataset -.->|"triages images"| node_triage
node_triage -.->|"supplies dataset evidence"| node_audit
node_audit -.->|"gates training"| node_train
node_train -.->|"provides checkpoint"| node_evaluate
node_evaluate -.->|"publishes report or artifacts"| node_cloud
node_cloud -.->|"calls optional SDKs"| node_external_services
node_token -->|"creates tracker"| node_usage
node_usage -->|"persists usage"| node_store
node_token -->|"exports estimation"| node_estimation

click node_dsh "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/adapters/dsh.ts"
click node_cli "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/cli.ts"
click node_core "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/index.ts"
click node_orchestrator "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/orchestrator.ts"
click node_registry "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/registry.ts"
click node_approval "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/guardrails/approval_gate.ts"
click node_workspace "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/workspace.ts"
click node_guards "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/guardrails/workspace_guard.ts"
click node_store "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/state-store.ts"
click node_events "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/events.ts"
click node_pythonrunner "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/python-runner.ts"
click node_contracts "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/contracts.ts"
click node_schema "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/schema-validator.ts"
click node_env "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/env-file.ts"
click node_redaction "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/redaction.ts"
click node_catalog "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/tool-catalog.ts"
click node_token "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/index.ts"
click node_estimation "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/estimation.ts"
click node_usage "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/usage-tracker.ts"
click node_common "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/common.py"
click node_watchers "https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/watchers"
click node_ingest "https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools"
click node_triage "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/vision_triage.py"
click node_dataset "https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools"
click node_audit "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/audit_dataset.py"
click node_train "https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/train_yolo.py"
click node_evaluate "https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools"
click node_cloud "https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools"

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_dsh,node_cli toneBlue
class node_core,node_orchestrator,node_registry,node_approval,node_workspace,node_guards,node_store,node_events,node_pythonrunner,node_contracts,node_schema,node_catalog toneAmber
class node_watchers,node_ingest,node_triage,node_dataset,node_audit,node_cloud toneMint
class node_train,node_evaluate toneRose
class node_env,node_redaction,node_token,node_estimation,node_usage,node_common,node_operator,node_external_services toneIndigo
```

## Components

### Host integration

- [DSH host](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/adapters/dsh.ts): `src/adapters/dsh.ts`
- [Trusted CLI](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/cli.ts): `src/cli.ts`

### Run control

- [Plugin core](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/index.ts): `src/index.ts`
- [Run orchestrator](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/orchestrator.ts): `src/orchestrator.ts`
- [Tool registry](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/registry.ts): `src/registry.ts`
- [Approval gate](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/guardrails/approval_gate.ts): `guardrails/approval_gate.ts`
- [Workspace registry](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/workspace.ts): `src/workspace.ts`
- [Path guards](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/guardrails/workspace_guard.ts): `guardrails/workspace_guard.ts`
- [SQLite state](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/state-store.ts): `src/state-store.ts`
- [Event bus](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/events.ts): `src/events.ts`
- [Python runner](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/python-runner.ts): `src/python-runner.ts`
- [Runtime contracts](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/contracts.ts): `src/contracts.ts`
- [Schema validator](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/schema-validator.ts): `src/schema-validator.ts`
- [Tool catalog](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/tool-catalog.ts): `src/tool-catalog.ts`

### Data pipeline

- [Workspace watchers](https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/watchers): `watchers`
- [Image ingest](https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools): `tools`
- [Vision triage](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/vision_triage.py): `tools/vision_triage.py`
- [Dataset preparation](https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools): `tools`
- [Dataset audit](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/audit_dataset.py): `tools/audit_dataset.py`
- [Drive and Roboflow](https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools): `tools`

### Model lifecycle

- [Model training](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/train_yolo.py): `tools/train_yolo.py`
- [Model evaluation](https://github.com/truongv2905/mlops-pipeline-plugin/tree/main/tools): `tools`

### Runtime support

- [Environment loader](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/env-file.ts): `src/env-file.ts`
- [Secret redaction](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/redaction.ts): `src/redaction.ts`
- [Token services](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/index.ts): `src/token-management/index.ts`
- [Token estimation](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/estimation.ts): `src/token-management/estimation.ts`
- [Usage tracking](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/src/token-management/usage-tracker.ts): `src/token-management/usage-tracker.ts`
- [Python tool support](https://github.com/truongv2905/mlops-pipeline-plugin/blob/main/tools/common.py): `tools/common.py`

### Other components

- **Operator**
- **Cloud SDKs**

## Connections

- Operator → DSH host: invokes plugin (evidence: `src/adapters/dsh.ts`)
- DSH host → Plugin core: creates core (evidence: `src/adapters/dsh.ts`)
- Operator → Trusted CLI: issues commands
- Trusted CLI → Run orchestrator: advances runs
- Plugin core → Workspace registry: creates registry (evidence: `src/index.ts`)
- Plugin core → Environment loader: loads environment (evidence: `src/index.ts`)
- Plugin core → Python runner: configures runtime (evidence: `src/index.ts`)
- Run orchestrator → Tool registry: dispatches tools (evidence: `src/orchestrator.ts`)
- Run orchestrator → SQLite state: reads run state (evidence: `src/orchestrator.ts`)
- Run orchestrator → Event bus: emits handoffs (evidence: `src/orchestrator.ts`)
- Run orchestrator → Token services: routes and hands off (evidence: `src/orchestrator.ts`)
- Tool registry → Schema validator: validates inputs (evidence: `src/registry.ts`)
- Tool registry → Approval gate: checks approvals (evidence: `src/registry.ts`)
- Tool registry → Workspace registry: resolves workspace (evidence: `src/registry.ts`)
- Tool registry → Environment loader: loads tool environment (evidence: `src/registry.ts`)
- Tool registry → Python runner: spawns tools (evidence: `src/registry.ts`)
- Tool registry → Event bus: records tool events (evidence: `src/registry.ts`)
- Tool registry → Tool catalog: uses definitions (evidence: `src/registry.ts`)
- Approval gate → SQLite state: persists approvals (evidence: `guardrails/approval_gate.ts`)
- Workspace registry → Path guards: guards paths (evidence: `src/workspace.ts`)
- Event bus → SQLite state: persists events (evidence: `src/events.ts`)
- Event bus → Secret redaction: redacts payloads (evidence: `src/events.ts`)
- Python runner → Python tool support: runs Python tools
- Workspace watchers → SQLite state: records workspace state (evidence: `watchers/local_watcher.ts`)
- Workspace watchers → Workspace registry: resolves workspace (evidence: `watchers/local_watcher.ts`)
- Python tool support → Vision triage: supports execution (evidence: `tools/vision_triage.py`)
- Python tool support → Model training: supports execution (evidence: `tools/train_yolo.py`)
- Python tool support → Drive and Roboflow: supports execution (evidence: `tools/drive_manager.py`)
- Image ingest → Dataset preparation: prepares images
- Dataset preparation → Vision triage: triages images (evidence: `tools/vision_triage.py`)
- Vision triage → Dataset audit: supplies dataset evidence
- Dataset audit → Model training: gates training
- Model training → Model evaluation: provides checkpoint (evidence: `tools/train_yolo.py`)
- Model evaluation → Drive and Roboflow: publishes report or artifacts
- Drive and Roboflow → Cloud SDKs: calls optional SDKs
- Token services → Usage tracking: creates tracker (evidence: `src/token-management/index.ts`)
- Usage tracking → SQLite state: persists usage (evidence: `src/token-management/usage-tracker.ts`)
- Token services → Token estimation: exports estimation (evidence: `src/token-management/index.ts`)
