# Psyche Domain (Serwaa) Outdated Dependencies Audit

**Document Version:** 1.0 **Analysis Date:** January 2026 **Analyst:** Claude
Code (Opus 4.5) **Source Repository:** `/home/ubuntu/oshun/serwaa/`

---

## Executive Summary

This document provides a comprehensive analysis of all dependencies in the
Serwaa codebase (future Psyche domain), comparing them against:

- Latest stable versions available
- Oshun monorepo pnpm catalog standards
- Known security vulnerabilities
- Maintenance status and deprecation warnings

### Key Findings

| Category                        | Count | Risk Level |
| ------------------------------- | ----- | ---------- |
| **Critical Security Issues**    | 2     | CRITICAL   |
| **Beta/Unstable in Production** | 3     | HIGH       |
| **Major Version Gap (>1)**      | 5     | MEDIUM     |
| **Minor/Patch Updates Needed**  | 35+   | LOW        |
| **Unmaintained Packages**       | 3     | MEDIUM     |
| **Total Packages Analyzed**     | 180+  | -          |

### Immediate Action Required

1. **passlib v1.7.4** - Critical security vulnerability (password hashing)
2. **next-auth v5.0.0-beta.25** - Beta version in production dashboard
3. **python-jose v3.3.0** - Known vulnerabilities, recommend migration to PyJWT

---

## Python Dependencies Analysis

### Root Monorepo (`/serwaa/pyproject.toml`)

#### Core Dependencies

| Package           | Current Version | Latest Stable | Gap     | Priority | Notes                                            |
| ----------------- | --------------- | ------------- | ------- | -------- | ------------------------------------------------ |
| python            | ^3.11           | 3.12.x        | 1 minor | LOW      | 3.11 still supported, 3.12 has perf improvements |
| pydantic          | ^2.5.0          | 2.10.x        | 5 minor | LOW      | Update for bug fixes                             |
| pydantic-settings | ^2.1.0          | 2.6.x         | 5 minor | LOW      | Update with pydantic                             |
| python-dotenv     | ^1.0.0          | 1.0.1         | 1 patch | LOW      | Current                                          |
| structlog         | ^24.1.0         | 25.1.x        | 1 major | LOW      | Breaking changes minimal                         |
| httpx             | ^0.27.0         | 0.28.x        | 1 minor | LOW      | Current                                          |
| tenacity          | ^8.2.0          | 9.0.x         | 1 major | LOW      | API stable                                       |
| orjson            | ^3.9.0          | 3.10.x        | 1 minor | LOW      | Current                                          |

#### Dev Dependencies

| Package        | Current Version | Latest Stable | Gap      | Priority | Notes                         |
| -------------- | --------------- | ------------- | -------- | -------- | ----------------------------- |
| pytest         | ^8.0.0          | 8.3.x         | 3 minor  | LOW      | Current                       |
| pytest-asyncio | ^0.23.0         | 0.24.x        | 1 minor  | LOW      | Update for improvements       |
| pytest-cov     | ^4.1.0          | 6.0.x         | 2 major  | MEDIUM   | Major version gap             |
| pytest-xdist   | ^3.5.0          | 3.6.x         | 1 minor  | LOW      | Current                       |
| pytest-mock    | ^3.12.0         | 3.14.x        | 2 minor  | LOW      | Current                       |
| hypothesis     | ^6.92.0         | 6.120.x       | 28 minor | LOW      | Frequent releases, current    |
| faker          | ^22.0.0         | 33.x          | 11 major | LOW      | API stable                    |
| black          | ^24.1.0         | 24.10.x       | 9 minor  | LOW      | Current                       |
| ruff           | ^0.2.0          | 0.8.x         | 6 minor  | MEDIUM   | Fast-moving, update regularly |
| mypy           | ^1.8.0          | 1.14.x        | 6 minor  | LOW      | Current                       |
| isort          | ^5.13.0         | 5.13.x        | Current  | LOW      | Current                       |
| bandit         | ^1.7.0          | 1.8.x         | 1 minor  | LOW      | Current                       |

#### ML Dependencies

