Skip to content

feat: agent YAML parsing, engine API fixes & AIOX cockpit enhancements#5

Open
rafaelscosta wants to merge 68 commits intomainfrom
feat/glass-ui-design-system-v2
Open

feat: agent YAML parsing, engine API fixes & AIOX cockpit enhancements#5
rafaelscosta wants to merge 68 commits intomainfrom
feat/glass-ui-design-system-v2

Conversation

@rafaelscosta
Copy link
Copy Markdown
Collaborator

@rafaelscosta rafaelscosta commented Mar 10, 2026

Summary

  • Agent Profile Modal: Parse rich agent data (persona, commands, principles, voiceDNA, anti-patterns, integration) from engine YAML content field — modal tabs now show real data instead of empty states
  • Engine API Integration: Fix response unwrapping in getRegistryAgent, add React Query cache invalidation via engineStatus in useSquads/useAgents, route CommandsModal and AgentCommandsPanel to engine endpoints
  • Vault Icons: Replace all emoji strings with Lucide icons using getIconComponent() across VaultOverview and WorkspaceDetail
  • Chat UX: Add "Engine offline" informative message in EmptyChat when squads list is empty
  • AIOX Cockpit Theme: New cockpit components (Accordion, Card, Checkbox, Input, Modal, Progress, Select, Skeleton, Slider, Stepper, Table, Tabs, Toast, Toggle), Geist font, HUD patterns, animations, Gold theme variant

Test plan

  • TypeScript compiles without errors (npx tsc --noEmit)
  • All unit tests pass (npx vitest run)
  • Open agent profile modal — verify persona, commands, and principles tabs show data
  • Open CommandsModal in chat — verify tasks and workflows load from engine
  • Navigate to Vault — verify icons render as Lucide components (no raw text)
  • Test with engine offline — verify "Engine offline" message in chat
  • Test with engine online — verify squads/agents load and React Query refetches

🤖 Generated with Claude Code

rafaelscosta and others added 30 commits March 10, 2026 20:27
5 integrations (Engine, WhatsApp, Supabase, API Keys, Voice) with
live health checks, status cards, and setup modals for each service.
New /integrations view with sidebar navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… registry, secrets vault

