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
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ function getEnterpriseConfig() {
const enterpriseApiKey = process.env.ENTERPRISE_API_SECRET;

if (!enterpriseApiKey) {
throw new Error('Not authorized to access enterprise API');
throw new EnterpriseApiError(
'Task automations require an enterprise license. Please contact sales@trycomp.ai to learn more.',
403,
);
}

return { enterpriseApiUrl, enterpriseApiKey };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { db } from '@db';
import { ArrowLeft, Lock } from 'lucide-react';
import Link from 'next/link';
import { redirect } from 'next/navigation';
import { loadChatHistory } from './actions/task-automation-actions';
import { AutomationLayoutWrapper } from './automation-layout-wrapper';
Expand All @@ -23,6 +25,37 @@ export default async function Page({
redirect('/tasks');
}

// Check if enterprise API is configured
if (!process.env.ENTERPRISE_API_SECRET) {
return (
<div className="flex items-center justify-center min-h-screen bg-background">
<div className="max-w-md w-full mx-auto p-8 text-center space-y-4">
<div className="mx-auto w-12 h-12 rounded-full bg-muted flex items-center justify-center">
<Lock className="w-6 h-6 text-muted-foreground" />
</div>
<h2 className="text-lg font-semibold text-foreground">Enterprise Feature</h2>
<p className="text-sm text-muted-foreground">
Task automations require an enterprise license. Contact{' '}
<a
href="mailto:sales@trycomp.ai"
className="text-primary underline underline-offset-4 hover:text-primary/80"
>
sales@trycomp.ai
</a>{' '}
to learn more about enabling this feature.
</p>
<Link
href={`/${orgId}/tasks/${taskId}`}
className="inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mt-2"
>
<ArrowLeft className="w-4 h-4" />
Back to task
</Link>
</div>
</div>
);
}

const taskName = task.title;

// Load chat history server-side (skip for ephemeral 'new' automations)
Expand Down