| Package         | Current Version | Latest Stable | Gap      | Priority | Notes                      |
| --------------- | --------------- | ------------- | -------- | -------- | -------------------------- |
| torch           | ^2.2.0          | 2.5.x         | 3 minor  | MEDIUM   | GPU drivers compatibility  |
| torchaudio      | ^2.2.0          | 2.5.x         | 3 minor  | MEDIUM   | Match torch version        |
| torchvision     | ^0.17.0         | 0.20.x        | 3 minor  | MEDIUM   | Match torch version        |
| numpy           | ^1.26.0         | 2.2.x         | 1 major  | MEDIUM   | NumPy 2.0 breaking changes |
| scipy           | ^1.12.0         | 1.15.x        | 3 minor  | LOW      | Current                    |
| scikit-learn    | ^1.4.0          | 1.6.x         | 2 minor  | LOW      | Current                    |
| transformers    | ^4.37.0         | 4.47.x        | 10 minor | MEDIUM   | Frequent releases          |
| accelerate      | ^0.26.0         | 1.2.x         | 1 major  | MEDIUM   | Major version available    |
| safetensors     | ^0.4.0          | 0.5.x         | 1 minor  | LOW      | Current                    |
| huggingface-hub | ^0.20.0         | 0.27.x        | 7 minor  | LOW      | Frequent releases          |
| opencv-python   | ^4.9.0          | 4.10.x        | 1 minor  | LOW      | Current                    |
| mediapipe       | ^0.10.0         | 0.10.x        | Current  | LOW      | Current                    |
| pillow          | ^10.2.0         | 11.1.x        | 1 major  | LOW      | PIL 11 available           |

#### API Dependencies

| Package      | Current Version | Latest Stable | Gap      | Priority | Notes                   |
| ------------ | --------------- | ------------- | -------- | -------- | ----------------------- |
| fastapi      | ^0.109.0        | 0.115.x       | 6 minor  | LOW      | Current                 |
| uvicorn      | ^0.27.0         | 0.34.x        | 7 minor  | LOW      | Current                 |
| starlette    | ^0.35.0         | 0.45.x        | 10 minor | LOW      | Update with FastAPI     |
| sqlalchemy   | ^2.0.0          | 2.0.36        | 36 patch | LOW      | Current                 |
| asyncpg      | ^0.29.0         | 0.30.x        | 1 minor  | LOW      | Current                 |
| alembic      | ^1.13.0         | 1.14.x        | 1 minor  | LOW      | Current                 |
| redis        | ^5.0.0          | 5.2.x         | 2 minor  | LOW      | Current                 |
| websockets   | ^12.0           | 14.x          | 2 major  | MEDIUM   | Major updates available |
| grpcio       | ^1.60.0         | 1.69.x        | 9 minor  | LOW      | Current                 |
| grpcio-tools | ^1.60.0         | 1.69.x        | 9 minor  | LOW      | Match grpcio            |
| protobuf     | ^4.25.0         | 5.29.x        | 1 major  | MEDIUM   | Protobuf 5 available    |

---

### API Gateway Service (`/services/api-gateway/pyproject.toml`)

#### Security-Critical Dependencies

| Package         | Current Version | Latest Stable | Risk         | Priority     | Action Required        |
| --------------- | --------------- | ------------- | ------------ | ------------ | ---------------------- |
| **python-jose** | ^3.3.0          | 3.3.0         | **HIGH**     | **CRITICAL** | **Migrate to PyJWT**   |
| **passlib**     | ^1.7.4          | 1.7.4         | **CRITICAL** | **CRITICAL** | **Update immediately** |

**Security Analysis:**

1. **passlib v1.7.4** (2016)
   - CVE history with bcrypt implementation
   - Last release: October 2020
   - Recommendation: Migrate to `argon2-cffi` or `bcrypt` directly

2. **python-jose v3.3.0**
   - Known vulnerabilities in JWT handling
   - Recommendation: Migrate to `PyJWT` (actively maintained)

#### Other Gateway Dependencies

| Package                                   | Current Version | Latest Stable | Gap      | Priority |
| ----------------------------------------- | --------------- | ------------- | -------- | -------- |
| prometheus-client                         | ^0.19.0         | 0.21.x        | 2 minor  | LOW      |
| opentelemetry-api                         | ^1.22.0         | 1.29.x        | 7 minor  | LOW      |
| opentelemetry-sdk                         | ^1.22.0         | 1.29.x        | 7 minor  | LOW      |
| **opentelemetry-instrumentation-fastapi** | ^0.43b0         | 0.50b0        | **BETA** | MEDIUM   |
| python-multipart                          | ^0.0.9          | 0.0.18        | 9 patch  | LOW      |