- 22 unit tests for integrationStore, useIntegrationStatus, IntegrationCard
- Auto-redirect to /integrations on first run when nothing is connected
- Sidebar status dot (red/yellow/green) on Integrations icon
- WhatsApp Send Test button for end-to-end webhook validation
- Engine-side integration CRUD routes (/integrations)
- Encrypted secrets vault (AES-256-GCM) with /integrations/secrets API
- SQLite migration 005_integrations for integrations + secrets tables
- SPA engineApi methods for integrations and secrets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 3 new integration cards with health checks and setup modals
- Telegram: bot token config, webhook setup, status check
- Google Drive: OAuth Client ID config, auth status indicator
- Google Calendar: shared OAuth config, Calendar API scope guidance
- Updated store, hook, hub, and tests for 8 total integrations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Item 1 — Google OAuth PKCE flow:
- Engine /auth/google/* routes (url, callback, refresh, disconnect, status)
- SPA GoogleOAuthCallback component handles redirect
- Google Drive/Calendar modals with "Connect with Google" button
- Tokens stored in engine secrets vault (AES-256-GCM)
- Disconnect button revokes tokens and clears vault

Item 2 — Telegram engine routes:
- /telegram/status — bot info + webhook status from Telegram API
- /telegram/webhook — receive updates with secret token verification
- /telegram/webhook/setup — set webhook URL via Bot API
- /telegram/send — send messages to any chat_id
- /telegram/test — verify bot is active
- /telegram/events — SSE stream with 100-event buffer

Item 3 — SPA ↔ Engine sync:
- integration-sync.ts — helper library for engine-first operations
- syncStatusToEngine() — push status to engine DB (best-effort)
- storeSecret/getSecretValue — engine vault with localStorage fallback
- startGoogleOAuth/completeGoogleOAuth — full OAuth redirect flow
- Health checks query engine /auth/google/status first, fallback local
- URL sync for /integrations and /auth/google/callback paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All API route files used path.resolve(cwd, '..', '..') which resolved
to /Downloads/ where Turbopack encountered an invalid symlink
(cpl2/venv/bin/python). Fixed to use single parent (..) which correctly
resolves to the apps/ project root. Also added outputFileTracingRoot
to next.config.ts as safety net.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-Experiment #1 — console.log cleanup (metric: lower_is_better)
- Baseline: 41 console.log statements
- After: 17 (legitimate lifecycle/connection logs kept)
- Delta: -24 (-58.5%)

Removed: debug traces in use-chat, use-execute, page.tsx,
StoryDetailModal, workflows API SSE handlers
Converted: retry logs → console.warn, failure logs → console.error,
dev-only API log → console.debug

Build: PASS | Tests: 65/65 PASS

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ional

Auto-Experiment #2: Replace unsafe :any with proper TypeScript types.
- AgentList: AgentSummary for all agent references
- AgentProfileModal: custom AgentProfile interface extending PlatformAgent
- ChatContainer: AgentWithUI, Message, ChatSession, AgentCommand types
- MarkdownRenderer: MdChildren type, explicit component prop types
- ActivityPanel: AgentWithUI, CommandCategory interface (3 intentional :any kept for heterogeneous callbacks)
- CategoryManager: explicit squad types, filter type guards
- use-execute: Record<string, unknown> casts replacing (as any)
- use-workflows: proper unknown→cast pattern for SSE data

Build passes, 65/65 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-Experiment #3: Bundle size optimization via code splitting.

Lazy loading (React.lazy + Suspense):
- page.tsx: 11 view panels lazy-loaded (only active view loads)
- AppLayout: AgentExplorer, GlobalSearch, KeyboardShortcuts lazy-loaded
  (modal/overlay components only load when opened)

Barrel export cleanup (export * → named exports):
- stories, kanban, terminals, terminal, roadmap, qa, github,
  context, insights, settings, agents, workflow index.ts files
- Enables better tree-shaking by making imports explicit

Build passes, 65/65 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-Experiment #4: Test coverage expansion.

New test files:
- utils.test.ts (25 tests): cn, formatRelativeTime, generateId, truncate, capitalizeFirst
- domain-taxonomy.test.ts (17 tests): resolveSquadDomain priority chain,
  getDomainColor/Bg/Border/Label with fallbacks, DOMAIN_ORDER completeness
- execution-log-store.test.ts (17 tests): startExecution, endExecution
  duration calc, addLog ID incrementing, agent/tool/error logging, clearLogs

Total: 65 → 124 tests (+90.8%)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-Experiment #5: Dead code detection and removal.

Removed:
- useWorkflowSchema hook (never used in any component)
- useWorkflowStats hook (never used in any component)
- Unused WorkflowSchema/WorkflowStats type imports
- shortcutDefinitions array (35 lines, duplicate of KeyboardShortcuts.tsx)
- validationRules object (67 lines, declared but never referenced)
- Unused getSquadType type import in use-execute.ts

De-exported (internal-only usage):
- queryKeys in use-optimistic.ts (used internally, never imported)

Total: ~130 lines of dead code removed.
Build passes, 124/124 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-Experiment #6: Accessibility audit fixes.

aria-labels added:
- Header: search button, notification bell (dynamic count), dismiss button,
  agent explorer, workflow toggle, activity panel toggle
- All toggle buttons now have aria-expanded
- Notification badge marked aria-hidden (count in button label)
- Notification dropdown: role="menu" + aria-label

Keyboard support added:
- AgentCard: role="button", tabIndex, onKeyDown (Enter/Space), focus ring
- SquadCard: role="button", tabIndex, onKeyDown (Enter/Space), focus ring

Form labels:
- GlobalSearch input: aria-label added

FAB components:
- FAB: aria-label from label/icon prop, icons marked aria-hidden
- FABIcon: aria-label from tooltip/icon prop
- HelpFAB: aria-label="Ajuda"

Build passes, 124/124 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…scriptions

Auto-Experiment #7: React.memo / useMemo audit.

MessageBubble.tsx:
- Extract animation objects to module-level constants (stable references)
- Extract MARKDOWN_PATTERN regex to module-level constant
- Memoize MessageAttachments with React.memo
- Add useMemo for image/file filtering in MessageAttachments

ConversationHistory.tsx:
- Convert destructured store to selective Zustand subscriptions
  (prevents re-renders on isStreaming/isLoading/error changes)
- Wrap filteredSessions, sortedSessions, grouped in useMemo
  (eliminates O(n*m) filter+sort+group on every render)
- Wrap handleSelect, handleNewConversation, handleClearAll in useCallback

Build passes, 124/124 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create Next.js error.tsx for route-level error handling
- Wrap ViewContent with ErrorBoundary + resetKeys=[activeView]
- View crashes are isolated; switching views auto-resets error state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CI: add lint, typecheck, test jobs (was only typecheck + build)
- CI: add metrics-gate job that runs after quality checks
- Metrics script: measures :any count, test count, barrel exports, build size
- Metrics baseline: snapshot with current values (3 any, 124 tests, 28 barrels)
- --ci flag blocks regressions, --save creates new baseline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace 3 `any` typed callbacks in CommandCategory interface with
`unknown` + explicit casts. Type safety fully enforced.

:any count: 3 → 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace 28 `export *` in hooks/index.ts and stores/index.ts with
explicit named exports for better tree-shaking.

export * count: 28 → 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 8 components with 3+ destructured store props to individual
selectors. Prevents unnecessary re-renders when unrelated state changes.

Files: AppLayout, Header, Sidebar, MobileNav, ExecutionLogPanel,
ChatContainer, GlobalSearch, use-execute

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- npm audit fix: resolve minimatch ReDoS and rollup path traversal
- npm update: patch-level updates for 17 packages (tailwind, zustand,
  framer-motion, swr, mermaid, etc.)
- 0 vulnerabilities remaining

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- src/lib/env.ts: centralized env access with typed defaults
- .env.example: documents all env vars used by the dashboard
- Client vars validated at import, server vars via getServerEnv()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add apiFetcher to api client — SWR-compatible wrapper with retry,
timeout, and error classification. Replace 4 raw fetch() fetchers
in use-agents, use-stories, use-squads, use-aios-status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Install @next/bundle-analyzer, enable with ANALYZE=true
- Add scripts: analyze, metrics, metrics:save, metrics:ci
- Run `npm run analyze` to visualize chunk sizes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
:any count: 3 → 0
export * barrels: 28 → 0
test count: 124 (stable)
vulnerabilities: 4 → 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Install highlight.js (required by globals.css @import)
- Bundle audit: 5.4MB total chunks, largest 424KB
- mermaid (72MB src) already lazy-loaded
- lucide-react (40MB src) tree-shakes correctly via named imports
- No further optimization needed at this scale

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…enhancements

Major features:
- Vault: enterprise data management with 3-level navigation (overview → workspace → document),
  4 tabs (dados, templates, taxonomias, c-suite), Zustand store with Supabase sync
- Marketplace: browse, listing detail, seller dashboard, submit wizard, review queue, purchases
- Brainstorm: room list, idea canvas, idea cards, organize panel, output preview

Enhancements:
- Integrations: setup wizard, config export/import, QR share, env generator, webhook alerts
- Engine: agent logger, process pool improvements, rate limit tests
- Dashboard: health cards, dependency graph, health sparkline
- Terminals: live terminal card/output, SSE hook
- GitHub/QA/Context/Monitor views refactored and improved
- New hooks: useHealthCheck, useCapabilities, useEngineConnection, useMarketplace, etc.
- Supabase services for brainstorm, marketplace, vault, roadmap
- Multiple store additions and test coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…utes

Includes marketplace-escrow-release edge function, dashboard API,
integrations API routes, and knowledge files overview fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d tests

Includes useDashboardOverview, useMarketplaceAgents hooks, settings Supabase
service, health report tests, and connection profile store tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The comment `squads/*/agents/` prematurely closed the JSDoc block
due to `*/`. Changed to `squads/[name]/agents/`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New test files:
- toast-store.test.ts: timer tracking, auto-dismiss, clearAll cleanup
- theme.test.ts: getSquadTheme, getTierTheme for all squad types
- icons.test.ts: getIconComponent, EMOJI_TO_ICON, ICON_MAP
- env.test.ts: client env defaults, getServerEnv() shape

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevent unbounded growth of execution log store by keeping only the
last 500 entries. Matches monitor-store's MAX_EVENTS pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
:any: 0 | tests: 272 | export*: 0 | vulns: 0 | TS errors: 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update docker-compose, nginx, vite config, and package dependencies.
Add SSL setup and VPS provisioning scripts, deploy env example.
Add Supabase migrations (brainstorm rooms, orchestration tasks, seed)
and remove superseded migration files. Add tech audit plan and
migration documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rafaelscosta rafaelscosta changed the title Auto-experiments: quality, performance, and CI pipeline feat: AIOX Dashboard v2 — engine programs, orchestration, vault & cleanup Mar 12, 2026
…ault emojis

- Parse rich agent data (persona, commands, principles, voiceDNA, anti-patterns,
  integration) from engine YAML content field in getAgent()
- Fix engine response unwrapping in getRegistryAgent (squad→squadId, title→role)
- Add React Query cache invalidation via engineStatus in useSquads/useAgents
- Replace emoji strings with Lucide icons in Vault components (VaultOverview,
  WorkspaceDetail) using getIconComponent()
- Route CommandsModal and AgentCommandsPanel to engine API (tasks/workflows)
  instead of non-existent /api/squads/:id/commands endpoint
- Add "Engine offline" informative message in EmptyChat
- Fix agents-api tests with proper engine URL mock
- AIOX cockpit theme enhancements, new cockpit components, Geist font,
  HUD patterns, animations, and Glass→Cockpit migration groundwork

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rafaelscosta rafaelscosta changed the title feat: AIOX Dashboard v2 — engine programs, orchestration, vault & cleanup feat: agent YAML parsing, engine API fixes & AIOX cockpit enhancements Mar 13, 2026
oalanicolas and others added 25 commits March 13, 2026 14:37
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AIOX Dashboard Premium — AI Orchestration Dashboard with:
- React 19 + Vite 7 + TypeScript
- Cockpit-style dark theme (AIOX Brandbook)
- 37 squad visualization + agent registry
- Real-time orchestration via SSE
- Engine integration (Bun + Claude CLI)
- Supabase persistence
- E2E tests (Playwright) + unit tests (Vitest)
- Storybook component docs
- Docker deployment config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Wave 1]

Install shadcn infrastructure (CVA, Radix Slot) and create 3 core
components (Button, Card, Input) using Tailwind + CSS vars mapped to
AIOX Cockpit tokens. Add ds-preview view for visual comparison with
existing Cockpit components. Zero breaking changes to existing UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mium dashboard merge

Engine rewrite (~850 lines):
- Bun/Hono server on :4002 with SQLite persistence
- Claude CLI integration for AI planning and step execution
- SSE streaming with 15 event types matching shared/api-contract.ts
- Plan approval flow with polling, revision support
- Agent discovery from filesystem (60+ agents)
- Demo mode fallback when Claude CLI unavailable

shadcn/ui Wave 1:
- Button, Card, Input components with CVA variants
- CSS variable bridge mapping AIOX tokens to shadcn vars
- components.json for shadcn CLI compatibility
- DSPreview comparison page

Premium dashboard merge:
- Marketing hub with traffic, content, funnels, creatives modules
- Sales dashboard, traffic dashboard, creative gallery
- Agent tech-sheet detailed view
- Vault SSOT with spaces, sources, document upload
- Enhanced vault store with full CRUD
- Type system expansion (ViewType, VaultTab, DocumentType)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Map --secondary and --accent to --aiox-blue (#0099FF) instead of lime,
matching the existing dashboard palette where blue is the secondary
interactive color. Adjust Button secondary variant to use translucent
blue background with blue text/border.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ovable

Rewrite Button, Card, Input to match standard shadcn/ui patterns from
the lovable dashboard. Fix CSS vars bridge: secondary=surface-alt,
accent=lime glow 10%, ring=lime 40%, radius=0.5rem. Add DEFAULT values
for background/foreground/accent in Tailwind config so bg-background,
text-foreground, border-input resolve correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add /ds-preview path to VIEW_PATHS so the view is accessible via URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Exclude engine/ from frontend tsconfig.app.json build
- Inline vault-store types in src/services/api/vault.ts (break cross-project import)
- Fix PackageBuilder.tsx engine import → use local api/vault types
- Add backwards-compatible variants to CockpitButton (default/danger/outline)
- Add accent prop alias to CockpitCard for backward compat
- Add size prop to CockpitKpiCard (accepted, unused)
- Relax CockpitTable generics (T=any), make header optional, add label alias
- Add children support to CockpitSectionDivider
- Add squad? field to 9 agent type interfaces
- Fix VaultImportDialog missing VaultDocument fields
- Fix TrafficDashboard CockpitTableColumn import
- Fix OrchestrationActivityPanel variable shadowing
- Fix sales-room/seed.ts duplicate property
- Fix useTrafficData missing clicks field
- Add marketing-hub to ViewType union
- Make Celebration trigger optional with celebrating alias

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Register DSPreview lazy component in App.tsx viewMap
- Add loading message for ds-preview view
- Add Design System entry to sidebar EXTRA_ITEMS with Palette icon

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 (Foundation):
- Expanded types with VaultSpace, DataSource, DocumentQuality, 7-tab system
- Supabase migration: vault_spaces, vault_sources, vault_documents_v2,
  vault_sync_jobs, vault_taxonomy, vault_context_packages, vault_activity
- Engine SQLite cache + vault-store CRUD for all entities
- File parsers (PDF, DOCX, XLSX, CSV, MD, TXT) with content hashing
- Frontend API service, Supabase service, mock data with spaces/sources

Phase 2 (Intelligence):
- AI Services: classify, summarize, taxonomy, quality-score, tags via Claude CLI
- Connector system: VaultConnector interface, URL scrape, AI memory parser
- ETL sync runner: discover -> extract -> transform -> load pipeline
- Context Package builder with markdown/JSON/YAML export
- AI Memory Import wizard (Claude, ChatGPT, Gemini, Copilot)
- Sync job SSE streaming for real-time progress
- 37 engine routes total

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copied 16 brandbook images (product mockups, apparel, jackets, agent cards,
squad group) to public/creatives/ and replaced all placehold.co URLs in
the CreativeGallery component.

Images include: bag, bottle, cap, cards, flatlay, mug, bomber, hoodie,
tshirt, LED jacket, neon jacket, tech jacket, agent ARIA/DEX/ORION, squad.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Single-key view navigation shortcuts (H, D, S, etc.) were firing
while typing in the rejection notes textarea inside CockpitModal.

Added two guards:
- Check for SELECT and role="textbox" elements
- Suppress all single-key shortcuts when target is inside a
  dialog, [role="dialog"], or [aria-modal="true"]

Modifier shortcuts (Cmd+K, Cmd+B, etc.) still work everywhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…utes

Marketing Hub:
- Overview with HeroKpiStrip, SecondaryMetrics, MarqueeTicker, SectionNumber
- Traffic module with expanded campaign metrics
- Content module: CarouselBuilder, ContentCalendar, ThumbnailCreator
- Creatives module with updated studio layout
- Funnels module: FunnelBuilder, TemplateGallery
- Analytics: UnifiedDashboard with enhanced visualizations
- Scenarios: BudgetSimulator, GoalCalculator, BreakEvenVisualizer
- Charts system: 9 chart components (Area, Bar, Donut, Funnel, Heatmap,
  Scatter, Sparkline, Waterfall) with AIOX theme + ChartContainer + FilterBar
- Shared: PlatformDistribution, MarketingKpiCard refactor

Dashboard:
- PlatformIntelligencePanel, IntegrationGraphPanel, KnowledgeSearchPanel
- SquadHealthBadge component
- usePlatformIntelligence hook

Engine:
- Content routes (content.ts)
- Platform routes (platform.ts)

Infra:
- Migrate postcss.config.js -> postcss.config.cjs
- New stores: graphStore, maturityStore, qualityGateStore
- Engine API service expansion
- recharts dependency added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Raw JSON from Claude CLI stream-json was dumped as-is into the terminal,
making it unreadable. Now the TerminalOutput component parses each line:

- Detects JSON events (system/init, assistant, tool_use, tool_result,
  error, done, rate_limit, routed messages)
- Extracts readable content from nested message structures
- Renders with colored labels (INIT, AI, TOOL, RESULT, DONE, ERROR)
- Shows formatted timestamps (HH:MM:SS)
- Truncates long content with ellipsis
- Falls back to raw ANSI/heuristic rendering for non-JSON lines

Also updated TerminalCard to reuse TerminalOutput instead of inline
rendering logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lines from Claude CLI stream-json often contain multiple JSON objects
concatenated without separators (e.g. '{"type":"system",...}{"type":"init",...}').

Added splitJsonBlobs() that tracks brace depth to split them into
individual objects before parsing. Each JSON is now rendered as its own
structured row with label, timestamp, and formatted content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tables

The agent content parser only recognized ```yaml fenced blocks (used by
squad agents) but not --- frontmatter (used by core .claude/agents/).

