Commit graph

14 commits

Author SHA1 Message Date
Vadym Samoilenko
250796dd0c Replace Auth.js OAuth with MSAL.js SPA browser flow
- Token exchange now happens entirely in the browser via @azure/msal-browser
  (PKCE, no client_secret — correct for Azure SPA registrations)
- Browser stays on /hp-prod-tracker/login throughout; the /api/auth/callback
  URL never appears in the address bar
- New /api/auth/sso route validates the id_token (jose + Azure JWKS),
  creates User/Account/Session in Prisma, and sets the authjs session cookie
- Auth.js retained only for session reading (auth()) and signOut()
- Fix dev bypass safety gate: use NODE_ENV !== production instead of
  absence of AUTH_MICROSOFT_ENTRA_ID_SECRET
- Rename env vars: AUTH_MICROSOFT_ENTRA_ID_ID → AZURE_CLIENT_ID,
  AUTH_MICROSOFT_ENTRA_ID_TENANT_ID → AZURE_TENANT_ID, remove AUTH_URL
- Remove /api/auth Apache proxy rule (no longer needed)
- Delete OAuthRelay.tsx, add MsalLogin.tsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 18:49:43 +01:00
Vadym Samoilenko
17fc539d19 Configure SSO for Azure SPA registration: PKCE without client_secret
- Override authorization redirect_uri to match Azure SPA portal registration
  (login page URL instead of Auth.js callback URL)
- Custom token.request: public client PKCE exchange — no client_secret sent
- Add OAuthRelay client component: forwards ?code&state from login page to
  /api/auth/callback/microsoft-entra-id via window.location.replace
- Add AZURE_REDIRECT_URI env var to docker-compose.yml and .env.example
- Remove AUTH_MICROSOFT_ENTRA_ID_SECRET (SPA registrations don't issue secrets)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 15:25:57 +01:00
DJP
f41dfe6024 Pass AUTH_URL through to container for SSO callback
Auth.js needs AUTH_URL to build the correct redirect URI
including the /hp-prod-tracker basePath.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 15:39:09 -04:00
DJP
d4fa69957e Switch Ollama chat model to gemma4:latest
Gemma 4 loads successfully, supports tool calling with proper
structured output, and responds in ~100ms after initial load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 15:11:59 -04:00
DJP
49f301f6f4 Use mistral:latest (7B) for Ollama chat — only model that loads on server
Larger models (mistral-large 122B, qwen3-coder 30B, gpt-oss 20B) all
fail to load due to resource limits. mistral:latest (7.2B) loads and
responds successfully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 14:40:58 -04:00
DJP
93ab4a0947 Switch Ollama chat model to qwen3-coder:30b (mistral-large too large for server)
mistral-large:latest requires 420GB RAM, server only has 345GB.
qwen3-coder:30b is a 30.5B MoE model that fits in ~20GB with good
tool calling and reasoning capabilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 14:38:34 -04:00
DJP
6e19c1f046 Add Ollama as fallback AI provider, remove local Ollama container
- Claude is primary, Ollama (internal GPU server) is automatic fallback
- Provider auto-selects: Claude if API key set, else Ollama if reachable
- Ollama uses mistral-large:latest for chat with full tool calling support
- Removed local Ollama Docker service — uses remote at 10.24.42.219
- Chat panel badge shows "Claude" (purple) or "Ollama" (orange)
- OLLAMA_CHAT_HOST and OLLAMA_CHAT_MODEL env vars for configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:30:13 -04:00
DJP
2f1afed855 Pass ANTHROPIC_API_KEY through to Docker container
The env var was in .env but not listed in docker-compose environment
block, so the container never received it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:11:18 -04:00
DJP
4c0e9d32df Dev server deployment: port conflicts, auth bypass, API key, UI fixes
- Remap ports (3001, 5491) to avoid conflicts on shared server
- Remove NODE_ENV guard from DEV_BYPASS_AUTH in middleware, api-utils, layout
- Add API key authentication for external integrations
- Comment out Ollama dependency (optional for dev)
- Fix pipeline graph: topological depth layout for parallel branches
- Fix uploads: move to /data/uploads volume, serve via /api/uploads
- Fix wipe comparison: correct A/B layering, transformOrigin, ResizeObserver fit
- Fix Dockerfile: create /app/public directory for standalone build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 17:17:54 -04:00
Leivur Djurhuus
010d29656c Clean up deployment config: remove Docker Hub refs, Cloudflare Tunnel
Source code is now on Bitbucket — IT builds from source directly.
Docker Hub and Cloudflare Tunnel are no longer needed. Removed
profiles gate from app service so docker compose up -d works without
flags. Updated .env.example with organized sections and comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:44:09 -05:00
Leivur Djurhuus
fa55dfc25f Add deployment infrastructure: health endpoint, Docker Compose fixes, tunnel
- Add /api/health endpoint checking DB, pgvector, org, templates,
  dev bypass safety, and AUTH_SECRET presence
- Fix Docker Compose app service: AUTH_SECRET, Entra ID env vars,
  AUTH_TRUST_HOST, app health check
- Add Cloudflare Tunnel service for zero-config HTTPS access
- Exclude health endpoint from auth middleware

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:54:15 -05:00
Leivur Djurhuus
2e87a5ff4d Add video upload with HLS streaming infrastructure (A7.1)
FFmpeg in Docker for transcoding, thumbnail extraction, and metadata
parsing. Videos stored in /data/uploads (mounted volume), served via
streaming API route with Range headers and HLS segment caching. Upload
flow: stream-write MP4 → ffprobe metadata → thumbnail → async HLS
transcode → update revision status to ready.

New files:
- video-service.ts: FFmpeg/ffprobe wrapper (HLS, thumbnails, metadata)
- /api/uploads/[...path]: streaming file server with Range support
Modified:
- upload-service.ts: video handling, 500MB limit, async HLS pipeline
- upload route: accepts video/referenceVideo types
- Dockerfile: ffmpeg + /data/uploads directory
- docker-compose.yml: uploads_data volume

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 23:52:40 -05:00
Leivur Djurhuus
e5b398d7da feat: Implement automation event bus and rule engine
- Add event bus for dispatching automation events with handlers.
- Create rule engine to evaluate events against defined triggers.
- Introduce chat provider to interface with Claude API and Ollama fallback.
- Define tool schemas for Claude-compatible operations.
- Implement tool executor to map tool calls to service layer functions.
- Develop automation service for CRUD operations on rules and event handling.
2026-03-12 11:20:21 -05:00
Leivur Djurhuus
9d5acf1683 feat: add Smart Search Panel with semantic search capabilities
- Implemented Smart Search Panel component for enhanced project and deliverable search functionality.
- Introduced useSemanticSearch and useOllamaHealth hooks for managing search queries and AI availability.
- Developed embedding-service to generate and store vector embeddings for projects and deliverables.
- Created semantic-search-service to handle vector search, structural query detection, and LLM summarization.
- Added support for hybrid search combining structural filters and semantic queries.
- Integrated UI components for displaying search results and user interactions.
2026-03-06 16:13:36 -06:00