@memberjunction/server 2.110.0 → 2.111.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.
@@ -19,7 +19,7 @@ import { mj_core_schema } from '../config.js';
19
19
 
20
20
 
21
21
 
22
- import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, ArtifactPermissionEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, ScheduledJobRunEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, CollectionPermissionEntity, AIAgentPromptEntity, ComponentLibraryEntity, ScheduledJobTypeEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ScheduledJobEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity, AIAgentDataSourceEntity } from '@memberjunction/core-entities';
22
+ import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, ArtifactPermissionEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, ScheduledJobRunEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, AIAgentExampleEntity, ConversationArtifactEntity, CollectionPermissionEntity, AIAgentPromptEntity, ComponentLibraryEntity, ScheduledJobTypeEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ScheduledJobEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity, AIAgentDataSourceEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -1287,6 +1287,13 @@ export class MJAIAgentNoteType_ {
1287
1287
  @MaxLength(10)
1288
1288
  _mj__UpdatedAt: Date;
1289
1289
 
1290
+ @Field(() => Int, {description: `Priority for injection ordering. Lower numbers are injected first (0 is highest priority).`})
1291
+ Priority: number;
1292
+
1293
+ @Field({description: `Status of the note type: Pending (awaiting approval), Active (available for use), or Revoked (deprecated).`})
1294
+ @MaxLength(40)
1295
+ Status: string;
1296
+
1290
1297
  @Field(() => [MJAIAgentNote_])
1291
1298
  AIAgentNotes_AgentNoteTypeIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
1292
1299
 
@@ -1305,6 +1312,12 @@ export class CreateMJAIAgentNoteTypeInput {
1305
1312
 
1306
1313
  @Field({ nullable: true })
1307
1314
  Description: string | null;
1315
+
1316
+ @Field(() => Int, { nullable: true })
1317
+ Priority?: number;
1318
+
1319
+ @Field({ nullable: true })
1320
+ Status?: string;
1308
1321
  }
1309
1322
 
1310
1323
 
@@ -1322,6 +1335,12 @@ export class UpdateMJAIAgentNoteTypeInput {
1322
1335
  @Field({ nullable: true })
1323
1336
  Description?: string | null;
1324
1337
 
1338
+ @Field(() => Int, { nullable: true })
1339
+ Priority?: number;
1340
+
1341
+ @Field({ nullable: true })
1342
+ Status?: string;
1343
+
1325
1344
  @Field(() => [KeyValuePairInput], { nullable: true })
1326
1345
  OldValues___?: KeyValuePairInput[];
1327
1346
  }
@@ -1757,11 +1776,17 @@ each time the agent processes a prompt step.`})
1757
1776
  @MaxLength(16)
1758
1777
  RootLastRunID?: string;
1759
1778
 
1779
+ @Field(() => [MJAIAgentRunStep_])
1780
+ MJ_AIAgentRunSteps_AgentRunIDArray: MJAIAgentRunStep_[]; // Link to MJ_AIAgentRunSteps
1781
+
1760
1782
  @Field(() => [MJAIAgentRun_])
1761
1783
  MJ_AIAgentRuns_ParentRunIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
1762
1784
 
1763
- @Field(() => [MJAIAgentRunStep_])
1764
- MJ_AIAgentRunSteps_AgentRunIDArray: MJAIAgentRunStep_[]; // Link to MJ_AIAgentRunSteps
1785
+ @Field(() => [MJAIAgentNote_])
1786
+ AIAgentNotes_SourceAIAgentRunIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
1787
+
1788
+ @Field(() => [MJAIAgentExample_])
1789
+ MJ_AIAgentExamples_SourceAIAgentRunIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
1765
1790
 
1766
1791
  @Field(() => [MJAIPromptRun_])
1767
1792
  MJ_AIPromptRuns_AgentRunIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
@@ -2070,6 +2095,17 @@ export class MJAIAgentRunResolver extends ResolverBase {
2070
2095
  return result;
2071
2096
  }
2072
2097
 
2098
+ @FieldResolver(() => [MJAIAgentRunStep_])
2099
+ async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2100
+ this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2101
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2102
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2103
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2104
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2105
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2106
+ return result;
2107
+ }
2108
+
2073
2109
  @FieldResolver(() => [MJAIAgentRun_])
2074
2110
  async MJ_AIAgentRuns_ParentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2075
2111
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -2081,14 +2117,25 @@ export class MJAIAgentRunResolver extends ResolverBase {
2081
2117
  return result;
2082
2118
  }
2083
2119
 
2084
- @FieldResolver(() => [MJAIAgentRunStep_])
2085
- async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2086
- this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2120
+ @FieldResolver(() => [MJAIAgentNote_])
2121
+ async AIAgentNotes_SourceAIAgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2122
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
2087
2123
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2088
2124
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2089
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2125
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [SourceAIAgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
2090
2126
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2091
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2127
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows);
2128
+ return result;
2129
+ }
2130
+
2131
+ @FieldResolver(() => [MJAIAgentExample_])
2132
+ async MJ_AIAgentExamples_SourceAIAgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2133
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
2134
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2135
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2136
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [SourceAIAgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
2137
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2138
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
2092
2139
  return result;
2093
2140
  }
2094
2141
 
@@ -2977,6 +3024,26 @@ if this limit is exceeded.`})
2977
3024
  @Field({nullable: true, description: `Detailed markdown that explains the structure of the agent including agent architecture, actions, sub-agents, prompts, and payload structure.`})
2978
3025
  TechnicalDesign?: string;