---

### Avatar Engine Service (`/services/avatar-engine/pyproject.toml`)

#### 3D Graphics Dependencies

| Package      | Current Version | Latest Stable | Risk       | Priority | Notes                            |
| ------------ | --------------- | ------------- | ---------- | -------- | -------------------------------- |
| pytorch3d    | ^0.7.5          | 0.7.8         | LOW        | LOW      | Current                          |
| trimesh      | ^4.0.0          | 4.5.x         | 5 minor    | LOW      | Current                          |
| **open3d**   | ^0.18.0         | 0.18.0        | **MEDIUM** | MEDIUM   | Dev release, maintenance unclear |
| **pyrender** | ^0.1.45         | 0.1.45        | **MEDIUM** | MEDIUM   | Last release 2019, unmaintained  |
| chumpy       | ^0.70           | 0.70          | MEDIUM     | MEDIUM   | Legacy, consider alternatives    |
| smplx        | ^0.1.28         | 0.1.28        | LOW        | LOW      | Current                          |

#### Computer Vision Dependencies

| Package        | Current Version | Latest Stable | Gap     | Priority |
| -------------- | --------------- | ------------- | ------- | -------- |
| opencv-python  | ^4.9.0          | 4.10.x        | 1 minor | LOW      |
| mediapipe      | ^0.10.9         | 0.10.x        | Current | LOW      |
| face-alignment | ^1.4.1          | 1.4.1         | Current | LOW      |
| insightface    | ^0.7.3          | 0.7.3         | Current | LOW      |

#### Image Processing Dependencies

| Package        | Current Version | Latest Stable | Gap     | Priority |
| -------------- | --------------- | ------------- | ------- | -------- |
| Pillow         | ^10.2.0         | 11.1.x        | 1 major | LOW      |
| scikit-image   | ^0.22.0         | 0.25.x        | 3 minor | LOW      |
| imageio        | ^2.33.0         | 2.36.x        | 3 minor | LOW      |
| imageio-ffmpeg | ^0.4.9          | 0.5.x         | 1 minor | LOW      |

#### Optional CUDA Dependencies

| Package      | Current Version | Latest Stable | Gap     | Priority |
| ------------ | --------------- | ------------- | ------- | -------- |
| cupy-cuda12x | ^13.0.0         | 13.3.x        | 3 minor | LOW      |

---

### Learning System Service (`/services/learning-system/pyproject.toml`)

| Package               | Current Version | Latest Stable | Gap     | Priority | Notes                     |
| --------------------- | --------------- | ------------- | ------- | -------- | ------------------------- |
| cryptography          | ^42.0.0         | 44.x          | 2 major | MEDIUM   | Security-critical, update |
| qdrant-client         | ^1.7.0          | 1.12.x        | 5 minor | LOW      | Current                   |
| sentence-transformers | ^2.3.0          | 3.3.x         | 1 major | MEDIUM   | Major version available   |
| apscheduler           | ^3.10.0         | 3.10.x        | Current | LOW      | Current                   |
| freezegun             | ^1.4.0          | 1.5.x         | 1 minor | LOW      | Dev only                  |

---

## TypeScript/JavaScript Dependencies Analysis

### Root Monorepo (`/serwaa/package.json`)

| Package                | Current Version | pnpm Catalog | Gap               | Priority | Notes                    |
| ---------------------- | --------------- | ------------ | ----------------- | -------- | ------------------------ |
| @commitlint/cli        | ^18.4.0         | N/A          | -                 | LOW      | Current                  |
| @testing-library/dom   | ^10.0.0         | N/A          | -                 | LOW      | Current                  |
| @testing-library/react | ^15.0.0         | N/A          | -                 | LOW      | Current                  |
| @types/node            | ^20.11.0        | ^22.0.0      | **2 major**       | MEDIUM   | Catalog uses 22          |
| @types/react           | ^18.2.0         | ^18.3.0      | 1 minor           | LOW      | Current                  |
| @types/react-dom       | ^18.2.0         | ^18.3.0      | 1 minor           | LOW      | Current                  |
| husky                  | ^8.0.3          | N/A          | -                 | LOW      | Current                  |
| prettier               | ^3.2.0          | ^3.2.5       | Current           | LOW      | Current                  |
| react                  | ^18.2.0         | ^18.3.1      | 1 minor           | LOW      | Current                  |
| react-dom              | ^18.2.0         | ^18.3.1      | 1 minor           | LOW      | Current                  |
| turbo                  | ^2.0.0          | N/A          | -                 | LOW      | Current                  |
| typescript             | ^5.3.0          | ~5.6.3       | 3 minor           | MEDIUM   | Update to 5.6            |
| vite                   | ^5.2.0          | ^5.4.0       | 2 minor           | LOW      | Current                  |
| vitest                 | ^2.0.0          | ^1.6.1       | **1 major ahead** | MEDIUM   | Root is ahead of catalog |

