@memberjunction/server 5.40.2 → 5.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/agentSessions/HostInstance.d.ts +19 -0
  2. package/dist/agentSessions/HostInstance.d.ts.map +1 -0
  3. package/dist/agentSessions/HostInstance.js +48 -0
  4. package/dist/agentSessions/HostInstance.js.map +1 -0
  5. package/dist/agentSessions/SessionJanitor.d.ts +97 -0
  6. package/dist/agentSessions/SessionJanitor.d.ts.map +1 -0
  7. package/dist/agentSessions/SessionJanitor.js +222 -0
  8. package/dist/agentSessions/SessionJanitor.js.map +1 -0
  9. package/dist/agentSessions/SessionManager.d.ts +142 -0
  10. package/dist/agentSessions/SessionManager.d.ts.map +1 -0
  11. package/dist/agentSessions/SessionManager.js +308 -0
  12. package/dist/agentSessions/SessionManager.js.map +1 -0
  13. package/dist/agentSessions/index.d.ts +4 -0
  14. package/dist/agentSessions/index.d.ts.map +1 -0
  15. package/dist/agentSessions/index.js +26 -0
  16. package/dist/agentSessions/index.js.map +1 -0
  17. package/dist/auth/initializeProviders.d.ts.map +1 -1
  18. package/dist/auth/initializeProviders.js +6 -1
  19. package/dist/auth/initializeProviders.js.map +1 -1
  20. package/dist/context.d.ts.map +1 -1
  21. package/dist/context.js +41 -7
  22. package/dist/context.js.map +1 -1
  23. package/dist/generated/generated.d.ts +659 -3
  24. package/dist/generated/generated.d.ts.map +1 -1
  25. package/dist/generated/generated.js +5459 -1759
  26. package/dist/generated/generated.js.map +1 -1
  27. package/dist/generic/ResolverBase.js +1 -1
  28. package/dist/generic/ResolverBase.js.map +1 -1
  29. package/dist/generic/RunViewResolver.js +9 -10
  30. package/dist/generic/RunViewResolver.js.map +1 -1
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +97 -41
  34. package/dist/index.js.map +1 -1
  35. package/dist/logging/StartupLogger.d.ts +121 -0
  36. package/dist/logging/StartupLogger.d.ts.map +1 -0
  37. package/dist/logging/StartupLogger.js +245 -0
  38. package/dist/logging/StartupLogger.js.map +1 -0
  39. package/dist/logging/variablesLoggingMiddleware.d.ts.map +1 -1
  40. package/dist/logging/variablesLoggingMiddleware.js +21 -2
  41. package/dist/logging/variablesLoggingMiddleware.js.map +1 -1
  42. package/dist/resolvers/AgentSessionResolver.d.ts +42 -0
  43. package/dist/resolvers/AgentSessionResolver.d.ts.map +1 -0
  44. package/dist/resolvers/AgentSessionResolver.js +152 -0
  45. package/dist/resolvers/AgentSessionResolver.js.map +1 -0
  46. package/dist/resolvers/EntityPermissionResolver.d.ts +16 -0
  47. package/dist/resolvers/EntityPermissionResolver.d.ts.map +1 -0
  48. package/dist/resolvers/EntityPermissionResolver.js +95 -0
  49. package/dist/resolvers/EntityPermissionResolver.js.map +1 -0
  50. package/dist/resolvers/RealtimeClientSessionResolver.d.ts +688 -0
  51. package/dist/resolvers/RealtimeClientSessionResolver.d.ts.map +1 -0
  52. package/dist/resolvers/RealtimeClientSessionResolver.js +1774 -0
  53. package/dist/resolvers/RealtimeClientSessionResolver.js.map +1 -0
  54. package/dist/resolvers/RemoteBrowserActionResolver.d.ts +359 -0
  55. package/dist/resolvers/RemoteBrowserActionResolver.d.ts.map +1 -0
  56. package/dist/resolvers/RemoteBrowserActionResolver.js +896 -0
  57. package/dist/resolvers/RemoteBrowserActionResolver.js.map +1 -0
  58. package/dist/services/ScheduledJobsService.d.ts.map +1 -1
  59. package/dist/services/ScheduledJobsService.js +6 -5
  60. package/dist/services/ScheduledJobsService.js.map +1 -1
  61. package/package.json +78 -74
  62. package/src/__tests__/RealtimeClientSessionResolver.test.ts +2605 -0
  63. package/src/__tests__/RemoteBrowserAudioStream.test.ts +174 -0
  64. package/src/__tests__/SessionJanitor.test.ts +234 -0
  65. package/src/__tests__/SessionManager.test.ts +465 -0
  66. package/src/__tests__/subscriptionRedaction.test.ts +5 -0
  67. package/src/agentSessions/HostInstance.ts +53 -0
  68. package/src/agentSessions/SessionJanitor.ts +267 -0
  69. package/src/agentSessions/SessionManager.ts +446 -0
  70. package/src/agentSessions/index.ts +27 -0
  71. package/src/auth/initializeProviders.ts +6 -1
  72. package/src/context.ts +42 -7
  73. package/src/generated/generated.ts +3111 -567
  74. package/src/generic/ResolverBase.ts +1 -1
  75. package/src/generic/RunViewResolver.ts +9 -9
  76. package/src/index.ts +98 -41
  77. package/src/logging/StartupLogger.ts +317 -0
  78. package/src/logging/variablesLoggingMiddleware.ts +25 -5
  79. package/src/resolvers/AgentSessionResolver.ts +138 -0
  80. package/src/resolvers/EntityPermissionResolver.ts +73 -0
  81. package/src/resolvers/RealtimeClientSessionResolver.ts +2162 -0
  82. package/src/resolvers/RemoteBrowserActionResolver.ts +907 -0
  83. package/src/services/ScheduledJobsService.ts +6 -5
@@ -18,7 +18,7 @@ import { mj_core_schema } from '../config.js';
18
18
 
19
19
 
20
20
 
21
- import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentClientToolEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentSearchScopeEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIResultCacheEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJClusterAnalysisEntity, MJClusterAnalysisClusterEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityFormOverrideEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExplorerNavigationItemEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMagicLinkInviteAllowedDomainEntity, MJMagicLinkInviteAllowedPathEntity, MJMagicLinkInviteApplicationEntity, MJMagicLinkInviteRoleEntity, MJMagicLinkInviteEntity, MJMagicLinkRedemptionEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJSearchExecutionLogEntity, MJSearchProviderEntity, MJSearchScopeEntityEntity, MJSearchScopeExternalIndexEntity, MJSearchScopePermissionEntity, MJSearchScopeProviderEntity, MJSearchScopeStorageAccountEntity, MJSearchScopeTestQueryEntity, MJSearchScopeEntity, MJSignatureAccountEntity, MJSignatureProviderEntity, MJSignatureRequestDocumentEntity, MJSignatureRequestLogEntity, MJSignatureRequestRecipientEntity, MJSignatureRequestEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJViewTypeEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
21
+ import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentChannelEntity, MJAIAgentClientToolEntity, MJAIAgentCoAgentEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentSearchScopeEntity, MJAIAgentSessionBridgeParticipantEntity, MJAIAgentSessionBridgeEntity, MJAIAgentSessionChannelEntity, MJAIAgentSessionEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIBridgeAgentIdentityEntity, MJAIBridgeProviderChannelEntity, MJAIBridgeProviderEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIRemoteBrowserProviderEntity, MJAIResultCacheEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJClusterAnalysisEntity, MJClusterAnalysisClusterEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityFormOverrideEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExplorerNavigationItemEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMagicLinkInviteAllowedDomainEntity, MJMagicLinkInviteAllowedPathEntity, MJMagicLinkInviteApplicationEntity, MJMagicLinkInviteRoleEntity, MJMagicLinkInviteEntity, MJMagicLinkRedemptionEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJSearchExecutionLogEntity, MJSearchProviderEntity, MJSearchScopeEntityEntity, MJSearchScopeExternalIndexEntity, MJSearchScopePermissionEntity, MJSearchScopeProviderEntity, MJSearchScopeStorageAccountEntity, MJSearchScopeTestQueryEntity, MJSearchScopeEntity, MJSignatureAccountEntity, MJSignatureProviderEntity, MJSignatureRequestDocumentEntity, MJSignatureRequestLogEntity, MJSignatureRequestRecipientEntity, MJSignatureRequestEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJViewTypeEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
22
22
 
23
23
 
24
24
  //****************************************************************************
@@ -3353,6 +3353,231 @@ export class MJAIAgentCategoryResolver extends ResolverBase {
3353
3353
 
3354
3354
  }
3355
3355
 
3356
+ //****************************************************************************
3357
+ // ENTITY CLASS for MJ: AI Agent Channels
3358
+ //****************************************************************************
3359
+ @ObjectType()
3360
+ export class MJAIAgentChannel_ {
3361
+ @Field()
3362
+ @MaxLength(36)
3363
+ ID: string;
3364
+
3365
+ @Field({description: `Unique channel definition name (e.g. VoiceAudio, TextChat, ClientControl, Whiteboard).`})
3366
+ @MaxLength(100)
3367
+ Name: string;
3368
+
3369
+ @Field({nullable: true, description: `Optional human-readable description of what the channel surface does.`})
3370
+ @MaxLength(1000)
3371
+ Description?: string;
3372
+
3373
+ @Field({description: `Driver key resolved at runtime via MJGlobal.ClassFactory.CreateInstance on the server. MUST match the @RegisterClass key on the concrete server-side channel plugin.`})
3374
+ @MaxLength(250)
3375
+ ServerPluginClass: string;
3376
+
3377
+ @Field({description: `Driver key resolved at runtime via MJGlobal.ClassFactory.CreateInstance on the client. MUST match the @RegisterClass key on the concrete client-side channel plugin (typically an Angular component).`})
3378
+ @MaxLength(250)
3379
+ ClientPluginClass: string;
3380
+
3381
+ @Field({description: `Which transport plane this channel rides: PubSub (the shared control plane), WebRTC (binary media), or WebSocket.`})
3382
+ @MaxLength(20)
3383
+ TransportType: string;
3384
+
3385
+ @Field({nullable: true, description: `Optional JSON Schema used to validate the per-instance channel configuration (AIAgentSessionChannel.Config).`})
3386
+ ConfigSchema?: string;
3387
+
3388
+ @Field(() => Boolean, {description: `Whether this channel definition is available for use. Inactive channels cannot be attached to a session.`})
3389
+ IsActive: boolean;
3390
+
3391
+ @Field()
3392
+ _mj__CreatedAt: Date;
3393
+
3394
+ @Field()
3395
+ _mj__UpdatedAt: Date;
3396
+
3397
+ @Field(() => [MJAIAgentSessionChannel_])
3398
+ MJAIAgentSessionChannels_ChannelIDArray: MJAIAgentSessionChannel_[]; // Link to MJAIAgentSessionChannels
3399
+
3400
+ @Field(() => [MJAIBridgeProviderChannel_])
3401
+ MJAIBridgeProviderChannels_ChannelIDArray: MJAIBridgeProviderChannel_[]; // Link to MJAIBridgeProviderChannels
3402
+
3403
+ }
3404
+
3405
+ //****************************************************************************
3406
+ // INPUT TYPE for MJ: AI Agent Channels
3407
+ //****************************************************************************
3408
+ @InputType()
3409
+ export class CreateMJAIAgentChannelInput {
3410
+ @Field({ nullable: true })
3411
+ ID?: string;
3412
+
3413
+ @Field({ nullable: true })
3414
+ Name?: string;
3415
+
3416
+ @Field({ nullable: true })
3417
+ Description: string | null;
3418
+
3419
+ @Field({ nullable: true })
3420
+ ServerPluginClass?: string;
3421
+
3422
+ @Field({ nullable: true })
3423
+ ClientPluginClass?: string;
3424
+
3425
+ @Field({ nullable: true })
3426
+ TransportType?: string;
3427
+
3428
+ @Field({ nullable: true })
3429
+ ConfigSchema: string | null;
3430
+
3431
+ @Field(() => Boolean, { nullable: true })
3432
+ IsActive?: boolean;
3433
+
3434
+ @Field(() => RestoreContextInput, { nullable: true })
3435
+ RestoreContext___?: RestoreContextInput;
3436
+ }
3437
+
3438
+
3439
+ //****************************************************************************
3440
+ // INPUT TYPE for MJ: AI Agent Channels
3441
+ //****************************************************************************
3442
+ @InputType()
3443
+ export class UpdateMJAIAgentChannelInput {
3444
+ @Field()
3445
+ ID: string;
3446
+
3447
+ @Field({ nullable: true })
3448
+ Name?: string;
3449
+
3450
+ @Field({ nullable: true })
3451
+ Description?: string | null;
3452
+
3453
+ @Field({ nullable: true })
3454
+ ServerPluginClass?: string;
3455
+
3456
+ @Field({ nullable: true })
3457
+ ClientPluginClass?: string;
3458
+
3459
+ @Field({ nullable: true })
3460
+ TransportType?: string;
3461
+
3462
+ @Field({ nullable: true })
3463
+ ConfigSchema?: string | null;
3464
+
3465
+ @Field(() => Boolean, { nullable: true })
3466
+ IsActive?: boolean;
3467
+
3468
+ @Field(() => [KeyValuePairInput], { nullable: true })
3469
+ OldValues___?: KeyValuePairInput[];
3470
+
3471
+ @Field(() => RestoreContextInput, { nullable: true })
3472
+ RestoreContext___?: RestoreContextInput;
3473
+ }
3474
+
3475
+ //****************************************************************************
3476
+ // RESOLVER for MJ: AI Agent Channels
3477
+ //****************************************************************************
3478
+ @ObjectType()
3479
+ export class RunMJAIAgentChannelViewResult {
3480
+ @Field(() => [MJAIAgentChannel_])
3481
+ Results: MJAIAgentChannel_[];
3482
+
3483
+ @Field(() => String, {nullable: true})
3484
+ UserViewRunID?: string;
3485
+
3486
+ @Field(() => Int, {nullable: true})
3487
+ RowCount: number;
3488
+
3489
+ @Field(() => Int, {nullable: true})
3490
+ TotalRowCount: number;
3491
+
3492
+ @Field(() => Int, {nullable: true})
3493
+ ExecutionTime: number;
3494
+
3495
+ @Field({nullable: true})
3496
+ ErrorMessage?: string;
3497
+
3498
+ @Field(() => Boolean, {nullable: false})
3499
+ Success: boolean;
3500
+ }
3501
+
3502
+ @Resolver(MJAIAgentChannel_)
3503
+ export class MJAIAgentChannelResolver extends ResolverBase {
3504
+ @Query(() => RunMJAIAgentChannelViewResult)
3505
+ async RunMJAIAgentChannelViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3506
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3507
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
3508
+ }
3509
+
3510
+ @Query(() => RunMJAIAgentChannelViewResult)
3511
+ async RunMJAIAgentChannelViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3512
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3513
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
3514
+ }
3515
+
3516
+ @Query(() => RunMJAIAgentChannelViewResult)
3517
+ async RunMJAIAgentChannelDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3518
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3519
+ input.EntityName = 'MJ: AI Agent Channels';
3520
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
3521
+ }
3522
+ @Query(() => MJAIAgentChannel_, { nullable: true })
3523
+ async MJAIAgentChannel(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentChannel_ | null> {
3524
+ this.CheckUserReadPermissions('MJ: AI Agent Channels', userPayload);
3525
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3526
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentChannels')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Channels', userPayload, EntityPermissionType.Read, 'AND');
3527
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
3528
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Channels', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
3529
+ return result;
3530
+ }
3531
+
3532
+ @FieldResolver(() => [MJAIAgentSessionChannel_])
3533
+ async MJAIAgentSessionChannels_ChannelIDArray(@Root() mjaiagentchannel_: MJAIAgentChannel_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3534
+ this.CheckUserReadPermissions('MJ: AI Agent Session Channels', userPayload);
3535
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3536
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionChannels')} WHERE ${provider.QuoteIdentifier('ChannelID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Channels', userPayload, EntityPermissionType.Read, 'AND');
3537
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentchannel_.ID], undefined, this.GetUserFromPayload(userPayload));
3538
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Channels', rows, this.GetUserFromPayload(userPayload));
3539
+ return result;
3540
+ }
3541
+
3542
+ @FieldResolver(() => [MJAIBridgeProviderChannel_])
3543
+ async MJAIBridgeProviderChannels_ChannelIDArray(@Root() mjaiagentchannel_: MJAIAgentChannel_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3544
+ this.CheckUserReadPermissions('MJ: AI Bridge Provider Channels', userPayload);
3545
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3546
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeProviderChannels')} WHERE ${provider.QuoteIdentifier('ChannelID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Provider Channels', userPayload, EntityPermissionType.Read, 'AND');
3547
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentchannel_.ID], undefined, this.GetUserFromPayload(userPayload));
3548
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Bridge Provider Channels', rows, this.GetUserFromPayload(userPayload));
3549
+ return result;
3550
+ }
3551
+
3552
+ @Mutation(() => MJAIAgentChannel_)
3553
+ async CreateMJAIAgentChannel(
3554
+ @Arg('input', () => CreateMJAIAgentChannelInput) input: CreateMJAIAgentChannelInput,
3555
+ @Ctx() { providers, userPayload }: AppContext,
3556
+ @PubSub() pubSub: PubSubEngine
3557
+ ) {
3558
+ const provider = GetReadWriteProvider(providers);
3559
+ return this.CreateRecord('MJ: AI Agent Channels', input, provider, userPayload, pubSub)
3560
+ }
3561
+
3562
+ @Mutation(() => MJAIAgentChannel_)
3563
+ async UpdateMJAIAgentChannel(
3564
+ @Arg('input', () => UpdateMJAIAgentChannelInput) input: UpdateMJAIAgentChannelInput,
3565
+ @Ctx() { providers, userPayload }: AppContext,
3566
+ @PubSub() pubSub: PubSubEngine
3567
+ ) {
3568
+ const provider = GetReadWriteProvider(providers);
3569
+ return this.UpdateRecord('MJ: AI Agent Channels', input, provider, userPayload, pubSub);
3570
+ }
3571
+
3572
+ @Mutation(() => MJAIAgentChannel_)
3573
+ async DeleteMJAIAgentChannel(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3574
+ const provider = GetReadWriteProvider(providers);
3575
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
3576
+ return this.DeleteRecord('MJ: AI Agent Channels', key, options, provider, userPayload, pubSub);
3577
+ }
3578
+
3579
+ }
3580
+
3356
3581
  //****************************************************************************
3357
3582
  // ENTITY CLASS for MJ: AI Agent Client Tools
3358
3583
  //****************************************************************************
@@ -3530,6 +3755,226 @@ export class MJAIAgentClientToolResolver extends ResolverBase {
3530
3755
 
3531
3756
  }
3532
3757
 
3758
+ //****************************************************************************
3759
+ // ENTITY CLASS for MJ: AI Agent Co Agents
3760
+ //****************************************************************************
3761
+ @ObjectType({ description: `Agent-to-agent affinity registry. Today: OPT-IN co-agent pairings — which underlying agents (or whole agent types) a Realtime-type co-agent can front in live sessions. A co-agent with NO rows is universal (fronts any single agent supplied at runtime — the zero-config default); rows restrict the co-agent to a prebuilt target list. The Type column reserves future relationship natures (Peer/Delegate/Fallback/Reviewer/Observer). Distinct from AIAgentRelationship, which wires agent-to-SUB-AGENT invocation (mappings, message modes); this table is peer affinity with no invocation config.` })
3762
+ export class MJAIAgentCoAgent_ {
3763
+ @Field()
3764
+ @MaxLength(36)
3765
+ ID: string;
3766
+
3767
+ @Field({description: `The relationship OWNER. For Type=CoAgent this is the Realtime-type co-agent (the live voice); it must be an Active agent of the Realtime type (enforced server-side). For reserved future types, the agent the relationship is read FROM.`})
3768
+ @MaxLength(36)
3769
+ CoAgentID: string;
3770
+
3771
+ @Field({nullable: true, description: `A specific paired agent — for Type=CoAgent, an underlying agent this co-agent can front. Exactly one of TargetAgentID / TargetAgentTypeID is set per row.`})
3772
+ @MaxLength(36)
3773
+ TargetAgentID?: string;
3774
+
3775
+ @Field({nullable: true, description: `A whole agent TYPE as the paired side — for Type=CoAgent, this co-agent applies to every agent of the type (with IsDefault=1, it is the type-level default co-agent, replacing a column-based default that would create an AIAgent↔AIAgentType FK cycle). Exactly one of TargetAgentID / TargetAgentTypeID is set per row.`})
3776
+ @MaxLength(36)
3777
+ TargetAgentTypeID?: string;
3778
+
3779
+ @Field({description: `Nature of the relationship, read CoAgentID → target side. CoAgent = the owner can front the target in realtime sessions (the ONLY type implemented today). Peer (agent-to-agent conversation partners), Delegate (handoff/escalation), Fallback (substitute when owner unavailable), Reviewer (target reviews owner output), Observer (target observes owner sessions) are RESERVED for future features — the vocabulary ships now so generated string-union types stay stable.`})
3780
+ @MaxLength(30)
3781
+ Type: string;
3782
+
3783
+ @Field(() => Boolean, {description: `When 1: for a TargetAgentID row, this target is the co-agent's default underlying agent (used when a session starts against the co-agent without an explicit runtime target); for a TargetAgentTypeID row, this co-agent is the default co-agent for agents of that type. At most one default per (CoAgentID, Type) is enforced server-side.`})
3784
+ IsDefault: boolean;
3785
+
3786
+ @Field(() => Int, {description: `Display/priority order of this pairing in target-agent pickers and resolution ties (ascending).`})
3787
+ Sequence: number;
3788
+
3789
+ @Field({description: `Whether this pairing participates in resolution. Disabled rows are kept for audit/toggling but ignored by the resolution chain and pickers.`})
3790
+ @MaxLength(20)
3791
+ Status: string;
3792
+
3793
+ @Field({nullable: true, description: `Optional per-relationship configuration JSON (shape owned by the Type, e.g. a future Peer arena's turn budget). NULL for plain pairings.`})
3794
+ Configuration?: string;
3795
+
3796
+ @Field()
3797
+ _mj__CreatedAt: Date;
3798
+
3799
+ @Field()
3800
+ _mj__UpdatedAt: Date;
3801
+
3802
+ @Field({nullable: true})
3803
+ @MaxLength(255)
3804
+ CoAgent?: string;
3805
+
3806
+ @Field({nullable: true})
3807
+ @MaxLength(255)
3808
+ TargetAgent?: string;
3809
+
3810
+ @Field({nullable: true})
3811
+ @MaxLength(100)
3812
+ TargetAgentType?: string;
3813
+
3814
+ }
3815
+
3816
+ //****************************************************************************
3817
+ // INPUT TYPE for MJ: AI Agent Co Agents
3818
+ //****************************************************************************
3819
+ @InputType()
3820
+ export class CreateMJAIAgentCoAgentInput {
3821
+ @Field({ nullable: true })
3822
+ ID?: string;
3823
+
3824
+ @Field({ nullable: true })
3825
+ CoAgentID?: string;
3826
+
3827
+ @Field({ nullable: true })
3828
+ TargetAgentID: string | null;
3829
+
3830
+ @Field({ nullable: true })
3831
+ TargetAgentTypeID: string | null;
3832
+
3833
+ @Field({ nullable: true })
3834
+ Type?: string;
3835
+
3836
+ @Field(() => Boolean, { nullable: true })
3837
+ IsDefault?: boolean;
3838
+
3839
+ @Field(() => Int, { nullable: true })
3840
+ Sequence?: number;
3841
+
3842
+ @Field({ nullable: true })
3843
+ Status?: string;
3844
+
3845
+ @Field({ nullable: true })
3846
+ Configuration: string | null;
3847
+
3848
+ @Field(() => RestoreContextInput, { nullable: true })
3849
+ RestoreContext___?: RestoreContextInput;
3850
+ }
3851
+
3852
+
3853
+ //****************************************************************************
3854
+ // INPUT TYPE for MJ: AI Agent Co Agents
3855
+ //****************************************************************************
3856
+ @InputType()
3857
+ export class UpdateMJAIAgentCoAgentInput {
3858
+ @Field()
3859
+ ID: string;
3860
+
3861
+ @Field({ nullable: true })
3862
+ CoAgentID?: string;
3863
+
3864
+ @Field({ nullable: true })
3865
+ TargetAgentID?: string | null;
3866
+
3867
+ @Field({ nullable: true })
3868
+ TargetAgentTypeID?: string | null;
3869
+
3870
+ @Field({ nullable: true })
3871
+ Type?: string;
3872
+
3873
+ @Field(() => Boolean, { nullable: true })
3874
+ IsDefault?: boolean;
3875
+
3876
+ @Field(() => Int, { nullable: true })
3877
+ Sequence?: number;
3878
+
3879
+ @Field({ nullable: true })
3880
+ Status?: string;
3881
+
3882
+ @Field({ nullable: true })
3883
+ Configuration?: string | null;
3884
+
3885
+ @Field(() => [KeyValuePairInput], { nullable: true })
3886
+ OldValues___?: KeyValuePairInput[];
3887
+
3888
+ @Field(() => RestoreContextInput, { nullable: true })
3889
+ RestoreContext___?: RestoreContextInput;
3890
+ }
3891
+
3892
+ //****************************************************************************
3893
+ // RESOLVER for MJ: AI Agent Co Agents
3894
+ //****************************************************************************
3895
+ @ObjectType()
3896
+ export class RunMJAIAgentCoAgentViewResult {
3897
+ @Field(() => [MJAIAgentCoAgent_])
3898
+ Results: MJAIAgentCoAgent_[];
3899
+
3900
+ @Field(() => String, {nullable: true})
3901
+ UserViewRunID?: string;
3902
+
3903
+ @Field(() => Int, {nullable: true})
3904
+ RowCount: number;
3905
+
3906
+ @Field(() => Int, {nullable: true})
3907
+ TotalRowCount: number;
3908
+
3909
+ @Field(() => Int, {nullable: true})
3910
+ ExecutionTime: number;
3911
+
3912
+ @Field({nullable: true})
3913
+ ErrorMessage?: string;
3914
+
3915
+ @Field(() => Boolean, {nullable: false})
3916
+ Success: boolean;
3917
+ }
3918
+
3919
+ @Resolver(MJAIAgentCoAgent_)
3920
+ export class MJAIAgentCoAgentResolver extends ResolverBase {
3921
+ @Query(() => RunMJAIAgentCoAgentViewResult)
3922
+ async RunMJAIAgentCoAgentViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3923
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3924
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
3925
+ }
3926
+
3927
+ @Query(() => RunMJAIAgentCoAgentViewResult)
3928
+ async RunMJAIAgentCoAgentViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3929
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3930
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
3931
+ }
3932
+
3933
+ @Query(() => RunMJAIAgentCoAgentViewResult)
3934
+ async RunMJAIAgentCoAgentDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3935
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3936
+ input.EntityName = 'MJ: AI Agent Co Agents';
3937
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
3938
+ }
3939
+ @Query(() => MJAIAgentCoAgent_, { nullable: true })
3940
+ async MJAIAgentCoAgent(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentCoAgent_ | null> {
3941
+ this.CheckUserReadPermissions('MJ: AI Agent Co Agents', userPayload);
3942
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3943
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentCoAgents')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Co Agents', userPayload, EntityPermissionType.Read, 'AND');
3944
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
3945
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Co Agents', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
3946
+ return result;
3947
+ }
3948
+
3949
+ @Mutation(() => MJAIAgentCoAgent_)
3950
+ async CreateMJAIAgentCoAgent(
3951
+ @Arg('input', () => CreateMJAIAgentCoAgentInput) input: CreateMJAIAgentCoAgentInput,
3952
+ @Ctx() { providers, userPayload }: AppContext,
3953
+ @PubSub() pubSub: PubSubEngine
3954
+ ) {
3955
+ const provider = GetReadWriteProvider(providers);
3956
+ return this.CreateRecord('MJ: AI Agent Co Agents', input, provider, userPayload, pubSub)
3957
+ }
3958
+
3959
+ @Mutation(() => MJAIAgentCoAgent_)
3960
+ async UpdateMJAIAgentCoAgent(
3961
+ @Arg('input', () => UpdateMJAIAgentCoAgentInput) input: UpdateMJAIAgentCoAgentInput,
3962
+ @Ctx() { providers, userPayload }: AppContext,
3963
+ @PubSub() pubSub: PubSubEngine
3964
+ ) {
3965
+ const provider = GetReadWriteProvider(providers);
3966
+ return this.UpdateRecord('MJ: AI Agent Co Agents', input, provider, userPayload, pubSub);
3967
+ }
3968
+
3969
+ @Mutation(() => MJAIAgentCoAgent_)
3970
+ async DeleteMJAIAgentCoAgent(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3971
+ const provider = GetReadWriteProvider(providers);
3972
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
3973
+ return this.DeleteRecord('MJ: AI Agent Co Agents', key, options, provider, userPayload, pubSub);
3974
+ }
3975
+
3976
+ }
3977
+
3533
3978
  //****************************************************************************
