Conversation
|
Too many files changed for review. ( |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Redesigns the docs UI with a two-row desktop navbar (tabs for Docs/API Reference/Mothership), new ambient Adds reusable Adds internal contributor/AI assistant guidance via new Written by Cursor Bugbot for commit 7ad813b. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Non-copilot sources misattributed to copilot billing counters
- Added conditional check to only increment copilot-specific counters (totalCopilotCost, currentPeriodCopilotCost, totalCopilotCalls, totalCopilotTokens) when source is 'copilot' or 'mcp_copilot', preventing workspace-chat and mothership_block costs from being misattributed.
- ✅ Fixed: Duplicated
hexToRgbautility across landing components- Extracted the hexToRgba function to a shared utility at lib/core/utils/color.ts and updated both features.tsx and templates.tsx to import from the shared location.
Or push these changes by commenting:
@cursor push a1b4fb2499
Preview (a1b4fb2499)
diff --git a/apps/sim/app/(home)/components/features/features.tsx b/apps/sim/app/(home)/components/features/features.tsx
--- a/apps/sim/app/(home)/components/features/features.tsx
+++ b/apps/sim/app/(home)/components/features/features.tsx
@@ -3,14 +3,8 @@
import { useState } from 'react'
import Image from 'next/image'
import { Badge } from '@/components/emcn'
+import { hexToRgba } from '@/lib/core/utils/color'
-function hexToRgba(hex: string, alpha: number): string {
- const r = Number.parseInt(hex.slice(1, 3), 16)
- const g = Number.parseInt(hex.slice(3, 5), 16)
- const b = Number.parseInt(hex.slice(5, 7), 16)
- return `rgba(${r},${g},${b},${alpha})`
-}
-
const FEATURE_TABS = [
{
label: 'Integrations',
diff --git a/apps/sim/app/(home)/components/templates/templates.tsx b/apps/sim/app/(home)/components/templates/templates.tsx
--- a/apps/sim/app/(home)/components/templates/templates.tsx
+++ b/apps/sim/app/(home)/components/templates/templates.tsx
@@ -6,6 +6,7 @@
import Link from 'next/link'
import { Badge, ChevronDown } from '@/components/emcn'
import { cn } from '@/lib/core/utils/cn'
+import { hexToRgba } from '@/lib/core/utils/color'
import { TEMPLATE_WORKFLOWS } from '@/app/(home)/components/templates/template-workflows'
const LandingPreviewWorkflow = dynamic(
@@ -19,13 +20,6 @@
}
)
-function hexToRgba(hex: string, alpha: number): string {
- const r = Number.parseInt(hex.slice(1, 3), 16)
- const g = Number.parseInt(hex.slice(3, 5), 16)
- const b = Number.parseInt(hex.slice(5, 7), 16)
- return `rgba(${r},${g},${b},${alpha})`
-}
-
const LEFT_WALL_CLIP = 'polygon(0 8px, 100% 0, 100% 100%, 0 100%)'
const BOTTOM_WALL_CLIP = 'polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%)'
diff --git a/apps/sim/app/api/billing/update-cost/route.ts b/apps/sim/app/api/billing/update-cost/route.ts
--- a/apps/sim/app/api/billing/update-cost/route.ts
+++ b/apps/sim/app/api/billing/update-cost/route.ts
@@ -78,6 +78,7 @@
}
const { userId, cost, model, inputTokens, outputTokens, source } = validation.data
+ const isCopilot = source === 'copilot' || source === 'mcp_copilot'
const isMcp = source === 'mcp_copilot'
logger.info(`[${requestId}] Processing cost update`, {
@@ -105,13 +106,16 @@
const updateFields: Record<string, unknown> = {
totalCost: sql`total_cost + ${cost}`,
currentPeriodCost: sql`current_period_cost + ${cost}`,
- totalCopilotCost: sql`total_copilot_cost + ${cost}`,
- currentPeriodCopilotCost: sql`current_period_copilot_cost + ${cost}`,
- totalCopilotCalls: sql`total_copilot_calls + 1`,
- totalCopilotTokens: sql`total_copilot_tokens + ${totalTokens}`,
lastActive: new Date(),
}
+ if (isCopilot) {
+ updateFields.totalCopilotCost = sql`total_copilot_cost + ${cost}`
+ updateFields.currentPeriodCopilotCost = sql`current_period_copilot_cost + ${cost}`
+ updateFields.totalCopilotCalls = sql`total_copilot_calls + 1`
+ updateFields.totalCopilotTokens = sql`total_copilot_tokens + ${totalTokens}`
+ }
+
if (isMcp) {
updateFields.totalMcpCopilotCost = sql`total_mcp_copilot_cost + ${cost}`
updateFields.currentPeriodMcpCopilotCost = sql`current_period_mcp_copilot_cost + ${cost}`
diff --git a/apps/sim/lib/core/utils/color.ts b/apps/sim/lib/core/utils/color.ts
new file mode 100644
--- /dev/null
+++ b/apps/sim/lib/core/utils/color.ts
@@ -1,0 +1,12 @@
+/**
+ * Converts a hex color string to an rgba string with the specified alpha.
+ * @param hex - Hex color string (e.g., '#FF0000')
+ * @param alpha - Alpha value between 0 and 1
+ * @returns An rgba color string (e.g., 'rgba(255,0,0,0.5)')
+ */
+export function hexToRgba(hex: string, alpha: number): string {
+ const r = Number.parseInt(hex.slice(1, 3), 16)
+ const g = Number.parseInt(hex.slice(3, 5), 16)
+ const b = Number.parseInt(hex.slice(5, 7), 16)
+ return `rgba(${r},${g},${b},${alpha})`
+}| const g = Number.parseInt(hex.slice(3, 5), 16) | ||
| const b = Number.parseInt(hex.slice(5, 7), 16) | ||
| return `rgba(${r},${g},${b},${alpha})` | ||
| } |
There was a problem hiding this comment.
Duplicated hexToRgba utility across landing components
Low Severity
The hexToRgba function is identically defined in both features.tsx and templates.tsx. This duplicated logic increases maintenance burden — a bug fix in one copy could easily be missed in the other. It could be extracted to a shared utility.
Additional Locations (1)
#3439) * fix(sidebar): use client-generated UUIDs for stable optimistic updates * fix(folders): use zod schema validation for folder create API Replace inline UUID regex with zod schema validation for consistency with other API routes. Update test expectations accordingly. * fix(sidebar): add client UUID to single workflow duplicate hook The useDuplicateWorkflow hook was missing newId: crypto.randomUUID(), causing the same temp-ID-swap issue for single workflow duplication from the context menu. * fix(folders): avoid unnecessary Set re-creation in replaceOptimisticEntry Only create new expandedFolders/selectedFolders Sets when tempId differs from data.id. In the common happy path (client-generated UUIDs), this avoids unnecessary Zustand state reference changes and re-renders.
#3440) * improvement(knowledge): make connector-synced document chunks readonly * fix(knowledge): enforce connector chunk readonly on server side * fix(knowledge): disable toggle and delete actions for connector-synced chunks
…, ServiceNow, Google Sheets, Microsoft Teams, Discord, Google Calendar, Reddit Each connector syncs documents into knowledge bases with configurable filtering: - Zendesk: Help Center articles + support tickets with status/locale filters - Intercom: Articles + conversations with state filtering - ServiceNow: KB articles + incidents with state/priority/category filters - Google Sheets: Spreadsheet tabs as LLM-friendly row-by-row documents - Microsoft Teams: Channel messages (Slack-like pattern) via Graph API - Discord: Channel messages with bot token auth - Google Calendar: Events with date range presets and attendee metadata - Reddit: Subreddit posts with top comments, sort/time filters All connectors validated against official API docs with bug fixes applied. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…st for chat display The AgentMail attachment endpoint returns JSON metadata with a download_url, not raw binary. We were base64-encoding the JSON text and sending it to the LLM, causing provider rejection. Now we parse the metadata, fetch the actual file from the presigned URL, upload it to copilot storage, and persist it on the chat message so images render inline with previews. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add handle dragging tab to input chat * Add back delete tools * Handle deletions properly with resources view * Fix lint * Add permisssions checking * Skip resource_added event when resource is deleted * Pass workflow id as context --------- Co-authored-by: Theodore Li <theo@sim.ai>
Replace the centered "No documents yet" text with the standard Resource table empty state (column headers + create row), matching all other resource pages. Move "Upload documents" from header action to table create row as "New documents". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gger filters (#3571) * fix(notifications): polish modal styling, credential display, and trigger filters - Show credential display name instead of raw account ID in Slack account selector - Fix label styling to use default Label component (text-primary) for consistency - Fix modal body spacing with proper top padding after tab bar - Replace list-card skeleton with form-field skeleton matching actual layout - Replace custom "Select a Slack account first" box with disabled Combobox (dependsOn pattern) - Use proper Label component in WorkflowSelector with consistent gap spacing - Add overflow badge pattern (slice + +N) to level and trigger filter badges - Use dynamic trigger options from getTriggerOptions() instead of hardcoded CORE_TRIGGER_TYPES - Relax API validation to accept integration trigger types (z.string instead of z.enum) - Deduplicate account rows from credential leftJoin in accounts API - Extract getTriggerOptions() to module-level constants to avoid per-render calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(notifications): address PR review feedback - Restore accountId in displayName fallback chain (credentialDisplayName || accountId || providerId) - Add .default([]) to triggerFilter in create schema to preserve backward compatibility - Treat empty triggerFilter as "match all" in notification matching logic - Remove unreachable overflow badge for levelFilter (only 2 possible values) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…icon with Send Add 24px top margin to the "Allow personal Sim keys" toggle so it doesn't sit right below the empty state. Replace the Mail envelope icon for Sim Mailer with a new Send (paper plane) icon matching the emcn icon style. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add restore endpoints and ui * Derive toast from notification * Auth user if workspaceid not found * Fix recently deleted ui * Add restore error toast * Fix deleted at timestamp mismatch --------- Co-authored-by: Theodore Li <theo@sim.ai>
…into feat/mothership-copilot
- Send SVGs as document/text-xml to Claude instead of unsupported image/svg+xml, so the mothership can actually read SVG content - Serve SVGs inline with proper content type and CSP sandbox so chat previews render correctly - Add SVG preview support in file viewer (sandboxed iframe) - Derive IMAGE_MIME_TYPES from MIME_TYPE_MAPPING to reduce duplication - Add missing webp to contentTypeMap, SAFE_INLINE_TYPES, binaryExtensions - Consolidate PREVIEWABLE_EXTENSIONS into preview-panel exports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…icker The image/* accept attribute allowed users to select BMP, TIFF, HEIC, and other image types that are rejected server-side. Replace with the exact set of supported image MIME types and extensions to match the copilot upload validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>



Summary
MOTHERSHIP
Type of Change
Testing
Manual
Checklist