Changes:
- parseAgentContent now tries frontmatter (---...---) first, then fenced
- Added fallback: extract *command patterns from markdown tables when
  no commands: array exists in YAML
- Extract sampleTasks from triggers/activation_triggers YAML arrays

Fixes both "Acoes & Comandos" and "Perfil do Agente" modals showing
empty states for agents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The menu had a scroll loop: onMouseEnter set selectedIndex, which
triggered scrollIntoView, which moved the list under the cursor,
triggering mouseEnter on a new item, repeating infinitely.

Fix: track whether selection came from keyboard or mouse. Only call
scrollIntoView for keyboard-driven selection changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Core agents (aios-qa, aios-dev, etc.) have no squad assignment.
sendMessage was requiring squadId to be non-null, causing messages
to silently disappear with an early return.

Changes:
- Remove squadId from the required fields check
- Fallback squadId to 'core' when passing to executeMutation
- Handle undefined squadId in getSquadType call

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gistry

The frontend expected { agents: [...], count: N } with squadId field,
but the engine returned a raw array with squad field. This caused all
340 agents to appear without squadId, breaking:
- Chat message sending (squadId required)
- Agent profile modal (squadId needed for detail fetch)
- Commands modal (squad-based task/workflow queries)
- Agent search and filtering

All /agents routes now map squad -> squadId and wrap in { agents, count }.
Agent detail routes wrap in { agent: {...} } as frontend expects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaced the 400 placeholder with a real implementation that:
- Loads agent persona from filesystem (loadAgentContent)
- Spawns Claude CLI with agent context + user message
- Streams response via SSE (start, text, done, error events)
- Falls back to demo mode when Claude CLI is unavailable