3534
3979
  // ENTITY CLASS for MJ: AI Agent Configurations
3535
3980
  //****************************************************************************
@@ -4170,6 +4615,7 @@ export class MJAIAgentExample_ {
4170
4615
  SourceConversation?: string;
4171
4616
 
4172
4617
  @Field({nullable: true})
4618
+ @MaxLength(100)
4173
4619
  SourceConversationDetail?: string;
4174
4620
 
4175
4621
  @Field({nullable: true})
@@ -5203,7 +5649,7 @@ export class MJAIAgentNote_ {
5203
5649
  @Field({nullable: true, description: `Internal comments about this note, not included in agent context injection.`})
5204
5650
  Comments?: string;
5205
5651
 
5206
- @Field({description: `Status of the note: Pending (awaiting review), Active (in use), or Revoked (disabled).`})
5652
+ @Field({description: `Lifecycle status of the note. Pending = awaiting approval, Active = vetted and injectable, Provisional = written in-flight by an agent (immediately injectable, awaiting Memory Manager hardening to Active), Revoked = superseded/withdrawn, Archived = retired by consolidation or decay.`})
5207
5653
  @MaxLength(20)
5208
5654
  Status: string;
5209
5655
 
@@ -5267,6 +5713,10 @@ export class MJAIAgentNote_ {
5267
5713
  @Field(() => Float, {nullable: true, description: `Composite importance score (0-10) computed from 7 signals: recency, LLM-importance, relevance, uniqueness, correction boost, goal alignment, user mark. Replaces raw AccessCount for authority and retention decisions.`})
5268
5714
  ImportanceScore?: number;
5269
5715
 
5716
+ @Field({description: `Type of author that created the note: Agent = written in-flight during an agent run, MemoryManager = extracted/consolidated by the scheduled Memory Manager, User = manually created by a person.`})
5717
+ @MaxLength(20)
5718
+ AuthorType: string;
5719
+
5270
5720
  @Field({nullable: true})
5271
5721
  @MaxLength(255)
5272
5722
  Agent?: string;
@@ -5284,6 +5734,7 @@ export class MJAIAgentNote_ {
5284
5734
  SourceConversation?: string;
5285
5735
 
5286
5736
  @Field({nullable: true})
5737
+ @MaxLength(100)
5287
5738
  SourceConversationDetail?: string;
5288
5739
 
5289
5740
  @Field({nullable: true})
@@ -5303,6 +5754,7 @@ export class MJAIAgentNote_ {
5303
5754
  PrimaryScopeEntity?: string;
5304
5755
 
5305
5756
  @Field({nullable: true})
5757
+ @MaxLength(20)
5306
5758
  ConsolidatedIntoNote?: string;
5307
5759
 
5308
5760
  @Field({nullable: true})
@@ -5397,6 +5849,9 @@ export class CreateMJAIAgentNoteInput {
5397
5849
  @Field(() => Float, { nullable: true })
5398
5850
  ImportanceScore: number | null;
5399
5851
 
5852
+ @Field({ nullable: true })
5853
+ AuthorType?: string;
5854
+
5400
5855
  @Field(() => RestoreContextInput, { nullable: true })
5401
5856
  RestoreContext___?: RestoreContextInput;
5402
5857
  }
@@ -5485,6 +5940,9 @@ export class UpdateMJAIAgentNoteInput {
5485
5940
  @Field(() => Float, { nullable: true })
5486
5941
  ImportanceScore?: number | null;
5487
5942
 
5943
+ @Field({ nullable: true })
5944
+ AuthorType?: string;
5945
+
5488
5946
  @Field(() => [KeyValuePairInput], { nullable: true })
5489
5947
  OldValues___?: KeyValuePairInput[];
5490
5948
 
@@ -7602,6 +8060,10 @@ each time the agent processes a prompt step.`})
7602
8060
  @Field({nullable: true, description: `Timestamp of the most recent liveness heartbeat written by the owning process while this run is in progress. Used by the agent-run watchdog to detect runs orphaned by a process restart/crash or a failed terminal-state write: a Running row whose LastHeartbeatAt has gone stale (or is NULL with an old StartedAt) is force-failed. Always stamped on the database clock (GETUTCDATE), never process time.`})
7603
8061
  LastHeartbeatAt?: Date;
7604
8062
 
8063
+ @Field({nullable: true, description: `Links this run to the long-lived AIAgentSession it executed within. NULL for runs outside any real-time session. This is the persisted session reference and is distinct from the per-connection transport sessionID.`})
8064
+ @MaxLength(36)
8065
+ AgentSessionID?: string;
8066
+
7605
8067
  @Field({nullable: true})
7606
8068
  @MaxLength(255)
7607
8069
  Agent?: string;
@@ -7619,6 +8081,7 @@ each time the agent processes a prompt step.`})
7619
8081
  User?: string;
7620
8082
 
7621
8083
  @Field({nullable: true})
8084
+ @MaxLength(100)
7622
8085
  ConversationDetail?: string;
7623
8086
 
7624
8087
  @Field({nullable: true})
@@ -7832,6 +8295,9 @@ export class CreateMJAIAgentRunInput {
7832
8295
  @Field({ nullable: true })
7833
8296
  LastHeartbeatAt: Date | null;
7834
8297
 
8298
+ @Field({ nullable: true })
8299
+ AgentSessionID: string | null;
8300
+
7835
8301
  @Field(() => RestoreContextInput, { nullable: true })
7836
8302
  RestoreContext___?: RestoreContextInput;
7837
8303
  }
@@ -7983,6 +8449,9 @@ export class UpdateMJAIAgentRunInput {
7983
8449
  @Field({ nullable: true })
7984
8450
  LastHeartbeatAt?: Date | null;
7985
8451
 
8452
+ @Field({ nullable: true })
8453
+ AgentSessionID?: string | null;
8454
+
7986
8455
  @Field(() => [KeyValuePairInput], { nullable: true })
7987
8456
  OldValues___?: KeyValuePairInput[];
7988
8457
 
@@ -8423,34 +8892,42 @@ export class MJAIAgentSearchScopeResolver extends ResolverBase {
8423
8892
  }
8424
8893
 
8425
8894
  //****************************************************************************
8426
- // ENTITY CLASS for MJ: AI Agent Step Paths
8895
+ // ENTITY CLASS for MJ: AI Agent Session Bridge Participants
8427
8896
  //****************************************************************************
8428
- @ObjectType({ description: `Defines paths (edges) between steps in a flow-based AI agent execution graph` })
8429
- export class MJAIAgentStepPath_ {
8897
+ @ObjectType()
8898
+ export class MJAIAgentSessionBridgeParticipant_ {
8430
8899
  @Field()
8431
8900
  @MaxLength(36)
8432
8901
  ID: string;
8433
8902
 
8434
8903
  @Field()
8435
8904
  @MaxLength(36)
8436
- OriginStepID: string;
8905
+ SessionBridgeID: string;
8437
8906
 
8438
- @Field()
8439
- @MaxLength(36)
8440
- DestinationStepID: string;
8907
+ @Field({nullable: true, description: `The platform's participant identifier (used to map diarized audio to a person).`})
8908
+ @MaxLength(500)
8909
+ ExternalParticipantID?: string;
8441
8910
 
8442
- @Field({nullable: true, description: `Boolean expression to evaluate. If null, path is always taken. Evaluated against payload and step results.`})
8443
- Condition?: string;
8911
+ @Field({nullable: true, description: `The participant's display name as shown on the platform.`})
8912
+ @MaxLength(500)
8913
+ DisplayName?: string;
8444
8914
 
8445
- @Field(() => Int, {description: `Path evaluation priority. Higher values are evaluated first. Use 0 or negative values for default/fallback paths that execute when no other conditions match.`})
8446
- Priority: number;
8915
+ @Field({description: `The participant's role in the meeting/call: Host, CoHost, Participant, or Agent (the AI bot).`})
8916
+ @MaxLength(20)
8917
+ Role: string;
8447
8918
 
8448
- @Field({nullable: true})
8449
- @MaxLength(255)
8450
- Description?: string;
8919
+ @Field({nullable: true, description: `The matched MJ user, when the participant can be identified (NULL for external/anonymous participants).`})
8920
+ @MaxLength(36)
8921
+ UserID?: string;
8451
8922
 
8452
- @Field({nullable: true})
8453
- PathPoints?: string;
8923
+ @Field(() => Boolean, {description: `True when this participant is the bridged AI agent bot itself.`})
8924
+ IsAgent: boolean;
8925
+
8926
+ @Field({nullable: true, description: `When the participant joined the meeting/call.`})
8927
+ JoinedAt?: Date;
8928
+
8929
+ @Field({nullable: true, description: `When the participant left. NULL while still present.`})
8930
+ LeftAt?: Date;
8454
8931
 
8455
8932
  @Field()
8456
8933
  _mj__CreatedAt: Date;
@@ -8458,41 +8935,47 @@ export class MJAIAgentStepPath_ {
8458
8935
  @Field()
8459
8936
  _mj__UpdatedAt: Date;
8460
8937
 
8461
- @Field()
8462
- @MaxLength(255)
8463
- OriginStep: string;
8938
+ @Field({nullable: true})
8939
+ @MaxLength(500)
8940
+ SessionBridge?: string;
8464
8941
 
8465
- @Field()
8466
- @MaxLength(255)
8467
- DestinationStep: string;
8942
+ @Field({nullable: true})
8943
+ @MaxLength(100)
8944
+ User?: string;
8468
8945
 
8469
8946
  }
8470
8947
 
8471
8948
  //****************************************************************************
8472
- // INPUT TYPE for MJ: AI Agent Step Paths
8949
+ // INPUT TYPE for MJ: AI Agent Session Bridge Participants
8473
8950
  //****************************************************************************
8474
8951
  @InputType()
8475
- export class CreateMJAIAgentStepPathInput {
8952
+ export class CreateMJAIAgentSessionBridgeParticipantInput {
8476
8953
  @Field({ nullable: true })
8477
8954
  ID?: string;
8478
8955
 
8479
8956
  @Field({ nullable: true })
8480
- OriginStepID?: string;
8957
+ SessionBridgeID?: string;
8481
8958
 
8482
8959
  @Field({ nullable: true })
8483
- DestinationStepID?: string;
8960
+ ExternalParticipantID: string | null;
8484
8961
 
8485
8962
  @Field({ nullable: true })
8486
- Condition: string | null;
8963
+ DisplayName: string | null;
8487
8964
 
8488
- @Field(() => Int, { nullable: true })
8489
- Priority?: number;
8965
+ @Field({ nullable: true })
8966
+ Role?: string;
8490
8967
 
8491
8968
  @Field({ nullable: true })
8492
- Description: string | null;
8969
+ UserID: string | null;
8970
+
8971
+ @Field(() => Boolean, { nullable: true })
8972
+ IsAgent?: boolean;
8493
8973
 
8494
8974
  @Field({ nullable: true })
8495
- PathPoints: string | null;
8975
+ JoinedAt: Date | null;
8976
+
8977
+ @Field({ nullable: true })
8978
+ LeftAt: Date | null;
8496
8979
 
8497
8980
  @Field(() => RestoreContextInput, { nullable: true })
8498
8981
  RestoreContext___?: RestoreContextInput;
@@ -8500,30 +8983,36 @@ export class CreateMJAIAgentStepPathInput {
8500
8983
 
8501
8984
 
8502
8985
  //****************************************************************************
8503
- // INPUT TYPE for MJ: AI Agent Step Paths
8986
+ // INPUT TYPE for MJ: AI Agent Session Bridge Participants
8504
8987
  //****************************************************************************
8505
8988
  @InputType()
8506
- export class UpdateMJAIAgentStepPathInput {
8989
+ export class UpdateMJAIAgentSessionBridgeParticipantInput {
8507
8990
  @Field()
8508
8991
  ID: string;
8509
8992
 
8510
8993
  @Field({ nullable: true })
8511
- OriginStepID?: string;
8994
+ SessionBridgeID?: string;
8512
8995
 
8513
8996
  @Field({ nullable: true })
8514
- DestinationStepID?: string;
8997
+ ExternalParticipantID?: string | null;
8515
8998
 
8516
8999
  @Field({ nullable: true })
8517
- Condition?: string | null;
9000
+ DisplayName?: string | null;
8518
9001
 
8519
- @Field(() => Int, { nullable: true })
8520
- Priority?: number;
9002
+ @Field({ nullable: true })
9003
+ Role?: string;
8521
9004
 
8522
9005
  @Field({ nullable: true })
8523
- Description?: string | null;
9006
+ UserID?: string | null;
9007
+
9008
+ @Field(() => Boolean, { nullable: true })
9009
+ IsAgent?: boolean;
8524
9010
 
8525
9011
  @Field({ nullable: true })
8526
- PathPoints?: string | null;
9012
+ JoinedAt?: Date | null;
9013
+
9014
+ @Field({ nullable: true })
9015
+ LeftAt?: Date | null;
8527
9016
 
8528
9017
  @Field(() => [KeyValuePairInput], { nullable: true })
8529
9018
  OldValues___?: KeyValuePairInput[];
@@ -8533,12 +9022,12 @@ export class UpdateMJAIAgentStepPathInput {
8533
9022
  }
8534
9023
 
8535
9024
  //****************************************************************************
8536
- // RESOLVER for MJ: AI Agent Step Paths
9025
+ // RESOLVER for MJ: AI Agent Session Bridge Participants
8537
9026
  //****************************************************************************
8538
9027
  @ObjectType()
8539
- export class RunMJAIAgentStepPathViewResult {
8540
- @Field(() => [MJAIAgentStepPath_])
8541
- Results: MJAIAgentStepPath_[];
9028
+ export class RunMJAIAgentSessionBridgeParticipantViewResult {
9029
+ @Field(() => [MJAIAgentSessionBridgeParticipant_])
9030
+ Results: MJAIAgentSessionBridgeParticipant_[];
8542
9031
 
8543
9032
  @Field(() => String, {nullable: true})
8544
9033
  UserViewRunID?: string;
@@ -8559,128 +9048,129 @@ export class RunMJAIAgentStepPathViewResult {
8559
9048
  Success: boolean;
8560
9049
  }
8561
9050
 
8562
- @Resolver(MJAIAgentStepPath_)
8563
- export class MJAIAgentStepPathResolver extends ResolverBase {
8564
- @Query(() => RunMJAIAgentStepPathViewResult)
8565
- async RunMJAIAgentStepPathViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9051
+ @Resolver(MJAIAgentSessionBridgeParticipant_)
9052
+ export class MJAIAgentSessionBridgeParticipantResolver extends ResolverBase {
9053
+ @Query(() => RunMJAIAgentSessionBridgeParticipantViewResult)
9054
+ async RunMJAIAgentSessionBridgeParticipantViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8566
9055
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8567
9056
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
8568
9057
  }
8569
9058
 
8570
- @Query(() => RunMJAIAgentStepPathViewResult)
8571
- async RunMJAIAgentStepPathViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9059
+ @Query(() => RunMJAIAgentSessionBridgeParticipantViewResult)
9060
+ async RunMJAIAgentSessionBridgeParticipantViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8572
9061
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8573
9062
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
8574
9063
  }
8575
9064
 
8576
- @Query(() => RunMJAIAgentStepPathViewResult)
8577
- async RunMJAIAgentStepPathDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9065
+ @Query(() => RunMJAIAgentSessionBridgeParticipantViewResult)
9066
+ async RunMJAIAgentSessionBridgeParticipantDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8578
9067
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8579
- input.EntityName = 'MJ: AI Agent Step Paths';
9068
+ input.EntityName = 'MJ: AI Agent Session Bridge Participants';
8580
9069
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
8581
9070
  }
8582
- @Query(() => MJAIAgentStepPath_, { nullable: true })
8583
- async MJAIAgentStepPath(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentStepPath_ | null> {
8584
- this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
9071
+ @Query(() => MJAIAgentSessionBridgeParticipant_, { nullable: true })
9072
+ async MJAIAgentSessionBridgeParticipant(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentSessionBridgeParticipant_ | null> {
9073
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridge Participants', userPayload);
8585
9074
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8586
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
9075
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridgeParticipants')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridge Participants', userPayload, EntityPermissionType.Read, 'AND');
8587
9076
  const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
8588
- const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
9077
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Session Bridge Participants', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
8589
9078
  return result;
8590
9079
  }
8591
9080
 
8592
- @Mutation(() => MJAIAgentStepPath_)
8593
- async CreateMJAIAgentStepPath(
8594
- @Arg('input', () => CreateMJAIAgentStepPathInput) input: CreateMJAIAgentStepPathInput,
9081
+ @Mutation(() => MJAIAgentSessionBridgeParticipant_)
9082
+ async CreateMJAIAgentSessionBridgeParticipant(
9083
+ @Arg('input', () => CreateMJAIAgentSessionBridgeParticipantInput) input: CreateMJAIAgentSessionBridgeParticipantInput,
8595
9084
  @Ctx() { providers, userPayload }: AppContext,
8596
9085
  @PubSub() pubSub: PubSubEngine
8597
9086
  ) {
8598
9087
  const provider = GetReadWriteProvider(providers);
8599
- return this.CreateRecord('MJ: AI Agent Step Paths', input, provider, userPayload, pubSub)
9088
+ return this.CreateRecord('MJ: AI Agent Session Bridge Participants', input, provider, userPayload, pubSub)
8600
9089
  }
8601
9090
 
8602
- @Mutation(() => MJAIAgentStepPath_)
8603
- async UpdateMJAIAgentStepPath(
8604
- @Arg('input', () => UpdateMJAIAgentStepPathInput) input: UpdateMJAIAgentStepPathInput,
9091
+ @Mutation(() => MJAIAgentSessionBridgeParticipant_)
9092
+ async UpdateMJAIAgentSessionBridgeParticipant(
9093
+ @Arg('input', () => UpdateMJAIAgentSessionBridgeParticipantInput) input: UpdateMJAIAgentSessionBridgeParticipantInput,
8605
9094
  @Ctx() { providers, userPayload }: AppContext,
8606
9095
  @PubSub() pubSub: PubSubEngine
8607
9096
  ) {
8608
9097
  const provider = GetReadWriteProvider(providers);
8609
- return this.UpdateRecord('MJ: AI Agent Step Paths', input, provider, userPayload, pubSub);
9098
+ return this.UpdateRecord('MJ: AI Agent Session Bridge Participants', input, provider, userPayload, pubSub);
8610
9099
  }
8611
9100
 
8612
- @Mutation(() => MJAIAgentStepPath_)
8613
- async DeleteMJAIAgentStepPath(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9101
+ @Mutation(() => MJAIAgentSessionBridgeParticipant_)
9102
+ async DeleteMJAIAgentSessionBridgeParticipant(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8614
9103
  const provider = GetReadWriteProvider(providers);
8615
9104
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
8616
- return this.DeleteRecord('MJ: AI Agent Step Paths', key, options, provider, userPayload, pubSub);
9105
+ return this.DeleteRecord('MJ: AI Agent Session Bridge Participants', key, options, provider, userPayload, pubSub);
8617
9106
  }
8618
9107
 
8619
9108
  }
8620
9109
 
8621
9110
  //****************************************************************************
8622
- // ENTITY CLASS for MJ: AI Agent Steps
9111
+ // ENTITY CLASS for MJ: AI Agent Session Bridges
8623
9112
  //****************************************************************************
8624
- @ObjectType({ description: `Defines individual steps (nodes) in a flow-based AI agent execution graph` })
8625
- export class MJAIAgentStep_ {
9113
+ @ObjectType()
9114
+ export class MJAIAgentSessionBridge_ {
8626
9115
  @Field()
8627
9116
  @MaxLength(36)
8628
9117
  ID: string;
8629
9118
 
8630
9119
  @Field()
8631
9120
  @MaxLength(36)
8632
- AgentID: string;
9121
+ AgentSessionID: string;
8633
9122
 
8634
9123
  @Field()
8635
- @MaxLength(255)
8636
- Name: string;
8637
-
8638
- @Field({nullable: true})
8639
- Description?: string;
9124
+ @MaxLength(36)
9125
+ ProviderID: string;
8640
9126
 
8641
- @Field({description: `Type of step: Action (execute an action), Sub-Agent (delegate to another agent), or Prompt (run an AI prompt)`})
9127
+ @Field({description: `Direction of the connection: Outbound (the agent goes to a meeting / places a call) or Inbound (a meeting/call routes to the agent).`})
8642
9128
  @MaxLength(20)
8643
- StepType: string;
9129
+ Direction: string;
8644
9130
 
8645
- @Field(() => Boolean, {description: `If true, this step is executed when the agent starts`})
8646
- StartingStep: boolean;
9131
+ @Field({description: `How the agent connected: OnDemand, Scheduled, Invite (calendar), NativeInvite (platform UI), InboundRoute (call/invite to the agent's identity), or InMeetingCommand (chat command).`})
9132
+ @MaxLength(30)
9133
+ JoinMethod: string;
8647
9134
 
8648
- @Field(() => Int, {nullable: true})
8649
- TimeoutSeconds?: number;
9135
+ @Field({description: `Turn-taking mode for this bridged session: Passive (speak only when addressed — default), Active (proactive in silence windows), or Hybrid (passive voice + post-to-chat hand-raise).`})
9136
+ @MaxLength(20)
9137
+ TurnMode: string;
8650
9138
 
8651
- @Field(() => Int)
8652
- RetryCount: number;
9139
+ @Field({nullable: true, description: `The platform's identifier for the connection (meeting id / call SID), set once connecting.`})
9140
+ @MaxLength(500)
9141
+ ExternalConnectionID?: string;
8653
9142
 
8654
- @Field()
8655
- @MaxLength(20)
8656
- OnErrorBehavior: string;
9143
+ @Field({nullable: true, description: `The endpoint address: a meeting join URL (meetings) or a phone number (telephony).`})
9144
+ @MaxLength(2000)
9145
+ Address?: string;
8657
9146
 
8658
- @Field({nullable: true})
8659
- @MaxLength(36)
8660
- ActionID?: string;
9147
+ @Field({nullable: true, description: `The agent bot's own participant id within the meeting/call once admitted.`})
9148
+ @MaxLength(500)
9149
+ BotParticipantID?: string;
8661
9150
 
8662
- @Field({nullable: true})
8663
- @MaxLength(36)
8664
- SubAgentID?: string;
9151
+ @Field({description: `Bridge connection lifecycle: Pending, Scheduled, Connecting, Connected, Disconnecting, Disconnected, or Failed.`})
9152
+ @MaxLength(20)
9153
+ Status: string;
8665
9154
 
8666
- @Field({nullable: true})
8667
- @MaxLength(36)
8668
- PromptID?: string;
9155
+ @Field({nullable: true, description: `For scheduled/invite joins: when the bridge should connect. NULL for immediate (on-demand/inbound).`})
9156
+ ScheduledStartTime?: Date;
8669
9157
 
8670
- @Field({nullable: true, description: `JSON configuration for mapping action output parameters to payload paths. Example: {"outputParam1": "payload.customer.status", "*": "payload.lastResult"}`})
8671
- ActionOutputMapping?: string;
9158
+ @Field({nullable: true, description: `When the bridge became Connected (media flowing). NULL until connected.`})
9159
+ ConnectedAt?: Date;
8672
9160
 
8673
- @Field(() => Int)
8674
- PositionX: number;
9161
+ @Field({nullable: true, description: `When the bridge disconnected. NULL while still connected.`})
9162
+ DisconnectedAt?: Date;
8675
9163
 
8676
- @Field(() => Int)
8677
- PositionY: number;
9164
+ @Field({nullable: true, description: `Why the bridge closed: Explicit, HostEnded (the meeting/call ended), Janitor (orphan sweep), Error, or Shutdown. NULL while active.`})
9165
+ @MaxLength(20)
9166
+ CloseReason?: string;
8678
9167
 
8679
- @Field(() => Int)
8680
- Width: number;
9168
+ @Field({nullable: true, description: `Identifier of the server node currently hosting this bridge's bot connection (hostname:pid:bootId). Used for affinity and janitor orphan reconciliation, mirroring AIAgentSession.`})
9169
+ @MaxLength(200)
9170
+ HostInstanceID?: string;
8681
9171
 
8682
- @Field(() => Int)
8683
- Height: number;
9172
+ @Field({nullable: true, description: `Per-session bridge configuration/state JSON (validated against the provider ConfigSchema).`})
9173
+ Config?: string;
8684
9174
 
8685
9175
  @Field()
8686
9176
  _mj__CreatedAt: Date;
@@ -8688,111 +9178,67 @@ export class MJAIAgentStep_ {
8688
9178
  @Field()
8689
9179
  _mj__UpdatedAt: Date;
8690
9180
 
8691
- @Field({description: `Controls whether this step is executed. Active=normal execution, Pending=skip but may activate later, Disabled=never execute`})
8692
- @MaxLength(20)
8693
- Status: string;
8694
-
8695
- @Field({nullable: true, description: `JSON configuration for mapping static values or payload paths to action input parameters. Example: {"param1": "staticValue", "param2": "payload.dynamicValue"}`})
8696
- ActionInputMapping?: string;
8697
-
8698
- @Field({nullable: true, description: `Specifies what type of operation executes in the loop body. Values: Action, Sub-Agent, Prompt. Only used when StepType is ForEach or While.`})
8699
- @MaxLength(50)
8700
- LoopBodyType?: string;
8701
-
8702
- @Field({nullable: true, description: `JSON configuration object for step-specific settings. For loop steps: { type: "ForEach"|"While", collectionPath?, itemVariable?, indexVariable?, maxIterations?, continueOnError?, condition? }. For other step types: reserved for future use.`})
8703
- Configuration?: string;
8704
-
8705
- @Field({nullable: true})
8706
- @MaxLength(255)
8707
- Agent?: string;
8708
-
8709
- @Field({nullable: true})
8710
- @MaxLength(425)
8711
- Action?: string;
8712
-
8713
- @Field({nullable: true})
8714
- @MaxLength(255)
8715
- SubAgent?: string;
8716
-
8717
- @Field({nullable: true})
8718
- @MaxLength(255)
8719
- Prompt?: string;
9181
+ @Field()
9182
+ @MaxLength(100)
9183
+ Provider: string;
8720
9184
 
8721
- @Field(() => [MJAIAgentStepPath_])
8722
- MJAIAgentStepPaths_OriginStepIDArray: MJAIAgentStepPath_[]; // Link to MJAIAgentStepPaths
8723
-
8724
- @Field(() => [MJAIAgentStepPath_])
8725
- MJAIAgentStepPaths_DestinationStepIDArray: MJAIAgentStepPath_[]; // Link to MJAIAgentStepPaths
9185
+ @Field(() => [MJAIAgentSessionBridgeParticipant_])
9186
+ MJAIAgentSessionBridgeParticipants_SessionBridgeIDArray: MJAIAgentSessionBridgeParticipant_[]; // Link to MJAIAgentSessionBridgeParticipants
8726
9187
 
8727
9188
  }
8728
9189
 
8729
9190
  //****************************************************************************
8730
- // INPUT TYPE for MJ: AI Agent Steps
9191
+ // INPUT TYPE for MJ: AI Agent Session Bridges
8731
9192
  //****************************************************************************
8732
9193
  @InputType()
8733
- export class CreateMJAIAgentStepInput {
9194
+ export class CreateMJAIAgentSessionBridgeInput {
8734
9195
  @Field({ nullable: true })
8735
9196
  ID?: string;
8736
9197
 
8737
9198
  @Field({ nullable: true })
8738
- AgentID?: string;
9199
+ AgentSessionID?: string;
8739
9200
 
8740
9201
  @Field({ nullable: true })
8741
- Name?: string;
9202
+ ProviderID?: string;
8742
9203
 
8743
9204
  @Field({ nullable: true })
8744
- Description: string | null;
9205
+ Direction?: string;
8745
9206
 
8746
9207
  @Field({ nullable: true })
8747
- StepType?: string;
8748
-
8749
- @Field(() => Boolean, { nullable: true })
8750
- StartingStep?: boolean;
8751
-
8752
- @Field(() => Int, { nullable: true })
8753
- TimeoutSeconds?: number | null;
8754
-
8755
- @Field(() => Int, { nullable: true })
8756
- RetryCount?: number;
9208
+ JoinMethod?: string;
8757
9209
 
8758
9210
  @Field({ nullable: true })
8759
- OnErrorBehavior?: string;
9211
+ TurnMode?: string;
8760
9212
 
8761
9213
  @Field({ nullable: true })
8762
- ActionID: string | null;
9214
+ ExternalConnectionID: string | null;
8763
9215
 
8764
9216
  @Field({ nullable: true })
8765
- SubAgentID: string | null;
9217
+ Address: string | null;
8766
9218
 
8767
9219
  @Field({ nullable: true })
8768
- PromptID: string | null;
9220
+ BotParticipantID: string | null;
8769
9221
 
8770
9222
  @Field({ nullable: true })
8771
- ActionOutputMapping: string | null;
8772
-
8773
- @Field(() => Int, { nullable: true })
8774
- PositionX?: number;
8775
-
8776
- @Field(() => Int, { nullable: true })
8777
- PositionY?: number;
9223
+ Status?: string;
8778
9224
 
8779
- @Field(() => Int, { nullable: true })
8780
- Width?: number;
9225
+ @Field({ nullable: true })
9226
+ ScheduledStartTime: Date | null;
8781
9227
 
8782
- @Field(() => Int, { nullable: true })
8783
- Height?: number;
9228
+ @Field({ nullable: true })
9229
+ ConnectedAt: Date | null;
8784
9230
 
8785
9231
  @Field({ nullable: true })
8786
- Status?: string;
9232
+ DisconnectedAt: Date | null;
8787
9233
 
8788
9234
  @Field({ nullable: true })
8789
- ActionInputMapping: string | null;
9235
+ CloseReason: string | null;
8790
9236
 
8791
9237
  @Field({ nullable: true })
8792
- LoopBodyType: string | null;
9238
+ HostInstanceID: string | null;
8793
9239
 
8794
9240
  @Field({ nullable: true })
8795
- Configuration: string | null;
9241
+ Config: string | null;
8796
9242
 
8797
9243
  @Field(() => RestoreContextInput, { nullable: true })
8798
9244
  RestoreContext___?: RestoreContextInput;
@@ -8800,72 +9246,57 @@ export class CreateMJAIAgentStepInput {
8800
9246
 
8801
9247
 
8802
9248
  //****************************************************************************
8803
- // INPUT TYPE for MJ: AI Agent Steps
9249
+ // INPUT TYPE for MJ: AI Agent Session Bridges
8804
9250
  //****************************************************************************
8805
9251
  @InputType()
8806
- export class UpdateMJAIAgentStepInput {
9252
+ export class UpdateMJAIAgentSessionBridgeInput {
8807
9253
  @Field()
8808
9254
  ID: string;
8809
9255
 
8810
9256
  @Field({ nullable: true })
8811
- AgentID?: string;
9257
+ AgentSessionID?: string;
8812
9258
 
8813
9259
  @Field({ nullable: true })
8814
- Name?: string;
9260
+ ProviderID?: string;
8815
9261
 
8816
9262
  @Field({ nullable: true })
8817
- Description?: string | null;
9263
+ Direction?: string;
8818
9264
 
8819
9265
  @Field({ nullable: true })
8820
- StepType?: string;
8821
-
8822
- @Field(() => Boolean, { nullable: true })
8823
- StartingStep?: boolean;
8824
-
8825
- @Field(() => Int, { nullable: true })
8826
- TimeoutSeconds?: number | null;
8827
-
8828
- @Field(() => Int, { nullable: true })
8829
- RetryCount?: number;
9266
+ JoinMethod?: string;
8830
9267
 
8831
9268
  @Field({ nullable: true })
8832
- OnErrorBehavior?: string;
9269
+ TurnMode?: string;
8833
9270
 
8834
9271
  @Field({ nullable: true })
8835
- ActionID?: string | null;
9272
+ ExternalConnectionID?: string | null;
8836
9273
 
8837
9274
  @Field({ nullable: true })
8838
- SubAgentID?: string | null;
9275
+ Address?: string | null;
8839
9276
 
8840
9277
  @Field({ nullable: true })
8841
- PromptID?: string | null;
9278
+ BotParticipantID?: string | null;
8842
9279
 
8843
9280
  @Field({ nullable: true })
8844
- ActionOutputMapping?: string | null;
8845
-
8846
- @Field(() => Int, { nullable: true })
8847
- PositionX?: number;
8848
-
8849
- @Field(() => Int, { nullable: true })
8850
- PositionY?: number;
9281
+ Status?: string;
8851
9282
 
8852
- @Field(() => Int, { nullable: true })
8853
- Width?: number;
9283
+ @Field({ nullable: true })
9284
+ ScheduledStartTime?: Date | null;
8854
9285
 
8855
- @Field(() => Int, { nullable: true })
8856
- Height?: number;
9286
+ @Field({ nullable: true })
9287
+ ConnectedAt?: Date | null;
8857
9288
 
8858
9289
  @Field({ nullable: true })
8859
- Status?: string;
9290
+ DisconnectedAt?: Date | null;
8860
9291
 
8861
9292
  @Field({ nullable: true })
8862
- ActionInputMapping?: string | null;
9293
+ CloseReason?: string | null;
8863
9294
 
8864
9295
  @Field({ nullable: true })
8865
- LoopBodyType?: string | null;
9296
+ HostInstanceID?: string | null;
8866
9297
 
8867
9298
  @Field({ nullable: true })
8868
- Configuration?: string | null;
9299
+ Config?: string | null;
8869
9300
 
8870
9301
  @Field(() => [KeyValuePairInput], { nullable: true })
8871
9302
  OldValues___?: KeyValuePairInput[];
@@ -8875,12 +9306,12 @@ export class UpdateMJAIAgentStepInput {
8875
9306
  }
8876
9307
 
8877
9308
  //****************************************************************************
8878
- // RESOLVER for MJ: AI Agent Steps
9309
+ // RESOLVER for MJ: AI Agent Session Bridges
8879
9310
  //****************************************************************************
8880
9311
  @ObjectType()
8881
- export class RunMJAIAgentStepViewResult {
8882
- @Field(() => [MJAIAgentStep_])
8883
- Results: MJAIAgentStep_[];
9312
+ export class RunMJAIAgentSessionBridgeViewResult {
9313
+ @Field(() => [MJAIAgentSessionBridge_])
9314
+ Results: MJAIAgentSessionBridge_[];
8884
9315
 
8885
9316
  @Field(() => String, {nullable: true})
8886
9317
  UserViewRunID?: string;
@@ -8901,199 +9332,149 @@ export class RunMJAIAgentStepViewResult {
8901
9332
  Success: boolean;
8902
9333
  }
8903
9334
 
8904
- @Resolver(MJAIAgentStep_)
8905
- export class MJAIAgentStepResolver extends ResolverBase {
8906
- @Query(() => RunMJAIAgentStepViewResult)
8907
- async RunMJAIAgentStepViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9335
+ @Resolver(MJAIAgentSessionBridge_)
9336
+ export class MJAIAgentSessionBridgeResolver extends ResolverBase {
9337
+ @Query(() => RunMJAIAgentSessionBridgeViewResult)
9338
+ async RunMJAIAgentSessionBridgeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8908
9339
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8909
9340
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
8910
9341
  }
8911
9342
 
8912
- @Query(() => RunMJAIAgentStepViewResult)
8913
- async RunMJAIAgentStepViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9343
+ @Query(() => RunMJAIAgentSessionBridgeViewResult)
9344
+ async RunMJAIAgentSessionBridgeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8914
9345
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8915
9346
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
8916
9347
  }
8917
9348
 
8918
- @Query(() => RunMJAIAgentStepViewResult)
8919
- async RunMJAIAgentStepDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9349
+ @Query(() => RunMJAIAgentSessionBridgeViewResult)
9350
+ async RunMJAIAgentSessionBridgeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8920
9351
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8921
- input.EntityName = 'MJ: AI Agent Steps';
9352
+ input.EntityName = 'MJ: AI Agent Session Bridges';
8922
9353
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
8923
9354
  }
8924
- @Query(() => MJAIAgentStep_, { nullable: true })
8925
- async MJAIAgentStep(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentStep_ | null> {
8926
- this.CheckUserReadPermissions('MJ: AI Agent Steps', userPayload);
9355
+ @Query(() => MJAIAgentSessionBridge_, { nullable: true })
9356
+ async MJAIAgentSessionBridge(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentSessionBridge_ | null> {
9357
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridges', userPayload);
8927
9358
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8928
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSteps')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Steps', userPayload, EntityPermissionType.Read, 'AND');
9359
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridges')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridges', userPayload, EntityPermissionType.Read, 'AND');
8929
9360
  const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
8930
- const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Steps', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
9361
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Session Bridges', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
8931
9362
  return result;
8932
9363
  }
8933
9364
 
8934
- @FieldResolver(() => [MJAIAgentStepPath_])
8935
- async MJAIAgentStepPaths_OriginStepIDArray(@Root() mjaiagentstep_: MJAIAgentStep_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
8936
- this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
8937
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8938
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('OriginStepID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
8939
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagentstep_.ID], undefined, this.GetUserFromPayload(userPayload));
8940
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows, this.GetUserFromPayload(userPayload));
8941
- return result;
8942
- }
8943
-
8944
- @FieldResolver(() => [MJAIAgentStepPath_])
8945
- async MJAIAgentStepPaths_DestinationStepIDArray(@Root() mjaiagentstep_: MJAIAgentStep_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
8946
- this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
9365
+ @FieldResolver(() => [MJAIAgentSessionBridgeParticipant_])
9366
+ async MJAIAgentSessionBridgeParticipants_SessionBridgeIDArray(@Root() mjaiagentsessionbridge_: MJAIAgentSessionBridge_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9367
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridge Participants', userPayload);
8947
9368
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8948
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('DestinationStepID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
8949
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagentstep_.ID], undefined, this.GetUserFromPayload(userPayload));
8950
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows, this.GetUserFromPayload(userPayload));
9369
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridgeParticipants')} WHERE ${provider.QuoteIdentifier('SessionBridgeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridge Participants', userPayload, EntityPermissionType.Read, 'AND');
9370
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsessionbridge_.ID], undefined, this.GetUserFromPayload(userPayload));
9371
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Bridge Participants', rows, this.GetUserFromPayload(userPayload));
8951
9372
  return result;
8952
9373
  }
8953
9374
 
8954
- @Mutation(() => MJAIAgentStep_)
8955
- async CreateMJAIAgentStep(
8956
- @Arg('input', () => CreateMJAIAgentStepInput) input: CreateMJAIAgentStepInput,
9375
+ @Mutation(() => MJAIAgentSessionBridge_)
9376
+ async CreateMJAIAgentSessionBridge(
9377
+ @Arg('input', () => CreateMJAIAgentSessionBridgeInput) input: CreateMJAIAgentSessionBridgeInput,
8957
9378
  @Ctx() { providers, userPayload }: AppContext,
8958
9379
  @PubSub() pubSub: PubSubEngine
8959
9380
  ) {
8960
9381
  const provider = GetReadWriteProvider(providers);
8961
- return this.CreateRecord('MJ: AI Agent Steps', input, provider, userPayload, pubSub)
9382
+ return this.CreateRecord('MJ: AI Agent Session Bridges', input, provider, userPayload, pubSub)
8962
9383
  }
8963
9384
 
8964
- @Mutation(() => MJAIAgentStep_)
8965
- async UpdateMJAIAgentStep(
8966
- @Arg('input', () => UpdateMJAIAgentStepInput) input: UpdateMJAIAgentStepInput,
9385
+ @Mutation(() => MJAIAgentSessionBridge_)
9386
+ async UpdateMJAIAgentSessionBridge(
9387
+ @Arg('input', () => UpdateMJAIAgentSessionBridgeInput) input: UpdateMJAIAgentSessionBridgeInput,
8967
9388
  @Ctx() { providers, userPayload }: AppContext,
8968
9389
  @PubSub() pubSub: PubSubEngine
8969
9390
  ) {
8970
9391
  const provider = GetReadWriteProvider(providers);
8971
- return this.UpdateRecord('MJ: AI Agent Steps', input, provider, userPayload, pubSub);
9392
+ return this.UpdateRecord('MJ: AI Agent Session Bridges', input, provider, userPayload, pubSub);
8972
9393
  }
8973
9394
 
8974
- @Mutation(() => MJAIAgentStep_)
8975
- async DeleteMJAIAgentStep(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9395
+ @Mutation(() => MJAIAgentSessionBridge_)
9396
+ async DeleteMJAIAgentSessionBridge(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8976
9397
  const provider = GetReadWriteProvider(providers);
8977
9398
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
8978
- return this.DeleteRecord('MJ: AI Agent Steps', key, options, provider, userPayload, pubSub);
9399
+ return this.DeleteRecord('MJ: AI Agent Session Bridges', key, options, provider, userPayload, pubSub);
8979
9400
  }
8980
9401
 
8981
9402
  }
8982
9403
 
8983
9404
  //****************************************************************************
8984
- // ENTITY CLASS for MJ: AI Agent Types
9405
+ // ENTITY CLASS for MJ: AI Agent Session Channels
8985
9406
  //****************************************************************************
8986
- @ObjectType({ description: `Defines types of AI agents with their system prompts and behavioral characteristics. Each agent type represents a category of agents that share common system-level instructions and capabilities.` })
8987
- export class MJAIAgentType_ {
8988
- @Field({description: `Unique identifier for the agent type`})
9407
+ @ObjectType()
9408
+ export class MJAIAgentSessionChannel_ {
9409
+ @Field()
8989
9410
  @MaxLength(36)
8990
9411
  ID: string;
8991
9412
 
8992
- @Field({description: `Unique name of the agent type (e.g., "Base", "CustomerSupport", "DataAnalysis"). Used for programmatic identification and factory instantiation.`})
8993
- @MaxLength(100)
8994
- Name: string;
8995
-
8996
- @Field({nullable: true, description: `Detailed description of the agent type, its purpose, and typical use cases`})
8997
- Description?: string;
8998
-
8999
- @Field({nullable: true, description: `Reference to the AI Prompt that contains the system-level instructions for all agents of this type. This prompt will be blended with individual agent prompts.`})
9000
- @MaxLength(36)
9001
- SystemPromptID?: string;
9002
-
9003
- @Field(() => Boolean, {description: `Indicates whether this agent type is available for use. Inactive types cannot be assigned to new agents.`})
9004
- IsActive: boolean;
9005
-
9006
9413
  @Field()
9007
- _mj__CreatedAt: Date;
9414
+ @MaxLength(36)
9415
+ AgentSessionID: string;
9008
9416
 
9009
9417
  @Field()
9010
- _mj__UpdatedAt: Date;
9011
-
9012
- @Field({nullable: true, description: `The placeholder name used in the system prompt template where the agent prompt result should be injected. For example, if the system prompt contains "{{ agentPrompt }}", this field should contain "agentPrompt". This enables proper hierarchical prompt execution where the agent type's system prompt acts as the parent and the agent's specific prompt acts as the child.`})
9013
- @MaxLength(255)
9014
- AgentPromptPlaceholder?: string;
9015
-
9016
- @Field({nullable: true, description: `The class name used by the MemberJunction class factory to instantiate the specific agent type implementation. For example, "LoopAgentType" for a looping agent pattern. If not specified, defaults to using the agent type Name for the DriverClass lookup key.`})
9017
- @MaxLength(255)
9018
- DriverClass?: string;
9418
+ @MaxLength(36)
9419
+ ChannelID: string;
9019
9420
 
9020
- @Field({nullable: true, description: `Optional Angular component key name for a subclass of BaseFormSectionComponent that provides a custom form section for this agent type. When specified, this component will be dynamically loaded and displayed as the first expandable section in the AI Agent form. This allows agent types to have specialized UI elements. The class must be registered with the MemberJunction class factory via @RegisterClass`})
9021
- @MaxLength(500)
9022
- UIFormSectionKey?: string;
9421
+ @Field({description: `Connection status of this channel instance within the session.`})
9422
+ @MaxLength(20)
9423
+ Status: string;
9023
9424
 
9024
- @Field({nullable: true, description: `Optional Angular component key name for a subclass of BaseFormComponent that will completely overrides the default AI Agent form for this agent type. When specified, this component will be used instead of the standard AI Agent form, allowing for completely custom form implementations. The class must be registered with the MemberJunction class factory via @RegisterClass. If both UIFormClass and UIFormSectionClass are specified, UIFormClass takes precedence.`})
9425
+ @Field({nullable: true, description: `Socket URL handed to the client for this channel. NULL for PubSub channels, which ride the shared session subscription rather than a dedicated socket.`})
9025
9426
  @MaxLength(500)
9026
- UIFormKey?: string;
9427
+ SocketUrl?: string;
9027
9428
 
9028
- @Field(() => Boolean, {description: `Determines whether the custom form section (specified by UIFormSectionClass) should be expanded by default when the AI Agent form loads. True means the section starts expanded, False means it starts collapsed. Only applies when UIFormSectionClass is specified. Defaults to 1 (expanded).`})
9029
- UIFormSectionExpandedByDefault: boolean;
9429
+ @Field({nullable: true, description: `JSON of per-instance channel configuration/state, validated against the channel definitions ConfigSchema.`})
9430
+ Config?: string;
9030
9431
 
9031
- @Field({nullable: true, description: `JSON Schema defining the available prompt parameters for this agent type. Includes property definitions with types, defaults, and descriptions. Used by agents of this type to customize which prompt sections are included in the system prompt. The schema follows JSON Schema draft-07 format.`})
9032
- PromptParamsSchema?: string;
9432
+ @Field({description: `Timestamp of the last activity (or heartbeat) on this channel instance.`})
9433
+ LastActiveAt: Date;
9033
9434
 
9034
- @Field({nullable: true, description: `JSON-serialized AgentRequestAssignmentStrategy defining the default assignment strategy for all agents of this type. Overridden by per-invocation or category-level strategies in the resolution chain.`})
9035
- AssignmentStrategy?: string;
9435
+ @Field({nullable: true, description: `When this channel instance disconnected. NULL while still connected.`})
9436
+ DisconnectedAt?: Date;
9036
9437
 
9037
- @Field({nullable: true, description: `Default file storage account for agents of this type. Lowest priority in the resolution chain (Type → Category tree → Agent → Runtime override). When set, all agents of this type use this storage account unless overridden at a more specific level. FK to FileStorageAccount.`})
9038
- @MaxLength(36)
9039
- DefaultStorageAccountID?: string;
9438
+ @Field()
9439
+ _mj__CreatedAt: Date;
9040
9440
 
9041
- @Field({nullable: true})
9042
- @MaxLength(255)
9043
- SystemPrompt?: string;
9441
+ @Field()
9442
+ _mj__UpdatedAt: Date;
9044
9443
 
9045
- @Field({nullable: true})
9046
- @MaxLength(200)
9047
- DefaultStorageAccount?: string;
9444
+ @Field()
9445
+ @MaxLength(100)
9446
+ Channel: string;
9048
9447
 
9049
- @Field(() => [MJAIAgent_])
9050
- MJAIAgents_TypeIDArray: MJAIAgent_[]; // Link to MJAIAgents
9051
-
9052
9448
  }
9053
9449
 
9054
9450
  //****************************************************************************
9055
- // INPUT TYPE for MJ: AI Agent Types
9451
+ // INPUT TYPE for MJ: AI Agent Session Channels
9056
9452
  //****************************************************************************
9057
9453
  @InputType()
9058
- export class CreateMJAIAgentTypeInput {
9454
+ export class CreateMJAIAgentSessionChannelInput {
9059
9455
  @Field({ nullable: true })
9060
9456
  ID?: string;
9061
9457
 
9062
9458
  @Field({ nullable: true })
9063
- Name?: string;
9064
-
9065
- @Field({ nullable: true })
9066
- Description: string | null;
9067
-
9068
- @Field({ nullable: true })
9069
- SystemPromptID: string | null;
9070
-
9071
- @Field(() => Boolean, { nullable: true })
9072
- IsActive?: boolean;
9073
-
9074
- @Field({ nullable: true })
9075
- AgentPromptPlaceholder: string | null;
9459
+ AgentSessionID?: string;
9076
9460
 
9077
9461
  @Field({ nullable: true })
9078
- DriverClass: string | null;
9462
+ ChannelID?: string;
9079
9463
 
9080
9464
  @Field({ nullable: true })
9081
- UIFormSectionKey: string | null;
9465
+ Status?: string;
9082
9466
 
9083
9467
  @Field({ nullable: true })
9084
- UIFormKey: string | null;
9085
-
9086
- @Field(() => Boolean, { nullable: true })
9087
- UIFormSectionExpandedByDefault?: boolean;
9468
+ SocketUrl: string | null;
9088
9469
 
9089
9470
  @Field({ nullable: true })
9090
- PromptParamsSchema: string | null;
9471
+ Config: string | null;
9091
9472
 
9092
9473
  @Field({ nullable: true })
9093
- AssignmentStrategy: string | null;
9474
+ LastActiveAt?: Date;
9094
9475
 
9095
9476
  @Field({ nullable: true })
9096
- DefaultStorageAccountID: string | null;
9477
+ DisconnectedAt: Date | null;
9097
9478
 
9098
9479
  @Field(() => RestoreContextInput, { nullable: true })
9099
9480
  RestoreContext___?: RestoreContextInput;
@@ -9101,48 +9482,33 @@ export class CreateMJAIAgentTypeInput {
9101
9482
 
9102
9483
 
9103
9484
  //****************************************************************************
9104
- // INPUT TYPE for MJ: AI Agent Types
9485
+ // INPUT TYPE for MJ: AI Agent Session Channels
9105
9486
  //****************************************************************************
9106
9487
  @InputType()
9107
- export class UpdateMJAIAgentTypeInput {
9488
+ export class UpdateMJAIAgentSessionChannelInput {
9108
9489
  @Field()
9109
9490
  ID: string;
9110
9491
 
9111
9492
  @Field({ nullable: true })
9112
- Name?: string;
9113
-
9114
- @Field({ nullable: true })
9115
- Description?: string | null;
9116
-
9117
- @Field({ nullable: true })
9118
- SystemPromptID?: string | null;
9119
-
9120
- @Field(() => Boolean, { nullable: true })
9121
- IsActive?: boolean;
9122
-
9123
- @Field({ nullable: true })
9124
- AgentPromptPlaceholder?: string | null;
9493
+ AgentSessionID?: string;
9125
9494
 
9126
9495
  @Field({ nullable: true })
9127
- DriverClass?: string | null;
9496
+ ChannelID?: string;
9128
9497
 
9129
9498
  @Field({ nullable: true })
9130
- UIFormSectionKey?: string | null;
9499
+ Status?: string;
9131
9500
 
9132
9501
  @Field({ nullable: true })
9133
- UIFormKey?: string | null;
9134
-
9135
- @Field(() => Boolean, { nullable: true })
9136
- UIFormSectionExpandedByDefault?: boolean;
9502
+ SocketUrl?: string | null;
9137
9503
 
9138
9504
  @Field({ nullable: true })
9139
- PromptParamsSchema?: string | null;
9505
+ Config?: string | null;
9140
9506
 
9141
9507
  @Field({ nullable: true })
9142
- AssignmentStrategy?: string | null;
9508
+ LastActiveAt?: Date;
9143
9509
 
9144
9510
  @Field({ nullable: true })
9145
- DefaultStorageAccountID?: string | null;
9511
+ DisconnectedAt?: Date | null;
9146
9512
 
9147
9513
  @Field(() => [KeyValuePairInput], { nullable: true })
9148
9514
  OldValues___?: KeyValuePairInput[];
@@ -9152,12 +9518,12 @@ export class UpdateMJAIAgentTypeInput {
9152
9518
  }
9153
9519
 
9154
9520
  //****************************************************************************
9155
- // RESOLVER for MJ: AI Agent Types
9521
+ // RESOLVER for MJ: AI Agent Session Channels
9156
9522
  //****************************************************************************
9157
9523
  @ObjectType()
9158
- export class RunMJAIAgentTypeViewResult {
9159
- @Field(() => [MJAIAgentType_])
9160
- Results: MJAIAgentType_[];
9524
+ export class RunMJAIAgentSessionChannelViewResult {
9525
+ @Field(() => [MJAIAgentSessionChannel_])
9526
+ Results: MJAIAgentSessionChannel_[];
9161
9527
 
9162
9528
  @Field(() => String, {nullable: true})
9163
9529
  UserViewRunID?: string;
@@ -9178,106 +9544,1261 @@ export class RunMJAIAgentTypeViewResult {
9178
9544
  Success: boolean;
9179
9545
  }
9180
9546
 
9181
- @Resolver(MJAIAgentType_)
9182
- export class MJAIAgentTypeResolver extends ResolverBase {
9183
- @Query(() => RunMJAIAgentTypeViewResult)
9184
- async RunMJAIAgentTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9547
+ @Resolver(MJAIAgentSessionChannel_)
9548
+ export class MJAIAgentSessionChannelResolver extends ResolverBase {
9549
+ @Query(() => RunMJAIAgentSessionChannelViewResult)
9550
+ async RunMJAIAgentSessionChannelViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9185
9551
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9186
9552
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
9187
9553
  }
9188
9554
 
9189
- @Query(() => RunMJAIAgentTypeViewResult)
9190
- async RunMJAIAgentTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9555
+ @Query(() => RunMJAIAgentSessionChannelViewResult)
9556
+ async RunMJAIAgentSessionChannelViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9191
9557
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9192
9558
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
9193
9559
  }
9194
9560
 
9195
- @Query(() => RunMJAIAgentTypeViewResult)
9196
- async RunMJAIAgentTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9561
+ @Query(() => RunMJAIAgentSessionChannelViewResult)
9562
+ async RunMJAIAgentSessionChannelDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9197
9563
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9198
- input.EntityName = 'MJ: AI Agent Types';
9564
+ input.EntityName = 'MJ: AI Agent Session Channels';
9199
9565
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
9200
9566
  }
9201
- @Query(() => MJAIAgentType_, { nullable: true })
9202
- async MJAIAgentType(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentType_ | null> {
9203
- this.CheckUserReadPermissions('MJ: AI Agent Types', userPayload);
9567
+ @Query(() => MJAIAgentSessionChannel_, { nullable: true })
9568
+ async MJAIAgentSessionChannel(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentSessionChannel_ | null> {
9569
+ this.CheckUserReadPermissions('MJ: AI Agent Session Channels', userPayload);
9204
9570
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9205
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentTypes')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Types', userPayload, EntityPermissionType.Read, 'AND');
9571
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionChannels')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Channels', userPayload, EntityPermissionType.Read, 'AND');
9206
9572
  const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
9207
- const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Types', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
9573
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Session Channels', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
9208
9574
  return result;
9209
9575
  }
9210
9576
 
9211
- @FieldResolver(() => [MJAIAgent_])
9212
- async MJAIAgents_TypeIDArray(@Root() mjaiagenttype_: MJAIAgentType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9213
- this.CheckUserReadPermissions('MJ: AI Agents', userPayload);
9214
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9215
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgents')} WHERE ${provider.QuoteIdentifier('TypeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agents', userPayload, EntityPermissionType.Read, 'AND');
9216
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagenttype_.ID], undefined, this.GetUserFromPayload(userPayload));
9217
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agents', rows, this.GetUserFromPayload(userPayload));
9218
- return result;
9219
- }
9220
-
9221
- @Mutation(() => MJAIAgentType_)
9222
- async CreateMJAIAgentType(
9223
- @Arg('input', () => CreateMJAIAgentTypeInput) input: CreateMJAIAgentTypeInput,
9577
+ @Mutation(() => MJAIAgentSessionChannel_)
9578
+ async CreateMJAIAgentSessionChannel(
9579
+ @Arg('input', () => CreateMJAIAgentSessionChannelInput) input: CreateMJAIAgentSessionChannelInput,
9224
9580
  @Ctx() { providers, userPayload }: AppContext,
9225
9581
  @PubSub() pubSub: PubSubEngine
9226
9582
  ) {
9227
9583
  const provider = GetReadWriteProvider(providers);
9228
- return this.CreateRecord('MJ: AI Agent Types', input, provider, userPayload, pubSub)
9584
+ return this.CreateRecord('MJ: AI Agent Session Channels', input, provider, userPayload, pubSub)
9229
9585
  }
9230
9586
 
9231
- @Mutation(() => MJAIAgentType_)
9232
- async UpdateMJAIAgentType(
9233
- @Arg('input', () => UpdateMJAIAgentTypeInput) input: UpdateMJAIAgentTypeInput,
9587
+ @Mutation(() => MJAIAgentSessionChannel_)
9588
+ async UpdateMJAIAgentSessionChannel(
9589
+ @Arg('input', () => UpdateMJAIAgentSessionChannelInput) input: UpdateMJAIAgentSessionChannelInput,
9234
9590
  @Ctx() { providers, userPayload }: AppContext,
9235
9591
  @PubSub() pubSub: PubSubEngine
9236
9592
  ) {
9237
9593
  const provider = GetReadWriteProvider(providers);
9238
- return this.UpdateRecord('MJ: AI Agent Types', input, provider, userPayload, pubSub);
9594
+ return this.UpdateRecord('MJ: AI Agent Session Channels', input, provider, userPayload, pubSub);
9239
9595
  }
9240
9596
 
9241
- @Mutation(() => MJAIAgentType_)
9242
- async DeleteMJAIAgentType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9597
+ @Mutation(() => MJAIAgentSessionChannel_)
9598
+ async DeleteMJAIAgentSessionChannel(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9243
9599
  const provider = GetReadWriteProvider(providers);
9244
9600
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
9245
- return this.DeleteRecord('MJ: AI Agent Types', key, options, provider, userPayload, pubSub);
9601
+ return this.DeleteRecord('MJ: AI Agent Session Channels', key, options, provider, userPayload, pubSub);
9246
9602
  }
9247
9603
 
9248
9604
  }
9249
9605
 
9250
9606
  //****************************************************************************
9251
- // ENTITY CLASS for MJ: AI Agents
9607
+ // ENTITY CLASS for MJ: AI Agent Sessions
9252
9608
  //****************************************************************************
9253
- @ObjectType({ description: `Table to store information about AI agents.` })
9254
- export class MJAIAgent_ {
9255
- @Field({description: `The unique identifier for each AI agent. Serves as the primary key.`})
9609
+ @ObjectType()
9610
+ export class MJAIAgentSession_ {
9611
+ @Field()
9256
9612
  @MaxLength(36)
9257
9613
  ID: string;
9258
9614
 
9259
- @Field({nullable: true, description: `The name of the AI agent.`})
9260
- @MaxLength(255)
9261
- Name?: string;
9262
-
9263
- @Field({nullable: true, description: `A detailed description of the AI agent.`})
9264
- Description?: string;
9265
-
9266
- @Field({nullable: true, description: `URL to an image file or base64 data URI (e.g., data:image/png;base64,...) for the agent logo. Takes precedence over IconClass in UI display.`})
9267
- @MaxLength(255)
9268
- LogoURL?: string;
9269
-
9270
9615
  @Field()
9271
- _mj__CreatedAt: Date;
9616
+ @MaxLength(36)
9617
+ AgentID: string;
9272
9618
 
9273
9619
  @Field()
9274
- _mj__UpdatedAt: Date;
9275
-
9276
- @Field({nullable: true, description: `References the parent agent in the hierarchical structure. If NULL, this is a root (top-level) agent.`})
9277
9620
  @MaxLength(36)
9278
- ParentID?: string;
9621
+ UserID: string;
9279
9622
 
9280
- @Field(() => Boolean, {description: `When true, this agent can be exposed as an action for use by other agents. Only valid for root agents.`})
9623
+ @Field({description: `Lifecycle status of the session. Active = traffic flowing; Idle = connected but quiet beyond the idle threshold; Closed = terminal (ClosedAt set, channels disconnected).`})
9624
+ @MaxLength(20)
9625
+ Status: string;
9626
+
9627
+ @Field({nullable: true})
9628
+ @MaxLength(36)
9629
+ ConversationID?: string;
9630
+
9631
+ @Field({nullable: true})
9632
+ @MaxLength(36)
9633
+ LastSessionID?: string;
9634
+
9635
+ @Field({nullable: true, description: `Identifier of the server node currently hosting this sessions in-memory sockets (e.g. hostname:pid:bootId). Used for affinity and janitor orphan reconciliation.`})
9636
+ @MaxLength(200)
9637
+ HostInstanceID?: string;
9638
+
9639
+ @Field({nullable: true, description: `JSON block for free-form, low-traffic session-specific state and variables.`})
9640
+ Config?: string;
9641
+
9642
+ @Field({description: `Timestamp of the last activity on the session. Bubbled up from the most-recently-active channel; used by the heartbeat and staleness sweep.`})
9643
+ LastActiveAt: Date;
9644
+
9645
+ @Field({nullable: true, description: `When the session was closed (terminal). NULL while the session is Active or Idle.`})
9646
+ ClosedAt?: Date;
9647
+
9648
+ @Field({nullable: true, description: `Why the session was closed: Explicit (user hang-up / deliberate API close), Janitor (orphan or staleness sweep), Shutdown (graceful server shutdown), Error (session failure). NULL while the session is Active/Idle.`})
9649
+ @MaxLength(20)
9650
+ CloseReason?: string;
9651
+
9652
+ @Field()
9653
+ _mj__CreatedAt: Date;
9654
+
9655
+ @Field()
9656
+ _mj__UpdatedAt: Date;
9657
+
9658
+ @Field({nullable: true})
9659
+ @MaxLength(255)
9660
+ Agent?: string;
9661
+
9662
+ @Field()
9663
+ @MaxLength(100)
9664
+ User: string;
9665
+
9666
+ @Field({nullable: true})
9667
+ @MaxLength(255)
9668
+ Conversation?: string;
9669
+
9670
+ @Field({nullable: true})
9671
+ @MaxLength(36)
9672
+ RootLastSessionID?: string;
9673
+
9674
+ @Field(() => [MJAIAgentRun_])
9675
+ MJAIAgentRuns_AgentSessionIDArray: MJAIAgentRun_[]; // Link to MJAIAgentRuns
9676
+
9677
+ @Field(() => [MJAIAgentSessionChannel_])
9678
+ MJAIAgentSessionChannels_AgentSessionIDArray: MJAIAgentSessionChannel_[]; // Link to MJAIAgentSessionChannels
9679
+
9680
+ @Field(() => [MJConversationDetail_])
9681
+ MJConversationDetails_AgentSessionIDArray: MJConversationDetail_[]; // Link to MJConversationDetails
9682
+
9683
+ @Field(() => [MJAIAgentSession_])
9684
+ MJAIAgentSessions_LastSessionIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
9685
+
9686
+ @Field(() => [MJAIAgentSessionBridge_])
9687
+ MJAIAgentSessionBridges_AgentSessionIDArray: MJAIAgentSessionBridge_[]; // Link to MJAIAgentSessionBridges
9688
+
9689
+ }
9690
+
9691
+ //****************************************************************************
9692
+ // INPUT TYPE for MJ: AI Agent Sessions
9693
+ //****************************************************************************
9694
+ @InputType()
9695
+ export class CreateMJAIAgentSessionInput {
9696
+ @Field({ nullable: true })
9697
+ ID?: string;
9698
+
9699
+ @Field({ nullable: true })
9700
+ AgentID?: string;
9701
+
9702
+ @Field({ nullable: true })
9703
+ UserID?: string;
9704
+
9705
+ @Field({ nullable: true })
9706
+ Status?: string;
9707
+
9708
+ @Field({ nullable: true })
9709
+ ConversationID: string | null;
9710
+
9711
+ @Field({ nullable: true })
9712
+ LastSessionID: string | null;
9713
+
9714
+ @Field({ nullable: true })
9715
+ HostInstanceID: string | null;
9716
+
9717
+ @Field({ nullable: true })
9718
+ Config: string | null;
9719
+
9720
+ @Field({ nullable: true })
9721
+ LastActiveAt?: Date;
9722
+
9723
+ @Field({ nullable: true })
9724
+ ClosedAt: Date | null;
9725
+
9726
+ @Field({ nullable: true })
9727
+ CloseReason: string | null;
9728
+
9729
+ @Field(() => RestoreContextInput, { nullable: true })
9730
+ RestoreContext___?: RestoreContextInput;
9731
+ }
9732
+
9733
+
9734
+ //****************************************************************************
9735
+ // INPUT TYPE for MJ: AI Agent Sessions
9736
+ //****************************************************************************
9737
+ @InputType()
9738
+ export class UpdateMJAIAgentSessionInput {
9739
+ @Field()
9740
+ ID: string;
9741
+
9742
+ @Field({ nullable: true })
9743
+ AgentID?: string;
9744
+
9745
+ @Field({ nullable: true })
9746
+ UserID?: string;
9747
+
9748
+ @Field({ nullable: true })
9749
+ Status?: string;
9750
+
9751
+ @Field({ nullable: true })
9752
+ ConversationID?: string | null;
9753
+
9754
+ @Field({ nullable: true })
9755
+ LastSessionID?: string | null;
9756
+
9757
+ @Field({ nullable: true })
9758
+ HostInstanceID?: string | null;
9759
+
9760
+ @Field({ nullable: true })
9761
+ Config?: string | null;
9762
+
9763
+ @Field({ nullable: true })
9764
+ LastActiveAt?: Date;
9765
+
9766
+ @Field({ nullable: true })
9767
+ ClosedAt?: Date | null;
9768
+
9769
+ @Field({ nullable: true })
9770
+ CloseReason?: string | null;
9771
+
9772
+ @Field(() => [KeyValuePairInput], { nullable: true })
9773
+ OldValues___?: KeyValuePairInput[];
9774
+
9775
+ @Field(() => RestoreContextInput, { nullable: true })
9776
+ RestoreContext___?: RestoreContextInput;
9777
+ }
9778
+
9779
+ //****************************************************************************
9780
+ // RESOLVER for MJ: AI Agent Sessions
9781
+ //****************************************************************************
9782
+ @ObjectType()
9783
+ export class RunMJAIAgentSessionViewResult {
9784
+ @Field(() => [MJAIAgentSession_])
9785
+ Results: MJAIAgentSession_[];
9786
+
9787
+ @Field(() => String, {nullable: true})
9788
+ UserViewRunID?: string;
9789
+
9790
+ @Field(() => Int, {nullable: true})
9791
+ RowCount: number;
9792
+
9793
+ @Field(() => Int, {nullable: true})
9794
+ TotalRowCount: number;
9795
+
9796
+ @Field(() => Int, {nullable: true})
9797
+ ExecutionTime: number;
9798
+
9799
+ @Field({nullable: true})
9800
+ ErrorMessage?: string;
9801
+
9802
+ @Field(() => Boolean, {nullable: false})
9803
+ Success: boolean;
9804
+ }
9805
+
9806
+ @Resolver(MJAIAgentSession_)
9807
+ export class MJAIAgentSessionResolver extends ResolverBase {
9808
+ @Query(() => RunMJAIAgentSessionViewResult)
9809
+ async RunMJAIAgentSessionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9810
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9811
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
9812
+ }
9813
+
9814
+ @Query(() => RunMJAIAgentSessionViewResult)
9815
+ async RunMJAIAgentSessionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9816
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9817
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
9818
+ }
9819
+
9820
+ @Query(() => RunMJAIAgentSessionViewResult)
9821
+ async RunMJAIAgentSessionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9822
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9823
+ input.EntityName = 'MJ: AI Agent Sessions';
9824
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
9825
+ }
9826
+ @Query(() => MJAIAgentSession_, { nullable: true })
9827
+ async MJAIAgentSession(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentSession_ | null> {
9828
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
9829
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9830
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
9831
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
9832
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
9833
+ return result;
9834
+ }
9835
+
9836
+ @FieldResolver(() => [MJAIAgentRun_])
9837
+ async MJAIAgentRuns_AgentSessionIDArray(@Root() mjaiagentsession_: MJAIAgentSession_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9838
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
9839
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9840
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentRuns')} WHERE ${provider.QuoteIdentifier('AgentSessionID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
9841
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsession_.ID], undefined, this.GetUserFromPayload(userPayload));
9842
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows, this.GetUserFromPayload(userPayload));
9843
+ return result;
9844
+ }
9845
+
9846
+ @FieldResolver(() => [MJAIAgentSessionChannel_])
9847
+ async MJAIAgentSessionChannels_AgentSessionIDArray(@Root() mjaiagentsession_: MJAIAgentSession_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9848
+ this.CheckUserReadPermissions('MJ: AI Agent Session Channels', userPayload);
9849
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9850
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionChannels')} WHERE ${provider.QuoteIdentifier('AgentSessionID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Channels', userPayload, EntityPermissionType.Read, 'AND');
9851
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsession_.ID], undefined, this.GetUserFromPayload(userPayload));
9852
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Channels', rows, this.GetUserFromPayload(userPayload));
9853
+ return result;
9854
+ }
9855
+
9856
+ @FieldResolver(() => [MJConversationDetail_])
9857
+ async MJConversationDetails_AgentSessionIDArray(@Root() mjaiagentsession_: MJAIAgentSession_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9858
+ this.CheckUserReadPermissions('MJ: Conversation Details', userPayload);
9859
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9860
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationDetails')} WHERE ${provider.QuoteIdentifier('AgentSessionID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
9861
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsession_.ID], undefined, this.GetUserFromPayload(userPayload));
9862
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Details', rows, this.GetUserFromPayload(userPayload));
9863
+ return result;
9864
+ }
9865
+
9866
+ @FieldResolver(() => [MJAIAgentSession_])
9867
+ async MJAIAgentSessions_LastSessionIDArray(@Root() mjaiagentsession_: MJAIAgentSession_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9868
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
9869
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9870
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('LastSessionID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
9871
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsession_.ID], undefined, this.GetUserFromPayload(userPayload));
9872
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows, this.GetUserFromPayload(userPayload));
9873
+ return result;
9874
+ }
9875
+
9876
+ @FieldResolver(() => [MJAIAgentSessionBridge_])
9877
+ async MJAIAgentSessionBridges_AgentSessionIDArray(@Root() mjaiagentsession_: MJAIAgentSession_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9878
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridges', userPayload);
9879
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
9880
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridges')} WHERE ${provider.QuoteIdentifier('AgentSessionID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridges', userPayload, EntityPermissionType.Read, 'AND');
9881
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentsession_.ID], undefined, this.GetUserFromPayload(userPayload));
9882
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Bridges', rows, this.GetUserFromPayload(userPayload));
9883
+ return result;
9884
+ }
9885
+
9886
+ @Mutation(() => MJAIAgentSession_)
9887
+ async CreateMJAIAgentSession(
9888
+ @Arg('input', () => CreateMJAIAgentSessionInput) input: CreateMJAIAgentSessionInput,
9889
+ @Ctx() { providers, userPayload }: AppContext,
9890
+ @PubSub() pubSub: PubSubEngine
9891
+ ) {
9892
+ const provider = GetReadWriteProvider(providers);
9893
+ return this.CreateRecord('MJ: AI Agent Sessions', input, provider, userPayload, pubSub)
9894
+ }
9895
+
9896
+ @Mutation(() => MJAIAgentSession_)
9897
+ async UpdateMJAIAgentSession(
9898
+ @Arg('input', () => UpdateMJAIAgentSessionInput) input: UpdateMJAIAgentSessionInput,
9899
+ @Ctx() { providers, userPayload }: AppContext,
9900
+ @PubSub() pubSub: PubSubEngine
9901
+ ) {
9902
+ const provider = GetReadWriteProvider(providers);
9903
+ return this.UpdateRecord('MJ: AI Agent Sessions', input, provider, userPayload, pubSub);
9904
+ }
9905
+
9906
+ @Mutation(() => MJAIAgentSession_)
9907
+ async DeleteMJAIAgentSession(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9908
+ const provider = GetReadWriteProvider(providers);
9909
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
9910
+ return this.DeleteRecord('MJ: AI Agent Sessions', key, options, provider, userPayload, pubSub);
9911
+ }
9912
+
9913
+ }
9914
+
9915
+ //****************************************************************************
9916
+ // ENTITY CLASS for MJ: AI Agent Step Paths
9917
+ //****************************************************************************
9918
+ @ObjectType({ description: `Defines paths (edges) between steps in a flow-based AI agent execution graph` })
9919
+ export class MJAIAgentStepPath_ {
9920
+ @Field()
9921
+ @MaxLength(36)
9922
+ ID: string;
9923
+
9924
+ @Field()
9925
+ @MaxLength(36)
9926
+ OriginStepID: string;
9927
+
9928
+ @Field()
9929
+ @MaxLength(36)
9930
+ DestinationStepID: string;
9931
+
9932
+ @Field({nullable: true, description: `Boolean expression to evaluate. If null, path is always taken. Evaluated against payload and step results.`})
9933
+ Condition?: string;
9934
+
9935
+ @Field(() => Int, {description: `Path evaluation priority. Higher values are evaluated first. Use 0 or negative values for default/fallback paths that execute when no other conditions match.`})
9936
+ Priority: number;
9937
+
9938
+ @Field({nullable: true})
9939
+ @MaxLength(255)
9940
+ Description?: string;
9941
+
9942
+ @Field({nullable: true})
9943
+ PathPoints?: string;
9944
+
9945
+ @Field()
9946
+ _mj__CreatedAt: Date;
9947
+
9948
+ @Field()
9949
+ _mj__UpdatedAt: Date;
9950
+
9951
+ @Field()
9952
+ @MaxLength(255)
9953
+ OriginStep: string;
9954
+
9955
+ @Field()
9956
+ @MaxLength(255)
9957
+ DestinationStep: string;
9958
+
9959
+ }
9960
+
9961
+ //****************************************************************************
9962
+ // INPUT TYPE for MJ: AI Agent Step Paths
9963
+ //****************************************************************************
9964
+ @InputType()
9965
+ export class CreateMJAIAgentStepPathInput {
9966
+ @Field({ nullable: true })
9967
+ ID?: string;
9968
+
9969
+ @Field({ nullable: true })
9970
+ OriginStepID?: string;
9971
+
9972
+ @Field({ nullable: true })
9973
+ DestinationStepID?: string;
9974
+
9975
+ @Field({ nullable: true })
9976
+ Condition: string | null;
9977
+
9978
+ @Field(() => Int, { nullable: true })
9979
+ Priority?: number;
9980
+
9981
+ @Field({ nullable: true })
9982
+ Description: string | null;
9983
+
9984
+ @Field({ nullable: true })
9985
+ PathPoints: string | null;
9986
+
9987
+ @Field(() => RestoreContextInput, { nullable: true })
9988
+ RestoreContext___?: RestoreContextInput;
9989
+ }
9990
+
9991
+
9992
+ //****************************************************************************
9993
+ // INPUT TYPE for MJ: AI Agent Step Paths
9994
+ //****************************************************************************
9995
+ @InputType()
9996
+ export class UpdateMJAIAgentStepPathInput {
9997
+ @Field()
9998
+ ID: string;
9999
+
10000
+ @Field({ nullable: true })
10001
+ OriginStepID?: string;
10002
+
10003
+ @Field({ nullable: true })
10004
+ DestinationStepID?: string;
10005
+
10006
+ @Field({ nullable: true })
10007
+ Condition?: string | null;
10008
+
10009
+ @Field(() => Int, { nullable: true })
10010
+ Priority?: number;
10011
+
10012
+ @Field({ nullable: true })
10013
+ Description?: string | null;
10014
+
10015
+ @Field({ nullable: true })
10016
+ PathPoints?: string | null;
10017
+
10018
+ @Field(() => [KeyValuePairInput], { nullable: true })
10019
+ OldValues___?: KeyValuePairInput[];
10020
+
10021
+ @Field(() => RestoreContextInput, { nullable: true })
10022
+ RestoreContext___?: RestoreContextInput;
10023
+ }
10024
+
10025
+ //****************************************************************************
10026
+ // RESOLVER for MJ: AI Agent Step Paths
10027
+ //****************************************************************************
10028
+ @ObjectType()
10029
+ export class RunMJAIAgentStepPathViewResult {
10030
+ @Field(() => [MJAIAgentStepPath_])
10031
+ Results: MJAIAgentStepPath_[];
10032
+
10033
+ @Field(() => String, {nullable: true})
10034
+ UserViewRunID?: string;
10035
+
10036
+ @Field(() => Int, {nullable: true})
10037
+ RowCount: number;
10038
+
10039
+ @Field(() => Int, {nullable: true})
10040
+ TotalRowCount: number;
10041
+
10042
+ @Field(() => Int, {nullable: true})
10043
+ ExecutionTime: number;
10044
+
10045
+ @Field({nullable: true})
10046
+ ErrorMessage?: string;
10047
+
10048
+ @Field(() => Boolean, {nullable: false})
10049
+ Success: boolean;
10050
+ }
10051
+
10052
+ @Resolver(MJAIAgentStepPath_)
10053
+ export class MJAIAgentStepPathResolver extends ResolverBase {
10054
+ @Query(() => RunMJAIAgentStepPathViewResult)
10055
+ async RunMJAIAgentStepPathViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10056
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10057
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
10058
+ }
10059
+
10060
+ @Query(() => RunMJAIAgentStepPathViewResult)
10061
+ async RunMJAIAgentStepPathViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10062
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10063
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
10064
+ }
10065
+
10066
+ @Query(() => RunMJAIAgentStepPathViewResult)
10067
+ async RunMJAIAgentStepPathDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10068
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10069
+ input.EntityName = 'MJ: AI Agent Step Paths';
10070
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
10071
+ }
10072
+ @Query(() => MJAIAgentStepPath_, { nullable: true })
10073
+ async MJAIAgentStepPath(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentStepPath_ | null> {
10074
+ this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
10075
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10076
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
10077
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
10078
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10079
+ return result;
10080
+ }
10081
+
10082
+ @Mutation(() => MJAIAgentStepPath_)
10083
+ async CreateMJAIAgentStepPath(
10084
+ @Arg('input', () => CreateMJAIAgentStepPathInput) input: CreateMJAIAgentStepPathInput,
10085
+ @Ctx() { providers, userPayload }: AppContext,
10086
+ @PubSub() pubSub: PubSubEngine
10087
+ ) {
10088
+ const provider = GetReadWriteProvider(providers);
10089
+ return this.CreateRecord('MJ: AI Agent Step Paths', input, provider, userPayload, pubSub)
10090
+ }
10091
+
10092
+ @Mutation(() => MJAIAgentStepPath_)
10093
+ async UpdateMJAIAgentStepPath(
10094
+ @Arg('input', () => UpdateMJAIAgentStepPathInput) input: UpdateMJAIAgentStepPathInput,
10095
+ @Ctx() { providers, userPayload }: AppContext,
10096
+ @PubSub() pubSub: PubSubEngine
10097
+ ) {
10098
+ const provider = GetReadWriteProvider(providers);
10099
+ return this.UpdateRecord('MJ: AI Agent Step Paths', input, provider, userPayload, pubSub);
10100
+ }
10101
+
10102
+ @Mutation(() => MJAIAgentStepPath_)
10103
+ async DeleteMJAIAgentStepPath(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10104
+ const provider = GetReadWriteProvider(providers);
10105
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
10106
+ return this.DeleteRecord('MJ: AI Agent Step Paths', key, options, provider, userPayload, pubSub);
10107
+ }
10108
+
10109
+ }
10110
+
10111
+ //****************************************************************************
10112
+ // ENTITY CLASS for MJ: AI Agent Steps
10113
+ //****************************************************************************
10114
+ @ObjectType({ description: `Defines individual steps (nodes) in a flow-based AI agent execution graph` })
10115
+ export class MJAIAgentStep_ {
10116
+ @Field()
10117
+ @MaxLength(36)
10118
+ ID: string;
10119
+
10120
+ @Field()
10121
+ @MaxLength(36)
10122
+ AgentID: string;
10123
+
10124
+ @Field()
10125
+ @MaxLength(255)
10126
+ Name: string;
10127
+
10128
+ @Field({nullable: true})
10129
+ Description?: string;
10130
+
10131
+ @Field({description: `Type of step: Action (execute an action), Sub-Agent (delegate to another agent), or Prompt (run an AI prompt)`})
10132
+ @MaxLength(20)
10133
+ StepType: string;
10134
+
10135
+ @Field(() => Boolean, {description: `If true, this step is executed when the agent starts`})
10136
+ StartingStep: boolean;
10137
+
10138
+ @Field(() => Int, {nullable: true})
10139
+ TimeoutSeconds?: number;
10140
+
10141
+ @Field(() => Int)
10142
+ RetryCount: number;
10143
+
10144
+ @Field()
10145
+ @MaxLength(20)
10146
+ OnErrorBehavior: string;
10147
+
10148
+ @Field({nullable: true})
10149
+ @MaxLength(36)
10150
+ ActionID?: string;
10151
+
10152
+ @Field({nullable: true})
10153
+ @MaxLength(36)
10154
+ SubAgentID?: string;
10155
+
10156
+ @Field({nullable: true})
10157
+ @MaxLength(36)
10158
+ PromptID?: string;
10159
+
10160
+ @Field({nullable: true, description: `JSON configuration for mapping action output parameters to payload paths. Example: {"outputParam1": "payload.customer.status", "*": "payload.lastResult"}`})
10161
+ ActionOutputMapping?: string;
10162
+
10163
+ @Field(() => Int)
10164
+ PositionX: number;
10165
+
10166
+ @Field(() => Int)
10167
+ PositionY: number;
10168
+
10169
+ @Field(() => Int)
10170
+ Width: number;
10171
+
10172
+ @Field(() => Int)
10173
+ Height: number;
10174
+
10175
+ @Field()
10176
+ _mj__CreatedAt: Date;
10177
+
10178
+ @Field()
10179
+ _mj__UpdatedAt: Date;
10180
+
10181
+ @Field({description: `Controls whether this step is executed. Active=normal execution, Pending=skip but may activate later, Disabled=never execute`})
10182
+ @MaxLength(20)
10183
+ Status: string;
10184
+
10185
+ @Field({nullable: true, description: `JSON configuration for mapping static values or payload paths to action input parameters. Example: {"param1": "staticValue", "param2": "payload.dynamicValue"}`})
10186
+ ActionInputMapping?: string;
10187
+
10188
+ @Field({nullable: true, description: `Specifies what type of operation executes in the loop body. Values: Action, Sub-Agent, Prompt. Only used when StepType is ForEach or While.`})
10189
+ @MaxLength(50)
10190
+ LoopBodyType?: string;
10191
+
10192
+ @Field({nullable: true, description: `JSON configuration object for step-specific settings. For loop steps: { type: "ForEach"|"While", collectionPath?, itemVariable?, indexVariable?, maxIterations?, continueOnError?, condition? }. For other step types: reserved for future use.`})
10193
+ Configuration?: string;
10194
+
10195
+ @Field({nullable: true})
10196
+ @MaxLength(255)
10197
+ Agent?: string;
10198
+
10199
+ @Field({nullable: true})
10200
+ @MaxLength(425)
10201
+ Action?: string;
10202
+
10203
+ @Field({nullable: true})
10204
+ @MaxLength(255)
10205
+ SubAgent?: string;
10206
+
10207
+ @Field({nullable: true})
10208
+ @MaxLength(255)
10209
+ Prompt?: string;
10210
+
10211
+ @Field(() => [MJAIAgentStepPath_])
10212
+ MJAIAgentStepPaths_OriginStepIDArray: MJAIAgentStepPath_[]; // Link to MJAIAgentStepPaths
10213
+
10214
+ @Field(() => [MJAIAgentStepPath_])
10215
+ MJAIAgentStepPaths_DestinationStepIDArray: MJAIAgentStepPath_[]; // Link to MJAIAgentStepPaths
10216
+
10217
+ }
10218
+
10219
+ //****************************************************************************
10220
+ // INPUT TYPE for MJ: AI Agent Steps
10221
+ //****************************************************************************
10222
+ @InputType()
10223
+ export class CreateMJAIAgentStepInput {
10224
+ @Field({ nullable: true })
10225
+ ID?: string;
10226
+
10227
+ @Field({ nullable: true })
10228
+ AgentID?: string;
10229
+
10230
+ @Field({ nullable: true })
10231
+ Name?: string;
10232
+
10233
+ @Field({ nullable: true })
10234
+ Description: string | null;
10235
+
10236
+ @Field({ nullable: true })
10237
+ StepType?: string;
10238
+
10239
+ @Field(() => Boolean, { nullable: true })
10240
+ StartingStep?: boolean;
10241
+
10242
+ @Field(() => Int, { nullable: true })
10243
+ TimeoutSeconds?: number | null;
10244
+
10245
+ @Field(() => Int, { nullable: true })
10246
+ RetryCount?: number;
10247
+
10248
+ @Field({ nullable: true })
10249
+ OnErrorBehavior?: string;
10250
+
10251
+ @Field({ nullable: true })
10252
+ ActionID: string | null;
10253
+
10254
+ @Field({ nullable: true })
10255
+ SubAgentID: string | null;
10256
+
10257
+ @Field({ nullable: true })
10258
+ PromptID: string | null;
10259
+
10260
+ @Field({ nullable: true })
10261
+ ActionOutputMapping: string | null;
10262
+
10263
+ @Field(() => Int, { nullable: true })
10264
+ PositionX?: number;
10265
+
10266
+ @Field(() => Int, { nullable: true })
10267
+ PositionY?: number;
10268
+
10269
+ @Field(() => Int, { nullable: true })
10270
+ Width?: number;
10271
+
10272
+ @Field(() => Int, { nullable: true })
10273
+ Height?: number;
10274
+
10275
+ @Field({ nullable: true })
10276
+ Status?: string;
10277
+
10278
+ @Field({ nullable: true })
10279
+ ActionInputMapping: string | null;
10280
+
10281
+ @Field({ nullable: true })
10282
+ LoopBodyType: string | null;
10283
+
10284
+ @Field({ nullable: true })
10285
+ Configuration: string | null;
10286
+
10287
+ @Field(() => RestoreContextInput, { nullable: true })
10288
+ RestoreContext___?: RestoreContextInput;
10289
+ }
10290
+
10291
+
10292
+ //****************************************************************************
10293
+ // INPUT TYPE for MJ: AI Agent Steps
10294
+ //****************************************************************************
10295
+ @InputType()
10296
+ export class UpdateMJAIAgentStepInput {
10297
+ @Field()
10298
+ ID: string;
10299
+
10300
+ @Field({ nullable: true })
10301
+ AgentID?: string;
10302
+
10303
+ @Field({ nullable: true })
10304
+ Name?: string;
10305
+
10306
+ @Field({ nullable: true })
10307
+ Description?: string | null;
10308
+
10309
+ @Field({ nullable: true })
10310
+ StepType?: string;
10311
+
10312
+ @Field(() => Boolean, { nullable: true })
10313
+ StartingStep?: boolean;
10314
+
10315
+ @Field(() => Int, { nullable: true })
10316
+ TimeoutSeconds?: number | null;
10317
+
10318
+ @Field(() => Int, { nullable: true })
10319
+ RetryCount?: number;
10320
+
10321
+ @Field({ nullable: true })
10322
+ OnErrorBehavior?: string;
10323
+
10324
+ @Field({ nullable: true })
10325
+ ActionID?: string | null;
10326
+
10327
+ @Field({ nullable: true })
10328
+ SubAgentID?: string | null;
10329
+
10330
+ @Field({ nullable: true })
10331
+ PromptID?: string | null;
10332
+
10333
+ @Field({ nullable: true })
10334
+ ActionOutputMapping?: string | null;
10335
+
10336
+ @Field(() => Int, { nullable: true })
10337
+ PositionX?: number;
10338
+
10339
+ @Field(() => Int, { nullable: true })
10340
+ PositionY?: number;
10341
+
10342
+ @Field(() => Int, { nullable: true })
10343
+ Width?: number;
10344
+
10345
+ @Field(() => Int, { nullable: true })
10346
+ Height?: number;
10347
+
10348
+ @Field({ nullable: true })
10349
+ Status?: string;
10350
+
10351
+ @Field({ nullable: true })
10352
+ ActionInputMapping?: string | null;
10353
+
10354
+ @Field({ nullable: true })
10355
+ LoopBodyType?: string | null;
10356
+
10357
+ @Field({ nullable: true })
10358
+ Configuration?: string | null;
10359
+
10360
+ @Field(() => [KeyValuePairInput], { nullable: true })
10361
+ OldValues___?: KeyValuePairInput[];
10362
+
10363
+ @Field(() => RestoreContextInput, { nullable: true })
10364
+ RestoreContext___?: RestoreContextInput;
10365
+ }
10366
+
10367
+ //****************************************************************************
10368
+ // RESOLVER for MJ: AI Agent Steps
10369
+ //****************************************************************************
10370
+ @ObjectType()
10371
+ export class RunMJAIAgentStepViewResult {
10372
+ @Field(() => [MJAIAgentStep_])
10373
+ Results: MJAIAgentStep_[];
10374
+
10375
+ @Field(() => String, {nullable: true})
10376
+ UserViewRunID?: string;
10377
+
10378
+ @Field(() => Int, {nullable: true})
10379
+ RowCount: number;
10380
+
10381
+ @Field(() => Int, {nullable: true})
10382
+ TotalRowCount: number;
10383
+
10384
+ @Field(() => Int, {nullable: true})
10385
+ ExecutionTime: number;
10386
+
10387
+ @Field({nullable: true})
10388
+ ErrorMessage?: string;
10389
+
10390
+ @Field(() => Boolean, {nullable: false})
10391
+ Success: boolean;
10392
+ }
10393
+
10394
+ @Resolver(MJAIAgentStep_)
10395
+ export class MJAIAgentStepResolver extends ResolverBase {
10396
+ @Query(() => RunMJAIAgentStepViewResult)
10397
+ async RunMJAIAgentStepViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10398
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10399
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
10400
+ }
10401
+
10402
+ @Query(() => RunMJAIAgentStepViewResult)
10403
+ async RunMJAIAgentStepViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10404
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10405
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
10406
+ }
10407
+
10408
+ @Query(() => RunMJAIAgentStepViewResult)
10409
+ async RunMJAIAgentStepDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10410
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10411
+ input.EntityName = 'MJ: AI Agent Steps';
10412
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
10413
+ }
10414
+ @Query(() => MJAIAgentStep_, { nullable: true })
10415
+ async MJAIAgentStep(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentStep_ | null> {
10416
+ this.CheckUserReadPermissions('MJ: AI Agent Steps', userPayload);
10417
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10418
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSteps')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Steps', userPayload, EntityPermissionType.Read, 'AND');
10419
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
10420
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Steps', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10421
+ return result;
10422
+ }
10423
+
10424
+ @FieldResolver(() => [MJAIAgentStepPath_])
10425
+ async MJAIAgentStepPaths_OriginStepIDArray(@Root() mjaiagentstep_: MJAIAgentStep_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10426
+ this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
10427
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10428
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('OriginStepID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
10429
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentstep_.ID], undefined, this.GetUserFromPayload(userPayload));
10430
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows, this.GetUserFromPayload(userPayload));
10431
+ return result;
10432
+ }
10433
+
10434
+ @FieldResolver(() => [MJAIAgentStepPath_])
10435
+ async MJAIAgentStepPaths_DestinationStepIDArray(@Root() mjaiagentstep_: MJAIAgentStep_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10436
+ this.CheckUserReadPermissions('MJ: AI Agent Step Paths', userPayload);
10437
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10438
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentStepPaths')} WHERE ${provider.QuoteIdentifier('DestinationStepID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Step Paths', userPayload, EntityPermissionType.Read, 'AND');
10439
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentstep_.ID], undefined, this.GetUserFromPayload(userPayload));
10440
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Step Paths', rows, this.GetUserFromPayload(userPayload));
10441
+ return result;
10442
+ }
10443
+
10444
+ @Mutation(() => MJAIAgentStep_)
10445
+ async CreateMJAIAgentStep(
10446
+ @Arg('input', () => CreateMJAIAgentStepInput) input: CreateMJAIAgentStepInput,
10447
+ @Ctx() { providers, userPayload }: AppContext,
10448
+ @PubSub() pubSub: PubSubEngine
10449
+ ) {
10450
+ const provider = GetReadWriteProvider(providers);
10451
+ return this.CreateRecord('MJ: AI Agent Steps', input, provider, userPayload, pubSub)
10452
+ }
10453
+
10454
+ @Mutation(() => MJAIAgentStep_)
10455
+ async UpdateMJAIAgentStep(
10456
+ @Arg('input', () => UpdateMJAIAgentStepInput) input: UpdateMJAIAgentStepInput,
10457
+ @Ctx() { providers, userPayload }: AppContext,
10458
+ @PubSub() pubSub: PubSubEngine
10459
+ ) {
10460
+ const provider = GetReadWriteProvider(providers);
10461
+ return this.UpdateRecord('MJ: AI Agent Steps', input, provider, userPayload, pubSub);
10462
+ }
10463
+
10464
+ @Mutation(() => MJAIAgentStep_)
10465
+ async DeleteMJAIAgentStep(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10466
+ const provider = GetReadWriteProvider(providers);
10467
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
10468
+ return this.DeleteRecord('MJ: AI Agent Steps', key, options, provider, userPayload, pubSub);
10469
+ }
10470
+
10471
+ }
10472
+
10473
+ //****************************************************************************
10474
+ // ENTITY CLASS for MJ: AI Agent Types
10475
+ //****************************************************************************
10476
+ @ObjectType({ description: `Defines types of AI agents with their system prompts and behavioral characteristics. Each agent type represents a category of agents that share common system-level instructions and capabilities.` })
10477
+ export class MJAIAgentType_ {
10478
+ @Field({description: `Unique identifier for the agent type`})
10479
+ @MaxLength(36)
10480
+ ID: string;
10481
+
10482
+ @Field({description: `Unique name of the agent type (e.g., "Base", "CustomerSupport", "DataAnalysis"). Used for programmatic identification and factory instantiation.`})
10483
+ @MaxLength(100)
10484
+ Name: string;
10485
+
10486
+ @Field({nullable: true, description: `Detailed description of the agent type, its purpose, and typical use cases`})
10487
+ Description?: string;
10488
+
10489
+ @Field({nullable: true, description: `Reference to the AI Prompt that contains the system-level instructions for all agents of this type. This prompt will be blended with individual agent prompts.`})
10490
+ @MaxLength(36)
10491
+ SystemPromptID?: string;
10492
+
10493
+ @Field(() => Boolean, {description: `Indicates whether this agent type is available for use. Inactive types cannot be assigned to new agents.`})
10494
+ IsActive: boolean;
10495
+
10496
+ @Field()
10497
+ _mj__CreatedAt: Date;
10498
+
10499
+ @Field()
10500
+ _mj__UpdatedAt: Date;
10501
+
10502
+ @Field({nullable: true, description: `The placeholder name used in the system prompt template where the agent prompt result should be injected. For example, if the system prompt contains "{{ agentPrompt }}", this field should contain "agentPrompt". This enables proper hierarchical prompt execution where the agent type's system prompt acts as the parent and the agent's specific prompt acts as the child.`})
10503
+ @MaxLength(255)
10504
+ AgentPromptPlaceholder?: string;
10505
+
10506
+ @Field({nullable: true, description: `The class name used by the MemberJunction class factory to instantiate the specific agent type implementation. For example, "LoopAgentType" for a looping agent pattern. If not specified, defaults to using the agent type Name for the DriverClass lookup key.`})
10507
+ @MaxLength(255)
10508
+ DriverClass?: string;
10509
+
10510
+ @Field({nullable: true, description: `Optional Angular component key name for a subclass of BaseFormSectionComponent that provides a custom form section for this agent type. When specified, this component will be dynamically loaded and displayed as the first expandable section in the AI Agent form. This allows agent types to have specialized UI elements. The class must be registered with the MemberJunction class factory via @RegisterClass`})
10511
+ @MaxLength(500)
10512
+ UIFormSectionKey?: string;
10513
+
10514
+ @Field({nullable: true, description: `Optional Angular component key name for a subclass of BaseFormComponent that will completely overrides the default AI Agent form for this agent type. When specified, this component will be used instead of the standard AI Agent form, allowing for completely custom form implementations. The class must be registered with the MemberJunction class factory via @RegisterClass. If both UIFormClass and UIFormSectionClass are specified, UIFormClass takes precedence.`})
10515
+ @MaxLength(500)
10516
+ UIFormKey?: string;
10517
+
10518
+ @Field(() => Boolean, {description: `Determines whether the custom form section (specified by UIFormSectionClass) should be expanded by default when the AI Agent form loads. True means the section starts expanded, False means it starts collapsed. Only applies when UIFormSectionClass is specified. Defaults to 1 (expanded).`})
10519
+ UIFormSectionExpandedByDefault: boolean;
10520
+
10521
+ @Field({nullable: true, description: `JSON Schema defining the available prompt parameters for this agent type. Includes property definitions with types, defaults, and descriptions. Used by agents of this type to customize which prompt sections are included in the system prompt. The schema follows JSON Schema draft-07 format.`})
10522
+ PromptParamsSchema?: string;
10523
+
10524
+ @Field({nullable: true, description: `JSON-serialized AgentRequestAssignmentStrategy defining the default assignment strategy for all agents of this type. Overridden by per-invocation or category-level strategies in the resolution chain.`})
10525
+ AssignmentStrategy?: string;
10526
+
10527
+ @Field({nullable: true, description: `Default file storage account for agents of this type. Lowest priority in the resolution chain (Type → Category tree → Agent → Runtime override). When set, all agents of this type use this storage account unless overridden at a more specific level. FK to FileStorageAccount.`})
10528
+ @MaxLength(36)
10529
+ DefaultStorageAccountID?: string;
10530
+
10531
+ @Field({nullable: true, description: `JSON Schema (draft-07) describing the shape of TypeConfiguration payloads on agents of this type. When present, agent saves validate their TypeConfiguration against it server-side (MJAIAgentEntityServer.ValidateAsync); null = TypeConfiguration is freeform for this type.`})
10532
+ ConfigSchema?: string;
10533
+
10534
+ @Field({nullable: true, description: `Type-level DEFAULT configuration JSON for agents of this type — the base layer of the effective-configuration merge: type DefaultConfiguration <- agent TypeConfiguration <- runtime overrides (later layers win per key, deep-merged). Must itself conform to ConfigSchema when one is published. Null = no type defaults.`})
10535
+ DefaultConfiguration?: string;
10536
+
10537
+ @Field({nullable: true})
10538
+ @MaxLength(255)
10539
+ SystemPrompt?: string;
10540
+
10541
+ @Field({nullable: true})
10542
+ @MaxLength(200)
10543
+ DefaultStorageAccount?: string;
10544
+
10545
+ @Field(() => [MJAIAgentCoAgent_])
10546
+ MJAIAgentCoAgents_TargetAgentTypeIDArray: MJAIAgentCoAgent_[]; // Link to MJAIAgentCoAgents
10547
+
10548
+ @Field(() => [MJAIAgent_])
10549
+ MJAIAgents_TypeIDArray: MJAIAgent_[]; // Link to MJAIAgents
10550
+
10551
+ }
10552
+
10553
+ //****************************************************************************
10554
+ // INPUT TYPE for MJ: AI Agent Types
10555
+ //****************************************************************************
10556
+ @InputType()
10557
+ export class CreateMJAIAgentTypeInput {
10558
+ @Field({ nullable: true })
10559
+ ID?: string;
10560
+
10561
+ @Field({ nullable: true })
10562
+ Name?: string;
10563
+
10564
+ @Field({ nullable: true })
10565
+ Description: string | null;
10566
+
10567
+ @Field({ nullable: true })
10568
+ SystemPromptID: string | null;
10569
+
10570
+ @Field(() => Boolean, { nullable: true })
10571
+ IsActive?: boolean;
10572
+
10573
+ @Field({ nullable: true })
10574
+ AgentPromptPlaceholder: string | null;
10575
+
10576
+ @Field({ nullable: true })
10577
+ DriverClass: string | null;
10578
+
10579
+ @Field({ nullable: true })
10580
+ UIFormSectionKey: string | null;
10581
+
10582
+ @Field({ nullable: true })
10583
+ UIFormKey: string | null;
10584
+
10585
+ @Field(() => Boolean, { nullable: true })
10586
+ UIFormSectionExpandedByDefault?: boolean;
10587
+
10588
+ @Field({ nullable: true })
10589
+ PromptParamsSchema: string | null;
10590
+
10591
+ @Field({ nullable: true })
10592
+ AssignmentStrategy: string | null;
10593
+
10594
+ @Field({ nullable: true })
10595
+ DefaultStorageAccountID: string | null;
10596
+
10597
+ @Field({ nullable: true })
10598
+ ConfigSchema: string | null;
10599
+
10600
+ @Field({ nullable: true })
10601
+ DefaultConfiguration: string | null;
10602
+
10603
+ @Field(() => RestoreContextInput, { nullable: true })
10604
+ RestoreContext___?: RestoreContextInput;
10605
+ }
10606
+
10607
+
10608
+ //****************************************************************************
10609
+ // INPUT TYPE for MJ: AI Agent Types
10610
+ //****************************************************************************
10611
+ @InputType()
10612
+ export class UpdateMJAIAgentTypeInput {
10613
+ @Field()
10614
+ ID: string;
10615
+
10616
+ @Field({ nullable: true })
10617
+ Name?: string;
10618
+
10619
+ @Field({ nullable: true })
10620
+ Description?: string | null;
10621
+
10622
+ @Field({ nullable: true })
10623
+ SystemPromptID?: string | null;
10624
+
10625
+ @Field(() => Boolean, { nullable: true })
10626
+ IsActive?: boolean;
10627
+
10628
+ @Field({ nullable: true })
10629
+ AgentPromptPlaceholder?: string | null;
10630
+
10631
+ @Field({ nullable: true })
10632
+ DriverClass?: string | null;
10633
+
10634
+ @Field({ nullable: true })
10635
+ UIFormSectionKey?: string | null;
10636
+
10637
+ @Field({ nullable: true })
10638
+ UIFormKey?: string | null;
10639
+
10640
+ @Field(() => Boolean, { nullable: true })
10641
+ UIFormSectionExpandedByDefault?: boolean;
10642
+
10643
+ @Field({ nullable: true })
10644
+ PromptParamsSchema?: string | null;
10645
+
10646
+ @Field({ nullable: true })
10647
+ AssignmentStrategy?: string | null;
10648
+
10649
+ @Field({ nullable: true })
10650
+ DefaultStorageAccountID?: string | null;
10651
+
10652
+ @Field({ nullable: true })
10653
+ ConfigSchema?: string | null;
10654
+
10655
+ @Field({ nullable: true })
10656
+ DefaultConfiguration?: string | null;
10657
+
10658
+ @Field(() => [KeyValuePairInput], { nullable: true })
10659
+ OldValues___?: KeyValuePairInput[];
10660
+
10661
+ @Field(() => RestoreContextInput, { nullable: true })
10662
+ RestoreContext___?: RestoreContextInput;
10663
+ }
10664
+
10665
+ //****************************************************************************
10666
+ // RESOLVER for MJ: AI Agent Types
10667
+ //****************************************************************************
10668
+ @ObjectType()
10669
+ export class RunMJAIAgentTypeViewResult {
10670
+ @Field(() => [MJAIAgentType_])
10671
+ Results: MJAIAgentType_[];
10672
+
10673
+ @Field(() => String, {nullable: true})
10674
+ UserViewRunID?: string;
10675
+
10676
+ @Field(() => Int, {nullable: true})
10677
+ RowCount: number;
10678
+
10679
+ @Field(() => Int, {nullable: true})
10680
+ TotalRowCount: number;
10681
+
10682
+ @Field(() => Int, {nullable: true})
10683
+ ExecutionTime: number;
10684
+
10685
+ @Field({nullable: true})
10686
+ ErrorMessage?: string;
10687
+
10688
+ @Field(() => Boolean, {nullable: false})
10689
+ Success: boolean;
10690
+ }
10691
+
10692
+ @Resolver(MJAIAgentType_)
10693
+ export class MJAIAgentTypeResolver extends ResolverBase {
10694
+ @Query(() => RunMJAIAgentTypeViewResult)
10695
+ async RunMJAIAgentTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10696
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10697
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
10698
+ }
10699
+
10700
+ @Query(() => RunMJAIAgentTypeViewResult)
10701
+ async RunMJAIAgentTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10702
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10703
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
10704
+ }
10705
+
10706
+ @Query(() => RunMJAIAgentTypeViewResult)
10707
+ async RunMJAIAgentTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10708
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10709
+ input.EntityName = 'MJ: AI Agent Types';
10710
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
10711
+ }
10712
+ @Query(() => MJAIAgentType_, { nullable: true })
10713
+ async MJAIAgentType(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentType_ | null> {
10714
+ this.CheckUserReadPermissions('MJ: AI Agent Types', userPayload);
10715
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10716
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentTypes')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Types', userPayload, EntityPermissionType.Read, 'AND');
10717
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
10718
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Types', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10719
+ return result;
10720
+ }
10721
+
10722
+ @FieldResolver(() => [MJAIAgentCoAgent_])
10723
+ async MJAIAgentCoAgents_TargetAgentTypeIDArray(@Root() mjaiagenttype_: MJAIAgentType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10724
+ this.CheckUserReadPermissions('MJ: AI Agent Co Agents', userPayload);
10725
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10726
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentCoAgents')} WHERE ${provider.QuoteIdentifier('TargetAgentTypeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Co Agents', userPayload, EntityPermissionType.Read, 'AND');
10727
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagenttype_.ID], undefined, this.GetUserFromPayload(userPayload));
10728
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Co Agents', rows, this.GetUserFromPayload(userPayload));
10729
+ return result;
10730
+ }
10731
+
10732
+ @FieldResolver(() => [MJAIAgent_])
10733
+ async MJAIAgents_TypeIDArray(@Root() mjaiagenttype_: MJAIAgentType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10734
+ this.CheckUserReadPermissions('MJ: AI Agents', userPayload);
10735
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10736
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgents')} WHERE ${provider.QuoteIdentifier('TypeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agents', userPayload, EntityPermissionType.Read, 'AND');
10737
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagenttype_.ID], undefined, this.GetUserFromPayload(userPayload));
10738
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agents', rows, this.GetUserFromPayload(userPayload));
10739
+ return result;
10740
+ }
10741
+
10742
+ @Mutation(() => MJAIAgentType_)
10743
+ async CreateMJAIAgentType(
10744
+ @Arg('input', () => CreateMJAIAgentTypeInput) input: CreateMJAIAgentTypeInput,
10745
+ @Ctx() { providers, userPayload }: AppContext,
10746
+ @PubSub() pubSub: PubSubEngine
10747
+ ) {
10748
+ const provider = GetReadWriteProvider(providers);
10749
+ return this.CreateRecord('MJ: AI Agent Types', input, provider, userPayload, pubSub)
10750
+ }
10751
+
10752
+ @Mutation(() => MJAIAgentType_)
10753
+ async UpdateMJAIAgentType(
10754
+ @Arg('input', () => UpdateMJAIAgentTypeInput) input: UpdateMJAIAgentTypeInput,
10755
+ @Ctx() { providers, userPayload }: AppContext,
10756
+ @PubSub() pubSub: PubSubEngine
10757
+ ) {
10758
+ const provider = GetReadWriteProvider(providers);
10759
+ return this.UpdateRecord('MJ: AI Agent Types', input, provider, userPayload, pubSub);
10760
+ }
10761
+
10762
+ @Mutation(() => MJAIAgentType_)
10763
+ async DeleteMJAIAgentType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10764
+ const provider = GetReadWriteProvider(providers);
10765
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
10766
+ return this.DeleteRecord('MJ: AI Agent Types', key, options, provider, userPayload, pubSub);
10767
+ }
10768
+
10769
+ }
10770
+
10771
+ //****************************************************************************
10772
+ // ENTITY CLASS for MJ: AI Agents
10773
+ //****************************************************************************
10774
+ @ObjectType({ description: `Table to store information about AI agents.` })
10775
+ export class MJAIAgent_ {
10776
+ @Field({description: `The unique identifier for each AI agent. Serves as the primary key.`})
10777
+ @MaxLength(36)
10778
+ ID: string;
10779
+
10780
+ @Field({nullable: true, description: `The name of the AI agent.`})
10781
+ @MaxLength(255)
10782
+ Name?: string;
10783
+
10784
+ @Field({nullable: true, description: `A detailed description of the AI agent.`})
10785
+ Description?: string;
10786
+
10787
+ @Field({nullable: true, description: `URL to an image file or base64 data URI (e.g., data:image/png;base64,...) for the agent logo. Takes precedence over IconClass in UI display.`})
10788
+ @MaxLength(255)
10789
+ LogoURL?: string;
10790
+
10791
+ @Field()
10792
+ _mj__CreatedAt: Date;
10793
+
10794
+ @Field()
10795
+ _mj__UpdatedAt: Date;
10796
+
10797
+ @Field({nullable: true, description: `References the parent agent in the hierarchical structure. If NULL, this is a root (top-level) agent.`})
10798
+ @MaxLength(36)
10799
+ ParentID?: string;
10800
+
10801
+ @Field(() => Boolean, {description: `When true, this agent can be exposed as an action for use by other agents. Only valid for root agents.`})
9281
10802
  ExposeAsAction: boolean;
9282
10803
 
9283
10804
  @Field(() => Int, {description: `The order in which this agent should be executed among its siblings under the same parent.`})
@@ -9483,6 +11004,16 @@ if this limit is exceeded.`})
9483
11004
  @Field(() => Boolean, {description: `Per-agent opt-in to a Generic Binary fallback for file uploads whose MIME type does not match any registered Artifact Type. When false (default), unrecognized uploads are rejected at upload time with an actionable error. When true, unrecognized uploads resolve to the Generic Binary artifact type, exposing only get_full and get_metadata tools. Scoped per agent — there is no system-wide global flag.`})
9484
11005
  AcceptUnregisteredFiles: boolean;
9485
11006
 
11007
+ @Field({nullable: true, description: `Default co-agent (a Realtime-type AI Agent) that voices THIS agent in real-time sessions — a per-agent persona. Overridden by the runtime coAgentId parameter; NULL falls through to a type-level AIAgentCoAgent default row, then the global default co-agent.`})
11008
+ @MaxLength(36)
11009
+ DefaultCoAgentID?: string;
11010
+
11011
+ @Field({nullable: true, description: `Agent-type-specific configuration JSON, validated against the agent type's ConfigSchema (when one is published) in the server-side entity subclass. For Realtime-type co-agents this holds the realtime profile: preferred model, per-provider voice settings, tone/speaking style (folded into the session system prompt at mint), user-override policy, and narration pacing. Null = type defaults apply.`})
11012
+ TypeConfiguration?: string;
11013
+
11014
+ @Field(() => Boolean, {description: `When enabled, the agent may commit durable memories mid-run via the memoryWrites loop-response field. Writes are framework-guarded (type restriction, scope clamp, near-duplicate check, per-run cap) and land as Provisional notes pending Memory Manager hardening. On by default; disable for restricted or experimental agents.`})
11015
+ AllowMemoryWrite: boolean;
11016
+
9486
11017
  @Field({nullable: true})
9487
11018
  @MaxLength(255)
9488
11019
  Parent?: string;
@@ -9515,10 +11046,18 @@ if this limit is exceeded.`})
9515
11046
  @MaxLength(200)
9516
11047
  DefaultStorageAccount?: string;
9517
11048
 
11049
+ @Field({nullable: true})
11050
+ @MaxLength(255)
11051
+ DefaultCoAgent?: string;
11052
+
9518
11053
  @Field({nullable: true})
9519
11054
  @MaxLength(36)
9520
11055
  RootParentID?: string;
9521
11056
 
11057
+ @Field({nullable: true})
11058
+ @MaxLength(36)
11059
+ RootDefaultCoAgentID?: string;
11060
+
9522
11061
  @Field(() => [MJAIAgentAction_])
9523
11062
  MJAIAgentActions_AgentIDArray: MJAIAgentAction_[]; // Link to MJAIAgentActions
9524
11063
 
@@ -9600,6 +11139,21 @@ if this limit is exceeded.`})
9600
11139
  @Field(() => [MJConversation_])