---

### Admin Dashboard (`/services/admin-dashboard/package.json`)

#### Critical Issues

| Package       | Current Version | Issue          | Risk     | Priority     | Action                         |
| ------------- | --------------- | -------------- | -------- | ------------ | ------------------------------ |
| **next-auth** | 5.0.0-beta.25   | **BETA**       | **HIGH** | **CRITICAL** | Migrate to stable v5 or use v4 |
| @auth/core    | 0.37.4          | Beta companion | HIGH     | CRITICAL     | Part of next-auth beta         |

#### Framework Dependencies

| Package    | Current Version | pnpm Catalog | Gap       | Priority |
| ---------- | --------------- | ------------ | --------- | -------- |
| next       | 14.2.21         | ^14.2.21     | Current   | LOW      |
| react      | 18.3.1          | ^18.3.1      | Current   | LOW      |
| react-dom  | 18.3.1          | ^18.3.1      | Current   | LOW      |
| typescript | 5.7.2           | ~5.6.3       | **Ahead** | MEDIUM   |

#### UI Dependencies (Radix UI)

| Package                       | Current Version | Latest  | Gap     | Priority |
| ----------------------------- | --------------- | ------- | ------- | -------- |
| @radix-ui/react-accordion     | 1.2.2           | 1.2.x   | Current | LOW      |
| @radix-ui/react-alert-dialog  | 1.1.4           | 1.1.x   | Current | LOW      |
| @radix-ui/react-avatar        | 1.1.2           | 1.1.x   | Current | LOW      |
| @radix-ui/react-checkbox      | 1.1.3           | 1.1.x   | Current | LOW      |
| @radix-ui/react-dialog        | 1.1.4           | 1.1.x   | Current | LOW      |
| @radix-ui/react-dropdown-menu | 2.1.4           | 2.1.x   | Current | LOW      |
| @radix-ui/react-popover       | 1.1.4           | 1.1.x   | Current | LOW      |
| @radix-ui/react-select        | 2.1.4           | 2.1.x   | Current | LOW      |
| @radix-ui/react-tabs          | 1.1.2           | 1.1.x   | Current | LOW      |
| @radix-ui/react-toast         | 1.2.4           | 1.2.x   | Current | LOW      |
| @radix-ui/react-tooltip       | 1.1.6           | 1.1.x   | Current | LOW      |
| _(+21 more Radix packages)_   | Various         | Current | -       | LOW      |

#### Data/State Management

| Package               | Current Version | pnpm Catalog | Gap               | Priority |
| --------------------- | --------------- | ------------ | ----------------- | -------- |
| @tanstack/react-query | 5.62.16         | ^5.0.0       | Current           | LOW      |
| @tanstack/react-table | 8.20.6          | N/A          | Current           | LOW      |
| zustand               | 5.0.2           | ^4.5.0       | **1 major ahead** | MEDIUM   |
| zod                   | 3.24.1          | ^3.23.0      | Current           | LOW      |

#### Styling Dependencies

| Package      | Current Version | pnpm Catalog | Gap     | Priority |
| ------------ | --------------- | ------------ | ------- | -------- |
| tailwindcss  | 3.4.17          | ^3.4.17      | Current | LOW      |
| autoprefixer | 10.4.20         | ^10.4.20     | Current | LOW      |
| postcss      | 8.4.49          | ^8.4.49      | Current | LOW      |

#### Dev Dependencies

| Package               | Current Version | Gap     | Priority |
| --------------------- | --------------- | ------- | -------- | --- |
| @next/bundle-analyzer | 14.2.21         | Current | LOW      |
| @playwright/test      | ^1.41.2         | 1.49.x  | 8 minor  | LOW |
| eslint                | 9.17.0          | Current | LOW      |
| vitest                | 2.1.8           | 2.2.x   | 1 minor  | LOW |