2979
3026
 
3027
+ @Field(() => Boolean, {description: `When enabled, agent notes will be automatically injected into the agent context based on scoping rules.`})
3028
+ InjectNotes: boolean;
3029
+
3030
+ @Field(() => Int, {description: `Maximum number of notes to inject into agent context per request.`})
3031
+ MaxNotesToInject: number;
3032
+
3033
+ @Field({description: `Strategy for selecting which notes to inject: Relevant (semantic search), Recent (most recent first), or All (up to max limit).`})
3034
+ @MaxLength(40)
3035
+ NoteInjectionStrategy: string;
3036
+
3037
+ @Field(() => Boolean, {description: `When enabled, agent examples will be automatically injected into the agent context based on scoping rules.`})
3038
+ InjectExamples: boolean;
3039
+
3040
+ @Field(() => Int, {description: `Maximum number of examples to inject into agent context per request.`})
3041
+ MaxExamplesToInject: number;
3042
+
3043
+ @Field({description: `Strategy for selecting which examples to inject: Semantic (vector similarity), Recent (most recent first), or Rated (highest success score first).`})
3044
+ @MaxLength(40)
3045
+ ExampleInjectionStrategy: string;
3046
+
2980
3047
  @Field({nullable: true})
2981
3048
  @MaxLength(510)
2982
3049
  Parent?: string;