9601
11140
  MJConversations_DefaultAgentIDArray: MJConversation_[]; // Link to MJConversations
9602
11141
 
11142
+ @Field(() => [MJAIAgentSession_])
11143
+ MJAIAgentSessions_AgentIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
11144
+
11145
+ @Field(() => [MJAIAgent_])
11146
+ MJAIAgents_DefaultCoAgentIDArray: MJAIAgent_[]; // Link to MJAIAgents
11147
+
11148
+ @Field(() => [MJAIAgentCoAgent_])
11149
+ MJAIAgentCoAgents_CoAgentIDArray: MJAIAgentCoAgent_[]; // Link to MJAIAgentCoAgents
11150
+
11151
+ @Field(() => [MJAIAgentCoAgent_])
11152
+ MJAIAgentCoAgents_TargetAgentIDArray: MJAIAgentCoAgent_[]; // Link to MJAIAgentCoAgents
11153
+
11154
+ @Field(() => [MJAIBridgeAgentIdentity_])
11155
+ MJAIBridgeAgentIdentities_AgentIDArray: MJAIBridgeAgentIdentity_[]; // Link to MJAIBridgeAgentIdentities
11156
+
9603
11157
  }
9604
11158
 
9605
11159
  //****************************************************************************
@@ -9799,6 +11353,15 @@ export class CreateMJAIAgentInput {
9799
11353
  @Field(() => Boolean, { nullable: true })
9800
11354
  AcceptUnregisteredFiles?: boolean;
9801
11355
 
11356
+ @Field({ nullable: true })
11357
+ DefaultCoAgentID: string | null;
11358
+
11359
+ @Field({ nullable: true })
11360
+ TypeConfiguration: string | null;
11361
+
11362
+ @Field(() => Boolean, { nullable: true })
11363
+ AllowMemoryWrite?: boolean;
11364
+
9802
11365
  @Field(() => RestoreContextInput, { nullable: true })
9803
11366
  RestoreContext___?: RestoreContextInput;
9804
11367
  }
