Merged
Conversation
Contributor
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:58196 This environment will automatically shut down when the PR is closed or after 5 hours. |
37ff482 to
b48b285
Compare
Contributor
Author
|
I need to handle the pending migration |
e8d1d53 to
0f3c052
Compare
packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.service.ts
Show resolved
Hide resolved
Contributor
Greptile OverviewGreptile SummaryThis PR migrates the agent system from v1 to v2, introducing a new architecture built on Key Changes:
Issues Found:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant AgentResolver
participant AgentService
participant FlatEntityMapsCacheService
participant WorkspaceMigrationService
participant FlatAgentValidator
participant ActionHandler
participant Database
Note over Client,Database: Create Agent Flow
Client->>AgentResolver: createOneAgent(input)
AgentResolver->>AgentService: createOneAgent(input, workspaceId)
AgentService->>FlatEntityMapsCacheService: getOrRecomputeManyOrAllFlatEntityMaps()
FlatEntityMapsCacheService-->>AgentService: existingFlatAgentMaps, flatRoleTargetMaps, flatRoleMaps
AgentService->>AgentService: fromCreateAgentInputToFlatAgent()
AgentService->>WorkspaceMigrationService: validateBuildAndRunWorkspaceMigration()
WorkspaceMigrationService->>FlatAgentValidator: validateFlatAgentCreation()
FlatAgentValidator-->>WorkspaceMigrationService: validation result
WorkspaceMigrationService->>ActionHandler: executeForMetadata()
ActionHandler->>Database: save(agentEntity)
Database-->>ActionHandler: created
ActionHandler-->>WorkspaceMigrationService: success
WorkspaceMigrationService-->>AgentService: null (success)
AgentService->>FlatEntityMapsCacheService: getOrRecomputeManyOrAllFlatEntityMaps()
FlatEntityMapsCacheService-->>AgentService: recomputedFlatAgentMaps
AgentService-->>AgentResolver: FlatAgentWithRoleId
AgentResolver->>AgentResolver: fromFlatAgentWithRoleIdToAgentDto()
AgentResolver-->>Client: AgentDTO
|
...etadata-modules/ai/ai-agent/utils/__tests__/agent-graphql-api-exception-handler.util.spec.ts
Outdated
Show resolved
Hide resolved
f6b711d to
0ef27be
Compare
0ef27be to
c3552dc
Compare
Weiko
reviewed
Dec 2, 2025
| import { IsEnum } from 'class-validator'; | ||
|
|
||
| export class AgentResponseFormatText { | ||
| @IsEnum(['text']) |
packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.service.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.service.ts
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction
Closes twentyhq/core-team-issues#1980
In this PR we migrate the agent from v1 to v2.
New FlatRoleTargetByAgentIdMaps
Derivated the
flatRoleTargetMapsto be building aflatRoleTargetByAgentIdMapsto ease retrieving a roleId to associate to an agentCoverage
Added strong coverage on both failing and successful CRU agents operations