Commit Graph

369 Commits

Author SHA1 Message Date
Agent Zero 202d80c750 feat: treeview with folders, toolbar, file attachments in chat 2026-07-17 09:21:40 +02:00
Agent Zero 9a29206190 feat: chat folders, attachments, treeview backend - migration, models, routes 2026-07-17 09:15:39 +02:00
Agent Zero 50650f5b17 fix: always add provider prefix to litellm model string 2026-07-17 01:48:08 +02:00
Agent Zero da8d0ce818 fix: add CSRF token to streaming fetch request 2026-07-17 01:43:52 +02:00
Agent Zero 561d1919f5 fix: add deleted_at columns to AI Assistant migration SQL 2026-07-17 01:08:13 +02:00
Agent Zero 8255704ff9 fix: add missing AIPreset import in routes.py 2026-07-17 01:06:08 +02:00
Agent Zero 0774fc4407 fix: make migration 0020 idempotent (check column exists) 2026-07-17 00:59:41 +02:00
Agent Zero 4a461f4a72 fix: correct migration 0020 down_revision to 0019_rbac_groups 2026-07-17 00:58:08 +02:00
Agent Zero 2d5d0143e6 AI Assistant: frontend - chat app, sidebar, settings with 4 tabs 2026-07-17 00:52:17 +02:00
Agent Zero 26feadf179 AI Assistant plugin: backend with LiteLLM, agents, tools, streaming chat 2026-07-17 00:45:24 +02:00
Agent Zero 2e5065c9d0 fix(mail): frontend filename decoding for attachments + backend robust decoding
- Frontend: decodeMimeHeader() on attachment filenames in MailDetail for display
- Backend: _decode_mime_filename() helper with Q-encoding fallback for edge cases
- Attachments now visible in mail detail UI (was 0 records, now 44+)
- Notifications table updated_at column added via migration 0020
2026-07-16 23:36:58 +02:00
Agent Zero 2278ec2722 fix(mail): robust MIME filename decoding with fallback for attachments
- Add _decode_mime_filename() helper with Q-encoding fallback decoder
- Use helper for both new and existing email attachment saving
- Handles edge cases where email.header.decode_header fails on partially processed filenames
2026-07-16 23:30:13 +02:00
Agent Zero 0c310c5028 fix(mail): decode MIME-encoded attachment filenames during sync
- Decode =?utf-8?q?...?= filenames before sanitizing for both new and existing emails
- Prevents filenames like __utf-8_q_Wire_236095209372_2Epdf_2Ehtml__
- Uses email.header.decode_header + make_header for proper decoding
2026-07-16 23:23:27 +02:00
Agent Zero 1701361e92 fix(mail): add notifications updated_at migration + attachment sync fix
- Migration 0020: Add updated_at column to notifications table (was missing, causing sync failures)
- IMAP sync now saves attachments for existing emails (retroactive attachment saving)
- Replace silent exception with logger.warning for attachment save failures
- Sync verified: 37 attachments now stored in database (was 0 before)
2026-07-16 23:15:12 +02:00
Agent Zero 881f4817be fix(mail): save attachments for existing emails during sync
- IMAP sync now saves attachments for existing emails that have has_attachments=true
  but no attachment records in the database (retroactive attachment saving)
- Replace silent exception catching with logger.warning for attachment save failures
- Add logging module import and logger instance
- This fixes the issue where 62 emails had has_attachments=true but 0 attachment records
2026-07-16 23:08:37 +02:00
Agent Zero 5b3e874cf2 fix(mail): account creation form - add username and is_shared fields
- Add username field to account creation form (defaults to email if empty)
- Add is_shared checkbox toggle for shared mailboxes
- Update CreateAccountPayload type with optional username and is_shared
- The infinite re-render fix (previous commit) resolves the main issue:
  accounts were not shown in settings because loadAccounts was looping,
  flooding the browser with requests and preventing API calls from completing
2026-07-16 22:41:44 +02:00
Agent Zero 68a9415e99 fix(mail): infinite re-render in MailSettings + error handling + sync result
- Fix infinite re-render: loadAccounts had selectedAccountId in deps causing
  repeated fetches every render; use functional setState and empty deps