@@ -10001,6 +11564,15 @@ export class UpdateMJAIAgentInput {
10001
11564
  @Field(() => Boolean, { nullable: true })
10002
11565
  AcceptUnregisteredFiles?: boolean;
10003
11566
 
11567
+ @Field({ nullable: true })
11568
+ DefaultCoAgentID?: string | null;
11569
+
11570
+ @Field({ nullable: true })
11571
+ TypeConfiguration?: string | null;
11572
+
11573
+ @Field(() => Boolean, { nullable: true })
11574
+ AllowMemoryWrite?: boolean;
11575
+
10004
11576
  @Field(() => [KeyValuePairInput], { nullable: true })
10005
11577
  OldValues___?: KeyValuePairInput[];
10006
11578
 
@@ -10274,130 +11846,809 @@ export class MJAIAgentResolver extends ResolverBase {
10274
11846
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows, this.GetUserFromPayload(userPayload));
10275
11847
  return result;
10276
11848
  }
10277
-
10278
- @FieldResolver(() => [MJAIPromptRun_])
10279
- async MJAIPromptRuns_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10280
- this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
11849
+
11850
+ @FieldResolver(() => [MJAIPromptRun_])
11851
+ async MJAIPromptRuns_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11852
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
11853
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11854
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIPromptRuns')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
11855
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11856
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows, this.GetUserFromPayload(userPayload));
11857
+ return result;
11858
+ }
11859
+
11860
+ @FieldResolver(() => [MJAIResultCache_])
11861
+ async MJAIResultCache_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11862
+ this.CheckUserReadPermissions('MJ: AI Result Cache', userPayload);
11863
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11864
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIResultCaches')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
11865
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11866
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Result Cache', rows, this.GetUserFromPayload(userPayload));
11867
+ return result;
11868
+ }
11869
+
11870
+ @FieldResolver(() => [MJConversationDetail_])
11871
+ async MJConversationDetails_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11872
+ this.CheckUserReadPermissions('MJ: Conversation Details', userPayload);
11873
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11874
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationDetails')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
11875
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11876
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Details', rows, this.GetUserFromPayload(userPayload));
11877
+ return result;
11878
+ }
11879
+
11880
+ @FieldResolver(() => [MJAIAgent_])
11881
+ async MJAIAgents_ParentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11882
+ this.CheckUserReadPermissions('MJ: AI Agents', userPayload);
11883
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11884
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgents')} WHERE ${provider.QuoteIdentifier('ParentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agents', userPayload, EntityPermissionType.Read, 'AND');
11885
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11886
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agents', rows, this.GetUserFromPayload(userPayload));
11887
+ return result;
11888
+ }
11889
+
11890
+ @FieldResolver(() => [MJAction_])
11891
+ async MJActions_CreatedByAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11892
+ this.CheckUserReadPermissions('MJ: Actions', userPayload);
11893
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11894
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwActions')} WHERE ${provider.QuoteIdentifier('CreatedByAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Actions', userPayload, EntityPermissionType.Read, 'AND');
11895
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11896
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Actions', rows, this.GetUserFromPayload(userPayload));
11897
+ return result;
11898
+ }
11899
+
11900
+ @FieldResolver(() => [MJConversation_])
11901
+ async MJConversations_DefaultAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11902
+ this.CheckUserReadPermissions('MJ: Conversations', userPayload);
11903
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11904
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversations')} WHERE ${provider.QuoteIdentifier('DefaultAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversations', userPayload, EntityPermissionType.Read, 'AND');
11905
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11906
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversations', rows, this.GetUserFromPayload(userPayload));
11907
+ return result;
11908
+ }
11909
+
11910
+ @FieldResolver(() => [MJAIAgentSession_])
11911
+ async MJAIAgentSessions_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11912
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
11913
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11914
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
11915
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11916
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows, this.GetUserFromPayload(userPayload));
11917
+ return result;
11918
+ }
11919
+
11920
+ @FieldResolver(() => [MJAIAgent_])
11921
+ async MJAIAgents_DefaultCoAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11922
+ this.CheckUserReadPermissions('MJ: AI Agents', userPayload);
11923
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11924
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgents')} WHERE ${provider.QuoteIdentifier('DefaultCoAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agents', userPayload, EntityPermissionType.Read, 'AND');
11925
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11926
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agents', rows, this.GetUserFromPayload(userPayload));
11927
+ return result;
11928
+ }
11929
+
11930
+ @FieldResolver(() => [MJAIAgentCoAgent_])
11931
+ async MJAIAgentCoAgents_CoAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11932
+ this.CheckUserReadPermissions('MJ: AI Agent Co Agents', userPayload);
11933
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11934
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentCoAgents')} WHERE ${provider.QuoteIdentifier('CoAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Co Agents', userPayload, EntityPermissionType.Read, 'AND');
11935
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11936
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Co Agents', rows, this.GetUserFromPayload(userPayload));
11937
+ return result;
11938
+ }
11939
+
11940
+ @FieldResolver(() => [MJAIAgentCoAgent_])
11941
+ async MJAIAgentCoAgents_TargetAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11942
+ this.CheckUserReadPermissions('MJ: AI Agent Co Agents', userPayload);
11943
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11944
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentCoAgents')} WHERE ${provider.QuoteIdentifier('TargetAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Co Agents', userPayload, EntityPermissionType.Read, 'AND');
11945
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11946
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Co Agents', rows, this.GetUserFromPayload(userPayload));
11947
+ return result;
11948
+ }
11949
+
11950
+ @FieldResolver(() => [MJAIBridgeAgentIdentity_])
11951
+ async MJAIBridgeAgentIdentities_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11952
+ this.CheckUserReadPermissions('MJ: AI Bridge Agent Identities', userPayload);
11953
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11954
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeAgentIdentities')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Agent Identities', userPayload, EntityPermissionType.Read, 'AND');
11955
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
11956
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Bridge Agent Identities', rows, this.GetUserFromPayload(userPayload));
11957
+ return result;
11958
+ }
11959
+
11960
+ @Mutation(() => MJAIAgent_)
11961
+ async CreateMJAIAgent(
11962
+ @Arg('input', () => CreateMJAIAgentInput) input: CreateMJAIAgentInput,
11963
+ @Ctx() { providers, userPayload }: AppContext,
11964
+ @PubSub() pubSub: PubSubEngine
11965
+ ) {
11966
+ const provider = GetReadWriteProvider(providers);
11967
+ return this.CreateRecord('MJ: AI Agents', input, provider, userPayload, pubSub)
11968
+ }
11969
+
11970
+ @Mutation(() => MJAIAgent_)
11971
+ async UpdateMJAIAgent(
11972
+ @Arg('input', () => UpdateMJAIAgentInput) input: UpdateMJAIAgentInput,
11973
+ @Ctx() { providers, userPayload }: AppContext,
11974
+ @PubSub() pubSub: PubSubEngine
11975
+ ) {
11976
+ const provider = GetReadWriteProvider(providers);
11977
+ return this.UpdateRecord('MJ: AI Agents', input, provider, userPayload, pubSub);
11978
+ }
11979
+
11980
+ @Mutation(() => MJAIAgent_)
11981
+ async DeleteMJAIAgent(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
11982
+ const provider = GetReadWriteProvider(providers);
11983
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
11984
+ return this.DeleteRecord('MJ: AI Agents', key, options, provider, userPayload, pubSub);
11985
+ }
11986
+
11987
+ }
11988
+
11989
+ //****************************************************************************
11990
+ // ENTITY CLASS for MJ: AI Architectures
11991
+ //****************************************************************************
11992
+ @ObjectType({ description: `Master table of AI model architectures (Transformer, Diffusion, MoE, etc.) for model catalog enrichment and eval reporting.` })
11993
+ export class MJAIArchitecture_ {
11994
+ @Field()
11995
+ @MaxLength(36)
11996
+ ID: string;
11997
+
11998
+ @Field()
11999
+ @MaxLength(100)
12000
+ Name: string;
12001
+
12002
+ @Field({nullable: true})
12003
+ Description?: string;
12004
+
12005
+ @Field()
12006
+ @MaxLength(50)
12007
+ Category: string;
12008
+
12009
+ @Field({nullable: true, description: `Hierarchical relationship to parent architecture. Used for variants like Sparse Transformer being a child of Transformer.`})
12010
+ @MaxLength(36)
12011
+ ParentArchitectureID?: string;
12012
+
12013
+ @Field({nullable: true})
12014
+ @MaxLength(500)
12015
+ WikipediaURL?: string;
12016
+
12017
+ @Field(() => Int, {nullable: true})
12018
+ YearIntroduced?: number;
12019
+
12020
+ @Field({nullable: true})
12021
+ @MaxLength(500)
12022
+ KeyPaper?: string;
12023
+
12024
+ @Field()
12025
+ _mj__CreatedAt: Date;
12026
+
12027
+ @Field()
12028
+ _mj__UpdatedAt: Date;
12029
+
12030
+ @Field({nullable: true})
12031
+ @MaxLength(100)
12032
+ ParentArchitecture?: string;
12033
+
12034
+ @Field({nullable: true})
12035
+ @MaxLength(36)
12036
+ RootParentArchitectureID?: string;
12037
+
12038
+ @Field(() => [MJAIArchitecture_])
12039
+ MJAIArchitectures_ParentArchitectureIDArray: MJAIArchitecture_[]; // Link to MJAIArchitectures
12040
+
12041
+ @Field(() => [MJAIModelArchitecture_])
12042
+ MJAIModelArchitectures_ArchitectureIDArray: MJAIModelArchitecture_[]; // Link to MJAIModelArchitectures
12043
+
12044
+ }
12045
+
12046
+ //****************************************************************************
12047
+ // INPUT TYPE for MJ: AI Architectures
12048
+ //****************************************************************************
12049
+ @InputType()
12050
+ export class CreateMJAIArchitectureInput {
12051
+ @Field({ nullable: true })
12052
+ ID?: string;
12053
+
12054
+ @Field({ nullable: true })
12055
+ Name?: string;
12056
+
12057
+ @Field({ nullable: true })
12058
+ Description: string | null;
12059
+
12060
+ @Field({ nullable: true })
12061
+ Category?: string;
12062
+
12063
+ @Field({ nullable: true })
12064
+ ParentArchitectureID: string | null;
12065
+
12066
+ @Field({ nullable: true })
12067
+ WikipediaURL: string | null;
12068
+
12069
+ @Field(() => Int, { nullable: true })
12070
+ YearIntroduced: number | null;
12071
+
12072
+ @Field({ nullable: true })
12073
+ KeyPaper: string | null;
12074
+
12075
+ @Field(() => RestoreContextInput, { nullable: true })
12076
+ RestoreContext___?: RestoreContextInput;
12077
+ }
12078
+
12079
+
12080
+ //****************************************************************************
12081
+ // INPUT TYPE for MJ: AI Architectures
12082
+ //****************************************************************************
12083
+ @InputType()
12084
+ export class UpdateMJAIArchitectureInput {
12085
+ @Field()
12086
+ ID: string;
12087
+
12088
+ @Field({ nullable: true })
12089
+ Name?: string;
12090
+
12091
+ @Field({ nullable: true })
12092
+ Description?: string | null;
12093
+
12094
+ @Field({ nullable: true })
12095
+ Category?: string;
12096
+
12097
+ @Field({ nullable: true })
12098
+ ParentArchitectureID?: string | null;
12099
+
12100
+ @Field({ nullable: true })
12101
+ WikipediaURL?: string | null;
12102
+
12103
+ @Field(() => Int, { nullable: true })
12104
+ YearIntroduced?: number | null;
12105
+
12106
+ @Field({ nullable: true })
12107
+ KeyPaper?: string | null;
12108
+
12109
+ @Field(() => [KeyValuePairInput], { nullable: true })
12110
+ OldValues___?: KeyValuePairInput[];
12111
+
12112
+ @Field(() => RestoreContextInput, { nullable: true })
12113
+ RestoreContext___?: RestoreContextInput;
12114
+ }
12115
+
12116
+ //****************************************************************************
12117
+ // RESOLVER for MJ: AI Architectures
12118
+ //****************************************************************************
12119
+ @ObjectType()
12120
+ export class RunMJAIArchitectureViewResult {
12121
+ @Field(() => [MJAIArchitecture_])
12122
+ Results: MJAIArchitecture_[];
12123
+
12124
+ @Field(() => String, {nullable: true})
12125
+ UserViewRunID?: string;
12126
+
12127
+ @Field(() => Int, {nullable: true})
12128
+ RowCount: number;
12129
+
12130
+ @Field(() => Int, {nullable: true})
12131
+ TotalRowCount: number;
12132
+
12133
+ @Field(() => Int, {nullable: true})
12134
+ ExecutionTime: number;
12135
+
12136
+ @Field({nullable: true})
12137
+ ErrorMessage?: string;
12138
+
12139
+ @Field(() => Boolean, {nullable: false})
12140
+ Success: boolean;
12141
+ }
12142
+
12143
+ @Resolver(MJAIArchitecture_)
12144
+ export class MJAIArchitectureResolver extends ResolverBase {
12145
+ @Query(() => RunMJAIArchitectureViewResult)
12146
+ async RunMJAIArchitectureViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12147
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12148
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
12149
+ }
12150
+
12151
+ @Query(() => RunMJAIArchitectureViewResult)
12152
+ async RunMJAIArchitectureViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12153
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12154
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
12155
+ }
12156
+
12157
+ @Query(() => RunMJAIArchitectureViewResult)
12158
+ async RunMJAIArchitectureDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12159
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12160
+ input.EntityName = 'MJ: AI Architectures';
12161
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
12162
+ }
12163
+ @Query(() => MJAIArchitecture_, { nullable: true })
12164
+ async MJAIArchitecture(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIArchitecture_ | null> {
12165
+ this.CheckUserReadPermissions('MJ: AI Architectures', userPayload);
12166
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12167
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIArchitectures')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Architectures', userPayload, EntityPermissionType.Read, 'AND');
12168
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
12169
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Architectures', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
12170
+ return result;
12171
+ }
12172
+
12173
+ @FieldResolver(() => [MJAIArchitecture_])
12174
+ async MJAIArchitectures_ParentArchitectureIDArray(@Root() mjaiarchitecture_: MJAIArchitecture_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12175
+ this.CheckUserReadPermissions('MJ: AI Architectures', userPayload);
12176
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12177
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIArchitectures')} WHERE ${provider.QuoteIdentifier('ParentArchitectureID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Architectures', userPayload, EntityPermissionType.Read, 'AND');
12178
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiarchitecture_.ID], undefined, this.GetUserFromPayload(userPayload));
12179
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Architectures', rows, this.GetUserFromPayload(userPayload));
12180
+ return result;
12181
+ }
12182
+
12183
+ @FieldResolver(() => [MJAIModelArchitecture_])
12184
+ async MJAIModelArchitectures_ArchitectureIDArray(@Root() mjaiarchitecture_: MJAIArchitecture_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12185
+ this.CheckUserReadPermissions('MJ: AI Model Architectures', userPayload);
12186
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12187
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIModelArchitectures')} WHERE ${provider.QuoteIdentifier('ArchitectureID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Model Architectures', userPayload, EntityPermissionType.Read, 'AND');
12188
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiarchitecture_.ID], undefined, this.GetUserFromPayload(userPayload));
12189
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Architectures', rows, this.GetUserFromPayload(userPayload));
12190
+ return result;
12191
+ }
12192
+
12193
+ @Mutation(() => MJAIArchitecture_)
12194
+ async CreateMJAIArchitecture(
12195
+ @Arg('input', () => CreateMJAIArchitectureInput) input: CreateMJAIArchitectureInput,
12196
+ @Ctx() { providers, userPayload }: AppContext,
12197
+ @PubSub() pubSub: PubSubEngine
12198
+ ) {
12199
+ const provider = GetReadWriteProvider(providers);
12200
+ return this.CreateRecord('MJ: AI Architectures', input, provider, userPayload, pubSub)
12201
+ }
12202
+
12203
+ @Mutation(() => MJAIArchitecture_)
12204
+ async UpdateMJAIArchitecture(
12205
+ @Arg('input', () => UpdateMJAIArchitectureInput) input: UpdateMJAIArchitectureInput,
12206
+ @Ctx() { providers, userPayload }: AppContext,
12207
+ @PubSub() pubSub: PubSubEngine
12208
+ ) {
12209
+ const provider = GetReadWriteProvider(providers);
12210
+ return this.UpdateRecord('MJ: AI Architectures', input, provider, userPayload, pubSub);
12211
+ }
12212
+
12213
+ @Mutation(() => MJAIArchitecture_)
12214
+ async DeleteMJAIArchitecture(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12215
+ const provider = GetReadWriteProvider(providers);
12216
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
12217
+ return this.DeleteRecord('MJ: AI Architectures', key, options, provider, userPayload, pubSub);
12218
+ }
12219
+
12220
+ }
12221
+
12222
+ //****************************************************************************
12223
+ // ENTITY CLASS for MJ: AI Bridge Agent Identities
12224
+ //****************************************************************************
12225
+ @ObjectType()
12226
+ export class MJAIBridgeAgentIdentity_ {
12227
+ @Field()
12228
+ @MaxLength(36)
12229
+ ID: string;
12230
+
12231
+ @Field()
12232
+ @MaxLength(36)
12233
+ AgentID: string;
12234
+
12235
+ @Field()
12236
+ @MaxLength(36)
12237
+ ProviderID: string;
12238
+
12239
+ @Field({description: `The kind of address: Email (a calendar mailbox organizers invite), PhoneNumber (an inbound DID), or AccountID (a platform-native bot/user account).`})
12240
+ @MaxLength(20)
12241
+ IdentityType: string;
12242
+
12243
+ @Field({description: `The address value itself (e.g. sage@customer.com, +15551234567, or a platform account id). Unique per provider.`})
12244
+ @MaxLength(500)
12245
+ IdentityValue: string;
12246
+
12247
+ @Field({nullable: true, description: `Friendly display name shown to other participants (e.g. "Sage (AI)").`})
12248
+ @MaxLength(255)
12249
+ DisplayName?: string;
12250
+
12251
+ @Field(() => Boolean, {description: `Whether this identity is active. Inactive identities are ignored by invite watchers and inbound routing.`})
12252
+ IsActive: boolean;
12253
+
12254
+ @Field({nullable: true, description: `Identity-level configuration JSON (e.g. tenant/mailbox references, calendar-watch scopes). Credentials resolve via the MJ credential system; never inline.`})
12255
+ Configuration?: string;
12256
+
12257
+ @Field()
12258
+ _mj__CreatedAt: Date;
12259
+
12260
+ @Field()
12261
+ _mj__UpdatedAt: Date;
12262
+
12263
+ @Field({nullable: true})
12264
+ @MaxLength(255)
12265
+ Agent?: string;
12266
+
12267
+ @Field()
12268
+ @MaxLength(100)
12269
+ Provider: string;
12270
+
12271
+ }
12272
+
12273
+ //****************************************************************************
12274
+ // INPUT TYPE for MJ: AI Bridge Agent Identities
12275
+ //****************************************************************************
12276
+ @InputType()
12277
+ export class CreateMJAIBridgeAgentIdentityInput {
12278
+ @Field({ nullable: true })
12279
+ ID?: string;
12280
+
12281
+ @Field({ nullable: true })
12282
+ AgentID?: string;
12283
+
12284
+ @Field({ nullable: true })
12285
+ ProviderID?: string;
12286
+
12287
+ @Field({ nullable: true })
12288
+ IdentityType?: string;
12289
+
12290
+ @Field({ nullable: true })
12291
+ IdentityValue?: string;
12292
+
12293
+ @Field({ nullable: true })
12294
+ DisplayName: string | null;
12295
+
12296
+ @Field(() => Boolean, { nullable: true })
12297
+ IsActive?: boolean;
12298
+
12299
+ @Field({ nullable: true })
12300
+ Configuration: string | null;
12301
+
12302
+ @Field(() => RestoreContextInput, { nullable: true })
12303
+ RestoreContext___?: RestoreContextInput;
12304
+ }
12305
+
12306
+
12307
+ //****************************************************************************
12308
+ // INPUT TYPE for MJ: AI Bridge Agent Identities
12309
+ //****************************************************************************
12310
+ @InputType()
12311
+ export class UpdateMJAIBridgeAgentIdentityInput {
12312
+ @Field()
12313
+ ID: string;
12314
+
12315
+ @Field({ nullable: true })
12316
+ AgentID?: string;
12317
+
12318
+ @Field({ nullable: true })
12319
+ ProviderID?: string;
12320
+
12321
+ @Field({ nullable: true })
12322
+ IdentityType?: string;
12323
+
12324
+ @Field({ nullable: true })
12325
+ IdentityValue?: string;
12326
+
12327
+ @Field({ nullable: true })
12328
+ DisplayName?: string | null;
12329
+
12330
+ @Field(() => Boolean, { nullable: true })
12331
+ IsActive?: boolean;
12332
+
12333
+ @Field({ nullable: true })
12334
+ Configuration?: string | null;
12335
+
12336
+ @Field(() => [KeyValuePairInput], { nullable: true })
12337
+ OldValues___?: KeyValuePairInput[];
12338
+
12339
+ @Field(() => RestoreContextInput, { nullable: true })
12340
+ RestoreContext___?: RestoreContextInput;
12341
+ }
12342
+
12343
+ //****************************************************************************
12344
+ // RESOLVER for MJ: AI Bridge Agent Identities
12345
+ //****************************************************************************
12346
+ @ObjectType()
12347
+ export class RunMJAIBridgeAgentIdentityViewResult {
12348
+ @Field(() => [MJAIBridgeAgentIdentity_])
12349
+ Results: MJAIBridgeAgentIdentity_[];
12350
+
12351
+ @Field(() => String, {nullable: true})
12352
+ UserViewRunID?: string;
12353
+
12354
+ @Field(() => Int, {nullable: true})
12355
+ RowCount: number;
12356
+
12357
+ @Field(() => Int, {nullable: true})
12358
+ TotalRowCount: number;
12359
+
12360
+ @Field(() => Int, {nullable: true})
12361
+ ExecutionTime: number;
12362
+
12363
+ @Field({nullable: true})
12364
+ ErrorMessage?: string;
12365
+
12366
+ @Field(() => Boolean, {nullable: false})
12367
+ Success: boolean;
12368
+ }
12369
+
12370
+ @Resolver(MJAIBridgeAgentIdentity_)
12371
+ export class MJAIBridgeAgentIdentityResolver extends ResolverBase {
12372
+ @Query(() => RunMJAIBridgeAgentIdentityViewResult)
12373
+ async RunMJAIBridgeAgentIdentityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12374
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12375
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
12376
+ }
12377
+
12378
+ @Query(() => RunMJAIBridgeAgentIdentityViewResult)
12379
+ async RunMJAIBridgeAgentIdentityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12380
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12381
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
12382
+ }
12383
+
12384
+ @Query(() => RunMJAIBridgeAgentIdentityViewResult)
12385
+ async RunMJAIBridgeAgentIdentityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12386
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12387
+ input.EntityName = 'MJ: AI Bridge Agent Identities';
12388
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
12389
+ }
12390
+ @Query(() => MJAIBridgeAgentIdentity_, { nullable: true })
12391
+ async MJAIBridgeAgentIdentity(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIBridgeAgentIdentity_ | null> {
12392
+ this.CheckUserReadPermissions('MJ: AI Bridge Agent Identities', userPayload);
10281
12393
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10282
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIPromptRuns')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
10283
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10284
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows, this.GetUserFromPayload(userPayload));
12394
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeAgentIdentities')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Agent Identities', userPayload, EntityPermissionType.Read, 'AND');
12395
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
12396
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Bridge Agent Identities', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10285
12397
  return result;
