feat(odoo): add activeblue_ai Odoo 18 module with OWL2 frontend

Models:
- ab.ai.bot: service URL, webhook secret, privacy mode, ping/dispatch
- ab.ai.directive: full directive lifecycle log with status tracking
- ab.ai.log: activity log with level/agent/record linkage
- ab.ai.agent.registry: agent list synced from agent service

Controllers:
- webhook.py: /ai/webhook/callback handles directive_completed, escalation, sweep_findings
- health_proxy.py: /ai/health proxies agent service detailed health
- approval.py: /ai/chat dispatch, /ai/approval/pending, /ai/approval/respond

Security:
- group_ai_user (chat) + group_ai_manager (configure, approve, logs)
- ir.model.access.csv for all 4 models

Views: list/form for bot, directives, logs, registry; main menu with AI brain icon

OWL2 frontend:
- systray_button.js: brain icon in top bar, status dot, pending approval badge
- ai_panel.js: slide-in chat panel, approval workflow, 30s poll for pending items
- CSS: slide-in animation, message bubbles, loading dots, approval section

Data: 4 cron jobs (ping, registry sync, directive/log cleanup)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ActiveBlue Build
2026-04-12 17:59:02 -04:00
parent 430ab966b2
commit 29409ed71d
24 changed files with 1394 additions and 0 deletions

View File

@@ -0,0 +1,255 @@
/* ActiveBlue AI — systray + panel styles */
/* Systray brain icon */
.ab-ai-systray {
display: flex;
align-items: center;
cursor: pointer;
padding: 0 8px;
position: relative;
}
.ab-ai-brain-icon {
font-size: 18px;
transition: color 0.3s ease;
}
.ab-ai-badge {
position: absolute;
top: 4px;
right: 4px;
background: #dc3545;
color: #fff;
border-radius: 50%;
font-size: 10px;
min-width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
/* Slide-in panel */
.ab-ai-panel {
position: fixed;
top: 0;
right: -420px;
width: 400px;
height: 100vh;
background: #fff;
box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
display: flex;
flex-direction: column;
z-index: 9000;
transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border-left: 1px solid #dee2e6;
}
.ab-ai-panel--open {
right: 0;
}
.ab-ai-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
background: #1a2b4b;
color: #fff;
flex-shrink: 0;
}
.ab-ai-panel__title {
font-weight: 600;
font-size: 15px;
letter-spacing: 0.02em;
}
.ab-ai-panel__header-actions {
display: flex;
align-items: center;
gap: 8px;
}
/* Status indicator dot */
.ab-ai-status-dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #6c757d;
}
.ab-ai-status-dot--online { background: #28a745; }
.ab-ai-status-dot--offline { background: #dc3545; }
.ab-ai-status-dot--degraded { background: #ffc107; }
/* Messages area */
.ab-ai-panel__messages {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 12px;
}
.ab-ai-panel__empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
opacity: 0.5;
}
/* Message bubbles */
.ab-ai-msg {
display: flex;
flex-direction: column;
max-width: 85%;
}
.ab-ai-msg--user {
align-self: flex-end;
}
.ab-ai-msg--assistant,
.ab-ai-msg--error {
align-self: flex-start;
}
.ab-ai-msg__bubble {
padding: 10px 14px;
border-radius: 12px;
font-size: 14px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-word;
}
.ab-ai-msg--user .ab-ai-msg__bubble {
background: #1a2b4b;
color: #fff;
border-bottom-right-radius: 2px;
}
.ab-ai-msg--assistant .ab-ai-msg__bubble {
background: #f1f3f5;
color: #212529;
border-bottom-left-radius: 2px;
}
.ab-ai-msg--error .ab-ai-msg__bubble {
background: #fff3cd;
color: #856404;
border: 1px solid #ffc107;
}
/* Loading dots */
.ab-ai-msg__bubble--loading {
display: flex;
gap: 4px;
align-items: center;
padding: 12px 16px;
}
.ab-ai-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #adb5bd;
animation: ab-ai-bounce 1.2s infinite ease-in-out;
}
.ab-ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ab-ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ab-ai-bounce {
0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
40% { transform: scale(1.2); opacity: 1; }
}
/* Escalations */
.ab-ai-msg__escalations {
margin-top: 6px;
padding: 8px 12px;
background: #fff3cd;
border-radius: 8px;
font-size: 13px;
}
.ab-ai-escalation {
margin-top: 4px;
padding-left: 12px;
color: #856404;
}
/* Approval section */
.ab-ai-panel__approvals {
background: #fff8e1;
border-top: 1px solid #ffe082;
padding: 12px 16px;
flex-shrink: 0;
font-size: 13px;
}
.ab-ai-approval-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
gap: 8px;
}
.ab-ai-approval-btns {
display: flex;
gap: 6px;
flex-shrink: 0;
}
/* Input area */
.ab-ai-panel__input {
display: flex;
gap: 8px;
padding: 12px 16px;
border-top: 1px solid #dee2e6;
background: #f8f9fa;
flex-shrink: 0;
}
.ab-ai-panel__textarea {
flex: 1;
resize: none;
border: 1px solid #ced4da;
border-radius: 8px;
padding: 8px 12px;
font-size: 14px;
font-family: inherit;
line-height: 1.4;
transition: border-color 0.15s ease;
}
.ab-ai-panel__textarea:focus {
outline: none;
border-color: #1a2b4b;
box-shadow: 0 0 0 2px rgba(26, 43, 75, 0.15);
}
.ab-ai-panel__send {
align-self: flex-end;
border-radius: 8px;
width: 40px;
height: 40px;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
background: #1a2b4b;
border-color: #1a2b4b;
}
.ab-ai-panel__send:hover:not(:disabled) {
background: #243660;
border-color: #243660;
}