Add Competitive Research Agent for Market Intelligence#7
Open
Abblanchette wants to merge 6 commits intocodyde:mainfrom
Open
Add Competitive Research Agent for Market Intelligence#7Abblanchette wants to merge 6 commits intocodyde:mainfrom
Abblanchette wants to merge 6 commits intocodyde:mainfrom
Conversation
Install 11 Sentry agent skills including setup, monitoring, and code review capabilities. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Install @sentry/nextjs and configure Sentry for client, server, and edge runtimes. Add instrumentation hooks and example environment variables. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move deprecated options to webpack config structure to avoid Turbopack warnings. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…stom metrics This commit introduces comprehensive observability throughout the SentryOS application using Sentry's structured logging (Sentry.logger) and custom metrics (Sentry.metrics). Key Features: - Structured logging for tracking key application events and errors - Custom metrics for monitoring performance and user behavior - Console log capture (warn/error levels) in client-side code Instrumentation Coverage: 1. Sentry Configuration - Enabled logging in all configs (client, server, edge) - Added console logging integration to client config - Configured to capture warn/error console logs 2. Chat API Route (/api/chat/route.ts) - Request/response logging with context - Metrics: request count, validation errors, conversation length - Performance tracking: API duration, stream duration, tool usage - Error tracking with detailed context - Tool invocation logging and counting 3. Window Manager (WindowManager.tsx) - Window lifecycle logging (open, close, minimize, maximize, focus) - Metrics: window operations, window size tracking - Provides insights into user window management behavior 4. Chat Component (Chat.tsx) - User message logging with conversation context - Message length tracking for both user and assistant - Response duration and error tracking - Tool execution tracking in UI - Client-side error handling with metrics 5. Desktop Component (Desktop.tsx) - Session start tracking - Desktop icon interaction logging - Active window count monitoring - User engagement metrics Metrics Tracked: - chat.api.request - Total API requests - chat.api.duration - Request processing time - chat.conversation.message_count - Messages per conversation - chat.tool.invoked - Claude tools used - chat.message.sent - User messages sent - chat.response.duration - Response generation time - desktop.window.* - Window management operations - desktop.icon.opened - Desktop icon interactions - desktop.windows.active - Active window count - desktop.session.started - Desktop session tracking All logging uses structured format with relevant context attributes, making it easy to search, filter, and analyze in Sentry. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created API route at /api/competitive-research with specialized system prompt for analyzing Sentry vs competitors (Datadog, New Relic, Rollbar, etc.) - Built React component with quick query suggestions and streaming UI - Registered agent in Agents folder on desktop - Integrated full Sentry observability (structured logging, custom metrics) - Agent supports feature comparisons, pricing analysis, and market research Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Installed recharts library for data visualization - Added ChartRenderer component supporting line and bar charts - Updated markdown renderer to detect chart-line and chart-bar code blocks - Enhanced system prompt with chart generation instructions and examples - Added chart-focused quick queries for easier discovery - Charts use consistent dark theme matching the app design Charts display: - Line charts for trends over time (market share, growth, etc.) - Bar charts for comparisons (pricing, features, metrics) - Automatic parsing of JSON data in code blocks - Responsive design with themed colors Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines
+312
to
+322
| const errorMessage: Message = { | ||
| id: crypto.randomUUID(), | ||
| role: 'assistant', | ||
| content: 'Sorry, I encountered an error. Please check your Claude credentials are configured correctly.', | ||
| timestamp: new Date() | ||
| } | ||
| setMessages(prev => [...prev, errorMessage]) | ||
| } finally { | ||
| setIsLoading(false) | ||
| setCurrentTool(null) | ||
| } |
There was a problem hiding this comment.
Bug: If a stream fails, the empty placeholder message isn't removed, resulting in both an empty message and an error message appearing in the UI.
Severity: MEDIUM
Suggested Fix
Move the logic that removes the placeholder message to a finally block to ensure it always runs, or add logic to the catch block to remove the placeholder before adding the new error message.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/components/desktop/apps/CompetitiveResearch.tsx#L304-L322
Potential issue: When an exception occurs during the streaming of a response, such as
from a network error, the control flow jumps directly to the `catch` block. The cleanup
logic, which is responsible for removing the temporary empty placeholder message, is
located within the `try` block after the streaming loop. This cleanup code is skipped
when an exception is thrown, causing the empty placeholder message to remain in the chat
history. Subsequently, the `catch` block adds an error message, resulting in both an
empty message and an error message being displayed to the user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new AI-powered Competitive Research agent to help analyze Sentry's market position and compare it with competitors.
Key Features
Changes
API Route (
src/app/api/competitive-research/route.ts)React Component (
src/components/desktop/apps/CompetitiveResearch.tsx)Desktop Registration (
src/components/desktop/Desktop.tsx)Test Plan
npm run build)competitive_research.*)🤖 Generated with Claude Code