10286
12398
  }
12399
+
12400
+ @Mutation(() => MJAIBridgeAgentIdentity_)
12401
+ async CreateMJAIBridgeAgentIdentity(
12402
+ @Arg('input', () => CreateMJAIBridgeAgentIdentityInput) input: CreateMJAIBridgeAgentIdentityInput,
12403
+ @Ctx() { providers, userPayload }: AppContext,
12404
+ @PubSub() pubSub: PubSubEngine
12405
+ ) {
12406
+ const provider = GetReadWriteProvider(providers);
12407
+ return this.CreateRecord('MJ: AI Bridge Agent Identities', input, provider, userPayload, pubSub)
12408
+ }
10287
12409
 
10288
- @FieldResolver(() => [MJAIResultCache_])
10289
- async MJAIResultCache_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10290
- this.CheckUserReadPermissions('MJ: AI Result Cache', userPayload);
10291
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10292
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIResultCaches')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
10293
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10294
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Result Cache', rows, this.GetUserFromPayload(userPayload));
10295
- return result;
12410
+ @Mutation(() => MJAIBridgeAgentIdentity_)
12411
+ async UpdateMJAIBridgeAgentIdentity(
12412
+ @Arg('input', () => UpdateMJAIBridgeAgentIdentityInput) input: UpdateMJAIBridgeAgentIdentityInput,
12413
+ @Ctx() { providers, userPayload }: AppContext,
12414
+ @PubSub() pubSub: PubSubEngine
12415
+ ) {
12416
+ const provider = GetReadWriteProvider(providers);
12417
+ return this.UpdateRecord('MJ: AI Bridge Agent Identities', input, provider, userPayload, pubSub);
12418
+ }
12419
+
12420
+ @Mutation(() => MJAIBridgeAgentIdentity_)
12421
+ async DeleteMJAIBridgeAgentIdentity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12422
+ const provider = GetReadWriteProvider(providers);
12423
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
12424
+ return this.DeleteRecord('MJ: AI Bridge Agent Identities', key, options, provider, userPayload, pubSub);
10296
12425
  }