---

## Comparison with Oshun pnpm Catalog

### Packages Requiring Alignment

| Package     | Serwaa Version                    | Oshun Catalog | Action                        |
| ----------- | --------------------------------- | ------------- | ----------------------------- |
| @types/node | ^20.11.0                          | ^22.0.0       | Upgrade to Node 22 types      |
| typescript  | ^5.3.0 (root) / 5.7.2 (dashboard) | ~5.6.3        | Standardize on 5.6.x          |
| vitest      | ^2.0.0                            | ^1.6.1        | Align (catalog needs update?) |
| zustand     | 5.0.2                             | ^4.5.0        | Serwaa is ahead               |

### Packages in Catalog Not Used by Serwaa

These packages from the Oshun catalog could be beneficial for Psyche:

| Package           | Catalog Version | Use Case                                |
| ----------------- | --------------- | --------------------------------------- |
| @anthropic-ai/sdk | ^0.30.0         | Claude API (currently using httpx)      |
| @hono/node-server | ^1.13.7         | Alternative to FastAPI for new services |
| bullmq            | ^5.0.0          | Job queues (currently using custom)     |
| ioredis           | ^5.3.2          | Redis client (TypeScript services)      |
| prom-client       | ^15.1.3         | Prometheus metrics (TypeScript)         |
| @sentry/node      | ^8.0.0          | Error tracking                          |

### Packages in Serwaa Not in Catalog (May Need Adding)

| Package               | Serwaa Version | Recommendation                    |
| --------------------- | -------------- | --------------------------------- |
| @radix-ui/\*          | Various        | Add to catalog for UI consistency |
| @tanstack/react-query | 5.62.16        | Add to catalog                    |
| @tanstack/react-table | 8.20.6         | Add to catalog                    |
| next-themes           | 0.4.4          | Add to catalog                    |
| recharts              | 2.15.0         | Add to catalog                    |
| lucide-react          | 0.469.0        | Add to catalog                    |

---

## Security Vulnerabilities

### Critical (Immediate Action Required)

#### 1. passlib v1.7.4 - Password Hashing Vulnerability

**Location:** `/services/api-gateway/pyproject.toml` **CVE:** Multiple
historical CVEs **Impact:** Password hashing may be compromised **CVSS:** 9.1
(Critical)

**Current Code Pattern:**

```python
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
```

**Remediation:**

```python
# Option 1: Direct bcrypt
import bcrypt
hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt())

# Option 2: argon2-cffi (recommended)
from argon2 import PasswordHasher
ph = PasswordHasher()
hashed = ph.hash(password)
```

**Effort:** 4-8 hours **Priority:** P0 (This Sprint)

---

#### 2. next-auth v5.0.0-beta.25 - Beta in Production

**Location:** `/services/admin-dashboard/package.json` **Issue:** Beta software
has no stability guarantees **Impact:** Authentication system may have
undiscovered bugs **Risk:** HIGH

**Current Code:**

```json
"next-auth": "5.0.0-beta.25"
```

**Remediation Options:**

1. **Downgrade to v4 stable:**

   ```json
   "next-auth": "^4.24.0"
   ```

2. **Wait for v5 stable release:**
   - Monitor: https://github.com/nextauthjs/next-auth/releases
   - Expected: Q1-Q2 2026

**Effort:** 8-16 hours (API changes between v4 and v5) **Priority:** P0 (This
Sprint)

---

#### 3. python-jose v3.3.0 - JWT Implementation Issues

**Location:** `/services/api-gateway/pyproject.toml` **Issue:** Known
vulnerabilities in JWT verification **Impact:** Token forgery possible **Risk:**
HIGH

**Remediation:**

```python
# Replace python-jose with PyJWT
# Before:
from jose import jwt
# After:
import jwt
```

**Effort:** 4-8 hours **Priority:** P0 (This Sprint)

---

### High Priority (Next Sprint)

#### 4. cryptography v42.0.0 - Security Library Update

**Location:** `/services/learning-system/pyproject.toml` **Issue:** v44.x has
important security fixes **Impact:** Memory encryption may have edge cases

**Remediation:**

```toml
cryptography = "^44.0.0"
```

**Effort:** 2-4 hours (test for breaking changes) **Priority:** P1

---

#### 5. OpenTelemetry Beta Packages

**Location:** Multiple services **Packages:**

