Commit Graph

150 Commits

Author SHA1 Message Date
b6c8da8cca fix: increase WebSocket pub-sub timeout from 60s to 180s
LLM responses can take >60s (especially with local models). The
WebSocket listener was timing out before the response arrived,
causing agent replies to appear in logs but not in the chat UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:48:22 -06:00
ebe8a9d974 fix: login page crash — LanguageSwitcher split for pre-auth context
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:31:48 -06:00
2925aaac7d docs(phase-7): complete Multilanguage phase execution 2026-03-25 17:12:28 -06:00
b5709d9549 docs(07-04): complete multilanguage verification plan
- Human verification approved for all 6 I18N requirements
- Portal confirmed rendering correctly in EN/ES/PT
- Language switcher, persistence, and AI Employee language response verified
- Phase 7 (multilanguage) marked complete in ROADMAP.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 17:06:58 -06:00
6e9441215b docs(07-03): complete portal i18n string extraction plan 2026-03-25 17:05:08 -06:00
1018269f82 docs(07-02): complete frontend i18n infrastructure plan
- Create 07-02-SUMMARY.md with full execution details
- Update STATE.md with position, decisions, metrics
- Update ROADMAP.md progress (Phase 7: 2/4 plans complete)
- Mark requirements I18N-01, I18N-02 complete in REQUIREMENTS.md
2026-03-25 16:30:37 -06:00
1b69ea802e docs(07-01): complete backend multilanguage foundation plan 2026-03-25 16:29:03 -06:00
9654982433 feat(07-01): localized emails, locale-aware templates API, language preference endpoint
- email.py: send_invite_email() adds language param (en/es/pt), sends localized subject+body
- templates.py: list_templates()/get_template() accept ?locale= param, merge translations on response
- portal.py: PATCH /api/portal/users/me/language endpoint persists language preference
- portal.py: /api/portal/auth/verify response includes user.language field
- portal.py: AuthVerifyResponse adds language field (default 'en')
- test_portal_auth.py: fix _make_user mock to set language='en' (auto-fix Rule 1)
- test_language_preference.py: 4 integration tests for language preference endpoint
- test_templates_i18n.py: 5 integration tests for locale-aware templates (all passing)
2026-03-25 16:27:14 -06:00
7a3a4f0fdd feat(07-01): DB migration 009, ORM updates, and LANGUAGE_INSTRUCTION in system prompts
- Migration 009: adds language col (VARCHAR 10, NOT NULL, default 'en') to portal_users
- Migration 009: adds translations col (JSONB, NOT NULL, default '{}') to agent_templates
- Migration 009: backfills es+pt translations for all 7 seed templates
- PortalUser ORM: language mapped column added
- AgentTemplate ORM: translations mapped column added
- system_prompt_builder.py: LANGUAGE_INSTRUCTION constant + appended before AI_TRANSPARENCY_CLAUSE
- system-prompt-builder.ts: LANGUAGE_INSTRUCTION constant + appended before AI transparency clause
- tests: TestLanguageInstruction class with 3 tests (all pass, 20 total)
2026-03-25 16:22:53 -06:00
5cd9305d27 fix(07): revise plans based on checker feedback 2026-03-25 16:13:40 -06:00
528daeb237 docs(07): create phase 7 multilanguage plan 2026-03-25 16:07:50 -06:00
4ad975d850 docs(07): add research and validation strategy 2026-03-25 16:01:00 -06:00
3d3692f3ab docs(07): research phase multilanguage domain 2026-03-25 16:00:02 -06:00
52dcbe5977 docs(state): record phase 7 context session 2026-03-25 15:52:25 -06:00
9db830e14d docs(07): capture phase context 2026-03-25 15:52:25 -06:00
9ee0b8a405 docs: add Phase 7 — Multilanguage (English, Spanish, Portuguese) 2026-03-25 15:37:57 -06:00
ebfcb8a24c fix: template library and all API calls wait for session before fetching
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:23:47 -06:00
b3635ae34d fix: align all three New Employee cards at same height
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:13:20 -06:00
7ef727f968 fix: Recommended badge no longer clips outside Templates card
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:09:26 -06:00
35131e353b fix: eliminate 422 race condition — RBAC headers sync before queries
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:05:46 -06:00
ee1c2f70f8 fix: set RLS tenant context for chat conversation lookups
Chat API queries on web_conversations need tenant context set before
RLS policies allow the SELECT. Also fixes crypto.randomUUID fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:34:38 -06:00
5b02b233f3 fix: chat WebSocket connects to correct remote host
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:26:36 -06:00
ebf6e76174 feat: make Ollama model configurable via OLLAMA_MODEL env var
- Add OLLAMA_MODEL setting to shared config (default: qwen3:32b)
- LLM router reads from settings instead of hardcoded model name
- Create .env file with all configurable settings documented
- docker-compose passes OLLAMA_MODEL to llm-pool container

To change the model: edit OLLAMA_MODEL in .env and restart llm-pool.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:22:18 -06:00
22c6a44ff6 fix: map all model_preference values to LiteLLM router groups
Added balanced/economy/local groups alongside fast/quality so all 5
agent model_preference values resolve to real provider groups.
All default to local Ollama qwen3:32b, commercial as fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:20:23 -06:00
2444c61022 fix: chat page shows tenant picker for platform admins
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:10:49 -06:00
84d2e775ad fix: register RLS hook on gateway — agent creation was failing with policy violation
The gateway never called configure_rls_hook(engine), so SET LOCAL
app.current_tenant was never set for any DB operation through the
portal API endpoints. All tenant-scoped writes (agent creation, etc.)
failed with "new row violates row-level security policy."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:40:08 -06:00
2127d1a844 feat: portal font upgrade — DM Sans + JetBrains Mono
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:19:33 -06:00
01e685b18b feat: premium portal UI — glass-morphism and luminous design system
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:15:58 -06:00
012566c8ee feat: portal UI revamp — brand identity and visual polish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:54:33 -06:00
7469f39259 docs(phase-6): complete Web Chat phase execution 2026-03-25 10:41:50 -06:00
9af4ad5816 docs(06-03): complete web chat human verification plan
- Created 06-03-SUMMARY.md for human-verify checkpoint completion
- All CHAT requirements (CHAT-01–CHAT-05) confirmed by human review
- STATE.md updated: 25/25 plans complete, session recorded
- ROADMAP.md updated: Phase 6 marked Complete (3/3 summaries)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 10:37:59 -06:00
7281285b13 docs(06-02): complete web chat portal UI plan
- Add 06-02-SUMMARY.md with full execution record
- Update STATE.md: progress 96%, decisions recorded, session updated
- Update ROADMAP.md: phase 6 plan progress (2/3 summaries)
2026-03-25 10:36:22 -06:00
3c10bceba7 docs(06-01): complete web chat backend infrastructure plan 2026-03-25 10:28:44 -06:00
56c11a0f1a feat(06-01): WebSocket endpoint, chat REST API, orchestrator wiring, gateway mounting
- Create gateway/channels/web.py with normalize_web_event() and /chat/ws/{conversation_id}
  WebSocket endpoint (auth via first JSON message, typing indicator, Redis pub-sub response)
- Create shared/api/chat.py with GET/POST/DELETE /api/portal/chat/conversations* REST API
  with require_tenant_member RBAC enforcement and RLS context var setup
- Add chat_router to shared/api/__init__.py exports
- Mount chat_router and web_chat_router in gateway/main.py (Phase 6 Web Chat routers)
- All 19 unit tests pass; full 313-test suite green
2026-03-25 10:26:54 -06:00
c72beb916b feat(06-01): add web channel type, Redis key, ORM models, migration, and tests
- Add ChannelType.WEB = 'web' to shared/models/message.py
- Add webchat_response_key() to shared/redis_keys.py
- Create WebConversation and WebConversationMessage ORM models (SQLAlchemy 2.0)
- Create migration 008_web_chat.py with RLS, indexes, and channel_type CHECK update
- Pop conversation_id/portal_user_id extras in handle_message before model_validate
- Add web case to _build_response_extras and _send_response (Redis pub-sub publish)
- Import webchat_response_key in orchestrator/tasks.py
- Write 19 unit tests covering CHAT-01 through CHAT-05 (all pass)
2026-03-25 10:26:34 -06:00
c0fa0cefee docs(06-web-chat): create phase plan 2026-03-25 10:08:44 -06:00
5e4dd34331 docs(06): add research and validation strategy 2026-03-25 10:02:39 -06:00
03e38f3692 docs(06): research web chat phase — WebSocket, Redis pub-sub, channel adapter, portal UI 2026-03-25 10:01:45 -06:00
1b086b8c82 docs(state): record phase 6 context session 2026-03-25 08:38:50 -06:00
4077512a38 docs(06): capture phase context 2026-03-25 08:38:50 -06:00
d0afd66e85 docs: add Phase 6 — Web Chat interface for AI Employees 2026-03-24 22:45:32 -06:00
58a1295e5f docs(phase-5): complete Employee Design phase execution 2026-03-24 20:54:45 -06:00
999c6ce55b docs(05-04): complete RBAC gap closure and wizard error fix plan
- Added 05-04-SUMMARY.md
- Updated STATE.md with decisions and session info
- Updated ROADMAP.md with Phase 5 plan progress (4/4 complete)
2026-03-24 20:52:31 -06:00
b287a95014 docs(05-employee-design): create gap closure plan for RBAC and error handling fixes 2026-03-24 20:50:30 -06:00
969cc4f917 docs(05-03): complete employee design human verification — Phase 5 complete 2026-03-24 20:42:19 -06:00
b917f7c54c docs(05-02): complete employee creation UI frontend plan
- Three-option entry screen, template gallery, 5-step wizard, advanced mode
- SUMMARY.md created with task commits, deviations, decisions
- STATE.md updated with decisions, metrics, session
- ROADMAP.md updated with phase 5 plan progress
- Requirements EMPL-01, EMPL-05 marked complete
2026-03-24 20:40:53 -06:00
c688b76c13 docs(05-01): complete agent templates backend plan — system prompt builder, migration 007, template API
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 20:33:44 -06:00
f9ce3d650f feat(05-01): template list/detail/deploy API + RBAC + integration tests
- Create shared/api/templates.py with templates_router
- GET /api/portal/templates: list active templates (any authenticated user)
- GET /api/portal/templates/{id}: get template detail (any authenticated user)
- POST /api/portal/templates/{id}/deploy: create Agent snapshot (tenant_admin only)
- customer_operator returns 403 on deploy (RBAC enforced)
- Export templates_router from shared/api/__init__.py
- Mount templates_router in gateway/main.py (Phase 5 section)
- 11 integration tests pass (list, detail, deploy, RBAC, 404, snapshot independence)
2026-03-24 20:32:30 -06:00
d1acb292a1 feat(05-01): AgentTemplate ORM model, migration 007, and system prompt builder
- Add AgentTemplate ORM model to tenant.py (global, not tenant-scoped)
- Create migration 007 with agent_templates table and 7 seed templates
- Create shared/prompts/system_prompt_builder.py with build_system_prompt()
- AI transparency clause always present (non-negotiable per Phase 1 decision)
- Unit tests pass (17 tests, all sections verified)
2026-03-24 20:27:54 -06:00
bffc1f2f67 docs(05-employee-design): create phase plan — 3 plans in 3 waves 2026-03-24 20:11:56 -06:00