12426
+
12427
+ }
12428
+
12429
+ //****************************************************************************
12430
+ // ENTITY CLASS for MJ: AI Bridge Provider Channels
12431
+ //****************************************************************************
12432
+ @ObjectType()
12433
+ export class MJAIBridgeProviderChannel_ {
12434
+ @Field()
12435
+ @MaxLength(36)
12436
+ ID: string;
10297
12437
 
10298
- @FieldResolver(() => [MJConversationDetail_])
10299
- async MJConversationDetails_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10300
- this.CheckUserReadPermissions('MJ: Conversation Details', userPayload);
12438
+ @Field()
12439
+ @MaxLength(36)
12440
+ ProviderID: string;
12441
+
12442
+ @Field()
12443
+ @MaxLength(36)
12444
+ ChannelID: string;
12445
+
12446
+ @Field(() => Boolean, {description: `When 1, this channel is auto-attached to a new bridge session on this provider; when 0, it is available but attached on demand.`})
12447
+ IsDefault: boolean;
12448
+
12449
+ @Field(() => Int, {description: `Display/attachment order of this channel for the provider (ascending).`})
12450
+ Sequence: number;
12451
+
12452
+ @Field({nullable: true, description: `Optional per-provider configuration JSON for this channel contribution (e.g. mapping platform tool names to the channel's tool vocabulary).`})
12453
+ Configuration?: string;
12454
+
12455
+ @Field()
12456
+ _mj__CreatedAt: Date;
12457
+
12458
+ @Field()
12459
+ _mj__UpdatedAt: Date;
12460
+
12461
+ @Field()
12462
+ @MaxLength(100)
12463
+ Provider: string;
12464
+
12465
+ @Field()
12466
+ @MaxLength(100)
12467
+ Channel: string;
12468
+
12469
+ }
12470
+
12471
+ //****************************************************************************
12472
+ // INPUT TYPE for MJ: AI Bridge Provider Channels
12473
+ //****************************************************************************
12474
+ @InputType()
12475
+ export class CreateMJAIBridgeProviderChannelInput {
12476
+ @Field({ nullable: true })
12477
+ ID?: string;
12478
+
12479
+ @Field({ nullable: true })
12480
+ ProviderID?: string;
12481
+
12482
+ @Field({ nullable: true })
12483
+ ChannelID?: string;
12484
+
12485
+ @Field(() => Boolean, { nullable: true })
12486
+ IsDefault?: boolean;
12487
+
12488
+ @Field(() => Int, { nullable: true })
12489
+ Sequence?: number;
12490
+
12491
+ @Field({ nullable: true })
12492
+ Configuration: string | null;
12493
+
12494
+ @Field(() => RestoreContextInput, { nullable: true })
12495
+ RestoreContext___?: RestoreContextInput;
12496
+ }
12497
+
12498
+
12499
+ //****************************************************************************
12500
+ // INPUT TYPE for MJ: AI Bridge Provider Channels
12501
+ //****************************************************************************
12502
+ @InputType()
12503
+ export class UpdateMJAIBridgeProviderChannelInput {
12504
+ @Field()
12505
+ ID: string;
12506
+
12507
+ @Field({ nullable: true })
12508
+ ProviderID?: string;
12509
+
12510
+ @Field({ nullable: true })
12511
+ ChannelID?: string;
12512
+
12513
+ @Field(() => Boolean, { nullable: true })
12514
+ IsDefault?: boolean;
12515
+
12516
+ @Field(() => Int, { nullable: true })
12517
+ Sequence?: number;
12518
+
12519
+ @Field({ nullable: true })
12520
+ Configuration?: string | null;
12521
+
12522
+ @Field(() => [KeyValuePairInput], { nullable: true })
12523
+ OldValues___?: KeyValuePairInput[];
12524
+
12525
+ @Field(() => RestoreContextInput, { nullable: true })
12526
+ RestoreContext___?: RestoreContextInput;
12527
+ }
12528
+
12529
+ //****************************************************************************
12530
+ // RESOLVER for MJ: AI Bridge Provider Channels
12531
+ //****************************************************************************
12532
+ @ObjectType()
12533
+ export class RunMJAIBridgeProviderChannelViewResult {
12534
+ @Field(() => [MJAIBridgeProviderChannel_])
12535
+ Results: MJAIBridgeProviderChannel_[];
12536
+
12537
+ @Field(() => String, {nullable: true})
12538
+ UserViewRunID?: string;
12539
+
12540
+ @Field(() => Int, {nullable: true})
12541
+ RowCount: number;
12542
+
12543
+ @Field(() => Int, {nullable: true})
12544
+ TotalRowCount: number;
12545
+
12546
+ @Field(() => Int, {nullable: true})
12547
+ ExecutionTime: number;
12548
+
12549
+ @Field({nullable: true})
12550
+ ErrorMessage?: string;
12551
+
12552
+ @Field(() => Boolean, {nullable: false})
12553
+ Success: boolean;
12554
+ }
12555
+
12556
+ @Resolver(MJAIBridgeProviderChannel_)
12557
+ export class MJAIBridgeProviderChannelResolver extends ResolverBase {
12558
+ @Query(() => RunMJAIBridgeProviderChannelViewResult)
12559
+ async RunMJAIBridgeProviderChannelViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10301
12560
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10302
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationDetails')} WHERE ${provider.QuoteIdentifier('AgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
10303
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10304
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Details', rows, this.GetUserFromPayload(userPayload));
10305
- return result;
12561
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
10306
12562
  }