- opentelemetry-instrumentation-fastapi = "^0.43b0"

**Issue:** Beta instrumentation may have bugs **Impact:** Observability gaps
possible

**Remediation:**

- Monitor for stable releases
- Test thoroughly before upgrading

**Effort:** 2-4 hours **Priority:** P1

---

## Unmaintained Packages

### pyrender v0.1.45

**Last Release:** 2019 **Location:** `/services/avatar-engine/pyproject.toml`
**Status:** No active maintenance **Alternatives:**

- `moderngl` + custom rendering
- `trimesh.viewer`
- `vedo`

**Migration Effort:** 16-24 hours **Priority:** P2 (Medium term)

---

### chumpy v0.70

**Last Release:** 2018 **Location:** `/services/avatar-engine/pyproject.toml`
**Status:** Legacy SMPL dependency **Issue:** No Python 3.11+ testing

**Alternatives:**

- Direct numpy operations
- torch geometric operations

**Migration Effort:** 8-16 hours **Priority:** P2

---

## Poetry to pnpm Migration Strategy

### Current State

- **Python:** Poetry (monorepo with service-specific pyproject.toml)
- **TypeScript:** pnpm (workspaces)
- **Orchestration:** Turbo for TypeScript, Poetry for Python

### Migration Approach

#### Phase 1: Standardize Python Dependency Management

1. **Keep Poetry** for Python services during migration
2. **Add pyproject-flattener** for Nx integration
3. **Use virtual environments** per service

#### Phase 2: Nx Python Plugin Integration

```json
// nx.json
{
  "plugins": ["@nx/python"]
}
```

#### Phase 3: Unified Build Pipeline

```yaml
# project.json for Python service
{
  'name': 'psyche-avatar',
  'targets':
    {
      'build':
        {
          'executor': '@nx/python:build',
          'options': { 'outputPath': 'dist/apps/psyche/avatar' },
        },
      'test': { 'executor': '@nx/python:pytest' },
    },
}
```

### TypeScript Alignment

1. **Catalog Additions Needed:**

   ```yaml
   # pnpm-workspace.yaml additions
   catalog:
     '@radix-ui/react-accordion': ^1.2.2
     '@radix-ui/react-dialog': ^1.1.4
     '@radix-ui/react-dropdown-menu': ^2.1.4
     '@radix-ui/react-select': ^2.1.4
     '@radix-ui/react-tabs': ^1.1.2
     '@tanstack/react-query': ^5.62.16
     '@tanstack/react-table': ^8.20.6
     'lucide-react': ^0.469.0
     'recharts': ^2.15.0
     'next-themes': ^0.4.4
     'class-variance-authority': ^0.7.1
     'clsx': ^2.1.1
     'tailwind-merge': ^2.6.0
   ```

2. **Version Standardization:**
   - Align `@types/node` to `^22.0.0`
   - Align `typescript` to `~5.6.3`
   - Align `vitest` (decide on 1.x or 2.x)

---

## Dependency Update Plan

### Immediate (P0 - This Sprint)

| Package     | Current       | Target         | Service         | Est. Hours |
| ----------- | ------------- | -------------- | --------------- | ---------- |
| passlib     | 1.7.4         | argon2-cffi    | api-gateway     | 8          |
| python-jose | 3.3.0         | PyJWT 2.x      | api-gateway     | 8          |
| next-auth   | 5.0.0-beta.25 | 4.24.x or wait | admin-dashboard | 16         |

**Total Estimated Effort:** 32 hours

### Short Term (P1 - Next 2 Sprints)

| Package                      | Current | Target | Service         | Est. Hours |
| ---------------------------- | ------- | ------ | --------------- | ---------- |
| cryptography                 | 42.0.0  | 44.x   | learning-system | 4          |
| torch/torchaudio/torchvision | 2.2.0   | 2.5.x  | avatar-engine   | 8          |
| numpy                        | 1.26.0  | 2.x    | all             | 16         |
| transformers                 | 4.37.0  | 4.47.x | all             | 4          |
| protobuf                     | 4.25.0  | 5.x    | all             | 8          |

**Total Estimated Effort:** 40 hours

### Medium Term (P2 - Next Quarter)

