The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add /agents list and agent page, and remove the agent settings pages (#27254)
Félix Malfaitf84a259b33b3
diff --git a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.tsindex 069448dae92..27c0c9820a6 100644--- a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts+++ b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts@@ -380,6 +380,26 @@ const testCases: {{ loc: AppPath.WorkflowCoreShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.INVITE_TEAM, res: AppPath.InviteTeam },{ loc: AppPath.WorkflowCoreShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.BOOK_CALL, res: AppPath.BookCall },{ loc: AppPath.WorkflowCoreShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.COMPLETED, res: undefined },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PLAN_REQUIRED, res: AppPath.PlanRequired },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: true, onboardingStatus: OnboardingStatus.COMPLETED, res: getSettingsPath(SettingsPath.Billing) },+ { loc: AppPath.AgentIndexPage, isLogged: false, isWorkspaceSuspended: false, onboardingStatus: undefined, res: AppPath.SignInUp },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.WORKSPACE_ACTIVATION, res: AppPath.WorkspaceActivation },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PROFILE_CREATION, res: AppPath.CreateProfile },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.SYNC_EMAIL, res: AppPath.SyncEmails },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.APPS_INSTALLATION, res: AppPath.InstallApps },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.INVITE_TEAM, res: AppPath.InviteTeam },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.BOOK_CALL, res: AppPath.BookCall },+ { loc: AppPath.AgentIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.COMPLETED, res: undefined },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PLAN_REQUIRED, res: AppPath.PlanRequired },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: true, onboardingStatus: OnboardingStatus.COMPLETED, res: getSettingsPath(SettingsPath.Billing) },+ { loc: AppPath.AgentShowPage, isLogged: false, isWorkspaceSuspended: false, onboardingStatus: undefined, res: AppPath.SignInUp },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.WORKSPACE_ACTIVATION, res: AppPath.WorkspaceActivation },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PROFILE_CREATION, res: AppPath.CreateProfile },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.SYNC_EMAIL, res: AppPath.SyncEmails },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.APPS_INSTALLATION, res: AppPath.InstallApps },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.INVITE_TEAM, res: AppPath.InviteTeam },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.BOOK_CALL, res: AppPath.BookCall },+ { loc: AppPath.AgentShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.COMPLETED, res: undefined },{ loc: AppPath.PageLayoutPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PLAN_REQUIRED, res: AppPath.PlanRequired },{ loc: AppPath.PageLayoutPage, isLogged: true, isWorkspaceSuspended: true, onboardingStatus: OnboardingStatus.COMPLETED, res: getSettingsPath(SettingsPath.Billing) },{ loc: AppPath.PageLayoutPage, isLogged: false, isWorkspaceSuspended: false, onboardingStatus: undefined, res: AppPath.SignInUp },diff --git a/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx b/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsxindex 42fd5ee8109..d7f731ad45d 100644--- a/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx+++ b/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx@@ -359,18 +359,6 @@ const SettingsApplicationRegistrationDetails = lazy(() =>),);-const SettingsAgentForm = lazy(() =>- import('~/pages/settings/ai/SettingsAgentForm').then((module) => ({- default: module.SettingsAgentForm,- })),-);--const SettingsAgentTurnDetail = lazy(() =>- import('~/pages/settings/ai/SettingsAgentTurnDetail').then((module) => ({- default: module.SettingsAgentTurnDetail,- })),-);-const SettingsSkillForm = lazy(() =>import('~/pages/settings/ai/SettingsSkillForm').then((module) => ({default: module.SettingsSkillForm,@@ -873,18 +861,6 @@ const createSettingsRouteElements = ({><Route path={SettingsPath.AI} element={<SettingsAI />} /><Route path={SettingsPath.AiPrompts} element={<SettingsAiPrompts />} />- <Route- path={SettingsPath.AiNewAgent}- element={<SettingsAgentForm mode="create" />}- />- <Route- path={SettingsPath.AiAgentDetail}- element={<SettingsAgentForm mode="edit" />}- />- <Route- path={SettingsPath.AiAgentTurnDetail}- element={<SettingsAgentTurnDetail />}- /><Routepath={SettingsPath.AiNewSkill}element={<SettingsSkillForm mode="create" />}diff --git a/packages/twenty-front/src/modules/app/routing/utils/createWorkspaceRouteObjects.tsx b/packages/twenty-front/src/modules/app/routing/utils/createWorkspaceRouteObjects.tsxindex 1891eaad24a..c3b2d2b19ba 100644--- a/packages/twenty-front/src/modules/app/routing/utils/createWorkspaceRouteObjects.tsx+++ b/packages/twenty-front/src/modules/app/routing/utils/createWorkspaceRouteObjects.tsx@@ -11,6 +11,18 @@ import {import { type WorkspaceRouteObject } from '@/app/routing/types/WorkspaceRouteObject';import { RecordIndexSkeletonLoader } from '@/object-record/record-index/components/RecordIndexSkeletonLoader';+const AgentCoreIndexPage = lazy(() =>+ import('~/pages/object-core/AgentCoreIndexPage').then((module) => ({+ default: module.AgentCoreIndexPage,+ })),+);++const AgentCoreShowPage = lazy(() =>+ import('~/pages/object-core/AgentCoreShowPage').then((module) => ({+ default: module.AgentCoreShowPage,+ })),+);+const WorkflowCoreShowPage = lazy(() =>import('~/pages/object-core/WorkflowCoreShowPage').then((module) => ({default: module.WorkflowCoreShowPage,@@ -86,6 +98,22 @@ export const createWorkspaceRouteObjects = ({isLocationExpandableFromSidePanel: true,},},+ {+ path: AppPath.AgentIndexPage,+ element: (+ <LazyRoute fallback={<RecordIndexSkeletonLoader />}>+ <AgentCoreIndexPage />+ </LazyRoute>+ ),+ },+ {+ path: AppPath.AgentShowPage,+ element: (+ <LazyRoute>+ <AgentCoreShowPage />+ </LazyRoute>+ ),+ },{path: AppPath.Index,element: <RecordIndexSkeletonLoader />,diff --git a/packages/twenty-front/src/pages/settings/ai/utils/__tests__/isOwnedByInstalledApplication.test.ts b/packages/twenty-front/src/modules/applications/utils/__tests__/isOwnedByInstalledApplication.test.tssimilarity index 87%rename from packages/twenty-front/src/pages/settings/ai/utils/__tests__/isOwnedByInstalledApplication.test.tsrename to packages/twenty-front/src/modules/applications/utils/__tests__/isOwnedByInstalledApplication.test.tsindex 5003426f207..52a49cf486a 100644--- a/packages/twenty-front/src/pages/settings/ai/utils/__tests__/isOwnedByInstalledApplication.test.ts+++ b/packages/twenty-front/src/modules/applications/utils/__tests__/isOwnedByInstalledApplication.test.ts@@ -1,4 +1,4 @@-import { isOwnedByInstalledApplication } from '~/pages/settings/ai/utils/isOwnedByInstalledApplication';+import { isOwnedByInstalledApplication } from '@/applications/utils/isOwnedByInstalledApplication';describe('isOwnedByInstalledApplication', () => {it('is false without an application', () => {diff --git a/packages/twenty-front/src/pages/settings/ai/utils/isOwnedByInstalledApplication.ts b/packages/twenty-front/src/modules/applications/utils/isOwnedByInstalledApplication.tssimilarity index 100%rename from packages/twenty-front/src/pages/settings/ai/utils/isOwnedByInstalledApplication.tsrename to packages/twenty-front/src/modules/applications/utils/isOwnedByInstalledApplication.tsdiff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDeleteConfirmationModal.tsxsimilarity index 81%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDeleteConfirmationModal.tsxindex 4ee59482307..b6a4fcfee87 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDeleteConfirmationModal.tsx@@ -5,25 +5,25 @@ import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDiimport { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useMutation } from '@apollo/client/react';-import { SettingsPath } from 'twenty-shared/types';+import { AppPath } from 'twenty-shared/types';import { useToast } from 'twenty-ui/components';import { DeleteOneAgentDocument } from '~/generated-metadata/graphql';-import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { useNavigateApp } from '~/hooks/useNavigateApp';const DELETE_AGENT_MODAL_ID = 'delete-agent-modal';-type SettingsAgentDeleteConfirmationModalProps = {+type CoreAgentDeleteConfirmationModalProps = {agentId: string;agentName: string;};-export const SettingsAgentDeleteConfirmationModal = ({+export const CoreAgentDeleteConfirmationModal = ({agentId,agentName,-}: SettingsAgentDeleteConfirmationModalProps) => {+}: CoreAgentDeleteConfirmationModalProps) => {const { t } = useLingui();const { closeDialog } = useDialog();- const navigate = useNavigateSettings();+ const navigate = useNavigateApp();const { enqueueToast } = useToast();const [deleteAgent] = useMutation(DeleteOneAgentDocument);@@ -35,7 +35,7 @@ export const SettingsAgentDeleteConfirmationModal = ({},});closeDialog(DELETE_AGENT_MODAL_ID);- navigate(SettingsPath.AI);+ navigate(AppPath.AgentIndexPage);} catch (error) {enqueueToast(getToastOptionsFromError({ error }));}diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDetailSkeletonLoader.tsxsimilarity index 97%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDetailSkeletonLoader.tsxindex 3cd06096965..aa4e8e07228 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentDetailSkeletonLoader.tsx@@ -30,7 +30,7 @@ const StyledNameContainer = styled.div`flex: 1;`;-export const SettingsAgentDetailSkeletonLoader = () => {+export const CoreAgentDetailSkeletonLoader = () => {const theme = useTheme();return (<SkeletonThemediff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentEvalsTab.tsxsimilarity index 94%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentEvalsTab.tsxindex b0b4a3cc3a4..0c340bb2fff 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentEvalsTab.tsx@@ -28,7 +28,7 @@ import {} from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';-import { SETTINGS_AGENT_DETAIL_TABS } from '~/pages/settings/ai/constants/SettingsAgentDetailTabs';+import { CORE_AGENT_DETAIL_TABS } from '@/object-core/agents/constants/CoreAgentDetailTabs';import { getOperationName } from '~/utils/getOperationName';const DELETE_EVAL_INPUT_MODAL_ID = 'delete-eval-input-modal';@@ -45,7 +45,7 @@ const StyledEmptyMessage = styled.div`color: ${themeCssVariables.font.color.tertiary};`;-type SettingsAgentEvalsTabProps = {+type CoreAgentEvalsTabProps = {agentId: string;evaluationInputs: string[];onEvaluationInputsChange: (inputs: string[]) => void;@@ -57,19 +57,19 @@ type EvalInput = {text: string;};-export const SettingsAgentEvalsTab = ({+export const CoreAgentEvalsTab = ({agentId,evaluationInputs,onEvaluationInputsChange,disabled = false,-}: SettingsAgentEvalsTabProps) => {+}: CoreAgentEvalsTabProps) => {const [newInput, setNewInput] = useState('');const [inputToDelete, setInputToDelete] = useState<string | null>(null);const { openDialog } = useDialog();const { enqueueToast } = useToast();const navigate = useNavigate();- const tabListComponentId = `${SETTINGS_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`;+ const tabListComponentId = `${CORE_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`;const setActiveTabId = useSetAtomComponentState(activeTabIdComponentState,tabListComponentId,@@ -77,7 +77,7 @@ export const SettingsAgentEvalsTab = ({const [runEvaluationInput] = useMutation(RUN_EVALUATION_INPUT, {onCompleted: () => {- const logsTabId = SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.LOGS;+ const logsTabId = CORE_AGENT_DETAIL_TABS.TABS_IDS.LOGS;setActiveTabId(logsTabId);navigate(`#${logsTabId}`);},diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentFormContent.tsxsimilarity index 55%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentFormContent.tsxindex fe74cf40479..14d25709a97 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentFormContent.tsx@@ -1,7 +1,6 @@import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useState } from 'react';-import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components';import {@@ -13,10 +12,10 @@ import {} from 'twenty-ui/icon';import { useTheme, themeCssVariables } from 'twenty-ui/theme';-import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';+import { getCoreAgentBreadcrumbLinks } from '@/object-core/agents/utils/getCoreAgentBreadcrumbLinks';import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState';@@ -25,20 +24,17 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabimport { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';import { type FindOneAgentQuery } from '~/generated-metadata/graphql';-import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { SettingsAgentEvalsTab } from '~/pages/settings/ai/components/SettingsAgentEvalsTab';-import { SettingsAgentLogsTab } from '~/pages/settings/ai/components/SettingsAgentLogsTab';-import { SettingsAgentRoleTab } from '~/pages/settings/ai/components/SettingsAgentRoleTab';-import { SettingsAgentSettingsTab } from '~/pages/settings/ai/components/SettingsAgentSettingsTab';-import { SETTINGS_AGENT_DETAIL_TABS } from '~/pages/settings/ai/constants/SettingsAgentDetailTabs';-import { useSettingsAgentFormState } from '~/pages/settings/ai/hooks/useSettingsAgentFormState';-import { useSettingsAgentSave } from '~/pages/settings/ai/hooks/useSettingsAgentSave';-import { type SettingsAiAgentFormValues } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';-import { getSettingsAgentInitialFormValues } from '~/pages/settings/ai/utils/getSettingsAgentInitialFormValues';-import { getSettingsAiBreadcrumbLinks } from '~/pages/settings/ai/utils/getSettingsAiBreadcrumbLinks';-import { isOwnedByInstalledApplication } from '~/pages/settings/ai/utils/isOwnedByInstalledApplication';+import { CoreAgentEvalsTab } from '@/object-core/agents/components/CoreAgentEvalsTab';+import { CoreAgentLogsTab } from '@/object-core/agents/components/CoreAgentLogsTab';+import { CoreAgentRoleTab } from '@/object-core/agents/components/CoreAgentRoleTab';+import { CoreAgentSettingsTab } from '@/object-core/agents/components/CoreAgentSettingsTab';+import { CORE_AGENT_DETAIL_TABS } from '@/object-core/agents/constants/CoreAgentDetailTabs';+import { useCoreAgentFormState } from '@/object-core/agents/hooks/useCoreAgentFormState';+import { useCoreAgentSave } from '@/object-core/agents/hooks/useCoreAgentSave';+import { type CoreAgentFormValues } from '@/object-core/agents/validation-schemas/coreAgentFormSchema';+import { getCoreAgentInitialFormValues } from '@/object-core/agents/utils/getCoreAgentInitialFormValues';+import { isOwnedByInstalledApplication } from '@/applications/utils/isOwnedByInstalledApplication';import { isDeeplyEqual } from '~/utils/isDeeplyEqual';const StyledContentContainer = styled.div`@@ -49,47 +45,39 @@ const StyledContentContainer = styled.div`width: 100%;`;-type SettingsAgentFormContentProps = {- agent?: FindOneAgentQuery['findOneAgent'];+type CoreAgentFormContentProps = {+ agent: FindOneAgentQuery['findOneAgent'];};-export const SettingsAgentFormContent = ({- agent,-}: SettingsAgentFormContentProps) => {+export const CoreAgentFormContent = ({ agent }: CoreAgentFormContentProps) => {const theme = useTheme();const { getIcon } = useIcons();- const navigate = useNavigateSettings();const currentWorkspace = useAtomStateValue(currentWorkspaceState);- const isCreateMode = !isDefined(agent);const isReadonlyMode = isOwnedByInstalledApplication({- applicationId: agent?.applicationId,+ applicationId: agent.applicationId,workspaceCustomApplicationId:currentWorkspace?.workspaceCustomApplication?.id,});- const agentId = agent?.id ?? '';+ const agentId = agent.id;const [initialFormValues] = useState(() =>- getSettingsAgentInitialFormValues(agent),+ getCoreAgentInitialFormValues(agent),);- const tabListComponentId = `${SETTINGS_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`;+ const tabListComponentId = `${CORE_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`;const activeTabId = useAtomComponentStateValue(activeTabIdComponentState,tabListComponentId,);const { formValues, setFieldValue, validateForm } =- useSettingsAgentFormState(initialFormValues);+ useCoreAgentFormState(initialFormValues);const settingsDraftRole = useAtomFamilyStateValue(settingsDraftRoleFamilyState,formValues.role || '',);- const setSettingsDraftRole = useSetAtomFamilyState(- settingsDraftRoleFamilyState,- formValues.role || '',- );const settingsPersistedRole = useAtomFamilyStateValue(settingsPersistedRoleFamilyState,formValues.role || '',@@ -99,7 +87,7 @@ export const SettingsAgentFormContent = ({isDefined(formValues.role) &&!isDeeplyEqual(settingsDraftRole, settingsPersistedRole);- const { handleSave, isSubmitting, scheduleAutoSave } = useSettingsAgentSave({+ const { scheduleAutoSave } = useCoreAgentSave({agent,formValues,initialFormValues,@@ -109,60 +97,46 @@ export const SettingsAgentFormContent = ({});const handleFieldChange = (- field: keyof SettingsAiAgentFormValues,- value: SettingsAiAgentFormValues[keyof SettingsAiAgentFormValues],+ field: keyof CoreAgentFormValues,+ value: CoreAgentFormValues[keyof CoreAgentFormValues],) => {setFieldValue(field, value);-- if (isDefined(agent)) {- scheduleAutoSave();- }+ scheduleAutoSave();};- const canSave = !isReadonlyMode && validateForm() && !isSubmitting;-const tabs = [{- id: SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.SETTINGS,+ id: CORE_AGENT_DETAIL_TABS.TABS_IDS.SETTINGS,title: t`Settings`,Icon: IconSettings,},{- id: SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.ROLE,+ id: CORE_AGENT_DETAIL_TABS.TABS_IDS.ROLE,title: t`Role`,Icon: IconLock,},{- id: SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.EVALS,+ id: CORE_AGENT_DETAIL_TABS.TABS_IDS.EVALS,title: t`Evals`,Icon: IconListCheck,},{- id: SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.LOGS,+ id: CORE_AGENT_DETAIL_TABS.TABS_IDS.LOGS,title: t`Logs`,Icon: IconTerminal,},];- const handleCancel = () => {- if (isRoleDirty && isDefined(settingsPersistedRole)) {- setSettingsDraftRole(settingsPersistedRole);- }-- navigate(SettingsPath.AI);- };-- const title = isDefined(agent) ? agent.label : t`New Agent`;+ const title = agent.label;const AgentIcon = getIcon(formValues.icon || 'IconLego');- const isRoleTab = activeTabId === SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.ROLE;+ const isRoleTab = activeTabId === CORE_AGENT_DETAIL_TABS.TABS_IDS.ROLE;const isSettingsTab =- activeTabId === SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.SETTINGS;- const isEvalsTab = activeTabId === SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.EVALS;- const isLogsTab = activeTabId === SETTINGS_AGENT_DETAIL_TABS.TABS_IDS.LOGS;+ activeTabId === CORE_AGENT_DETAIL_TABS.TABS_IDS.SETTINGS;+ const isEvalsTab = activeTabId === CORE_AGENT_DETAIL_TABS.TABS_IDS.EVALS;+ const isLogsTab = activeTabId === CORE_AGENT_DETAIL_TABS.TABS_IDS.LOGS;- const isFormDisabled =- isReadonlyMode || (isDefined(agent) ? !agent.isCustom : false);+ const isFormDisabled = isReadonlyMode || !agent.isCustom;const isEvalsDisabled =process.env.NODE_ENV === 'development' ? isReadonlyMode : isFormDisabled;@@ -174,18 +148,7 @@ export const SettingsAgentFormContent = ({icon={<AgentIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />}- actionButton={- isCreateMode ? (- <SaveAndCancelButtons- onSave={handleSave}- onCancel={handleCancel}- isSaveDisabled={!canSave}- isLoading={isSubmitting}- isCancelDisabled={isSubmitting}- />- ) : undefined- }- links={getSettingsAiBreadcrumbLinks(title)}+ links={getCoreAgentBreadcrumbLinks([{ children: title }])}secondaryBar={<SettingsTabBararia-label={t`Agent settings`}@@ -198,7 +161,7 @@ export const SettingsAgentFormContent = ({<Section.Root><StyledContentContainer>{isRoleTab && (- <SettingsAgentRoleTab+ <CoreAgentRoleTabformValues={formValues}onFieldChange={handleFieldChange}disabled={isFormDisabled}@@ -207,7 +170,7 @@ export const SettingsAgentFormContent = ({/>)}{isSettingsTab && (- <SettingsAgentSettingsTab+ <CoreAgentSettingsTabformValues={formValues}onFieldChange={handleFieldChange}disabled={isFormDisabled}@@ -215,7 +178,7 @@ export const SettingsAgentFormContent = ({/>)}{isEvalsTab && (- <SettingsAgentEvalsTab+ <CoreAgentEvalsTabagentId={agentId}evaluationInputs={formValues.evaluationInputs}onEvaluationInputsChange={(inputs) =>@@ -224,7 +187,7 @@ export const SettingsAgentFormContent = ({disabled={isEvalsDisabled}/>)}- {isLogsTab && <SettingsAgentLogsTab agentId={agentId} />}+ {isLogsTab && <CoreAgentLogsTab agentId={agentId} />}</StyledContentContainer></Section.Root></SettingsPageContainer>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentLogsTab.tsxsimilarity index 95%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentLogsTab.tsxindex 158083eb5b3..bd336a02b1c 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentLogsTab.tsx@@ -1,3 +1,4 @@+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';import { AnimatedPlaceholder } from '@/ui/feedback/empty-state/components/AnimatedPlaceholder/AnimatedPlaceholder';import { EmptyState } from '@/ui/feedback/empty-state/components/EmptyState';import { Table } from '@/ui/layout/table/components/Table';@@ -9,8 +10,7 @@ import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useEffect, useState } from 'react';import Skeleton from 'react-loading-skeleton';-import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { isDefined } from 'twenty-shared/utils';import { IconChevronRight } from 'twenty-ui/icon';import { Status } from 'twenty-ui/primitives/data-display';@@ -31,13 +31,11 @@ const StyledTableHeaderRowContainer = styled.div`margin-bottom: ${themeCssVariables.spacing[2]};`;-type SettingsAgentLogsTabProps = {+type CoreAgentLogsTabProps = {agentId: string;};-export const SettingsAgentLogsTab = ({- agentId,-}: SettingsAgentLogsTabProps) => {+export const CoreAgentLogsTab = ({ agentId }: CoreAgentLogsTabProps) => {const { enqueueToast } = useToast();const [evaluatingTurnIds, setEvaluatingTurnIds] = useState<Set<string>>(new Set(),@@ -231,9 +229,7 @@ export const SettingsAgentLogsTab = ({>{latestEvaluation && (<UndecoratedLink- to={getSettingsPath(SettingsPath.AiAgentTurnDetail)- .replace(':agentId', agentId)- .replace(':turnId', turn.id)}+ to={getCoreAgentLink(agentId, { turn: turn.id })}><LightIconButtontitle={t`View all evaluations`}diff --git a/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentModelCell.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentModelCell.tsxnew file mode 100644index 00000000000..3e031ab437a--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentModelCell.tsx@@ -0,0 +1,35 @@+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';+import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme';++import { useResolvedAiModel } from '@/ai/hooks/useResolvedAiModel';++const StyledContainer = styled.div`+ color: ${themeCssVariables.font.color.secondary};+ min-width: 0;+ overflow: hidden;+`;++type CoreAgentModelCellProps = {+ modelId: string;+};++export const CoreAgentModelCell = ({ modelId }: CoreAgentModelCellProps) => {+ const { t } = useLingui();+ const resolvedModel = useResolvedAiModel(modelId);++ const fallbackLabel =+ modelId === AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID+ ? t`Workspace default`+ : modelId;++ return (+ <StyledContainer>+ <OverflowingTextWithTooltip+ text={resolvedModel?.label ?? fallbackLabel}+ />+ </StyledContainer>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentNameCell.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentNameCell.tsxnew file mode 100644index 00000000000..6bb41b08724--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentNameCell.tsx@@ -0,0 +1,22 @@+import { isNonEmptyString } from '@sniptt/guards';+import { useIcons } from 'twenty-ui/icon';++import { CoreObjectNameCell } from '@/object-core/components/cells/CoreObjectNameCell';+import { type CoreAgent } from '@/object-core/agents/types/CoreAgent';++type CoreAgentNameCellProps = {+ agent: Pick<CoreAgent, 'id' | 'label' | 'icon'>;+};++export const CoreAgentNameCell = ({ agent }: CoreAgentNameCellProps) => {+ const { getIcon } = useIcons();++ return (+ <CoreObjectNameCell+ name={agent.label}+ avatarColorSeed={agent.id}+ avatarShape="square"+ Icon={getIcon(isNonEmptyString(agent.icon) ? agent.icon : 'IconLego')}+ />+ );+};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentResponseFormat.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentResponseFormat.tsxsimilarity index 95%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentResponseFormat.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentResponseFormat.tsxindex 78f329d398a..8fbbd8cf0fc 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentResponseFormat.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentResponseFormat.tsx@@ -15,7 +15,7 @@ const StyledContainer = styled.div`gap: ${themeCssVariables.spacing[2]};`;-type SettingsAgentResponseFormatProps = {+type CoreAgentResponseFormatProps = {responseFormat?: {type: 'text' | 'json';schema?: AgentResponseSchema;@@ -27,11 +27,11 @@ type SettingsAgentResponseFormatProps = {disabled?: boolean;};-export const SettingsAgentResponseFormat = ({+export const CoreAgentResponseFormat = ({responseFormat,onResponseFormatChange,disabled,-}: SettingsAgentResponseFormatProps) => {+}: CoreAgentResponseFormatProps) => {const formatType = responseFormat?.type || 'text';const schema: AgentResponseSchema = responseFormat?.schema || {type: 'object' as const,diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentRoleTab.tsxsimilarity index 93%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentRoleTab.tsxindex c8087e459b4..7502586a11a 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentRoleTab.tsx@@ -21,7 +21,7 @@ import {AssignRoleToAgentDocument,CreateOneRoleDocument,} from '~/generated-metadata/graphql';-import { type SettingsAiAgentFormValues } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';+import { type CoreAgentFormValues } from '@/object-core/agents/validation-schemas/coreAgentFormSchema';const StyledWarningText = styled.div`color: ${themeCssVariables.font.color.tertiary};@@ -29,24 +29,24 @@ const StyledWarningText = styled.div`margin-bottom: ${themeCssVariables.spacing[4]};`;-type SettingsAgentRoleTabProps = {- formValues: SettingsAiAgentFormValues;+type CoreAgentRoleTabProps = {+ formValues: CoreAgentFormValues;onFieldChange: (- field: keyof SettingsAiAgentFormValues,- value: SettingsAiAgentFormValues[keyof SettingsAiAgentFormValues],+ field: keyof CoreAgentFormValues,+ value: CoreAgentFormValues[keyof CoreAgentFormValues],) => void;disabled: boolean;agentId?: string;agentLabel: string;};-export const SettingsAgentRoleTab = ({+export const CoreAgentRoleTab = ({formValues,onFieldChange,disabled,agentId,agentLabel,-}: SettingsAgentRoleTabProps) => {+}: CoreAgentRoleTabProps) => {const { t } = useLingui();const [isCreatingRole, setIsCreatingRole] = useState(false);diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentSettingsTab.tsxsimilarity index 88%rename from packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentSettingsTab.tsxindex 19d9860a16b..18c4a306aef 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentSettingsTab.tsx@@ -14,10 +14,10 @@ import { IconTrash } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';import { type Agent } from '~/generated-metadata/graphql';-import { SettingsAgentDeleteConfirmationModal } from '~/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal';-import { SettingsAgentResponseFormat } from '~/pages/settings/ai/components/SettingsAgentResponseFormat';+import { CoreAgentDeleteConfirmationModal } from '@/object-core/agents/components/CoreAgentDeleteConfirmationModal';+import { CoreAgentResponseFormat } from '@/object-core/agents/components/CoreAgentResponseFormat';import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/computeMetadataNameFromLabel';-import { type SettingsAiAgentFormValues } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';+import { type CoreAgentFormValues } from '@/object-core/agents/validation-schemas/coreAgentFormSchema';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';const StyledFormContainer = styled.div`@@ -44,22 +44,22 @@ const StyledErrorMessage = styled.div`const DELETE_AGENT_MODAL_ID = 'delete-agent-modal';-type SettingsAgentSettingsTabProps = {- formValues: SettingsAiAgentFormValues;+type CoreAgentSettingsTabProps = {+ formValues: CoreAgentFormValues;onFieldChange: (- field: keyof SettingsAiAgentFormValues,- value: SettingsAiAgentFormValues[keyof SettingsAiAgentFormValues],+ field: keyof CoreAgentFormValues,+ value: CoreAgentFormValues[keyof CoreAgentFormValues],) => void;disabled: boolean;agent?: Agent;};-export const SettingsAgentSettingsTab = ({+export const CoreAgentSettingsTab = ({formValues,onFieldChange,disabled,agent,-}: SettingsAgentSettingsTabProps) => {+}: CoreAgentSettingsTabProps) => {const { t } = useLingui();const { openDialog } = useDialog();@@ -147,7 +147,7 @@ export const SettingsAgentSettingsTab = ({/></StyledFormContainer><StyledFormContainer>- <SettingsAgentResponseFormat+ <CoreAgentResponseFormatresponseFormat={formValues.responseFormat}onResponseFormatChange={(format) =>onFieldChange('responseFormat', format)@@ -170,7 +170,7 @@ export const SettingsAgentSettingsTab = ({</Section.Root>)}{!disabled && agent && (- <SettingsAgentDeleteConfirmationModal+ <CoreAgentDeleteConfirmationModalagentId={agent.id}agentName={agent.label}/>diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAgentTurnDetail.tsx b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentTurnDetail.tsxsimilarity index 80%rename from packages/twenty-front/src/pages/settings/ai/SettingsAgentTurnDetail.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/CoreAgentTurnDetail.tsxindex 449549f7dc0..06cdd4dcf55 100644--- a/packages/twenty-front/src/pages/settings/ai/SettingsAgentTurnDetail.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/CoreAgentTurnDetail.tsx@@ -1,3 +1,5 @@+import { getCoreAgentBreadcrumbLinks } from '@/object-core/agents/utils/getCoreAgentBreadcrumbLinks';+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';import { AiChatAssistantMessageRenderer } from '@/ai/components/AiChatAssistantMessageRenderer';import { mapDBMessagesToUIMessages } from '@/ai/utils/mapDBMessagesToUIMessages';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';@@ -11,14 +13,12 @@ import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import Skeleton from 'react-loading-skeleton';import { Suspense } from 'react';-import { useParams } from 'react-router-dom';-import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components';import { Status } from 'twenty-ui/primitives/data-display';import { themeCssVariables } from 'twenty-ui/theme';import {type AgentMessage,+ type FindOneAgentQuery,GetAgentTurnsDocument,} from '~/generated-metadata/graphql';@@ -54,17 +54,24 @@ const StyledMessageContent = styled.div`max-width: 100%;`;-export const SettingsAgentTurnDetail = () => {- const { agentId, turnId } = useParams<{- agentId: string;- turnId: string;- }>();+type CoreAgentTurnDetailProps = {+ agent: Pick<FindOneAgentQuery['findOneAgent'], 'id' | 'label'>;+ turnId: string;+};+export const CoreAgentTurnDetail = ({+ agent,+ turnId,+}: CoreAgentTurnDetailProps) => {const { data, loading } = useQuery(GetAgentTurnsDocument, {- variables: { agentId: agentId || '' },- skip: !agentId,+ variables: { agentId: agent.id },});+ const links = getCoreAgentBreadcrumbLinks([+ { children: agent.label, href: getCoreAgentLink(agent.id) },+ { children: t`Turn` },+ ]);+const turn = data?.agentTurns?.find((t) => t.id === turnId);const getScoreColor = (score: number) => {@@ -75,24 +82,7 @@ export const SettingsAgentTurnDetail = () => {if (loading) {return (- <SettingsPageLayout- title={t`Turn Details`}- links={[- {- children: t`Workspace`,- href: getSettingsPath(SettingsPath.General),- },- { children: t`AI`, href: getSettingsPath(SettingsPath.AI) },- {- children: t`Agent`,- href: getSettingsPath(SettingsPath.AiAgentDetail).replace(- ':agentId',- agentId || '',- ),- },- { children: t`Turn` },- ]}- >+ <SettingsPageLayout title={t`Turn Details`} links={links}><SettingsPageContainer><Skeleton height={200} /></SettingsPageContainer>@@ -102,17 +92,7 @@ export const SettingsAgentTurnDetail = () => {if (!turn) {return (- <SettingsPageLayout- title={t`Turn Not Found`}- links={[- {- children: t`Workspace`,- href: getSettingsPath(SettingsPath.General),- },- { children: t`AI`, href: getSettingsPath(SettingsPath.AI) },- { children: t`Turn` },- ]}- >+ <SettingsPageLayout title={t`Turn Not Found`} links={links}><SettingsPageContainer><div>{t`Turn not found`}</div></SettingsPageContainer>@@ -121,24 +101,7 @@ export const SettingsAgentTurnDetail = () => {}return (- <SettingsPageLayout- title={t`Turn Details`}- links={[- {- children: t`Workspace`,- href: getSettingsPath(SettingsPath.General),- },- { children: t`AI`, href: getSettingsPath(SettingsPath.AI) },- {- children: t`Agent`,- href: getSettingsPath(SettingsPath.AiAgentDetail).replace(- ':agentId',- agentId || '',- ),- },- { children: t`Turn` },- ]}- >+ <SettingsPageLayout title={t`Turn Details`} links={links}><SettingsPageContainer><Section.Root><Section.Headerdiff --git a/packages/twenty-front/src/pages/settings/ai/components/__stories__/SettingsAgentEvalsTab.stories.tsx b/packages/twenty-front/src/modules/object-core/agents/components/__stories__/CoreAgentEvalsTab.stories.tsxsimilarity index 92%rename from packages/twenty-front/src/pages/settings/ai/components/__stories__/SettingsAgentEvalsTab.stories.tsxrename to packages/twenty-front/src/modules/object-core/agents/components/__stories__/CoreAgentEvalsTab.stories.tsxindex 97d2e0fdc01..5b4c36f250b 100644--- a/packages/twenty-front/src/pages/settings/ai/components/__stories__/SettingsAgentEvalsTab.stories.tsx+++ b/packages/twenty-front/src/modules/object-core/agents/components/__stories__/CoreAgentEvalsTab.stories.tsx@@ -7,7 +7,7 @@ import {type RunEvaluationInputMutation,type RunEvaluationInputMutationVariables,} from '~/generated-metadata/graphql';-import { SettingsAgentEvalsTab } from '~/pages/settings/ai/components/SettingsAgentEvalsTab';+import { CoreAgentEvalsTab } from '@/object-core/agents/components/CoreAgentEvalsTab';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ToastDecorator } from '~/testing/decorators/ToastDecorator';@@ -16,9 +16,9 @@ const evaluationInput = 'Find all customers in Paris';let pendingEvaluation = Promise.resolve();let completeEvaluation = () => {};-const meta: Meta<typeof SettingsAgentEvalsTab> = {- title: 'Pages/Settings/AI/SettingsAgentEvalsTab',- component: SettingsAgentEvalsTab,+const meta: Meta<typeof CoreAgentEvalsTab> = {+ title: 'Modules/ObjectCore/Agents/CoreAgentEvalsTab',+ component: CoreAgentEvalsTab,decorators: [ComponentDecorator, MemoryRouterDecorator, ToastDecorator],args: {agentId: 'test-agent',@@ -59,7 +59,7 @@ const meta: Meta<typeof SettingsAgentEvalsTab> = {};export default meta;-type Story = StoryObj<typeof SettingsAgentEvalsTab>;+type Story = StoryObj<typeof CoreAgentEvalsTab>;export const RunWhilePending: Story = {play: async ({ canvasElement, args }) => {diff --git a/packages/twenty-front/src/pages/settings/ai/constants/SettingsAgentDetailTabs.ts b/packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentDetailTabs.tssimilarity index 51%rename from packages/twenty-front/src/pages/settings/ai/constants/SettingsAgentDetailTabs.tsrename to packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentDetailTabs.tsindex 363736955b1..60859fa0969 100644--- a/packages/twenty-front/src/pages/settings/ai/constants/SettingsAgentDetailTabs.ts+++ b/packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentDetailTabs.ts@@ -1,5 +1,5 @@-export const SETTINGS_AGENT_DETAIL_TABS = {- COMPONENT_INSTANCE_ID: 'settings-agent-detail-tabs',+export const CORE_AGENT_DETAIL_TABS = {+ COMPONENT_INSTANCE_ID: 'core-agent-detail-tabs',TABS_IDS: {ROLE: 'role',SETTINGS: 'settings',diff --git a/packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentTableColumns.tsx b/packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentTableColumns.tsxnew file mode 100644index 00000000000..8fb635702bb--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/constants/CoreAgentTableColumns.tsx@@ -0,0 +1,33 @@+import { msg } from '@lingui/core/macro';++import { CoreAgentModelCell } from '@/object-core/agents/components/CoreAgentModelCell';+import { CoreAgentNameCell } from '@/object-core/agents/components/CoreAgentNameCell';+import { type CoreAgent } from '@/object-core/agents/types/CoreAgent';+import { type CoreObjectTableColumn } from '@/object-core/types/CoreObjectTableColumn';+import { DateTimeDisplay } from '@/ui/field/display/components/DateTimeDisplay';++export const CORE_AGENT_TABLE_COLUMNS: CoreObjectTableColumn<CoreAgent>[] = [+ {+ fieldName: 'label',+ fieldLabel: msg`Name`,+ fieldType: 'string',+ align: 'left',+ gridTrack: 'minmax(200px, 1fr)',+ renderCell: (agent) => <CoreAgentNameCell agent={agent} />,+ },+ {+ fieldName: 'modelId',+ fieldLabel: msg`Model`,+ align: 'left',+ gridTrack: '200px',+ renderCell: (agent) => <CoreAgentModelCell modelId={agent.modelId} />,+ },+ {+ fieldName: 'updatedAt',+ fieldLabel: msg`Last update`,+ fieldType: 'string',+ align: 'left',+ gridTrack: '150px',+ renderCell: (agent) => <DateTimeDisplay value={agent.updatedAt} />,+ },+];diff --git a/packages/twenty-front/src/modules/object-core/agents/hooks/__tests__/useCoreAgents.test.tsx b/packages/twenty-front/src/modules/object-core/agents/hooks/__tests__/useCoreAgents.test.tsxnew file mode 100644index 00000000000..0fa6c0cf876--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/hooks/__tests__/useCoreAgents.test.tsx@@ -0,0 +1,102 @@+import { MockedProvider } from '@apollo/client/testing/react';+import { renderHook, waitFor } from '@testing-library/react';+import { Provider as JotaiProvider } from 'jotai';+import { type ReactNode } from 'react';++import { useCoreAgents } from '@/object-core/agents/hooks/useCoreAgents';+import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';+import {+ jotaiStore,+ resetJotaiStore,+} from '@/ui/utilities/state/jotai/jotaiStore';+import { FindManyAgentsDocument } from '~/generated-metadata/graphql';++const buildAgent = ({+ id,+ label,+ isSystem,+ updatedAt,+}: {+ id: string;+ label: string;+ isSystem: boolean;+ updatedAt: string;+}) => ({+ __typename: 'Agent' as const,+ id,+ name: label.toLowerCase().replace(/\s/g, ''),+ label,+ description: null,+ icon: null,+ prompt: 'Prompt',+ modelId: 'workspace-default-model',+ responseFormat: null,+ roleId: null,+ isCustom: true,+ isSystem,+ modelConfiguration: null,+ evaluationInputs: [],+ applicationId: null,+ createdAt: '2026-01-01T00:00:00.000Z',+ updatedAt,+});++const FIND_MANY_AGENTS_MOCK = {+ request: { query: FindManyAgentsDocument },+ result: {+ data: {+ findManyAgents: [+ buildAgent({+ id: 'lead-qualifier',+ label: 'Lead qualifier',+ isSystem: false,+ updatedAt: '2026-01-02T00:00:00.000Z',+ }),+ buildAgent({+ id: 'workflow-agent',+ label: 'Workflow Agent 74d6',+ isSystem: true,+ updatedAt: '2026-01-03T00:00:00.000Z',+ }),+ ],+ },+ },+};++const Wrapper = ({ children }: { children: ReactNode }) => (+ <JotaiProvider store={jotaiStore}>+ <MockedProvider mocks={[FIND_MANY_AGENTS_MOCK]}>{children}</MockedProvider>+ </JotaiProvider>+);++const renderCoreAgents = (isAdvancedModeEnabled: boolean) => {+ resetJotaiStore();+ jotaiStore.set(isAdvancedModeEnabledState.atom, isAdvancedModeEnabled);++ return renderHook(() => useCoreAgents({ tableId: 'core-agents-test' }), {+ wrapper: Wrapper,+ });+};++describe('useCoreAgents', () => {+ it('leaves system agents out outside developer mode', async () => {+ const { result } = renderCoreAgents(false);++ await waitFor(() => expect(result.current.isInitialLoading).toBe(false));++ expect(result.current.coreAgents.map(({ label }) => label)).toEqual([+ 'Lead qualifier',+ ]);+ });++ it('lists system agents in developer mode, most recently updated first', async () => {+ const { result } = renderCoreAgents(true);++ await waitFor(() => expect(result.current.isInitialLoading).toBe(false));++ expect(result.current.coreAgents.map(({ label }) => label)).toEqual([+ 'Workflow Agent 74d6',+ 'Lead qualifier',+ ]);+ });+});diff --git a/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentFormState.ts b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentFormState.tsnew file mode 100644index 00000000000..54dd682fcf6--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentFormState.ts@@ -0,0 +1,25 @@+import { useState } from 'react';+import {+ coreAgentFormSchema,+ type CoreAgentFormValues,+} from '@/object-core/agents/validation-schemas/coreAgentFormSchema';++export const useCoreAgentFormState = (initialValues: CoreAgentFormValues) => {+ const [formValues, setFormValues] =+ useState<CoreAgentFormValues>(initialValues);+ const validateForm = (): boolean =>+ coreAgentFormSchema.safeParse(formValues).success;++ const setFieldValue = (+ field: keyof CoreAgentFormValues,+ value: CoreAgentFormValues[keyof CoreAgentFormValues],+ ) => {+ setFormValues((previousValues) => ({ ...previousValues, [field]: value }));+ };++ return {+ formValues,+ setFieldValue,+ validateForm,+ };+};diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.ts b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentSave.tssimilarity index 62%rename from packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.tsrename to packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentSave.tsindex e57bb7784f4..33130734211 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.ts+++ b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgentSave.ts@@ -2,7 +2,6 @@ import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useEffect, useState } from 'react';-import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { useToast } from 'twenty-ui/components';import { useDebouncedCallback } from 'use-debounce';@@ -10,16 +9,13 @@ import { useDebouncedCallback } from 'use-debounce';import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useSaveDraftRoleToDB } from '@/settings/roles/role/hooks/useSaveDraftRoleToDB';import {- type CreateAgentInput,- CreateOneAgentDocument,type FindOneAgentQuery,UpdateOneAgentDocument,} from '~/generated-metadata/graphql';-import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { type SettingsAiAgentFormValues } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';+import { type CoreAgentFormValues } from '@/object-core/agents/validation-schemas/coreAgentFormSchema';import { isDeeplyEqual } from '~/utils/isDeeplyEqual';-export const useSettingsAgentSave = ({+export const useCoreAgentSave = ({agent,formValues,initialFormValues,@@ -27,20 +23,18 @@ export const useSettingsAgentSave = ({isRoleDirty,validateForm,}: {- agent?: FindOneAgentQuery['findOneAgent'];- formValues: SettingsAiAgentFormValues;- initialFormValues: SettingsAiAgentFormValues;+ agent: FindOneAgentQuery['findOneAgent'];+ formValues: CoreAgentFormValues;+ initialFormValues: CoreAgentFormValues;isReadonlyMode: boolean;isRoleDirty: boolean;validateForm: () => boolean;}) => {- const navigate = useNavigateSettings();const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [originalFormValues, setOriginalFormValues] =useState(initialFormValues);- const [createAgent] = useMutation(CreateOneAgentDocument);const [updateAgent] = useMutation(UpdateOneAgentDocument);const { saveDraftRoleToDB } = useSaveDraftRoleToDB({@@ -84,12 +78,7 @@ export const useSettingsAgentSave = ({});const autoSave = useDebouncedCallback(async () => {- if (- !isDefined(agent) ||- isReadonlyMode ||- !validateForm() ||- isSubmitting- ) {+ if (isReadonlyMode || !validateForm() || isSubmitting) {return;}@@ -136,55 +125,5 @@ export const useSettingsAgentSave = ({};}, [autoSave]);- const handleSave = async () => {- if (isReadonlyMode || !validateForm()) {- return;- }-- setIsSubmitting(true);-- try {- if (isRoleDirty && isDefined(formValues.role)) {- const isRoleSaved = await saveDraftRole();-- if (!isRoleSaved) {- setIsSubmitting(false);- return;- }- }-- if (!isDefined(agent)) {- const input: CreateAgentInput = {- name: formValues.name,- label: formValues.label,- description: formValues.description,- icon: formValues.icon,- modelId: formValues.modelId,- roleId: formValues.role,- prompt: formValues.prompt,- modelConfiguration: formValues.modelConfiguration,- responseFormat: formValues.responseFormat,- evaluationInputs: formValues.evaluationInputs,- };-- await createAgent({- variables: { input },- });- navigate(SettingsPath.AI);- return;- }-- await updateAgent({- variables: { input: buildUpdateInput(agent.id) },- });-- navigate(SettingsPath.AI);- } catch (error) {- enqueueToast(getToastOptionsFromError({ error }));- } finally {- setIsSubmitting(false);- }- };-- return { handleSave, isSubmitting, scheduleAutoSave: autoSave };+ return { scheduleAutoSave: autoSave };};diff --git a/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgents.ts b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgents.tsnew file mode 100644index 00000000000..9d0edee7693--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/hooks/useCoreAgents.ts@@ -0,0 +1,62 @@+import { useQuery } from '@apollo/client/react';+import { useMemo } from 'react';+import { isDefined } from 'twenty-shared/utils';++import { CORE_AGENT_TABLE_COLUMNS } from '@/object-core/agents/constants/CoreAgentTableColumns';+import { type CoreAgent } from '@/object-core/agents/types/CoreAgent';+import { useSortedArray } from '@/ui/layout/table/hooks/useSortedArray';+import { type TableFieldMetadata } from '@/ui/layout/table/types/TableFieldMetadata';+import { type TableSortValue } from '@/ui/layout/table/types/TableSortValue';+import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { FindManyAgentsDocument } from '~/generated-metadata/graphql';++export const CORE_AGENTS_TABLE_ID = 'coreAgents';++export const CORE_AGENTS_INITIAL_SORT: TableSortValue = {+ fieldName: 'updatedAt',+ direction: 'desc',+};++const CORE_AGENTS_SORTABLE_FIELDS = CORE_AGENT_TABLE_COLUMNS.flatMap(+ ({ fieldName, fieldLabel, fieldType, align }) =>+ isDefined(fieldType) ? [{ fieldName, fieldLabel, fieldType, align }] : [],+) satisfies TableFieldMetadata<CoreAgent>[];++export const useCoreAgents = ({+ tableId = CORE_AGENTS_TABLE_ID,+}: {+ tableId?: string;+} = {}) => {+ const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState);++ // Workflow steps and the agent page create and delete agents without touching this query's cache+ const { data, loading, error } = useQuery(FindManyAgentsDocument, {+ fetchPolicy: 'cache-and-network',+ });++ const listedAgents = useMemo(+ () =>+ (data?.findManyAgents ?? []).filter(+ (agent) => !agent.isSystem || isAdvancedModeEnabled,+ ),+ [data?.findManyAgents, isAdvancedModeEnabled],+ );++ const tableMetadata = useMemo(+ () => ({+ tableId,+ fields: CORE_AGENTS_SORTABLE_FIELDS,+ initialSort: CORE_AGENTS_INITIAL_SORT,+ }),+ [tableId],+ );++ const coreAgents = useSortedArray(listedAgents, tableMetadata);++ return {+ coreAgents,+ isInitialLoading: loading && !isDefined(data),+ error,+ };+};diff --git a/packages/twenty-front/src/modules/object-core/agents/hooks/useCreateCoreAgent.ts b/packages/twenty-front/src/modules/object-core/agents/hooks/useCreateCoreAgent.tsnew file mode 100644index 00000000000..448340888ea--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/hooks/useCreateCoreAgent.ts@@ -0,0 +1,85 @@+import { useMutation } from '@apollo/client/react';+import { t } from '@lingui/core/macro';+import { useCallback, useState } from 'react';+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';+import { PermissionFlagType } from 'twenty-shared/constants';+import { AppPath } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/components';+import { v4 } from 'uuid';++import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';+import { CreateOneAgentDocument } from '~/generated-metadata/graphql';+import { useNavigateApp } from '~/hooks/useNavigateApp';+import { logError } from '~/utils/logError';++export const useCreateCoreAgent = () => {+ const canCreateCoreAgent = useHasPermissionFlag(+ PermissionFlagType.AI_SETTINGS,+ );++ const [createOneAgentMutation] = useMutation(CreateOneAgentDocument);++ const [isCreatingCoreAgent, setIsCreatingCoreAgent] = useState(false);++ const navigate = useNavigateApp();++ const { enqueueToast } = useToast();++ const createCoreAgent = useCallback(async () => {+ if (isCreatingCoreAgent || !canCreateCoreAgent) {+ return;+ }++ setIsCreatingCoreAgent(true);++ let coreAgentId: string | null | undefined;++ try {+ const { data } = await createOneAgentMutation({+ variables: {+ input: {+ // Names are unique per workspace and renaming the label rewrites it+ name: `untitledAgent${v4().split('-')[0]}`,+ label: t`Untitled agent`,+ icon: 'IconLego',+ prompt: 'You are a helpful AI assistant.',+ modelId: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,+ responseFormat: { type: 'text' },+ },+ },+ });++ coreAgentId = data?.createOneAgent.id;+ } catch (error) {+ logError(error);+ enqueueToast({+ variant: 'error',+ children: t`Failed to create agent`,+ });++ return;+ } finally {+ setIsCreatingCoreAgent(false);+ }++ if (!isDefined(coreAgentId)) {+ enqueueToast({+ variant: 'error',+ children: t`Failed to create agent`,+ });++ return;+ }++ navigate(AppPath.AgentShowPage, { agentId: coreAgentId });+ }, [+ canCreateCoreAgent,+ createOneAgentMutation,+ navigate,+ enqueueToast,+ isCreatingCoreAgent,+ ]);++ return { createCoreAgent, canCreateCoreAgent, isCreatingCoreAgent };+};diff --git a/packages/twenty-front/src/modules/object-core/agents/types/CoreAgent.ts b/packages/twenty-front/src/modules/object-core/agents/types/CoreAgent.tsnew file mode 100644index 00000000000..7264743c8a7--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/types/CoreAgent.ts@@ -0,0 +1,3 @@+import { type AgentFieldsFragment } from '~/generated-metadata/graphql';++export type CoreAgent = AgentFieldsFragment;diff --git a/packages/twenty-front/src/pages/settings/ai/utils/__tests__/getSettingsAgentInitialFormValues.test.ts b/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/getCoreAgentInitialFormValues.test.tssimilarity index 64%rename from packages/twenty-front/src/pages/settings/ai/utils/__tests__/getSettingsAgentInitialFormValues.test.tsrename to packages/twenty-front/src/modules/object-core/agents/utils/__tests__/getCoreAgentInitialFormValues.test.tsindex 359dd8e9389..86c34ecacc7 100644--- a/packages/twenty-front/src/pages/settings/ai/utils/__tests__/getSettingsAgentInitialFormValues.test.ts+++ b/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/getCoreAgentInitialFormValues.test.ts@@ -1,5 +1,4 @@-import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';-import { getSettingsAgentInitialFormValues } from '~/pages/settings/ai/utils/getSettingsAgentInitialFormValues';+import { getCoreAgentInitialFormValues } from '@/object-core/agents/utils/getCoreAgentInitialFormValues';const agent = {__typename: 'Agent' as const,@@ -21,25 +20,9 @@ const agent = {updatedAt: '2026-01-01T00:00:00.000Z',};-describe('getSettingsAgentInitialFormValues', () => {- it('starts a new agent on the workspace default model with an empty form', () => {- expect(getSettingsAgentInitialFormValues()).toEqual({- name: '',- label: '',- description: '',- icon: 'IconLego',- modelId: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,- role: null,- prompt: '',- isCustom: true,- modelConfiguration: {},- responseFormat: { type: 'text' },- evaluationInputs: [],- });- });-+describe('getCoreAgentInitialFormValues', () => {it('maps a loaded agent onto the form fields', () => {- expect(getSettingsAgentInitialFormValues(agent)).toEqual({+ expect(getCoreAgentInitialFormValues(agent)).toEqual({name: 'salesAssistant',label: 'Sales assistant',description: 'Qualifies leads',@@ -55,7 +38,7 @@ describe('getSettingsAgentInitialFormValues', () => {});it('falls back to the default icon, empty configuration and text format when the agent has none', () => {- const formValues = getSettingsAgentInitialFormValues({+ const formValues = getCoreAgentInitialFormValues({...agent,icon: null,modelConfiguration: null,diff --git a/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentBreadcrumbLinks.ts b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentBreadcrumbLinks.tsnew file mode 100644index 00000000000..04bf9376e83--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentBreadcrumbLinks.ts@@ -0,0 +1,15 @@+import { t } from '@lingui/core/macro';+import { AppPath } from 'twenty-shared/types';+import { getAppPath } from 'twenty-shared/utils';++import { type BreadcrumbProps } from '@/ui/navigation/bread-crumb/types/BreadcrumbProps';++export const getCoreAgentBreadcrumbLinks = (+ links: BreadcrumbProps['links'] = [],+): BreadcrumbProps['links'] => [+ {+ children: t`Agents`,+ href: getAppPath(AppPath.AgentIndexPage),+ },+ ...links,+];diff --git a/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentInitialFormValues.ts b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentInitialFormValues.tsnew file mode 100644index 00000000000..65709549178--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentInitialFormValues.ts@@ -0,0 +1,21 @@+import { type FindOneAgentQuery } from '~/generated-metadata/graphql';+import { type CoreAgentFormValues } from '@/object-core/agents/validation-schemas/coreAgentFormSchema';++export const getCoreAgentInitialFormValues = (+ agent: FindOneAgentQuery['findOneAgent'],+): CoreAgentFormValues => {+ return {+ name: agent.name,+ label: agent.label,+ description: agent.description,+ icon: agent.icon || 'IconLego',+ modelId: agent.modelId,+ role: agent.roleId,+ prompt: agent.prompt,+ isCustom: agent.isCustom,+ modelConfiguration: agent.modelConfiguration || {},+ // TODO: Fallback can be removed once all text response format agents are migrated.+ responseFormat: agent.responseFormat || { type: 'text' },+ evaluationInputs: agent.evaluationInputs ?? [],+ };+};diff --git a/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentLink.ts b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentLink.tsnew file mode 100644index 00000000000..2222a8b55f1--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/agents/utils/getCoreAgentLink.ts@@ -0,0 +1,7 @@+import { AppPath } from 'twenty-shared/types';+import { getAppPath } from 'twenty-shared/utils';++export const getCoreAgentLink = (+ agentId: string,+ queryParams?: { turn: string },+) => getAppPath(AppPath.AgentShowPage, { agentId }, queryParams);diff --git a/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts b/packages/twenty-front/src/modules/object-core/agents/validation-schemas/coreAgentFormSchema.tssimilarity index 88%rename from packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.tsrename to packages/twenty-front/src/modules/object-core/agents/validation-schemas/coreAgentFormSchema.tsindex c08f114d53c..17199f53e28 100644--- a/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts+++ b/packages/twenty-front/src/modules/object-core/agents/validation-schemas/coreAgentFormSchema.ts@@ -2,7 +2,7 @@ import { type AgentResponseSchema } from 'twenty-shared/ai';import { z } from 'zod';import { zodNonEmptyString } from '~/types/ZodNonEmptyString';-export const settingsAiAgentFormSchema = z.object({+export const coreAgentFormSchema = z.object({name: z.string().optional(),label: zodNonEmptyString,description: z.string().nullish(),@@ -36,6 +36,4 @@ export const settingsAiAgentFormSchema = z.object({evaluationInputs: z.array(z.string()).default([]),});-export type SettingsAiAgentFormValues = z.infer<- typeof settingsAiAgentFormSchema->;+export type CoreAgentFormValues = z.infer<typeof coreAgentFormSchema>;diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectIndexPageLayout.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectIndexPageLayout.tsxnew file mode 100644index 00000000000..cc184bab8fd--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectIndexPageLayout.tsx@@ -0,0 +1,109 @@+import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';+import { type ReactNode } from 'react';+import { isDefined } from 'twenty-shared/utils';+import { IconPlus } from 'twenty-ui/icon';++import { CoreObjectTableFetchMoreTrigger } from '@/object-core/components/CoreObjectTableFetchMoreTrigger';+import { RecordIndexEmptyStateDisplay } from '@/object-record/record-index/components/RecordIndexEmptyStateDisplay';+import { RecordIndexPageHeaderTitle } from '@/object-record/record-index/components/RecordIndexPageHeaderTitle';+import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';+import { PageCardLayout } from '@/ui/layout/page/components/PageCardLayout';+import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';++const StyledTableContainer = styled.div`+ height: 100%;+ overflow: auto;+ width: 100%;+`;++type CoreObjectIndexPageEmptyState = {+ title: string;+ subTitle: string;+ hasAppliedFilters?: boolean;+ buttonTitle?: string;+ onButtonClick?: () => void;+};++type CoreObjectIndexPageLayoutProps = {+ labelPlural: string;+ icon: ReactNode;+ numberOfSelectedRecords?: number;+ actionButton?: ReactNode;+ isInitialLoading: boolean;+ hasError: boolean;+ isEmpty: boolean;+ emptyState: CoreObjectIndexPageEmptyState;+ hasNextPage?: boolean;+ isFetchingNextPage?: boolean;+ onFetchNextPage?: () => void;+ children: ReactNode;+};++export const CoreObjectIndexPageLayout = ({+ labelPlural,+ icon,+ numberOfSelectedRecords = 0,+ actionButton,+ isInitialLoading,+ hasError,+ isEmpty,+ emptyState,+ hasNextPage = false,+ isFetchingNextPage = false,+ onFetchNextPage,+ children,+}: CoreObjectIndexPageLayoutProps) => {+ return (+ <>+ <PageTitle title={labelPlural} />+ <PageCardLayout+ header={+ <PageCardHeader+ icon={icon}+ title={+ <RecordIndexPageHeaderTitle+ label={labelPlural}+ numberOfSelectedRecords={numberOfSelectedRecords}+ />+ }+ actionButton={actionButton}+ />+ }+ >+ <StyledTableContainer>+ {hasError && (+ <RecordIndexEmptyStateDisplay+ animatedPlaceholderType="errorIndex"+ title={t`Something went wrong`}+ subTitle={t`We could not load your ${labelPlural}. Please try again later.`}+ />+ )}+ {isEmpty && (+ <RecordIndexEmptyStateDisplay+ animatedPlaceholderType={+ emptyState.hasAppliedFilters ? 'noMatchRecord' : 'noRecord'+ }+ title={emptyState.title}+ subTitle={emptyState.subTitle}+ ButtonIcon={IconPlus}+ buttonTitle={emptyState.buttonTitle}+ onButtonClick={emptyState.onButtonClick}+ />+ )}+ {!isInitialLoading && !hasError && !isEmpty && (+ <>+ {children}+ {hasNextPage && isDefined(onFetchNextPage) && (+ <CoreObjectTableFetchMoreTrigger+ isFetchingNextPage={isFetchingNextPage}+ onFetchNextPage={onFetchNextPage}+ />+ )}+ </>+ )}+ </StyledTableContainer>+ </PageCardLayout>+ </>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectTableFetchMoreTrigger.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectTableFetchMoreTrigger.tsxnew file mode 100644index 00000000000..8652eb470eb--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectTableFetchMoreTrigger.tsx@@ -0,0 +1,24 @@+import { styled } from '@linaria/react';++import { useCoreObjectTableFetchMore } from '@/object-core/hooks/useCoreObjectTableFetchMore';++const StyledFetchMoreTrigger = styled.div`+ height: 1px;+`;++type CoreObjectTableFetchMoreTriggerProps = {+ isFetchingNextPage: boolean;+ onFetchNextPage: () => void;+};++export const CoreObjectTableFetchMoreTrigger = ({+ isFetchingNextPage,+ onFetchNextPage,+}: CoreObjectTableFetchMoreTriggerProps) => {+ const { ref } = useCoreObjectTableFetchMore({+ isFetchingNextPage,+ onFetchNextPage,+ });++ return <StyledFetchMoreTrigger ref={ref} />;+};diff --git a/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx b/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsxindex 4fc17254a1c..c37bb566786 100644--- a/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx+++ b/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx@@ -1,9 +1,11 @@import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';+import { isDefined } from 'twenty-shared/utils';+import { type IconComponent } from 'twenty-ui/icon';import { Avatar, type AvatarShape } from 'twenty-ui/primitives/data-display';import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';-import { themeCssVariables } from 'twenty-ui/theme';+import { themeCssVariables, useTheme } from 'twenty-ui/theme';const StyledContainer = styled.div`align-items: center;@@ -24,24 +26,33 @@ type CoreObjectNameCellProps = {name: string | null | undefined;avatarColorSeed: string;avatarShape: AvatarShape;+ Icon?: IconComponent;};export const CoreObjectNameCell = ({name,avatarColorSeed,avatarShape,+ Icon,}: CoreObjectNameCellProps) => {const { t } = useLingui();+ const theme = useTheme();return (<StyledContainer><StyledAvatarContainer>- <Avatar- name={name ?? undefined}- colorSeed={avatarColorSeed}- size="sm"- shape={avatarShape}- />+ {isDefined(Icon) ? (+ <span aria-hidden>+ <Icon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />+ </span>+ ) : (+ <Avatar+ name={name ?? undefined}+ colorSeed={avatarColorSeed}+ size="sm"+ shape={avatarShape}+ />+ )}</StyledAvatarContainer><OverflowingTextWithTooltiptext={isNonEmptyString(name) ? name : t`Untitled`}diff --git a/packages/twenty-front/src/modules/object-core/hooks/useCoreObjectTableFetchMore.ts b/packages/twenty-front/src/modules/object-core/hooks/useCoreObjectTableFetchMore.tsnew file mode 100644index 00000000000..f1dffe2599c--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/hooks/useCoreObjectTableFetchMore.ts@@ -0,0 +1,21 @@+import { useEffect } from 'react';+import { useInView } from 'react-intersection-observer';++// Re-checks after each page so a short page that leaves the sentinel visible keeps loading+export const useCoreObjectTableFetchMore = ({+ isFetchingNextPage,+ onFetchNextPage,+}: {+ isFetchingNextPage: boolean;+ onFetchNextPage: () => void;+}) => {+ const { ref, inView } = useInView();++ useEffect(() => {+ if (inView && !isFetchingNextPage) {+ onFetchNextPage();+ }+ }, [inView, isFetchingNextPage, onFetchNextPage]);++ return { ref };+};diff --git a/packages/twenty-front/src/modules/settings/applications/hooks/useComputeApplicationContentForLayoutAndLogic.ts b/packages/twenty-front/src/modules/settings/applications/hooks/useComputeApplicationContentForLayoutAndLogic.tsindex 4c9a315461b..da749a5a106 100644--- a/packages/twenty-front/src/modules/settings/applications/hooks/useComputeApplicationContentForLayoutAndLogic.ts+++ b/packages/twenty-front/src/modules/settings/applications/hooks/useComputeApplicationContentForLayoutAndLogic.ts@@ -1,3 +1,4 @@+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { getViewTypeLabel } from '@/views/types/ViewType';@@ -146,9 +147,7 @@ export const useComputeApplicationContentForLayoutAndLogic = ({name: agent.label,icon: agent.icon ?? undefined,secondary: agent.description ?? undefined,- link: getSettingsPath(SettingsPath.AiAgentDetail, {- agentId: agent.id,- }),+ link: getCoreAgentLink(agent.id),})): (manifestContent?.agents ?? []).map((agent) => ({key: agent.universalIdentifier,diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsxindex c694bd7dc8e..a389f0d4b88 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx@@ -1,4 +1,6 @@import { NavigationButton } from '@/ui/input/components/NavigationButton';+import { getCoreAgentBreadcrumbLinks } from '@/object-core/agents/utils/getCoreAgentBreadcrumbLinks';+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById';import { mapRLSOperandToRecordFilterOperand } from '@/object-record/record-filter/utils/mapRLSOperandToRecordFilterOperand';@@ -71,25 +73,10 @@ export const SettingsRolePermissionsObjectLevelObjectForm = ({const breadcrumbLinks =fromAgentId && isDefined(agent)- ? [- {- children: t`Workspace`,- href: getSettingsPath(SettingsPath.General),- },- {- children: t`AI`,- href: getSettingsPath(SettingsPath.AI),- },- {- children: agent.label,- href: getSettingsPath(SettingsPath.AiAgentDetail, {- agentId: agent.id,- }),- },- {- children: t`Permissions · ${objectLabelSingular}`,- },- ]+ ? getCoreAgentBreadcrumbLinks([+ { children: agent.label, href: getCoreAgentLink(agent.id) },+ { children: t`Permissions · ${objectLabelSingular}` },+ ]): [{children: t`Workspace`,@@ -116,7 +103,7 @@ export const SettingsRolePermissionsObjectLevelObjectForm = ({const finishButtonPath =fromAgentId && isDefined(agent)- ? getSettingsPath(SettingsPath.AiAgentDetail, { agentId: agent.id })+ ? getCoreAgentLink(agent.id): getSettingsPath(SettingsPath.RoleDetail, { roleId });const previousStepPath = `${getSettingsPath(SettingsPath.RoleAddObjectLevel, {diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsxindex 7637f935b97..b057d003281 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx@@ -10,11 +10,12 @@ import { workflowAiAgentActionAgentState } from '@/workflow/workflow-steps/workfimport { useLingui } from '@lingui/react/macro';import { useId } from 'react';import { Dropdown } from 'twenty-ui/components';-import { SettingsPath } from 'twenty-shared/types';+import { AppPath, SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';import { IconLego, IconSettings, IconTrash, IconUsers } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';+import { useNavigateApp } from '~/hooks/useNavigateApp';import { useNavigateSettings } from '~/hooks/useNavigateSettings';export const WorkflowStepFooter = ({@@ -34,6 +35,7 @@ export const WorkflowStepFooter = ({openWorkflowTriggerTypeInSidePanel,} = useSidePanelWorkflowNavigation();const { deleteStep } = useDeleteStep();+ const navigateApp = useNavigateApp();const navigateSettings = useNavigateSettings();const workflowAiAgentActionAgent = useAtomStateValue(workflowAiAgentActionAgentState,@@ -68,7 +70,7 @@ export const WorkflowStepFooter = ({const handleViewAgent = () => {if (isDefined(agentId)) {- navigateSettings(SettingsPath.AiAgentDetail, { agentId });+ navigateApp(AppPath.AgentShowPage, { agentId });}};diff --git a/packages/twenty-front/src/pages/object-core/AgentCoreIndexPage.tsx b/packages/twenty-front/src/pages/object-core/AgentCoreIndexPage.tsxnew file mode 100644index 00000000000..bec6efd0e35--- /dev/null+++ b/packages/twenty-front/src/pages/object-core/AgentCoreIndexPage.tsx@@ -0,0 +1,72 @@+import { t } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';+import { IconLego } from 'twenty-ui/icon';+import { useTheme } from 'twenty-ui/theme';++import { CORE_AGENT_TABLE_COLUMNS } from '@/object-core/agents/constants/CoreAgentTableColumns';+import {+ CORE_AGENTS_INITIAL_SORT,+ CORE_AGENTS_TABLE_ID,+ useCoreAgents,+} from '@/object-core/agents/hooks/useCoreAgents';+import { useCreateCoreAgent } from '@/object-core/agents/hooks/useCreateCoreAgent';+import { type CoreAgent } from '@/object-core/agents/types/CoreAgent';+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';+import { CoreObjectIndexPageLayout } from '@/object-core/components/CoreObjectIndexPageLayout';+import { CoreObjectTable } from '@/object-core/components/CoreObjectTable';+import { CoreObjectTableAddNewRow } from '@/object-core/components/CoreObjectTableAddNewRow';+import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';+import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';++const getCoreAgentItemLink = (agent: CoreAgent) => getCoreAgentLink(agent.id);++export const AgentCoreIndexPage = () => {+ const theme = useTheme();++ const tableId =+ useWorkspaceSurfaceScopedComponentInstanceId(CORE_AGENTS_TABLE_ID);++ const { coreAgents, isInitialLoading, error } = useCoreAgents({ tableId });++ const { createCoreAgent, canCreateCoreAgent, isCreatingCoreAgent } =+ useCreateCoreAgent();++ const hasError = isDefined(error);++ const isEmpty = !isInitialLoading && !hasError && coreAgents.length === 0;++ return (+ <CoreObjectIndexPageLayout+ labelPlural={t`Agents`}+ icon={+ <IconLego size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />+ }+ actionButton={<SidePanelToggleButton />}+ isInitialLoading={isInitialLoading}+ hasError={hasError}+ isEmpty={isEmpty}+ emptyState={{+ title: t`Add your first Agent`,+ subTitle: t`Create an Agent to automate your work.`,+ buttonTitle: t`Add an Agent`,+ onButtonClick: canCreateCoreAgent ? createCoreAgent : undefined,+ }}+ >+ <CoreObjectTable+ tableId={tableId}+ columns={CORE_AGENT_TABLE_COLUMNS}+ items={coreAgents}+ getItemKey={(agent) => agent.id}+ getItemLink={getCoreAgentItemLink}+ initialSort={CORE_AGENTS_INITIAL_SORT}+ />+ {canCreateCoreAgent && (+ <CoreObjectTableAddNewRow+ label={t`New Agent`}+ onClick={createCoreAgent}+ disabled={isCreatingCoreAgent}+ />+ )}+ </CoreObjectIndexPageLayout>+ );+};diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx b/packages/twenty-front/src/pages/object-core/AgentCoreShowPage.tsxsimilarity index 62%rename from packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsxrename to packages/twenty-front/src/pages/object-core/AgentCoreShowPage.tsxindex de1e79f06ce..e300ced3151 100644--- a/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx+++ b/packages/twenty-front/src/pages/object-core/AgentCoreShowPage.tsx@@ -1,33 +1,33 @@import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';-import { useParams } from 'react-router-dom';+import { useParams, useSearchParams } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components';import { useIcons } from 'twenty-ui/icon';import { useTheme } from 'twenty-ui/theme';+import { getCoreAgentBreadcrumbLinks } from '@/object-core/agents/utils/getCoreAgentBreadcrumbLinks';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { FindOneAgentDocument } from '~/generated-metadata/graphql';-import { SettingsAgentDetailSkeletonLoader } from '~/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader';-import { SettingsAgentFormContent } from '~/pages/settings/ai/components/SettingsAgentFormContent';+import { CoreAgentDetailSkeletonLoader } from '@/object-core/agents/components/CoreAgentDetailSkeletonLoader';+import { CoreAgentFormContent } from '@/object-core/agents/components/CoreAgentFormContent';+import { CoreAgentTurnDetail } from '@/object-core/agents/components/CoreAgentTurnDetail';import { useNavigateToNotFoundOnLoadFailure } from '~/pages/settings/ai/hooks/useNavigateToNotFoundOnLoadFailure';-import { getSettingsAiBreadcrumbLinks } from '~/pages/settings/ai/utils/getSettingsAiBreadcrumbLinks';-export const SettingsAgentForm = ({ mode }: { mode: 'create' | 'edit' }) => {+export const AgentCoreShowPage = () => {+ const { agentId = '' } = useParams<{ agentId: string }>();const theme = useTheme();const { getIcon } = useIcons();- const { agentId = '' } = useParams<{ agentId: string }>();-- const isCreateMode = mode === 'create';+ const [searchParams] = useSearchParams();+ const turnId = searchParams.get('turn');const { data, loading, error } = useQuery(FindOneAgentDocument, {variables: { id: agentId },- skip: isCreateMode || !agentId,});const agent = data?.findOneAgent;- const hasFailedToLoad = !isCreateMode && !loading && !isDefined(agent);+ const hasFailedToLoad = !loading && !isDefined(agent);useNavigateToNotFoundOnLoadFailure({hasFailedToLoad,@@ -35,10 +35,6 @@ export const SettingsAgentForm = ({ mode }: { mode: 'create' | 'edit' }) => {notFoundMessage: t`Agent not found`,});- if (isCreateMode) {- return <SettingsAgentFormContent />;- }-if (hasFailedToLoad) {return null;}@@ -52,16 +48,20 @@ export const SettingsAgentForm = ({ mode }: { mode: 'create' | 'edit' }) => {icon={<AgentIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />}- links={getSettingsAiBreadcrumbLinks(t`Agent`)}+ links={getCoreAgentBreadcrumbLinks()}><SettingsPageContainer><Section.Root>- <SettingsAgentDetailSkeletonLoader />+ <CoreAgentDetailSkeletonLoader /></Section.Root></SettingsPageContainer></SettingsPageLayout>);}- return <SettingsAgentFormContent key={agent.id} agent={agent} />;+ if (isDefined(turnId)) {+ return <CoreAgentTurnDetail agent={agent} turnId={turnId} />;+ }++ return <CoreAgentFormContent key={agent.id} agent={agent} />;};diff --git a/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsxindex 54cfbeb871c..e5ab1b711af 100644--- a/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx+++ b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx@@ -1,16 +1,13 @@-import { useEffect } from 'react';-import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';-import { useInView } from 'react-intersection-observer';import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { getAppPath, isDefined } from 'twenty-shared/utils';-import { IconPlus } from 'twenty-ui/icon';import { CommandMenuContextProvider } from '@/command-menu-item/contexts/CommandMenuContextProvider';import { getCommandMenuIdFromRecordIndexId } from '@/command-menu-item/utils/getCommandMenuIdFromRecordIndexId';import { CommandMenuComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuComponentInstanceContext';import { PinnedCommandMenuItemButtons } from '@/command-menu-item/display/components/PinnedCommandMenuItemButtons';import { CommandMenuItemContainerType } from '@/command-menu-item/types/CommandMenuItemContainerType';+import { CoreObjectIndexPageLayout } from '@/object-core/components/CoreObjectIndexPageLayout';import { CoreObjectTable } from '@/object-core/components/CoreObjectTable';import { CoreObjectTableAddNewRow } from '@/object-core/components/CoreObjectTableAddNewRow';import { useCoreWorkflowsSelection } from '@/object-core/workflows/hooks/useCoreWorkflowsSelection';@@ -18,8 +15,6 @@ import { useListenToCoreWorkflowEvents } from '@/object-core/workflows/hooks/useimport { useCreateCoreWorkflow } from '@/object-core/workflows/hooks/useCreateCoreWorkflow';import { coreWorkflowsFilterSettingsState } from '@/object-core/workflows/states/coreWorkflowsFilterSettingsState';import { isUsableCoreWorkflowFilterRule } from '@/object-core/workflows/utils/isUsableCoreWorkflowFilterRule';-import { RecordIndexEmptyStateDisplay } from '@/object-record/record-index/components/RecordIndexEmptyStateDisplay';-import { RecordIndexPageHeaderTitle } from '@/object-record/record-index/components/RecordIndexPageHeaderTitle';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { CoreWorkflowsFilterBar } from '@/object-core/workflows/components/CoreWorkflowsFilterBar';import { WORKFLOW_CORE_TABLE_COLUMNS } from '@/object-core/workflows/constants/WorkflowCoreTableColumns';@@ -32,20 +27,7 @@ import { type CoreWorkflow } from '@/object-core/workflows/types/CoreWorkflow';import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';-import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';-import { PageCardLayout } from '@/ui/layout/page/components/PageCardLayout';import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';-import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';--const StyledTableContainer = styled.div`- height: 100%;- overflow: auto;- width: 100%;-`;--const StyledFetchMoreSentinel = styled.div`- height: 1px;-`;const getCoreWorkflowLink = (workflow: CoreWorkflow) =>getAppPath(AppPath.WorkflowCoreShowPage, { coreWorkflowId: workflow.id });@@ -69,8 +51,6 @@ export const WorkflowCoreIndexPage = () => {refetchLoadedCoreWorkflows,} = useCoreWorkflows({ tableId });- const { ref: fetchMoreRef, inView } = useInView();-const { createCoreWorkflow, canCreateCoreWorkflow, isCreatingCoreWorkflow } =useCreateCoreWorkflow();@@ -100,105 +80,67 @@ export const WorkflowCoreIndexPage = () => {!hasNextPage &&displayedCoreWorkflows.length === 0;- useEffect(() => {- if (inView && hasNextPage && !loading) {- void fetchNextPage();- }- }, [inView, hasNextPage, loading, fetchNextPage]);-return (- <>- <PageTitle title={objectMetadataItem.labelPlural} />- <PageCardLayout- header={- <PageCardHeader- icon={- <ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />- }- title={- <RecordIndexPageHeaderTitle- label={objectMetadataItem.labelPlural}- numberOfSelectedRecords={selectedRowCount}- />- }- actionButton={- <>- <CommandMenuComponentInstanceContext.Provider- value={{- instanceId: getCommandMenuIdFromRecordIndexId(tableId),- }}- >- <CommandMenuContextProvider- displayType="button"- containerType={CommandMenuItemContainerType.IndexPageHeader}- >- <PinnedCommandMenuItemButtons />- </CommandMenuContextProvider>- </CommandMenuComponentInstanceContext.Provider>- <CoreWorkflowsFilterBar />- <SidePanelToggleButton />- </>- }- />- }- >- <StyledTableContainer>- {hasError && (- <RecordIndexEmptyStateDisplay- animatedPlaceholderType="errorIndex"- title={t`Something went wrong`}- subTitle={t`We could not load your ${objectMetadataItem.labelPlural}. Please try again later.`}- />- )}- {isEmpty && (- <RecordIndexEmptyStateDisplay- animatedPlaceholderType={- hasAppliedFilters ? 'noMatchRecord' : 'noRecord'- }- title={- hasAppliedFilters- ? t`No ${objectMetadataItem.labelPlural} found`- : t`Add your first ${objectMetadataItem.labelSingular}`- }- subTitle={- hasAppliedFilters- ? t`No ${objectMetadataItem.labelPlural} match your filters. Try removing some of them.`- : t`Create a ${objectMetadataItem.labelSingular} to automate your work.`- }- ButtonIcon={IconPlus}- buttonTitle={t`Add a ${objectMetadataItem.labelSingular}`}- onButtonClick={- canCreateCoreWorkflow ? createCoreWorkflow : undefined- }- />- )}- {!isInitialLoading && !hasError && !isEmpty && (- <>- <CoreObjectTable- tableId={tableId}- columns={WORKFLOW_CORE_TABLE_COLUMNS}- items={displayedCoreWorkflows}- getItemKey={(workflow) => workflow.id}- getItemLink={getCoreWorkflowLink}- initialSort={CORE_WORKFLOWS_INITIAL_SORT}- selection={{- selectedRowIds,- onToggleRow: toggleRow,- onToggleAllRows: selectRows,- }}- />- {canCreateCoreWorkflow && (- <CoreObjectTableAddNewRow- label={t`New ${objectMetadataItem.labelSingular}`}- onClick={createCoreWorkflow}- disabled={isCreatingCoreWorkflow}- />- )}- {hasNextPage && <StyledFetchMoreSentinel ref={fetchMoreRef} />}- </>- )}- </StyledTableContainer>- </PageCardLayout>- </>+ <CoreObjectIndexPageLayout+ labelPlural={objectMetadataItem.labelPlural}+ icon={<ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />}+ numberOfSelectedRecords={selectedRowCount}+ actionButton={+ <>+ <CommandMenuComponentInstanceContext.Provider+ value={{+ instanceId: getCommandMenuIdFromRecordIndexId(tableId),+ }}+ >+ <CommandMenuContextProvider+ displayType="button"+ containerType={CommandMenuItemContainerType.IndexPageHeader}+ >+ <PinnedCommandMenuItemButtons />+ </CommandMenuContextProvider>+ </CommandMenuComponentInstanceContext.Provider>+ <CoreWorkflowsFilterBar />+ <SidePanelToggleButton />+ </>+ }+ isInitialLoading={isInitialLoading}+ hasError={hasError}+ isEmpty={isEmpty}+ emptyState={{+ hasAppliedFilters,+ title: hasAppliedFilters+ ? t`No ${objectMetadataItem.labelPlural} found`+ : t`Add your first ${objectMetadataItem.labelSingular}`,+ subTitle: hasAppliedFilters+ ? t`No ${objectMetadataItem.labelPlural} match your filters. Try removing some of them.`+ : t`Create a ${objectMetadataItem.labelSingular} to automate your work.`,+ buttonTitle: t`Add a ${objectMetadataItem.labelSingular}`,+ onButtonClick: canCreateCoreWorkflow ? createCoreWorkflow : undefined,+ }}+ hasNextPage={hasNextPage}+ isFetchingNextPage={loading}+ onFetchNextPage={fetchNextPage}+ >+ <CoreObjectTable+ tableId={tableId}+ columns={WORKFLOW_CORE_TABLE_COLUMNS}+ items={displayedCoreWorkflows}+ getItemKey={(workflow) => workflow.id}+ getItemLink={getCoreWorkflowLink}+ initialSort={CORE_WORKFLOWS_INITIAL_SORT}+ selection={{+ selectedRowIds,+ onToggleRow: toggleRow,+ onToggleAllRows: selectRows,+ }}+ />+ {canCreateCoreWorkflow && (+ <CoreObjectTableAddNewRow+ label={t`New ${objectMetadataItem.labelSingular}`}+ onClick={createCoreWorkflow}+ disabled={isCreatingCoreWorkflow}+ />+ )}+ </CoreObjectIndexPageLayout>);};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsxindex 724f8abc34c..0f87e9d0123 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx@@ -15,7 +15,7 @@ import { themeCssVariables } from 'twenty-ui/theme';import { SettingsAgentToolsTable } from '~/pages/settings/ai/components/SettingsAgentToolsTable';import { useSettingsAgentToolsTable } from '~/pages/settings/ai/hooks/useSettingsAgentToolsTable';import { type SettingsAgentToolItem } from '~/pages/settings/ai/types/SettingsAgentToolItem';-import { isOwnedByInstalledApplication } from '~/pages/settings/ai/utils/isOwnedByInstalledApplication';+import { isOwnedByInstalledApplication } from '@/applications/utils/isOwnedByInstalledApplication';import { normalizeSearchText } from '~/utils/normalizeSearchText';const StyledSearchContainer = styled.div`diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.tsdeleted file mode 100644index 3c10752813d..00000000000--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts+++ /dev/null@@ -1,27 +0,0 @@-import { useState } from 'react';-import {- settingsAiAgentFormSchema,- type SettingsAiAgentFormValues,-} from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';--export const useSettingsAgentFormState = (- initialValues: SettingsAiAgentFormValues,-) => {- const [formValues, setFormValues] =- useState<SettingsAiAgentFormValues>(initialValues);- const validateForm = (): boolean =>- settingsAiAgentFormSchema.safeParse(formValues).success;-- const setFieldValue = (- field: keyof SettingsAiAgentFormValues,- value: SettingsAiAgentFormValues[keyof SettingsAiAgentFormValues],- ) => {- setFormValues((previousValues) => ({ ...previousValues, [field]: value }));- };-- return {- formValues,- setFieldValue,- validateForm,- };-};diff --git a/packages/twenty-front/src/pages/settings/ai/utils/getSettingsAgentInitialFormValues.ts b/packages/twenty-front/src/pages/settings/ai/utils/getSettingsAgentInitialFormValues.tsdeleted file mode 100644index 57236921630..00000000000--- a/packages/twenty-front/src/pages/settings/ai/utils/getSettingsAgentInitialFormValues.ts+++ /dev/null@@ -1,42 +0,0 @@-import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';-import { isDefined } from 'twenty-shared/utils';-import { type FindOneAgentQuery } from '~/generated-metadata/graphql';-import { type SettingsAiAgentFormValues } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';--export const getSettingsAgentInitialFormValues = (- agent?: FindOneAgentQuery['findOneAgent'],-): SettingsAiAgentFormValues => {- if (!isDefined(agent)) {- return {- name: '',- label: '',- description: '',- icon: 'IconLego',- modelId: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,- role: null,- prompt: '',- isCustom: true,- modelConfiguration: {},- responseFormat: {- // TODO: Keep text default until legacy text agents are migrated in production.- type: 'text',- },- evaluationInputs: [],- };- }-- return {- name: agent.name,- label: agent.label,- description: agent.description,- icon: agent.icon || 'IconLego',- modelId: agent.modelId,- role: agent.roleId,- prompt: agent.prompt,- isCustom: agent.isCustom,- modelConfiguration: agent.modelConfiguration || {},- // TODO: Fallback can be removed once all text response format agents are migrated.- responseFormat: agent.responseFormat || { type: 'text' },- evaluationInputs: agent.evaluationInputs ?? [],- };-};diff --git a/packages/twenty-front/src/pages/settings/members/roles/SettingsRoleAddObjectLevel.tsx b/packages/twenty-front/src/pages/settings/members/roles/SettingsRoleAddObjectLevel.tsxindex f8c571d37ed..2045775b8a0 100644--- a/packages/twenty-front/src/pages/settings/members/roles/SettingsRoleAddObjectLevel.tsx+++ b/packages/twenty-front/src/pages/settings/members/roles/SettingsRoleAddObjectLevel.tsx@@ -1,3 +1,5 @@+import { getCoreAgentBreadcrumbLinks } from '@/object-core/agents/utils/getCoreAgentBreadcrumbLinks';+import { getCoreAgentLink } from '@/object-core/agents/utils/getCoreAgentLink';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsRoleRouteGuard } from '@/settings/roles/components/SettingsRoleRouteGuard';import { SettingsRolePermissionsObjectLevelObjectPicker } from '@/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker';@@ -36,25 +38,10 @@ export const SettingsRoleAddObjectLevel = () => {const breadcrumbLinks =fromAgentId && isDefined(agent)- ? [- {- children: t`Workspace`,- href: getSettingsPath(SettingsPath.General),- },- {- children: t`AI`,- href: getSettingsPath(SettingsPath.AI),- },- {- children: agent.label,- href: getSettingsPath(SettingsPath.AiAgentDetail, {- agentId: agent.id,- }),- },- {- children: t`Add object permission`,- },- ]+ ? getCoreAgentBreadcrumbLinks([+ { children: agent.label, href: getCoreAgentLink(agent.id) },+ { children: t`Add object permission` },+ ]): [{children: t`Workspace`,diff --git a/packages/twenty-shared/src/types/AppPath.ts b/packages/twenty-shared/src/types/AppPath.tsindex b506e81cb49..a8306f6307f 100644--- a/packages/twenty-shared/src/types/AppPath.ts+++ b/packages/twenty-shared/src/types/AppPath.ts@@ -26,6 +26,8 @@ export enum AppPath {RecordShowPage = '/object/:objectNameSingular/:objectRecordId',PageLayoutPage = '/page/:pageLayoutId',WorkflowCoreShowPage = '/workflow/:coreWorkflowId',+ AgentIndexPage = '/agents',+ AgentShowPage = '/agent/:agentId',Settings = `settings`,SettingsCatchAll = `/${Settings}/*`,diff --git a/packages/twenty-shared/src/types/SettingsPath.ts b/packages/twenty-shared/src/types/SettingsPath.tsindex 51232b0e9d5..c449a5de4d6 100644--- a/packages/twenty-shared/src/types/SettingsPath.ts+++ b/packages/twenty-shared/src/types/SettingsPath.ts@@ -46,9 +46,6 @@ export enum SettingsPath {AI = 'ai',AiUsageUserDetail = 'ai/usage/user/:userWorkspaceId',AiPrompts = 'ai/prompts',- AiNewAgent = 'ai/new-agent',- AiAgentDetail = 'ai/agents/:agentId',- AiAgentTurnDetail = 'ai/agents/:agentId/turns/:turnId',AiNewSkill = 'ai/new-skill',AiSkillDetail = 'ai/skills/:skillId',AiToolDetail = 'ai/tools/:toolIdentifier',