10307
-
10308
- @FieldResolver(() => [MJAIAgent_])
10309
- async MJAIAgents_ParentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10310
- this.CheckUserReadPermissions('MJ: AI Agents', userPayload);
12563
+
12564
+ @Query(() => RunMJAIBridgeProviderChannelViewResult)
12565
+ async RunMJAIBridgeProviderChannelViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10311
12566
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10312
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgents')} WHERE ${provider.QuoteIdentifier('ParentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agents', userPayload, EntityPermissionType.Read, 'AND');
10313
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10314
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agents', rows, this.GetUserFromPayload(userPayload));
10315
- return result;
12567
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
10316
12568
  }
10317
-
10318
- @FieldResolver(() => [MJAction_])
10319
- async MJActions_CreatedByAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10320
- this.CheckUserReadPermissions('MJ: Actions', userPayload);
12569
+
12570
+ @Query(() => RunMJAIBridgeProviderChannelViewResult)
12571
+ async RunMJAIBridgeProviderChannelDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10321
12572
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10322
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwActions')} WHERE ${provider.QuoteIdentifier('CreatedByAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Actions', userPayload, EntityPermissionType.Read, 'AND');
10323
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10324
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Actions', rows, this.GetUserFromPayload(userPayload));
10325
- return result;
12573
+ input.EntityName = 'MJ: AI Bridge Provider Channels';
12574
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
10326
12575
  }
10327
-
10328
- @FieldResolver(() => [MJConversation_])
10329
- async MJConversations_DefaultAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10330
- this.CheckUserReadPermissions('MJ: Conversations', userPayload);
12576
+ @Query(() => MJAIBridgeProviderChannel_, { nullable: true })
12577
+ async MJAIBridgeProviderChannel(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIBridgeProviderChannel_ | null> {
12578
+ this.CheckUserReadPermissions('MJ: AI Bridge Provider Channels', userPayload);
10331
12579
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10332
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversations')} WHERE ${provider.QuoteIdentifier('DefaultAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversations', userPayload, EntityPermissionType.Read, 'AND');
10333
- const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
10334
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversations', rows, this.GetUserFromPayload(userPayload));
12580
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeProviderChannels')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Provider Channels', userPayload, EntityPermissionType.Read, 'AND');
12581
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
12582
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Bridge Provider Channels', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10335
12583
  return result;
10336
12584
  }