- Fix all error handlers in MailSettings: err?.message || err?.detail instead of String(err)
- Fix sync result handling: backend returns {synced, error?} not {success, synced_count}
- This infinite re-render was flooding the browser with requests, causing
  Network Error for SignatureManager API calls
2026-07-16 22:20:41 +02:00
Agent Zero 214814785e fix(mail): signature manager error handling - prevent [object Object] display
- Fix error handling in SignatureManager load/save/delete to extract message from ApiError
- Same pattern as sync fix: err?.message || err?.detail instead of String(err)
2026-07-16 22:02:29 +02:00
Agent Zero 7cb1341a28 feat(mail): rich text editor for signatures + placeholder variables
- Replace textarea in SignatureManager with TipTap RichTextEditor
- Add placeholder variable buttons: {{user.name}}, {{user.first_name}},
  {{user.last_name}}, {{user.email}}, {{user.role}}, {{tenant.name}}, {{date}}
- Add replaceSignatureVariables() utility in mail API
- ComposeModal now replaces variables with actual user/tenant data when inserting signature
- Variables resolved from auth store (user name, email, role, tenant name)
2026-07-16 21:55:38 +02:00
Agent Zero 178bd84fd6 feat(mail): replace contentEditable with TipTap rich text editor
- Add RichTextEditor component with TipTap (ProseMirror-based) editor
- Full toolbar: bold, italic, underline, strikethrough, H1/H2/H3, bullet/numbered lists,
  blockquote, inline code, code block, text alignment (left/center/right/justify),
  text color picker, link insert/edit, image insert, clear formatting, undo/redo