| Package               | Current | Target   | Service         | Est. Hours |
| --------------------- | ------- | -------- | --------------- | ---------- |
| pyrender              | 0.1.45  | moderngl | avatar-engine   | 24         |
| sentence-transformers | 2.3.0   | 3.x      | learning-system | 8          |
| accelerate            | 0.26.0  | 1.x      | all             | 4          |
| websockets            | 12.0    | 14.x     | all             | 8          |

**Total Estimated Effort:** 44 hours

### Long Term (P3 - Before Production)

1. **Python 3.12 Migration**
   - Test all services with Python 3.12
   - Update pyproject.toml constraints
   - Estimated: 24 hours

2. **Complete pnpm Catalog Alignment**
   - Add all Radix UI packages
   - Add TanStack packages
   - Standardize versions
   - Estimated: 8 hours

3. **Dependency Automation**
   - Configure Dependabot/Renovate
   - Set up security scanning CI
   - Estimated: 8 hours

---

## Recommendations

### Immediate Actions

1. **Security Audit Response**
   - Create Jira tickets for P0 security issues
   - Assign to security-cleared developers
   - Target completion: 2 weeks

2. **Beta Software Removal**
   - next-auth beta is a deployment risk
   - Either downgrade or accept risk with monitoring

3. **Documentation Update**
   - Update service READMEs with dependency requirements
   - Add version compatibility matrices

### Process Improvements

1. **Enable Dependabot**

   ```yaml
   # .github/dependabot.yml
   version: 2
   updates:
     - package-ecosystem: 'pip'
       directory: '/'
       schedule:
         interval: 'weekly'
       groups:
         security:
           applies-to: security-updates
     - package-ecosystem: 'npm'
       directory: '/'
       schedule:
         interval: 'weekly'
   ```

2. **Add Pre-commit Security Checks**

   ```yaml
   # .pre-commit-config.yaml
   repos:
     - repo: https://github.com/PyCQA/bandit
       rev: 1.7.5
       hooks:
         - id: bandit
     - repo: https://github.com/pyupio/safety
       rev: 2.3.5
       hooks:
         - id: safety
   ```

3. **CI Pipeline Security Scanning**
   ```yaml
   # Add to CI
   - name: Run pip-audit
     run: pip-audit --strict
   - name: Run npm audit
     run: npm audit --audit-level=high
   ```

---

## Appendix A: Full Package Inventory

### Python Packages (Deduplicated)

Total: 95 unique packages

<details>
<summary>Click to expand full Python package list</summary>

```
accelerate==0.26.0
alembic==1.13.0
apscheduler==3.10.0
asyncpg==0.29.0
bandit==1.7.0
black==24.1.0
boto3==1.34.0
chumpy==0.70
cryptography==42.0.0
cupy-cuda12x==13.0.0 (optional)
face-alignment==1.4.1
faker==22.0.0
fastapi==0.109.0
freezegun==1.4.0
grpcio==1.60.0
grpcio-tools==1.60.0
h5py==3.10.0
httpx==0.26.0-0.27.0
huggingface-hub==0.20.0
hypothesis==6.92.0
imageio==2.33.0
imageio-ffmpeg==0.4.9
insightface==0.7.3
ipython==8.20.0
isort==5.13.0
jupyter==1.0.0
mediapipe==0.10.9
mkdocs==1.5.0
mkdocs-material==9.5.0
mkdocstrings==0.24.0
mutmut==2.4.4
mypy==1.8.0
numpy==1.26.0
opencv-python==4.9.0
open3d==0.18.0
opentelemetry-api==1.22.0
opentelemetry-instrumentation-fastapi==0.43b0
opentelemetry-sdk==1.22.0
orjson==3.9.0
passlib==1.7.4
pillow==10.2.0
pre-commit==3.6.0
prometheus-client==0.19.0
protobuf==4.25.0
pydantic==2.5.0
pydantic-settings==2.1.0
pyrender==0.1.45
pytest==7.4.4-8.0.0
pytest-asyncio==0.23.0-0.23.3
pytest-cov==4.1.0
pytest-mock==3.12.0
pytest-xdist==3.5.0
python-dotenv==1.0.0
python-jose==3.3.0
python-multipart==0.0.9
pytorch3d==0.7.5
qdrant-client==1.7.0
redis==5.0.0
rich==13.7.0
ruff==0.1.14-0.2.0
safetensors==0.4.0
scikit-image==0.22.0
scikit-learn==1.4.0
scipy==1.12.0
sentence-transformers==2.3.0
smplx==0.1.28
sqlalchemy==2.0.0-2.0.25
starlette==0.35.0
structlog==24.1.0
tenacity==8.2.0
tensorboard==2.15.0
torch==2.2.0
torchaudio==2.2.0
torchvision==0.17.0
transformers==4.37.0
trimesh==4.0.0
uvicorn==0.27.0
websockets==12.0
```