10337
-
10338
- @Mutation(() => MJAIAgent_)
10339
- async CreateMJAIAgent(
10340
- @Arg('input', () => CreateMJAIAgentInput) input: CreateMJAIAgentInput,
12585
+
12586
+ @Mutation(() => MJAIBridgeProviderChannel_)
12587
+ async CreateMJAIBridgeProviderChannel(
12588
+ @Arg('input', () => CreateMJAIBridgeProviderChannelInput) input: CreateMJAIBridgeProviderChannelInput,
10341
12589
  @Ctx() { providers, userPayload }: AppContext,
10342
12590
  @PubSub() pubSub: PubSubEngine
10343
12591
  ) {
10344
12592
  const provider = GetReadWriteProvider(providers);
10345
- return this.CreateRecord('MJ: AI Agents', input, provider, userPayload, pubSub)
12593
+ return this.CreateRecord('MJ: AI Bridge Provider Channels', input, provider, userPayload, pubSub)
10346
12594
  }
10347
12595
 
10348
- @Mutation(() => MJAIAgent_)
10349
- async UpdateMJAIAgent(
10350
- @Arg('input', () => UpdateMJAIAgentInput) input: UpdateMJAIAgentInput,
12596
+ @Mutation(() => MJAIBridgeProviderChannel_)
12597
+ async UpdateMJAIBridgeProviderChannel(
12598
+ @Arg('input', () => UpdateMJAIBridgeProviderChannelInput) input: UpdateMJAIBridgeProviderChannelInput,
10351
12599
  @Ctx() { providers, userPayload }: AppContext,
10352
12600
  @PubSub() pubSub: PubSubEngine
10353
12601
  ) {
10354
12602
  const provider = GetReadWriteProvider(providers);
10355
- return this.UpdateRecord('MJ: AI Agents', input, provider, userPayload, pubSub);
12603
+ return this.UpdateRecord('MJ: AI Bridge Provider Channels', input, provider, userPayload, pubSub);
10356
12604
  }
10357
12605
 
10358
- @Mutation(() => MJAIAgent_)
10359
- async DeleteMJAIAgent(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12606
+ @Mutation(() => MJAIBridgeProviderChannel_)
12607
+ async DeleteMJAIBridgeProviderChannel(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10360
12608
  const provider = GetReadWriteProvider(providers);
10361
12609
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
10362
- return this.DeleteRecord('MJ: AI Agents', key, options, provider, userPayload, pubSub);
12610
+ return this.DeleteRecord('MJ: AI Bridge Provider Channels', key, options, provider, userPayload, pubSub);
10363
12611
  }
10364
12612
 
10365
12613
  }
10366
12614
 
10367
12615
  //****************************************************************************
10368
- // ENTITY CLASS for MJ: AI Architectures
12616
+ // ENTITY CLASS for MJ: AI Bridge Providers
10369
12617
  //****************************************************************************
10370
- @ObjectType({ description: `Master table of AI model architectures (Transformer, Diffusion, MoE, etc.) for model catalog enrichment and eval reporting.` })
10371
- export class MJAIArchitecture_ {
12618
+ @ObjectType()
12619
+ export class MJAIBridgeProvider_ {
10372
12620
  @Field()
10373
12621
  @MaxLength(36)
10374
12622
  ID: string;
10375
12623
 
10376
- @Field()
12624
+ @Field({description: `Unique platform name (e.g. Zoom, Microsoft Teams, Google Meet, Webex, Slack, Discord, RingCentral, Twilio, Vonage, LiveKit).`})
10377
12625
  @MaxLength(100)
10378
12626
  Name: string;
10379
12627
 
10380
- @Field({nullable: true})
12628
+ @Field({nullable: true, description: `Optional human-readable description of the platform / driver.`})
12629
+ @MaxLength(1000)
10381
12630
  Description?: string;
10382
12631
 
10383
- @Field()
10384
- @MaxLength(50)
10385
- Category: string;
12632
+ @Field({description: `The family of endpoint this bridge connects to: Meeting (a conferencing room) or Telephony (a phone call). LiveKit (MJ-native multi-party room) is a Meeting.`})
12633
+ @MaxLength(20)
12634
+ BridgeType: string;
10386
12635
 
10387
- @Field({nullable: true, description: `Hierarchical relationship to parent architecture. Used for variants like Sparse Transformer being a child of Transformer.`})
10388
- @MaxLength(36)
10389
- ParentArchitectureID?: string;
12636
+ @Field({description: `Driver key resolved at runtime via MJGlobal.ClassFactory.CreateInstance(BaseRealtimeBridge, DriverClass). MUST match the @RegisterClass key on the concrete bridge driver.`})
12637
+ @MaxLength(250)
12638
+ DriverClass: string;
10390
12639
 
10391
- @Field({nullable: true})
10392
- @MaxLength(500)
10393
- WikipediaURL?: string;
12640
+ @Field({description: `Whether this provider is available for use. Inactive providers cannot start new bridge sessions.`})
12641
+ @MaxLength(20)
12642
+ Status: string;
10394
12643
 
10395
- @Field(() => Int, {nullable: true})
10396
- YearIntroduced?: number;
12644
+ @Field({nullable: true, description: `Strongly-typed JSON of the platform's supported features (the IBridgeProviderFeatures interface, bound via JSONType metadata): join methods (OnDemandJoin, ScheduledJoin, InviteJoin, NativeInvite, InboundRouting, OutboundDial), directional media tracks (AudioIn/Out, VideoIn/Out, ScreenIn/Out), and signals (SpeakerDiarization, DTMF, CallTransfer, Recording). The engine gates optional driver calls on these flags; the base driver throws BridgeCapabilityNotSupportedError when a feature is claimed but unimplemented. Held as JSON so new features need no schema change. NULL/omitted = unsupported.`})
12645
+ SupportedFeatures?: string;
10397
12646
 
10398
- @Field({nullable: true})
10399
- @MaxLength(500)
10400
- KeyPaper?: string;
12647
+ @Field({nullable: true, description: `Optional JSON Schema validating the provider Configuration and per-session bridge Config payloads.`})
12648
+ ConfigSchema?: string;
12649
+
12650
+ @Field({nullable: true, description: `Provider-level configuration JSON (e.g. credential references resolved via the MJ credential system, region, bot display name). Never store secrets inline.`})
12651
+ Configuration?: string;
10401
12652
 
10402
12653
  @Field()
10403
12654
  _mj__CreatedAt: Date;
@@ -10405,27 +12656,22 @@ export class MJAIArchitecture_ {
10405
12656
  @Field()
10406
12657
  _mj__UpdatedAt: Date;
10407
12658
 
10408
- @Field({nullable: true})
10409
- @MaxLength(100)
10410
- ParentArchitecture?: string;
10411
-
10412
- @Field({nullable: true})
10413
- @MaxLength(36)
10414
- RootParentArchitectureID?: string;
10415
-
10416
- @Field(() => [MJAIArchitecture_])
10417
- MJAIArchitectures_ParentArchitectureIDArray: MJAIArchitecture_[]; // Link to MJAIArchitectures
12659
+ @Field(() => [MJAIAgentSessionBridge_])
12660
+ MJAIAgentSessionBridges_ProviderIDArray: MJAIAgentSessionBridge_[]; // Link to MJAIAgentSessionBridges
10418
12661
 
10419
- @Field(() => [MJAIModelArchitecture_])
10420
- MJAIModelArchitectures_ArchitectureIDArray: MJAIModelArchitecture_[]; // Link to MJAIModelArchitectures
12662
+ @Field(() => [MJAIBridgeProviderChannel_])
12663
+ MJAIBridgeProviderChannels_ProviderIDArray: MJAIBridgeProviderChannel_[]; // Link to MJAIBridgeProviderChannels
12664
+
12665
+ @Field(() => [MJAIBridgeAgentIdentity_])
12666
+ MJAIBridgeAgentIdentities_ProviderIDArray: MJAIBridgeAgentIdentity_[]; // Link to MJAIBridgeAgentIdentities
10421
12667
 
10422
12668
  }
10423
12669
 
10424
12670
  //****************************************************************************
10425
- // INPUT TYPE for MJ: AI Architectures
12671
+ // INPUT TYPE for MJ: AI Bridge Providers
10426
12672
  //****************************************************************************
10427
12673
  @InputType()
10428
- export class CreateMJAIArchitectureInput {
12674
+ export class CreateMJAIBridgeProviderInput {
10429
12675
  @Field({ nullable: true })
10430
12676
  ID?: string;
10431
12677
 
@@ -10436,19 +12682,22 @@ export class CreateMJAIArchitectureInput {
10436
12682
  Description: string | null;
10437
12683
 
10438
12684
  @Field({ nullable: true })
10439
- Category?: string;
12685
+ BridgeType?: string;
10440
12686
 
10441
12687
  @Field({ nullable: true })
10442
- ParentArchitectureID: string | null;
12688
+ DriverClass?: string;
10443
12689
 
10444
12690
  @Field({ nullable: true })
10445
- WikipediaURL: string | null;
12691
+ Status?: string;
10446
12692
 
10447
- @Field(() => Int, { nullable: true })
10448
- YearIntroduced: number | null;
12693
+ @Field({ nullable: true })
12694
+ SupportedFeatures: string | null;
10449
12695
 
10450
12696
  @Field({ nullable: true })
10451
- KeyPaper: string | null;
12697
+ ConfigSchema: string | null;
12698
+
12699
+ @Field({ nullable: true })
12700
+ Configuration: string | null;
10452
12701
 
10453
12702
  @Field(() => RestoreContextInput, { nullable: true })
10454
12703
  RestoreContext___?: RestoreContextInput;
@@ -10456,10 +12705,10 @@ export class CreateMJAIArchitectureInput {
10456
12705
 
10457
12706
 
10458
12707
  //****************************************************************************
10459
- // INPUT TYPE for MJ: AI Architectures
12708
+ // INPUT TYPE for MJ: AI Bridge Providers
10460
12709
  //****************************************************************************
10461
12710
  @InputType()
10462
- export class UpdateMJAIArchitectureInput {
12711
+ export class UpdateMJAIBridgeProviderInput {
10463
12712
  @Field()
10464
12713
  ID: string;
10465
12714
 
@@ -10470,19 +12719,22 @@ export class UpdateMJAIArchitectureInput {
10470
12719
  Description?: string | null;
10471
12720
 
10472
12721
  @Field({ nullable: true })
10473
- Category?: string;
12722
+ BridgeType?: string;
10474
12723
 
10475
12724
  @Field({ nullable: true })
10476
- ParentArchitectureID?: string | null;
12725
+ DriverClass?: string;
10477
12726
 
10478
12727
  @Field({ nullable: true })
10479
- WikipediaURL?: string | null;
12728
+ Status?: string;
10480
12729
 
10481
- @Field(() => Int, { nullable: true })
10482
- YearIntroduced?: number | null;
12730
+ @Field({ nullable: true })
12731
+ SupportedFeatures?: string | null;
10483
12732
 
10484
12733
  @Field({ nullable: true })
10485
- KeyPaper?: string | null;
12734
+ ConfigSchema?: string | null;
12735
+
12736
+ @Field({ nullable: true })
12737
+ Configuration?: string | null;
10486
12738
 
10487
12739
  @Field(() => [KeyValuePairInput], { nullable: true })
10488
12740
  OldValues___?: KeyValuePairInput[];
@@ -10492,12 +12744,12 @@ export class UpdateMJAIArchitectureInput {
10492
12744
  }
10493
12745
 
10494
12746
  //****************************************************************************
10495
- // RESOLVER for MJ: AI Architectures
12747
+ // RESOLVER for MJ: AI Bridge Providers
10496
12748
  //****************************************************************************
10497
12749
  @ObjectType()
10498
- export class RunMJAIArchitectureViewResult {
10499
- @Field(() => [MJAIArchitecture_])
10500
- Results: MJAIArchitecture_[];
12750
+ export class RunMJAIBridgeProviderViewResult {
12751
+ @Field(() => [MJAIBridgeProvider_])
12752
+ Results: MJAIBridgeProvider_[];
10501
12753
 
10502
12754
  @Field(() => String, {nullable: true})
10503
12755
  UserViewRunID?: string;
@@ -10518,81 +12770,91 @@ export class RunMJAIArchitectureViewResult {
10518
12770
  Success: boolean;
10519
12771
  }
10520
12772
 
10521
- @Resolver(MJAIArchitecture_)
10522
- export class MJAIArchitectureResolver extends ResolverBase {
10523
- @Query(() => RunMJAIArchitectureViewResult)
10524
- async RunMJAIArchitectureViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12773
+ @Resolver(MJAIBridgeProvider_)
12774
+ export class MJAIBridgeProviderResolver extends ResolverBase {
12775
+ @Query(() => RunMJAIBridgeProviderViewResult)
12776
+ async RunMJAIBridgeProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10525
12777
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10526
12778
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
10527
12779
  }
10528
12780
 
10529
- @Query(() => RunMJAIArchitectureViewResult)
10530
- async RunMJAIArchitectureViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12781
+ @Query(() => RunMJAIBridgeProviderViewResult)
12782
+ async RunMJAIBridgeProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10531
12783
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10532
12784
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
10533
12785
  }
10534
12786
 
10535
- @Query(() => RunMJAIArchitectureViewResult)
10536
- async RunMJAIArchitectureDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12787
+ @Query(() => RunMJAIBridgeProviderViewResult)
12788
+ async RunMJAIBridgeProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10537
12789
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10538
- input.EntityName = 'MJ: AI Architectures';
12790
+ input.EntityName = 'MJ: AI Bridge Providers';
10539
12791
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
10540
12792
  }
10541
- @Query(() => MJAIArchitecture_, { nullable: true })
10542
- async MJAIArchitecture(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIArchitecture_ | null> {
10543
- this.CheckUserReadPermissions('MJ: AI Architectures', userPayload);
12793
+ @Query(() => MJAIBridgeProvider_, { nullable: true })
12794
+ async MJAIBridgeProvider(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIBridgeProvider_ | null> {
12795
+ this.CheckUserReadPermissions('MJ: AI Bridge Providers', userPayload);
10544
12796
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10545
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIArchitectures')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Architectures', userPayload, EntityPermissionType.Read, 'AND');
12797
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeProviders')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Providers', userPayload, EntityPermissionType.Read, 'AND');
10546
12798
  const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
10547
- const result = await this.MapFieldNamesToCodeNames('MJ: AI Architectures', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
12799
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Bridge Providers', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
10548
12800
  return result;
10549
12801
  }
10550
12802
 
10551
- @FieldResolver(() => [MJAIArchitecture_])
10552
- async MJAIArchitectures_ParentArchitectureIDArray(@Root() mjaiarchitecture_: MJAIArchitecture_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10553
- this.CheckUserReadPermissions('MJ: AI Architectures', userPayload);
12803
+ @FieldResolver(() => [MJAIAgentSessionBridge_])
12804
+ async MJAIAgentSessionBridges_ProviderIDArray(@Root() mjaibridgeprovider_: MJAIBridgeProvider_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12805
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridges', userPayload);
10554
12806
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10555
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIArchitectures')} WHERE ${provider.QuoteIdentifier('ParentArchitectureID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Architectures', userPayload, EntityPermissionType.Read, 'AND');
10556
- const rows = await provider.ExecuteSQL(sSQL, [mjaiarchitecture_.ID], undefined, this.GetUserFromPayload(userPayload));
10557
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Architectures', rows, this.GetUserFromPayload(userPayload));
12807
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridges')} WHERE ${provider.QuoteIdentifier('ProviderID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridges', userPayload, EntityPermissionType.Read, 'AND');
12808
+ const rows = await provider.ExecuteSQL(sSQL, [mjaibridgeprovider_.ID], undefined, this.GetUserFromPayload(userPayload));
12809
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Bridges', rows, this.GetUserFromPayload(userPayload));
10558
12810
  return result;
10559
12811
  }
10560
12812
 
10561
- @FieldResolver(() => [MJAIModelArchitecture_])
10562
- async MJAIModelArchitectures_ArchitectureIDArray(@Root() mjaiarchitecture_: MJAIArchitecture_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10563
- this.CheckUserReadPermissions('MJ: AI Model Architectures', userPayload);
12813
+ @FieldResolver(() => [MJAIBridgeProviderChannel_])
12814
+ async MJAIBridgeProviderChannels_ProviderIDArray(@Root() mjaibridgeprovider_: MJAIBridgeProvider_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12815
+ this.CheckUserReadPermissions('MJ: AI Bridge Provider Channels', userPayload);
10564
12816
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10565
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIModelArchitectures')} WHERE ${provider.QuoteIdentifier('ArchitectureID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Model Architectures', userPayload, EntityPermissionType.Read, 'AND');
10566
- const rows = await provider.ExecuteSQL(sSQL, [mjaiarchitecture_.ID], undefined, this.GetUserFromPayload(userPayload));
10567
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Architectures', rows, this.GetUserFromPayload(userPayload));
12817
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeProviderChannels')} WHERE ${provider.QuoteIdentifier('ProviderID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Provider Channels', userPayload, EntityPermissionType.Read, 'AND');
12818
+ const rows = await provider.ExecuteSQL(sSQL, [mjaibridgeprovider_.ID], undefined, this.GetUserFromPayload(userPayload));
12819
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Bridge Provider Channels', rows, this.GetUserFromPayload(userPayload));
10568
12820
  return result;
10569
12821
  }
10570
12822
 
10571
- @Mutation(() => MJAIArchitecture_)
10572
- async CreateMJAIArchitecture(
10573
- @Arg('input', () => CreateMJAIArchitectureInput) input: CreateMJAIArchitectureInput,
12823
+ @FieldResolver(() => [MJAIBridgeAgentIdentity_])
12824
+ async MJAIBridgeAgentIdentities_ProviderIDArray(@Root() mjaibridgeprovider_: MJAIBridgeProvider_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12825
+ this.CheckUserReadPermissions('MJ: AI Bridge Agent Identities', userPayload);
12826
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12827
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIBridgeAgentIdentities')} WHERE ${provider.QuoteIdentifier('ProviderID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Bridge Agent Identities', userPayload, EntityPermissionType.Read, 'AND');
12828
+ const rows = await provider.ExecuteSQL(sSQL, [mjaibridgeprovider_.ID], undefined, this.GetUserFromPayload(userPayload));
12829
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Bridge Agent Identities', rows, this.GetUserFromPayload(userPayload));
12830
+ return result;
12831
+ }
12832
+
12833
+ @Mutation(() => MJAIBridgeProvider_)
12834
+ async CreateMJAIBridgeProvider(
12835
+ @Arg('input', () => CreateMJAIBridgeProviderInput) input: CreateMJAIBridgeProviderInput,
10574
12836
  @Ctx() { providers, userPayload }: AppContext,
10575
12837
  @PubSub() pubSub: PubSubEngine
10576
12838
  ) {
10577
12839
  const provider = GetReadWriteProvider(providers);
10578
- return this.CreateRecord('MJ: AI Architectures', input, provider, userPayload, pubSub)
12840
+ return this.CreateRecord('MJ: AI Bridge Providers', input, provider, userPayload, pubSub)
10579
12841
  }
10580
12842
 
10581
- @Mutation(() => MJAIArchitecture_)
10582
- async UpdateMJAIArchitecture(
10583
- @Arg('input', () => UpdateMJAIArchitectureInput) input: UpdateMJAIArchitectureInput,
12843
+ @Mutation(() => MJAIBridgeProvider_)
12844
+ async UpdateMJAIBridgeProvider(
12845
+ @Arg('input', () => UpdateMJAIBridgeProviderInput) input: UpdateMJAIBridgeProviderInput,
10584
12846
  @Ctx() { providers, userPayload }: AppContext,
10585
12847
  @PubSub() pubSub: PubSubEngine
10586
12848
  ) {
10587
12849
  const provider = GetReadWriteProvider(providers);
10588
- return this.UpdateRecord('MJ: AI Architectures', input, provider, userPayload, pubSub);
12850
+ return this.UpdateRecord('MJ: AI Bridge Providers', input, provider, userPayload, pubSub);
10589
12851
  }
10590
12852
 
10591
- @Mutation(() => MJAIArchitecture_)
10592
- async DeleteMJAIArchitecture(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12853
+ @Mutation(() => MJAIBridgeProvider_)
12854
+ async DeleteMJAIBridgeProvider(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
10593
12855
  const provider = GetReadWriteProvider(providers);
10594
12856
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
10595
- return this.DeleteRecord('MJ: AI Architectures', key, options, provider, userPayload, pubSub);
12857
+ return this.DeleteRecord('MJ: AI Bridge Providers', key, options, provider, userPayload, pubSub);
10596
12858
  }
10597
12859
 
10598
12860
  }
@@ -17041,6 +19303,224 @@ export class MJAIPromptResolver extends ResolverBase {
17041
19303
 
17042
19304
  }
17043
19305
 
19306
+ //****************************************************************************
19307
+ // ENTITY CLASS for MJ: AI Remote Browser Providers
19308
+ //****************************************************************************
19309
+ @ObjectType()
19310
+ export class MJAIRemoteBrowserProvider_ {
19311
+ @Field()
19312
+ @MaxLength(36)
19313
+ ID: string;
19314
+
19315
+ @Field({description: `Unique backend name (e.g. Self-Hosted Chrome, Browserbase, Steel, Browserless, Hyperbrowser).`})
19316
+ @MaxLength(100)
19317
+ Name: string;
19318
+
19319
+ @Field({nullable: true, description: `Optional human-readable description of the backend / driver.`})
19320
+ @MaxLength(1000)
19321
+ Description?: string;
19322
+
19323
+ @Field({description: `How the browser is hosted: SelfHost (MJ orchestrates a lightweight headless-Chrome container we connect to over CDP) or Service (a browser-as-a-service such as Browserbase/Steel/Browserless/Hyperbrowser exposes a CDP connect endpoint).`})
19324
+ @MaxLength(20)
19325
+ ProviderType: string;
19326
+
19327
+ @Field({description: `Driver key resolved at runtime via MJGlobal.ClassFactory.CreateInstance(BaseRemoteBrowserProvider, DriverClass). MUST match the @RegisterClass key on the concrete provider driver.`})
19328
+ @MaxLength(250)
19329
+ DriverClass: string;
19330
+
19331
+ @Field({description: `Whether this backend is available for use. Disabled backends cannot start new remote-browser sessions.`})
19332
+ @MaxLength(20)
19333
+ Status: string;
19334
+
19335
+ @Field({nullable: true, description: `Strongly-typed JSON of the backend's supported features (the IRemoteBrowserProviderFeatures interface, bound via JSONType metadata): the universal CDP-control substrate (RawCdpControl), an optional provider-native AI-control harness (NativeAIControl, e.g. Browserbase Stagehand), LiveView, HumanTakeover, ScreenStreaming, and operational capabilities (Stealth, ProxyEgress, SessionRecording, PersistentContext, MultiTab, FileDownloads, CaptchaSolving). The engine gates optional driver calls on these flags; the base driver throws RemoteBrowserCapabilityNotSupportedError when a feature is claimed but unimplemented. Held as JSON so new features need no schema change. NULL/omitted = unsupported.`})
19336
+ SupportedFeatures?: string;
19337
+
19338
+ @Field({description: `Default control mode for channels using this backend, overridable per-channel and at runtime: AgentOnly (only the agent drives — e.g. a sales demo), ViewOnly (the agent drives while humans watch the live view but cannot take over), or Collaborative (a human can grab the wheel — e.g. a trainer agent that demonstrates then watches the user try). The backend must support the capabilities a mode requires (HumanTakeover for Collaborative, LiveView for ViewOnly/Collaborative).`})
19339
+ @MaxLength(20)
19340
+ DefaultControlMode: string;
19341
+
19342
+ @Field({nullable: true, description: `Optional JSON Schema validating the backend Configuration and per-session remote-browser Config payloads.`})
19343
+ ConfigSchema?: string;
19344
+
19345
+ @Field({nullable: true, description: `Backend-level configuration JSON (e.g. API region, default Chrome container image for SelfHost, credential references resolved via the MJ credential system, egress proxy settings). Never store secrets inline.`})
19346
+ Configuration?: string;
19347
+
19348
+ @Field()
19349
+ _mj__CreatedAt: Date;
19350
+
19351
+ @Field()
19352
+ _mj__UpdatedAt: Date;
19353
+
19354
+ }
19355
+
19356
+ //****************************************************************************
19357
+ // INPUT TYPE for MJ: AI Remote Browser Providers
19358
+ //****************************************************************************
19359
+ @InputType()
19360
+ export class CreateMJAIRemoteBrowserProviderInput {
19361
+ @Field({ nullable: true })
19362
+ ID?: string;
19363
+
19364
+ @Field({ nullable: true })
19365
+ Name?: string;
19366
+
19367
+ @Field({ nullable: true })
19368
+ Description: string | null;
19369
+
19370
+ @Field({ nullable: true })
19371
+ ProviderType?: string;
19372
+
19373
+ @Field({ nullable: true })
19374
+ DriverClass?: string;
19375
+
19376
+ @Field({ nullable: true })
19377
+ Status?: string;
19378
+
19379
+ @Field({ nullable: true })
19380
+ SupportedFeatures: string | null;
19381
+
19382
+ @Field({ nullable: true })
19383
+ DefaultControlMode?: string;
19384
+
19385
+ @Field({ nullable: true })
19386
+ ConfigSchema: string | null;
19387
+
19388
+ @Field({ nullable: true })
19389
+ Configuration: string | null;
19390
+
19391
+ @Field(() => RestoreContextInput, { nullable: true })
19392
+ RestoreContext___?: RestoreContextInput;
19393
+ }
19394
+
19395
+
19396
+ //****************************************************************************
19397
+ // INPUT TYPE for MJ: AI Remote Browser Providers
19398
+ //****************************************************************************
19399
+ @InputType()
19400
+ export class UpdateMJAIRemoteBrowserProviderInput {
19401
+ @Field()
19402
+ ID: string;
19403
+
19404
+ @Field({ nullable: true })
19405
+ Name?: string;
19406
+
19407
+ @Field({ nullable: true })
19408
+ Description?: string | null;
19409
+
19410
+ @Field({ nullable: true })
19411
+ ProviderType?: string;
19412
+
19413
+ @Field({ nullable: true })
19414
+ DriverClass?: string;
19415
+
19416
+ @Field({ nullable: true })
19417
+ Status?: string;
19418
+
19419
+ @Field({ nullable: true })
19420
+ SupportedFeatures?: string | null;
19421
+
19422
+ @Field({ nullable: true })
19423
+ DefaultControlMode?: string;
19424
+
19425
+ @Field({ nullable: true })
19426
+ ConfigSchema?: string | null;
19427
+
19428
+ @Field({ nullable: true })
19429
+ Configuration?: string | null;
19430
+
19431
+ @Field(() => [KeyValuePairInput], { nullable: true })
19432
+ OldValues___?: KeyValuePairInput[];
19433
+
19434
+ @Field(() => RestoreContextInput, { nullable: true })
19435
+ RestoreContext___?: RestoreContextInput;
19436
+ }
19437
+
19438
+ //****************************************************************************
19439
+ // RESOLVER for MJ: AI Remote Browser Providers
19440
+ //****************************************************************************
19441
+ @ObjectType()
19442
+ export class RunMJAIRemoteBrowserProviderViewResult {
19443
+ @Field(() => [MJAIRemoteBrowserProvider_])
19444
+ Results: MJAIRemoteBrowserProvider_[];
19445
+
19446
+ @Field(() => String, {nullable: true})
19447
+ UserViewRunID?: string;
19448
+
19449
+ @Field(() => Int, {nullable: true})
19450
+ RowCount: number;
19451
+
19452
+ @Field(() => Int, {nullable: true})
19453
+ TotalRowCount: number;
19454
+
19455
+ @Field(() => Int, {nullable: true})
19456
+ ExecutionTime: number;
19457
+
19458
+ @Field({nullable: true})
19459
+ ErrorMessage?: string;
19460
+
19461
+ @Field(() => Boolean, {nullable: false})
19462
+ Success: boolean;
19463
+ }
19464
+
19465
+ @Resolver(MJAIRemoteBrowserProvider_)
19466
+ export class MJAIRemoteBrowserProviderResolver extends ResolverBase {
19467
+ @Query(() => RunMJAIRemoteBrowserProviderViewResult)
19468
+ async RunMJAIRemoteBrowserProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19469
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
19470
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
19471
+ }
19472
+
19473
+ @Query(() => RunMJAIRemoteBrowserProviderViewResult)
19474
+ async RunMJAIRemoteBrowserProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19475
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
19476
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
19477
+ }
19478
+
19479
+ @Query(() => RunMJAIRemoteBrowserProviderViewResult)
19480
+ async RunMJAIRemoteBrowserProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19481
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
19482
+ input.EntityName = 'MJ: AI Remote Browser Providers';
19483
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
19484
+ }
19485
+ @Query(() => MJAIRemoteBrowserProvider_, { nullable: true })
19486
+ async MJAIRemoteBrowserProvider(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIRemoteBrowserProvider_ | null> {
19487
+ this.CheckUserReadPermissions('MJ: AI Remote Browser Providers', userPayload);
19488
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
19489
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIRemoteBrowserProviders')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Remote Browser Providers', userPayload, EntityPermissionType.Read, 'AND');
19490
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
19491
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Remote Browser Providers', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
19492
+ return result;
19493
+ }
19494
+
19495
+ @Mutation(() => MJAIRemoteBrowserProvider_)
19496
+ async CreateMJAIRemoteBrowserProvider(
19497
+ @Arg('input', () => CreateMJAIRemoteBrowserProviderInput) input: CreateMJAIRemoteBrowserProviderInput,
19498
+ @Ctx() { providers, userPayload }: AppContext,
19499
+ @PubSub() pubSub: PubSubEngine
19500
+ ) {
19501
+ const provider = GetReadWriteProvider(providers);
19502
+ return this.CreateRecord('MJ: AI Remote Browser Providers', input, provider, userPayload, pubSub)
19503
+ }
19504
+
19505
+ @Mutation(() => MJAIRemoteBrowserProvider_)
19506
+ async UpdateMJAIRemoteBrowserProvider(
19507
+ @Arg('input', () => UpdateMJAIRemoteBrowserProviderInput) input: UpdateMJAIRemoteBrowserProviderInput,
19508
+ @Ctx() { providers, userPayload }: AppContext,
19509
+ @PubSub() pubSub: PubSubEngine
19510
+ ) {
19511
+ const provider = GetReadWriteProvider(providers);
19512
+ return this.UpdateRecord('MJ: AI Remote Browser Providers', input, provider, userPayload, pubSub);
19513
+ }
19514
+
19515
+ @Mutation(() => MJAIRemoteBrowserProvider_)
19516
+ async DeleteMJAIRemoteBrowserProvider(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19517
+ const provider = GetReadWriteProvider(providers);
19518
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
19519
+ return this.DeleteRecord('MJ: AI Remote Browser Providers', key, options, provider, userPayload, pubSub);
19520
+ }
19521
+
19522
+ }
19523
+
17044
19524
  //****************************************************************************
17045
19525
  // ENTITY CLASS for MJ: AI Result Cache
17046
19526
  //****************************************************************************
@@ -33357,8 +35837,9 @@ export class MJConversationDetailArtifact_ {
33357
35837
  @Field()
33358
35838
  _mj__UpdatedAt: Date;
33359
35839
 
33360
- @Field()
33361
- ConversationDetail: string;
35840
+ @Field({nullable: true})
35841
+ @MaxLength(100)
35842
+ ConversationDetail?: string;
33362
35843
 
33363
35844
  @Field({nullable: true})
33364
35845
  @MaxLength(255)
@@ -33561,8 +36042,9 @@ export class MJConversationDetailAttachment_ {
33561
36042
  @MaxLength(36)
33562
36043
  ArtifactVersionID?: string;
33563
36044
 
33564
- @Field()
33565
- ConversationDetail: string;
36045
+ @Field({nullable: true})
36046
+ @MaxLength(100)
36047
+ ConversationDetail?: string;
33566
36048
 
33567
36049
  @Field()
33568
36050
  @MaxLength(50)
@@ -33805,8 +36287,9 @@ export class MJConversationDetailRating_ {
33805
36287
  @Field()
33806
36288
  _mj__UpdatedAt: Date;
33807
36289
 
33808
- @Field()
33809
- ConversationDetail: string;
36290
+ @Field({nullable: true})
36291
+ @MaxLength(100)
36292
+ ConversationDetail?: string;
33810
36293
 
33811
36294
  @Field()
33812
36295
  @MaxLength(100)
@@ -34049,6 +36532,10 @@ export class MJConversationDetail_ {
34049
36532
  @Field(() => Boolean, {description: `Indicates if the original message content was modified after initial creation. Set automatically by the server when the Message field is changed on update.`})
34050
36533
  OriginalMessageChanged: boolean;
34051
36534
 
36535
+ @Field({nullable: true, description: `Links this message to the AIAgentSession that was active when it was created. NULL for messages typed in standard text chat outside any live session. Lets the conversation timeline group a sessions messages into a single collapsible block.`})
36536
+ @MaxLength(36)
36537
+ AgentSessionID?: string;
36538
+
34052
36539
  @Field({nullable: true})
34053
36540
  @MaxLength(255)
34054
36541
  Conversation?: string;
@@ -34066,6 +36553,7 @@ export class MJConversationDetail_ {
34066
36553
  ArtifactVersion?: string;
34067
36554
 
34068
36555
  @Field({nullable: true})
36556
+ @MaxLength(100)
34069
36557
  Parent?: string;
34070
36558
 
34071
36559
  @Field({nullable: true})
@@ -34189,6 +36677,9 @@ export class CreateMJConversationDetailInput {
34189
36677
  @Field(() => Boolean, { nullable: true })
34190
36678
  OriginalMessageChanged?: boolean;
34191
36679
 
36680
+ @Field({ nullable: true })
36681
+ AgentSessionID: string | null;
36682
+
34192
36683
  @Field(() => RestoreContextInput, { nullable: true })
34193
36684
  RestoreContext___?: RestoreContextInput;
34194
36685
  }
@@ -34274,6 +36765,9 @@ export class UpdateMJConversationDetailInput {
34274
36765
  @Field(() => Boolean, { nullable: true })
34275
36766
  OriginalMessageChanged?: boolean;
34276
36767
 
36768
+ @Field({ nullable: true })
36769
+ AgentSessionID?: string | null;
36770
+
34277
36771
  @Field(() => [KeyValuePairInput], { nullable: true })
34278
36772
  OldValues___?: KeyValuePairInput[];
34279
36773
 
@@ -34590,6 +37084,9 @@ export class MJConversation_ {
34590
37084
  @Field(() => [MJAIAgentExample_])
34591
37085
  MJAIAgentExamples_SourceConversationIDArray: MJAIAgentExample_[]; // Link to MJAIAgentExamples
34592
37086
 
37087
+ @Field(() => [MJAIAgentSession_])
37088
+ MJAIAgentSessions_ConversationIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
37089
+
34593
37090
  }
34594
37091
 
34595
37092
  //****************************************************************************
@@ -34845,6 +37342,16 @@ export class MJConversationResolver extends ResolverBase {
34845
37342
  return result;
34846
37343
  }
34847
37344
 
37345
+ @FieldResolver(() => [MJAIAgentSession_])
37346
+ async MJAIAgentSessions_ConversationIDArray(@Root() mjconversation_: MJConversation_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
37347
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
37348
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
37349
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('ConversationID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
37350
+ const rows = await provider.ExecuteSQL(sSQL, [mjconversation_.ID], undefined, this.GetUserFromPayload(userPayload));
37351
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows, this.GetUserFromPayload(userPayload));
37352
+ return result;
37353
+ }
37354
+
34848
37355
  @Mutation(() => MJConversation_)
34849
37356
  async CreateMJConversation(
34850
37357
  @Arg('input', () => CreateMJConversationInput) input: CreateMJConversationInput,
@@ -65066,6 +67573,7 @@ export class MJReport_ {
65066
67573
  Conversation?: string;
65067
67574
 
65068
67575
  @Field({nullable: true})
67576
+ @MaxLength(100)
65069
67577
  ConversationDetail?: string;
65070
67578
 
65071
67579
  @Field({nullable: true})
@@ -67662,6 +70170,9 @@ export class MJScheduledJob_ {
67662
70170
  @Field(() => Boolean, {description: `When true AND LastRunAt IS NULL, the scheduler sets NextRunAt to now() instead of the next cron tick on initialization, so the job runs on the next polling cycle. Useful for newly-seeded jobs that should not wait up to a full cron interval before their first execution.`})
67663
70171
  RunImmediatelyIfNeverRun: boolean;
67664
70172
 
70173
+ @Field(() => Int, {nullable: true, description: `Optional per-job override for the acquire-time lock lease length, in minutes. When set and positive, the engine uses max(default lease, MaxRuntimeMinutes) as the initial ExpectedCompletionAt — so it only ever EXTENDS the default lease, never shrinks it. Intended for jobs whose work is a single long-running call that cannot heartbeat mid-flight (e.g. one slow synchronous action). Jobs that heartbeat via the plugin opt-in pattern do not need this. NULL = use the engine default lease (LeaseTimeoutMinutes). See plans/scheduled-job-engine-heartbeat-lease.md (GH #2749).`})
70174
+ MaxRuntimeMinutes?: number;
70175
+
67665
70176
  @Field()
67666
70177
  @MaxLength(100)
67667
70178
  JobType: string;
@@ -67768,6 +70279,9 @@ export class CreateMJScheduledJobInput {
67768
70279
  @Field(() => Boolean, { nullable: true })
67769
70280
  RunImmediatelyIfNeverRun?: boolean;
67770
70281
 
70282
+ @Field(() => Int, { nullable: true })
70283
+ MaxRuntimeMinutes: number | null;
70284
+
67771
70285
  @Field(() => RestoreContextInput, { nullable: true })
67772
70286
  RestoreContext___?: RestoreContextInput;
67773
70287
  }
@@ -67859,6 +70373,9 @@ export class UpdateMJScheduledJobInput {
67859
70373
  @Field(() => Boolean, { nullable: true })
67860
70374
  RunImmediatelyIfNeverRun?: boolean;
67861
70375
 
70376
+ @Field(() => Int, { nullable: true })
70377
+ MaxRuntimeMinutes?: number | null;
70378
+
67862
70379
  @Field(() => [KeyValuePairInput], { nullable: true })
67863
70380
  OldValues___?: KeyValuePairInput[];
67864
70381
 
@@ -74196,6 +76713,7 @@ export class MJTask_ {
74196
76713
  Project?: string;
74197
76714
 
74198
76715
  @Field({nullable: true})
76716
+ @MaxLength(100)
74199
76717
  ConversationDetail?: string;
74200
76718
 
74201
76719
  @Field({nullable: true})
@@ -81421,6 +83939,12 @@ export class MJUser_ {
81421
83939
  @Field(() => [MJMagicLinkInvite_])
81422
83940
  MJMagicLinkInvites_CreatedByUserIDArray: MJMagicLinkInvite_[]; // Link to MJMagicLinkInvites
81423
83941
 
83942
+ @Field(() => [MJAIAgentSession_])
83943
+ MJAIAgentSessions_UserIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
83944
+
83945
+ @Field(() => [MJAIAgentSessionBridgeParticipant_])
83946
+ MJAIAgentSessionBridgeParticipants_UserIDArray: MJAIAgentSessionBridgeParticipant_[]; // Link to MJAIAgentSessionBridgeParticipants
83947
+
81424
83948
  }
81425
83949
 
81426
83950
  //****************************************************************************
@@ -82606,6 +85130,26 @@ export class MJUserResolverBase extends ResolverBase {
82606
85130
  return result;
82607
85131
  }
82608
85132
 
85133
+ @FieldResolver(() => [MJAIAgentSession_])
85134
+ async MJAIAgentSessions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
85135
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
85136
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
85137
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('UserID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
85138
+ const rows = await provider.ExecuteSQL(sSQL, [mjuser_.ID], undefined, this.GetUserFromPayload(userPayload));
85139
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows, this.GetUserFromPayload(userPayload));
85140
+ return result;
85141
+ }
85142
+
85143
+ @FieldResolver(() => [MJAIAgentSessionBridgeParticipant_])
85144
+ async MJAIAgentSessionBridgeParticipants_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
85145
+ this.CheckUserReadPermissions('MJ: AI Agent Session Bridge Participants', userPayload);
85146
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
85147
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessionBridgeParticipants')} WHERE ${provider.QuoteIdentifier('UserID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Session Bridge Participants', userPayload, EntityPermissionType.Read, 'AND');
85148
+ const rows = await provider.ExecuteSQL(sSQL, [mjuser_.ID], undefined, this.GetUserFromPayload(userPayload));
85149
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Session Bridge Participants', rows, this.GetUserFromPayload(userPayload));
85150
+ return result;
85151
+ }
85152
+
82609
85153
  @Mutation(() => MJUser_)
82610
85154
  async CreateMJUser(
82611
85155
  @Arg('input', () => CreateMJUserInput) input: CreateMJUserInput,