Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions apps/sim/app/(auth)/signup/signup-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,6 @@ function SignupFormContent({
}
}

try {
await client.emailOtp.sendVerificationOtp({
email: emailValue,
type: 'sign-in',
})
} catch (otpErr) {
logger.warn('Failed to send sign-in OTP after signup; user can press Resend', otpErr)
}

router.push('/verify?fromSignup=true')
} catch (error) {
logger.error('Signup error:', error)
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/app/(auth)/verify/use-verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function useVerification({

try {
const normalizedEmail = email.trim().toLowerCase()
const response = await client.signIn.emailOtp({
const response = await client.emailOtp.verifyEmail({
email: normalizedEmail,
otp,
})
Expand Down Expand Up @@ -169,7 +169,7 @@ export function useVerification({
client.emailOtp
.sendVerificationOtp({
email: normalizedEmail,
type: 'sign-in',
type: 'email-verification',
})
.then(() => {})
.catch(() => {
Expand Down
10 changes: 3 additions & 7 deletions apps/sim/app/api/logs/stats/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ export async function GET(request: NextRequest) {

const totalMs = Math.max(1, endTime.getTime() - startTime.getTime())
const segmentMs = Math.max(60000, Math.floor(totalMs / params.segmentCount))
const startTimeIso = startTime.toISOString()

const statsQuery = await db
.select({
workflowId: workflowExecutionLogs.workflowId,
workflowName: workflow.name,
segmentIndex:
sql<number>`FLOOR(EXTRACT(EPOCH FROM (${workflowExecutionLogs.startedAt} - ${startTime}::timestamp)) * 1000 / ${segmentMs})`.as(
sql<number>`FLOOR(EXTRACT(EPOCH FROM (${workflowExecutionLogs.startedAt} - ${startTimeIso}::timestamp)) * 1000 / ${segmentMs})`.as(
'segment_index'
),
totalExecutions: sql<number>`COUNT(*)`.as('total_executions'),
Expand All @@ -129,12 +130,7 @@ export async function GET(request: NextRequest) {
)
)
.where(whereCondition)
.groupBy(
workflowExecutionLogs.workflowId,
workflow.name,
sql`FLOOR(EXTRACT(EPOCH FROM (${workflowExecutionLogs.startedAt} - ${startTime}::timestamp)) * 1000 / ${segmentMs})`
)
.orderBy(workflowExecutionLogs.workflowId, sql`segment_index`)
.groupBy(workflowExecutionLogs.workflowId, workflow.name, sql`segment_index`)

const workflowMap = new Map<
string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const updateNotificationSchema = z
levelFilter: levelFilterSchema.optional(),
triggerFilter: triggerFilterSchema.optional(),
includeFinalOutput: z.boolean().optional(),
includeTraceSpans: z.boolean().optional(),
includeRateLimits: z.boolean().optional(),
includeUsageData: z.boolean().optional(),
alertConfig: alertConfigSchema.optional(),
Expand Down Expand Up @@ -146,6 +147,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
levelFilter: subscription.levelFilter,
triggerFilter: subscription.triggerFilter,
includeFinalOutput: subscription.includeFinalOutput,
includeTraceSpans: subscription.includeTraceSpans,
includeRateLimits: subscription.includeRateLimits,
includeUsageData: subscription.includeUsageData,
webhookConfig: subscription.webhookConfig,
Expand Down Expand Up @@ -220,6 +222,7 @@ export async function PUT(request: NextRequest, { params }: RouteParams) {
if (data.triggerFilter !== undefined) updateData.triggerFilter = data.triggerFilter
if (data.includeFinalOutput !== undefined)
updateData.includeFinalOutput = data.includeFinalOutput
if (data.includeTraceSpans !== undefined) updateData.includeTraceSpans = data.includeTraceSpans
if (data.includeRateLimits !== undefined) updateData.includeRateLimits = data.includeRateLimits
if (data.includeUsageData !== undefined) updateData.includeUsageData = data.includeUsageData
if (data.alertConfig !== undefined) updateData.alertConfig = data.alertConfig
Expand Down Expand Up @@ -257,6 +260,7 @@ export async function PUT(request: NextRequest, { params }: RouteParams) {
levelFilter: subscription.levelFilter,
triggerFilter: subscription.triggerFilter,
includeFinalOutput: subscription.includeFinalOutput,
includeTraceSpans: subscription.includeTraceSpans,
includeRateLimits: subscription.includeRateLimits,
includeUsageData: subscription.includeUsageData,
webhookConfig: subscription.webhookConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ function buildTestPayload(subscription: typeof workspaceNotificationSubscription
data.usage = { currentPeriodCost: 2.45, limit: 20, percentUsed: 12.25, isExceeded: false }
}

if (subscription.includeTraceSpans && subscription.notificationType === 'webhook') {
data.traceSpans = [
{
name: 'test-block',
startTime: timestamp,
endTime: timestamp + 150,
duration: 150,
status: 'success',
blockId: 'block_test_1',
blockType: 'agent',
blockName: 'Test Agent',
children: [],
},
]
}

return { payload, timestamp }
}

Expand Down
5 changes: 4 additions & 1 deletion apps/sim/app/api/workspaces/[id]/notifications/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const createNotificationSchema = z
levelFilter: levelFilterSchema.default(['info', 'error']),
triggerFilter: triggerFilterSchema.default([...CORE_TRIGGER_TYPES]),
includeFinalOutput: z.boolean().default(false),
includeTraceSpans: z.boolean().default(false),
includeRateLimits: z.boolean().default(false),
includeUsageData: z.boolean().default(false),
alertConfig: alertConfigSchema.optional(),
Expand Down Expand Up @@ -137,6 +138,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
levelFilter: workspaceNotificationSubscription.levelFilter,
triggerFilter: workspaceNotificationSubscription.triggerFilter,
includeFinalOutput: workspaceNotificationSubscription.includeFinalOutput,
includeTraceSpans: workspaceNotificationSubscription.includeTraceSpans,
includeRateLimits: workspaceNotificationSubscription.includeRateLimits,
includeUsageData: workspaceNotificationSubscription.includeUsageData,
webhookConfig: workspaceNotificationSubscription.webhookConfig,
Expand Down Expand Up @@ -220,7 +222,6 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
}
}

// Encrypt webhook secret if provided
let webhookConfig = data.webhookConfig || null
if (webhookConfig?.secret) {
const { encrypted } = await encryptSecret(webhookConfig.secret)
Expand All @@ -238,6 +239,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
levelFilter: data.levelFilter,
triggerFilter: data.triggerFilter,
includeFinalOutput: data.includeFinalOutput,
includeTraceSpans: data.includeTraceSpans,
includeRateLimits: data.includeRateLimits,
includeUsageData: data.includeUsageData,
alertConfig: data.alertConfig || null,
Expand All @@ -263,6 +265,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
levelFilter: subscription.levelFilter,
triggerFilter: subscription.triggerFilter,
includeFinalOutput: subscription.includeFinalOutput,
includeTraceSpans: subscription.includeTraceSpans,
includeRateLimits: subscription.includeRateLimits,
includeUsageData: subscription.includeUsageData,
webhookConfig: subscription.webhookConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function NotificationSettings({
levelFilter: ['info', 'error'] as LogLevel[],
triggerFilter: [...CORE_TRIGGER_TYPES] as CoreTriggerType[],
includeFinalOutput: false,
includeTraceSpans: false,
includeRateLimits: false,
includeUsageData: false,
webhookUrl: '',
Expand Down Expand Up @@ -202,6 +203,7 @@ export function NotificationSettings({
levelFilter: ['info', 'error'],
triggerFilter: [...CORE_TRIGGER_TYPES],
includeFinalOutput: false,
includeTraceSpans: false,
includeRateLimits: false,
includeUsageData: false,
webhookUrl: '',
Expand Down Expand Up @@ -420,6 +422,8 @@ export function NotificationSettings({
levelFilter: formData.levelFilter,
triggerFilter: formData.triggerFilter,
includeFinalOutput: formData.includeFinalOutput,
// Trace spans only available for webhooks (too large for email/Slack)
includeTraceSpans: activeTab === 'webhook' ? formData.includeTraceSpans : false,
includeRateLimits: formData.includeRateLimits,
includeUsageData: formData.includeUsageData,
alertConfig,
Expand Down Expand Up @@ -471,6 +475,7 @@ export function NotificationSettings({
levelFilter: subscription.levelFilter as LogLevel[],
triggerFilter: subscription.triggerFilter as CoreTriggerType[],
includeFinalOutput: subscription.includeFinalOutput,
includeTraceSpans: subscription.includeTraceSpans,
includeRateLimits: subscription.includeRateLimits,
includeUsageData: subscription.includeUsageData,
webhookUrl: subscription.webhookConfig?.url || '',
Expand Down Expand Up @@ -826,13 +831,18 @@ export function NotificationSettings({
<Combobox
options={[
{ label: 'Final Output', value: 'includeFinalOutput' },
// Trace spans only available for webhooks (too large for email/Slack)
...(activeTab === 'webhook'
? [{ label: 'Trace Spans', value: 'includeTraceSpans' }]
: []),
{ label: 'Rate Limits', value: 'includeRateLimits' },
{ label: 'Usage Data', value: 'includeUsageData' },
]}
multiSelect
multiSelectValues={
[
formData.includeFinalOutput && 'includeFinalOutput',
formData.includeTraceSpans && activeTab === 'webhook' && 'includeTraceSpans',
formData.includeRateLimits && 'includeRateLimits',
formData.includeUsageData && 'includeUsageData',
].filter(Boolean) as string[]
Expand All @@ -841,6 +851,7 @@ export function NotificationSettings({
setFormData({
...formData,
includeFinalOutput: values.includes('includeFinalOutput'),
includeTraceSpans: values.includes('includeTraceSpans'),
includeRateLimits: values.includes('includeRateLimits'),
includeUsageData: values.includes('includeUsageData'),
})
Expand All @@ -849,11 +860,13 @@ export function NotificationSettings({
overlayContent={(() => {
const labels: Record<string, string> = {
includeFinalOutput: 'Final Output',
includeTraceSpans: 'Trace Spans',
includeRateLimits: 'Rate Limits',
includeUsageData: 'Usage Data',
}
const selected = [
formData.includeFinalOutput && 'includeFinalOutput',
formData.includeTraceSpans && activeTab === 'webhook' && 'includeTraceSpans',
formData.includeRateLimits && 'includeRateLimits',
formData.includeUsageData && 'includeUsageData',
].filter(Boolean) as string[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ function isDefaultDescription(desc: string | null | undefined, workflowName: str
if (!desc) return true
const normalized = desc.toLowerCase().trim()
return (
normalized === '' || normalized === 'new workflow' || normalized === workflowName.toLowerCase()
normalized === '' ||
normalized === 'new workflow' ||
normalized === 'your first workflow - start building here!' ||
normalized === workflowName.toLowerCase()
)
}

Expand Down Expand Up @@ -685,9 +688,31 @@ console.log(data);`
{/* Endpoint URL (shown when agent exists) */}
{existingAgent && endpoint && (
<div>
<Label className='mb-[6.5px] block pl-[2px] font-medium text-[13px] text-[var(--text-primary)]'>
URL
</Label>
<div className='mb-[6.5px] flex items-center justify-between'>
<Label className='block pl-[2px] font-medium text-[13px] text-[var(--text-primary)]'>
URL
</Label>
<Tooltip.Root>
<Tooltip.Trigger asChild>
<Button
type='button'
variant='ghost'
onClick={() => {
navigator.clipboard.writeText(endpoint)
setUrlCopied(true)
setTimeout(() => setUrlCopied(false), 2000)
}}
aria-label='Copy URL'
className='!p-1.5 -my-1.5'
>
{urlCopied ? <Check className='h-3 w-3' /> : <Clipboard className='h-3 w-3' />}
</Button>
</Tooltip.Trigger>
<Tooltip.Content>
<span>{urlCopied ? 'Copied' : 'Copy'}</span>
</Tooltip.Content>
</Tooltip.Root>
</div>
<div className='relative flex items-stretch overflow-hidden rounded-[4px] border border-[var(--border-1)]'>
<div className='flex items-center whitespace-nowrap bg-[var(--surface-5)] pr-[6px] pl-[8px] font-medium text-[var(--text-secondary)] text-sm dark:bg-[var(--surface-5)]'>
{baseUrl.replace(/^https?:\/\//, '')}/api/a2a/serve/
Expand All @@ -696,30 +721,8 @@ console.log(data);`
<Input
value={existingAgent.id}
readOnly
className='rounded-none border-0 pr-[32px] pl-0 text-[var(--text-tertiary)] shadow-none'
className='rounded-none border-0 pl-0 text-[var(--text-tertiary)] shadow-none'
/>
<Tooltip.Root>
<Tooltip.Trigger asChild>
<button
type='button'
onClick={() => {
navigator.clipboard.writeText(endpoint)
setUrlCopied(true)
setTimeout(() => setUrlCopied(false), 2000)
}}
className='-translate-y-1/2 absolute top-1/2 right-2'
>
{urlCopied ? (
<Check className='h-3 w-3 text-[var(--brand-tertiary-2)]' />
) : (
<Clipboard className='h-3 w-3 text-[var(--text-tertiary)]' />
)}
</button>
</Tooltip.Trigger>
<Tooltip.Content>
<span>{urlCopied ? 'Copied' : 'Copy'}</span>
</Tooltip.Content>
</Tooltip.Root>
</div>
</div>
<p className='mt-[6.5px] text-[11px] text-[var(--text-secondary)]'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export function ChatDeploy({
>
Cancel
</Button>
<Button variant='destructive' onClick={handleDelete} disabled={isDeleting}>
<Button variant='default' onClick={handleDelete} disabled={isDeleting}>
{isDeleting ? 'Deleting...' : 'Delete'}
</Button>
</ModalFooter>
Expand Down Expand Up @@ -532,7 +532,8 @@ function IdentifierInput({
</div>
) : (
isValid &&
value && (
value &&
value !== originalIdentifier && (
<Tooltip.Root>
<Tooltip.Trigger asChild>
<div className='-translate-y-1/2 absolute top-1/2 right-2'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ export function McpDeploy({

const [toolName, setToolName] = useState(() => sanitizeToolName(workflowName))
const [toolDescription, setToolDescription] = useState(() => {
const normalizedDesc = workflowDescription?.toLowerCase().trim()
const isDefaultDescription =
!workflowDescription ||
workflowDescription === workflowName ||
workflowDescription.toLowerCase() === 'new workflow'
normalizedDesc === 'new workflow' ||
normalizedDesc === 'your first workflow - start building here!'

return isDefaultDescription ? '' : workflowDescription
})
Expand Down Expand Up @@ -193,10 +195,12 @@ export function McpDeploy({
setToolName(toolInfo.tool.toolName)

const loadedDescription = toolInfo.tool.toolDescription || ''
const normalizedLoadedDesc = loadedDescription.toLowerCase().trim()
const isDefaultDescription =
!loadedDescription ||
loadedDescription === workflowName ||
loadedDescription.toLowerCase() === 'new workflow'
normalizedLoadedDesc === 'new workflow' ||
normalizedLoadedDesc === 'your first workflow - start building here!'
setToolDescription(isDefaultDescription ? '' : loadedDescription)

const schema = toolInfo.tool.parameterSchema as Record<string, unknown> | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ export function DeployModal({
)}
</ModalTabsContent> */}

<ModalTabsContent value='mcp'>
<ModalTabsContent value='mcp' className='h-full'>
{workflowId && (
<McpDeploy
workflowId={workflowId}
Expand Down Expand Up @@ -800,7 +800,7 @@ export function DeployModal({
{chatExists && (
<Button
type='button'
variant='destructive'
variant='default'
onClick={handleChatDelete}
disabled={chatSubmitting}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export function ApiKeys({ onOpenChange, registerCloseHandler }: ApiKeysProps) {
Cancel
</Button>
<Button
variant='ghost'
variant='destructive'
onClick={handleDeleteKey}
disabled={deleteApiKeyMutation.isPending}
>
Expand Down
Loading