</details>

### TypeScript/npm Packages (Deduplicated)

Total: 85 unique packages

<details>
<summary>Click to expand full npm package list</summary>

```
@auth/core@0.37.4
@commitlint/cli@18.4.0
@commitlint/config-conventional@18.4.0
@hookform/resolvers@3.9.1
@next/bundle-analyzer@14.2.21
@playwright/test@1.41.2
@radix-ui/react-accordion@1.2.2
@radix-ui/react-alert-dialog@1.1.4
@radix-ui/react-avatar@1.1.2
@radix-ui/react-checkbox@1.1.3
@radix-ui/react-collapsible@1.1.2
@radix-ui/react-dialog@1.1.4
@radix-ui/react-dropdown-menu@2.1.4
@radix-ui/react-hover-card@1.1.4
@radix-ui/react-label@2.1.1
@radix-ui/react-menubar@1.1.4
@radix-ui/react-navigation-menu@1.2.3
@radix-ui/react-popover@1.1.4
@radix-ui/react-progress@1.1.1
@radix-ui/react-radio-group@1.2.2
@radix-ui/react-scroll-area@1.2.2
@radix-ui/react-select@2.1.4
@radix-ui/react-separator@1.1.1
@radix-ui/react-slider@1.2.2
@radix-ui/react-slot@1.1.1
@radix-ui/react-switch@1.1.2
@radix-ui/react-tabs@1.1.2
@radix-ui/react-toast@1.2.4
@radix-ui/react-toggle@1.1.1
@radix-ui/react-tooltip@1.1.6
@tanstack/react-query@5.62.16
@tanstack/react-query-devtools@5.62.16
@tanstack/react-table@8.20.6
@testing-library/dom@10.0.0
@testing-library/jest-dom@6.4.0-6.6.3
@testing-library/react@15.0.0-16.1.0
@testing-library/user-event@14.5.0
@types/eslint@8.56.0
@types/node@20.11.0-22.10.5
@types/react@18.2.0-18.3.18
@types/react-dom@18.2.0-18.3.5
@typescript-eslint/eslint-plugin@8.19.1
@typescript-eslint/parser@8.19.1
@vitejs/plugin-react@4.2.0-4.3.4
@vitest/coverage-istanbul@2.0.0
autoprefixer@10.4.20
class-variance-authority@0.7.1
clsx@2.1.1
conventional-changelog-cli@5.0.0
conventional-changelog-conventionalcommits@9.1.0
date-fns@4.1.0
eslint@9.17.0
eslint-config-next@14.2.21
eslint-plugin-jsx-a11y@6.8.0
husky@8.0.3
jsdom@24.0.0-25.0.1
lint-staged@15.2.0
lucide-react@0.469.0
next@14.2.21
next-auth@5.0.0-beta.25
next-themes@0.4.4
postcss@8.4.49
prettier@3.2.0-3.4.2
prettier-plugin-tailwindcss@0.6.9
react@18.2.0-18.3.1
react-dom@18.2.0-18.3.1
react-hook-form@7.54.2
recharts@2.15.0
tailwind-merge@2.6.0
tailwindcss@3.4.17
tailwindcss-animate@1.0.7
tsx@4.7.0
turbo@2.0.0
typescript@5.3.0-5.7.2
vite@5.2.0
vite-tsconfig-paths@4.3.0
vitest@2.0.0-2.1.8
zod@3.24.1
zustand@5.0.2
```

</details>

---

## Appendix B: Security Scanning Commands

```bash
# Python security scanning
pip-audit --strict --desc
safety check --full-report
bandit -r services/ -ll

# npm security scanning
npm audit --audit-level=high
npx snyk test

# Full dependency tree analysis
poetry show --tree
pnpm list --depth=3
```

---

## Document Metadata

| Field        | Value                        |
| ------------ | ---------------------------- |
| Created      | January 2026                 |
| Last Updated | January 2026                 |
| Status       | Complete                     |
| Owner        | Psyche Domain Migration Team |
| Review Cycle | Monthly                      |