- Replace old contentEditable div + document.execCommand in ComposeModal
- Add Placeholder extension for empty editor hint
- Add ProseMirror CSS styles (lists, blockquote, code, headings, links, images)
- Update signature/template insertion to work with new editor state
2026-07-16 17:14:14 +02:00
Agent Zero 2a80aeb0af fix(mail): sync Object error, MIME subject decoding, sticky compact pagination
- Fix sync error: backend returns {synced, error?} not {success, synced_count}; frontend now checks error field
- Decode MIME encoded-words (=?UTF-8?Q?...?=) in backend during IMAP sync for subject/from/to/cc headers
- Add frontend decodeMimeHeader() utility for already-stored encoded subjects (MailList + MailDetail)
- Make pagination sticky at bottom of mail list (flex-col h-full, ul scrolls, pagination flex-shrink-0)
- Make pagination compact: smaller padding (px-1.5 py-0.5), text-xs, smaller icons, tighter spacing
2026-07-16 09:40:59 +02:00
Agent Zero 560e4ac69d fix(mail): remove duplicate toolbar, fix iframe height, move attachments into scrollable body
- Remove duplicate action bar from MailDetail (actions are in global plugin toolbar)
- Change iframe sandbox from "" to "allow-same-origin" so height auto-resize works
- Move attachments inside the scrollable body container so they are visible
- Remove unused imports (clsx, Badge) and unused destructured props
2026-07-16 09:09:15 +02:00
Agent Zero 467f73113c test: 102 comprehensive RBAC tests + fix: filter soft-deleted groups in permission resolver 2026-07-16 01:58:22 +02:00
Agent Zero a4560344c9 feat: phase 5 - mail plugin RBAC integration with delegate access levels (read/write/delete/full) 2026-07-16 00:34:36 +02:00
Agent Zero bb6466b53d feat: phase 4 - frontend groups UI, permission-matrix, usePermission hook, field-level permissions tab, authStore permissions 2026-07-15 23:27:11 +02:00
Agent Zero beaca24480 feat: phase 3 - field-level permissions with plugin field definitions, service-layer filtering, 20 core field definitions 2026-07-15 23:02:30 +02:00
Agent Zero 08fd3ab72c feat: phase 2 - migrate all route guards to require_permission (75 guards, 21 files) 2026-07-15 22:35:50 +02:00
Agent Zero 8ca6dfee88 fix: migration 0019 - add missing updated_at and deleted_at columns to roles table 2026-07-15 22:18:48 +02:00
Agent Zero ada5594ce5 fix: migration 0019 - remove updated_at from roles INSERT (roles table has no updated_at column) 2026-07-15 22:13:55 +02:00
Agent Zero 23e5cf1e15 fix: migration 0019 - use CAST(:perms AS jsonb) to avoid SQLAlchemy bind param collision with ::jsonb cast 2026-07-15 22:10:14 +02:00
Agent Zero 7bb0eb1941 fix: migration 0019 - use sa.text() with bindparams to avoid SQLAlchemy interpreting JSON colons as bind parameters 2026-07-15 22:06:24 +02:00
Agent Zero b490a62322 feat: granular RBAC system with user groups, deny-list, permission registry, system-admin, self-mod prevention 2026-07-15 21:59:45 +02:00
Agent Zero 905bc9b744 fix: correct migration 0018 revision id 2026-07-15 21:19:08 +02:00
Agent Zero 21f47b91dc fix: add missing created_at and deleted_at columns to notification_preferences
- Remove duplicate updated_at from NotificationPreference model (inherited from TimestampMixin)
- Add migration 0018 to add created_at and deleted_at columns
- Fixes 500 error on GET /notifications/types and /preferences
2026-07-15 21:13:32 +02:00
Agent Zero b0e987f790 feat: notification preferences system with plugin registry
- Add NotificationType and NotificationPreference models
- Add get_notification_types() to BasePlugin for plugin registration
- Add sync_notification_types() to PluginRegistry
- Update create_notification() to check user preferences (returns Notification|None)
- Add API endpoints: GET /types, GET /preferences, PATCH /preferences/{type_key}
- Add NotificationPreferenceUpdate schema
- Mail plugin registers 10 notification types with metadata
- Add Alembic migration 0017 for new tables + seed data
- Frontend: SettingsNotifications page with toggle switches
- Frontend: Settings tab, route, hooks for notification preferences
- i18n: notification settings keys (de/en)
2026-07-15 21:00:32 +02:00
Agent Zero c4d0ec6f7f feat: mail notification integration - 10 notification types
- mail_new: new mails during sync (max 10, then summary)
- mail_error: IMAP connection failure
- mail_auth: IMAP login failure
- mail_quota: mailbox quota >80% / >95% critical
- mail_sync_error: general sync failure per account
- mail_sent: mail sent confirmation
- mail_send_error: SMTP send failure
- mail_draft: draft saved confirmation
- mail_account: account inactive warning
- mail_folder: folder created/deleted confirmation
- All notifications non-critical (try/except wrapped)
- Import create_notification from app.core.notifications
2026-07-15 20:41:57 +02:00
Agent Zero f1a12092a0 feat: mail phase 4 - IMAP folder create/delete + auto-sync
- Add imap_create_folder() and imap_delete_folder() service functions
- Call IMAP CREATE/DELETE in folder create/delete endpoints
- Add auto_sync_all_accounts() background task (every 5 min)
- Start auto-sync loop on plugin activation via asyncio.create_task
- Frontend: working sync button with isSyncing state and toast feedback
- i18n: syncSuccess, syncFailed, syncing, autoSyncEnabled keys (de/en)
2026-07-15 20:28:11 +02:00
Agent Zero 4e100e9d33 feat: mail phase 3 - sorting (date/from/subject, asc/desc)
- Add sort_by and sort_order query params to list_mails endpoint
- Add deleted_at IS NULL filter to exclude soft-deleted mails
- Frontend: sort state in Mail.tsx, sort header bar in MailList
- Sort dropdown (Datum/Absender/Betreff) + asc/desc toggle
- fetchMails API accepts optional sortBy/sortOrder params
- i18n: 6 new sort keys (de/en)
2026-07-15 20:17:27 +02:00
Agent Zero ed1eec87dc feat: mail phase 2 - delete, move, drafts
- Add deleted_at field to Mail/MailAccount/MailFolder models
- Add DELETE /{mail_id} endpoint (soft-delete + IMAP EXPUNGE)
- Add POST /{mail_id}/move endpoint (IMAP UID MOVE + folder_id update)
- Add POST /drafts and PUT /drafts/{id} endpoints (save/edit drafts)
- Add imap_delete_mail() and imap_move_mail() service functions
- Add save_draft() and update_draft() service functions
- Frontend: deleteMail, moveMail, saveDraft, updateDraft API functions
- ComposeModal: draft mode with Save Draft button
- MailDetail: delete/move buttons, edit-draft for drafts
- Mail.tsx: bulk delete/move, move dropdown, draft handlers
- i18n: 13 new keys (de/en)
2026-07-15 19:44:46 +02:00
Agent Zero df83cee10c feat: mail phase 1 - HTML iframe display, bulk read/unread, IMAP flag sync
- Fix FlagUpdatePayload field names to match backend schema (is_seen/is_flagged)
- Replace dangerouslySetInnerHTML with sandboxed iframe (srcDoc, sandbox="")
- Add bulk mark read/unread with checkbox selection in MailList
- Add floating bulk action bar in Mail.tsx
- Add imap_sync_mail_flags() to push Seen/Flagged flags to IMAP server
- Call IMAP flag sync in PATCH /flags endpoint
- Add i18n keys for bulk actions (de/en)
2026-07-15 19:26:37 +02:00
Agent Zero 2108bdb9c2 feat: mail attachment support — sync, display, download, upload 2026-07-15 18:43:38 +02:00
Agent Zero de74429f4e feat: mobile-responsive mail plugin UI 2026-07-15 17:53:56 +02:00
Agent Zero 57b6df5357 fix: IMAP hierarchical folder sync, deduplication, folder tree display, resizable panel 2026-07-15 15:59:04 +02:00
Agent Zero e0975f4044 fix: mail UI German labels, multi-folder sync, account management, resizable panel fix 2026-07-15 14:36:45 +02:00
Agent Zero 0409a08002 feat(mail): resizable columns, account in folder tree, mail settings in CRM settings
- Add ResizablePanel component (components/ui/ResizablePanel.tsx) with
  drag-to-resize via mouse events, no external dependencies
