Skip to content

The open alternative to Salesforce, designed for AI.

Store workspace Ada modes and conversation types (#29206)

Raphaël Bosidb30725ad329
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-instance-command-fast-1793280483473-add-workspace-chat-assistant-modes.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-instance-command-fast-1793280483473-add-workspace-chat-assistant-modes.ts
new file mode 100644
index 00000000000..cd12e6c939b
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-instance-command-fast-1793280483473-add-workspace-chat-assistant-modes.ts
@@ -0,0 +1,25 @@
+import { type QueryRunner } from 'typeorm';
+
+import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator';
+import { type FastInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/fast-instance-command.interface';
+
+@RegisteredInstanceCommand('2.54.0', 1793280483473)
+export class AddWorkspaceChatAssistantModesFastInstanceCommand implements FastInstanceCommand {
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ 'ALTER TABLE "core"."workspace" ADD "aiChatDirectMessageAssistantMode" character varying NOT NULL DEFAULT \'MENTION_ONLY\'',
+ );
+ await queryRunner.query(
+ 'ALTER TABLE "core"."workspace" ADD "aiChatInboxAssistantMode" character varying NOT NULL DEFAULT \'AUTOMATIC\'',
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ 'ALTER TABLE "core"."workspace" DROP COLUMN "aiChatInboxAssistantMode"',
+ );
+ await queryRunner.query(
+ 'ALTER TABLE "core"."workspace" DROP COLUMN "aiChatDirectMessageAssistantMode"',
+ );
+ }
+}
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-upgrade-version-command.module.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-upgrade-version-command.module.ts
index 5fceb02c869..3f048222814 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-upgrade-version-command.module.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-upgrade-version-command.module.ts
@@ -1,6 +1,7 @@
import { Module } from '@nestjs/common';
import { WorkspaceIteratorModule } from 'src/database/commands/command-runners/workspace-iterator.module';
+import { AddChatConversationTypeCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793280040522-add-chat-conversation-type.command';
import { AddMergeWithRecordCommandMenuItemCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793265618567-add-merge-with-record-command-menu-item.command';
import { UpdateCrmHygieneSkillMergeGuidanceCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793206127866-update-crm-hygiene-skill-merge-guidance.command';
import { RemoveMessageCampaignFlagCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793266150123-remove-message-campaign-flag.command';
@@ -17,6 +18,7 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace
WorkspaceMigrationModule,
],
providers: [
+ AddChatConversationTypeCommand,
AddMergeWithRecordCommandMenuItemCommand,
UpdateCrmHygieneSkillMergeGuidanceCommand,
RemoveMessageCampaignFlagCommand,
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793280040522-add-chat-conversation-type.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793280040522-add-chat-conversation-type.command.ts
new file mode 100644
index 00000000000..c84eb0152da
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/2-54-workspace-command-1793280040522-add-chat-conversation-type.command.ts
@@ -0,0 +1,168 @@
+import { Inject } from '@nestjs/common';
+
+import { Command } from 'nest-commander';
+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';
+import { doNotTranslate } from 'twenty-shared/i18n';
+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 { 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 { 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 CONVERSATION_TYPE_FIELD_UNIVERSAL_IDENTIFIER =
+ STANDARD_OBJECTS.agentChatThread.fields.conversationType.universalIdentifier;
+
+@RegisteredWorkspaceCommand('2.54.0', 1793280040522)
+@Command({
+ name: 'upgrade:2-54:add-chat-conversation-type',
+ description: doNotTranslate(
+ 'Persist the system-managed conversation type without reclassifying existing chats',
+ ),
+})
+export class AddChatConversationTypeCommand extends ProvisionedWorkspaceCommandRunner {
+ @Inject(ApplicationService)
+ private readonly applicationService: ApplicationService;
+
+ @Inject(WorkspaceCacheService)
+ private readonly workspaceCacheService: WorkspaceCacheService;
+
+ @Inject(WorkspaceMigrationValidateBuildAndRunService)
+ private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService;
+
+ constructor(
+ protected readonly workspaceIteratorService: WorkspaceIteratorService,
+ ) {
+ super(workspaceIteratorService);
+ }
+
+ override async runOnWorkspace(args: RunOnWorkspaceArgs): Promise<void> {
+ await this.up(args);
+ }
+
+ async up({ workspaceId, options }: RunOnWorkspaceArgs): Promise<void> {
+ const { flatObjectMetadataMaps, flatFieldMetadataMaps } =
+ await this.workspaceCacheService.getOrRecompute(workspaceId, [
+ 'flatObjectMetadataMaps',
+ 'flatFieldMetadataMaps',
+ ]);
+ const threadObject =
+ flatObjectMetadataMaps.byUniversalIdentifier[
+ STANDARD_OBJECTS.agentChatThread.universalIdentifier
+ ];
+ const existingField =
+ findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({
+ flatEntityMaps: flatFieldMetadataMaps,
+ universalIdentifier: CONVERSATION_TYPE_FIELD_UNIVERSAL_IDENTIFIER,
+ });
+
+ if (!isDefined(threadObject) || isDefined(existingField)) {
+ return;
+ }
+
+ const { twentyStandardFlatApplication } =
+ await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(
+ { workspaceId },
+ );
+ const { allFlatEntityMaps } =
+ computeTwentyStandardApplicationAllFlatEntityMaps({
+ now: new Date().toISOString(),
+ workspaceId,
+ twentyStandardApplicationId: twentyStandardFlatApplication.id,
+ });
+ const fieldsToCreate =
+ getStandardFlatEntitiesToCreateOrThrow<FlatFieldMetadata>({
+ standardFlatEntityMaps: allFlatEntityMaps.flatFieldMetadataMaps,
+ existingFlatEntityMaps: flatFieldMetadataMaps,
+ universalIdentifiers: [CONVERSATION_TYPE_FIELD_UNIVERSAL_IDENTIFIER],
+ });
+
+ await this.migrateField({
+ workspaceId,
+ options,
+ fieldsToCreate,
+ fieldsToDelete: [],
+ });
+ }
+
+ async down({ workspaceId, options }: RunOnWorkspaceArgs): Promise<void> {
+ const { flatFieldMetadataMaps } =
+ await this.workspaceCacheService.getOrRecompute(workspaceId, [
+ 'flatFieldMetadataMaps',
+ ]);
+ const field = findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({
+ flatEntityMaps: flatFieldMetadataMaps,
+ universalIdentifier: CONVERSATION_TYPE_FIELD_UNIVERSAL_IDENTIFIER,
+ });
+
+ if (!isDefined(field)) {
+ return;
+ }
+
+ await this.migrateField({
+ workspaceId,
+ options,
+ fieldsToCreate: [],
+ fieldsToDelete: [field],
+ });
+ }
+
+ private async migrateField({
+ workspaceId,
+ options,
+ fieldsToCreate,
+ fieldsToDelete,
+ }: Pick<RunOnWorkspaceArgs, 'workspaceId' | 'options'> & {
+ fieldsToCreate: FlatFieldMetadata[];
+ fieldsToDelete: FlatFieldMetadata[];
+ }): Promise<void> {
+ if (options.dryRun ?? false) {
+ this.logger.log(
+ doNotTranslate(
+ `[DRY RUN] Would create ${fieldsToCreate.length} and delete ${fieldsToDelete.length} conversation type fields for workspace ${workspaceId}`,
+ ),
+ );
+
+ return;
+ }
+
+ const { twentyStandardFlatApplication } =
+ await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(
+ { workspaceId },
+ );
+ const result =
+ await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
+ {
+ shouldDeferActions: false,
+ workspaceId,
+ isSystemBuild: true,
+ applicationUniversalIdentifier:
+ twentyStandardFlatApplication.universalIdentifier,
+ allFlatEntityOperationByMetadataName: {
+ fieldMetadata: {
+ flatEntityToCreate: fieldsToCreate,
+ flatEntityToDelete: fieldsToDelete,
+ flatEntityToUpdate: [],
+ },
+ },
+ },
+ );
+
+ if (result.status === 'fail') {
+ throw new WorkspaceMigrationBuilderException(
+ result,
+ doNotTranslate(
+ `Failed to migrate conversation type for workspace ${workspaceId}`,
+ ),
+ );
+ }
+ }
+}
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/add-workspace-chat-assistant-modes-upgrade-command-name.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/add-workspace-chat-assistant-modes-upgrade-command-name.constant.ts
new file mode 100644
index 00000000000..6e4db22eec2
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-54/add-workspace-chat-assistant-modes-upgrade-command-name.constant.ts
@@ -0,0 +1,2 @@
+export const ADD_WORKSPACE_CHAT_ASSISTANT_MODES_UPGRADE_COMMAND_NAME =
+ '2.54.0_AddWorkspaceChatAssistantModesFastInstanceCommand_1793280483473';
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
index 90274cd48ef..f7cedb92fbb 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
@@ -268,6 +268,7 @@ import { DropIsCustomFromAgentSkillViewIndexAndAgentChatChannelFastInstanceComma
import { UnlistUnreviewedApplicationRegistrationsSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-instance-command-slow-1793278636737-unlist-unreviewed-application-registrations';
import { PurgeSoftDeletedAgentsSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-instance-command-slow-1793272266091-purge-soft-deleted-agents';
import { AddGeolocationToUserSessionFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-instance-command-fast-1793274494191-add-geolocation-to-user-session';
+import { AddWorkspaceChatAssistantModesFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-54/2-54-instance-command-fast-1793280483473-add-workspace-chat-assistant-modes';
export const INSTANCE_COMMANDS = [
AddViewFieldGroupIdIndexOnViewFieldFastInstanceCommand,
@@ -538,4 +539,5 @@ export const INSTANCE_COMMANDS = [
AddFieldMetadataDisabledFieldPermissionActionsFastInstanceCommand,
PurgeSoftDeletedAgentsSlowInstanceCommand,
AddGeolocationToUserSessionFastInstanceCommand,
+ AddWorkspaceChatAssistantModesFastInstanceCommand,
];
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/enums/ai-chat-assistant-mode.enum.ts b/packages/twenty-server/src/engine/core-modules/workspace/enums/ai-chat-assistant-mode.enum.ts
new file mode 100644
index 00000000000..64c292bfe29
--- /dev/null
+++ b/packages/twenty-server/src/engine/core-modules/workspace/enums/ai-chat-assistant-mode.enum.ts
@@ -0,0 +1,9 @@
+import { registerEnumType } from '@nestjs/graphql';
+
+export enum AiChatAssistantMode {
+ NEVER = 'NEVER',
+ MENTION_ONLY = 'MENTION_ONLY',
+ AUTOMATIC = 'AUTOMATIC',
+}
+
+registerEnumType(AiChatAssistantMode, { name: 'AiChatAssistantMode' });
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts b/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
index a0b0316b9bb..c3dd9c71a26 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
@@ -37,6 +37,8 @@ export const fromWorkspaceEntityToFlat = (
isAutoModelSelectionEnabled: entity.isAutoModelSelectionEnabled,
aiModelIdByTier: entity.aiModelIdByTier,
aiEvaluationModelId: entity.aiEvaluationModelId,
+ aiChatDirectMessageAssistantMode: entity.aiChatDirectMessageAssistantMode,
+ aiChatInboxAssistantMode: entity.aiChatInboxAssistantMode,
aiAdditionalInstructions: entity.aiAdditionalInstructions,
isInternalMessagesImportEnabled: entity.isInternalMessagesImportEnabled,
workspaceCustomApplicationId: entity.workspaceCustomApplicationId,
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
index 4db1506d134..07d12600970 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
@@ -27,6 +27,7 @@ import {
import { ADD_WORKSPACE_DISCOVERABILITY_TO_WORKSPACE_UPGRADE_COMMAND_NAME } from 'src/database/commands/upgrade-version-command/2-19/add-workspace-discoverability-to-workspace-upgrade-command-name.constant';
import { ADD_CAMPAIGN_TRACKING_FLAGS_UPGRADE_COMMAND_NAME } from 'src/database/commands/upgrade-version-command/2-44/add-campaign-tracking-flags-upgrade-command-name.constant';
+import { ADD_WORKSPACE_CHAT_ASSISTANT_MODES_UPGRADE_COMMAND_NAME } from 'src/database/commands/upgrade-version-command/2-54/add-workspace-chat-assistant-modes-upgrade-command-name.constant';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { ApiKeyEntity } from 'src/engine/core-modules/api-key/api-key.entity';
import { AppTokenEntity } from 'src/engine/core-modules/app-token/app-token.entity';
@@ -41,6 +42,7 @@ import { PublicDomainEntity } from 'src/engine/core-modules/public-domain/public
import { WorkspaceSsoIdentityProviderEntity } from 'src/engine/core-modules/sso/workspace-sso-identity-provider.entity';
import { WasIntroducedInUpgrade } from 'src/engine/core-modules/upgrade/decorators/was-introduced-in-upgrade.decorator';
import { UserWorkspaceEntity } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
+import { AiChatAssistantMode } from 'src/engine/core-modules/workspace/enums/ai-chat-assistant-mode.enum';
import { WorkspaceDiscoverability } from 'src/engine/core-modules/workspace/types/workspace-discoverability.type';
import { AgentEntity } from 'src/engine/metadata-modules/ai/ai-agent/entities/agent.entity';
import { AiModelTier as AiModelTierEnum } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum';
@@ -371,6 +373,26 @@ export class WorkspaceEntity {
@Column({ type: 'text', nullable: true })
aiEvaluationModelId: string | null;
+ @WasIntroducedInUpgrade({
+ upgradeCommandName: ADD_WORKSPACE_CHAT_ASSISTANT_MODES_UPGRADE_COMMAND_NAME,
+ })
+ @Column({
+ type: 'varchar',
+ nullable: false,
+ default: AiChatAssistantMode.MENTION_ONLY,
+ })
+ aiChatDirectMessageAssistantMode: AiChatAssistantMode;
+
+ @WasIntroducedInUpgrade({
+ upgradeCommandName: ADD_WORKSPACE_CHAT_ASSISTANT_MODES_UPGRADE_COMMAND_NAME,
+ })
+ @Column({
+ type: 'varchar',
+ nullable: false,
+ default: AiChatAssistantMode.AUTOMATIC,
+ })
+ aiChatInboxAssistantMode: AiChatAssistantMode;
+
@Field(() => String, { nullable: true })
@Column({ type: 'text', nullable: true })
aiAdditionalInstructions: string | null;
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread.workspace-entity.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread.workspace-entity.ts
index 4fc3d538798..de1374089f6 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread.workspace-entity.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread.workspace-entity.ts
@@ -4,6 +4,7 @@ import { type AgentMessageWorkspaceEntity } from 'src/engine/metadata-modules/ai
import { type AgentTurnWorkspaceEntity } from 'src/engine/metadata-modules/ai/ai-history/standard-objects/agent-turn.workspace-entity';
import { type AgentChatThreadParticipantWorkspaceEntity } from 'src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-participant.workspace-entity';
import { type AgentChatThreadTargetWorkspaceEntity } from 'src/engine/metadata-modules/ai/ai-history/standard-objects/agent-chat-thread-target.workspace-entity';
+import { type AgentChatThreadConversationType } from 'src/engine/metadata-modules/ai/ai-history/types/agent-chat-thread-conversation-type.type';
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
@@ -24,6 +25,7 @@ export class AgentChatThreadWorkspaceEntity extends BaseWorkspaceEntity {
channelArchivedAt: string | null;
channelSnoozedUntil: string | null;
title: string | null;
+ conversationType: AgentChatThreadConversationType;
isAssistantParticipant: boolean;
lastActivityAt: string | null;
lastMessageText: string | null;
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/types/agent-chat-thread-conversation-type.type.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/types/agent-chat-thread-conversation-type.type.ts
new file mode 100644
index 00000000000..3774416e530
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-history/types/agent-chat-thread-conversation-type.type.ts
@@ -0,0 +1 @@
+export type AgentChatThreadConversationType = 'STANDARD' | 'DIRECT_MESSAGE';
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.snap
index 8c99d8d8125..b87f6899340 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
@@ -5,31 +5,34 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object
"agentChatThread": {
"fields": {
"activeStreamId": {
- "id": "00000000-0000-0000-0000-000000001061",
+ "id": "00000000-0000-0000-0000-000000001062",
},
"archivedAt": {
"id": "00000000-0000-0000-0000-000000001049",
},
"assignee": {
- "id": "00000000-0000-0000-0000-000000001068",
+ "id": "00000000-0000-0000-0000-000000001069",
},
"attachments": {
- "id": "00000000-0000-0000-0000-000000001065",
+ "id": "00000000-0000-0000-0000-000000001066",
},
"channelArchivedAt": {
- "id": "00000000-0000-0000-0000-000000001070",
+ "id": "00000000-0000-0000-0000-000000001071",
},
"channelId": {
- "id": "00000000-0000-0000-0000-000000001069",
+ "id": "00000000-0000-0000-0000-000000001070",
},
"channelSnoozedUntil": {
- "id": "00000000-0000-0000-0000-000000001071",
+ "id": "00000000-0000-0000-0000-000000001072",
},
"contextWindowTokens": {
- "id": "00000000-0000-0000-0000-000000001055",
+ "id": "00000000-0000-0000-0000-000000001056",
},
"conversationSize": {
- "id": "00000000-0000-0000-0000-000000001056",
+ "id": "00000000-0000-0000-0000-000000001057",
+ },
+ "conversationType": {
+ "id": "00000000-0000-0000-0000-000000001052",
},
"createdAt": {
"id": "00000000-0000-0000-0000-000000001046",
@@ -41,52 +44,52 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object
"id": "00000000-0000-0000-0000-000000001045",
},
"isAssistantParticipant": {
- "id": "00000000-0000-0000-0000-000000001052",
+ "id": "00000000-0000-0000-0000-000000001053",
},
"lastActivityAt": {
- "id": "00000000-0000-0000-0000-000000001072",
+ "id": "00000000-0000-0000-0000-000000001073",
},
"lastMessageSenderWorkspaceMemberId": {
- "id": "00000000-0000-0000-0000-000000001074",
+ "id": "00000000-0000-0000-0000-000000001075",
},
"lastMessageText": {
- "id": "00000000-0000-0000-0000-000000001073",
+ "id": "00000000-0000-0000-0000-000000001074",
},
"messages": {
- "id": "00000000-0000-0000-0000-000000001064",
+ "id": "00000000-0000-0000-0000-000000001065",
},
"participants": {
- "id": "00000000-0000-0000-0000-000000001067",
+ "id": "00000000-0000-0000-0000-000000001068",
},
"pendingQuestionMessageId": {
- "id": "00000000-0000-0000-0000-000000001062",
+ "id": "00000000-0000-0000-0000-000000001063",
},
"recordTargets": {
- "id": "00000000-0000-0000-0000-000000001066",
+ "id": "00000000-0000-0000-0000-000000001067",
},
"title": {
"id": "00000000-0000-0000-0000-000000001051",
},
"totalCacheCreationTokens": {
- "id": "00000000-0000-0000-0000-000000001060",
+ "id": "00000000-0000-0000-0000-000000001061",
},
"totalCacheReadTokens": {
- "id": "00000000-0000-0000-0000-000000001059",
+ "id": "00000000-0000-0000-0000-000000001060",
},
"totalInputCredits": {
- "id": "00000000-0000-0000-0000-000000001057",
+ "id": "00000000-0000-0000-0000-000000001058",
},
"totalInputTokens": {
- "id": "00000000-0000-0000-0000-000000001053",
+ "id": "00000000-0000-0000-0000-000000001054",
},
"totalOutputCredits": {
- "id": "00000000-0000-0000-0000-000000001058",
+ "id": "00000000-0000-0000-0000-000000001059",
},
"totalOutputTokens": {
- "id": "00000000-0000-0000-0000-000000001054",
+ "id": "00000000-0000-0000-0000-000000001055",
},
"turns": {
- "id": "00000000-0000-0000-0000-000000001063",
+ "id": "00000000-0000-0000-0000-000000001064",
},
"updatedAt": {
"id": "00000000-0000-0000-0000-000000001047",
@@ -95,310 +98,310 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object
"id": "00000000-0000-0000-0000-000000001050",
},
"writerWorkspaceMemberIds": {
- "id": "00000000-0000-0000-0000-000000001075",
+ "id": "00000000-0000-0000-0000-000000001076",
},
},
- "id": "00000000-0000-0000-0000-000000001076",
+ "id": "00000000-0000-0000-0000-000000001077",
"views": undefined,
},
"agentChatThreadParticipant": {
"fields": {
"archivedAt": {
- "id": "00000000-0000-0000-0000-000000001084",
+ "id": "00000000-0000-0000-0000-000000001085",
},
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001078",
+ "id": "00000000-0000-0000-0000-000000001079",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001080",
+ "id": "00000000-0000-0000-0000-000000001081",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001077",
+ "id": "00000000-0000-0000-0000-000000001078",
},
"isSubscribed": {
- "id": "00000000-0000-0000-0000-000000001086",
+ "id": "00000000-0000-0000-0000-000000001087",
},
"lastMentionedAt": {
- "id": "00000000-0000-0000-0000-000000001087",
+ "id": "00000000-0000-0000-0000-000000001088",
},
"lastReadAt": {
- "id": "00000000-0000-0000-0000-000000001083",
+ "id": "00000000-0000-0000-0000-000000001084",
},
"snoozedUntil": {
- "id": "00000000-0000-0000-0000-000000001085",
+ "id": "00000000-0000-0000-0000-000000001086",
},
"thread": {
- "id": "00000000-0000-0000-0000-000000001081",
+ "id": "00000000-0000-0000-0000-000000001082",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001079",
+ "id": "00000000-0000-0000-0000-000000001080",
},
"workspaceMember": {
- "id": "00000000-0000-0000-0000-000000001082",
+ "id": "00000000-0000-0000-0000-000000001083",
},
},
- "id": "00000000-0000-0000-0000-000000001088",
+ "id": "00000000-0000-0000-0000-000000001089",
"views": undefined,
},
"agentChatThreadTarget": {
"fields": {
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001091",
+ "id": "00000000-0000-0000-0000-000000001092",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001093",
+ "id": "00000000-0000-0000-0000-000000001094",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001090",
+ "id": "00000000-0000-0000-0000-000000001091",
},
"target": {
- "id": "00000000-0000-0000-0000-000000001089",
+ "id": "00000000-0000-0000-0000-000000001090",
},
"targetCompany": {
- "id": "00000000-0000-0000-0000-000000001096",
+ "id": "00000000-0000-0000-0000-000000001097",
},
"targetOpportunity": {
- "id": "00000000-0000-0000-0000-000000001097",
+ "id": "00000000-0000-0000-0000-000000001098",
},
"targetPerson": {
- "id": "00000000-0000-0000-0000-000000001095",
+ "id": "00000000-0000-0000-0000-000000001096",
},
"thread": {
- "id": "00000000-0000-0000-0000-000000001094",
+ "id": "00000000-0000-0000-0000-000000001095",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001092",
+ "id": "00000000-0000-0000-0000-000000001093",
},
},
- "id": "00000000-0000-0000-0000-000000001098",
+ "id": "00000000-0000-0000-0000-000000001099",
"views": {},
},
"agentMessage": {
"fields": {
"agentId": {
- "id": "00000000-0000-0000-0000-000000001123",
+ "id": "00000000-0000-0000-0000-000000001124",
},
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001120",
+ "id": "00000000-0000-0000-0000-000000001121",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001122",
+ "id": "00000000-0000-0000-0000-000000001123",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001119",
+ "id": "00000000-0000-0000-0000-000000001120",
},
"parts": {
- "id": "00000000-0000-0000-0000-000000001131",
+ "id": "00000000-0000-0000-0000-000000001132",
},
"processedAt": {
- "id": "00000000-0000-0000-0000-000000001128",
+ "id": "00000000-0000-0000-0000-000000001129",
},
"reactions": {
- "id": "00000000-0000-0000-0000-000000001132",
+ "id": "00000000-0000-0000-0000-000000001133",
},
"role": {
- "id": "00000000-0000-0000-0000-000000001126",
+ "id": "00000000-0000-0000-0000-000000001127",
},
"senderApplicationId": {
- "id": "00000000-0000-0000-0000-000000001125",
+ "id": "00000000-0000-0000-0000-000000001126",
},
"senderWorkspaceMember": {
- "id": "00000000-0000-0000-0000-000000001124",
+ "id": "00000000-0000-0000-0000-000000001125",
},
"status": {
- "id": "00000000-0000-0000-0000-000000001127",
+ "id": "00000000-0000-0000-0000-000000001128",
},
"thread": {
- "id": "00000000-0000-0000-0000-000000001129",
+ "id": "00000000-0000-0000-0000-000000001130",
},
"turn": {
- "id": "00000000-0000-0000-0000-000000001130",
+ "id": "00000000-0000-0000-0000-000000001131",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001121",
+ "id": "00000000-0000-0000-0000-000000001122",
},
},
- "id": "00000000-0000-0000-0000-000000001133",
+ "id": "00000000-0000-0000-0000-000000001134",
"views": undefined,
},
"agentMessagePart": {
"fields": {
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001144",
+ "id": "00000000-0000-0000-0000-000000001145",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001146",
+ "id": "00000000-0000-0000-0000-000000001147",
},
"errorDetails": {
- "id": "00000000-0000-0000-0000-000000001158",
+ "id": "00000000-0000-0000-0000-000000001159",
},
"errorMessage": {
- "id": "00000000-0000-0000-0000-000000001157",
+ "id": "00000000-0000-0000-0000-000000001158",
},
"fileFilename": {
- "id": "00000000-0000-0000-0000-000000001166",
+ "id": "00000000-0000-0000-0000-000000001167",
},
"fileId": {
- "id": "00000000-0000-0000-0000-000000001167",
+ "id": "00000000-0000-0000-0000-000000001168",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001143",
+ "id": "00000000-0000-0000-0000-000000001144",
},
"message": {
- "id": "00000000-0000-0000-0000-000000001169",
+ "id": "00000000-0000-0000-0000-000000001170",
},
"orderIndex": {
- "id": "00000000-0000-0000-0000-000000001147",
+ "id": "00000000-0000-0000-0000-000000001148",
},
"providerExecuted": {
- "id": "00000000-0000-0000-0000-000000001156",
+ "id": "00000000-0000-0000-0000-000000001157",
},
"providerMetadata": {
- "id": "00000000-0000-0000-0000-000000001168",
+ "id": "00000000-0000-0000-0000-000000001169",
},
"reasoningContent": {
- "id": "00000000-0000-0000-0000-000000001150",
+ "id": "00000000-0000-0000-0000-000000001151",
},
"sourceDocumentFilename": {
- "id": "00000000-0000-0000-0000-000000001165",
+ "id": "00000000-0000-0000-0000-000000001166",
},
"sourceDocumentMediaType": {
- "id": "00000000-0000-0000-0000-000000001163",
+ "id": "00000000-0000-0000-0000-000000001164",
},
"sourceDocumentSourceId": {
- "id": "00000000-0000-0000-0000-000000001162",
+ "id": "00000000-0000-0000-0000-000000001163",
},
"sourceDocumentTitle": {
- "id": "00000000-0000-0000-0000-000000001164",
+ "id": "00000000-0000-0000-0000-000000001165",
},
"sourceUrlSourceId": {
- "id": "00000000-0000-0000-0000-000000001159",
+ "id": "00000000-0000-0000-0000-000000001160",
},
"sourceUrlTitle": {
- "id": "00000000-0000-0000-0000-000000001161",
+ "id": "00000000-0000-0000-0000-000000001162",
},
"sourceUrlUrl": {
- "id": "00000000-0000-0000-0000-000000001160",
+ "id": "00000000-0000-0000-0000-000000001161",
},
"state": {
- "id": "00000000-0000-0000-0000-000000001155",
+ "id": "00000000-0000-0000-0000-000000001156",
},
"textContent": {
- "id": "00000000-0000-0000-0000-000000001149",
+ "id": "00000000-0000-0000-0000-000000001150",
},
"toolCallId": {
- "id": "00000000-0000-0000-0000-000000001152",
+ "id": "00000000-0000-0000-0000-000000001153",
},
"toolInput": {
- "id": "00000000-0000-0000-0000-000000001153",
+ "id": "00000000-0000-0000-0000-000000001154",
},
"toolName": {
- "id": "00000000-0000-0000-0000-000000001151",
+ "id": "00000000-0000-0000-0000-000000001152",
},
"toolOutput": {
- "id": "00000000-0000-0000-0000-000000001154",
+ "id": "00000000-0000-0000-0000-000000001155",
},
"type": {
- "id": "00000000-0000-0000-0000-000000001148",
+ "id": "00000000-0000-0000-0000-000000001149",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001145",
+ "id": "00000000-0000-0000-0000-000000001146",
},
},
- "id": "00000000-0000-0000-0000-000000001170",
+ "id": "00000000-0000-0000-0000-000000001171",
"views": undefined,
},
"agentMessageReaction": {
"fields": {
"agentId": {
- "id": "00000000-0000-0000-0000-000000001140",
+ "id": "00000000-0000-0000-0000-000000001141",
},
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001135",
+ "id": "00000000-0000-0000-0000-000000001136",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001137",
+ "id": "00000000-0000-0000-0000-000000001138",
},
"emoji": {
- "id": "00000000-0000-0000-0000-000000001141",
+ "id": "00000000-0000-0000-0000-000000001142",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001134",
+ "id": "00000000-0000-0000-0000-000000001135",
},
"message": {
- "id": "00000000-0000-0000-0000-000000001138",
+ "id": "00000000-0000-0000-0000-000000001139",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001136",
+ "id": "00000000-0000-0000-0000-000000001137",
},
"workspaceMember": {
- "id": "00000000-0000-0000-0000-000000001139",
+ "id": "00000000-0000-0000-0000-000000001140",
},
},
- "id": "00000000-0000-0000-0000-000000001142",
+ "id": "00000000-0000-0000-0000-000000001143",
"views": undefined,
},
"agentTurn": {
"fields": {
"agentId": {
- "id": "00000000-0000-0000-0000-000000001103",
+ "id": "00000000-0000-0000-0000-000000001104",
},
"cacheCreationTokens": {
- "id": "00000000-0000-0000-0000-000000001114",
+ "id": "00000000-0000-0000-0000-000000001115",
},
"cacheReadTokens": {
- "id": "00000000-0000-0000-0000-000000001113",
+ "id": "00000000-0000-0000-0000-000000001114",
},
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001100",
+ "id": "00000000-0000-0000-0000-000000001101",
},
"createdBy": {
- "id": "00000000-0000-0000-0000-000000001117",
+ "id": "00000000-0000-0000-0000-000000001118",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001102",
+ "id": "00000000-0000-0000-0000-000000001103",
},
"endedAt": {
- "id": "00000000-0000-0000-0000-000000001109",
+ "id": "00000000-0000-0000-0000-000000001110",
},
"error": {
- "id": "00000000-0000-0000-0000-000000001107",
+ "id": "00000000-0000-0000-0000-000000001108",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001099",
+ "id": "00000000-0000-0000-0000-000000001100",
},
"inputCredits": {
- "id": "00000000-0000-0000-0000-000000001115",
+ "id": "00000000-0000-0000-0000-000000001116",
},
"inputTokens": {
- "id": "00000000-0000-0000-0000-000000001111",
+ "id": "00000000-0000-0000-0000-000000001112",
},
"messages": {
- "id": "00000000-0000-0000-0000-000000001105",
+ "id": "00000000-0000-0000-0000-000000001106",
},
"modelId": {
- "id": "00000000-0000-0000-0000-000000001110",
+ "id": "00000000-0000-0000-0000-000000001111",
},
"outputCredits": {
- "id": "00000000-0000-0000-0000-000000001116",
+ "id": "00000000-0000-0000-0000-000000001117",
},
"outputTokens": {
- "id": "00000000-0000-0000-0000-000000001112",
+ "id": "00000000-0000-0000-0000-000000001113",
},
"startedAt": {
- "id": "00000000-0000-0000-0000-000000001108",
+ "id": "00000000-0000-0000-0000-000000001109",
},
"status": {
- "id": "00000000-0000-0000-0000-000000001106",
+ "id": "00000000-0000-0000-0000-000000001107",
},
"thread": {
- "id": "00000000-0000-0000-0000-000000001104",
+ "id": "00000000-0000-0000-0000-000000001105",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001101",
+ "id": "00000000-0000-0000-0000-000000001102",
},
},
- "id": "00000000-0000-0000-0000-000000001118",
+ "id": "00000000-0000-0000-0000-000000001119",
"views": undefined,
},
"attachment": {
@@ -1162,64 +1165,64 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object
"campaignDelivery": {
"fields": {
"bouncedAt": {
- "id": "00000000-0000-0000-0000-000000001186",
+ "id": "00000000-0000-0000-0000-000000001187",
},
"campaignId": {
- "id": "00000000-0000-0000-0000-000000001175",
+ "id": "00000000-0000-0000-0000-000000001176",
},
"claimExpiresAt": {
- "id": "00000000-0000-0000-0000-000000001182",
+ "id": "00000000-0000-0000-0000-000000001183",
},
"claimToken": {
- "id": "00000000-0000-0000-0000-000000001181",
+ "id": "00000000-0000-0000-0000-000000001182",
},
"complainedAt": {
- "id": "00000000-0000-0000-0000-000000001187",
+ "id": "00000000-0000-0000-0000-000000001188",
},
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001172",
+ "id": "00000000-0000-0000-0000-000000001173",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001174",
+ "id": "00000000-0000-0000-0000-000000001175",
},
"deliveredAt": {
- "id": "00000000-0000-0000-0000-000000001185",
+ "id": "00000000-0000-0000-0000-000000001186",
},
"failureReason": {
- "id": "00000000-0000-0000-0000-000000001180",
+ "id": "00000000-0000-0000-0000-000000001181",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001171",
+ "id": "00000000-0000-0000-0000-000000001172",
},
"personId": {
- "id": "00000000-0000-0000-0000-000000001176",
+ "id": "00000000-0000-0000-0000-000000001177",
},
"providerMessageId": {
- "id": "00000000-0000-0000-0000-000000001183",
+ "id": "00000000-0000-0000-0000-000000001184",
},
"recipientEmail": {
- "id": "00000000-0000-0000-0000-000000001177",
+ "id": "00000000-0000-0000-0000-000000001178",
},
"rejectedAt": {
- "id": "00000000-0000-0000-0000-000000001188",
+ "id": "00000000-0000-0000-0000-000000001189",
},
"renderingFailedAt": {
- "id": "00000000-0000-0000-0000-000000001189",
+ "id": "00000000-0000-0000-0000-000000001190",
},
"sentAt": {
- "id": "00000000-0000-0000-0000-000000001184",
+ "id": "00000000-0000-0000-0000-000000001185",
},
"skipReason": {
- "id": "00000000-0000-0000-0000-000000001179",
+ "id": "00000000-0000-0000-0000-000000001180",
},
"state": {
- "id": "00000000-0000-0000-0000-000000001178",
+ "id": "00000000-0000-0000-0000-000000001179",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001173",
+ "id": "00000000-0000-0000-0000-000000001174",
},
},
- "id": "00000000-0000-0000-0000-000000001190",
+ "id": "00000000-0000-0000-0000-000000001191",
"views": undefined,
},
"company": {
@@ -2216,34 +2219,34 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object
"messageSuppression": {
"fields": {
"createdAt": {
- "id": "00000000-0000-0000-0000-000000001192",
+ "id": "00000000-0000-0000-0000-000000001193",
},
"deletedAt": {
- "id": "00000000-0000-0000-0000-000000001194",
+ "id": "00000000-0000-0000-0000-000000001195",
},
"emailAddress": {
- "id": "00000000-0000-0000-0000-000000001195",
+ "id": "00000000-0000-0000-0000-000000001196",
},
"id": {
- "id": "00000000-0000-0000-0000-000000001191",
+ "id": "00000000-0000-0000-0000-000000001192",
},
"providerEventId": {
- "id": "00000000-0000-0000-0000-000000001198",
+ "id": "00000000-0000-0000-0000-000000001199",
},
"reason": {
- "id": "00000000-0000-0000-0000-000000001196",
+ "id": "00000000-0000-0000-0000-000000001197",
},
"source": {
- "id": "00000000-0000-0000-0000-000000001197",
+ "id": "00000000-0000-0000-0000-000000001198",
},
"unsubscribeTopicId": {
- "id": "00000000-0000-0000-0000-000000001199",
+ "id": "00000000-0000-0000-0000-000000001200",
},
"updatedAt": {
- "id": "00000000-0000-0000-0000-000000001193",
+ "id": "00000000-0000-0000-0000-000000001194",
},
},
- "id": "00000000-0000-0000-0000-000000001200",
+ "id": "00000000-0000-0000-0000-000000001201",
"views": undefined,
},
"messageThread": {
diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/compute-agent-history-standard-metadata.spec.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/compute-agent-history-standard-metadata.spec.ts
index cdfe60095f1..3c4d4efcd90 100644
--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/compute-agent-history-standard-metadata.spec.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/compute-agent-history-standard-metadata.spec.ts
@@ -149,6 +149,23 @@ describe('agent history workspace metadata', () => {
expect(titleField).toMatchObject({ isUIEditable: true });
});
+ it('keeps conversation identity system-managed and existing chats regular', () => {
+ expect(
+ allFlatEntityMaps.flatFieldMetadataMaps.byUniversalIdentifier[
+ STANDARD_OBJECTS.agentChatThread.fields.conversationType
+ .universalIdentifier
+ ],
+ ).toMatchObject({
+ type: FieldMetadataType.SELECT,
+ isSystem: true,
+ isUIEditable: false,
+ isNullable: false,
+ defaultValue: "'STANDARD'",
+ disabledFieldPermissionActions: ['canUpdateFieldValue'],
+ options: [{ value: 'STANDARD' }, { value: 'DIRECT_MESSAGE' }],
+ });
+ });
+
it('keeps the legacy archive column out of reach now that archive is soft delete', () => {
expect(
allFlatEntityMaps.flatFieldMetadataMaps.byUniversalIdentifier[
diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-standard-flat-field-metadata.util.ts
index a05ab135ee5..491b80fd04d 100644
--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-standard-flat-field-metadata.util.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-agent-chat-thread-standard-flat-field-metadata.util.ts
@@ -70,6 +70,57 @@ export const buildAgentChatThreadStandardFlatFieldMetadatas = (
writability: MetadataWritability.OPEN,
isAuditLogged: false,
},
+ conversationType: {
+ ...createStandardFieldFlatMetadata({
+ ...args,
+ context: {
+ fieldName: 'conversationType',
+ type: FieldMetadataType.SELECT,
+ label: i18nLabel(
+ msg({ message: 'Conversation type', context: 'fieldMetadata.label' }),
+ ),
+ description: i18nLabel(
+ msg({
+ message:
+ 'Whether this is a regular chat or a canonical direct message',
+ context: 'fieldMetadata.description',
+ }),
+ ),
+ icon: 'IconMessages',
+ isSystem: true,
+ isUIEditable: false,
+ isNullable: false,
+ defaultValue: "'STANDARD'",
+ options: [
+ {
+ id: '3236f63d-b8f8-4339-9562-1f45814338fd',
+ value: 'STANDARD',
+ label: i18nLabel(
+ msg({ message: 'Regular chat', context: 'fieldMetadata.label' }),
+ ),
+ position: 0,
+ color: 'gray',
+ },
+ {
+ id: '293035d8-eaa1-4f12-8a78-e9eec497ef10',
+ value: 'DIRECT_MESSAGE',
+ label: i18nLabel(
+ msg({
+ message: 'Direct message',
+ context: 'fieldMetadata.label',
+ }),
+ ),
+ position: 1,
+ color: 'blue',
+ },
+ ],
+ },
+ }),
+ writability: MetadataWritability.SYSTEM,
+ disabledFieldPermissionActions:
+ PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
+ isAuditLogged: false,
+ },
isAssistantParticipant: {
...createStandardFieldFlatMetadata({
...args,
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.snap
index 729991b101b..8269dc782f9 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
@@ -31,6 +31,9 @@ exports[`STANDARD_OBJECTS universal identifiers should never change without an e
"conversationSize": {
"universalIdentifier": "f34617ff-a0de-4116-a5ad-7cfd1d0c6d5a",
},
+ "conversationType": {
+ "universalIdentifier": "66f93c2f-ae10-4c1a-8510-355a521f7899",
+ },
"createdAt": {
"universalIdentifier": "a8019021-2b81-5991-bf86-b1eab8e55500",
},
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.ts
index f5400742548..68f28da0e19 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
@@ -17,6 +17,9 @@ export const STANDARD_OBJECT_FIELDS = {
universalIdentifier: '6f3ed3b5-0642-4a2a-9558-98376adb60f4',
},
title: { universalIdentifier: '9283c05e-127c-46ec-82e9-6424a7c0a2f1' },
+ conversationType: {
+ universalIdentifier: '66f93c2f-ae10-4c1a-8510-355a521f7899',
+ },
isAssistantParticipant: {
universalIdentifier: 'd901f5bc-23ba-48ac-9103-145da4b76afe',
},