Hide Agent Builder features when disabled#2314
Conversation
b19deab to
bf14c4e
Compare
...commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/SidebarArea/index.tsx
Outdated
Show resolved
Hide resolved
2ea3e07 to
312ce20
Compare
Conditionally hide Agent Builder UI components and redirect from protected routes when agentBuilder access is disabled for a workspace. Features hidden when agentBuilder is false: - Home link in project sidebar navigation - Integrations section in settings page - Latte AI copilot sidebar - Triggers section in document editor sidebar - SubAgents section in document editor sidebar Tools section behavior when agentBuilder is false: - Shows configured integrations (read-only) - Hides add button - Hides remove option from dropdown menu Routes that redirect to /dashboard when agentBuilder is false: - /projects/[projectId]/versions/[commitUuid]/home - /settings/integrations/new - /settings/integrations/[integrationId]/destroy Implementation uses the productAccess flags from the workspace model, accessed via useProductAccess() hook for client components and computeProductAccess()/getProductAccess() for server components. Also extracts Latte fetching logic into a separate LatteWrapper component for cleaner layout code. Co-authored-by: Cursor <cursoragent@cursor.com>
312ce20 to
2b6bb6a
Compare
| } | ||
|
|
||
| // TODO: Replace with /traces project level when ready | ||
| return url.issues.root |
There was a problem hiding this comment.
When no agent builder if users go to /projects/:id we redirect to
First document or issues
In the future will redirect to traces project level. What do you think?
| @@ -31,7 +31,9 @@ export const workspaces = latitudeSchema.table('workspaces', { | |||
| }), | |||
| stripeCustomerId: varchar('stripe_customer_id', { length: 256 }), | |||
| isBigAccount: boolean('is_big_account').notNull().default(false), | |||
There was a problem hiding this comment.
remove this please, not needed anymore
There was a problem hiding this comment.
Is used in the weekly email. Needed until we fully migrate to CH
| promptManagerEnabled: boolean('prompt_manager_enabled') | ||
| .notNull() | ||
| .default(true), | ||
| agentBuilderEnabled: boolean('agent_builder_enabled').notNull().default(true), |
There was a problem hiding this comment.
I really don't think it makes sense to have this in the data model, we have feature flags
There was a problem hiding this comment.
This is an example why I think these kind of cases where a lot of things are affected is better in custom flags
Also not super important but this way is 0 extra queries. Again not important but these 2 flags are for everyone and are here to stay for a long time.
| initialThreadUuid={lastThreadUuid} | ||
| initialMessages={initialMessages} | ||
| > | ||
| {productAccess.agentBuilder ? ( |
There was a problem hiding this comment.
Only people with promptManagerEnabled will have latte because of this validation: https://github.com/latitude-dev/latitude-llm/blob/main/packages/core/src/services/workspaces/updateProductAccess.ts#L31-L36
It's an impossible combination, a workspace with agentBuilder and not with promptManagerEnabled
There was a problem hiding this comment.
you could have built exactly the same logic but storing the state in feature's data model rather than workspace's, the only advantage i see is to have index-enforced conditions but that is not a good tradeoff to polute the main workspace model imo
|
@claude review please |
|
Claude finished @andresgutgon's task in 1m 44s —— View job PR Review: Hide Agent Builder features when disabledTodo:
SummaryGood approach overall. The implementation is clean and the pattern of propagating Issues1.
|
Summary
agentBuilderaccess is disabled for a workspace/dashboardwhen trying to access Agent Builder routes directlyFeatures Hidden
When
productAccess.agentBuilderisfalse:PROJECT_ROUTESarrayLatteLayoutwrapper conditionally renderedagentBuildercheckagentBuildercheckagentBuildercheckRoutes Protected
Routes that redirect to
/dashboardwhenagentBuilderis disabled:/projects/[projectId]/versions/[commitUuid]/home/settings/integrations/new/settings/integrations/[integrationId]/destroyImplementation Details
getProductAccess()server-side helper atapps/web/src/services/productAccess/useProductAccess()hook fromSessionProvidercomputeProductAccess()orgetProductAccess()Test plan
/homeredirects to/dashboard/settings/integrations/newredirects to/dashboardMade with Cursor