- Replace fixed-width columns in Mail.tsx with ResizablePanel for all
  three panes (folder tree, mail list, mail detail)
- Remove account-select toolbar item from Mail.tsx; account selection
  is now integrated into the folder tree
- Restructure MailFolderTree to show mail accounts as top-level nodes
  with folders nested underneath, built from flat list via parent_id
- Add expand/collapse chevrons for accounts and folders with children
- Load folders for ALL accounts (not just selected one) so multi-account
  tree works
- Derive selectedAccountId from selected folder instead of separate
  account selector
- Add Mail tab to CRM Settings page (Settings.tsx) with 📧 icon
- Add /settings/mail route pointing to MailSettingsPage
- Update settings link in mail toolbar to point to /settings/mail
- Update no-accounts empty state link to /settings/mail
2026-07-15 13:37:22 +02:00
Agent Zero 5693fe1c3a fix: stabilize store functions with selectors to prevent infinite loop
- Use usePluginToolbarStore((s) => s.registerItems) selector pattern
- Remove store functions from useEffect dependency array
- Store functions are stable references from zustand selectors
2026-07-15 13:10:27 +02:00
Agent Zero 1f01f2182a fix: React infinite loop - use primitive deps for toolbar registration
- Replace selectedMail object with selectedMailId and selectedMailFlagged primitives
- Prevents useEffect infinite re-render loop
2026-07-15 13:03:36 +02:00
Agent Zero d82ca27fdc feat: move reply/forward/flag/event buttons to plugin toolbar
- Toolbar now includes context-aware mail action buttons
- Reply, Forward, Flag, Create Event disabled when no mail selected
- Buttons grouped: account | search | compose | mail-actions | tools
2026-07-15 12:55:41 +02:00
Agent Zero 56f624a073 feat: plugin ribbon toolbar + mail response fixes
- Add pluginToolbarStore for plugin toolbar item registration
- Add PluginToolbar component (slim ribbon bar under TopBar)
- Update AppShell to render PluginToolbar between TopBar and content
- Mail page registers toolbar items (account select, search, compose, sync, settings)
- Remove old mail top bar, use plugin toolbar instead
- Fix mail response: arrays for addresses, add from_name/body_html/sanitized_html/date
2026-07-15 12:22:14 +02:00
Agent Zero 6b6408fd25 fix: mail response fields - arrays for addresses, add from_name/body_html/sanitized_html/date
- to_addresses/cc_addresses/bcc_addresses now returned as arrays
- Added from_name, body_html, sanitized_html, date fields for frontend compatibility
2026-07-15 08:42:37 +02:00