The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Inbox: chat subscriptions and server-side mentions (#27430)
Félix Malfaitcc8b196d3a60
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex d11b476f704..6a674c50a02 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -53,6 +53,8 @@ type AgentChatThread {type AgentChatThreadParticipant {archivedAt: DateTimeid: UUID!+ isSubscribed: Boolean!+ lastMentionedAt: DateTimelastReadAt: DateTimesnoozedUntil: DateTimethreadId: UUID!@@ -1903,10 +1905,12 @@ enum EngineComponentKey {SHARE_RECORDSNOOZE_AI_CHATSTOP_WORKFLOW_RUN+ SUBSCRIBE_TO_AI_CHATTEST_WORKFLOWTIDY_UP_WORKFLOWTOGGLE_WORKFLOW_VISIBILITYTRIGGER_WORKFLOW_VERSION+ UNSUBSCRIBE_FROM_AI_CHATUPDATE_MULTIPLE_RECORDSUSE_AS_DRAFT_WORKFLOW_VERSIONVIEW_PREVIOUS_AI_CHATS@@ -3097,7 +3101,7 @@ type Mutation {runAgent(input: RunAgentInput!): RunAgentResult!runApplicationHealthCheck(applicationId: UUID!): ApplicationHealthCheckResultsaveImapSmtpCaldavAccount(connectionParameters: EmailAccountConnectionParameters!, handle: String!, id: UUID): ImapSmtpCaldavConnectionSuccess!- sendChatMessage(browsingContext: JSON, fileAttachments: [FileAttachmentInput!], messageId: UUID!, modelId: String, text: String!, threadId: UUID!): SendChatMessageResult!+ sendChatMessage(browsingContext: JSON, fileAttachments: [FileAttachmentInput!], mentionedWorkspaceMemberIds: [UUID!], messageId: UUID!, modelId: String, text: String!, threadId: UUID!): SendChatMessageResult!sendEmail(input: SendEmailInput!): SendEmailOutput!sendInboxMessage(input: SendInboxMessageInput!): SendInboxMessageResult!sendInvitations(emails: [String!]!, roleId: UUID): SendInvitations!@@ -3119,6 +3123,7 @@ type Mutation {startWorkspaceSetupChat(companyContext: JSON, personContext: JSON): StartWorkspaceSetupChatResult!stopAgentChatStream(threadId: UUID!): Boolean!stopImpersonation: StopImpersonation!+ subscribeToAgentChatThread(threadId: UUID!): AgentChatThreadParticipant!switchBillingPlan: BillingUpdate!switchSubscriptionInterval: BillingUpdate!syncApplication(dryRun: Boolean, inferDeletionFromMissingEntities: Boolean, manifest: JSON!): WorkspaceMigration!@@ -3128,6 +3133,7 @@ type Mutation {triggerInstallApplicationJob(input: TriggerInstallApplicationJobInput!): TriggerInstallApplicationJobResult!triggerUninstallApplicationJob(input: TriggerUninstallApplicationJobInput!): TriggerUninstallApplicationJobResult!uninstallApplication(universalIdentifier: String!): Boolean!+ unsubscribeFromAgentChatThread(threadId: UUID!): AgentChatThreadParticipant!updateApiKey(input: UpdateApiKeyInput!): ApiKeyupdateAppMessageChannel(input: UpdateAppMessageChannelInput!): MessageChannel!updateApplication(id: UUID!, input: UpdateApplicationInput!): Application!@@ -4174,6 +4180,7 @@ type SearchField {}type SendChatMessageResult {+ mentionedParticipantWorkspaceMemberIds: [UUID!]messageId: Stringqueued: Boolean!streamId: Stringdiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 8fd1132a219..74b7b07c08f 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -59,6 +59,8 @@ export interface AgentChatThread {export interface AgentChatThreadParticipant {archivedAt?: Scalars['DateTime']id: Scalars['UUID']+ isSubscribed: Scalars['Boolean']+ lastMentionedAt?: Scalars['DateTime']lastReadAt?: Scalars['DateTime']snoozedUntil?: Scalars['DateTime']threadId: Scalars['UUID']@@ -1239,7 +1241,7 @@ export interface EmailsConfiguration {__typename: 'EmailsConfiguration'}-export type EngineComponentKey = 'ACTIVATE_WORKFLOW' | 'ADD_NODE_WORKFLOW' | 'ADD_TO_FAVORITES' | 'ASK_AI' | 'CANCEL_DASHBOARD_LAYOUT' | 'CANCEL_MESSAGE_CAMPAIGN' | 'COMPOSE_CAMPAIGN' | 'COMPOSE_EMAIL' | 'CREATE_NEW_RECORD' | 'CREATE_NEW_VIEW' | 'DEACTIVATE_WORKFLOW' | 'DELETE_MULTIPLE_RECORDS' | 'DELETE_RECORDS' | 'DELETE_SINGLE_RECORD' | 'DESTROY_MULTIPLE_RECORDS' | 'DESTROY_RECORDS' | 'DESTROY_SINGLE_RECORD' | 'DISCARD_DRAFT_WORKFLOW' | 'DUPLICATE_DASHBOARD' | 'DUPLICATE_MESSAGE_CAMPAIGN' | 'DUPLICATE_MESSAGE_LIST' | 'DUPLICATE_WORKFLOW' | 'EDIT_DASHBOARD_LAYOUT' | 'EDIT_RECORD_PAGE_LAYOUT' | 'EMAIL_BLOCK_SETTINGS' | 'EXPORT_FROM_RECORD_INDEX' | 'EXPORT_FROM_RECORD_SHOW' | 'EXPORT_MULTIPLE_RECORDS' | 'EXPORT_NOTE_TO_PDF' | 'EXPORT_RECORDS' | 'EXPORT_VIEW' | 'FRONT_COMPONENT_RENDERER' | 'GO_TO_COMPANIES' | 'GO_TO_DASHBOARDS' | 'GO_TO_NOTES' | 'GO_TO_OPPORTUNITIES' | 'GO_TO_PEOPLE' | 'GO_TO_RUNS' | 'GO_TO_SETTINGS' | 'GO_TO_TASKS' | 'GO_TO_WORKFLOWS' | 'HIDE_DELETED_RECORDS' | 'IMPORT_RECORDS' | 'MARK_AI_CHAT_AS_DONE' | 'MARK_AI_CHAT_AS_READ' | 'MARK_AI_CHAT_AS_UNREAD' | 'MERGE_MULTIPLE_RECORDS' | 'NAVIGATE_TO_NEXT_RECORD' | 'NAVIGATE_TO_PREVIOUS_RECORD' | 'NAVIGATION' | 'NEW_AI_CHAT' | 'REMOVE_FROM_FAVORITES' | 'REOPEN_AI_CHAT' | 'REPLY_TO_EMAIL_THREAD' | 'RESTORE_MULTIPLE_RECORDS' | 'RESTORE_RECORDS' | 'RESTORE_SINGLE_RECORD' | 'RETRY_WORKFLOW_RUN' | 'SAVE_DASHBOARD_LAYOUT' | 'SEARCH_RECORDS' | 'SEARCH_RECORDS_FALLBACK' | 'SEE_ACTIVE_VERSION_WORKFLOW' | 'SEE_DELETED_RECORDS' | 'SEE_RUNS_WORKFLOW' | 'SEE_RUNS_WORKFLOW_VERSION' | 'SEE_VERSIONS_WORKFLOW' | 'SEE_VERSIONS_WORKFLOW_VERSION' | 'SEE_VERSION_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_VERSION' | 'SEND_MESSAGE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN_TEST' | 'SHARE_RECORD' | 'SNOOZE_AI_CHAT' | 'STOP_WORKFLOW_RUN' | 'TEST_WORKFLOW' | 'TIDY_UP_WORKFLOW' | 'TOGGLE_WORKFLOW_VISIBILITY' | 'TRIGGER_WORKFLOW_VERSION' | 'UPDATE_MULTIPLE_RECORDS' | 'USE_AS_DRAFT_WORKFLOW_VERSION' | 'VIEW_PREVIOUS_AI_CHATS'+export type EngineComponentKey = 'ACTIVATE_WORKFLOW' | 'ADD_NODE_WORKFLOW' | 'ADD_TO_FAVORITES' | 'ASK_AI' | 'CANCEL_DASHBOARD_LAYOUT' | 'CANCEL_MESSAGE_CAMPAIGN' | 'COMPOSE_CAMPAIGN' | 'COMPOSE_EMAIL' | 'CREATE_NEW_RECORD' | 'CREATE_NEW_VIEW' | 'DEACTIVATE_WORKFLOW' | 'DELETE_MULTIPLE_RECORDS' | 'DELETE_RECORDS' | 'DELETE_SINGLE_RECORD' | 'DESTROY_MULTIPLE_RECORDS' | 'DESTROY_RECORDS' | 'DESTROY_SINGLE_RECORD' | 'DISCARD_DRAFT_WORKFLOW' | 'DUPLICATE_DASHBOARD' | 'DUPLICATE_MESSAGE_CAMPAIGN' | 'DUPLICATE_MESSAGE_LIST' | 'DUPLICATE_WORKFLOW' | 'EDIT_DASHBOARD_LAYOUT' | 'EDIT_RECORD_PAGE_LAYOUT' | 'EMAIL_BLOCK_SETTINGS' | 'EXPORT_FROM_RECORD_INDEX' | 'EXPORT_FROM_RECORD_SHOW' | 'EXPORT_MULTIPLE_RECORDS' | 'EXPORT_NOTE_TO_PDF' | 'EXPORT_RECORDS' | 'EXPORT_VIEW' | 'FRONT_COMPONENT_RENDERER' | 'GO_TO_COMPANIES' | 'GO_TO_DASHBOARDS' | 'GO_TO_NOTES' | 'GO_TO_OPPORTUNITIES' | 'GO_TO_PEOPLE' | 'GO_TO_RUNS' | 'GO_TO_SETTINGS' | 'GO_TO_TASKS' | 'GO_TO_WORKFLOWS' | 'HIDE_DELETED_RECORDS' | 'IMPORT_RECORDS' | 'MARK_AI_CHAT_AS_DONE' | 'MARK_AI_CHAT_AS_READ' | 'MARK_AI_CHAT_AS_UNREAD' | 'MERGE_MULTIPLE_RECORDS' | 'NAVIGATE_TO_NEXT_RECORD' | 'NAVIGATE_TO_PREVIOUS_RECORD' | 'NAVIGATION' | 'NEW_AI_CHAT' | 'REMOVE_FROM_FAVORITES' | 'REOPEN_AI_CHAT' | 'REPLY_TO_EMAIL_THREAD' | 'RESTORE_MULTIPLE_RECORDS' | 'RESTORE_RECORDS' | 'RESTORE_SINGLE_RECORD' | 'RETRY_WORKFLOW_RUN' | 'SAVE_DASHBOARD_LAYOUT' | 'SEARCH_RECORDS' | 'SEARCH_RECORDS_FALLBACK' | 'SEE_ACTIVE_VERSION_WORKFLOW' | 'SEE_DELETED_RECORDS' | 'SEE_RUNS_WORKFLOW' | 'SEE_RUNS_WORKFLOW_VERSION' | 'SEE_VERSIONS_WORKFLOW' | 'SEE_VERSIONS_WORKFLOW_VERSION' | 'SEE_VERSION_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_VERSION' | 'SEND_MESSAGE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN_TEST' | 'SHARE_RECORD' | 'SNOOZE_AI_CHAT' | 'STOP_WORKFLOW_RUN' | 'SUBSCRIBE_TO_AI_CHAT' | 'TEST_WORKFLOW' | 'TIDY_UP_WORKFLOW' | 'TOGGLE_WORKFLOW_VISIBILITY' | 'TRIGGER_WORKFLOW_VERSION' | 'UNSUBSCRIBE_FROM_AI_CHAT' | 'UPDATE_MULTIPLE_RECORDS' | 'USE_AS_DRAFT_WORKFLOW_VERSION' | 'VIEW_PREVIOUS_AI_CHATS'export interface EnqueueJobResult {enqueued: Scalars['Boolean']@@ -2174,6 +2176,7 @@ export interface Mutation {startWorkspaceSetupChat: StartWorkspaceSetupChatResultstopAgentChatStream: Scalars['Boolean']stopImpersonation: StopImpersonation+ subscribeToAgentChatThread: AgentChatThreadParticipantswitchBillingPlan: BillingUpdateswitchSubscriptionInterval: BillingUpdatesyncApplication: WorkspaceMigration@@ -2183,6 +2186,7 @@ export interface Mutation {triggerInstallApplicationJob: TriggerInstallApplicationJobResulttriggerUninstallApplicationJob: TriggerUninstallApplicationJobResultuninstallApplication: Scalars['Boolean']+ unsubscribeFromAgentChatThread: AgentChatThreadParticipantupdateApiKey?: ApiKeyupdateAppMessageChannel: MessageChannelupdateApplication: Application@@ -3037,6 +3041,7 @@ export interface SearchField {}export interface SendChatMessageResult {+ mentionedParticipantWorkspaceMemberIds?: Scalars['UUID'][]messageId?: Scalars['String']queued: Scalars['Boolean']streamId?: Scalars['String']@@ -3897,6 +3902,8 @@ export interface AgentChatThreadGenqlSelection{export interface AgentChatThreadParticipantGenqlSelection{archivedAt?: boolean | numberid?: boolean | number+ isSubscribed?: boolean | number+ lastMentionedAt?: boolean | numberlastReadAt?: boolean | numbersnoozedUntil?: boolean | numberthreadId?: boolean | number@@ -6259,7 +6266,7 @@ export interface MutationGenqlSelection{runAgent?: (RunAgentResultGenqlSelection & { __args: {input: RunAgentInput} })runApplicationHealthCheck?: (ApplicationHealthCheckResultGenqlSelection & { __args: {applicationId: Scalars['UUID']} })saveImapSmtpCaldavAccount?: (ImapSmtpCaldavConnectionSuccessGenqlSelection & { __args: {connectionParameters: EmailAccountConnectionParameters, handle: Scalars['String'], id?: (Scalars['UUID'] | null)} })- sendChatMessage?: (SendChatMessageResultGenqlSelection & { __args: {browsingContext?: (Scalars['JSON'] | null), fileAttachments?: (FileAttachmentInput[] | null), messageId: Scalars['UUID'], modelId?: (Scalars['String'] | null), text: Scalars['String'], threadId: Scalars['UUID']} })+ sendChatMessage?: (SendChatMessageResultGenqlSelection & { __args: {browsingContext?: (Scalars['JSON'] | null), fileAttachments?: (FileAttachmentInput[] | null), mentionedWorkspaceMemberIds?: (Scalars['UUID'][] | null), messageId: Scalars['UUID'], modelId?: (Scalars['String'] | null), text: Scalars['String'], threadId: Scalars['UUID']} })sendEmail?: (SendEmailOutputGenqlSelection & { __args: {input: SendEmailInput} })sendInboxMessage?: (SendInboxMessageResultGenqlSelection & { __args: {input: SendInboxMessageInput} })sendInvitations?: (SendInvitationsGenqlSelection & { __args: {emails: Scalars['String'][], roleId?: (Scalars['UUID'] | null)} })@@ -6281,6 +6288,7 @@ export interface MutationGenqlSelection{startWorkspaceSetupChat?: (StartWorkspaceSetupChatResultGenqlSelection & { __args?: {companyContext?: (Scalars['JSON'] | null), personContext?: (Scalars['JSON'] | null)} })stopAgentChatStream?: { __args: {threadId: Scalars['UUID']} }stopImpersonation?: StopImpersonationGenqlSelection+ subscribeToAgentChatThread?: (AgentChatThreadParticipantGenqlSelection & { __args: {threadId: Scalars['UUID']} })switchBillingPlan?: BillingUpdateGenqlSelectionswitchSubscriptionInterval?: BillingUpdateGenqlSelectionsyncApplication?: (WorkspaceMigrationGenqlSelection & { __args: {dryRun?: (Scalars['Boolean'] | null), inferDeletionFromMissingEntities?: (Scalars['Boolean'] | null), manifest: Scalars['JSON']} })@@ -6290,6 +6298,7 @@ export interface MutationGenqlSelection{triggerInstallApplicationJob?: (TriggerInstallApplicationJobResultGenqlSelection & { __args: {input: TriggerInstallApplicationJobInput} })triggerUninstallApplicationJob?: (TriggerUninstallApplicationJobResultGenqlSelection & { __args: {input: TriggerUninstallApplicationJobInput} })uninstallApplication?: { __args: {universalIdentifier: Scalars['String']} }+ unsubscribeFromAgentChatThread?: (AgentChatThreadParticipantGenqlSelection & { __args: {threadId: Scalars['UUID']} })updateApiKey?: (ApiKeyGenqlSelection & { __args: {input: UpdateApiKeyInput} })updateAppMessageChannel?: (MessageChannelGenqlSelection & { __args: {input: UpdateAppMessageChannelInput} })updateApplication?: (ApplicationGenqlSelection & { __args: {id: Scalars['UUID'], input: UpdateApplicationInput} })@@ -7214,6 +7223,7 @@ export interface SearchFieldGenqlSelection{}export interface SendChatMessageResultGenqlSelection{+ mentionedParticipantWorkspaceMemberIds?: boolean | numbermessageId?: boolean | numberqueued?: boolean | numberstreamId?: boolean | number@@ -11160,10 +11170,12 @@ export const enumEngineComponentKey = {SHARE_RECORD: 'SHARE_RECORD' as const,SNOOZE_AI_CHAT: 'SNOOZE_AI_CHAT' as const,STOP_WORKFLOW_RUN: 'STOP_WORKFLOW_RUN' as const,+ SUBSCRIBE_TO_AI_CHAT: 'SUBSCRIBE_TO_AI_CHAT' as const,TEST_WORKFLOW: 'TEST_WORKFLOW' as const,TIDY_UP_WORKFLOW: 'TIDY_UP_WORKFLOW' as const,TOGGLE_WORKFLOW_VISIBILITY: 'TOGGLE_WORKFLOW_VISIBILITY' as const,TRIGGER_WORKFLOW_VERSION: 'TRIGGER_WORKFLOW_VERSION' as const,+ UNSUBSCRIBE_FROM_AI_CHAT: 'UNSUBSCRIBE_FROM_AI_CHAT' as const,UPDATE_MULTIPLE_RECORDS: 'UPDATE_MULTIPLE_RECORDS' as const,USE_AS_DRAFT_WORKFLOW_VERSION: 'USE_AS_DRAFT_WORKFLOW_VERSION' as const,VIEW_PREVIOUS_AI_CHATS: 'VIEW_PREVIOUS_AI_CHATS' as constdiff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.tsindex b24490e1de8..e8f38e9207e 100644--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts@@ -256,6 +256,12 @@ export default {"id": [477],+ "isSubscribed": [+ 4+ ],+ "lastMentionedAt": [+ 184+ ],"lastReadAt": [184],@@ -7545,6 +7551,10 @@ export default {251,"[FileAttachmentInput!]"],+ "mentionedWorkspaceMemberIds": [+ 477,+ "[UUID!]"+ ],"messageId": [477,"UUID!"@@ -7812,6 +7822,15 @@ export default {"stopImpersonation": [458],+ "subscribeToAgentChatThread": [+ 10,+ {+ "threadId": [+ 477,+ "UUID!"+ ]+ }+ ],"switchBillingPlan": [103],@@ -7894,6 +7913,15 @@ export default {]}],+ "unsubscribeFromAgentChatThread": [+ 10,+ {+ "threadId": [+ 477,+ "UUID!"+ ]+ }+ ],"updateApiKey": [26,{@@ -11187,6 +11215,9 @@ export default {]},"SendChatMessageResult": {+ "mentionedParticipantWorkspaceMemberIds": [+ 477+ ],"messageId": [1],diff --git a/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx b/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdxindex e3f6746f420..0145603ebb8 100644--- a/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx@@ -47,6 +47,7 @@ Supported props: `color`, `size`, `stroke`, `title`. Native SVG attributes and r- `IconBadge2k`- `IconBaselineDensitySmall`- `IconBell`+- `IconBellOff`- `IconBlockquote`- `IconBold`- `IconBolt`diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 556359f6609..0138f8f0ec2 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -79,6 +79,8 @@ export type AgentChatThreadParticipant = {__typename?: 'AgentChatThreadParticipant';archivedAt?: Maybe<Scalars['DateTime']['output']>;id: Scalars['UUID']['output'];+ isSubscribed: Scalars['Boolean']['output'];+ lastMentionedAt?: Maybe<Scalars['DateTime']['output']>;lastReadAt?: Maybe<Scalars['DateTime']['output']>;snoozedUntil?: Maybe<Scalars['DateTime']['output']>;threadId: Scalars['UUID']['output'];@@ -2013,10 +2015,12 @@ export enum EngineComponentKey {SHARE_RECORD = 'SHARE_RECORD',SNOOZE_AI_CHAT = 'SNOOZE_AI_CHAT',STOP_WORKFLOW_RUN = 'STOP_WORKFLOW_RUN',+ SUBSCRIBE_TO_AI_CHAT = 'SUBSCRIBE_TO_AI_CHAT',TEST_WORKFLOW = 'TEST_WORKFLOW',TIDY_UP_WORKFLOW = 'TIDY_UP_WORKFLOW',TOGGLE_WORKFLOW_VISIBILITY = 'TOGGLE_WORKFLOW_VISIBILITY',TRIGGER_WORKFLOW_VERSION = 'TRIGGER_WORKFLOW_VERSION',+ UNSUBSCRIBE_FROM_AI_CHAT = 'UNSUBSCRIBE_FROM_AI_CHAT',UPDATE_MULTIPLE_RECORDS = 'UPDATE_MULTIPLE_RECORDS',USE_AS_DRAFT_WORKFLOW_VERSION = 'USE_AS_DRAFT_WORKFLOW_VERSION',VIEW_PREVIOUS_AI_CHATS = 'VIEW_PREVIOUS_AI_CHATS'@@ -3281,6 +3285,7 @@ export type Mutation = {startWorkspaceSetupChat: StartWorkspaceSetupChatResult;stopAgentChatStream: Scalars['Boolean']['output'];stopImpersonation: StopImpersonation;+ subscribeToAgentChatThread: AgentChatThreadParticipant;switchBillingPlan: BillingUpdate;switchSubscriptionInterval: BillingUpdate;syncApplication: WorkspaceMigration;@@ -3290,6 +3295,7 @@ export type Mutation = {triggerInstallApplicationJob: TriggerInstallApplicationJobResult;triggerUninstallApplicationJob: TriggerUninstallApplicationJobResult;uninstallApplication: Scalars['Boolean']['output'];+ unsubscribeFromAgentChatThread: AgentChatThreadParticipant;updateApiKey?: Maybe<ApiKey>;updateAppMessageChannel: MessageChannel;updateApplication: Application;@@ -4198,6 +4204,7 @@ export type MutationSaveImapSmtpCaldavAccountArgs = {export type MutationSendChatMessageArgs = {browsingContext?: InputMaybe<Scalars['JSON']['input']>;fileAttachments?: InputMaybe<Array<FileAttachmentInput>>;+ mentionedWorkspaceMemberIds?: InputMaybe<Array<Scalars['UUID']['input']>>;messageId: Scalars['UUID']['input'];modelId?: InputMaybe<Scalars['String']['input']>;text: Scalars['String']['input'];@@ -4326,6 +4333,11 @@ export type MutationStopAgentChatStreamArgs = {};+export type MutationSubscribeToAgentChatThreadArgs = {+ threadId: Scalars['UUID']['input'];+};++export type MutationSyncApplicationArgs = {dryRun?: InputMaybe<Scalars['Boolean']['input']>;inferDeletionFromMissingEntities?: InputMaybe<Scalars['Boolean']['input']>;@@ -4362,6 +4374,11 @@ export type MutationUninstallApplicationArgs = {};+export type MutationUnsubscribeFromAgentChatThreadArgs = {+ threadId: Scalars['UUID']['input'];+};++export type MutationUpdateApiKeyArgs = {input: UpdateApiKeyInput;};@@ -6213,6 +6230,7 @@ export type SearchField = {export type SendChatMessageResult = {__typename?: 'SendChatMessageResult';+ mentionedParticipantWorkspaceMemberIds?: Maybe<Array<Scalars['UUID']['output']>>;messageId?: Maybe<Scalars['String']['output']>;queued: Scalars['Boolean']['output'];streamId?: Maybe<Scalars['String']['output']>;@@ -8036,7 +8054,7 @@ export type FindManyTimelineActivityTypesQueryVariables = Exact<{ [key: string]:export type FindManyTimelineActivityTypesQuery = { __typename?: 'Query', timelineActivityTypes: Array<{ __typename?: 'TimelineActivityType', id: string, applicationId?: string | null, universalIdentifier: string, name: string, label: string, icon?: string | null, frontComponentUniversalIdentifier?: string | null, isActive: boolean, emit?: { __typename?: 'TimelineActivityTypeEmit', on: string, objectUniversalIdentifier?: string | null } | null }> };-export type AgentChatThreadParticipantFieldsFragment = { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string };+export type AgentChatThreadParticipantFieldsFragment = { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string };export type AgentFieldsFragment = { __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, isSystem: boolean, modelConfiguration?: any | null, triggers: Array<any>, applicationId?: string | null, createdAt: string, updatedAt: string };@@ -8049,20 +8067,12 @@ export type ActivateSkillMutationVariables = Exact<{export type ActivateSkillMutation = { __typename?: 'Mutation', activateSkill: { __typename?: 'Skill', id: string, name: string, label: string, description?: string | null, icon?: string | null, content: string, isCustom: boolean, isSystem: boolean, isActive: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } };-export type AddAgentChatThreadParticipantsMutationVariables = Exact<{- threadId: Scalars['UUID']['input'];- workspaceMemberIds: Array<Scalars['UUID']['input']> | Scalars['UUID']['input'];-}>;---export type AddAgentChatThreadParticipantsMutation = { __typename?: 'Mutation', addAgentChatThreadParticipants: Array<string> };-export type ArchiveAgentChatThreadMutationVariables = Exact<{threadId: Scalars['UUID']['input'];}>;-export type ArchiveAgentChatThreadMutation = { __typename?: 'Mutation', archiveAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string } };+export type ArchiveAgentChatThreadMutation = { __typename?: 'Mutation', archiveAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };export type AssignRoleToAgentMutationVariables = Exact<{agentId: Scalars['UUID']['input'];@@ -8124,21 +8134,21 @@ export type MarkAgentChatThreadAsReadMutationVariables = Exact<{}>;-export type MarkAgentChatThreadAsReadMutation = { __typename?: 'Mutation', markAgentChatThreadAsRead: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string } };+export type MarkAgentChatThreadAsReadMutation = { __typename?: 'Mutation', markAgentChatThreadAsRead: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };export type MarkAgentChatThreadAsUnreadMutationVariables = Exact<{threadId: Scalars['UUID']['input'];}>;-export type MarkAgentChatThreadAsUnreadMutation = { __typename?: 'Mutation', markAgentChatThreadAsUnread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string } };+export type MarkAgentChatThreadAsUnreadMutation = { __typename?: 'Mutation', markAgentChatThreadAsUnread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };export type MoveAgentChatThreadToInboxMutationVariables = Exact<{threadId: Scalars['UUID']['input'];}>;-export type MoveAgentChatThreadToInboxMutation = { __typename?: 'Mutation', moveAgentChatThreadToInbox: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string } };+export type MoveAgentChatThreadToInboxMutation = { __typename?: 'Mutation', moveAgentChatThreadToInbox: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };export type RetryChatMessageMutationVariables = Exact<{threadId: Scalars['UUID']['input'];@@ -8155,10 +8165,11 @@ export type SendChatMessageMutationVariables = Exact<{browsingContext?: InputMaybe<Scalars['JSON']['input']>;modelId?: InputMaybe<Scalars['String']['input']>;fileAttachments?: InputMaybe<Array<FileAttachmentInput> | FileAttachmentInput>;+ mentionedWorkspaceMemberIds?: InputMaybe<Array<Scalars['UUID']['input']> | Scalars['UUID']['input']>;}>;-export type SendChatMessageMutation = { __typename?: 'Mutation', sendChatMessage: { __typename?: 'SendChatMessageResult', messageId?: string | null, queued: boolean, streamId?: string | null } };+export type SendChatMessageMutation = { __typename?: 'Mutation', sendChatMessage: { __typename?: 'SendChatMessageResult', messageId?: string | null, queued: boolean, streamId?: string | null, mentionedParticipantWorkspaceMemberIds?: Array<string> | null } };export type SnoozeAgentChatThreadMutationVariables = Exact<{threadId: Scalars['UUID']['input'];@@ -8166,7 +8177,7 @@ export type SnoozeAgentChatThreadMutationVariables = Exact<{}>;-export type SnoozeAgentChatThreadMutation = { __typename?: 'Mutation', snoozeAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, updatedAt: string } };+export type SnoozeAgentChatThreadMutation = { __typename?: 'Mutation', snoozeAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };export type StopAgentChatStreamMutationVariables = Exact<{threadId: Scalars['UUID']['input'];@@ -8175,6 +8186,20 @@ export type StopAgentChatStreamMutationVariables = Exact<{export type StopAgentChatStreamMutation = { __typename?: 'Mutation', stopAgentChatStream: boolean };+export type SubscribeToAgentChatThreadMutationVariables = Exact<{+ threadId: Scalars['UUID']['input'];+}>;+++export type SubscribeToAgentChatThreadMutation = { __typename?: 'Mutation', subscribeToAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };++export type UnsubscribeFromAgentChatThreadMutationVariables = Exact<{+ threadId: Scalars['UUID']['input'];+}>;+++export type UnsubscribeFromAgentChatThreadMutation = { __typename?: 'Mutation', unsubscribeFromAgentChatThread: { __typename?: 'AgentChatThreadParticipant', id: string, threadId: string, lastReadAt?: string | null, archivedAt?: string | null, snoozedUntil?: string | null, isSubscribed: boolean, lastMentionedAt?: string | null, updatedAt: string } };+export type UpdateOneAgentMutationVariables = Exact<{input: UpdateAgentInput;}>;@@ -10639,7 +10664,7 @@ export type FindManyMarketplaceAppsForToolTableQueryVariables = Exact<{ [key: stexport type FindManyMarketplaceAppsForToolTableQuery = { __typename?: 'Query', findManyMarketplaceApps: Array<{ __typename?: 'MarketplaceApp', id: string, logoUrl?: string | null }> };-export const AgentChatThreadParticipantFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<AgentChatThreadParticipantFieldsFragment, unknown>;+export const AgentChatThreadParticipantFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<AgentChatThreadParticipantFieldsFragment, unknown>;export const SkillFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SkillFieldsFragment, unknown>;export const AgentFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<AgentFieldsFragment, unknown>;export const ObjectMetadataFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"sharingReach"}},{"kind":"Field","name":{"kind":"Name","value":"readability"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<ObjectMetadataFieldsFragment, unknown>;@@ -10700,8 +10725,7 @@ export const ResetTimelineActivityTypeDocument = {"kind":"Document","definitionsexport const UpdateTimelineActivityTypeIsActiveDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTimelineActivityTypeIsActive"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTimelineActivityTypeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTimelineActivityType"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]}}]} as unknown as DocumentNode<UpdateTimelineActivityTypeIsActiveMutation, UpdateTimelineActivityTypeIsActiveMutationVariables>;export const FindManyTimelineActivityTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyTimelineActivityTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"timelineActivityTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"emit"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"on"}},{"kind":"Field","name":{"kind":"Name","value":"objectUniversalIdentifier"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentUniversalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]}}]} as unknown as DocumentNode<FindManyTimelineActivityTypesQuery, FindManyTimelineActivityTypesQueryVariables>;export const ActivateSkillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ActivateSkill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activateSkill"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<ActivateSkillMutation, ActivateSkillMutationVariables>;-export const AddAgentChatThreadParticipantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddAgentChatThreadParticipants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addAgentChatThreadParticipants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"workspaceMemberIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIds"}}}]}]}}]} as unknown as DocumentNode<AddAgentChatThreadParticipantsMutation, AddAgentChatThreadParticipantsMutationVariables>;-export const ArchiveAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ArchiveAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"archiveAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<ArchiveAgentChatThreadMutation, ArchiveAgentChatThreadMutationVariables>;+export const ArchiveAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ArchiveAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"archiveAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<ArchiveAgentChatThreadMutation, ArchiveAgentChatThreadMutationVariables>;export const AssignRoleToAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignRoleToAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"roleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignRoleToAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"agentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"roleId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"roleId"}}}]}]}}]} as unknown as DocumentNode<AssignRoleToAgentMutation, AssignRoleToAgentMutationVariables>;export const CreateChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateChatThread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createChatThread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<CreateChatThreadMutation, CreateChatThreadMutationVariables>;export const CreateOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAgentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<CreateOneAgentMutation, CreateOneAgentMutationVariables>;@@ -10710,13 +10734,15 @@ export const DeactivateSkillDocument = {"kind":"Document","definitions":[{"kind"export const DeleteOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AgentIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteOneAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<DeleteOneAgentMutation, DeleteOneAgentMutationVariables>;export const DeleteQueuedChatMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteQueuedChatMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteQueuedChatMessage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"messageId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}}}]}]}}]} as unknown as DocumentNode<DeleteQueuedChatMessageMutation, DeleteQueuedChatMessageMutationVariables>;export const DeleteSkillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteSkill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteSkill"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<DeleteSkillMutation, DeleteSkillMutationVariables>;-export const MarkAgentChatThreadAsReadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkAgentChatThreadAsRead"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markAgentChatThreadAsRead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MarkAgentChatThreadAsReadMutation, MarkAgentChatThreadAsReadMutationVariables>;-export const MarkAgentChatThreadAsUnreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkAgentChatThreadAsUnread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markAgentChatThreadAsUnread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MarkAgentChatThreadAsUnreadMutation, MarkAgentChatThreadAsUnreadMutationVariables>;-export const MoveAgentChatThreadToInboxDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MoveAgentChatThreadToInbox"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"moveAgentChatThreadToInbox"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MoveAgentChatThreadToInboxMutation, MoveAgentChatThreadToInboxMutationVariables>;+export const MarkAgentChatThreadAsReadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkAgentChatThreadAsRead"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markAgentChatThreadAsRead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MarkAgentChatThreadAsReadMutation, MarkAgentChatThreadAsReadMutationVariables>;+export const MarkAgentChatThreadAsUnreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkAgentChatThreadAsUnread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markAgentChatThreadAsUnread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MarkAgentChatThreadAsUnreadMutation, MarkAgentChatThreadAsUnreadMutationVariables>;+export const MoveAgentChatThreadToInboxDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MoveAgentChatThreadToInbox"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"moveAgentChatThreadToInbox"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<MoveAgentChatThreadToInboxMutation, MoveAgentChatThreadToInboxMutationVariables>;export const RetryChatMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RetryChatMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"retryChatMessage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"queued"}},{"kind":"Field","name":{"kind":"Name","value":"streamId"}}]}}]}}]} as unknown as DocumentNode<RetryChatMessageMutation, RetryChatMessageMutationVariables>;-export const SendChatMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendChatMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"text"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"browsingContext"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fileAttachments"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"FileAttachmentInput"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sendChatMessage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"text"},"value":{"kind":"Variable","name":{"kind":"Name","value":"text"}}},{"kind":"Argument","name":{"kind":"Name","value":"messageId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}}},{"kind":"Argument","name":{"kind":"Name","value":"browsingContext"},"value":{"kind":"Variable","name":{"kind":"Name","value":"browsingContext"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}},{"kind":"Argument","name":{"kind":"Name","value":"fileAttachments"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fileAttachments"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"queued"}},{"kind":"Field","name":{"kind":"Name","value":"streamId"}}]}}]}}]} as unknown as DocumentNode<SendChatMessageMutation, SendChatMessageMutationVariables>;-export const SnoozeAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SnoozeAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"snoozedUntil"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"snoozeAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"snoozedUntil"},"value":{"kind":"Variable","name":{"kind":"Name","value":"snoozedUntil"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SnoozeAgentChatThreadMutation, SnoozeAgentChatThreadMutationVariables>;+export const SendChatMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendChatMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"text"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"browsingContext"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fileAttachments"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"FileAttachmentInput"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"mentionedWorkspaceMemberIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sendChatMessage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"text"},"value":{"kind":"Variable","name":{"kind":"Name","value":"text"}}},{"kind":"Argument","name":{"kind":"Name","value":"messageId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}}},{"kind":"Argument","name":{"kind":"Name","value":"browsingContext"},"value":{"kind":"Variable","name":{"kind":"Name","value":"browsingContext"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}},{"kind":"Argument","name":{"kind":"Name","value":"fileAttachments"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fileAttachments"}}},{"kind":"Argument","name":{"kind":"Name","value":"mentionedWorkspaceMemberIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"mentionedWorkspaceMemberIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"queued"}},{"kind":"Field","name":{"kind":"Name","value":"streamId"}},{"kind":"Field","name":{"kind":"Name","value":"mentionedParticipantWorkspaceMemberIds"}}]}}]}}]} as unknown as DocumentNode<SendChatMessageMutation, SendChatMessageMutationVariables>;+export const SnoozeAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SnoozeAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"snoozedUntil"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"snoozeAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}},{"kind":"Argument","name":{"kind":"Name","value":"snoozedUntil"},"value":{"kind":"Variable","name":{"kind":"Name","value":"snoozedUntil"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SnoozeAgentChatThreadMutation, SnoozeAgentChatThreadMutationVariables>;export const StopAgentChatStreamDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"StopAgentChatStream"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stopAgentChatStream"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}]}]}}]} as unknown as DocumentNode<StopAgentChatStreamMutation, StopAgentChatStreamMutationVariables>;+export const SubscribeToAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SubscribeToAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscribeToAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SubscribeToAgentChatThreadMutation, SubscribeToAgentChatThreadMutationVariables>;+export const UnsubscribeFromAgentChatThreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UnsubscribeFromAgentChatThread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"unsubscribeFromAgentChatThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentChatThreadParticipantFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"lastReadAt"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"isSubscribed"}},{"kind":"Field","name":{"kind":"Name","value":"lastMentionedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<UnsubscribeFromAgentChatThreadMutation, UnsubscribeFromAgentChatThreadMutationVariables>;export const UpdateOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAgentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateOneAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<UpdateOneAgentMutation, UpdateOneAgentMutationVariables>;export const UpdateSkillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSkill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateSkillInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSkill"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<UpdateSkillMutation, UpdateSkillMutationVariables>;export const FindManyAgentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyAgents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyAgents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<FindManyAgentsQuery, FindManyAgentsQueryVariables>;diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadActivityTime.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadActivityTime.tsxindex ee6d5506a84..9601a523297 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadActivityTime.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadActivityTime.tsx@@ -43,6 +43,11 @@ export const AiChatThreadActivityTime = ({return t`Done ${doneTime}`;}+ case 'UNSUBSCRIBED': {+ const unsubscribedTime = beautifyPastDateRelativeToNowShort(event.at);++ return t`Unsubscribed ${unsubscribedTime}`;+ }default:return beautifyPastDateRelativeToNowShort(getAgentChatThreadLastActivityAt(thread),diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadInboxStateNotice.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadInboxStateNotice.tsxindex 968035c799c..2499541b032 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadInboxStateNotice.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadInboxStateNotice.tsx@@ -1,7 +1,7 @@import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';-import { IconClock, IconProgressCheck } from 'twenty-ui/icon';+import { IconBellOff, IconClock, IconProgressCheck } from 'twenty-ui/icon';import { themeCssVariables, useTheme } from 'twenty-ui/theme';import { useFormatAgentChatThreadDate } from '@/ai/hooks/useFormatAgentChatThreadDate';@@ -39,6 +39,10 @@ export const AiChatThreadInboxStateNotice = () => {SNOOZED: { Icon: IconClock, text: t`Snoozed until ${eventTime}` },SNOOZE_ENDED: { Icon: IconClock, text: t`Snooze ended ${eventTime}` },DONE: { Icon: IconProgressCheck, text: t`Marked as done ${eventTime}` },+ UNSUBSCRIBED: {+ Icon: IconBellOff,+ text: t`Unsubscribed ${eventTime}. New messages stay out of your inbox unless you're mentioned.`,+ },}[event.type];return (diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageItem.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageItem.tsxnew file mode 100644index 00000000000..cdca882c4ef--- /dev/null+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageItem.tsx@@ -0,0 +1,56 @@+import { useLingui } from '@lingui/react/macro';+import { useLocation } from 'react-router-dom';+import { AppPath } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';++import { AGENT_CHAT_THREAD_FILTER_STATUS_ICONS } from '@/ai/constants/AgentChatThreadFilterStatusIcons';+import { AGENT_CHAT_THREAD_FILTER_STATUS_LABELS } from '@/ai/constants/AgentChatThreadFilterStatusLabels';+import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';+import { type AgentChatThreadFilterStatus } from '@/ai/types/AgentChatThreadFilterStatus';+import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';+import { type NavigationDrawerSubItemState } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerSubItemState';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useNavigateApp } from '~/hooks/useNavigateApp';+import { isAiChatInboxPath } from '~/utils/isAiChatInboxPath';++type NavigationDrawerAiChatTriageItemProps = {+ filterStatus: AgentChatThreadFilterStatus;+ count?: number;+ isUnread?: boolean;+ subItemState?: NavigationDrawerSubItemState;+};++export const NavigationDrawerAiChatTriageItem = ({+ filterStatus,+ count,+ isUnread,+ subItemState,+}: NavigationDrawerAiChatTriageItemProps) => {+ const { t } = useLingui();+ const location = useLocation();+ const navigate = useNavigateApp();+ const [agentChatThreadFilterStatus, setAgentChatThreadFilterStatus] =+ useAtomState(agentChatThreadFilterStatusState);++ const handleClick = () => {+ setAgentChatThreadFilterStatus(filterStatus);+ navigate(AppPath.AiChatInbox, { threadId: null });+ };++ return (+ <NavigationDrawerItem+ label={t(AGENT_CHAT_THREAD_FILTER_STATUS_LABELS[filterStatus])}+ secondaryLabel={isDefined(count) && count > 0 ? `${count}` : undefined}+ isUnread={isUnread}+ Icon={AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[filterStatus]}+ active={+ isAiChatInboxPath(location.pathname) &&+ agentChatThreadFilterStatus === filterStatus+ }+ indentationLevel={isDefined(subItemState) ? 2 : undefined}+ subItemState={subItemState}+ onClick={handleClick}+ triggerEvent="CLICK"+ />+ );+};diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageSection.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageSection.tsxindex a2ff1ee0031..316eb3154e1 100644--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageSection.tsx+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatTriageSection.tsx@@ -1,72 +1,76 @@import { useLingui } from '@lingui/react/macro';import { useLocation } from 'react-router-dom';-import { AppPath } from 'twenty-shared/types';+import { NavigationDrawerAiChatTriageItem } from '@/ai/components/NavigationDrawerAiChatTriageItem';import { AGENT_CHAT_THREAD_FILTER_STATUS } from '@/ai/constants/AgentChatThreadFilterStatus';-import { AGENT_CHAT_THREAD_FILTER_STATUS_ICONS } from '@/ai/constants/AgentChatThreadFilterStatusIcons';-import { AGENT_CHAT_THREAD_FILTER_STATUS_LABELS } from '@/ai/constants/AgentChatThreadFilterStatusLabels';import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';import { agentChatOpenThreadsSummarySelector } from '@/ai/states/selectors/agentChatOpenThreadsSummarySelector';-import { type AgentChatThreadFilterStatus } from '@/ai/types/AgentChatThreadFilterStatus';import { CollapsibleNavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection';-import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { NavigationDrawerItemGroup } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemGroup';+import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useNavigateApp } from '~/hooks/useNavigateApp';import { isAiChatInboxPath } from '~/utils/isAiChatInboxPath';const AI_CHAT_TRIAGE_NAVIGATION_SECTION_ID = 'AiChatTriage';-const TRIAGE_FILTER_STATUSES: AgentChatThreadFilterStatus[] = [- AGENT_CHAT_THREAD_FILTER_STATUS.ACTIVE,- AGENT_CHAT_THREAD_FILTER_STATUS.SNOOZED,- AGENT_CHAT_THREAD_FILTER_STATUS.DONE,+// Needs input and Mentions narrow Open, so they hang under it+const OPEN_SUB_FILTER_STATUSES = [+ AGENT_CHAT_THREAD_FILTER_STATUS.NEEDS_INPUT,+ AGENT_CHAT_THREAD_FILTER_STATUS.MENTIONS,];export const NavigationDrawerAiChatTriageSection = () => {const { t } = useLingui();const location = useLocation();- const navigate = useNavigateApp();- const [agentChatThreadFilterStatus, setAgentChatThreadFilterStatus] =- useAtomState(agentChatThreadFilterStatusState);- const { openThreadCount, hasUnreadOpenThread } = useAtomStateValue(- agentChatOpenThreadsSummarySelector,+ const agentChatThreadFilterStatus = useAtomStateValue(+ agentChatThreadFilterStatusState,);- const isOnInboxPage = isAiChatInboxPath(location.pathname);+ const {+ openThreadCount,+ hasUnreadOpenThread,+ needsInputThreadCount,+ hasUnreadMentionThread,+ } = useAtomStateValue(agentChatOpenThreadsSummarySelector);- const handleTriageClick = (filterStatus: AgentChatThreadFilterStatus) => {- setAgentChatThreadFilterStatus(filterStatus);- navigate(AppPath.AiChatInbox, { threadId: null });- };+ const getOpenSubItemState = (index: number) =>+ getNavigationSubItemLeftAdornment({+ index,+ arrayLength: OPEN_SUB_FILTER_STATUSES.length,+ selectedIndex: isAiChatInboxPath(location.pathname)+ ? OPEN_SUB_FILTER_STATUSES.findIndex(+ (filterStatus) => filterStatus === agentChatThreadFilterStatus,+ )+ : -1,+ });return (<CollapsibleNavigationDrawerSectionsectionId={AI_CHAT_TRIAGE_NAVIGATION_SECTION_ID}label={t`Triage`}>- {TRIAGE_FILTER_STATUSES.map((filterStatus) => {- const isOpenStatus =- filterStatus === AGENT_CHAT_THREAD_FILTER_STATUS.ACTIVE;-- return (- <NavigationDrawerItem- key={filterStatus}- label={t(AGENT_CHAT_THREAD_FILTER_STATUS_LABELS[filterStatus])}- secondaryLabel={- isOpenStatus && openThreadCount > 0- ? `${openThreadCount}`- : undefined- }- isUnread={isOpenStatus && hasUnreadOpenThread}- Icon={AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[filterStatus]}- active={- isOnInboxPage && agentChatThreadFilterStatus === filterStatus- }- onClick={() => handleTriageClick(filterStatus)}- triggerEvent="CLICK"- />- );- })}+ <NavigationDrawerItemGroup>+ <NavigationDrawerAiChatTriageItem+ filterStatus={AGENT_CHAT_THREAD_FILTER_STATUS.ACTIVE}+ count={openThreadCount}+ isUnread={hasUnreadOpenThread}+ />+ <NavigationDrawerAiChatTriageItem+ filterStatus={AGENT_CHAT_THREAD_FILTER_STATUS.NEEDS_INPUT}+ count={needsInputThreadCount}+ subItemState={getOpenSubItemState(0)}+ />+ <NavigationDrawerAiChatTriageItem+ filterStatus={AGENT_CHAT_THREAD_FILTER_STATUS.MENTIONS}+ isUnread={hasUnreadMentionThread}+ subItemState={getOpenSubItemState(1)}+ />+ </NavigationDrawerItemGroup>+ <NavigationDrawerAiChatTriageItem+ filterStatus={AGENT_CHAT_THREAD_FILTER_STATUS.SNOOZED}+ />+ <NavigationDrawerAiChatTriageItem+ filterStatus={AGENT_CHAT_THREAD_FILTER_STATUS.DONE}+ /></CollapsibleNavigationDrawerSection>);};diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadMarkAsReadEffect.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadMarkAsReadEffect.test.tsxindex 79e61c2675c..bb7ba8b4e4c 100644--- a/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadMarkAsReadEffect.test.tsx+++ b/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadMarkAsReadEffect.test.tsx@@ -44,6 +44,8 @@ describe('AgentChatThreadMarkAsReadEffect', () => {lastReadAt: '2026-10-01T09:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: '2026-10-01T10:00:00.000Z',},diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadParticipantOperationsEffect.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadParticipantOperationsEffect.test.tsxindex e03ba8233e1..99b07ed4255 100644--- a/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadParticipantOperationsEffect.test.tsx+++ b/packages/twenty-front/src/modules/ai/components/__tests__/AgentChatThreadParticipantOperationsEffect.test.tsx@@ -40,6 +40,8 @@ const READ_PARTICIPANT: AgentChatThreadParticipantFieldsFragment = {lastReadAt: '2026-10-01T10:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt: '2026-10-01T10:00:00.000Z',};@@ -131,6 +133,8 @@ describe('AgentChatThreadParticipantOperationsEffect', () => {...READ_PARTICIPANT,archivedAt: '2026-10-01T11:00:00.000Z',snoozedUntil: '2026-10-02T09:00:00.000Z',+ isSubscribed: true,+ lastMentionedAt: null,};const { store } = renderEffect({ [THREAD_ID]: snoozedParticipant });diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/NavigationDrawerAiChatTriageSection.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/NavigationDrawerAiChatTriageSection.test.tsxindex 30b5c579275..0477984e272 100644--- a/packages/twenty-front/src/modules/ai/components/__tests__/NavigationDrawerAiChatTriageSection.test.tsx+++ b/packages/twenty-front/src/modules/ai/components/__tests__/NavigationDrawerAiChatTriageSection.test.tsx@@ -12,6 +12,7 @@ import { AGENT_CHAT_THREAD_FILTER_STATUS } from '@/ai/constants/AgentChatThreadFimport { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';import { setAgentChatThreadList } from '@/ai/testing/setAgentChatThreadList';import { agentChatThreadParticipantsState } from '@/ai/states/agentChatThreadParticipantsState';+import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';import {jotaiStore,resetJotaiStore,@@ -29,6 +30,20 @@ jest.mock('~/hooks/useNavigateApp', () => ({const THREAD_IDS = ['thread-1', 'thread-2'];+const buildThread = (+ id: string,+ overrides: Partial<AgentChatThreadRecord> = {},+): AgentChatThreadRecord => ({+ __typename: 'AgentChatThread',+ id,+ title: null,+ deletedAt: null,+ createdAt: '2026-10-01T09:00:00.000Z',+ updatedAt: '2026-10-01T10:00:00.000Z',+ lastActivityAt: '2026-10-01T10:00:00.000Z',+ ...overrides,+});+const renderTriage = (path = '/') =>render(<JotaiProvider store={jotaiStore}>@@ -48,15 +63,7 @@ describe('NavigationDrawerAiChatTriageSection', () => {setAgentChatThreadList(jotaiStore,- THREAD_IDS.map(- (threadId) =>- ({- __typename: 'AgentChatThread',- id: threadId,- deletedAt: null,- lastActivityAt: '2026-10-01T10:00:00.000Z',- }) as never,- ),+ THREAD_IDS.map((threadId) => buildThread(threadId)),);jotaiStore.set(agentChatThreadParticipantsState.atom, {});});@@ -69,6 +76,8 @@ describe('NavigationDrawerAiChatTriageSection', () => {lastReadAt: '2026-10-01T10:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: '2026-10-01T10:00:00.000Z',},@@ -123,4 +132,51 @@ describe('NavigationDrawerAiChatTriageSection', () => {threadId: null,});});++ it('counts the open chats waiting on an answer under Needs input', () => {+ setAgentChatThreadList(jotaiStore, [+ buildThread('thread-1', { pendingQuestionMessageId: 'question' }),+ buildThread('thread-2', { pendingQuestionMessageId: null }),+ ]);+ THREAD_IDS.forEach(markThreadAsRead);++ renderTriage();++ expect(+ screen.getByRole('button', { name: 'Needs input · 1' }),+ ).toBeVisible();+ });++ it('flags Mentions when a chat the member was mentioned in is unread', () => {+ markThreadAsRead('thread-2');+ jotaiStore.set(agentChatThreadParticipantsState.atom, (participants) => ({+ ...participants,+ 'thread-1': {+ id: 'mention',+ threadId: 'thread-1',+ lastReadAt: null,+ archivedAt: null,+ snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: '2026-10-01T10:00:00.000Z',+ updatedAt: '2026-10-01T10:00:00.000Z',+ },+ }));++ renderTriage();++ expect(+ screen.getByRole('button', { name: /^Mentions\s*, unread$/ }),+ ).toBeVisible();+ });++ it('opens the inbox on the chats the member was mentioned in', async () => {+ renderTriage();++ await userEvent.click(screen.getByRole('button', { name: 'Mentions' }));++ expect(jotaiStore.get(agentChatThreadFilterStatusState.atom)).toBe(+ AGENT_CHAT_THREAD_FILTER_STATUS.MENTIONS,+ );+ });});diff --git a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatus.ts b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatus.tsindex a8abe2ba486..b3a7293fee8 100644--- a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatus.ts+++ b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatus.ts@@ -1,5 +1,7 @@export const AGENT_CHAT_THREAD_FILTER_STATUS = {ACTIVE: 'active',+ NEEDS_INPUT: 'needsInput',+ MENTIONS: 'mentions',SNOOZED: 'snoozed',DONE: 'done',} as const;diff --git a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusIcons.ts b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusIcons.tsindex bbd234e5ef7..a42a4606144 100644--- a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusIcons.ts+++ b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusIcons.ts@@ -1,7 +1,9 @@import {type IconComponent,+ IconAt,IconCircleDashed,IconClock,+ IconHandClick,IconProgressCheck,} from 'twenty-ui/icon';@@ -12,6 +14,8 @@ export const AGENT_CHAT_THREAD_FILTER_STATUS_ICONS: Record<IconComponent> = {active: IconCircleDashed,+ needsInput: IconHandClick,+ mentions: IconAt,snoozed: IconClock,done: IconProgressCheck,};diff --git a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusLabels.ts b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusLabels.tsindex 4d4c09ba3fc..2ca380ae848 100644--- a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusLabels.ts+++ b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadFilterStatusLabels.ts@@ -8,6 +8,8 @@ export const AGENT_CHAT_THREAD_FILTER_STATUS_LABELS: Record<MessageDescriptor> = {active: msg`Open`,+ needsInput: msg`Needs input`,+ mentions: msg`Mentions`,snoozed: msg`Snoozed`,done: msg`Done`,};diff --git a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadListRecordGqlFields.ts b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadListRecordGqlFields.tsindex 9303bee25f1..e770bc3d426 100644--- a/packages/twenty-front/src/modules/ai/constants/AgentChatThreadListRecordGqlFields.ts+++ b/packages/twenty-front/src/modules/ai/constants/AgentChatThreadListRecordGqlFields.ts@@ -24,6 +24,8 @@ export const AGENT_CHAT_THREAD_LIST_RECORD_GQL_FIELDS = {lastReadAt: true,archivedAt: true,snoozedUntil: true,+ isSubscribed: true,+ lastMentionedAt: true,updatedAt: true,},};diff --git a/packages/twenty-front/src/modules/ai/graphql/fragments/agentChatThreadParticipantFragment.ts b/packages/twenty-front/src/modules/ai/graphql/fragments/agentChatThreadParticipantFragment.tsindex a38f65b43bb..c08f68e54c7 100644--- a/packages/twenty-front/src/modules/ai/graphql/fragments/agentChatThreadParticipantFragment.ts+++ b/packages/twenty-front/src/modules/ai/graphql/fragments/agentChatThreadParticipantFragment.ts@@ -7,6 +7,8 @@ export const AGENT_CHAT_THREAD_PARTICIPANT_FRAGMENT = gql`lastReadAtarchivedAtsnoozedUntil+ isSubscribed+ lastMentionedAtupdatedAt}`;diff --git a/packages/twenty-front/src/modules/ai/graphql/mutations/addAgentChatThreadParticipants.ts b/packages/twenty-front/src/modules/ai/graphql/mutations/addAgentChatThreadParticipants.tsdeleted file mode 100644index 3e1fa8b9875..00000000000--- a/packages/twenty-front/src/modules/ai/graphql/mutations/addAgentChatThreadParticipants.ts+++ /dev/null@@ -1,13 +0,0 @@-import { gql } from '@apollo/client';--export const ADD_AGENT_CHAT_THREAD_PARTICIPANTS = gql`- mutation AddAgentChatThreadParticipants(- $threadId: UUID!- $workspaceMemberIds: [UUID!]!- ) {- addAgentChatThreadParticipants(- threadId: $threadId- workspaceMemberIds: $workspaceMemberIds- )- }-`;diff --git a/packages/twenty-front/src/modules/ai/graphql/mutations/sendChatMessage.ts b/packages/twenty-front/src/modules/ai/graphql/mutations/sendChatMessage.tsindex f4c21ddfc6b..cc89cfddb61 100644--- a/packages/twenty-front/src/modules/ai/graphql/mutations/sendChatMessage.ts+++ b/packages/twenty-front/src/modules/ai/graphql/mutations/sendChatMessage.ts@@ -8,6 +8,7 @@ export const SEND_CHAT_MESSAGE = gql`$browsingContext: JSON$modelId: String$fileAttachments: [FileAttachmentInput!]+ $mentionedWorkspaceMemberIds: [UUID!]) {sendChatMessage(threadId: $threadId@@ -16,10 +17,12 @@ export const SEND_CHAT_MESSAGE = gql`browsingContext: $browsingContextmodelId: $modelIdfileAttachments: $fileAttachments+ mentionedWorkspaceMemberIds: $mentionedWorkspaceMemberIds) {messageIdqueuedstreamId+ mentionedParticipantWorkspaceMemberIds}}`;diff --git a/packages/twenty-front/src/modules/ai/graphql/mutations/subscribeToAgentChatThread.ts b/packages/twenty-front/src/modules/ai/graphql/mutations/subscribeToAgentChatThread.tsnew file mode 100644index 00000000000..3a203813d95--- /dev/null+++ b/packages/twenty-front/src/modules/ai/graphql/mutations/subscribeToAgentChatThread.ts@@ -0,0 +1,12 @@+import { gql } from '@apollo/client';++import { AGENT_CHAT_THREAD_PARTICIPANT_FRAGMENT } from '@/ai/graphql/fragments/agentChatThreadParticipantFragment';++export const SUBSCRIBE_TO_AGENT_CHAT_THREAD = gql`+ ${AGENT_CHAT_THREAD_PARTICIPANT_FRAGMENT}+ mutation SubscribeToAgentChatThread($threadId: UUID!) {+ subscribeToAgentChatThread(threadId: $threadId) {+ ...AgentChatThreadParticipantFields+ }+ }+`;diff --git a/packages/twenty-front/src/modules/ai/graphql/mutations/unsubscribeFromAgentChatThread.ts b/packages/twenty-front/src/modules/ai/graphql/mutations/unsubscribeFromAgentChatThread.tsnew file mode 100644index 00000000000..079992f6c20--- /dev/null+++ b/packages/twenty-front/src/modules/ai/graphql/mutations/unsubscribeFromAgentChatThread.ts@@ -0,0 +1,12 @@+import { gql } from '@apollo/client';++import { AGENT_CHAT_THREAD_PARTICIPANT_FRAGMENT } from '@/ai/graphql/fragments/agentChatThreadParticipantFragment';++export const UNSUBSCRIBE_FROM_AGENT_CHAT_THREAD = gql`+ ${AGENT_CHAT_THREAD_PARTICIPANT_FRAGMENT}+ mutation UnsubscribeFromAgentChatThread($threadId: UUID!) {+ unsubscribeFromAgentChatThread(threadId: $threadId) {+ ...AgentChatThreadParticipantFields+ }+ }+`;diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatThreadParticipants.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatThreadParticipants.test.tsxindex 0081cce3aed..06bf02ec0ac 100644--- a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatThreadParticipants.test.tsx+++ b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatThreadParticipants.test.tsx@@ -14,6 +14,8 @@ const READ_PARTICIPANT = {lastReadAt: LAST_ACTIVITY_AT,archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: '2026-10-01T10:00:00.000Z',};diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useOptimisticallyRestoreOnSend.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useOptimisticallyRestoreOnSend.test.tsxindex 294de1bd3d6..58bc03a07b7 100644--- a/packages/twenty-front/src/modules/ai/hooks/__tests__/useOptimisticallyRestoreOnSend.test.tsx+++ b/packages/twenty-front/src/modules/ai/hooks/__tests__/useOptimisticallyRestoreOnSend.test.tsx@@ -13,6 +13,8 @@ const ARCHIVED_PARTICIPANT = {lastReadAt: LAST_ACTIVITY_AT,archivedAt: '2026-10-01T11:00:00.000Z',snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: '2026-10-01T11:00:00.000Z',};@@ -55,6 +57,8 @@ describe('useOptimisticallyRestoreOnSend', () => {lastReadAt: sentAt,archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: ARCHIVED_PARTICIPANT.updatedAt,});diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useRefreshAgentChatThreads.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useRefreshAgentChatThreads.test.tsxindex fd1313dc535..e3878e4e7f9 100644--- a/packages/twenty-front/src/modules/ai/hooks/__tests__/useRefreshAgentChatThreads.test.tsx+++ b/packages/twenty-front/src/modules/ai/hooks/__tests__/useRefreshAgentChatThreads.test.tsx@@ -148,6 +148,8 @@ describe('useRefreshAgentChatThreads', () => {lastReadAt: '2026-10-01T10:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt,});const streamedParticipant = {@@ -156,6 +158,8 @@ describe('useRefreshAgentChatThreads', () => {lastReadAt: null,archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt: '2026-10-01T10:05:00.000Z',};store.set(agentChatThreadStreamedParticipantsState.atom, {@@ -213,6 +217,8 @@ describe('useRefreshAgentChatThreads', () => {lastReadAt: '2026-10-01T10:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt: '2026-10-01T10:00:00.000Z',},'thread-2': streamedParticipant,diff --git a/packages/twenty-front/src/modules/ai/hooks/useAddAgentChatThreadParticipants.ts b/packages/twenty-front/src/modules/ai/hooks/useAddAgentChatThreadParticipants.tsdeleted file mode 100644index 8fb2069c3a4..00000000000--- a/packages/twenty-front/src/modules/ai/hooks/useAddAgentChatThreadParticipants.ts+++ /dev/null@@ -1,77 +0,0 @@-import { useApolloClient } from '@apollo/client/react';-import { t } from '@lingui/core/macro';-import { isNonEmptyString } from '@sniptt/guards';-import { useStore } from 'jotai';-import { useCallback } from 'react';-import { useToast } from 'twenty-ui/components/feedback';--import { getParticipantMentionsFromSerializedDocument } from '@/ai/utils/getParticipantMentionsFromSerializedDocument';-import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';-import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';-import { AddAgentChatThreadParticipantsDocument } from '~/generated-metadata/graphql';--export const useAddAgentChatThreadParticipants = () => {- const apolloClient = useApolloClient();- const store = useStore();- const { enqueueToast } = useToast();-- const addParticipantsMentionedInMessage = useCallback(- async ({- threadId,- serializedMessage,- }: {- threadId: string;- serializedMessage: string;- }) => {- const currentWorkspaceMemberId = store.get(- currentWorkspaceMemberState.atom,- )?.id;- // Members already following are sent too, so the mention brings the- // chat back to their inbox- const participantMentions = getParticipantMentionsFromSerializedDocument(- serializedMessage,- ).filter(- ({ workspaceMemberId }) =>- workspaceMemberId !== currentWorkspaceMemberId,- );-- if (participantMentions.length === 0) {- return;- }-- try {- const { data } = await apolloClient.mutate({- mutation: AddAgentChatThreadParticipantsDocument,- variables: {- threadId,- workspaceMemberIds: participantMentions.map(- ({ workspaceMemberId }) => workspaceMemberId,- ),- },- });-- const addedWorkspaceMemberIds =- data?.addAgentChatThreadParticipants ?? [];- const notAddedLabels = participantMentions- .filter(- ({ workspaceMemberId }) =>- !addedWorkspaceMemberIds.includes(workspaceMemberId),- )- .map(({ label }) => label)- .join(', ');-- if (isNonEmptyString(notAddedLabels)) {- enqueueToast({- variant: 'warning',- children: t`${notAddedLabels} could not be added to this chat because they can't reply in it.`,- });- }- } catch (error) {- enqueueToast(getToastOptionsFromError({ error }));- }- },- [apolloClient, enqueueToast, store],- );-- return { addParticipantsMentionedInMessage };-};diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.tsindex d3e0a8ecff7..fdd616d8dd1 100644--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts@@ -17,12 +17,12 @@ import { AGENT_CHAT_REFETCH_MESSAGES_EVENT_NAME } from '@/ai/constants/AgentChatimport { AGENT_CHAT_RESTORE_EDITOR_CONTENT_EVENT_NAME } from '@/ai/constants/AgentChatRestoreEditorContentEventName';import { AGENT_CHAT_SEND_MESSAGE_EVENT_NAME } from '@/ai/constants/AgentChatSendMessageEventName';import { AGENT_CHAT_STOP_EVENT_NAME } from '@/ai/constants/AgentChatStopEventName';-import { useAddAgentChatThreadParticipants } from '@/ai/hooks/useAddAgentChatThreadParticipants';import { useAgentChatModelId } from '@/ai/hooks/useAgentChatModelId';import { useAttachChatThreadToRecord } from '@/ai/hooks/useAttachChatThreadToRecord';import { useGetBrowsingContext } from '@/ai/hooks/useGetBrowsingContext';import { useOptimisticallyRestoreOnSend } from '@/ai/hooks/useOptimisticallyRestoreOnSend';import { useProjectAiChatThreadToUrl } from '@/ai/hooks/useProjectAiChatThreadToUrl';+import { useWarnAboutParticipantMentionsNotAdded } from '@/ai/hooks/useWarnAboutParticipantMentionsNotAdded';import {AGENT_CHAT_NEW_THREAD_DRAFT_KEY,agentChatDraftsByThreadIdState,@@ -34,6 +34,7 @@ import { agentChatUploadedFilesState } from '@/ai/states/agentChatUploadedFilesSimport { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState';import { getAgentChatThreadAtoms } from '@/ai/utils/getAgentChatThreadAtoms';import { getConversationTargetsFromSerializedDocument } from '@/ai/utils/getConversationTargetsFromSerializedDocument';+import { getParticipantMentionsFromSerializedDocument } from '@/ai/utils/getParticipantMentionsFromSerializedDocument';import { isAiChatCreditsExhaustedError } from '@/ai/utils/isAiChatCreditsExhaustedError';import { toAiChatError } from '@/ai/utils/toAiChatError';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';@@ -59,8 +60,8 @@ export const useAgentChat = (const { getBrowsingContext } = useGetBrowsingContext();const { applyOptimisticRestore } = useOptimisticallyRestoreOnSend();const { attachChatThreadToRecord } = useAttachChatThreadToRecord();- const { addParticipantsMentionedInMessage } =- useAddAgentChatThreadParticipants();+ const { warnAboutParticipantMentionsNotAdded } =+ useWarnAboutParticipantMentionsNotAdded();const apolloClient = useApolloClient();const { enqueueToast } = useToast();const setCurrentAiChatThread = useSetAtomState(currentAiChatThreadState);@@ -179,6 +180,17 @@ export const useAgentChat = (filename: file.filename,}));+ // Members already following are sent too, so the mention brings the chat+ // back to their inbox+ const currentWorkspaceMemberId = store.get(+ currentWorkspaceMemberState.atom,+ )?.id;+ const participantMentions = getParticipantMentionsFromSerializedDocument(+ serializedContentToSend,+ ).filter(+ ({ workspaceMemberId }) => workspaceMemberId !== currentWorkspaceMemberId,+ );+setAgentChatUploadedFiles([]);try {@@ -192,6 +204,12 @@ export const useAgentChat = (modelId: modelIdForRequest,fileAttachments:fileAttachments.length > 0 ? fileAttachments : undefined,+ mentionedWorkspaceMemberIds:+ participantMentions.length > 0+ ? participantMentions.map(+ ({ workspaceMemberId }) => workspaceMemberId,+ )+ : undefined,},});@@ -210,9 +228,10 @@ export const useAgentChat = ().forEach((conversationTarget) => {void attachChatThreadToRecord({ threadId, ...conversationTarget });});- void addParticipantsMentionedInMessage({- threadId,- serializedMessage: serializedContentToSend,+ warnAboutParticipantMentionsNotAdded({+ participantMentions,+ addedWorkspaceMemberIds:+ data?.sendChatMessage.mentionedParticipantWorkspaceMemberIds ?? [],});if (data?.sendChatMessage.queued === true) {@@ -263,7 +282,7 @@ export const useAgentChat = (apolloClient,applyOptimisticRestore,attachChatThreadToRecord,- addParticipantsMentionedInMessage,+ warnAboutParticipantMentionsNotAdded,]);useListenToBrowserEvent({diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatThreadParticipants.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatThreadParticipants.tsindex d80262ff387..11281c1e205 100644--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatThreadParticipants.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatThreadParticipants.ts@@ -19,6 +19,8 @@ import {MarkAgentChatThreadAsUnreadDocument,MoveAgentChatThreadToInboxDocument,SnoozeAgentChatThreadDocument,+ SubscribeToAgentChatThreadDocument,+ UnsubscribeFromAgentChatThreadDocument,} from '~/generated-metadata/graphql';export const useAgentChatThreadParticipants = () => {@@ -163,6 +165,7 @@ export const useAgentChatThreadParticipants = () => {optimisticParticipant: {archivedAt: new Date().toISOString(),snoozedUntil: snoozedUntil.toISOString(),+ isSubscribed: true,},}),),@@ -176,7 +179,35 @@ export const useAgentChatThreadParticipants = () => {updateParticipant({mutation: MoveAgentChatThreadToInboxDocument,variables: { threadId },- optimisticParticipant: { archivedAt: null, snoozedUntil: null },+ optimisticParticipant: {+ archivedAt: null,+ snoozedUntil: null,+ isSubscribed: true,+ },+ }),+ [updateParticipant],+ );++ const subscribeToAgentChatThread = useCallback(+ (threadId: string) =>+ updateParticipant({+ mutation: SubscribeToAgentChatThreadDocument,+ variables: { threadId },+ optimisticParticipant: { isSubscribed: true },+ }),+ [updateParticipant],+ );++ const unsubscribeFromAgentChatThread = useCallback(+ (threadId: string) =>+ updateParticipant({+ mutation: UnsubscribeFromAgentChatThreadDocument,+ variables: { threadId },+ optimisticParticipant: {+ isSubscribed: false,+ archivedAt: new Date().toISOString(),+ snoozedUntil: null,+ },}),[updateParticipant],);@@ -187,5 +218,7 @@ export const useAgentChatThreadParticipants = () => {archiveAgentChatThread,snoozeAgentChatThreads,moveAgentChatThreadToInbox,+ subscribeToAgentChatThread,+ unsubscribeFromAgentChatThread,};};diff --git a/packages/twenty-front/src/modules/ai/hooks/useOptimisticallyRestoreOnSend.ts b/packages/twenty-front/src/modules/ai/hooks/useOptimisticallyRestoreOnSend.tsindex 7212e3c5522..8234d8caa1d 100644--- a/packages/twenty-front/src/modules/ai/hooks/useOptimisticallyRestoreOnSend.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useOptimisticallyRestoreOnSend.ts@@ -53,6 +53,7 @@ export const useOptimisticallyRestoreOnSend = () => {lastReadAt: optimisticUpdatedAt,archivedAt: null,snoozedUntil: null,+ isSubscribed: true,updatedAt:previousParticipant?.updatedAt ??AGENT_CHAT_THREAD_PARTICIPANT_UNSAVED_UPDATED_AT,diff --git a/packages/twenty-front/src/modules/ai/hooks/useWarnAboutParticipantMentionsNotAdded.ts b/packages/twenty-front/src/modules/ai/hooks/useWarnAboutParticipantMentionsNotAdded.tsnew file mode 100644index 00000000000..4c9cd916dbc--- /dev/null+++ b/packages/twenty-front/src/modules/ai/hooks/useWarnAboutParticipantMentionsNotAdded.ts@@ -0,0 +1,38 @@+import { t } from '@lingui/core/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { useCallback } from 'react';+import { useToast } from 'twenty-ui/components/feedback';++import { type AgentChatParticipantMention } from '@/ai/types/AgentChatParticipantMention';++export const useWarnAboutParticipantMentionsNotAdded = () => {+ const { enqueueToast } = useToast();++ const warnAboutParticipantMentionsNotAdded = useCallback(+ ({+ participantMentions,+ addedWorkspaceMemberIds,+ }: {+ participantMentions: AgentChatParticipantMention[];+ addedWorkspaceMemberIds: string[];+ }) => {+ const notAddedLabels = participantMentions+ .filter(+ ({ workspaceMemberId }) =>+ !addedWorkspaceMemberIds.includes(workspaceMemberId),+ )+ .map(({ label }) => label)+ .join(', ');++ if (isNonEmptyString(notAddedLabels)) {+ enqueueToast({+ variant: 'warning',+ children: t`${notAddedLabels} could not be added to this chat because they can't reply in it.`,+ });+ }+ },+ [enqueueToast],+ );++ return { warnAboutParticipantMentionsNotAdded };+};diff --git a/packages/twenty-front/src/modules/ai/states/selectors/__tests__/agentChatVisibleThreadsSelector.test.ts b/packages/twenty-front/src/modules/ai/states/selectors/__tests__/agentChatVisibleThreadsSelector.test.tsindex 544c17d80db..e0853029370 100644--- a/packages/twenty-front/src/modules/ai/states/selectors/__tests__/agentChatVisibleThreadsSelector.test.ts+++ b/packages/twenty-front/src/modules/ai/states/selectors/__tests__/agentChatVisibleThreadsSelector.test.ts@@ -6,11 +6,14 @@ import { setAgentChatThreadList } from '@/ai/testing/setAgentChatThreadList';import { agentChatThreadParticipantsState } from '@/ai/states/agentChatThreadParticipantsState';import { agentChatVisibleThreadsSelector } from '@/ai/states/selectors/agentChatVisibleThreadsSelector';import { type AgentChatThreadFilterStatus } from '@/ai/types/AgentChatThreadFilterStatus';+import { type AgentChatThreadParticipantFieldsFragment } from '~/generated-metadata/graphql';const LAST_ACTIVITY_AT = '2026-10-01T10:00:00.000Z';const READ = {lastReadAt: LAST_ACTIVITY_AT,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt: LAST_ACTIVITY_AT,};@@ -20,13 +23,9 @@ const THREADS: {id: string;deletedAt: string | null;lastActivityAt?: string;+ pendingQuestionMessageId?: string;participant:- | {- lastReadAt: string;- archivedAt: string | null;- snoozedUntil: string | null;- updatedAt: string;- }+ | Omit<AgentChatThreadParticipantFieldsFragment, 'id' | 'threadId'>| undefined;}[] = [{ id: 'read', deletedAt: null, participant: { ...READ, archivedAt: null } },@@ -75,6 +74,37 @@ const THREADS: {deletedAt: '2026-10-01T11:00:00.000Z',participant: { ...READ, archivedAt: null },},+ {+ id: 'needs-input',+ deletedAt: null,+ pendingQuestionMessageId: 'question',+ participant: { ...READ, archivedAt: null },+ },+ {+ id: 'done-needs-input',+ deletedAt: null,+ pendingQuestionMessageId: 'question',+ participant: { ...READ, archivedAt: '2026-10-01T11:00:00.000Z' },+ },+ {+ id: 'mentioned',+ deletedAt: null,+ participant: {+ ...READ,+ archivedAt: null,+ lastMentionedAt: '2026-10-01T09:00:00.000Z',+ },+ },+ {+ id: 'unsubscribed-then-active',+ deletedAt: null,+ lastActivityAt: ACTIVITY_AFTER_ARCHIVE_AT,+ participant: {+ ...READ,+ archivedAt: '2026-10-01T11:00:00.000Z',+ isSubscribed: false,+ },+ },];const getVisibleThreadIds = (filterStatus: AgentChatThreadFilterStatus) => {@@ -83,12 +113,13 @@ const getVisibleThreadIds = (filterStatus: AgentChatThreadFilterStatus) => {setAgentChatThreadList(store,THREADS.map(- ({ id, deletedAt, lastActivityAt }) =>+ ({ id, deletedAt, lastActivityAt, pendingQuestionMessageId }) =>({__typename: 'AgentChatThread',id,title: id,deletedAt,+ pendingQuestionMessageId: pendingQuestionMessageId ?? null,createdAt: LAST_ACTIVITY_AT,updatedAt: LAST_ACTIVITY_AT,lastActivityAt: lastActivityAt ?? LAST_ACTIVITY_AT,@@ -118,10 +149,17 @@ describe('agentChatVisibleThreadsSelector', () => {'snoozed-then-active','unread','snooze-ended',+ 'needs-input',+ 'mentioned',],],+ [AGENT_CHAT_THREAD_FILTER_STATUS.NEEDS_INPUT, ['needs-input']],+ [AGENT_CHAT_THREAD_FILTER_STATUS.MENTIONS, ['mentioned']],[AGENT_CHAT_THREAD_FILTER_STATUS.SNOOZED, ['snoozed']],- [AGENT_CHAT_THREAD_FILTER_STATUS.DONE, ['archived']],+ [+ AGENT_CHAT_THREAD_FILTER_STATUS.DONE,+ ['archived', 'done-needs-input', 'unsubscribed-then-active'],+ ],])('lists the %s threads', (filterStatus, expectedThreadIds) => {expect(getVisibleThreadIds(filterStatus)).toEqual(expectedThreadIds);});diff --git a/packages/twenty-front/src/modules/ai/states/selectors/agentChatOpenThreadsSummarySelector.ts b/packages/twenty-front/src/modules/ai/states/selectors/agentChatOpenThreadsSummarySelector.tsindex e925486d4eb..d92064a50c3 100644--- a/packages/twenty-front/src/modules/ai/states/selectors/agentChatOpenThreadsSummarySelector.ts+++ b/packages/twenty-front/src/modules/ai/states/selectors/agentChatOpenThreadsSummarySelector.ts@@ -3,12 +3,15 @@ import { isDefined } from 'twenty-shared/utils';import { agentChatThreadInboxStatusFamilySelector } from '@/ai/states/selectors/agentChatThreadInboxStatusFamilySelector';import { agentChatRecentThreadsSelector } from '@/ai/states/selectors/agentChatRecentThreadsSelector';import { agentChatThreadParticipantsState } from '@/ai/states/agentChatThreadParticipantsState';+import { isAgentChatThreadInFilterStatus } from '@/ai/utils/isAgentChatThreadInFilterStatus';import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector';import { isDeeplyEqual } from '~/utils/isDeeplyEqual';type AgentChatOpenThreadsSummary = {openThreadCount: number;hasUnreadOpenThread: boolean;+ needsInputThreadCount: number;+ hasUnreadMentionThread: boolean;};export const agentChatOpenThreadsSummarySelector =@@ -16,19 +19,34 @@ export const agentChatOpenThreadsSummarySelector =key: 'agentChatOpenThreadsSummarySelector',get: ({ get }) => {if (!isDefined(get(agentChatThreadParticipantsState))) {- return { openThreadCount: 0, hasUnreadOpenThread: false };+ return {+ openThreadCount: 0,+ hasUnreadOpenThread: false,+ needsInputThreadCount: 0,+ hasUnreadMentionThread: false,+ };}- const openThreadStatuses = get(agentChatRecentThreadsSelector)- .map((thread) =>- get(agentChatThreadInboxStatusFamilySelector, thread.id),- )- .filter(({ scope }) => scope === 'INBOX');+ const openThreads = get(agentChatRecentThreadsSelector)+ .map((thread) => ({+ thread,+ inboxStatus: get(agentChatThreadInboxStatusFamilySelector, thread.id),+ }))+ .filter(({ inboxStatus }) => inboxStatus.scope === 'INBOX');return {- openThreadCount: openThreadStatuses.length,- hasUnreadOpenThread: openThreadStatuses.some(- ({ isUnread }) => isUnread,+ openThreadCount: openThreads.length,+ hasUnreadOpenThread: openThreads.some(+ ({ inboxStatus }) => inboxStatus.isUnread,+ ),+ needsInputThreadCount: openThreads.filter((openThread) =>+ isAgentChatThreadInFilterStatus({+ ...openThread,+ filterStatus: 'needsInput',+ }),+ ).length,+ hasUnreadMentionThread: openThreads.some(+ ({ inboxStatus }) => inboxStatus.isMentioned && inboxStatus.isUnread,),};},diff --git a/packages/twenty-front/src/modules/ai/states/selectors/agentChatVisibleThreadsSelector.ts b/packages/twenty-front/src/modules/ai/states/selectors/agentChatVisibleThreadsSelector.tsindex 75c071772ae..fa3695ba340 100644--- a/packages/twenty-front/src/modules/ai/states/selectors/agentChatVisibleThreadsSelector.ts+++ b/packages/twenty-front/src/modules/ai/states/selectors/agentChatVisibleThreadsSelector.ts@@ -1,33 +1,23 @@-import { AGENT_CHAT_THREAD_FILTER_STATUS } from '@/ai/constants/AgentChatThreadFilterStatus';import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';import { agentChatThreadInboxStatusFamilySelector } from '@/ai/states/selectors/agentChatThreadInboxStatusFamilySelector';import { agentChatRecentThreadsSelector } from '@/ai/states/selectors/agentChatRecentThreadsSelector';-import { type AgentChatThreadFilterStatus } from '@/ai/types/AgentChatThreadFilterStatus';-import { type AgentChatThreadInboxStatus } from '@/ai/types/AgentChatThreadInboxStatus';import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';+import { isAgentChatThreadInFilterStatus } from '@/ai/utils/isAgentChatThreadInFilterStatus';import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector';-const INBOX_SCOPE_BY_FILTER_STATUS: Record<- AgentChatThreadFilterStatus,- AgentChatThreadInboxStatus['scope']-> = {- [AGENT_CHAT_THREAD_FILTER_STATUS.ACTIVE]: 'INBOX',- [AGENT_CHAT_THREAD_FILTER_STATUS.SNOOZED]: 'SNOOZED',- [AGENT_CHAT_THREAD_FILTER_STATUS.DONE]: 'ARCHIVED',-};-export const agentChatVisibleThreadsSelector = createAtomSelector<AgentChatThreadRecord[]>({key: 'agentChatVisibleThreadsSelector',get: ({ get }) => {- const requiredScope =- INBOX_SCOPE_BY_FILTER_STATUS[get(agentChatThreadFilterStatusState)];+ const filterStatus = get(agentChatThreadFilterStatusState);- return get(agentChatRecentThreadsSelector).filter(- (thread) =>- get(agentChatThreadInboxStatusFamilySelector, thread.id).scope ===- requiredScope,+ return get(agentChatRecentThreadsSelector).filter((thread) =>+ isAgentChatThreadInFilterStatus({+ thread,+ inboxStatus: get(agentChatThreadInboxStatusFamilySelector, thread.id),+ filterStatus,+ }),);},});diff --git a/packages/twenty-front/src/modules/ai/types/AgentChatThreadInboxStatus.ts b/packages/twenty-front/src/modules/ai/types/AgentChatThreadInboxStatus.tsindex 71531e4a67e..858c7e27403 100644--- a/packages/twenty-front/src/modules/ai/types/AgentChatThreadInboxStatus.ts+++ b/packages/twenty-front/src/modules/ai/types/AgentChatThreadInboxStatus.ts@@ -1,9 +1,11 @@export type AgentChatThreadInboxStatus = {scope: 'INBOX' | 'SNOOZED' | 'ARCHIVED';isUnread: boolean;+ isSubscribed: boolean;+ isMentioned: boolean;// The latest inbox change the member made, shown on the row and in the chatevent: {- type: 'SNOOZED' | 'SNOOZE_ENDED' | 'DONE';+ type: 'SNOOZED' | 'SNOOZE_ENDED' | 'DONE' | 'UNSUBSCRIBED';at: string;} | null;};diff --git a/packages/twenty-front/src/modules/ai/utils/__tests__/getAgentChatThreadInboxStatus.test.ts b/packages/twenty-front/src/modules/ai/utils/__tests__/getAgentChatThreadInboxStatus.test.tsindex 2e85bcc9964..08ff9dcbf6d 100644--- a/packages/twenty-front/src/modules/ai/utils/__tests__/getAgentChatThreadInboxStatus.test.ts+++ b/packages/twenty-front/src/modules/ai/utils/__tests__/getAgentChatThreadInboxStatus.test.ts@@ -8,11 +8,15 @@ const getStatus = ({lastReadAt = lastActivityAt,archivedAt = null,snoozedUntil = null,+ isSubscribed = true,+ lastMentionedAt = null,}: {lastActivityAt?: string | null;lastReadAt?: string | null;archivedAt?: string | null;snoozedUntil?: string | null;+ isSubscribed?: boolean;+ lastMentionedAt?: string | null;} = {}) =>getAgentChatThreadInboxStatus({lastActivityAt,@@ -22,6 +26,8 @@ const getStatus = ({lastReadAt,archivedAt,snoozedUntil,+ isSubscribed,+ lastMentionedAt,updatedAt: ARCHIVED_AT,},});@@ -33,13 +39,21 @@ describe('getAgentChatThreadInboxStatus', () => {lastActivityAt: '2026-10-01T09:00:00.000Z',participant: undefined,}),- ).toEqual({ scope: 'INBOX', isUnread: true, event: null });+ ).toEqual({+ scope: 'INBOX',+ isUnread: true,+ isSubscribed: true,+ isMentioned: false,+ event: null,+ });});it('reads a thread as read up to its read cursor', () => {expect(getStatus()).toEqual({scope: 'INBOX',isUnread: false,+ isSubscribed: true,+ isMentioned: false,event: null,});expect(getStatus({ lastReadAt: '2026-10-01T08:00:00.000Z' }).isUnread).toBe(@@ -58,6 +72,8 @@ describe('getAgentChatThreadInboxStatus', () => {expect(getStatus({ archivedAt: ARCHIVED_AT })).toEqual({scope: 'ARCHIVED',isUnread: false,+ isSubscribed: true,+ isMentioned: false,event: { type: 'DONE', at: ARCHIVED_AT },});expect(@@ -101,6 +117,35 @@ describe('getAgentChatThreadInboxStatus', () => {lastActivityAt: '2026-10-01T11:00:00.000Z',lastReadAt: '2026-10-01T09:00:00.000Z',}),- ).toEqual({ scope: 'INBOX', isUnread: true, event: null });+ ).toEqual({+ scope: 'INBOX',+ isUnread: true,+ isSubscribed: true,+ isMentioned: false,+ event: null,+ });+ });++ it('keeps an unsubscribed thread done whatever happens in it', () => {+ expect(+ getStatus({+ isSubscribed: false,+ archivedAt: ARCHIVED_AT,+ lastActivityAt: '2026-10-01T11:00:00.000Z',+ lastReadAt: ARCHIVED_AT,+ }),+ ).toEqual({+ scope: 'ARCHIVED',+ isUnread: true,+ isSubscribed: false,+ isMentioned: false,+ event: { type: 'UNSUBSCRIBED', at: ARCHIVED_AT },+ });+ });++ it('tells when the member was mentioned', () => {+ expect(+ getStatus({ lastMentionedAt: '2026-10-01T09:00:00.000Z' }).isMentioned,+ ).toBe(true);});});diff --git a/packages/twenty-front/src/modules/ai/utils/__tests__/isAgentChatThreadInFilterStatus.test.ts b/packages/twenty-front/src/modules/ai/utils/__tests__/isAgentChatThreadInFilterStatus.test.tsnew file mode 100644index 00000000000..34eea6e9f57--- /dev/null+++ b/packages/twenty-front/src/modules/ai/utils/__tests__/isAgentChatThreadInFilterStatus.test.ts@@ -0,0 +1,68 @@+import { isAgentChatThreadInFilterStatus } from '@/ai/utils/isAgentChatThreadInFilterStatus';++const OPEN_STATUS = { scope: 'INBOX', isMentioned: false } as const;++describe('isAgentChatThreadInFilterStatus', () => {+ it('lists open chats under Open', () => {+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: null },+ inboxStatus: OPEN_STATUS,+ filterStatus: 'active',+ }),+ ).toBe(true);+ });++ it('lists open chats waiting on an answer under Needs input', () => {+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: 'message' },+ inboxStatus: OPEN_STATUS,+ filterStatus: 'needsInput',+ }),+ ).toBe(true);+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: null },+ inboxStatus: OPEN_STATUS,+ filterStatus: 'needsInput',+ }),+ ).toBe(false);+ });++ it('lists open chats the member was mentioned in under Mentions', () => {+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: null },+ inboxStatus: { scope: 'INBOX', isMentioned: true },+ filterStatus: 'mentions',+ }),+ ).toBe(true);+ });++ it('leaves done chats out of the views narrowing Open', () => {+ const doneStatus = { scope: 'ARCHIVED', isMentioned: true } as const;++ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: 'message' },+ inboxStatus: doneStatus,+ filterStatus: 'needsInput',+ }),+ ).toBe(false);+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: 'message' },+ inboxStatus: doneStatus,+ filterStatus: 'mentions',+ }),+ ).toBe(false);+ expect(+ isAgentChatThreadInFilterStatus({+ thread: { pendingQuestionMessageId: 'message' },+ inboxStatus: doneStatus,+ filterStatus: 'done',+ }),+ ).toBe(true);+ });+});diff --git a/packages/twenty-front/src/modules/ai/utils/__tests__/mergeAgentChatThreadParticipants.test.ts b/packages/twenty-front/src/modules/ai/utils/__tests__/mergeAgentChatThreadParticipants.test.tsindex 37233cb2d3c..07f274a1ee4 100644--- a/packages/twenty-front/src/modules/ai/utils/__tests__/mergeAgentChatThreadParticipants.test.ts+++ b/packages/twenty-front/src/modules/ai/utils/__tests__/mergeAgentChatThreadParticipants.test.ts@@ -6,6 +6,8 @@ const READ_PARTICIPANT = {lastReadAt: '2026-10-01T10:00:00.000Z',archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,updatedAt: '2026-10-01T10:00:00.000Z',};diff --git a/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadInboxStatus.ts b/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadInboxStatus.tsindex 809e449cc98..b49cb5055f5 100644--- a/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadInboxStatus.ts+++ b/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadInboxStatus.ts@@ -8,7 +8,8 @@ import { type AgentChatThreadParticipantFieldsFragment } from '~/generated-metad// folded into a status, so a message landing right after an archive brings the// thread back whichever write committed last. Snooze is an archive with a// wake-up time; the server unarchives the thread when it passes and keeps the-// snooze as what brought it back+// snooze as what brought it back. A member who unsubscribed keeps the thread+// under done whatever happens in it.export const getAgentChatThreadInboxStatus = ({lastActivityAt,participant,@@ -20,13 +21,29 @@ export const getAgentChatThreadInboxStatus = ({isDefined(lastActivityAt) &&(!isDefined(participant?.lastReadAt) ||isAfter(lastActivityAt, participant.lastReadAt));+ const isSubscribed = participant?.isSubscribed ?? true;+ const isMentioned = isDefined(participant?.lastMentionedAt);const archivedAt = participant?.archivedAt;const snoozedUntil = participant?.snoozedUntil;+ if (!isSubscribed) {+ return {+ scope: 'ARCHIVED',+ isUnread,+ isSubscribed,+ isMentioned,+ event: isDefined(archivedAt)+ ? { type: 'UNSUBSCRIBED', at: archivedAt }+ : null,+ };+ }+if (!isDefined(archivedAt)) {return {scope: 'INBOX',isUnread,+ isSubscribed,+ isMentioned,event:isDefined(snoozedUntil) &&!(isDefined(lastActivityAt) && isAfter(lastActivityAt, snoozedUntil))@@ -36,13 +53,21 @@ export const getAgentChatThreadInboxStatus = ({}if (isDefined(lastActivityAt) && isAfter(lastActivityAt, archivedAt)) {- return { scope: 'INBOX', isUnread, event: null };+ return {+ scope: 'INBOX',+ isUnread,+ isSubscribed,+ isMentioned,+ event: null,+ };}if (!isDefined(snoozedUntil)) {return {scope: 'ARCHIVED',isUnread,+ isSubscribed,+ isMentioned,event: { type: 'DONE', at: archivedAt },};}@@ -50,6 +75,8 @@ export const getAgentChatThreadInboxStatus = ({return {scope: 'SNOOZED',isUnread,+ isSubscribed,+ isMentioned,event: { type: 'SNOOZED', at: snoozedUntil },};};diff --git a/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadParticipantFromRecord.ts b/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadParticipantFromRecord.tsindex 6c5cf97eb43..5a3e9883801 100644--- a/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadParticipantFromRecord.ts+++ b/packages/twenty-front/src/modules/ai/utils/getAgentChatThreadParticipantFromRecord.ts@@ -10,5 +10,7 @@ export const getAgentChatThreadParticipantFromRecord = (lastReadAt: record.lastReadAt ?? null,archivedAt: record.archivedAt ?? null,snoozedUntil: record.snoozedUntil ?? null,+ isSubscribed: record.isSubscribed ?? true,+ lastMentionedAt: record.lastMentionedAt ?? null,updatedAt: record.updatedAt,});diff --git a/packages/twenty-front/src/modules/ai/utils/isAgentChatThreadInFilterStatus.ts b/packages/twenty-front/src/modules/ai/utils/isAgentChatThreadInFilterStatus.tsnew file mode 100644index 00000000000..738865a9d23--- /dev/null+++ b/packages/twenty-front/src/modules/ai/utils/isAgentChatThreadInFilterStatus.ts@@ -0,0 +1,33 @@+import { isDefined } from 'twenty-shared/utils';++import { type AgentChatThreadFilterStatus } from '@/ai/types/AgentChatThreadFilterStatus';+import { type AgentChatThreadInboxStatus } from '@/ai/types/AgentChatThreadInboxStatus';+import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';++// Needs input and Mentions narrow the open chats, so a chat leaves them once+// it is done or snoozed+export const isAgentChatThreadInFilterStatus = ({+ thread,+ inboxStatus,+ filterStatus,+}: {+ thread: Pick<AgentChatThreadRecord, 'pendingQuestionMessageId'>;+ inboxStatus: Pick<AgentChatThreadInboxStatus, 'scope' | 'isMentioned'>;+ filterStatus: AgentChatThreadFilterStatus;+}): boolean => {+ switch (filterStatus) {+ case 'active':+ return inboxStatus.scope === 'INBOX';+ case 'needsInput':+ return (+ inboxStatus.scope === 'INBOX' &&+ isDefined(thread.pendingQuestionMessageId)+ );+ case 'mentions':+ return inboxStatus.scope === 'INBOX' && inboxStatus.isMentioned;+ case 'snoozed':+ return inboxStatus.scope === 'SNOOZED';+ case 'done':+ return inboxStatus.scope === 'ARCHIVED';+ }+};diff --git a/packages/twenty-front/src/modules/command-menu-item/constants/CommandMenuItemSectionByEngineComponentKey.ts b/packages/twenty-front/src/modules/command-menu-item/constants/CommandMenuItemSectionByEngineComponentKey.tsindex a80851fcad9..c707bc83f0c 100644--- a/packages/twenty-front/src/modules/command-menu-item/constants/CommandMenuItemSectionByEngineComponentKey.ts+++ b/packages/twenty-front/src/modules/command-menu-item/constants/CommandMenuItemSectionByEngineComponentKey.ts@@ -19,6 +19,8 @@ export const COMMAND_MENU_ITEM_SECTION_BY_ENGINE_COMPONENT_KEY = {[EngineComponentKey.MARK_AI_CHAT_AS_DONE]: 'SELECTION',[EngineComponentKey.REOPEN_AI_CHAT]: 'SELECTION',[EngineComponentKey.SNOOZE_AI_CHAT]: 'SELECTION',+ [EngineComponentKey.SUBSCRIBE_TO_AI_CHAT]: 'SELECTION',+ [EngineComponentKey.UNSUBSCRIBE_FROM_AI_CHAT]: 'SELECTION',[EngineComponentKey.EDIT_DASHBOARD_LAYOUT]: 'SELECTION',[EngineComponentKey.SAVE_DASHBOARD_LAYOUT]: 'SELECTION',[EngineComponentKey.CANCEL_DASHBOARD_LAYOUT]: 'SELECTION',diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsxindex 468e796af85..dd1f8767c56 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx@@ -275,6 +275,12 @@ export const ENGINE_COMPONENT_KEY_COMPONENT_MAP: Record<[EngineComponentKey.SNOOZE_AI_CHAT]: (<AgentChatThreadInboxCommand action="snooze" />),+ [EngineComponentKey.SUBSCRIBE_TO_AI_CHAT]: (+ <AgentChatThreadInboxCommand action="subscribe" />+ ),+ [EngineComponentKey.UNSUBSCRIBE_FROM_AI_CHAT]: (+ <AgentChatThreadInboxCommand action="unsubscribe" />+ ),[EngineComponentKey.COMPOSE_EMAIL]: <ComposeEmailCommand />,[EngineComponentKey.COMPOSE_CAMPAIGN]: <ComposeCampaignCommand />,[EngineComponentKey.SEND_MESSAGE_CAMPAIGN]: (diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/components/AgentChatThreadInboxCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/components/AgentChatThreadInboxCommand.tsxindex 6f25cb35f60..b2170053aa4 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/components/AgentChatThreadInboxCommand.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/components/AgentChatThreadInboxCommand.tsx@@ -4,7 +4,14 @@ import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-commandimport { useOpenSnoozeAiChatInSidePanel } from '@/side-panel/hooks/useOpenSnoozeAiChatInSidePanel';type AgentChatThreadInboxCommandProps = {- action: 'read' | 'unread' | 'done' | 'reopen' | 'snooze';+ action:+ | 'read'+ | 'unread'+ | 'done'+ | 'reopen'+ | 'snooze'+ | 'subscribe'+ | 'unsubscribe';};export const AgentChatThreadInboxCommand = ({@@ -16,6 +23,8 @@ export const AgentChatThreadInboxCommand = ({markAgentChatThreadAsUnread,archiveAgentChatThread,moveAgentChatThreadToInbox,+ subscribeToAgentChatThread,+ unsubscribeFromAgentChatThread,} = useAgentChatThreadParticipants();const { openSnoozeAiChatInSidePanel } = useOpenSnoozeAiChatInSidePanel();@@ -35,6 +44,8 @@ export const AgentChatThreadInboxCommand = ({unread: markAgentChatThreadAsUnread,done: archiveAgentChatThread,reopen: moveAgentChatThreadToInbox,+ subscribe: subscribeToAgentChatThread,+ unsubscribe: unsubscribeFromAgentChatThread,}[action];// One at a time: a failed update reloads every chat's state, which woulddiff --git a/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx b/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsxindex b14d690190c..ed018bb3259 100644--- a/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx+++ b/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx@@ -48,6 +48,8 @@ const receiveOpenChat = (lastReadAt,archivedAt: null,snoozedUntil: null,+ isSubscribed: true,+ lastMentionedAt: null,id: 'participant-id',updatedAt: LAST_ACTIVITY_AT,},diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-upgrade-version-command.module.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-upgrade-version-command.module.tsindex 9303e7d1a93..f5fc6797165 100644--- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-upgrade-version-command.module.ts+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-upgrade-version-command.module.ts@@ -12,6 +12,7 @@ import { TurnHiddenAgentMessagesIntoSystemMessagesCommand } from 'src/database/cimport { AddAgentTurnRunFieldsCommand } from 'src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791227584393-add-agent-turn-run-fields.command';import { BackfillFailedAgentTurnsCommand } from 'src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791227584394-backfill-failed-agent-turns.command';import { SuspendPausedAgentStepsCommand } from 'src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791306663446-suspend-paused-agent-steps.command';+import { AddAgentChatThreadSubscriptionsCommand } from 'src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.command';import { ApplicationModule } from 'src/engine/core-modules/application/application.module';import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache.module';import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace-migration/workspace-migration.module';@@ -35,6 +36,7 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspaceAddAgentTurnRunFieldsCommand,BackfillFailedAgentTurnsCommand,SuspendPausedAgentStepsCommand,+ AddAgentChatThreadSubscriptionsCommand,],})export class V2_46_UpgradeVersionCommandModule {}diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.command.tsnew file mode 100644index 00000000000..ec4a05d1d84--- /dev/null+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.command.ts@@ -0,0 +1,206 @@+import { Command } from 'nest-commander';+import { TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER } from 'twenty-shared/application';+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';+import { isDefined } from 'twenty-shared/utils';++import { ProvisionedWorkspaceCommandRunner } from 'src/database/commands/command-runners/provisioned-workspace.command-runner';+import { WorkspaceIteratorService } from 'src/database/commands/command-runners/workspace-iterator.service';+import { type RunOnWorkspaceArgs } from 'src/database/commands/command-runners/workspace.command-runner';+import { getStandardFlatEntitiesToCreateOrThrow } from 'src/database/commands/upgrade-version-command/2-10/utils/get-standard-flat-entities-to-create-or-throw.util';+import { buildMissingStandardCommandMenuItemsToCreate } from 'src/database/commands/upgrade-version-command/2-39/utils/build-missing-standard-command-menu-items-to-create.util';+import { ApplicationService } from 'src/engine/core-modules/application/application.service';+import { RegisteredWorkspaceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-workspace-command.decorator';+import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';+import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';+import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';+import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';+import { computeTwentyStandardApplicationAllFlatEntityMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/twenty-standard-application-all-flat-entity-maps.constant';+import { WorkspaceMigrationBuilderException } from 'src/engine/workspace-manager/workspace-migration/exceptions/workspace-migration-builder-exception';+import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';++const SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS = [+ STANDARD_OBJECTS.agentChatThreadParticipant.fields.isSubscribed+ .universalIdentifier,+ STANDARD_OBJECTS.agentChatThreadParticipant.fields.lastMentionedAt+ .universalIdentifier,+];++const SUBSCRIPTION_COMMAND_MENU_ITEM_NAMES = [+ 'subscribeToAiChat',+ 'unsubscribeFromAiChat',+] as const;++// Upgrades from 2.45 get the fields with the participant object, so this+// only adds them where that object was created before they existed. Every+// existing row is a subscription, which the default keeps.+@RegisteredWorkspaceCommand('2.46.0', 1791322315043)+@Command({+ name: 'upgrade:2-46:add-agent-chat-thread-subscriptions',+ description:+ 'Add the subscription and last mention of chat participants, and the Subscribe and Unsubscribe commands',+})+export class AddAgentChatThreadSubscriptionsCommand extends ProvisionedWorkspaceCommandRunner {+ constructor(+ protected readonly workspaceIteratorService: WorkspaceIteratorService,+ private readonly applicationService: ApplicationService,+ private readonly workspaceCacheService: WorkspaceCacheService,+ private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService,+ ) {+ super(workspaceIteratorService);+ }++ override async runOnWorkspace(args: RunOnWorkspaceArgs): Promise<void> {+ await this.up(args);+ }++ async up({ workspaceId, options }: RunOnWorkspaceArgs): Promise<void> {+ const {+ flatObjectMetadataMaps,+ flatFieldMetadataMaps,+ flatCommandMenuItemMaps,+ } = await this.workspaceCacheService.getOrRecompute(workspaceId, [+ 'flatObjectMetadataMaps',+ 'flatFieldMetadataMaps',+ 'flatCommandMenuItemMaps',+ ]);++ const hasParticipantObject = isDefined(+ flatObjectMetadataMaps.byUniversalIdentifier[+ STANDARD_OBJECTS.agentChatThreadParticipant.universalIdentifier+ ],+ );++ const { twentyStandardFlatApplication } =+ await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(+ { workspaceId },+ );++ const fieldsToCreate = hasParticipantObject+ ? getStandardFlatEntitiesToCreateOrThrow<FlatFieldMetadata>({+ standardFlatEntityMaps: computeTwentyStandardApplicationAllFlatEntityMaps(+ {+ now: new Date().toISOString(),+ workspaceId,+ twentyStandardApplicationId: twentyStandardFlatApplication.id,+ },+ ).allFlatEntityMaps.flatFieldMetadataMaps,+ existingFlatEntityMaps: flatFieldMetadataMaps,+ universalIdentifiers: SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS,+ })+ : [];++ const commandMenuItemsToCreate =+ buildMissingStandardCommandMenuItemsToCreate({+ commandMenuItemNames: [...SUBSCRIPTION_COMMAND_MENU_ITEM_NAMES],+ flatCommandMenuItemByUniversalIdentifier:+ flatCommandMenuItemMaps.byUniversalIdentifier,+ flatObjectMetadataMaps,+ workspaceId,+ now: new Date().toISOString(),+ });++ if (fieldsToCreate.length + commandMenuItemsToCreate.length === 0) {+ return;+ }++ this.logger.log(+ `${options.dryRun ? '[DRY RUN] ' : ''}Workspace ${workspaceId}: creating ${fieldsToCreate.length} chat participant field(s) and ${commandMenuItemsToCreate.length} command menu item(s)`,+ );++ if (options.dryRun ?? false) {+ return;+ }++ const result =+ await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(+ {+ workspaceId,+ isSystemBuild: true,+ applicationUniversalIdentifier:+ TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER,+ allFlatEntityOperationByMetadataName: {+ fieldMetadata: {+ flatEntityToCreate: fieldsToCreate,+ flatEntityToDelete: [],+ flatEntityToUpdate: [],+ },+ commandMenuItem: {+ flatEntityToCreate: commandMenuItemsToCreate,+ flatEntityToDelete: [],+ flatEntityToUpdate: [],+ },+ },+ },+ );++ if (result.status === 'fail') {+ throw new WorkspaceMigrationBuilderException(+ result,+ `Failed to add chat subscriptions for workspace ${workspaceId}`,+ );+ }+ }++ async down({ workspaceId, options }: RunOnWorkspaceArgs): Promise<void> {+ const { flatFieldMetadataMaps, flatCommandMenuItemMaps } =+ await this.workspaceCacheService.getOrRecompute(workspaceId, [+ 'flatFieldMetadataMaps',+ 'flatCommandMenuItemMaps',+ ]);++ const fieldsToDelete = SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS.map(+ (universalIdentifier) =>+ findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({+ flatEntityMaps: flatFieldMetadataMaps,+ universalIdentifier,+ }),+ ).filter(isDefined);+ const commandMenuItemsToDelete = SUBSCRIPTION_COMMAND_MENU_ITEM_NAMES.map(+ (name) =>+ flatCommandMenuItemMaps.byUniversalIdentifier[+ STANDARD_COMMAND_MENU_ITEMS[name].universalIdentifier+ ],+ ).filter(isDefined);++ if (fieldsToDelete.length + commandMenuItemsToDelete.length === 0) {+ return;+ }++ this.logger.log(+ `${options.dryRun ? '[DRY RUN] ' : ''}Workspace ${workspaceId}: deleting ${fieldsToDelete.length} chat participant field(s) and ${commandMenuItemsToDelete.length} command menu item(s)`,+ );++ if (options.dryRun ?? false) {+ return;+ }++ const result =+ await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(+ {+ workspaceId,+ isSystemBuild: true,+ applicationUniversalIdentifier:+ TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER,+ allFlatEntityOperationByMetadataName: {+ fieldMetadata: {+ flatEntityToCreate: [],+ flatEntityToDelete: fieldsToDelete,+ flatEntityToUpdate: [],+ },+ commandMenuItem: {+ flatEntityToCreate: [],+ flatEntityToDelete: commandMenuItemsToDelete,+ flatEntityToUpdate: [],+ },+ },+ },+ );++ if (result.status === 'fail') {+ throw new WorkspaceMigrationBuilderException(+ result,+ `Failed to remove chat subscriptions for workspace ${workspaceId}`,+ );+ }+ }+}diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-thread-participant.dto.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-thread-participant.dto.tsindex ff0b5c5d479..b9ba719703d 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-thread-participant.dto.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-thread-participant.dto.ts@@ -19,6 +19,12 @@ export class AgentChatThreadParticipantDTO {@Field(() => Date, { nullable: true })snoozedUntil: Date | null;+ @Field(() => Boolean)+ isSubscribed: boolean;++ @Field(() => Date, { nullable: true })+ lastMentionedAt: Date | null;+// Orders the copies a member's apps receive, so an older one never wins@Field(() => Date)updatedAt: Date;diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/send-chat-message-result.dto.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/send-chat-message-result.dto.tsindex d7964095cca..8bb214d6a83 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/send-chat-message-result.dto.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/send-chat-message-result.dto.ts@@ -1,5 +1,7 @@import { Field, ObjectType } from '@nestjs/graphql';+import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';+@ObjectType('SendChatMessageResult')export class SendChatMessageResultDTO {// null when a retried turn was opened by the agent, without a user message@@ -11,4 +13,9 @@ export class SendChatMessageResultDTO {@Field(() => String, { nullable: true })streamId?: string;++ // The mentioned members who now follow the chat, leaving out those who+ // cannot reply in it+ @Field(() => [UUIDScalarType], { nullable: true })+ mentionedParticipantWorkspaceMemberIds?: string[];}diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/__tests__/agent-chat.resolver.sharing.spec.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/__tests__/agent-chat.resolver.sharing.spec.tsindex 2530ea503c8..d8e7cb0c1ef 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/__tests__/agent-chat.resolver.sharing.spec.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/__tests__/agent-chat.resolver.sharing.spec.ts@@ -176,6 +176,7 @@ describe('Shared conversation API boundaries', () => {null,undefined,null,+ null,VIEWER_ID,'member',workspace,@@ -218,6 +219,7 @@ describe('Shared conversation API boundaries', () => {null,undefined,null,+ null,VIEWER_ID,'member',workspace,@@ -266,6 +268,7 @@ describe('Shared conversation API boundaries', () => {null,undefined,null,+ null,VIEWER_ID,'member',workspace,@@ -280,6 +283,61 @@ describe('Shared conversation API boundaries', () => {);});+ it('adds the mentioned members once the message is sent', async () => {+ const { resolver, threadService, streaming } = buildResolver();+ const addParticipants = jest+ .spyOn(threadService, 'addParticipants')+ .mockResolvedValue(['jony']);++ const result = await resolver.sendChatMessage(+ THREAD_ID,+ 'Can you look at this @Jony @Tim',+ 'message',+ null,+ undefined,+ null,+ ['jony', 'tim'],+ 'owner-user',+ 'owner',+ workspace,+ );++ expect(streaming.streamAgentChat).toHaveBeenCalled();+ expect(addParticipants).toHaveBeenCalledWith({+ threadId: THREAD_ID,+ workspaceMemberId: 'owner',+ workspaceId: WORKSPACE_ID,+ participantWorkspaceMemberIds: ['jony', 'tim'],+ });+ expect(result.mentionedParticipantWorkspaceMemberIds).toEqual(['jony']);+ });++ it('keeps a sent message sent when its mentions cannot be applied', async () => {+ const { resolver, threadService } = buildResolver();++ jest+ .spyOn(threadService, 'addParticipants')+ .mockRejectedValue(new Error('share failed'));++ const result = await resolver.sendChatMessage(+ THREAD_ID,+ 'Can you look at this @Jony',+ 'message',+ null,+ undefined,+ null,+ ['jony'],+ 'owner-user',+ 'owner',+ workspace,+ );++ expect(result).toMatchObject({+ messageId: 'message',+ mentionedParticipantWorkspaceMemberIds: [],+ });+ });+it('allows an editor to remove a queued message after update authorization', async () => {const { resolver, sharing, messages } = buildResolver();sharing.getThreadWithAccess.mockResolvedValue({diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat-thread-participant.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat-thread-participant.resolver.tsindex 7dc612aa4ea..a14975e64ed 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat-thread-participant.resolver.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat-thread-participant.resolver.ts@@ -106,6 +106,32 @@ export class AgentChatThreadParticipantResolver {});}+ @Mutation(() => AgentChatThreadParticipantDTO)+ async subscribeToAgentChatThread(+ @Args('threadId', { type: () => UUIDScalarType }) threadId: string,+ @AuthWorkspaceMemberId() workspaceMemberId: string,+ @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,+ ): Promise<AgentChatThreadParticipantDTO> {+ return this.participantService.subscribe({+ threadId,+ workspaceMemberId,+ workspaceId,+ });+ }++ @Mutation(() => AgentChatThreadParticipantDTO)+ async unsubscribeFromAgentChatThread(+ @Args('threadId', { type: () => UUIDScalarType }) threadId: string,+ @AuthWorkspaceMemberId() workspaceMemberId: string,+ @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,+ ): Promise<AgentChatThreadParticipantDTO> {+ return this.participantService.unsubscribe({+ threadId,+ workspaceMemberId,+ workspaceId,+ });+ }+// Returns the members who were added, leaving out those who cannot reply in the chat@Mutation(() => [UUIDScalarType])async addAgentChatThreadParticipants(diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.tsindex 83d29f436c3..283f5abe8f7 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts@@ -169,10 +169,59 @@ export class AgentChatResolver {nullable: true,})fileAttachments: FileAttachmentInput[] | null,+ @Args('mentionedWorkspaceMemberIds', {+ type: () => [UUIDScalarType],+ nullable: true,+ })+ mentionedWorkspaceMemberIds: string[] | null,@AuthUserWorkspaceId() userWorkspaceId: string,@AuthWorkspaceMemberId() workspaceMemberId: string,@AuthWorkspace() workspace: WorkspaceEntity,): Promise<SendChatMessageResultDTO> {+ const sentMessage = await this.sendChatMessageToThread({+ threadId,+ text,+ messageId,+ browsingContext,+ modelId,+ fileAttachments,+ userWorkspaceId,+ workspaceMemberId,+ workspace,+ });++ const mentionedParticipantWorkspaceMemberIds =+ await this.threadService.addMentionedParticipants({+ threadId,+ workspaceMemberId,+ workspaceId: workspace.id,+ mentionedWorkspaceMemberIds: mentionedWorkspaceMemberIds ?? [],+ });++ return { ...sentMessage, mentionedParticipantWorkspaceMemberIds };+ }++ private async sendChatMessageToThread({+ threadId,+ text,+ messageId,+ browsingContext,+ modelId,+ fileAttachments,+ userWorkspaceId,+ workspaceMemberId,+ workspace,+ }: {+ threadId: string;+ text: string;+ messageId: string;+ browsingContext: BrowsingContextType | null;+ modelId: string | undefined;+ fileAttachments: FileAttachmentInput[] | null;+ userWorkspaceId: string;+ workspaceMemberId: string;+ workspace: WorkspaceEntity;+ }): Promise<SendChatMessageResultDTO> {const thread = await this.turnPreflightService.assertCanStartChatTurn({threadId,modelId,diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-sharing.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-sharing.service.tsindex 45693adb363..38ed09f8fb5 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-sharing.service.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-sharing.service.ts@@ -7,6 +7,7 @@ import { Injectable } from '@nestjs/common';import chunk from 'lodash.chunk';import { PermissionFlagType } from 'twenty-shared/constants';+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';import { RecordShareAccessLevel } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';@@ -16,6 +17,7 @@ import { RecordShareStorageService } from 'src/engine/core-modules/record-share/import { RecordSharingService } from 'src/engine/core-modules/record-share/services/record-sharing.service';import { UserWorkspaceAuthContextService } from 'src/engine/core-modules/user-workspace/services/user-workspace-auth-context.service';import { type AgentChatThreadAccessArgs } from 'src/engine/metadata-modules/ai/ai-chat/types/agent-chat-thread-access-args.type';+import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';import { findAgentChatFlatObjectMetadata } from 'src/engine/metadata-modules/ai/ai-chat/utils/find-agent-chat-flat-object-metadata.util';import { throwAgentChatThreadNotFound } from 'src/engine/metadata-modules/ai/ai-chat/utils/throw-agent-chat-thread-not-found.util';import { AgentChatThreadWorkspaceEntity } from 'src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread.workspace-entity';@@ -32,6 +34,12 @@ import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/worksconst READABLE_THREAD_IDS_BATCH_SIZE = 1000;+// Added by 2.46 commands that run after the participant object's+const INBOX_STATE_LATER_FIELD_UNIVERSAL_IDENTIFIERS = [+ STANDARD_OBJECTS.agentChatThreadParticipant.fields.isSubscribed+ .universalIdentifier,+];+const EDIT_ACCESS_LEVELS: (RecordShareAccessLevel | null | undefined)[] = [RecordShareAccessLevel.READ_WRITE,RecordShareAccessLevel.FULL,@@ -50,10 +58,10 @@ export class AgentChatSharingService {private readonly workspaceOrmManager: WorkspaceOrmManager,) {}- // Fence for the 2.46 cross-upgrade window: until- // upgrade:2-46:add-agent-chat-thread-participant-object has reached a- // workspace, it has neither the participant table nor the thread's- // lastActivityAt column. Remove once 2.46 leaves the window.+ // Fence for the 2.46 cross-upgrade window: until every 2.46 inbox command+ // has reached a workspace, it lacks the participant table, the thread's+ // lastActivityAt column or the fields added after them. Remove once 2.46+ // leaves the window.async hasInboxState(workspaceId: string): Promise<boolean> {return isDefined(await this.findParticipantObjectMetadataId(workspaceId));}@@ -61,11 +69,27 @@ export class AgentChatSharingService {async findParticipantObjectMetadataId(workspaceId: string,): Promise<string | undefined> {- const { flatObjectMetadataMaps } =+ const { flatObjectMetadataMaps, flatFieldMetadataMaps } =await this.workspaceCacheService.getOrRecompute(workspaceId, ['flatObjectMetadataMaps',+ 'flatFieldMetadataMaps',]);+ const hasLaterInboxFields =+ INBOX_STATE_LATER_FIELD_UNIVERSAL_IDENTIFIERS.every(+ (universalIdentifier) =>+ isDefined(+ findFlatEntityByUniversalIdentifier({+ flatEntityMaps: flatFieldMetadataMaps,+ universalIdentifier,+ }),+ ),+ );++ if (!hasLaterInboxFields) {+ return undefined;+ }+return findAgentChatFlatObjectMetadata(flatObjectMetadataMaps,'agentChatThreadParticipant',diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread-participant.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread-participant.service.tsindex cbf6f717e77..670c33177fc 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread-participant.service.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread-participant.service.ts@@ -36,17 +36,19 @@ type BuildParticipantWriteQuery = (tables: {}) => string;// A snooze whose end is already due, which its queued end may have checked-// before this write, is saved as ended+// before this write, is saved as ended. A snoozed thread is meant to come+// back, so snoozing follows it againconst buildArchiveQuery: BuildParticipantWriteQuery = ({ participantTable }) =>`INSERT INTO ${participantTable} AS participant ("threadId", "workspaceMemberId", "archivedAt", "snoozedUntil")VALUES ($1, $2, CASE WHEN $3::timestamptz <= clock_timestamp() THEN NULL ELSE clock_timestamp() END, $3)ON CONFLICT ("threadId", "workspaceMemberId") DO UPDATE SET"archivedAt" = EXCLUDED."archivedAt","snoozedUntil" = EXCLUDED."snoozedUntil",+ "isSubscribed" = participant."isSubscribed" OR EXCLUDED."snoozedUntil" IS NOT NULL,"updatedAt" = now()RETURNING *`;-const PARTICIPANT_COLUMNS = `id, "workspaceMemberId", "threadId", "lastReadAt", "archivedAt", "snoozedUntil", "updatedAt"`;+const PARTICIPANT_COLUMNS = `id, "workspaceMemberId", "threadId", "lastReadAt", "archivedAt", "snoozedUntil", "isSubscribed", "lastMentionedAt", "updatedAt"`;// Timestamps compared against thread.lastActivityAt are stamped by Postgres// (clock_timestamp), so ordering follows the database rather than app servers.@@ -95,19 +97,56 @@ export class AgentChatThreadParticipantService {}// A mention brings the chat back unread for the mentioned member, who the- // caller has already checked can reply in it+ // caller has already checked can reply in it, and follows it again for a+ // member who had unsubscribedasync markAsMentioned(args: AgentChatThreadAccessArgs,): Promise<AgentChatThreadParticipantRow | null> {return this.writeOne(args,({ participantTable }) =>- `INSERT INTO ${participantTable} AS participant ("threadId", "workspaceMemberId")- VALUES ($1, $2)+ `INSERT INTO ${participantTable} AS participant ("threadId", "workspaceMemberId", "lastMentionedAt")+ VALUES ($1, $2, clock_timestamp())ON CONFLICT ("threadId", "workspaceMemberId") DO UPDATE SET"lastReadAt" = NULL,"archivedAt" = NULL,"snoozedUntil" = NULL,+ "isSubscribed" = true,+ "lastMentionedAt" = EXCLUDED."lastMentionedAt",+ "updatedAt" = now()+ RETURNING *`,+ );+ }++ async subscribe(+ args: AgentChatThreadAccessArgs,+ ): Promise<AgentChatThreadParticipantDTO> {+ return this.upsertOne(+ args,+ ({ participantTable }) =>+ `INSERT INTO ${participantTable} AS participant ("threadId", "workspaceMemberId")+ VALUES ($1, $2)+ ON CONFLICT ("threadId", "workspaceMemberId") DO UPDATE SET+ "isSubscribed" = true,+ "updatedAt" = now()+ RETURNING *`,+ );+ }++ // Files the chat under done and keeps it there whatever happens in it,+ // until the member is mentioned or writes in it again+ async unsubscribe(+ args: AgentChatThreadAccessArgs,+ ): Promise<AgentChatThreadParticipantDTO> {+ return this.upsertOne(+ args,+ ({ participantTable }) =>+ `INSERT INTO ${participantTable} AS participant ("threadId", "workspaceMemberId", "isSubscribed", "archivedAt")+ VALUES ($1, $2, false, clock_timestamp())+ ON CONFLICT ("threadId", "workspaceMemberId") DO UPDATE SET+ "isSubscribed" = false,+ "archivedAt" = EXCLUDED."archivedAt",+ "snoozedUntil" = NULL,"updatedAt" = now()RETURNING *`,);@@ -226,13 +265,14 @@ export class AgentChatThreadParticipantService {ON CONFLICT ("threadId", "workspaceMemberId") DO UPDATE SET"archivedAt" = NULL,"snoozedUntil" = NULL,+ "isSubscribed" = true,"updatedAt" = now()RETURNING *`,);}- // A member who writes in a thread has read it and wants it back in their- // inbox, so their cursor follows the activity they just created+ // A member who writes in a thread has read it and follows it again, so+ // their cursor follows the activity they just createdasync recordMemberActivity({workspaceId,workspaceMemberId,@@ -284,6 +324,7 @@ export class AgentChatThreadParticipantService {"lastReadAt" = GREATEST(participant."lastReadAt", EXCLUDED."lastReadAt"),"archivedAt" = NULL,"snoozedUntil" = NULL,+ "isSubscribed" = true,"updatedAt" = now()RETURNING id, "workspaceMemberId"), owner_share AS (diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread.service.tsindex c561d4e933b..df32908fc13 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread.service.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-thread.service.ts@@ -1,4 +1,4 @@-import { Injectable } from '@nestjs/common';+import { Injectable, Logger } from '@nestjs/common';import { isDefined } from 'twenty-shared/utils';@@ -20,6 +20,8 @@ import {@Injectable()export class AgentChatThreadService {+ private readonly logger = new Logger(AgentChatThreadService.name);+constructor(@InjectAgentHistoryRepository('agentChatThread')private readonly threadRepository: AgentHistoryRepository<AgentChatThreadWorkspaceEntity>,@@ -158,6 +160,33 @@ export class AgentChatThreadService {return participantMemberIds;}+ // The message is already sent, so a mention that cannot be applied leaves the+ // member out rather than failing the send+ async addMentionedParticipants({+ mentionedWorkspaceMemberIds,+ ...args+ }: AgentChatThreadAccessArgs & {+ mentionedWorkspaceMemberIds: string[];+ }): Promise<string[]> {+ if (mentionedWorkspaceMemberIds.length === 0) {+ return [];+ }++ try {+ return await this.addParticipants({+ ...args,+ participantWorkspaceMemberIds: mentionedWorkspaceMemberIds,+ });+ } catch (error) {+ this.logger.error(+ `Could not add the members mentioned in chat ${args.threadId} of workspace ${args.workspaceId}`,+ error,+ );++ return [];+ }+ }+// Activity no member wrote, such as an agent turn or an application's// message, leaves the chat unread for everyoneasync recordThreadActivity({diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-participant.workspace-entity.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-participant.workspace-entity.tsindex f4ec76273b4..b781b31738d 100644--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-participant.workspace-entity.ts+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-participant.workspace-entity.ts@@ -12,4 +12,6 @@ export class AgentChatThreadParticipantWorkspaceEntity extends BaseWorkspaceEntilastReadAt: string | null;archivedAt: string | null;snoozedUntil: string | null;+ isSubscribed: boolean;+ lastMentionedAt: string | null;}diff --git a/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts b/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.tsindex 21377de495c..c6e8d34a056 100644--- a/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts+++ b/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts@@ -54,6 +54,8 @@ export enum EngineComponentKey {MARK_AI_CHAT_AS_DONE = 'MARK_AI_CHAT_AS_DONE',REOPEN_AI_CHAT = 'REOPEN_AI_CHAT',SNOOZE_AI_CHAT = 'SNOOZE_AI_CHAT',+ SUBSCRIBE_TO_AI_CHAT = 'SUBSCRIBE_TO_AI_CHAT',+ UNSUBSCRIBE_FROM_AI_CHAT = 'UNSUBSCRIBE_FROM_AI_CHAT',NAVIGATION = 'NAVIGATION',TRIGGER_WORKFLOW_VERSION = 'TRIGGER_WORKFLOW_VERSION',FRONT_COMPONENT_RENDERER = 'FRONT_COMPONENT_RENDERER',diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/__tests__/standard-ai-chat-inbox-command-menu-items.spec.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/__tests__/standard-ai-chat-inbox-command-menu-items.spec.tsindex 9adc23ca26b..d4d6a80f154 100644--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/__tests__/standard-ai-chat-inbox-command-menu-items.spec.ts+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/__tests__/standard-ai-chat-inbox-command-menu-items.spec.ts@@ -27,6 +27,32 @@ const getAvailableInboxCommands = (...scopes: InboxScope[]) =>),);+const SUBSCRIPTION_COMMAND_MENU_ITEM_NAMES = [+ 'subscribeToAiChat',+ 'unsubscribeFromAiChat',+] as const;++const getAvailableSubscriptionCommands = (...subscriptions: boolean[]) =>+ SUBSCRIPTION_COMMAND_MENU_ITEM_NAMES.filter((name) =>+ evaluateConditionalAvailabilityExpression(+ STANDARD_COMMAND_MENU_ITEMS[name].conditionalAvailabilityExpression,+ {+ numberOfSelectedRecords: subscriptions.length,+ permissionFlags: { AI: true },+ selectedRecords: subscriptions.map((isSubscribed, index) => ({+ id: `thread-${index}`,+ deletedAt: null,+ inboxStatus: {+ scope: 'INBOX',+ isUnread: false,+ isSubscribed,+ event: null,+ },+ })),+ },+ ),+ );+describe('AI chat inbox command menu items', () => {it('offers done and snooze on an open chat', () => {expect(getAvailableInboxCommands('INBOX')).toEqual([@@ -58,4 +84,20 @@ describe('AI chat inbox command menu items', () => {'snoozeAiChat',]);});++ it('offers unsubscribe on followed chats', () => {+ expect(getAvailableSubscriptionCommands(true, true)).toEqual([+ 'unsubscribeFromAiChat',+ ]);+ });++ it('offers subscribe on unfollowed chats', () => {+ expect(getAvailableSubscriptionCommands(false)).toEqual([+ 'subscribeToAiChat',+ ]);+ });++ it('offers neither on a mix of followed and unfollowed chats', () => {+ expect(getAvailableSubscriptionCommands(true, false)).toEqual([]);+ });});diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.tsindex f72021bcf03..a31162a80ab 100644--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts@@ -1060,6 +1060,46 @@ export const STANDARD_COMMAND_MENU_ITEMS = {engineComponentKey: EngineComponentKey.SNOOZE_AI_CHAT,hotKeys: ['H'],},+ subscribeToAiChat: {+ universalIdentifier: 'bf5345f0-14d3-438b-ab02-1daa5386743f',+ label: i18nLabel(+ msg({ message: `Subscribe`, context: 'commandMenuItem.label' }),+ ),+ icon: 'IconBell',+ isPinned: false,+ position: 78,+ shortLabel: i18nLabel(+ msg({ message: `Subscribe`, context: 'commandMenuItem.shortLabel' }),+ ),+ availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,+ conditionalAvailabilityExpression:+ 'numberOfSelectedRecords >= 1 and permissionFlags.AI and noneDefined(selectedRecords, "deletedAt") and everyEquals(selectedRecords, "inboxStatus.isSubscribed", false)',+ availabilityObjectMetadataUniversalIdentifier:+ STANDARD_OBJECTS.agentChatThread.universalIdentifier,+ frontComponentUniversalIdentifier: null,+ engineComponentKey: EngineComponentKey.SUBSCRIBE_TO_AI_CHAT,+ hotKeys: null,+ },+ unsubscribeFromAiChat: {+ universalIdentifier: '31dbf857-d442-447a-be76-e4eb8ef34fcf',+ label: i18nLabel(+ msg({ message: `Unsubscribe`, context: 'commandMenuItem.label' }),+ ),+ icon: 'IconBellOff',+ isPinned: false,+ position: 79,+ shortLabel: i18nLabel(+ msg({ message: `Unsubscribe`, context: 'commandMenuItem.shortLabel' }),+ ),+ availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,+ conditionalAvailabilityExpression:+ 'numberOfSelectedRecords >= 1 and permissionFlags.AI and noneDefined(selectedRecords, "deletedAt") and everyEquals(selectedRecords, "inboxStatus.isSubscribed", true)',+ availabilityObjectMetadataUniversalIdentifier:+ STANDARD_OBJECTS.agentChatThread.universalIdentifier,+ frontComponentUniversalIdentifier: null,+ engineComponentKey: EngineComponentKey.UNSUBSCRIBE_FROM_AI_CHAT,+ hotKeys: null,+ },// Chats keep their pinned Share item; it is a system object, so this one never shows thereshareAnyRecord: {universalIdentifier: '1e703e2c-9f3a-4a23-8448-107b01be509c',diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snapindex a82aa67ac35..0daf757a912 100644--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap@@ -106,6 +106,12 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object"id": {"id": "00000000-0000-0000-0000-000000001043",},+ "isSubscribed": {+ "id": "00000000-0000-0000-0000-000000001052",+ },+ "lastMentionedAt": {+ "id": "00000000-0000-0000-0000-000000001053",+ },"lastReadAt": {"id": "00000000-0000-0000-0000-000000001049",},@@ -122,238 +128,238 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object"id": "00000000-0000-0000-0000-000000001048",},},- "id": "00000000-0000-0000-0000-000000001052",+ "id": "00000000-0000-0000-0000-000000001054","views": undefined,},"agentChatThreadTarget": {"fields": {"createdAt": {- "id": "00000000-0000-0000-0000-000000001054",+ "id": "00000000-0000-0000-0000-000000001056",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001056",+ "id": "00000000-0000-0000-0000-000000001058",},"id": {- "id": "00000000-0000-0000-0000-000000001053",+ "id": "00000000-0000-0000-0000-000000001055",},"targetCompany": {- "id": "00000000-0000-0000-0000-000000001059",+ "id": "00000000-0000-0000-0000-000000001061",},"targetOpportunity": {- "id": "00000000-0000-0000-0000-000000001060",+ "id": "00000000-0000-0000-0000-000000001062",},"targetPerson": {- "id": "00000000-0000-0000-0000-000000001058",+ "id": "00000000-0000-0000-0000-000000001060",},"thread": {- "id": "00000000-0000-0000-0000-000000001057",+ "id": "00000000-0000-0000-0000-000000001059",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001055",+ "id": "00000000-0000-0000-0000-000000001057",},},- "id": "00000000-0000-0000-0000-000000001061",+ "id": "00000000-0000-0000-0000-000000001063","views": {},},"agentMessage": {"fields": {"agentId": {- "id": "00000000-0000-0000-0000-000000001086",+ "id": "00000000-0000-0000-0000-000000001088",},"createdAt": {- "id": "00000000-0000-0000-0000-000000001083",+ "id": "00000000-0000-0000-0000-000000001085",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001085",+ "id": "00000000-0000-0000-0000-000000001087",},"id": {- "id": "00000000-0000-0000-0000-000000001082",+ "id": "00000000-0000-0000-0000-000000001084",},"isHidden": {- "id": "00000000-0000-0000-0000-000000001092",+ "id": "00000000-0000-0000-0000-000000001094",},"parts": {- "id": "00000000-0000-0000-0000-000000001096",+ "id": "00000000-0000-0000-0000-000000001098",},"processedAt": {- "id": "00000000-0000-0000-0000-000000001093",+ "id": "00000000-0000-0000-0000-000000001095",},"role": {- "id": "00000000-0000-0000-0000-000000001090",+ "id": "00000000-0000-0000-0000-000000001092",},"senderApplicationId": {- "id": "00000000-0000-0000-0000-000000001089",+ "id": "00000000-0000-0000-0000-000000001091",},"senderUserWorkspaceId": {- "id": "00000000-0000-0000-0000-000000001088",+ "id": "00000000-0000-0000-0000-000000001090",},"senderWorkspaceMember": {- "id": "00000000-0000-0000-0000-000000001087",+ "id": "00000000-0000-0000-0000-000000001089",},"status": {- "id": "00000000-0000-0000-0000-000000001091",+ "id": "00000000-0000-0000-0000-000000001093",},"thread": {- "id": "00000000-0000-0000-0000-000000001094",+ "id": "00000000-0000-0000-0000-000000001096",},"turn": {- "id": "00000000-0000-0000-0000-000000001095",+ "id": "00000000-0000-0000-0000-000000001097",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001084",+ "id": "00000000-0000-0000-0000-000000001086",},},- "id": "00000000-0000-0000-0000-000000001097",+ "id": "00000000-0000-0000-0000-000000001099","views": undefined,},"agentMessagePart": {"fields": {"createdAt": {- "id": "00000000-0000-0000-0000-000000001099",+ "id": "00000000-0000-0000-0000-000000001101",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001101",+ "id": "00000000-0000-0000-0000-000000001103",},"errorDetails": {- "id": "00000000-0000-0000-0000-000000001113",+ "id": "00000000-0000-0000-0000-000000001115",},"errorMessage": {- "id": "00000000-0000-0000-0000-000000001112",+ "id": "00000000-0000-0000-0000-000000001114",},"fileFilename": {- "id": "00000000-0000-0000-0000-000000001121",+ "id": "00000000-0000-0000-0000-000000001123",},"fileId": {- "id": "00000000-0000-0000-0000-000000001122",+ "id": "00000000-0000-0000-0000-000000001124",},"id": {- "id": "00000000-0000-0000-0000-000000001098",+ "id": "00000000-0000-0000-0000-000000001100",},"message": {- "id": "00000000-0000-0000-0000-000000001124",+ "id": "00000000-0000-0000-0000-000000001126",},"orderIndex": {- "id": "00000000-0000-0000-0000-000000001102",+ "id": "00000000-0000-0000-0000-000000001104",},"providerExecuted": {- "id": "00000000-0000-0000-0000-000000001111",+ "id": "00000000-0000-0000-0000-000000001113",},"providerMetadata": {- "id": "00000000-0000-0000-0000-000000001123",+ "id": "00000000-0000-0000-0000-000000001125",},"reasoningContent": {- "id": "00000000-0000-0000-0000-000000001105",+ "id": "00000000-0000-0000-0000-000000001107",},"sourceDocumentFilename": {- "id": "00000000-0000-0000-0000-000000001120",+ "id": "00000000-0000-0000-0000-000000001122",},"sourceDocumentMediaType": {- "id": "00000000-0000-0000-0000-000000001118",+ "id": "00000000-0000-0000-0000-000000001120",},"sourceDocumentSourceId": {- "id": "00000000-0000-0000-0000-000000001117",+ "id": "00000000-0000-0000-0000-000000001119",},"sourceDocumentTitle": {- "id": "00000000-0000-0000-0000-000000001119",+ "id": "00000000-0000-0000-0000-000000001121",},"sourceUrlSourceId": {- "id": "00000000-0000-0000-0000-000000001114",+ "id": "00000000-0000-0000-0000-000000001116",},"sourceUrlTitle": {- "id": "00000000-0000-0000-0000-000000001116",+ "id": "00000000-0000-0000-0000-000000001118",},"sourceUrlUrl": {- "id": "00000000-0000-0000-0000-000000001115",+ "id": "00000000-0000-0000-0000-000000001117",},"state": {- "id": "00000000-0000-0000-0000-000000001110",+ "id": "00000000-0000-0000-0000-000000001112",},"textContent": {- "id": "00000000-0000-0000-0000-000000001104",+ "id": "00000000-0000-0000-0000-000000001106",},"toolCallId": {- "id": "00000000-0000-0000-0000-000000001107",+ "id": "00000000-0000-0000-0000-000000001109",},"toolInput": {- "id": "00000000-0000-0000-0000-000000001108",+ "id": "00000000-0000-0000-0000-000000001110",},"toolName": {- "id": "00000000-0000-0000-0000-000000001106",+ "id": "00000000-0000-0000-0000-000000001108",},"toolOutput": {- "id": "00000000-0000-0000-0000-000000001109",+ "id": "00000000-0000-0000-0000-000000001111",},"type": {- "id": "00000000-0000-0000-0000-000000001103",+ "id": "00000000-0000-0000-0000-000000001105",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001100",+ "id": "00000000-0000-0000-0000-000000001102",},},- "id": "00000000-0000-0000-0000-000000001125",+ "id": "00000000-0000-0000-0000-000000001127","views": undefined,},"agentTurn": {"fields": {"agentId": {- "id": "00000000-0000-0000-0000-000000001066",+ "id": "00000000-0000-0000-0000-000000001068",},"cacheCreationTokens": {- "id": "00000000-0000-0000-0000-000000001077",+ "id": "00000000-0000-0000-0000-000000001079",},"cacheReadTokens": {- "id": "00000000-0000-0000-0000-000000001076",+ "id": "00000000-0000-0000-0000-000000001078",},"createdAt": {- "id": "00000000-0000-0000-0000-000000001063",+ "id": "00000000-0000-0000-0000-000000001065",},"createdBy": {- "id": "00000000-0000-0000-0000-000000001080",+ "id": "00000000-0000-0000-0000-000000001082",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001065",+ "id": "00000000-0000-0000-0000-000000001067",},"endedAt": {- "id": "00000000-0000-0000-0000-000000001072",+ "id": "00000000-0000-0000-0000-000000001074",},"error": {- "id": "00000000-0000-0000-0000-000000001070",+ "id": "00000000-0000-0000-0000-000000001072",},"id": {- "id": "00000000-0000-0000-0000-000000001062",+ "id": "00000000-0000-0000-0000-000000001064",},"inputCredits": {- "id": "00000000-0000-0000-0000-000000001078",+ "id": "00000000-0000-0000-0000-000000001080",},"inputTokens": {- "id": "00000000-0000-0000-0000-000000001074",+ "id": "00000000-0000-0000-0000-000000001076",},"messages": {- "id": "00000000-0000-0000-0000-000000001068",+ "id": "00000000-0000-0000-0000-000000001070",},"modelId": {- "id": "00000000-0000-0000-0000-000000001073",+ "id": "00000000-0000-0000-0000-000000001075",},"outputCredits": {- "id": "00000000-0000-0000-0000-000000001079",+ "id": "00000000-0000-0000-0000-000000001081",},"outputTokens": {- "id": "00000000-0000-0000-0000-000000001075",+ "id": "00000000-0000-0000-0000-000000001077",},"startedAt": {- "id": "00000000-0000-0000-0000-000000001071",+ "id": "00000000-0000-0000-0000-000000001073",},"status": {- "id": "00000000-0000-0000-0000-000000001069",+ "id": "00000000-0000-0000-0000-000000001071",},"thread": {- "id": "00000000-0000-0000-0000-000000001067",+ "id": "00000000-0000-0000-0000-000000001069",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001064",+ "id": "00000000-0000-0000-0000-000000001066",},},- "id": "00000000-0000-0000-0000-000000001081",+ "id": "00000000-0000-0000-0000-000000001083","views": undefined,},"attachment": {@@ -1111,64 +1117,64 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object"campaignDelivery": {"fields": {"bouncedAt": {- "id": "00000000-0000-0000-0000-000000001141",+ "id": "00000000-0000-0000-0000-000000001143",},"campaignId": {- "id": "00000000-0000-0000-0000-000000001130",+ "id": "00000000-0000-0000-0000-000000001132",},"claimExpiresAt": {- "id": "00000000-0000-0000-0000-000000001137",+ "id": "00000000-0000-0000-0000-000000001139",},"claimToken": {- "id": "00000000-0000-0000-0000-000000001136",+ "id": "00000000-0000-0000-0000-000000001138",},"complainedAt": {- "id": "00000000-0000-0000-0000-000000001142",+ "id": "00000000-0000-0000-0000-000000001144",},"createdAt": {- "id": "00000000-0000-0000-0000-000000001127",+ "id": "00000000-0000-0000-0000-000000001129",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001129",+ "id": "00000000-0000-0000-0000-000000001131",},"deliveredAt": {- "id": "00000000-0000-0000-0000-000000001140",+ "id": "00000000-0000-0000-0000-000000001142",},"failureReason": {- "id": "00000000-0000-0000-0000-000000001135",+ "id": "00000000-0000-0000-0000-000000001137",},"id": {- "id": "00000000-0000-0000-0000-000000001126",+ "id": "00000000-0000-0000-0000-000000001128",},"personId": {- "id": "00000000-0000-0000-0000-000000001131",+ "id": "00000000-0000-0000-0000-000000001133",},"providerMessageId": {- "id": "00000000-0000-0000-0000-000000001138",+ "id": "00000000-0000-0000-0000-000000001140",},"recipientEmail": {- "id": "00000000-0000-0000-0000-000000001132",+ "id": "00000000-0000-0000-0000-000000001134",},"rejectedAt": {- "id": "00000000-0000-0000-0000-000000001143",+ "id": "00000000-0000-0000-0000-000000001145",},"renderingFailedAt": {- "id": "00000000-0000-0000-0000-000000001144",+ "id": "00000000-0000-0000-0000-000000001146",},"sentAt": {- "id": "00000000-0000-0000-0000-000000001139",+ "id": "00000000-0000-0000-0000-000000001141",},"skipReason": {- "id": "00000000-0000-0000-0000-000000001134",+ "id": "00000000-0000-0000-0000-000000001136",},"state": {- "id": "00000000-0000-0000-0000-000000001133",+ "id": "00000000-0000-0000-0000-000000001135",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001128",+ "id": "00000000-0000-0000-0000-000000001130",},},- "id": "00000000-0000-0000-0000-000000001145",+ "id": "00000000-0000-0000-0000-000000001147","views": undefined,},"company": {@@ -2125,34 +2131,34 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object"messageSuppression": {"fields": {"createdAt": {- "id": "00000000-0000-0000-0000-000000001147",+ "id": "00000000-0000-0000-0000-000000001149",},"deletedAt": {- "id": "00000000-0000-0000-0000-000000001149",+ "id": "00000000-0000-0000-0000-000000001151",},"emailAddress": {- "id": "00000000-0000-0000-0000-000000001150",+ "id": "00000000-0000-0000-0000-000000001152",},"id": {- "id": "00000000-0000-0000-0000-000000001146",+ "id": "00000000-0000-0000-0000-000000001148",},"providerEventId": {- "id": "00000000-0000-0000-0000-000000001153",+ "id": "00000000-0000-0000-0000-000000001155",},"reason": {- "id": "00000000-0000-0000-0000-000000001151",+ "id": "00000000-0000-0000-0000-000000001153",},"source": {- "id": "00000000-0000-0000-0000-000000001152",+ "id": "00000000-0000-0000-0000-000000001154",},"unsubscribeTopicId": {- "id": "00000000-0000-0000-0000-000000001154",+ "id": "00000000-0000-0000-0000-000000001156",},"updatedAt": {- "id": "00000000-0000-0000-0000-000000001148",+ "id": "00000000-0000-0000-0000-000000001150",},},- "id": "00000000-0000-0000-0000-000000001155",+ "id": "00000000-0000-0000-0000-000000001157","views": undefined,},"messageThread": {diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-participant-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-participant-standard-flat-field-metadata.util.tsindex 86a54765e1b..186a7207b4a 100644--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-participant-standard-flat-field-metadata.util.ts+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-participant-standard-flat-field-metadata.util.ts@@ -244,4 +244,53 @@ export const buildAgentChatThreadParticipantStandardFlatFieldMetadatas = (writability: MetadataWritability.SYSTEM,isAuditLogged: false,},+ isSubscribed: {+ ...createStandardFieldFlatMetadata({+ ...args,+ context: {+ fieldName: 'isSubscribed',+ type: FieldMetadataType.BOOLEAN,+ label: i18nLabel(+ msg({ message: 'Subscribed', context: 'fieldMetadata.label' }),+ ),+ description: i18nLabel(+ msg({+ message: 'Whether new activity brings the thread back to the inbox',+ context: 'fieldMetadata.description',+ }),+ ),+ icon: 'IconBell',+ isSystem: true,+ isUIEditable: false,+ isNullable: false,+ defaultValue: true,+ },+ }),+ writability: MetadataWritability.SYSTEM,+ isAuditLogged: false,+ },+ lastMentionedAt: {+ ...createStandardFieldFlatMetadata({+ ...args,+ context: {+ fieldName: 'lastMentionedAt',+ type: FieldMetadataType.DATE_TIME,+ label: i18nLabel(+ msg({ message: 'Last mentioned at', context: 'fieldMetadata.label' }),+ ),+ description: i18nLabel(+ msg({+ message: 'When the member was last mentioned in the thread',+ context: 'fieldMetadata.description',+ }),+ ),+ icon: 'IconAt',+ isSystem: true,+ isUIEditable: false,+ isNullable: true,+ },+ }),+ writability: MetadataWritability.SYSTEM,+ isAuditLogged: false,+ },});diff --git a/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap b/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snapindex f8edcfc1903..b499f7b42fa 100644--- a/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap+++ b/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap@@ -77,6 +77,8 @@ exports[`endpoint permission declarations should match the AuthPrincipalGuard an"AgentChatThreadParticipantResolver.markAgentChatThreadAsUnread {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}","AgentChatThreadParticipantResolver.moveAgentChatThreadToInbox {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}","AgentChatThreadParticipantResolver.snoozeAgentChatThread {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",+ "AgentChatThreadParticipantResolver.subscribeToAgentChatThread {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",+ "AgentChatThreadParticipantResolver.unsubscribeFromAgentChatThread {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}","AgentInboxResolver.sendInboxMessage {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":true,"oauthClient":false,"userSession":false}]}","AgentResolver.createOneAgent {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}","AgentResolver.deleteOneAgent {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",diff --git a/packages/twenty-server/test/integration/graphql/suites/chat-thread-participant.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/chat-thread-participant.integration-spec.tsindex fc5338bc043..3a96e694ea3 100644--- a/packages/twenty-server/test/integration/graphql/suites/chat-thread-participant.integration-spec.ts+++ b/packages/twenty-server/test/integration/graphql/suites/chat-thread-participant.integration-spec.ts@@ -29,7 +29,7 @@ import { WORKSPACE_MEMBER_DATA_SEED_IDS } from 'src/engine/workspace-manager/devconst SCHEMA = getWorkspaceSchemaName(SEED_APPLE_WORKSPACE_ID);const PARTICIPANT_FIELDS =- 'id threadId lastReadAt archivedAt snoozedUntil updatedAt';+ 'id threadId lastReadAt archivedAt snoozedUntil isSubscribed lastMentionedAt updatedAt';const buildThreadMutation = (name: string) =>parse(@@ -64,6 +64,8 @@ type Participant = {lastReadAt: string | null;archivedAt: string | null;snoozedUntil: string | null;+ isSubscribed: boolean;+ lastMentionedAt: string | null;};const runThreadMutation = (@@ -818,4 +820,131 @@ describe('Chat thread participant state through the authenticated API', () => {(await readThreadActivity(threadId)).writerWorkspaceMemberIds ?? [],).toEqual([]);});++ it('keeps an unsubscribed chat done through new activity', async () => {+ const threadId = await createTestThread();+ const unsubscribed = await runThreadMutation(+ 'unsubscribeFromAgentChatThread',+ threadId,+ );++ expect(unsubscribed.body.errors).toBeUndefined();+ expect(unsubscribed.body.data.unsubscribeFromAgentChatThread).toMatchObject(+ { isSubscribed: false, snoozedUntil: null },+ );+ expect(+ unsubscribed.body.data.unsubscribeFromAgentChatThread.archivedAt,+ ).not.toBeNull();++ await getAppProviderByClassName<AgentChatThreadService>(+ 'AgentChatThreadService',+ ).recordThreadActivity({+ workspaceId: SEED_APPLE_WORKSPACE_ID,+ threadId,+ text: 'The renewal went through',+ });++ expect(await findMyParticipant(threadId)).toMatchObject({+ isSubscribed: false,+ });++ // Subscribing again leaves the chat where it is until something happens+ const subscribed = await runThreadMutation(+ 'subscribeToAgentChatThread',+ threadId,+ );++ expect(subscribed.body.errors).toBeUndefined();+ expect(subscribed.body.data.subscribeToAgentChatThread).toMatchObject({+ isSubscribed: true,+ archivedAt:+ unsubscribed.body.data.unsubscribeFromAgentChatThread.archivedAt,+ });+ });++ it('follows the chat again for a member who reopens, snoozes or writes in it', async () => {+ const threadId = await createTestThread();++ await runThreadMutation('unsubscribeFromAgentChatThread', threadId);+ await runThreadMutation('moveAgentChatThreadToInbox', threadId);++ expect(await findMyParticipant(threadId)).toMatchObject({+ isSubscribed: true,+ archivedAt: null,+ });++ await runThreadMutation('unsubscribeFromAgentChatThread', threadId);+ await makeMetadataApiRequest(+ {+ query: SNOOZE,+ variables: { threadId, snoozedUntil: buildFutureSnoozedUntil() },+ },+ APPLE_JANE_ADMIN_ACCESS_TOKEN,+ );++ expect(await findMyParticipant(threadId)).toMatchObject({+ isSubscribed: true,+ });++ await runThreadMutation('unsubscribeFromAgentChatThread', threadId);+ await getAppProviderByClassName<AgentChatThreadParticipantService>(+ 'AgentChatThreadParticipantService',+ ).recordMemberActivity({+ workspaceId: SEED_APPLE_WORKSPACE_ID,+ workspaceMemberId: WORKSPACE_MEMBER_DATA_SEED_IDS.JANE,+ threadId,+ text: 'Back on this one',+ });++ expect(await findMyParticipant(threadId)).toMatchObject({+ isSubscribed: true,+ archivedAt: null,+ });+ });++ it('follows the chat again and records the mention for a mentioned member who had unsubscribed', async () => {+ const threadId = await createTestThread();++ await addParticipants(threadId, [WORKSPACE_MEMBER_DATA_SEED_IDS.JONY]);++ const firstMention = await findMyParticipant(+ threadId,+ APPLE_JONY_MEMBER_ACCESS_TOKEN,+ );++ expect(firstMention).toMatchObject({ isSubscribed: true });+ expect(firstMention!.lastMentionedAt).not.toBeNull();++ await runThreadMutation(+ 'unsubscribeFromAgentChatThread',+ threadId,+ APPLE_JONY_MEMBER_ACCESS_TOKEN,+ );+ await addParticipants(threadId, [WORKSPACE_MEMBER_DATA_SEED_IDS.JONY]);++ const secondMention = await findMyParticipant(+ threadId,+ APPLE_JONY_MEMBER_ACCESS_TOKEN,+ );++ expect(secondMention).toMatchObject({+ isSubscribed: true,+ archivedAt: null,+ lastReadAt: null,+ });+ expect(new Date(secondMention!.lastMentionedAt!).getTime()).toBeGreaterThan(+ new Date(firstMention!.lastMentionedAt!).getTime(),+ );+ });++ it('refuses to change the subscription of a member who cannot read the chat', async () => {+ const threadId = await createTestThread();+ const response = await runThreadMutation(+ 'unsubscribeFromAgentChatThread',+ threadId,+ APPLE_JONY_MEMBER_ACCESS_TOKEN,+ );++ expect(response.body.errors[0].extensions.code).toBe('NOT_FOUND');+ });});diff --git a/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.integration-spec.ts b/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.integration-spec.tsnew file mode 100644index 00000000000..ed1c9fc46cb--- /dev/null+++ b/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.integration-spec.ts@@ -0,0 +1,132 @@+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';++import { getAppProviderByClassName } from 'test/integration/utils/get-app-provider-by-class-name.util';++import { type AgentChatSharingService } from 'src/engine/metadata-modules/ai/ai-chat/services/agent-chat-sharing.service';+import { type AddAgentChatThreadSubscriptionsCommand } from 'src/database/commands/upgrade-version-command/2-46/2-46-workspace-command-1791322315043-add-agent-chat-thread-subscriptions.command';+import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';+import { type WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';+import { getWorkspaceSchemaName } from 'src/engine/workspace-datasource/utils/get-workspace-schema-name.util';+import { SEED_APPLE_WORKSPACE_ID } from 'src/engine/workspace-manager/dev-seeder/core/constants/seeder-workspaces.constant';+import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';++const RUN_ON_WORKSPACE_ARGS = {+ workspaceId: SEED_APPLE_WORKSPACE_ID,+ options: {},+ index: 0,+ total: 1,+};++const SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS = [+ STANDARD_OBJECTS.agentChatThreadParticipant.fields.isSubscribed+ .universalIdentifier,+ STANDARD_OBJECTS.agentChatThreadParticipant.fields.lastMentionedAt+ .universalIdentifier,+];++const SUBSCRIPTION_COMMAND_MENU_ITEM_UNIVERSAL_IDENTIFIERS = [+ STANDARD_COMMAND_MENU_ITEMS.subscribeToAiChat.universalIdentifier,+ STANDARD_COMMAND_MENU_ITEMS.unsubscribeFromAiChat.universalIdentifier,+];++describe('2-46 workspace command - add agent chat thread subscriptions (integration)', () => {+ let command: AddAgentChatThreadSubscriptionsCommand;+ let workspaceCacheService: WorkspaceCacheService;++ const findSubscriptionMetadata = async () => {+ const { flatFieldMetadataMaps, flatCommandMenuItemMaps } =+ await workspaceCacheService.getOrRecompute(SEED_APPLE_WORKSPACE_ID, [+ 'flatFieldMetadataMaps',+ 'flatCommandMenuItemMaps',+ ]);++ return {+ fields: SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS.filter(+ (universalIdentifier) =>+ findFlatEntityByUniversalIdentifier({+ flatEntityMaps: flatFieldMetadataMaps,+ universalIdentifier,+ }) !== undefined,+ ),+ commandMenuItems:+ SUBSCRIPTION_COMMAND_MENU_ITEM_UNIVERSAL_IDENTIFIERS.filter(+ (universalIdentifier) =>+ flatCommandMenuItemMaps.byUniversalIdentifier[+ universalIdentifier+ ] !== undefined,+ ),+ };+ };++ const listParticipantColumns = async (): Promise<string[]> => {+ const columns: { column_name: string }[] =+ await global.testDataSource.query(+ `SELECT column_name FROM information_schema.columns+ WHERE table_schema = $1 AND table_name = 'agentChatThreadParticipant'+ AND column_name IN ('isSubscribed', 'lastMentionedAt')+ ORDER BY column_name`,+ [getWorkspaceSchemaName(SEED_APPLE_WORKSPACE_ID)],+ );++ return columns.map(({ column_name }) => column_name);+ };++ beforeAll(() => {+ command = getAppProviderByClassName<AddAgentChatThreadSubscriptionsCommand>(+ 'AddAgentChatThreadSubscriptionsCommand',+ );+ workspaceCacheService = getAppProviderByClassName<WorkspaceCacheService>(+ 'WorkspaceCacheService',+ );+ });++ it('removes the fields and commands on down', async () => {+ await command.down(RUN_ON_WORKSPACE_ARGS);++ expect(await findSubscriptionMetadata()).toEqual({+ fields: [],+ commandMenuItems: [],+ });+ expect(await listParticipantColumns()).toEqual([]);+ // Chats keep working without the inbox until the command reaches them+ expect(+ await getAppProviderByClassName<AgentChatSharingService>(+ 'AgentChatSharingService',+ ).hasInboxState(SEED_APPLE_WORKSPACE_ID),+ ).toBe(false);+ });++ it('adds them back on up, with every existing row subscribed', async () => {+ await command.up(RUN_ON_WORKSPACE_ARGS);++ expect(await findSubscriptionMetadata()).toEqual({+ fields: SUBSCRIPTION_FIELD_UNIVERSAL_IDENTIFIERS,+ commandMenuItems: SUBSCRIPTION_COMMAND_MENU_ITEM_UNIVERSAL_IDENTIFIERS,+ });+ expect(await listParticipantColumns()).toEqual([+ 'isSubscribed',+ 'lastMentionedAt',+ ]);++ const [{ unsubscribedCount }] = await global.testDataSource.query(+ `SELECT count(*)::int AS "unsubscribedCount"+ FROM ${getWorkspaceSchemaName(SEED_APPLE_WORKSPACE_ID)}."agentChatThreadParticipant"+ WHERE "isSubscribed" IS NOT TRUE`,+ );++ expect(unsubscribedCount).toBe(0);+ expect(+ await getAppProviderByClassName<AgentChatSharingService>(+ 'AgentChatSharingService',+ ).hasInboxState(SEED_APPLE_WORKSPACE_ID),+ ).toBe(true);+ });++ it('changes nothing when it runs again', async () => {+ await expect(command.up(RUN_ON_WORKSPACE_ARGS)).resolves.toBeUndefined();+ expect(await listParticipantColumns()).toEqual([+ 'isSubscribed',+ 'lastMentionedAt',+ ]);+ });+});diff --git a/packages/twenty-shared/src/metadata/__tests__/__snapshots__/standardObjectUniversalIdentifiers.test.ts.snap b/packages/twenty-shared/src/metadata/__tests__/__snapshots__/standardObjectUniversalIdentifiers.test.ts.snapindex c1764f688de..f0fcb5dffba 100644--- a/packages/twenty-shared/src/metadata/__tests__/__snapshots__/standardObjectUniversalIdentifiers.test.ts.snap+++ b/packages/twenty-shared/src/metadata/__tests__/__snapshots__/standardObjectUniversalIdentifiers.test.ts.snap@@ -113,6 +113,12 @@ exports[`STANDARD_OBJECTS universal identifiers should never change without an e"id": {"universalIdentifier": "13ba446f-db00-5635-888e-c2b11299e34b",},+ "isSubscribed": {+ "universalIdentifier": "146b1d5e-6603-4493-944b-c3bd2817569b",+ },+ "lastMentionedAt": {+ "universalIdentifier": "52a54602-633f-496a-966a-9a70437fa887",+ },"lastReadAt": {"universalIdentifier": "7e3a8319-c127-4c4f-add4-6feac37ea555",},diff --git a/packages/twenty-shared/src/metadata/constants/standard-object-fields.constant.ts b/packages/twenty-shared/src/metadata/constants/standard-object-fields.constant.tsindex 38cd4120af2..864638db92e 100644--- a/packages/twenty-shared/src/metadata/constants/standard-object-fields.constant.ts+++ b/packages/twenty-shared/src/metadata/constants/standard-object-fields.constant.ts@@ -97,6 +97,12 @@ export const STANDARD_OBJECT_FIELDS = {snoozedUntil: {universalIdentifier: '65bc5785-877d-4363-b65c-95175ba20fd0',},+ isSubscribed: {+ universalIdentifier: '146b1d5e-6603-4493-944b-c3bd2817569b',+ },+ lastMentionedAt: {+ universalIdentifier: '52a54602-633f-496a-966a-9a70437fa887',+ },},agentChatThreadTarget: {...buildStandardObjectBaseFields(diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.jsonindex a9c4f3f5d90..0101c75461b 100644--- a/packages/twenty-ui/docs/public-exports.json+++ b/packages/twenty-ui/docs/public-exports.json@@ -207,6 +207,7 @@"IconBadge2k": "icon/components/TablerIcons","IconBaselineDensitySmall": "icon/components/TablerIcons","IconBell": "icon/components/TablerIcons",+ "IconBellOff": "icon/components/TablerIcons","IconBlockquote": "icon/components/TablerIcons","IconBold": "icon/components/TablerIcons","IconBolt": "icon/components/TablerIcons",diff --git a/packages/twenty-ui/generated/icons.docs.json b/packages/twenty-ui/generated/icons.docs.jsonindex 3b8f35e8759..fa706416ada 100644--- a/packages/twenty-ui/generated/icons.docs.json+++ b/packages/twenty-ui/generated/icons.docs.json@@ -33,6 +33,7 @@"IconBadge2k","IconBaselineDensitySmall","IconBell",+ "IconBellOff","IconBlockquote","IconBold","IconBolt",diff --git a/packages/twenty-ui/src/icon/components/TablerIcons.ts b/packages/twenty-ui/src/icon/components/TablerIcons.tsindex 9ae7bd164f6..0087eb8f4d5 100644--- a/packages/twenty-ui/src/icon/components/TablerIcons.ts+++ b/packages/twenty-ui/src/icon/components/TablerIcons.ts@@ -32,6 +32,7 @@ export {IconBadge2k,IconBaselineDensitySmall,IconBell,+ IconBellOff,IconBlockquote,IconBold,IconBolt,diff --git a/packages/twenty-ui/src/icon/index.ts b/packages/twenty-ui/src/icon/index.tsindex 01d98a57520..8fb3340b7e3 100644--- a/packages/twenty-ui/src/icon/index.ts+++ b/packages/twenty-ui/src/icon/index.ts@@ -88,6 +88,7 @@ export {IconBadge2k,IconBaselineDensitySmall,IconBell,+ IconBellOff,IconBlockquote,IconBold,IconBolt,