This is the endpoint the chat UI calls for real-time agent responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Frontend expects:
- start: { executionId, agentId, agentName }
- text: { content: "string" }
- done: { usage: { inputTokens, outputTokens, totalTokens }, duration: N }

Engine was sending:
- start: { agentId, sessionId } (missing executionId/agentName)
- done: { content, durationMs } (wrong shape, caused [object Object] display)

Also: result event no longer re-sends content (already streamed via
assistant events) — prevents duplicated text in the chat bubble.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Added dual persistence layer for chat sessions and messages:

Migration (20260321_chat_sessions.sql):
- chat_sessions: id, agent_id, agent_name, squad_id, title, message_count
- chat_messages: id, session_id, role, content, metadata (JSONB), attachments (JSONB)
- RLS anon full CRUD, indexes on session_id + created_at

Service (supabase/chat.ts):
- upsertSession, listSessions, deleteSession
- addMessage, updateMessage, getMessages, bulkInsertMessages
- Graceful fallback when Supabase unavailable (same pattern as vault.ts)

Store (chatStore.ts):
- All mutations now fire-and-forget sync to Supabase
- _syncFromSupabase() on init: merges remote sessions missing locally
- Seeds Supabase with localStorage sessions on first run
- localStorage remains primary — Supabase is the durable backup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Welcome message "O que posso fazer por voce" now shows agent-specific
suggestions from: commands (YAML/markdown), sampleTasks (triggers),
or hardcoded fallbacks by agent/squad.

Slash command menu (/) now includes dynamic commands:
- Agent *commands extracted from markdown definitions
- Squad tasks from engine registry
- Squad workflows from engine registry
- Plus the existing global system commands (/help, /clear, /export, etc.)

ChatContainer fetches tasks/workflows via useRegistryTasks/useRegistryWorkflows
and builds SlashCommand[] passed through ChatInput -> SlashCommandMenu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude CLI assistant events can return message as either a JSON string
or a direct object. extractTextFromAssistant now handles both:
- string: JSON.parse then extract content[].text
- object: directly extract content[].text or content string
- undefined: return empty string

This fixes [object Object] appearing in chat responses when the CLI
returns message as an object instead of a JSON-encoded string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rafaelscosta rafaelscosta force-pushed the feat/glass-ui-design-system-v2 branch from bd07b98 to 11b88f2 Compare March 14, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants