Commit graph

61 commits

Author SHA1 Message Date
eric
deda8ac86a Fix communication_manager: replace @SEND_TELEGRAM with <send_telegram> XML format 2026-02-23 10:53:41 +00:00
eric
5c75ad575d Add fullscreen file editor for email templates, project docs and agent files 2026-02-23 10:23:02 +00:00
eric
7844e82c95 Fix delete JSON error: API routes return 401 JSON instead of HTML redirect, robust fetch error handling 2026-02-23 08:58:18 +00:00
eric
58fcddbff1 Fix mixed content: ProxyFix for HTTPS behind nginx, set PREFERRED_URL_SCHEME=https 2026-02-23 08:56:50 +00:00
eric
595451428a Fix delete fetch: add credentials same-origin 2026-02-23 08:55:15 +00:00
eric
04eaac3094 Fix sent emails: use data-attributes for read modal, fix delete route collision with /emails/<email_id> 2026-02-23 08:54:00 +00:00
eric
7a9a69c86d Sent emails log: add read (eye) and delete buttons matching files page style 2026-02-23 08:52:00 +00:00
eric
d31af062ed Add sent emails log to /emails page with full body preview modal 2026-02-23 08:43:13 +00:00
eric
639f093175 Security: harden against prompt injection - remove Bash tool, isolate user input, restrict dangerous commands to orchestrator only 2026-02-23 08:13:07 +00:00
eric
558c2d46f0 Fix Telegram double-message: skip TaskBeat reply if agent already sent via <send_telegram>, strip command blocks from response 2026-02-23 08:03:09 +00:00
eric
be1f375071 Fix Telegram prompt: send only message text to orchestrator, not duplicate title 2026-02-23 07:59:51 +00:00
eric
ab21363032 Fix Telegram: handle None message text and include reply context for bot message replies 2026-02-23 07:57:03 +00:00
eric
86dc556c4e Add daily standup toggle slider and clear-all-tasks button to dashboard 2026-02-22 09:56:12 +00:00
eric
c82ecdd5f1 Fix duplicate Telegram: orchestrator prompt must not send messages during standup (team already contacted directly) 2026-02-21 20:39:35 +00:00
eric
0868a2c71f Fix standup race condition: lock + daily guard + remove standup from TaskBeat whitelist
- _standup_lock: threading.Lock prevents concurrent standup runs
- DB check: if a standup task already exists for today, abort
- TaskBeat whitelist: remove 'standup' type so TaskBeat never re-runs standup tasks
  (standup is always driven by trigger_daily_standup(), not TaskBeat)
2026-02-21 20:28:22 +00:00
eric
8780c2b176 Fix task ordering (FIFO) + Telegram standup reply matching
- get_tasks(): ORDER BY id ASC (oldest first) for TaskBeat FIFO processing
- UI calls use order='desc' so display stays newest-first
- trigger_daily_standup(): standup sub-tasks now stored as type='standup_reply'
  with telegram_chat_id set correctly so replies can be matched
- telegram_message_handler: checks for open standup_reply task from same
  chat_id before creating new task - if found, marks standup complete and
  creates orchestrator follow-up task with full context to process the reply
- tasks.html: badge for standup_reply type
2026-02-21 20:22:39 +00:00
eric
01858b5fc6 Fix TaskBeat: add agent_subtask/standup/broadcast to processing whitelist 2026-02-21 19:53:11 +00:00
eric
003e591a04 Add daily standup + knowledge broadcast system
- DailyStandupBeat thread fires at 09:00 every day
- trigger_daily_standup(): messages all team members, orchestrator updates KB + agent reminders
- broadcast_knowledge_update(): distributes any new info to all agents immediately
- parse_agent_commands(): add <update_knowledge> and <update_agent_reminder> XML handlers
- /api/standup/trigger and /api/broadcast routes for manual triggering
- orchestrator systemprompt: standup + broadcast instructions with examples
- tasks.html: badges for standup / broadcast / action_knowledge task types
2026-02-21 19:46:42 +00:00
eric
7fe1365ebc Fix get_field(): support multiline values in key-value format (email body was truncated to first line) 2026-02-21 19:35:34 +00:00
eric
46a77c7800 Fix /api/agent-stream: use build_agent_prompt, accumulate response_text, call parse_agent_commands 2026-02-21 19:29:20 +00:00
eric
c6ce8a873c fix: Switch agent commands from @-syntax to XML tags — Claude Code refuses to output @-directives
Root cause: opencode/Claude Code recognizes the Frankenbot repo context from CLAUDE.md
and refuses to output @CREATE_SUBTASK, @SEND_EMAIL etc. as they look like 'system
directives'. XML tags (<create_task>, <send_email>, etc.) work reliably.

- parse_agent_commands(): full rewrite with XML tag parser, supports both
  XML child tags and key: value fields within blocks
- build_agent_prompt(): command docs updated to XML format with code examples
- orchestrator/systemprompt.md: rewritten with XML action examples
- ar_manager/systemprompt.md: @ASK_ORCHESTRATOR -> <ask_orchestrator>
2026-02-21 19:21:01 +00:00
eric
54cc5a496f fix: Rewrite orchestrator system prompt with clear task-creation and delegation rules
Old prompt had no instructions for when/how to use @CREATE_SUBTASK during chat,
no list of available agents by key name, and no guidance on handling conversational
messages. Orchestrator was answering questions but never creating tasks or taking
actions autonomously.
2026-02-21 19:11:28 +00:00
eric
d38ba10b5e fix: Use correct created_at field name in tasks template (was task.created) 2026-02-21 19:09:40 +00:00
eric
d3800ac792 feat: Log all agent actions (@SEND_EMAIL, @SEND_TELEGRAM, @ADD/UPDATE_TEAM_MEMBER) as tasks
Every parsed agent command now creates a task entry with type action_email /
action_telegram / action_team, parent_task_id pointing to the originating task,
and status completed/error reflecting the actual outcome.

Tasks UI gets matching badges for all new types plus a parent-task indicator
(↳ #N) so the full chain from trigger to action is visible at a glance.
2026-02-21 19:06:33 +00:00
eric
f13860f38d fix: Chat streaming uses same full prompt as execute_agent_task
The /chat/send SSE stream was building a stripped-down system prompt
without any Frankenbot command documentation (@CREATE_SUBTASK, @SEND_EMAIL,
@SEND_TELEGRAM etc.), so agents never knew to emit these commands during
web chat sessions — tasks were never created, emails never sent.

Extract build_agent_prompt() as shared function used by both
execute_agent_task() and the streaming chat generator.
2026-02-21 19:04:03 +00:00
eric
eaccbe770a fix: Correct all agent command parsers and document Claude Code tools in system prompt
- @SEND_TELEGRAM: fix regex To: -> TelegramID:, fix DB lookup telegram_chat_id -> telegram_id,
  use send_telegram_message() (sync HTTP) instead of asyncio.run(), support direct numeric IDs
- @ADD_TEAM_MEMBER: fix field order in regex (Name/Role/Responsibilities/Email) to match prompt
- System prompt: document all Claude Code built-in tools (WebFetch, Read, Write, Edit,
  Glob, Grep, Bash) so agents know what is available, clean up command documentation
2026-02-21 18:56:52 +00:00
eric
f6ad727bf0 feat: Persist outbound emails, fix @UPDATE_TEAM_MEMBER parser, add per-entry delete
- Add sent_emails table to DB for persistent outbox logging
- send_email() now writes every outgoing mail (incl. errors) to sent_emails
- parse_agent_commands() passes agent_key/task_id as triggered_by metadata
- Fix @UPDATE_TEAM_MEMBER parser: now matches Identifier/TelegramID/Role/etc.
  format from system prompt (was expecting Email/Field/Value — never matched)
- update_team_member() called correctly via **kwargs (was positional args bug)
- Set Piotr telegram_id=1578034974 directly in DB
- email_log.html: two-tab UI (Inbox Journal + Outbox), click-to-expand body
- emails.html: per-message delete button in inbox list
- New routes: DELETE inbox (IMAP expunge), journal entry, sent entry
2026-02-21 18:43:21 +00:00
eric
99df910497 feat: Add Telegram bot integration and task detail/delete UI
- Wire up Telegram bot with token, allowed users and username from .env
- Fix TaskBeat to handle direct tasks (Telegram/email) without sub_tasks
- Fix send_telegram_message to use run_coroutine_threadsafe (avoid event loop clash)
- Add TaskBeat watchdog thread for auto-restart on crash
- Reset stuck in_progress tasks on startup
- Add task detail page (/tasks/<id>) with full response/log view and auto-refresh
- Add task delete route (/tasks/delete/<id>) with confirmation
- Include agent sender info in Telegram task prompts
- Orchestrator self-updated knowledge base with Telegram contact info
2026-02-21 18:14:43 +00:00
eric
5b4b698064 feat: Add webhook endpoint for auto-deploy on git push
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:38:00 +00:00
eric
c3438beed1 docs: Add CLAUDE.md for Claude Code context
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:32:11 +00:00
eric
83b1842392 feat: Add password login system and upgrade agent models
- App-level password auth via Flask session (APP_PASSWORD in .env)
- login_required decorator on all routes
- Login page, logout button in navbar, 7-day session lifetime
- Upgrade musik_rechte_advisor and negotiator from Opus 4.0 to Opus 4.6
- Fix orchestrator session cookie overflow (kb/prompts no longer stored in session)
- Change app port from 5000 to 5050 (5000 occupied by Zou/Kitsu)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:26:10 +00:00
7ee66397e1 feat: Enhanced Orchestrator Chat with notifications and better UX
- Add task creation notifications in Orchestrator Chat
- New messages appear at top (newest first)
- Add Clear Chat button with confirmation
- Improve timestamps: DD.MM.YYYY HH:MM:SS format
- Support for system notifications (task created, sub-agent responses)
- Add add_orchestrator_notification() helper function
- Auto-notify when agents create sub-tasks
- Clear Chat route: POST /orchestrator/clear
- Better visual distinction between messages and notifications
2026-02-21 18:02:01 +01:00
98ff812a82 fix: Centralize all agent work to their work directories
- Move knowledge base from root to agents/orchestrator/knowledge/
- Move orphaned files (AKM, Event-Plan) to orchestrator/work/
- Update all kb_file paths to new location
- Change orchestrator stream to use work_dir instead of root
- Now ALL agents (including orchestrator) work in their own folders
- No more files created in project root
- Consistent work directory behavior across all agents
2026-02-21 17:48:30 +01:00
4c03663418 fix: Reload AGENTS dict when agent is deleted
- Add global AGENTS reload after agent deletion
- Ensures agent immediately disappears from all dropdowns/UIs
- Matches agent creation behavior (which already reloads)
- Fixes issue where deleted agents still appeared in chat/task forms
2026-02-21 17:42:54 +01:00
e2a853ffde feat: Add live streaming to Chat page
- Replace blocking execute_agent_task() with live subprocess streaming
- Use Popen() to read opencode output line-by-line in real-time
- Send 'chunk' events to frontend as agent thinks
- Frontend appends chunks incrementally for live response
- Matches Orchestrator's streaming UX
- No more waiting for complete response before seeing output
2026-02-21 17:32:37 +01:00
d620f496a8 feat: Make footer app name dynamic
- Replace hardcoded 'Frankenbot' in footer with {{ app_name }}
- Footer now reflects custom app name from settings
- Consistent branding across navigation, title, and footer
2026-02-21 17:28:46 +01:00
4f5e3dcd34 fix: Improve form-text readability in Dark Mode
- Override Bootstrap default color for .form-text
- Use var(--text-secondary) for better visibility
- Ensures help text under form fields is readable
2026-02-21 17:25:57 +01:00
b218d111b6 feat: Redesign Dark Mode with balanced purple theme
- Change Dark Mode accent from blue to purple (#a855f7)
- Balance dark backgrounds to match Light Mode structure
  - bg-base: #1a1a1a (was #0f0f0f - too dark)
  - bg-surface: #212121 (more balanced)
  - Improved contrast and readability
- Update borders to be more visible (12% vs 8% opacity)
- Adjust agent colors for purple theme:
  - Orchestrator: Purple
  - Researcher: Green
  - Negotiator: Orange
  - AR Manager: Yellow
- Update Settings description: 'Violett' instead of 'Blau'
- Dark Mode now mirrors Light Mode balance (just inverted)
2026-02-21 17:19:32 +01:00
85976afa09 fix: Use theme-aware code color in file modal
- Replace hardcoded #a5f3fc (bright blue) with var(--code-text)
- Now respects dark mode (#d4d4d4) and light mode (#404040)
- Fixes unreadable text in file preview modal
2026-02-21 17:14:06 +01:00
559eca4d61 fix: Improve code/pre readability in both themes
- Dark Mode: Use soft light gray (#d4d4d4) instead of bright blue
- Light Mode: Use dark gray (#404040) for good contrast
- Add subtle border for better code block definition
- Remove hacky bright blue color that was unreadable in light mode
2026-02-21 17:06:48 +01:00
2a9941f35f feat: Material Icons, customizable app name & dark/light mode toggle
- Add Google Material Icons integration with smart_toy robot icon
- Implement app_settings database table for persistent configuration
- Add App Name customization in Settings (changes navigation & title)
- Add Dark/Light Mode theme switcher
  - Dark Mode: Lightened black (#0f0f0f) with blue accents (#0a84ff)
  - Light Mode: Clean white/gray with red accents (#ef4444)
- Create context_processor for global app_settings injection
- Redesign Settings page with new App Design section
- Optimize CSS: 724 additions, reduced complexity
- Remove outdated agent reminders (70 lines cleanup)
2026-02-21 16:59:18 +01:00
f43bf1646d feat: Modern professional design overhaul
From 'Russian hacker site' to 'Tech startup' aesthetic 🎨

Color Palette:
- Switched from dark purple (#7c6fff) to elegant indigo (#6366f1)
- Softer backgrounds with better contrast
- Professional teal accent (#14b8a6) instead of neon green
- Vibrant but tasteful status colors

Typography:
- New font: Plus Jakarta Sans (modern, professional)
- Better letter-spacing and line-height
- Improved hierarchy with font weights

Components:
- Cards: Soft shadows, subtle gradients, hover lift effect
- Buttons: Gradient backgrounds, prominent shadows, smooth animations
- Inputs: Backdrop blur, focus glow effects, refined borders
- Badges: Rounded corners, glow shadows, better contrast
- Navbar: Enhanced glass effect, professional spacing

Visual Effects:
- Smooth transitions (.25s cubic-bezier)
- Hover animations (translateY, shadows)
- Multi-layer radial gradients for depth
- Subtle glow effects on interactive elements

Agent Colors (brighter):
- Orchestrator: Vibrant purple (#8b5cf6)
- Researcher: Modern teal (#14b8a6)
- Negotiator: Bold red (#f43f5e)
- AR Manager: Warm amber (#f59e0b)

Result: Clean, modern, professional interface
2026-02-21 16:00:03 +01:00
d48537b1fd fix: Handle orchestrated tasks without sub_tasks
Problem:
- Task #1 was stuck in 'in_progress' status
- TaskBeat expects 'sub_tasks' array for orchestrated tasks
- Tasks created via old API didn't have sub_tasks defined
- TaskBeat only processes 'pending' tasks, so in_progress tasks stay stuck

Solution:
- Added validation: if orchestrated task has no sub_tasks, mark as completed with error message
- Prevents infinite loop with stuck tasks
- Manually completed Task #1 in database

Note: This handles legacy tasks from deprecated /api/orchestrate endpoint.
2026-02-21 15:44:00 +01:00
dc2ea07621 feat: Complete UX cleanup - Agent colors & streamlined navigation
Agent Color System:
- Added unique colors for each agent (orchestrator: purple, researcher: teal, negotiator: red, ar_manager: yellow)
- CSS variables and utility classes (.agent-*, .agent-badge-*, .agent-border-*)
- Tasks table now shows colored left border per agent
- Agent names displayed in their brand color

Navigation Simplification:
- Removed 'Email Log' from main menu (reduced clutter)
- Email Log now accessible via link in Emails page
- Active state for both /emails and /email-log on Emails nav item

Visual Improvements:
- Agent assignments now visually distinct at a glance
- Cleaner, more focused navigation menu
- Better information architecture
2026-02-21 15:06:32 +01:00
50c1a0315b feat: UX Cleanup & Critical TaskBeat Fix
UX Improvements:
- Tasks page: Remove 'Create new task' form (orchestrator handles all)
- Orchestrator: Simplified to single 'Prompt' section, removed 'Tasks verteilen'
- Orchestrator: Removed 'Klassisch senden' button (live-only responses)
- Orchestrator: Removed 'Aktive Agenten' display (redundant with dashboard)

Critical Fix:
- TaskBeat now reads pending tasks from DATABASE instead of in-memory array
- All status updates (pending→in_progress→completed) now persist to DB
- Fixes issue where tasks created via API/UI were not being processed
- Agent_key updates also synced to DB

This fixes the bug where Task #1 was stuck in pending status.
2026-02-21 15:04:22 +01:00
c949c04a5c chore: Update agent work files and documentation
Agent updates:
- AR Manager: Add memory tasks.json, performance log
- Negotiator: Update reminders, systemprompt, add strategy doc
- Orchestrator: Update reminders, add performance & budget reports
- Researcher: Remove test file

New content:
- Diversity Ball sponsor research documentation
- Email template for beverage sponsor inquiry
- Sponsor strategy tracking

Cleanup:
- Remove old Location Report (outdated)
2026-02-21 14:47:25 +01:00
1970abf487 fix: Correct url_for endpoint for file deletion routes
Changed all 'files_page' to 'files' in redirect calls:
- delete_agent_file() - 4 occurrences
- delete_project_file() - 4 occurrences

Fixes Internal Server Error (500) when deleting files.
Error was: BuildError: Could not build url for endpoint 'files_page'
2026-02-21 14:38:01 +01:00
57a6ffc046 fix: Update init_default_team_members() to match correct DB data
Corrected team member roles and responsibilities:
- Eric Fischer: Programmer → Funktionserweiterung
- Georg Tschare: CEO → Personalmanagement, Kundenkommunikation, Kommunikation mit Behörden
- Piotr Dyderski: Tech, 3D Art, RnD → Technische Infrastruktur, AI-Agenten, Automatisierung, 3D Avatare, Research and Development

DB data is the source of truth, code now matches.
2026-02-21 14:27:20 +01:00
4ca5132391 feat: Add edit functionality for team members
- Edit modal with Bootstrap for inline editing
- Update name, email, role, responsibilities, telegram_id
- Form validation and error handling
- Success/error flash messages
- Team member data passed to frontend via JSON
2026-02-21 14:22:38 +01:00
0e02611c87 feat: Add Team-Members management page
- New /team route to view all team members
- Add/activate/deactivate team members via UI
- Display name, role, email, responsibilities, telegram_id
- Integrated into main navigation
- Self-learning system info displayed
2026-02-21 14:20:07 +01:00