@@ -3046,6 +3113,9 @@ if this limit is exceeded.`})
3046
3113
  @Field(() => [MJTask_])
3047
3114
  MJ_Tasks_AgentIDArray: MJTask_[]; // Link to MJ_Tasks
3048
3115
 
3116
+ @Field(() => [MJAIAgentExample_])
3117
+ MJ_AIAgentExamples_AgentIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
3118
+
3049
3119
  @Field(() => [MJAIResultCache_])
3050
3120
  AIResultCache_AgentIDArray: MJAIResultCache_[]; // Link to AIResultCache
3051
3121
 
@@ -3187,6 +3257,24 @@ export class CreateMJAIAgentInput {
3187
3257
 
3188
3258
  @Field({ nullable: true })
3189
3259
  TechnicalDesign: string | null;
3260
+
3261
+ @Field(() => Boolean, { nullable: true })
3262
+ InjectNotes?: boolean;
3263
+
3264
+ @Field(() => Int, { nullable: true })
3265
+ MaxNotesToInject?: number;
3266
+
3267
+ @Field({ nullable: true })
3268
+ NoteInjectionStrategy?: string;
3269
+
3270
+ @Field(() => Boolean, { nullable: true })
3271
+ InjectExamples?: boolean;
3272
+
3273
+ @Field(() => Int, { nullable: true })
3274
+ MaxExamplesToInject?: number;
3275
+
3276
+ @Field({ nullable: true })
3277
+ ExampleInjectionStrategy?: string;
3190
3278
  }
3191
3279
 
3192
3280
 
@@ -3318,6 +3406,24 @@ export class UpdateMJAIAgentInput {
3318
3406
  @Field({ nullable: true })
3319
3407
  TechnicalDesign?: string | null;
3320
3408
 
3409
+ @Field(() => Boolean, { nullable: true })
3410
+ InjectNotes?: boolean;
3411
+
3412
+ @Field(() => Int, { nullable: true })
3413
+ MaxNotesToInject?: number;
3414
+
3415
+ @Field({ nullable: true })
3416
+ NoteInjectionStrategy?: string;
3417
+
3418
+ @Field(() => Boolean, { nullable: true })
3419
+ InjectExamples?: boolean;
3420
+
3421
+ @Field(() => Int, { nullable: true })
3422
+ MaxExamplesToInject?: number;
3423
+
3424
+ @Field({ nullable: true })
3425
+ ExampleInjectionStrategy?: string;
3426
+
3321
3427
  @Field(() => [KeyValuePairInput], { nullable: true })
3322
3428
  OldValues___?: KeyValuePairInput[];
3323
3429
  }
@@ -3545,6 +3651,17 @@ export class MJAIAgentResolver extends ResolverBase {
3545
3651
  return result;
3546
3652
  }
3547
3653
 
3654
+ @FieldResolver(() => [MJAIAgentExample_])
3655
+ async MJ_AIAgentExamples_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3656
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
3657
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3658
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3659
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
3660
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3661
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
3662
+ return result;
3663
+ }
3664
+
3548
3665
  @FieldResolver(() => [MJAIResultCache_])
3549
3666
  async AIResultCache_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3550
3667
  this.CheckUserReadPermissions('AI Result Cache', userPayload);
@@ -3697,6 +3814,13 @@ export class MJAIAgentStep_ {
3697
3814
  @Field({nullable: true, description: `JSON configuration for mapping static values or payload paths to action input parameters. Example: {"param1": "staticValue", "param2": "payload.dynamicValue"}`})
3698
3815
  ActionInputMapping?: string;
3699
3816
 
3817
+ @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.`})
3818
+ @MaxLength(100)
3819
+ LoopBodyType?: string;
3820
+
3821
+ @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.`})
3822
+ Configuration?: string;
3823
+
3700
3824
  @Field({nullable: true})
3701
3825
  @MaxLength(510)
3702
3826
  Agent?: string;
@@ -3782,6 +3906,12 @@ export class CreateMJAIAgentStepInput {
3782
3906
 
3783
3907
  @Field({ nullable: true })
3784
3908
  ActionInputMapping: string | null;
3909
+
3910
+ @Field({ nullable: true })
3911
+ LoopBodyType: string | null;
3912
+
3913
+ @Field({ nullable: true })
3914
+ Configuration: string | null;
3785
3915
  }
3786
3916
 
3787
3917
 
@@ -3847,6 +3977,12 @@ export class UpdateMJAIAgentStepInput {
3847
3977
  @Field({ nullable: true })
3848
3978
  ActionInputMapping?: string | null;
3849
3979
 
3980
+ @Field({ nullable: true })
3981
+ LoopBodyType?: string | null;
3982
+
3983
+ @Field({ nullable: true })
3984
+ Configuration?: string | null;
3985
+
3850
3986
  @Field(() => [KeyValuePairInput], { nullable: true })
3851
3987
  OldValues___?: KeyValuePairInput[];
3852
3988
  }
@@ -4707,7 +4843,7 @@ export class MJAIAgentTypeResolver extends ResolverBase {
4707
4843
  //****************************************************************************
4708
4844
  // ENTITY CLASS for AI Agent Notes
4709
4845
  //****************************************************************************
4710
- @ObjectType({ description: `Stores notes, observations, and learnings generated by AI agents during their operations, linked to specific agent runs and categorized by note type. Can be user-specific or general.` })
4846
+ @ObjectType({ description: `Stores notes, observations, and learnings for AI agents with multi-dimensional scoping (Agent, User, company). Scoping is determined by which FK fields are populated: all NULL = global, AgentID only = agent-specific, UserID only = user-specific across all agents, etc.` })
4711
4847
  export class MJAIAgentNote_ {
4712
4848
  @Field()
4713
4849
  @MaxLength(16)
@@ -4732,13 +4868,39 @@ export class MJAIAgentNote_ {
4732
4868
  @MaxLength(10)
4733
4869
  _mj__UpdatedAt: Date;
4734
4870
 
4735
- @Field({description: `Indicates the type of note, either User-specific or Global.`})
4871
+ @Field({nullable: true, description: `Foreign key referencing the ID column in the User table, indicating the user associated with the note. Used when Type=User`})
4872
+ @MaxLength(16)
4873
+ UserID?: string;
4874
+
4875
+ @Field({description: `Quick categorization of the note content: Preference (user preferences), Constraint (hard rules/requirements), Context (background information), Example (sample interactions), or Issue (known problems/limitations). Complements the more detailed AIAgentNoteType categorization.`})
4736
4876
  @MaxLength(40)
4737
4877
  Type: string;
4738
4878
 
4739
- @Field({nullable: true, description: `Foreign key referencing the ID column in the User table, indicating the user associated with the note. Used when Type=User`})
4879
+ @Field(() => Boolean, {description: `Indicates whether this note was automatically generated by an AI agent (1) or manually created (0).`})
4880
+ IsAutoGenerated: boolean;
4881
+
4882
+ @Field({nullable: true, description: `Internal comments about this note, not included in agent context injection.`})
4883
+ Comments?: string;
4884
+
4885
+ @Field({description: `Status of the note: Pending (awaiting review), Active (in use), or Revoked (disabled).`})
4886
+ @MaxLength(40)
4887
+ Status: string;
4888
+
4889
+ @Field({nullable: true, description: `Optional reference to the conversation that inspired or generated this note.`})
4740
4890
  @MaxLength(16)
4741
- UserID?: string;
4891
+ SourceConversationID?: string;
4892
+
4893
+ @Field({nullable: true, description: `Optional reference to the specific conversation message that inspired this note.`})
4894
+ @MaxLength(16)
4895
+ SourceConversationDetailID?: string;
4896
+
4897
+ @Field({nullable: true, description: `Optional reference to the AI agent run that generated this note.`})
4898
+ @MaxLength(16)
4899
+ SourceAIAgentRunID?: string;
4900
+
4901
+ @Field({nullable: true, description: `Optional company scope for this note. When populated with UserID, creates org+user specific notes.`})
4902
+ @MaxLength(16)
4903
+ CompanyID?: string;
4742
4904
 
4743
4905
  @Field({nullable: true})
4744
4906
  @MaxLength(510)
@@ -4752,6 +4914,14 @@ export class MJAIAgentNote_ {
4752
4914
  @MaxLength(200)
4753
4915
  User?: string;
4754
4916
 
4917
+ @Field({nullable: true})
4918
+ @MaxLength(510)
4919
+ SourceConversation?: string;
4920
+
4921
+ @Field({nullable: true})
4922
+ @MaxLength(100)
4923
+ Company?: string;
4924
+
4755
4925
  }
4756
4926
 
4757
4927
  //****************************************************************************
@@ -4771,11 +4941,32 @@ export class CreateMJAIAgentNoteInput {
4771
4941
  @Field({ nullable: true })
4772
4942
  Note: string | null;
4773
4943
 
4944
+ @Field({ nullable: true })
4945
+ UserID: string | null;
4946
+
4774
4947
  @Field({ nullable: true })
4775
4948
  Type?: string;
4776
4949
 
4950
+ @Field(() => Boolean, { nullable: true })
4951
+ IsAutoGenerated?: boolean;
4952
+
4777
4953
  @Field({ nullable: true })
4778
- UserID: string | null;
4954
+ Comments: string | null;
4955
+
4956
+ @Field({ nullable: true })
4957
+ Status?: string;
4958
+
4959
+ @Field({ nullable: true })
4960
+ SourceConversationID: string | null;
4961
+
4962
+ @Field({ nullable: true })
4963
+ SourceConversationDetailID: string | null;
4964
+
4965
+ @Field({ nullable: true })
4966
+ SourceAIAgentRunID: string | null;
4967
+
4968
+ @Field({ nullable: true })
4969
+ CompanyID: string | null;
4779
4970
  }
4780
4971
 
4781
4972
 
@@ -4796,11 +4987,32 @@ export class UpdateMJAIAgentNoteInput {
4796
4987
  @Field({ nullable: true })
4797
4988
  Note?: string | null;
4798
4989
 
4990
+ @Field({ nullable: true })
4991
+ UserID?: string | null;
4992
+
4799
4993
  @Field({ nullable: true })
4800
4994
  Type?: string;
4801
4995
 
4996
+ @Field(() => Boolean, { nullable: true })
4997
+ IsAutoGenerated?: boolean;
4998
+
4802
4999
  @Field({ nullable: true })
4803
- UserID?: string | null;
5000
+ Comments?: string | null;
5001
+
5002
+ @Field({ nullable: true })
5003
+ Status?: string;
5004
+
5005
+ @Field({ nullable: true })
5006
+ SourceConversationID?: string | null;
5007
+
5008
+ @Field({ nullable: true })
5009
+ SourceConversationDetailID?: string | null;
5010
+
5011
+ @Field({ nullable: true })
5012
+ SourceAIAgentRunID?: string | null;
5013
+
5014
+ @Field({ nullable: true })
5015
+ CompanyID?: string | null;
4804
5016
 
4805
5017
  @Field(() => [KeyValuePairInput], { nullable: true })
4806
5018
  OldValues___?: KeyValuePairInput[];
@@ -6783,12 +6995,12 @@ export class MJAIPrompt_ {
6783
6995
  @Field(() => [MJAIPrompt_])
6784
6996
  AIPrompts_ResultSelectorPromptIDArray: MJAIPrompt_[]; // Link to AIPrompts
6785
6997
 
6786
- @Field(() => [MJAIAgentPrompt_])
6787
- MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
6788
-
6789
6998
  @Field(() => [MJAIPromptModel_])
6790
6999
  MJ_AIPromptModels_PromptIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
6791
7000
 
7001
+ @Field(() => [MJAIAgentPrompt_])
7002
+ MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
7003
+
6792
7004
  @Field(() => [MJAIAgentStep_])
6793
7005
  MJ_AIAgentSteps_PromptIDArray: MJAIAgentStep_[]; // Link to MJ_AIAgentSteps
6794
7006
 
@@ -7237,25 +7449,25 @@ export class MJAIPromptResolver extends ResolverBase {
7237
7449
  return result;
7238
7450
  }
7239
7451
 
7240
- @FieldResolver(() => [MJAIAgentPrompt_])
7241
- async MJ_AIAgentPrompts_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7242
- this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
7452
+ @FieldResolver(() => [MJAIPromptModel_])
7453
+ async MJ_AIPromptModels_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7454
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
7243
7455
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
7244
7456
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7245
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
7457
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
7246
7458
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
7247
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
7459
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
7248
7460
  return result;
7249
7461
  }
7250
7462
 
7251
- @FieldResolver(() => [MJAIPromptModel_])
7252
- async MJ_AIPromptModels_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7253
- this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
7463
+ @FieldResolver(() => [MJAIAgentPrompt_])
7464
+ async MJ_AIAgentPrompts_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7465
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
7254
7466
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
7255
7467
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7256
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
7468
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
7257
7469
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
7258
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
7470
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
7259
7471
  return result;
7260
7472
  }
7261
7473
 
@@ -7997,6 +8209,12 @@ export class MJCompany_ {
7997
8209
  @Field(() => [MJWorkflow_])
7998
8210
  Workflows_CompanyNameArray: MJWorkflow_[]; // Link to Workflows
7999
8211
 
8212
+ @Field(() => [MJAIAgentNote_])
8213
+ AIAgentNotes_CompanyIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
8214
+
8215
+ @Field(() => [MJAIAgentExample_])
8216
+ MJ_AIAgentExamples_CompanyIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
8217
+
8000
8218
  }
8001
8219
 
8002
8220
  //****************************************************************************
@@ -8153,6 +8371,28 @@ export class MJCompanyResolver extends ResolverBase {
8153
8371
  return result;
8154
8372
  }
8155
8373
 
8374
+ @FieldResolver(() => [MJAIAgentNote_])
8375
+ async AIAgentNotes_CompanyIDArray(@Root() mjcompany_: MJCompany_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
8376
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
8377
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8378
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
8379
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [CompanyID]='${mjcompany_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
8380
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
8381
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows);
8382
+ return result;
8383
+ }
8384
+
8385
+ @FieldResolver(() => [MJAIAgentExample_])
8386
+ async MJ_AIAgentExamples_CompanyIDArray(@Root() mjcompany_: MJCompany_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
8387
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
8388
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8389
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
8390
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [CompanyID]='${mjcompany_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
8391
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
8392
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
8393
+ return result;
8394
+ }
8395
+
8156
8396
  @Mutation(() => MJCompany_)
8157
8397
  async CreateMJCompany(
8158
8398
  @Arg('input', () => CreateMJCompanyInput) input: CreateMJCompanyInput,
@@ -9148,7 +9388,7 @@ export class MJRole_ {
9148
9388
  @MaxLength(16)
9149
9389
  ID: string;
9150
9390
 
9151
- @Field()
9391
+ @Field({description: `Role with full permissions to manage AI agents and all related entities. This role is required for AgentSpecSync operations to function correctly, allowing create, read, update, and delete operations on agents, prompts, actions, relationships, steps, and paths.`})
9152
9392
  @MaxLength(100)
9153
9393
  Name: string;
9154
9394
 
@@ -12329,24 +12569,24 @@ export class MJUser_ {
12329
12569
  @Field(() => [MJReportUserState_])
12330
12570
  MJ_ReportUserStates_UserIDArray: MJReportUserState_[]; // Link to MJ_ReportUserStates
12331
12571
 
12332
- @Field(() => [MJDashboardUserState_])
12333
- MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
12334
-
12335
12572
  @Field(() => [MJDashboardUserPreference_])
12336
12573
  MJ_DashboardUserPreferences_UserIDArray: MJDashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
12337
12574
 
12575
+ @Field(() => [MJDashboardUserState_])
12576
+ MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
12577
+
12338
12578
  @Field(() => [MJArtifactVersion_])
12339
12579
  MJ_ArtifactVersions_UserIDArray: MJArtifactVersion_[]; // Link to MJ_ArtifactVersions
12340
12580
 
12341
12581
  @Field(() => [MJPublicLink_])
12342
12582
  MJ_PublicLinks_UserIDArray: MJPublicLink_[]; // Link to MJ_PublicLinks
12343
12583
 
12344
- @Field(() => [MJScheduledJob_])
12345
- MJ_ScheduledJobs_NotifyUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
12346
-
12347
12584
  @Field(() => [MJScheduledJobRun_])
12348
12585
  MJ_ScheduledJobRuns_ExecutedByUserIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
12349
12586
 
12587
+ @Field(() => [MJScheduledJob_])
12588
+ MJ_ScheduledJobs_NotifyUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
12589
+
12350
12590
  @Field(() => [MJArtifactPermission_])
12351
12591
  MJ_ArtifactPermissions_UserIDArray: MJArtifactPermission_[]; // Link to MJ_ArtifactPermissions
12352
12592
 
@@ -12389,6 +12629,9 @@ export class MJUser_ {
12389
12629
  @Field(() => [MJTask_])
12390
12630
  MJ_Tasks_UserIDArray: MJTask_[]; // Link to MJ_Tasks
12391
12631
 
12632
+ @Field(() => [MJAIAgentExample_])
12633
+ MJ_AIAgentExamples_UserIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
12634
+
12392
12635
  @Field(() => [MJAIAgent_])
12393
12636
  AIAgents_OwnerUserIDArray: MJAIAgent_[]; // Link to AIAgents
12394
12637
 
@@ -12959,25 +13202,25 @@ export class MJUserResolverBase extends ResolverBase {
12959
13202
  return result;
12960
13203
  }
12961
13204
 
12962
- @FieldResolver(() => [MJDashboardUserState_])
12963
- async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12964
- this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
13205
+ @FieldResolver(() => [MJDashboardUserPreference_])
13206
+ async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13207
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
12965
13208
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12966
13209
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12967
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
13210
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
12968
13211
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12969
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
13212
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
12970
13213
  return result;
12971
13214
  }
12972
13215
 
12973
- @FieldResolver(() => [MJDashboardUserPreference_])
12974
- async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12975
- this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
13216
+ @FieldResolver(() => [MJDashboardUserState_])
13217
+ async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13218
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
12976
13219
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12977
13220
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12978
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
13221
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
12979
13222
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12980
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
13223
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
12981
13224
  return result;
12982
13225
  }
12983
13226
 
@@ -13003,25 +13246,25 @@ export class MJUserResolverBase extends ResolverBase {
13003
13246
  return result;
13004
13247
  }
13005
13248
 
13006
- @FieldResolver(() => [MJScheduledJob_])
13007
- async MJ_ScheduledJobs_NotifyUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13008
- this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
13249
+ @FieldResolver(() => [MJScheduledJobRun_])
13250
+ async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13251
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
13009
13252
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13010
13253
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13011
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [NotifyUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
13254
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
13012
13255
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13013
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
13256
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
13014
13257
  return result;
13015
13258
  }
13016
13259
 
13017
- @FieldResolver(() => [MJScheduledJobRun_])
13018
- async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13019
- this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
13260
+ @FieldResolver(() => [MJScheduledJob_])
13261
+ async MJ_ScheduledJobs_NotifyUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13262
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
13020
13263
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13021
13264
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13022
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
13265
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [NotifyUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
13023
13266
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13024
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
13267
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
13025
13268
  return result;
13026
13269
  }
13027
13270
 
@@ -13179,6 +13422,17 @@ export class MJUserResolverBase extends ResolverBase {
13179
13422
  return result;
13180
13423
  }
13181
13424
 
13425
+ @FieldResolver(() => [MJAIAgentExample_])
13426
+ async MJ_AIAgentExamples_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13427
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
13428
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13429
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13430
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
13431
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13432
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
13433
+ return result;
13434
+ }
13435
+
13182
13436
  @FieldResolver(() => [MJAIAgent_])
13183
13437
  async AIAgents_OwnerUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13184
13438
  this.CheckUserReadPermissions('AI Agents', userPayload);
@@ -23985,6 +24239,9 @@ export class MJConversationDetail_ {
23985
24239
  @Field(() => [MJConversationDetailArtifact_])
23986
24240
  MJ_ConversationDetailArtifacts_ConversationDetailIDArray: MJConversationDetailArtifact_[]; // Link to MJ_ConversationDetailArtifacts
23987
24241
 
24242
+ @Field(() => [MJAIAgentNote_])
24243
+ AIAgentNotes_SourceConversationDetailIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
24244
+
23988
24245
  @Field(() => [MJAIAgentRun_])
23989
24246
  MJ_AIAgentRuns_ConversationDetailIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
23990
24247
 
@@ -23994,6 +24251,9 @@ export class MJConversationDetail_ {
23994
24251
  @Field(() => [MJTask_])
23995
24252
  MJ_Tasks_ConversationDetailIDArray: MJTask_[]; // Link to MJ_Tasks
23996
24253
 
24254
+ @Field(() => [MJAIAgentExample_])
24255
+ MJ_AIAgentExamples_SourceConversationDetailIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
24256
+
23997
24257
  }
23998
24258
 
23999
24259
  //****************************************************************************
@@ -24212,6 +24472,17 @@ export class MJConversationDetailResolver extends ResolverBase {
24212
24472
  return result;
24213
24473
  }
24214
24474
 
24475
+ @FieldResolver(() => [MJAIAgentNote_])
24476
+ async AIAgentNotes_SourceConversationDetailIDArray(@Root() mjconversationdetail_: MJConversationDetail_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24477
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
24478
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
24479
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
24480
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [SourceConversationDetailID]='${mjconversationdetail_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
24481
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
24482
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows);
24483
+ return result;
24484
+ }
24485
+
24215
24486
  @FieldResolver(() => [MJAIAgentRun_])
24216
24487
  async MJ_AIAgentRuns_ConversationDetailIDArray(@Root() mjconversationdetail_: MJConversationDetail_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24217
24488
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -24245,6 +24516,17 @@ export class MJConversationDetailResolver extends ResolverBase {
24245
24516
  return result;
24246
24517
  }
24247
24518
 
24519
+ @FieldResolver(() => [MJAIAgentExample_])
24520
+ async MJ_AIAgentExamples_SourceConversationDetailIDArray(@Root() mjconversationdetail_: MJConversationDetail_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24521
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
24522
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
24523
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
24524
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [SourceConversationDetailID]='${mjconversationdetail_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
24525
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
24526
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
24527
+ return result;
24528
+ }
24529
+
24248
24530
  @Mutation(() => MJConversationDetail_)
24249
24531
  async CreateMJConversationDetail(
24250
24532
  @Arg('input', () => CreateMJConversationDetailInput) input: CreateMJConversationDetailInput,
@@ -24372,6 +24654,12 @@ export class MJConversation_ {
24372
24654
  @Field(() => [MJAIAgentRun_])
24373
24655
  MJ_AIAgentRuns_ConversationIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
24374
24656
 
24657
+ @Field(() => [MJAIAgentNote_])
24658
+ AIAgentNotes_SourceConversationIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
24659
+
24660
+ @Field(() => [MJAIAgentExample_])
24661
+ MJ_AIAgentExamples_SourceConversationIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
24662
+
24375
24663
  }
24376
24664
 
24377
24665
  //****************************************************************************
@@ -24576,6 +24864,28 @@ export class MJConversationResolver extends ResolverBase {
24576
24864
  return result;
24577
24865
  }
24578
24866
 
24867
+ @FieldResolver(() => [MJAIAgentNote_])
24868
+ async AIAgentNotes_SourceConversationIDArray(@Root() mjconversation_: MJConversation_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24869
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
24870
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
24871
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
24872
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [SourceConversationID]='${mjconversation_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
24873
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
24874
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows);
24875
+ return result;
24876
+ }
24877
+
24878
+ @FieldResolver(() => [MJAIAgentExample_])
24879
+ async MJ_AIAgentExamples_SourceConversationIDArray(@Root() mjconversation_: MJConversation_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24880
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
24881
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
24882
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
24883
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [SourceConversationID]='${mjconversation_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
24884
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
24885
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows);
24886
+ return result;
24887
+ }
24888
+
24579
24889
  @Mutation(() => MJConversation_)
24580
24890
  async CreateMJConversation(
24581
24891
  @Arg('input', () => CreateMJConversationInput) input: CreateMJConversationInput,
@@ -28982,6 +29292,9 @@ export class MJFileStorageProvider_ {
28982
29292
  @MaxLength(10)
28983
29293
  _mj__UpdatedAt: Date;
28984
29294
 
29295
+ @Field(() => Boolean, {description: `Indicates whether this storage provider supports native full-text search across file names and content. Providers with native search APIs (Google Drive, SharePoint, Dropbox, Box) have this set to true.`})
29296
+ SupportsSearch: boolean;
29297
+
28985
29298
  @Field(() => [MJFile_])
28986
29299
  Files_ProviderIDArray: MJFile_[]; // Link to Files
28987
29300
 
@@ -29012,6 +29325,9 @@ export class CreateMJFileStorageProviderInput {
29012
29325
 
29013
29326
  @Field(() => Boolean, { nullable: true })
29014
29327
  IsActive?: boolean;
29328
+
29329
+ @Field(() => Boolean, { nullable: true })
29330
+ SupportsSearch?: boolean;
29015
29331
  }
29016
29332
 
29017
29333
 
@@ -29041,6 +29357,9 @@ export class UpdateMJFileStorageProviderInput {
29041
29357
  @Field(() => Boolean, { nullable: true })
29042
29358
  IsActive?: boolean;
29043
29359
 
29360
+ @Field(() => Boolean, { nullable: true })
29361
+ SupportsSearch?: boolean;
29362
+
29044
29363
  @Field(() => [KeyValuePairInput], { nullable: true })
29045
29364
  OldValues___?: KeyValuePairInput[];
29046
29365
  }
@@ -42070,6 +42389,275 @@ export class MJArtifactResolver extends ResolverBase {
42070
42389
 
42071
42390
  }
42072
42391
 
42392
+ //****************************************************************************
42393
+ // ENTITY CLASS for MJ: AI Agent Examples
42394
+ //****************************************************************************
42395
+ @ObjectType({ description: `Stores example input/output pairs for AI agents to learn from successful interactions. Examples are always agent-specific and support optional user/company scoping for personalized examples.` })
42396
+ export class MJAIAgentExample_ {
42397
+ @Field()
42398
+ @MaxLength(16)
42399
+ ID: string;
42400
+
42401
+ @Field({description: `The AI agent this example is associated with. Examples are always agent-specific.`})
42402
+ @MaxLength(16)
42403
+ AgentID: string;
42404
+
42405
+ @Field({nullable: true, description: `Optional user scope. When populated, this example is specific to this user.`})
42406
+ @MaxLength(16)
42407
+ UserID?: string;
42408
+
42409
+ @Field({nullable: true, description: `Optional company scope. When populated, this example is specific to this company.`})
42410
+ @MaxLength(16)
42411
+ CompanyID?: string;
42412
+
42413
+ @Field({description: `Quick categorization of the example: Preference (demonstrates user preference), Constraint (shows constraint compliance), Context (provides contextual example), Example (typical successful interaction - most common), or Issue (demonstrates handling of known issue).`})
42414
+ @MaxLength(40)
42415
+ Type: string;
42416
+
42417
+ @Field({description: `The input text or prompt that was provided in this example interaction.`})
42418
+ ExampleInput: string;
42419
+
42420
+ @Field({description: `The successful output or response that the agent provided for this example.`})
42421
+ ExampleOutput: string;
42422
+
42423
+ @Field(() => Boolean, {description: `Indicates whether this example was automatically captured (1) or manually created (0).`})
42424
+ IsAutoGenerated: boolean;
42425
+
42426
+ @Field({nullable: true, description: `Optional reference to the conversation where this example originated.`})
42427
+ @MaxLength(16)
42428
+ SourceConversationID?: string;
42429
+
42430
+ @Field({nullable: true, description: `Optional reference to the specific conversation message that represents this example.`})
42431
+ @MaxLength(16)
42432
+ SourceConversationDetailID?: string;
42433
+
42434
+ @Field({nullable: true, description: `Optional reference to the AI agent run that generated this example.`})
42435
+ @MaxLength(16)
42436
+ SourceAIAgentRunID?: string;
42437
+
42438
+ @Field(() => Float, {nullable: true, description: `Optional success score (0-100) indicating the quality or effectiveness of this example based on user feedback or metrics.`})
42439
+ SuccessScore?: number;
42440
+
42441
+ @Field({nullable: true, description: `Internal comments about this example, not included in agent context injection.`})
42442
+ Comments?: string;
42443
+
42444
+ @Field({description: `Status of the example: Pending (awaiting review), Active (in use), or Revoked (disabled).`})
42445
+ @MaxLength(40)
42446
+ Status: string;
42447
+
42448
+ @Field()
42449
+ @MaxLength(10)
42450
+ _mj__CreatedAt: Date;
42451
+
42452
+ @Field()
42453
+ @MaxLength(10)
42454
+ _mj__UpdatedAt: Date;
42455
+
42456
+ @Field({nullable: true})
42457
+ @MaxLength(510)
42458
+ Agent?: string;
42459
+
42460
+ @Field({nullable: true})
42461
+ @MaxLength(200)
42462
+ User?: string;
42463
+
42464
+ @Field({nullable: true})
42465
+ @MaxLength(100)
42466
+ Company?: string;
42467
+
42468
+ @Field({nullable: true})
42469
+ @MaxLength(510)
42470
+ SourceConversation?: string;
42471
+
42472
+ }
42473
+
42474
+ //****************************************************************************
42475
+ // INPUT TYPE for MJ: AI Agent Examples
42476
+ //****************************************************************************
42477
+ @InputType()
42478
+ export class CreateMJAIAgentExampleInput {
42479
+ @Field({ nullable: true })
42480
+ ID?: string;
42481
+
42482
+ @Field({ nullable: true })
42483
+ AgentID?: string;
42484
+
42485
+ @Field({ nullable: true })
42486
+ UserID: string | null;
42487
+
42488
+ @Field({ nullable: true })
42489
+ CompanyID: string | null;
42490
+
42491
+ @Field({ nullable: true })
42492
+ Type?: string;
42493
+
42494
+ @Field({ nullable: true })
42495
+ ExampleInput?: string;
42496
+
42497
+ @Field({ nullable: true })
42498
+ ExampleOutput?: string;
42499
+
42500
+ @Field(() => Boolean, { nullable: true })
42501
+ IsAutoGenerated?: boolean;
42502
+
42503
+ @Field({ nullable: true })
42504
+ SourceConversationID: string | null;
42505
+
42506
+ @Field({ nullable: true })
42507
+ SourceConversationDetailID: string | null;
42508
+
42509
+ @Field({ nullable: true })
42510
+ SourceAIAgentRunID: string | null;
42511
+
42512
+ @Field(() => Float, { nullable: true })
42513
+ SuccessScore: number | null;
42514
+
42515
+ @Field({ nullable: true })
42516
+ Comments: string | null;
42517
+
42518
+ @Field({ nullable: true })
42519
+ Status?: string;
42520
+ }
42521
+
42522
+
42523
+ //****************************************************************************
42524
+ // INPUT TYPE for MJ: AI Agent Examples
42525
+ //****************************************************************************
42526
+ @InputType()
42527
+ export class UpdateMJAIAgentExampleInput {
42528
+ @Field()
42529
+ ID: string;
42530
+
42531
+ @Field({ nullable: true })
42532
+ AgentID?: string;
42533
+
42534
+ @Field({ nullable: true })
42535
+ UserID?: string | null;
42536
+
42537
+ @Field({ nullable: true })
42538
+ CompanyID?: string | null;
42539
+
42540
+ @Field({ nullable: true })
42541
+ Type?: string;
42542
+
42543
+ @Field({ nullable: true })
42544
+ ExampleInput?: string;
42545
+
42546
+ @Field({ nullable: true })
42547
+ ExampleOutput?: string;
42548
+
42549
+ @Field(() => Boolean, { nullable: true })
42550
+ IsAutoGenerated?: boolean;
42551
+
42552
+ @Field({ nullable: true })
42553
+ SourceConversationID?: string | null;
42554
+
42555
+ @Field({ nullable: true })
42556
+ SourceConversationDetailID?: string | null;
42557
+
42558
+ @Field({ nullable: true })
42559
+ SourceAIAgentRunID?: string | null;
42560
+
42561
+ @Field(() => Float, { nullable: true })
42562
+ SuccessScore?: number | null;
42563
+
42564
+ @Field({ nullable: true })
42565
+ Comments?: string | null;
42566
+
42567
+ @Field({ nullable: true })
42568
+ Status?: string;
42569
+
42570
+ @Field(() => [KeyValuePairInput], { nullable: true })
42571
+ OldValues___?: KeyValuePairInput[];
42572
+ }
42573
+
42574
+ //****************************************************************************
42575
+ // RESOLVER for MJ: AI Agent Examples
42576
+ //****************************************************************************
42577
+ @ObjectType()
42578
+ export class RunMJAIAgentExampleViewResult {
42579
+ @Field(() => [MJAIAgentExample_])
42580
+ Results: MJAIAgentExample_[];
42581
+
42582
+ @Field(() => String, {nullable: true})
42583
+ UserViewRunID?: string;
42584
+
42585
+ @Field(() => Int, {nullable: true})
42586
+ RowCount: number;
42587
+
42588
+ @Field(() => Int, {nullable: true})
42589
+ TotalRowCount: number;
42590
+
42591
+ @Field(() => Int, {nullable: true})
42592
+ ExecutionTime: number;
42593
+
42594
+ @Field({nullable: true})
42595
+ ErrorMessage?: string;
42596
+
42597
+ @Field(() => Boolean, {nullable: false})
42598
+ Success: boolean;
42599
+ }
42600
+
42601
+ @Resolver(MJAIAgentExample_)
42602
+ export class MJAIAgentExampleResolver extends ResolverBase {
42603
+ @Query(() => RunMJAIAgentExampleViewResult)
42604
+ async RunMJAIAgentExampleViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42605
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42606
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42607
+ }
42608
+
42609
+ @Query(() => RunMJAIAgentExampleViewResult)
42610
+ async RunMJAIAgentExampleViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42611
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42612
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42613
+ }
42614
+
42615
+ @Query(() => RunMJAIAgentExampleViewResult)
42616
+ async RunMJAIAgentExampleDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42617
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42618
+ input.EntityName = 'MJ: AI Agent Examples';
42619
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42620
+ }
42621
+ @Query(() => MJAIAgentExample_, { nullable: true })
42622
+ async MJAIAgentExample(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentExample_ | null> {
42623
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
42624
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42625
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42626
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
42627
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42628
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Agent Examples', rows && rows.length > 0 ? rows[0] : {})
42629
+ return result;
42630
+ }
42631
+
42632
+ @Mutation(() => MJAIAgentExample_)
42633
+ async CreateMJAIAgentExample(
42634
+ @Arg('input', () => CreateMJAIAgentExampleInput) input: CreateMJAIAgentExampleInput,
42635
+ @Ctx() { providers, userPayload }: AppContext,
42636
+ @PubSub() pubSub: PubSubEngine
42637
+ ) {
42638
+ const provider = GetReadWriteProvider(providers);
42639
+ return this.CreateRecord('MJ: AI Agent Examples', input, provider, userPayload, pubSub)
42640
+ }
42641
+
42642
+ @Mutation(() => MJAIAgentExample_)
42643
+ async UpdateMJAIAgentExample(
42644
+ @Arg('input', () => UpdateMJAIAgentExampleInput) input: UpdateMJAIAgentExampleInput,
42645
+ @Ctx() { providers, userPayload }: AppContext,
42646
+ @PubSub() pubSub: PubSubEngine
42647
+ ) {
42648
+ const provider = GetReadWriteProvider(providers);
42649
+ return this.UpdateRecord('MJ: AI Agent Examples', input, provider, userPayload, pubSub);
42650
+ }
42651
+
42652
+ @Mutation(() => MJAIAgentExample_)
42653
+ async DeleteMJAIAgentExample(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42654
+ const provider = GetReadWriteProvider(providers);
42655
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42656
+ return this.DeleteRecord('MJ: AI Agent Examples', key, options, provider, userPayload, pubSub);
42657
+ }
42658
+
42659
+ }
42660
+
42073
42661
  //****************************************************************************
42074
42662
  // ENTITY CLASS for MJ: Conversation Artifacts
42075
42663
  //****************************************************************************