@memberjunction/core-entities 5.33.0 → 5.34.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.
@@ -2985,6 +2985,112 @@ each time the agent processes a prompt step.`),
2985
2985
  * * Display Name: Root Last Run
2986
2986
  * * SQL Data Type: uniqueidentifier`),
2987
2987
  });
2988
+ /**
2989
+ * zod schema definition for the entity MJ: AI Agent Search Scopes
2990
+ */
2991
+ export const MJAIAgentSearchScopeSchema = z.object({
2992
+ ID: z.string().describe(`
2993
+ * * Field Name: ID
2994
+ * * Display Name: ID
2995
+ * * SQL Data Type: uniqueidentifier
2996
+ * * Default Value: newsequentialid()`),
2997
+ AgentID: z.string().describe(`
2998
+ * * Field Name: AgentID
2999
+ * * Display Name: Agent
3000
+ * * SQL Data Type: uniqueidentifier
3001
+ * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)`),
3002
+ SearchScopeID: z.string().describe(`
3003
+ * * Field Name: SearchScopeID
3004
+ * * Display Name: Search Scope
3005
+ * * SQL Data Type: uniqueidentifier
3006
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)`),
3007
+ Phase: z.union([z.literal('AgentInvoked'), z.literal('Both'), z.literal('PreExecution')]).describe(`
3008
+ * * Field Name: Phase
3009
+ * * Display Name: Execution Phase
3010
+ * * SQL Data Type: nvarchar(20)
3011
+ * * Default Value: Both
3012
+ * * Value List Type: List
3013
+ * * Possible Values
3014
+ * * AgentInvoked
3015
+ * * Both
3016
+ * * PreExecution
3017
+ * * Description: When this scope is used: PreExecution (injected as retrieved context before the agent runs), AgentInvoked (callable via the scoped search Action), or Both.`),
3018
+ Status: z.union([z.literal('Active'), z.literal('Inactive')]).describe(`
3019
+ * * Field Name: Status
3020
+ * * Display Name: Status
3021
+ * * SQL Data Type: nvarchar(20)
3022
+ * * Default Value: Active
3023
+ * * Value List Type: List
3024
+ * * Possible Values
3025
+ * * Active
3026
+ * * Inactive
3027
+ * * Description: Lifecycle status. Only Active rows are considered at runtime.`),
3028
+ StartAt: z.date().nullable().describe(`
3029
+ * * Field Name: StartAt
3030
+ * * Display Name: Start At
3031
+ * * SQL Data Type: datetimeoffset
3032
+ * * Description: Time-windowed activation for this agent-scope assignment. NULL = immediately active.`),
3033
+ EndAt: z.date().nullable().describe(`
3034
+ * * Field Name: EndAt
3035
+ * * Display Name: End At
3036
+ * * SQL Data Type: datetimeoffset
3037
+ * * Description: Time-windowed deactivation for this agent-scope assignment. NULL = no expiry.`),
3038
+ Priority: z.number().describe(`
3039
+ * * Field Name: Priority
3040
+ * * Display Name: Priority
3041
+ * * SQL Data Type: int
3042
+ * * Default Value: 100
3043
+ * * Description: Ordering within Phase. Lower = higher priority. Used for pre-execution ordering and as default preference for agent-invoked scope selection.`),
3044
+ MaxResults: z.number().nullable().describe(`
3045
+ * * Field Name: MaxResults
3046
+ * * Display Name: Max Results
3047
+ * * SQL Data Type: int
3048
+ * * Description: Override max results for this scope when used by this agent. NULL = use scope/engine default.`),
3049
+ MinScore: z.number().nullable().describe(`
3050
+ * * Field Name: MinScore
3051
+ * * Display Name: Minimum Score
3052
+ * * SQL Data Type: decimal(5, 4)
3053
+ * * Description: Override min score threshold (0.0000–1.0000). NULL = use engine default.`),
3054
+ QueryTemplateID: z.string().nullable().describe(`
3055
+ * * Field Name: QueryTemplateID
3056
+ * * Display Name: Query Template
3057
+ * * SQL Data Type: uniqueidentifier
3058
+ * * Related Entity/Foreign Key: MJ: Templates (vwTemplates.ID)
3059
+ * * Description: FK to Templates. MJ Template used to generate the search query from conversation context (lastUserMessage, recentMessages, payload, etc.). NULL = use lastUserMessage as-is. Can be further specialized per-provider via SearchScopeProvider.QueryTransformTemplateID.`),
3060
+ FusionWeightsOverride: z.string().nullable().describe(`
3061
+ * * Field Name: FusionWeightsOverride
3062
+ * * Display Name: Fusion Weights Override
3063
+ * * SQL Data Type: nvarchar(MAX)
3064
+ * * Description: JSON override for RRF per-provider fusion weights when this agent uses this scope. Resolution order: AIAgentSearchScope.FusionWeightsOverride > SearchScope.ScopeConfig.fusionWeights > engine defaults. Example: { "vector": 2.0, "fulltext": 1.0, "entity": 1.0 }.`),
3065
+ IsDefault: z.boolean().describe(`
3066
+ * * Field Name: IsDefault
3067
+ * * Display Name: Is Default Scope
3068
+ * * SQL Data Type: bit
3069
+ * * Default Value: 0
3070
+ * * Description: If true, this is the agent's default scope when no scope is specified in a tool call.`),
3071
+ __mj_CreatedAt: z.date().describe(`
3072
+ * * Field Name: __mj_CreatedAt
3073
+ * * Display Name: Created At
3074
+ * * SQL Data Type: datetimeoffset
3075
+ * * Default Value: getutcdate()`),
3076
+ __mj_UpdatedAt: z.date().describe(`
3077
+ * * Field Name: __mj_UpdatedAt
3078
+ * * Display Name: Updated At
3079
+ * * SQL Data Type: datetimeoffset
3080
+ * * Default Value: getutcdate()`),
3081
+ Agent: z.string().nullable().describe(`
3082
+ * * Field Name: Agent
3083
+ * * Display Name: Agent Name
3084
+ * * SQL Data Type: nvarchar(255)`),
3085
+ SearchScope: z.string().describe(`
3086
+ * * Field Name: SearchScope
3087
+ * * Display Name: Search Scope Name
3088
+ * * SQL Data Type: nvarchar(200)`),
3089
+ QueryTemplate: z.string().nullable().describe(`
3090
+ * * Field Name: QueryTemplate
3091
+ * * Display Name: Query Template Name
3092
+ * * SQL Data Type: nvarchar(255)`),
3093
+ });
2988
3094
  /**
2989
3095
  * zod schema definition for the entity MJ: AI Agent Step Paths
2990
3096
  */
@@ -3330,7 +3436,7 @@ export const MJAIAgentSchema = z.object({
3330
3436
  * * Default Value: getutcdate()`),
3331
3437
  ParentID: z.string().nullable().describe(`
3332
3438
  * * Field Name: ParentID
3333
- * * Display Name: Parent
3439
+ * * Display Name: Parent Agent
3334
3440
  * * SQL Data Type: uniqueidentifier
3335
3441
  * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)
3336
3442
  * * Description: References the parent agent in the hierarchical structure. If NULL, this is a root (top-level) agent.`),
@@ -3364,22 +3470,22 @@ export const MJAIAgentSchema = z.object({
3364
3470
  * * Description: When true, enables automatic compression of conversation context when the message threshold is reached.`),
3365
3471
  ContextCompressionMessageThreshold: z.number().nullable().describe(`
3366
3472
  * * Field Name: ContextCompressionMessageThreshold
3367
- * * Display Name: Context Compression Message Threshold
3473
+ * * Display Name: Message Threshold
3368
3474
  * * SQL Data Type: int
3369
3475
  * * Description: Number of messages that triggers context compression when EnableContextCompression is true.`),
3370
3476
  ContextCompressionPromptID: z.string().nullable().describe(`
3371
3477
  * * Field Name: ContextCompressionPromptID
3372
- * * Display Name: Context Compression Prompt
3478
+ * * Display Name: Compression Prompt
3373
3479
  * * SQL Data Type: uniqueidentifier
3374
3480
  * * Related Entity/Foreign Key: MJ: AI Prompts (vwAIPrompts.ID)`),
3375
3481
  ContextCompressionMessageRetentionCount: z.number().nullable().describe(`
3376
3482
  * * Field Name: ContextCompressionMessageRetentionCount
3377
- * * Display Name: Context Compression Message Retention Count
3483
+ * * Display Name: Retention Count
3378
3484
  * * SQL Data Type: int
3379
3485
  * * Description: Number of recent messages to keep uncompressed when context compression is applied.`),
3380
3486
  TypeID: z.string().nullable().describe(`
3381
3487
  * * Field Name: TypeID
3382
- * * Display Name: Type
3488
+ * * Display Name: Agent Type
3383
3489
  * * SQL Data Type: uniqueidentifier
3384
3490
  * * Related Entity/Foreign Key: MJ: AI Agent Types (vwAIAgentTypes.ID)
3385
3491
  * * Description: Reference to the AIAgentType that defines the category and system-level behavior for this agent. Cannot be null.`),
@@ -3416,25 +3522,25 @@ export const MJAIAgentSchema = z.object({
3416
3522
  * * Description: Controls whether model selection is driven by the Agent Type's system prompt or the Agent's specific prompt. Default is Agent Type for backward compatibility.`),
3417
3523
  PayloadDownstreamPaths: z.string().describe(`
3418
3524
  * * Field Name: PayloadDownstreamPaths
3419
- * * Display Name: Payload Downstream Paths
3525
+ * * Display Name: Downstream Paths
3420
3526
  * * SQL Data Type: nvarchar(MAX)
3421
3527
  * * Default Value: ["*"]
3422
3528
  * * Description: JSON array of paths that define which parts of the payload should be sent downstream to sub-agents. Use ["*"] to send entire payload, or specify paths like ["customer.id", "campaign.*", "analysis.sentiment"]`),
3423
3529
  PayloadUpstreamPaths: z.string().describe(`
3424
3530
  * * Field Name: PayloadUpstreamPaths
3425
- * * Display Name: Payload Upstream Paths
3531
+ * * Display Name: Upstream Paths
3426
3532
  * * SQL Data Type: nvarchar(MAX)
3427
3533
  * * Default Value: ["*"]
3428
3534
  * * Description: JSON array of paths that define which parts of the payload sub-agents are allowed to write back upstream. Use ["*"] to allow all writes, or specify paths like ["analysis.results", "recommendations.*"]`),
3429
3535
  PayloadSelfReadPaths: z.string().nullable().describe(`
3430
3536
  * * Field Name: PayloadSelfReadPaths
3431
- * * Display Name: Payload Self Read Paths
3537
+ * * Display Name: Self Read Paths
3432
3538
  * * SQL Data Type: nvarchar(MAX)
3433
3539
  * * Description: JSON array of paths that specify what parts of the payload the agent's own prompt can read. Controls downstream data
3434
3540
  flow when the agent executes its own prompt step.`),
3435
3541
  PayloadSelfWritePaths: z.string().nullable().describe(`
3436
3542
  * * Field Name: PayloadSelfWritePaths
3437
- * * Display Name: Payload Self Write Paths
3543
+ * * Display Name: Self Write Paths
3438
3544
  * * SQL Data Type: nvarchar(MAX)
3439
3545
  * * Description: JSON array of paths that specify what parts of the payload the agent's own prompt can write back. Controls upstream
3440
3546
  data flow when the agent executes its own prompt step.`),
@@ -3450,7 +3556,7 @@ data flow when the agent executes its own prompt step.`),
3450
3556
  * * Description: Optional JSON schema or requirements that define the expected structure and content of the agent's final payload. Used to validate the output when the agent declares success. Similar to OutputExample in AI Prompts.`),
3451
3557
  FinalPayloadValidationMode: z.union([z.literal('Fail'), z.literal('Retry'), z.literal('Warn')]).describe(`
3452
3558
  * * Field Name: FinalPayloadValidationMode
3453
- * * Display Name: Final Payload Validation Mode
3559
+ * * Display Name: Final Validation Mode
3454
3560
  * * SQL Data Type: nvarchar(25)
3455
3561
  * * Default Value: Retry
3456
3562
  * * Value List Type: List
@@ -3461,7 +3567,7 @@ data flow when the agent executes its own prompt step.`),
3461
3567
  * * Description: Determines how to handle validation failures when FinalPayloadValidation is specified. Options: Retry (default) - retry the agent with validation feedback, Fail - fail the agent run immediately, Warn - log a warning but allow success.`),
3462
3568
  FinalPayloadValidationMaxRetries: z.number().describe(`
3463
3569
  * * Field Name: FinalPayloadValidationMaxRetries
3464
- * * Display Name: Final Payload Validation Max Retries
3570
+ * * Display Name: Max Validation Retries
3465
3571
  * * SQL Data Type: int
3466
3572
  * * Default Value: 3
3467
3573
  * * Description: Maximum number of retry attempts allowed when FinalPayloadValidation fails with
@@ -3507,7 +3613,7 @@ if this limit is exceeded.`),
3507
3613
  * * Description: Optional JSON schema validation to apply to the input payload before agent execution begins. Uses the same JSONValidator format as FinalPayloadValidation.`),
3508
3614
  StartingPayloadValidationMode: z.union([z.literal('Fail'), z.literal('Warn')]).describe(`
3509
3615
  * * Field Name: StartingPayloadValidationMode
3510
- * * Display Name: Starting Payload Validation Mode
3616
+ * * Display Name: Starting Validation Mode
3511
3617
  * * SQL Data Type: nvarchar(25)
3512
3618
  * * Default Value: Fail
3513
3619
  * * Value List Type: List
@@ -3517,7 +3623,7 @@ if this limit is exceeded.`),
3517
3623
  * * Description: Determines how to handle StartingPayloadValidation failures. Fail = reject invalid input, Warn = log warning but proceed.`),
3518
3624
  DefaultPromptEffortLevel: z.number().nullable().describe(`
3519
3625
  * * Field Name: DefaultPromptEffortLevel
3520
- * * Display Name: Default Prompt Effort Level
3626
+ * * Display Name: Default Effort Level
3521
3627
  * * SQL Data Type: int
3522
3628
  * * Description: Default effort level for all prompts executed by this agent (1-100, where 1=minimal effort, 100=maximum effort). Takes precedence over individual prompt EffortLevel settings but can be overridden by runtime parameters. Inherited by sub-agents unless explicitly overridden.`),
3523
3629
  ChatHandlingOption: z.union([z.literal('Failed'), z.literal('Retry'), z.literal('Success')]).nullable().describe(`
@@ -3538,7 +3644,7 @@ if this limit is exceeded.`),
3538
3644
  * * Description: Default artifact type produced by this agent. This is the primary artifact type; additional artifact types can be linked via AIAgentArtifactType junction table. Can be NULL if agent does not produce artifacts by default.`),
3539
3645
  OwnerUserID: z.string().describe(`
3540
3646
  * * Field Name: OwnerUserID
3541
- * * Display Name: Owner User
3647
+ * * Display Name: Owner
3542
3648
  * * SQL Data Type: uniqueidentifier
3543
3649
  * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
3544
3650
  * * Default Value: ECAFCCEC-6A37-EF11-86D4-000D3A4E707E
@@ -3583,7 +3689,7 @@ if this limit is exceeded.`),
3583
3689
  * * Description: When enabled, agent notes will be automatically injected into the agent context based on scoping rules.`),
3584
3690
  MaxNotesToInject: z.number().describe(`
3585
3691
  * * Field Name: MaxNotesToInject
3586
- * * Display Name: Max Notes To Inject
3692
+ * * Display Name: Max Notes to Inject
3587
3693
  * * SQL Data Type: int
3588
3694
  * * Default Value: 5
3589
3695
  * * Description: Maximum number of notes to inject into agent context per request.`),
@@ -3606,7 +3712,7 @@ if this limit is exceeded.`),
3606
3712
  * * Description: When enabled, agent examples will be automatically injected into the agent context based on scoping rules.`),
3607
3713
  MaxExamplesToInject: z.number().describe(`
3608
3714
  * * Field Name: MaxExamplesToInject
3609
- * * Display Name: Max Examples To Inject
3715
+ * * Display Name: Max Examples to Inject
3610
3716
  * * SQL Data Type: int
3611
3717
  * * Default Value: 3
3612
3718
  * * Description: Maximum number of examples to inject into agent context per request.`),
@@ -3646,23 +3752,23 @@ if this limit is exceeded.`),
3646
3752
  * * Description: Maximum number of conversation messages to include when MessageMode is 'Latest' or 'Bookend'. NULL means no limit (ignored for 'None' and 'All' modes). Must be greater than 0 if specified. For 'Latest': keeps most recent N messages. For 'Bookend': keeps first 2 + most recent (N-2) messages.`),
3647
3753
  AttachmentStorageProviderID: z.string().nullable().describe(`
3648
3754
  * * Field Name: AttachmentStorageProviderID
3649
- * * Display Name: Attachment Storage Provider
3755
+ * * Display Name: Storage Provider
3650
3756
  * * SQL Data Type: uniqueidentifier
3651
3757
  * * Related Entity/Foreign Key: MJ: File Storage Providers (vwFileStorageProviders.ID)
3652
3758
  * * Description: File storage provider for large attachments. Overrides the default from AIConfiguration. NULL uses system default.`),
3653
3759
  AttachmentRootPath: z.string().nullable().describe(`
3654
3760
  * * Field Name: AttachmentRootPath
3655
- * * Display Name: Attachment Root Path
3761
+ * * Display Name: Root Path
3656
3762
  * * SQL Data Type: nvarchar(500)
3657
3763
  * * Description: Base path within the storage provider for this agent's attachments. Agent run ID and sequence number are appended to create unique paths. Format: /folder/subfolder`),
3658
3764
  InlineStorageThresholdBytes: z.number().nullable().describe(`
3659
3765
  * * Field Name: InlineStorageThresholdBytes
3660
- * * Display Name: Inline Storage Threshold Bytes
3766
+ * * Display Name: Inline Storage Threshold
3661
3767
  * * SQL Data Type: int
3662
3768
  * * Description: File size threshold for inline storage. Files <= this size are stored as base64 inline, larger files use MJStorage. NULL uses system default (1MB). Set to 0 to always use MJStorage.`),
3663
3769
  AgentTypePromptParams: z.string().nullable().describe(`
3664
3770
  * * Field Name: AgentTypePromptParams
3665
- * * Display Name: Agent Type Prompt Params
3771
+ * * Display Name: Prompt Parameters
3666
3772
  * * SQL Data Type: nvarchar(MAX)
3667
3773
  * * Description: JSON object containing parameter values that customize how this agent's type-level system prompt is rendered. The schema is defined by the agent type's PromptParamsSchema field. Allows per-agent control over which prompt sections are included, enabling token savings by excluding unused documentation.`),
3668
3774
  ScopeConfig: z.string().nullable().describe(`
@@ -3701,23 +3807,34 @@ if this limit is exceeded.`),
3701
3807
  * * Description: Foreign key to AIAgentCategory. Assigns this agent to an organizational category for grouping, filtering, and inherited assignment strategy resolution.`),
3702
3808
  AllowEphemeralClientTools: z.boolean().describe(`
3703
3809
  * * Field Name: AllowEphemeralClientTools
3704
- * * Display Name: Allow Ephemeral Client Tools
3810
+ * * Display Name: Allow Ephemeral Tools
3705
3811
  * * SQL Data Type: bit
3706
3812
  * * Default Value: 1
3707
3813
  * * Description: When true (default), this agent accepts runtime-registered ephemeral client tools that are not defined in metadata. Set to false for agents that require strict tool governance.`),
3708
3814
  DefaultStorageAccountID: z.string().nullable().describe(`
3709
3815
  * * Field Name: DefaultStorageAccountID
3710
- * * Display Name: Default Storage Account ID
3816
+ * * Display Name: Default Storage Account
3711
3817
  * * SQL Data Type: uniqueidentifier
3712
3818
  * * Related Entity/Foreign Key: MJ: File Storage Accounts (vwFileStorageAccounts.ID)
3713
3819
  * * Description: Default file storage account for this specific agent. Overrides both Type-level and Category-level defaults. Can be further overridden at runtime via ExecuteAgentParams.override.storageAccountId. FK to FileStorageAccount.`),
3820
+ SearchScopeAccess: z.union([z.literal('All'), z.literal('Assigned'), z.literal('None')]).describe(`
3821
+ * * Field Name: SearchScopeAccess
3822
+ * * Display Name: Search Scope Access
3823
+ * * SQL Data Type: nvarchar(20)
3824
+ * * Default Value: None
3825
+ * * Value List Type: List
3826
+ * * Possible Values
3827
+ * * All
3828
+ * * Assigned
3829
+ * * None
3830
+ * * Description: Controls the agent's search capability. All = may use any scope including Global; search action does not restrict. Assigned = may use ONLY scopes explicitly linked via AIAgentSearchScope; scoped search action enforces this. None = agent has no search capability; the scoped search action rejects all requests.`),
3714
3831
  Parent: z.string().nullable().describe(`
3715
3832
  * * Field Name: Parent
3716
3833
  * * Display Name: Parent Name
3717
3834
  * * SQL Data Type: nvarchar(255)`),
3718
3835
  ContextCompressionPrompt: z.string().nullable().describe(`
3719
3836
  * * Field Name: ContextCompressionPrompt
3720
- * * Display Name: Context Compression Prompt
3837
+ * * Display Name: Compression Prompt Name
3721
3838
  * * SQL Data Type: nvarchar(255)`),
3722
3839
  Type: z.string().nullable().describe(`
3723
3840
  * * Field Name: Type
@@ -3729,11 +3846,11 @@ if this limit is exceeded.`),
3729
3846
  * * SQL Data Type: nvarchar(100)`),
3730
3847
  OwnerUser: z.string().describe(`
3731
3848
  * * Field Name: OwnerUser
3732
- * * Display Name: Owner User Name
3849
+ * * Display Name: Owner Name
3733
3850
  * * SQL Data Type: nvarchar(100)`),
3734
3851
  AttachmentStorageProvider: z.string().nullable().describe(`
3735
3852
  * * Field Name: AttachmentStorageProvider
3736
- * * Display Name: Attachment Storage Provider Name
3853
+ * * Display Name: Storage Provider Name
3737
3854
  * * SQL Data Type: nvarchar(50)`),
3738
3855
  Category: z.string().nullable().describe(`
3739
3856
  * * Field Name: Category
@@ -3741,7 +3858,7 @@ if this limit is exceeded.`),
3741
3858
  * * SQL Data Type: nvarchar(200)`),
3742
3859
  DefaultStorageAccount: z.string().nullable().describe(`
3743
3860
  * * Field Name: DefaultStorageAccount
3744
- * * Display Name: Default Storage Account
3861
+ * * Display Name: Default Storage Account Name
3745
3862
  * * SQL Data Type: nvarchar(200)`),
3746
3863
  RootParentID: z.string().nullable().describe(`
3747
3864
  * * Field Name: RootParentID
@@ -6127,7 +6244,7 @@ export const MJAIResultCacheSchema = z.object({
6127
6244
  * * SQL Data Type: uniqueidentifier
6128
6245
  * * Related Entity/Foreign Key: MJ: AI Configurations (vwAIConfigurations.ID)
6129
6246
  * * Description: The configuration used for this execution.`),
6130
- PromptEmbedding: z.number().nullable().describe(`
6247
+ PromptEmbedding: z.string().nullable().describe(`
6131
6248
  * * Field Name: PromptEmbedding
6132
6249
  * * Display Name: Prompt Embedding
6133
6250
  * * SQL Data Type: varbinary
@@ -14339,7 +14456,7 @@ export const MJEntityFieldSchema = z.object({
14339
14456
  * * Default Value: newsequentialid()`),
14340
14457
  EntityID: z.string().describe(`
14341
14458
  * * Field Name: EntityID
14342
- * * Display Name: Entity ID
14459
+ * * Display Name: Entity
14343
14460
  * * SQL Data Type: uniqueidentifier
14344
14461
  * * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)`),
14345
14462
  Sequence: z.number().describe(`
@@ -14350,7 +14467,7 @@ export const MJEntityFieldSchema = z.object({
14350
14467
  * * Description: Display order of the field within the entity`),
14351
14468
  Name: z.string().describe(`
14352
14469
  * * Field Name: Name
14353
- * * Display Name: Name
14470
+ * * Display Name: Field Name
14354
14471
  * * SQL Data Type: nvarchar(255)
14355
14472
  * * Description: Name of the field within the database table`),
14356
14473
  DisplayName: z.string().nullable().describe(`
@@ -14388,7 +14505,7 @@ export const MJEntityFieldSchema = z.object({
14388
14505
  * * Description: Used for generating custom tabs in the generated forms, only utilized if GeneratedFormSection=Category`),
14389
14506
  Type: z.string().describe(`
14390
14507
  * * Field Name: Type
14391
- * * Display Name: Data Type
14508
+ * * Display Name: SQL Type
14392
14509
  * * SQL Data Type: nvarchar(100)
14393
14510
  * * Description: SQL Data type (auto maintained by CodeGen)`),
14394
14511
  Length: z.number().nullable().describe(`
@@ -14504,7 +14621,7 @@ export const MJEntityFieldSchema = z.object({
14504
14621
  * * Description: If set to 1, and if AllowUpdateAPI=1, the field can be edited within a view when the view is in edit mode.`),
14505
14622
  IncludeInUserSearchAPI: z.boolean().describe(`
14506
14623
  * * Field Name: IncludeInUserSearchAPI
14507
- * * Display Name: Include In User Search
14624
+ * * Display Name: Include In Search
14508
14625
  * * SQL Data Type: bit
14509
14626
  * * Default Value: 0
14510
14627
  * * Description: If set to 1, this column will be included in user search queries for both traditional and full text search`),
@@ -14521,13 +14638,13 @@ export const MJEntityFieldSchema = z.object({
14521
14638
  * * Description: NULL`),
14522
14639
  IncludeInGeneratedForm: z.boolean().describe(`
14523
14640
  * * Field Name: IncludeInGeneratedForm
14524
- * * Display Name: Include In Generated Form
14641
+ * * Display Name: Include In Form
14525
14642
  * * SQL Data Type: bit
14526
14643
  * * Default Value: 1
14527
14644
  * * Description: If set to 1, this field will be included in the generated form by CodeGen. If set to 0, this field will be excluded from the generated form. For custom forms, this field has no effect as the layout is controlled independently.`),
14528
14645
  GeneratedFormSection: z.union([z.literal('Category'), z.literal('Details'), z.literal('Top')]).describe(`
14529
14646
  * * Field Name: GeneratedFormSection
14530
- * * Display Name: Generated Form Section
14647
+ * * Display Name: Form Section
14531
14648
  * * SQL Data Type: nvarchar(10)
14532
14649
  * * Default Value: Details
14533
14650
  * * Value List Type: List
@@ -14541,7 +14658,7 @@ export const MJEntityFieldSchema = z.object({
14541
14658
  * * Display Name: Is Virtual
14542
14659
  * * SQL Data Type: bit
14543
14660
  * * Default Value: 0
14544
- * * Description: NULL`),
14661
+ * * Description: When 1, this field is read-only at the API layer (excluded from spCreate / spUpdate / GraphQL input types). Set automatically when the column is either (a) not present in the base table — e.g., a joined name lookup in the base view, or (b) a SQL Server computed column or PostgreSQL generated column. Cases (a) and (b) are distinguished by the IsComputed flag: IsVirtual=1, IsComputed=0 means view-only; IsVirtual=1, IsComputed=1 means computed/generated and physically present in the base table.`),
14545
14662
  IsNameField: z.boolean().describe(`
14546
14663
  * * Field Name: IsNameField
14547
14664
  * * Display Name: Is Name Field
@@ -14603,7 +14720,7 @@ export const MJEntityFieldSchema = z.object({
14603
14720
  * * Description: Indicates whether the related entity information should be automatically updated from the database schema. When set to 0, relationships not part of the database schema can be manually defined at the application and AI agent level. Defaults to 1.`),
14604
14721
  ValuesToPackWithSchema: z.union([z.literal('All'), z.literal('Auto'), z.literal('None')]).describe(`
14605
14722
  * * Field Name: ValuesToPackWithSchema
14606
- * * Display Name: Values To Pack With Schema
14723
+ * * Display Name: Values To Pack
14607
14724
  * * SQL Data Type: nvarchar(10)
14608
14725
  * * Default Value: Auto
14609
14726
  * * Value List Type: List
@@ -14625,13 +14742,13 @@ export const MJEntityFieldSchema = z.object({
14625
14742
  * * Description: Current status of the entity field - Active fields are available for use, Deprecated fields are discouraged but still functional, Disabled fields are not available for use`),
14626
14743
  AutoUpdateIsNameField: z.boolean().describe(`
14627
14744
  * * Field Name: AutoUpdateIsNameField
14628
- * * Display Name: Auto Update Is Name Field
14745
+ * * Display Name: Auto Update Name Field
14629
14746
  * * SQL Data Type: bit
14630
14747
  * * Default Value: 1
14631
14748
  * * Description: When 1, allows system/LLM to auto-update IsNameField; when 0, user has locked this field`),
14632
14749
  AutoUpdateDefaultInView: z.boolean().describe(`
14633
14750
  * * Field Name: AutoUpdateDefaultInView
14634
- * * Display Name: Auto Update Default In View
14751
+ * * Display Name: Auto Update View Default
14635
14752
  * * SQL Data Type: bit
14636
14753
  * * Default Value: 1
14637
14754
  * * Description: When 1, allows system/LLM to auto-update DefaultInView; when 0, user has locked this field`),
@@ -14691,7 +14808,7 @@ export const MJEntityFieldSchema = z.object({
14691
14808
  * * Description: When 1, indicates RelatedEntityID/RelatedEntityFieldName were set via metadata (not a database constraint). Protects these fields from being cleared by schema sync.`),
14692
14809
  RelatedEntityJoinFields: z.string().nullable().describe(`
14693
14810
  * * Field Name: RelatedEntityJoinFields
14694
- * * Display Name: Related Entity Join Fields
14811
+ * * Display Name: Related Join Fields
14695
14812
  * * SQL Data Type: nvarchar(MAX)
14696
14813
  * * Description: JSON configuration for additional fields to join from the related entity into this entity's base view. Supports modes: extend (add to NameField), override (replace NameField), disable (no joins). Schema: { mode?: string, fields?: [{ field: string, alias?: string }] }`),
14697
14814
  JSONType: z.string().nullable().describe(`
@@ -14701,7 +14818,7 @@ export const MJEntityFieldSchema = z.object({
14701
14818
  * * Description: The name of the TypeScript interface/type for this JSON field. When set, CodeGen emits a strongly-typed Object-suffixed accessor using this type instead of only the default string getter/setter.`),
14702
14819
  JSONTypeIsArray: z.boolean().describe(`
14703
14820
  * * Field Name: JSONTypeIsArray
14704
- * * Display Name: JSON Type Is Array
14821
+ * * Display Name: JSON Is Array
14705
14822
  * * SQL Data Type: bit
14706
14823
  * * Default Value: 0
14707
14824
  * * Description: If true, the field holds a JSON array of JSONType items. The Object accessor returns Array<JSONType> | null and the setter accepts Array<JSONType> | null.`),
@@ -14710,11 +14827,17 @@ export const MJEntityFieldSchema = z.object({
14710
14827
  * * Display Name: JSON Type Definition
14711
14828
  * * SQL Data Type: nvarchar(MAX)
14712
14829
  * * Description: Raw TypeScript code emitted by CodeGen above the entity class definition. Typically contains the interface/type definition referenced by JSONType. Can include imports, multiple types, or any valid TypeScript.`),
14713
- UserSearchPredicateAPI: z.string().describe(`
14830
+ UserSearchPredicateAPI: z.union([z.literal('BeginsWith'), z.literal('Contains'), z.literal('EndsWith'), z.literal('Exact')]).describe(`
14714
14831
  * * Field Name: UserSearchPredicateAPI
14715
- * * Display Name: User Search Predicate
14832
+ * * Display Name: Search Predicate
14716
14833
  * * SQL Data Type: nvarchar(20)
14717
14834
  * * Default Value: Contains
14835
+ * * Value List Type: List
14836
+ * * Possible Values
14837
+ * * BeginsWith
14838
+ * * Contains
14839
+ * * EndsWith
14840
+ * * Exact
14718
14841
  * * Description: Search predicate controlling how user search queries match against this field. Valid values: BeginsWith, Contains, EndsWith, Exact.`),
14719
14842
  AutoUpdateUserSearchPredicate: z.boolean().describe(`
14720
14843
  * * Field Name: AutoUpdateUserSearchPredicate
@@ -14724,7 +14847,7 @@ export const MJEntityFieldSchema = z.object({
14724
14847
  * * Description: When true, CodeGen LLM can auto-set the UserSearchPredicateAPI value during code generation runs.`),
14725
14848
  AutoUpdateFullTextSearch: z.boolean().describe(`
14726
14849
  * * Field Name: AutoUpdateFullTextSearch
14727
- * * Display Name: Auto Update Full Text Search
14850
+ * * Display Name: Auto Update Full Text
14728
14851
  * * SQL Data Type: bit
14729
14852
  * * Default Value: 1
14730
14853
  * * Description: When true, CodeGen LLM can auto-set the FullTextSearchEnabled value during code generation runs.`),
@@ -14734,6 +14857,12 @@ export const MJEntityFieldSchema = z.object({
14734
14857
  * * SQL Data Type: bit
14735
14858
  * * Default Value: 1
14736
14859
  * * Description: When true (default), CodeGen can automatically suggest and apply ExtendedType values (GeoLatitude, GeoLongitude, GeoAddress, etc.) during LLM field categorization. Set to 0 to lock admin-specified ExtendedType.`),
14860
+ IsComputed: z.boolean().describe(`
14861
+ * * Field Name: IsComputed
14862
+ * * Display Name: Is Computed
14863
+ * * SQL Data Type: bit
14864
+ * * Default Value: 0
14865
+ * * Description: When 1, this field is a SQL Server computed column or PostgreSQL generated column — physically present in the base table but read-only at the SQL layer. Distinct from IsVirtual, which means the column is not in the base table at all (e.g., joined name lookups in the base view). A computed column has both IsVirtual=1 (read-only at the API layer) and IsComputed=1 (physically in the table). The difference matters for base-view JOIN target selection: when an FK's related Name Field is computed, the generated view joins to the related entity's base table instead of its view.`),
14737
14866
  FieldCodeName: z.string().nullable().describe(`
14738
14867
  * * Field Name: FieldCodeName
14739
14868
  * * Display Name: Field Code Name
@@ -14772,11 +14901,11 @@ export const MJEntityFieldSchema = z.object({
14772
14901
  * * SQL Data Type: nvarchar(255)`),
14773
14902
  RelatedEntityBaseTable: z.string().nullable().describe(`
14774
14903
  * * Field Name: RelatedEntityBaseTable
14775
- * * Display Name: Related Entity Table
14904
+ * * Display Name: Related Entity Base Table
14776
14905
  * * SQL Data Type: nvarchar(255)`),
14777
14906
  RelatedEntityBaseView: z.string().nullable().describe(`
14778
14907
  * * Field Name: RelatedEntityBaseView
14779
- * * Display Name: Related Entity View
14908
+ * * Display Name: Related Entity Base View
14780
14909
  * * SQL Data Type: nvarchar(255)`),
14781
14910
  RelatedEntityCodeName: z.string().nullable().describe(`
14782
14911
  * * Field Name: RelatedEntityCodeName
@@ -21335,6 +21464,102 @@ export const MJSchemaInfoSchema = z.object({
21335
21464
  * * SQL Data Type: nvarchar(25)
21336
21465
  * * Description: Optional suffix to append to entity names generated for this schema. Can be overridden by mj.config.cjs NameRulesBySchema settings.`),
21337
21466
  });
21467
+ /**
21468
+ * zod schema definition for the entity MJ: Search Execution Logs
21469
+ */
21470
+ export const MJSearchExecutionLogSchema = z.object({
21471
+ ID: z.string().describe(`
21472
+ * * Field Name: ID
21473
+ * * Display Name: ID
21474
+ * * SQL Data Type: uniqueidentifier
21475
+ * * Default Value: newsequentialid()`),
21476
+ SearchScopeID: z.string().nullable().describe(`
21477
+ * * Field Name: SearchScopeID
21478
+ * * Display Name: Search Scope
21479
+ * * SQL Data Type: uniqueidentifier
21480
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
21481
+ * * Description: The SearchScope this invocation targeted. NULL for unscoped global search.`),
21482
+ UserID: z.string().nullable().describe(`
21483
+ * * Field Name: UserID
21484
+ * * Display Name: User
21485
+ * * SQL Data Type: uniqueidentifier
21486
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
21487
+ * * Description: The User who initiated the search. NULL for system / unauthenticated callers.`),
21488
+ AIAgentID: z.string().nullable().describe(`
21489
+ * * Field Name: AIAgentID
21490
+ * * Display Name: AI Agent
21491
+ * * SQL Data Type: uniqueidentifier
21492
+ * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)
21493
+ * * Description: The AIAgent identity if the search was invoked from an agent (e.g. ScopedSearchAction). NULL for direct human-initiated searches.`),
21494
+ Query: z.string().describe(`
21495
+ * * Field Name: Query
21496
+ * * Display Name: Query
21497
+ * * SQL Data Type: nvarchar(MAX)
21498
+ * * Description: Raw query string the user / agent submitted. NVARCHAR(MAX) because some queries are long (full sentences, snippets). Stored verbatim for analytics — do NOT rely on this for permission decisions.`),
21499
+ TotalDurationMs: z.number().describe(`
21500
+ * * Field Name: TotalDurationMs
21501
+ * * Display Name: Total Duration (ms)
21502
+ * * SQL Data Type: int
21503
+ * * Description: End-to-end search duration in milliseconds, measured at the SearchEngine.search call boundary (provider runs + fusion + rerank + permission filter + enrichment).`),
21504
+ ResultCount: z.number().describe(`
21505
+ * * Field Name: ResultCount
21506
+ * * Display Name: Result Count
21507
+ * * SQL Data Type: int
21508
+ * * Default Value: 0
21509
+ * * Description: Number of results returned to the caller after permission filtering, deduplication, and score-threshold trimming. Use this as the hit-rate denominator (rows where ResultCount > 0).`),
21510
+ RerankerName: z.string().nullable().describe(`
21511
+ * * Field Name: RerankerName
21512
+ * * Display Name: Reranker Name
21513
+ * * SQL Data Type: nvarchar(100)
21514
+ * * Description: BaseReRanker.Name of the reranker that ran (e.g. 'Cohere', 'Voyage', 'OpenAI', 'BGE', 'NoopReRanker'). NULL when no rerank stage executed for this invocation.`),
21515
+ RerankerCostCents: z.number().nullable().describe(`
21516
+ * * Field Name: RerankerCostCents
21517
+ * * Display Name: Reranker Cost (Cents)
21518
+ * * SQL Data Type: decimal(10, 4)
21519
+ * * Description: Total reranker spend in cents for this invocation, populated from the BaseReRanker.CostReporter callback via RerankerBudgetGuard. NULL when no rerank ran or no real-provider cost was incurred (Noop / BGE).`),
21520
+ Status: z.union([z.literal('Failure'), z.literal('Forbidden'), z.literal('Success')]).describe(`
21521
+ * * Field Name: Status
21522
+ * * Display Name: Status
21523
+ * * SQL Data Type: nvarchar(20)
21524
+ * * Value List Type: List
21525
+ * * Possible Values
21526
+ * * Failure
21527
+ * * Forbidden
21528
+ * * Success
21529
+ * * Description: Outcome of the search: 'Success' (results returned, possibly empty), 'Failure' (an exception bubbled out — see FailureReason), 'Forbidden' (the caller lacked SearchScopePermission for the requested scope). Constrained by CK_SearchExecutionLog_Status.`),
21530
+ FailureReason: z.string().nullable().describe(`
21531
+ * * Field Name: FailureReason
21532
+ * * Display Name: Failure Reason
21533
+ * * SQL Data Type: nvarchar(500)
21534
+ * * Description: Short human-readable failure reason when Status = 'Failure' or 'Forbidden'. NULL on success.`),
21535
+ ProvidersJSON: z.string().nullable().describe(`
21536
+ * * Field Name: ProvidersJSON
21537
+ * * Display Name: Providers Breakdown
21538
+ * * SQL Data Type: nvarchar(MAX)
21539
+ * * Description: JSON array of per-provider breakdown entries: [{"Provider":"Vector","DurationMs":123,"ResultCount":5,"ErrorMessage":null}, ...]. Used by the analytics dashboard for p50/p95 latency-by-provider charts and to spot consistently slow providers.`),
21540
+ __mj_CreatedAt: z.date().describe(`
21541
+ * * Field Name: __mj_CreatedAt
21542
+ * * Display Name: Created At
21543
+ * * SQL Data Type: datetimeoffset
21544
+ * * Default Value: getutcdate()`),
21545
+ __mj_UpdatedAt: z.date().describe(`
21546
+ * * Field Name: __mj_UpdatedAt
21547
+ * * Display Name: Updated At
21548
+ * * SQL Data Type: datetimeoffset
21549
+ * * Default Value: getutcdate()`),
21550
+ SearchScope: z.string().nullable().describe(`
21551
+ * * Field Name: SearchScope
21552
+ * * Display Name: Search Scope Name
21553
+ * * SQL Data Type: nvarchar(200)`),
21554
+ User: z.string().nullable().describe(`
21555
+ * * Field Name: User
21556
+ * * Display Name: User Name
21557
+ * * SQL Data Type: nvarchar(100)`),
21558
+ AIAgent: z.string().nullable().describe(`
21559
+ * * Field Name: AIAgent
21560
+ * * Display Name: AI Agent Name
21561
+ * * SQL Data Type: nvarchar(255)`),
21562
+ });
21338
21563
  /**
21339
21564
  * zod schema definition for the entity MJ: Search Providers
21340
21565
  */
@@ -21428,6 +21653,438 @@ export const MJSearchProviderSchema = z.object({
21428
21653
  * * Display Name: Credential Name
21429
21654
  * * SQL Data Type: nvarchar(200)`),
21430
21655
  });
21656
+ /**
21657
+ * zod schema definition for the entity MJ: Search Scope Entities
21658
+ */
21659
+ export const MJSearchScopeEntitySchema = z.object({
21660
+ ID: z.string().describe(`
21661
+ * * Field Name: ID
21662
+ * * Display Name: ID
21663
+ * * SQL Data Type: uniqueidentifier
21664
+ * * Default Value: newsequentialid()`),
21665
+ SearchScopeID: z.string().describe(`
21666
+ * * Field Name: SearchScopeID
21667
+ * * Display Name: Search Scope ID
21668
+ * * SQL Data Type: uniqueidentifier
21669
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)`),
21670
+ EntityID: z.string().describe(`
21671
+ * * Field Name: EntityID
21672
+ * * Display Name: Entity ID
21673
+ * * SQL Data Type: uniqueidentifier
21674
+ * * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)`),
21675
+ ExtraFilter: z.string().nullable().describe(`
21676
+ * * Field Name: ExtraFilter
21677
+ * * Display Name: Extra Filter
21678
+ * * SQL Data Type: nvarchar(MAX)
21679
+ * * Description: Optional SQL filter applied to this entity's search within this scope. Example: Status='Published' AND DepartmentID='abc'. Rendered as a Nunjucks template with SearchContext variables for multi-tenant filtering.`),
21680
+ UserSearchString: z.string().nullable().describe(`
21681
+ * * Field Name: UserSearchString
21682
+ * * Display Name: User Search String
21683
+ * * SQL Data Type: nvarchar(MAX)
21684
+ * * Description: Optional override for the UserSearchString passed to RunView for this entity within this scope. Nunjucks template (e.g., "{{ query }} AND type:policy"). NULL = pass the user's actual query through as-is.`),
21685
+ __mj_CreatedAt: z.date().describe(`
21686
+ * * Field Name: __mj_CreatedAt
21687
+ * * Display Name: Created At
21688
+ * * SQL Data Type: datetimeoffset
21689
+ * * Default Value: getutcdate()`),
21690
+ __mj_UpdatedAt: z.date().describe(`
21691
+ * * Field Name: __mj_UpdatedAt
21692
+ * * Display Name: Updated At
21693
+ * * SQL Data Type: datetimeoffset
21694
+ * * Default Value: getutcdate()`),
21695
+ SearchScope: z.string().describe(`
21696
+ * * Field Name: SearchScope
21697
+ * * Display Name: Search Scope
21698
+ * * SQL Data Type: nvarchar(200)`),
21699
+ Entity: z.string().describe(`
21700
+ * * Field Name: Entity
21701
+ * * Display Name: Entity
21702
+ * * SQL Data Type: nvarchar(255)`),
21703
+ });
21704
+ /**
21705
+ * zod schema definition for the entity MJ: Search Scope External Indexes
21706
+ */
21707
+ export const MJSearchScopeExternalIndexSchema = z.object({
21708
+ ID: z.string().describe(`
21709
+ * * Field Name: ID
21710
+ * * Display Name: ID
21711
+ * * SQL Data Type: uniqueidentifier
21712
+ * * Default Value: newsequentialid()`),
21713
+ SearchScopeID: z.string().describe(`
21714
+ * * Field Name: SearchScopeID
21715
+ * * Display Name: Search Scope ID
21716
+ * * SQL Data Type: uniqueidentifier
21717
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)`),
21718
+ IndexType: z.union([z.literal('AzureAISearch'), z.literal('Elasticsearch'), z.literal('OpenSearch'), z.literal('Other'), z.literal('Typesense'), z.literal('Vector')]).describe(`
21719
+ * * Field Name: IndexType
21720
+ * * Display Name: Index Type
21721
+ * * SQL Data Type: nvarchar(40)
21722
+ * * Default Value: Vector
21723
+ * * Value List Type: List
21724
+ * * Possible Values
21725
+ * * AzureAISearch
21726
+ * * Elasticsearch
21727
+ * * OpenSearch
21728
+ * * Other
21729
+ * * Typesense
21730
+ * * Vector
21731
+ * * Description: Discriminator. Determines which provider class consumes this row: Vector | Elasticsearch | Typesense | AzureAISearch | OpenSearch | Other.`),
21732
+ VectorIndexID: z.string().nullable().describe(`
21733
+ * * Field Name: VectorIndexID
21734
+ * * Display Name: Vector Index ID
21735
+ * * SQL Data Type: uniqueidentifier
21736
+ * * Related Entity/Foreign Key: MJ: Vector Indexes (vwVectorIndexes.ID)
21737
+ * * Description: FK to VectorIndex. REQUIRED when IndexType='Vector'. NULL for all other IndexType values.`),
21738
+ ExternalIndexName: z.string().nullable().describe(`
21739
+ * * Field Name: ExternalIndexName
21740
+ * * Display Name: External Index Name
21741
+ * * SQL Data Type: nvarchar(400)
21742
+ * * Description: For non-vector IndexTypes: the remote engine's index/collection/alias name (e.g., Elasticsearch index "kb_docs_v3", Typesense collection "articles"). NULL for IndexType='Vector' (VectorIndexID resolves the name instead).`),
21743
+ ExternalIndexConfig: z.string().nullable().describe(`
21744
+ * * Field Name: ExternalIndexConfig
21745
+ * * Display Name: External Index Config
21746
+ * * SQL Data Type: nvarchar(MAX)
21747
+ * * Description: JSON with extra connection/config hints the provider needs (cluster alias, routing key, custom analyzer, etc.). Provider-interpreted.`),
21748
+ MetadataFilter: z.string().nullable().describe(`
21749
+ * * Field Name: MetadataFilter
21750
+ * * Display Name: Metadata Filter
21751
+ * * SQL Data Type: nvarchar(MAX)
21752
+ * * Description: JSON filter expression applied as a native metadata filter on the remote engine. Pinecone/Qdrant/PGVector metadata filter, or Elasticsearch filter DSL, etc. Rendered as a Nunjucks template so SearchContext.PrimaryScopeRecordID and SearchContext.SecondaryScopes.* can be interpolated for multi-tenant filtering.`),
21753
+ __mj_CreatedAt: z.date().describe(`
21754
+ * * Field Name: __mj_CreatedAt
21755
+ * * Display Name: Created At
21756
+ * * SQL Data Type: datetimeoffset
21757
+ * * Default Value: getutcdate()`),
21758
+ __mj_UpdatedAt: z.date().describe(`
21759
+ * * Field Name: __mj_UpdatedAt
21760
+ * * Display Name: Updated At
21761
+ * * SQL Data Type: datetimeoffset
21762
+ * * Default Value: getutcdate()`),
21763
+ SearchScope: z.string().describe(`
21764
+ * * Field Name: SearchScope
21765
+ * * Display Name: Search Scope
21766
+ * * SQL Data Type: nvarchar(200)`),
21767
+ VectorIndex: z.string().nullable().describe(`
21768
+ * * Field Name: VectorIndex
21769
+ * * Display Name: Vector Index
21770
+ * * SQL Data Type: nvarchar(255)`),
21771
+ });
21772
+ /**
21773
+ * zod schema definition for the entity MJ: Search Scope Permissions
21774
+ */
21775
+ export const MJSearchScopePermissionSchema = z.object({
21776
+ ID: z.string().describe(`
21777
+ * * Field Name: ID
21778
+ * * Display Name: ID
21779
+ * * SQL Data Type: uniqueidentifier
21780
+ * * Default Value: newsequentialid()
21781
+ * * Description: Primary key. Auto-generated.`),
21782
+ SearchScopeID: z.string().describe(`
21783
+ * * Field Name: SearchScopeID
21784
+ * * Display Name: Search Scope
21785
+ * * SQL Data Type: uniqueidentifier
21786
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
21787
+ * * Description: The SearchScope this permission row applies to.`),
21788
+ UserID: z.string().nullable().describe(`
21789
+ * * Field Name: UserID
21790
+ * * Display Name: User
21791
+ * * SQL Data Type: uniqueidentifier
21792
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
21793
+ * * Description: The user this permission applies to. Mutually exclusive with RoleID — exactly one must be set.`),
21794
+ RoleID: z.string().nullable().describe(`
21795
+ * * Field Name: RoleID
21796
+ * * Display Name: Role
21797
+ * * SQL Data Type: uniqueidentifier
21798
+ * * Related Entity/Foreign Key: MJ: Roles (vwRoles.ID)
21799
+ * * Description: The role this permission applies to. Mutually exclusive with UserID — exactly one must be set. Permissions granted via roles flow to all users in that role.`),
21800
+ PermissionLevel: z.union([z.literal('Manage'), z.literal('None'), z.literal('Read'), z.literal('Search')]).describe(`
21801
+ * * Field Name: PermissionLevel
21802
+ * * Display Name: Permission Level
21803
+ * * SQL Data Type: nvarchar(20)
21804
+ * * Value List Type: List
21805
+ * * Possible Values
21806
+ * * Manage
21807
+ * * None
21808
+ * * Read
21809
+ * * Search
21810
+ * * Description: Capability granted on this SearchScope. None = explicit deny (overrides role grants), Read = view scope metadata, Search = invoke ScopedSearchAction, Manage = full edit including authoring of permission rows. The resolver picks the highest level when multiple grants apply (direct + role).`),
21811
+ __mj_CreatedAt: z.date().describe(`
21812
+ * * Field Name: __mj_CreatedAt
21813
+ * * Display Name: Created At
21814
+ * * SQL Data Type: datetimeoffset
21815
+ * * Default Value: getutcdate()`),
21816
+ __mj_UpdatedAt: z.date().describe(`
21817
+ * * Field Name: __mj_UpdatedAt
21818
+ * * Display Name: Updated At
21819
+ * * SQL Data Type: datetimeoffset
21820
+ * * Default Value: getutcdate()`),
21821
+ SearchScope: z.string().describe(`
21822
+ * * Field Name: SearchScope
21823
+ * * Display Name: Search Scope Name
21824
+ * * SQL Data Type: nvarchar(200)`),
21825
+ User: z.string().nullable().describe(`
21826
+ * * Field Name: User
21827
+ * * Display Name: User Name
21828
+ * * SQL Data Type: nvarchar(100)`),
21829
+ Role: z.string().nullable().describe(`
21830
+ * * Field Name: Role
21831
+ * * Display Name: Role Name
21832
+ * * SQL Data Type: nvarchar(50)`),
21833
+ });
21834
+ /**
21835
+ * zod schema definition for the entity MJ: Search Scope Providers
21836
+ */
21837
+ export const MJSearchScopeProviderSchema = z.object({
21838
+ ID: z.string().describe(`
21839
+ * * Field Name: ID
21840
+ * * Display Name: ID
21841
+ * * SQL Data Type: uniqueidentifier
21842
+ * * Default Value: newsequentialid()`),
21843
+ SearchScopeID: z.string().describe(`
21844
+ * * Field Name: SearchScopeID
21845
+ * * Display Name: Search Scope
21846
+ * * SQL Data Type: uniqueidentifier
21847
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)`),
21848
+ SearchProviderID: z.string().describe(`
21849
+ * * Field Name: SearchProviderID
21850
+ * * Display Name: Search Provider
21851
+ * * SQL Data Type: uniqueidentifier
21852
+ * * Related Entity/Foreign Key: MJ: Search Providers (vwSearchProviders.ID)`),
21853
+ Enabled: z.boolean().describe(`
21854
+ * * Field Name: Enabled
21855
+ * * Display Name: Enabled
21856
+ * * SQL Data Type: bit
21857
+ * * Default Value: 1
21858
+ * * Description: Whether this provider is active for this scope. Lets an admin toggle providers off per-scope without deleting the row.`),
21859
+ MaxResultsOverride: z.number().nullable().describe(`
21860
+ * * Field Name: MaxResultsOverride
21861
+ * * Display Name: Max Results Override
21862
+ * * SQL Data Type: int
21863
+ * * Description: Override the max-results value for this provider within this scope. NULL = use the provider's default.`),
21864
+ ProviderConfigOverride: z.string().nullable().describe(`
21865
+ * * Field Name: ProviderConfigOverride
21866
+ * * Display Name: Provider Config Override
21867
+ * * SQL Data Type: nvarchar(MAX)
21868
+ * * Description: JSON override for provider-specific configuration within this scope. Provider interprets.`),
21869
+ QueryTransformTemplateID: z.string().nullable().describe(`
21870
+ * * Field Name: QueryTransformTemplateID
21871
+ * * Display Name: Query Transform Template
21872
+ * * SQL Data Type: uniqueidentifier
21873
+ * * Related Entity/Foreign Key: MJ: Templates (vwTemplates.ID)
21874
+ * * Description: Optional FK to Templates. When set, the user/agent query is rewritten through this Template before being sent to this provider. Lets vector providers get a chunk-shaped rewrite while FTS providers get keyword extraction within the same scope. Resolution order: this > AIAgentSearchScope.QueryTemplateID > raw lastUserMessage.`),
21875
+ __mj_CreatedAt: z.date().describe(`
21876
+ * * Field Name: __mj_CreatedAt
21877
+ * * Display Name: Created At
21878
+ * * SQL Data Type: datetimeoffset
21879
+ * * Default Value: getutcdate()`),
21880
+ __mj_UpdatedAt: z.date().describe(`
21881
+ * * Field Name: __mj_UpdatedAt
21882
+ * * Display Name: Updated At
21883
+ * * SQL Data Type: datetimeoffset
21884
+ * * Default Value: getutcdate()`),
21885
+ SearchScope: z.string().describe(`
21886
+ * * Field Name: SearchScope
21887
+ * * Display Name: Search Scope Name
21888
+ * * SQL Data Type: nvarchar(200)`),
21889
+ SearchProvider: z.string().describe(`
21890
+ * * Field Name: SearchProvider
21891
+ * * Display Name: Search Provider Name
21892
+ * * SQL Data Type: nvarchar(200)`),
21893
+ QueryTransformTemplate: z.string().nullable().describe(`
21894
+ * * Field Name: QueryTransformTemplate
21895
+ * * Display Name: Query Transform Template Name
21896
+ * * SQL Data Type: nvarchar(255)`),
21897
+ });
21898
+ /**
21899
+ * zod schema definition for the entity MJ: Search Scope Storage Accounts
21900
+ */
21901
+ export const MJSearchScopeStorageAccountSchema = z.object({
21902
+ ID: z.string().describe(`
21903
+ * * Field Name: ID
21904
+ * * Display Name: ID
21905
+ * * SQL Data Type: uniqueidentifier
21906
+ * * Default Value: newsequentialid()`),
21907
+ SearchScopeID: z.string().describe(`
21908
+ * * Field Name: SearchScopeID
21909
+ * * Display Name: Search Scope
21910
+ * * SQL Data Type: uniqueidentifier
21911
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)`),
21912
+ FileStorageAccountID: z.string().describe(`
21913
+ * * Field Name: FileStorageAccountID
21914
+ * * Display Name: Storage Account
21915
+ * * SQL Data Type: uniqueidentifier
21916
+ * * Related Entity/Foreign Key: MJ: File Storage Accounts (vwFileStorageAccounts.ID)`),
21917
+ FolderPath: z.string().nullable().describe(`
21918
+ * * Field Name: FolderPath
21919
+ * * Display Name: Folder Path
21920
+ * * SQL Data Type: nvarchar(1000)
21921
+ * * Description: Optional folder path restriction. NULL = entire storage account. Example: /policies/hr/. Rendered as a Nunjucks template with SearchContext variables so platforms can do per-tenant folder routing like /tenants/{{ context.PrimaryScopeRecordID }}/.`),
21922
+ __mj_CreatedAt: z.date().describe(`
21923
+ * * Field Name: __mj_CreatedAt
21924
+ * * Display Name: Created At
21925
+ * * SQL Data Type: datetimeoffset
21926
+ * * Default Value: getutcdate()`),
21927
+ __mj_UpdatedAt: z.date().describe(`
21928
+ * * Field Name: __mj_UpdatedAt
21929
+ * * Display Name: Updated At
21930
+ * * SQL Data Type: datetimeoffset
21931
+ * * Default Value: getutcdate()`),
21932
+ SearchScope: z.string().describe(`
21933
+ * * Field Name: SearchScope
21934
+ * * Display Name: Search Scope Name
21935
+ * * SQL Data Type: nvarchar(200)`),
21936
+ FileStorageAccount: z.string().describe(`
21937
+ * * Field Name: FileStorageAccount
21938
+ * * Display Name: Storage Account Name
21939
+ * * SQL Data Type: nvarchar(200)`),
21940
+ });
21941
+ /**
21942
+ * zod schema definition for the entity MJ: Search Scope Test Queries
21943
+ */
21944
+ export const MJSearchScopeTestQuerySchema = z.object({
21945
+ ID: z.string().describe(`
21946
+ * * Field Name: ID
21947
+ * * Display Name: ID
21948
+ * * SQL Data Type: uniqueidentifier
21949
+ * * Default Value: newsequentialid()`),
21950
+ SearchScopeID: z.string().describe(`
21951
+ * * Field Name: SearchScopeID
21952
+ * * Display Name: Search Scope
21953
+ * * SQL Data Type: uniqueidentifier
21954
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
21955
+ * * Description: The SearchScope this test query belongs to. Cascade-restricted via FK so accidental scope deletion preserves test history.`),
21956
+ Label: z.string().describe(`
21957
+ * * Field Name: Label
21958
+ * * Display Name: Label
21959
+ * * SQL Data Type: nvarchar(200)
21960
+ * * Description: Short human-readable label for the test query, shown in the form's test-query grid (e.g. "VIP customer escalation", "expense reimbursement policy").`),
21961
+ Query: z.string().describe(`
21962
+ * * Field Name: Query
21963
+ * * Display Name: Query
21964
+ * * SQL Data Type: nvarchar(MAX)
21965
+ * * Description: The query text itself. NVARCHAR(MAX) because canonical queries can be full sentences or chunks of natural-language context.`),
21966
+ ExpectedTopResultEntity: z.string().nullable().describe(`
21967
+ * * Field Name: ExpectedTopResultEntity
21968
+ * * Display Name: Expected Top Result Entity
21969
+ * * SQL Data Type: nvarchar(255)
21970
+ * * Description: Optional MJ entity name (e.g. "Contacts", "Documents") of the expected top result. When set together with ExpectedTopResultRecordID, lets the test runner assert that the tuned scope returns the right record at rank #1 — a regression tripwire for fusion / reranker changes.`),
21971
+ ExpectedTopResultRecordID: z.string().nullable().describe(`
21972
+ * * Field Name: ExpectedTopResultRecordID
21973
+ * * Display Name: Expected Top Result Record ID
21974
+ * * SQL Data Type: uniqueidentifier
21975
+ * * Description: Optional record ID of the expected top result, paired with ExpectedTopResultEntity. NULL = no assertion (the query is exploratory).`),
21976
+ Notes: z.string().nullable().describe(`
21977
+ * * Field Name: Notes
21978
+ * * Display Name: Notes
21979
+ * * SQL Data Type: nvarchar(MAX)
21980
+ * * Description: Free-form notes explaining why this query is canonical or what edge case it represents.`),
21981
+ __mj_CreatedAt: z.date().describe(`
21982
+ * * Field Name: __mj_CreatedAt
21983
+ * * Display Name: Created At
21984
+ * * SQL Data Type: datetimeoffset
21985
+ * * Default Value: getutcdate()`),
21986
+ __mj_UpdatedAt: z.date().describe(`
21987
+ * * Field Name: __mj_UpdatedAt
21988
+ * * Display Name: Updated At
21989
+ * * SQL Data Type: datetimeoffset
21990
+ * * Default Value: getutcdate()`),
21991
+ SearchScope: z.string().describe(`
21992
+ * * Field Name: SearchScope
21993
+ * * Display Name: Search Scope Name
21994
+ * * SQL Data Type: nvarchar(200)`),
21995
+ });
21996
+ /**
21997
+ * zod schema definition for the entity MJ: Search Scopes
21998
+ */
21999
+ export const MJSearchScopeSchema = z.object({
22000
+ ID: z.string().describe(`
22001
+ * * Field Name: ID
22002
+ * * Display Name: ID
22003
+ * * SQL Data Type: uniqueidentifier
22004
+ * * Default Value: newsequentialid()`),
22005
+ Name: z.string().describe(`
22006
+ * * Field Name: Name
22007
+ * * Display Name: Name
22008
+ * * SQL Data Type: nvarchar(200)
22009
+ * * Description: Human-readable scope name (e.g., "HR Policies", "Engineering Docs"). Unique across the system.`),
22010
+ Description: z.string().nullable().describe(`
22011
+ * * Field Name: Description
22012
+ * * Display Name: Description
22013
+ * * SQL Data Type: nvarchar(MAX)
22014
+ * * Description: Detailed description of what this scope covers. Surfaced to agents in the available-scopes prompt injection so the LLM can choose a scope.`),
22015
+ Icon: z.string().nullable().describe(`
22016
+ * * Field Name: Icon
22017
+ * * Display Name: Icon
22018
+ * * SQL Data Type: nvarchar(200)
22019
+ * * Description: Font Awesome (or equivalent) icon class used by the scope selector UI.`),
22020
+ IsGlobal: z.boolean().describe(`
22021
+ * * Field Name: IsGlobal
22022
+ * * Display Name: Is Global
22023
+ * * SQL Data Type: bit
22024
+ * * Default Value: 0
22025
+ * * Description: If true, this scope includes everything (equivalent to no scope filtering). Exactly one Global scope should exist; it is seeded via metadata sync.`),
22026
+ IsDefault: z.boolean().describe(`
22027
+ * * Field Name: IsDefault
22028
+ * * Display Name: Is Default
22029
+ * * SQL Data Type: bit
22030
+ * * Default Value: 0
22031
+ * * Description: If true, this is the default scope for users/agents that do not specify one.`),
22032
+ OwnerUserID: z.string().nullable().describe(`
22033
+ * * Field Name: OwnerUserID
22034
+ * * Display Name: Owner User
22035
+ * * SQL Data Type: uniqueidentifier
22036
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
22037
+ * * Description: NULL = organization-wide scope. Set = personal scope owned by this user (visible/usable only by that user unless explicitly shared).`),
22038
+ Status: z.union([z.literal('Active'), z.literal('Inactive')]).describe(`
22039
+ * * Field Name: Status
22040
+ * * Display Name: Status
22041
+ * * SQL Data Type: nvarchar(20)
22042
+ * * Default Value: Active
22043
+ * * Value List Type: List
22044
+ * * Possible Values
22045
+ * * Active
22046
+ * * Inactive
22047
+ * * Description: Lifecycle status. Only Active scopes are considered at query time.`),
22048
+ StartAt: z.date().nullable().describe(`
22049
+ * * Field Name: StartAt
22050
+ * * Display Name: Start At
22051
+ * * SQL Data Type: datetimeoffset
22052
+ * * Description: Optional time-window activation. Scope is inactive before StartAt. NULL = immediately active.`),
22053
+ EndAt: z.date().nullable().describe(`
22054
+ * * Field Name: EndAt
22055
+ * * Display Name: End At
22056
+ * * SQL Data Type: datetimeoffset
22057
+ * * Description: Optional time-window deactivation. Scope is inactive after EndAt. NULL = no expiry.`),
22058
+ ScopeConfig: z.string().nullable().describe(`
22059
+ * * Field Name: ScopeConfig
22060
+ * * Display Name: Scope Configuration
22061
+ * * SQL Data Type: nvarchar(MAX)
22062
+ * * Description: JSON configuration for advanced scope behavior. Recognized keys: rrfK (RRF k parameter), fusionWeights (per-provider weights), reRanker (optional re-ranker stage config: driverClass, inputTopN, outputTopN, config), permissionOverfetchFactor.`),
22063
+ SearchContextConfig: z.string().nullable().describe(`
22064
+ * * Field Name: SearchContextConfig
22065
+ * * Display Name: Search Context Configuration
22066
+ * * SQL Data Type: nvarchar(MAX)
22067
+ * * Description: JSON defining available multi-tenant SearchContext dimensions, inheritance modes, and validation rules. Uses the SecondaryScopeConfig structure shared with the agent memory system (@memberjunction/ai-core-plus). NULL = scope is not multi-tenant aware.`),
22068
+ RerankerBudgetCents: z.number().nullable().describe(`
22069
+ * * Field Name: RerankerBudgetCents
22070
+ * * Display Name: Reranker Budget (Cents)
22071
+ * * SQL Data Type: int
22072
+ * * Description: Optional cap on reranker spend (in cents) per search invocation against this scope. NULL means uncapped — existing behavior. When set, the SearchEngine's budget guard short-circuits any reranker call whose projected cost would push the run total past this value, and accumulates actual post-call cost via each reranker's CostReporter callback (BaseReRanker.CostReporter). Real-provider rerankers (Cohere, Voyage, OpenAI) report cost; NoopReRanker and BGEReRanker report zero (local / pass-through).`),
22073
+ __mj_CreatedAt: z.date().describe(`
22074
+ * * Field Name: __mj_CreatedAt
22075
+ * * Display Name: Created At
22076
+ * * SQL Data Type: datetimeoffset
22077
+ * * Default Value: getutcdate()`),
22078
+ __mj_UpdatedAt: z.date().describe(`
22079
+ * * Field Name: __mj_UpdatedAt
22080
+ * * Display Name: Updated At
22081
+ * * SQL Data Type: datetimeoffset
22082
+ * * Default Value: getutcdate()`),
22083
+ OwnerUser: z.string().nullable().describe(`
22084
+ * * Field Name: OwnerUser
22085
+ * * Display Name: Owner User Name
22086
+ * * SQL Data Type: nvarchar(100)`),
22087
+ });
21431
22088
  /**
21432
22089
  * zod schema definition for the entity MJ: Skills
21433
22090
  */
@@ -32680,6 +33337,251 @@ MJAIAgentRunEntity = __decorate([
32680
33337
  RegisterClass(BaseEntity, 'MJ: AI Agent Runs')
32681
33338
  ], MJAIAgentRunEntity);
32682
33339
  export { MJAIAgentRunEntity };
33340
+ /**
33341
+ * MJ: AI Agent Search Scopes - strongly typed entity sub-class
33342
+ * * Schema: __mj
33343
+ * * Base Table: AIAgentSearchScope
33344
+ * * Base View: vwAIAgentSearchScopes
33345
+ * * @description Many-to-many between agents and search scopes, with phase and scheduling control. Drives both pre-execution RAG and agent-invoked scoped search.
33346
+ * * Primary Key: ID
33347
+ * @extends {BaseEntity}
33348
+ * @class
33349
+ * @public
33350
+ */
33351
+ let MJAIAgentSearchScopeEntity = class MJAIAgentSearchScopeEntity extends BaseEntity {
33352
+ /**
33353
+ * Loads the MJ: AI Agent Search Scopes record from the database
33354
+ * @param ID: string - primary key value to load the MJ: AI Agent Search Scopes record.
33355
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
33356
+ * @returns {Promise<boolean>} - true if successful, false otherwise
33357
+ * @public
33358
+ * @async
33359
+ * @memberof MJAIAgentSearchScopeEntity
33360
+ * @method
33361
+ * @override
33362
+ */
33363
+ async Load(ID, EntityRelationshipsToLoad) {
33364
+ const compositeKey = new CompositeKey();
33365
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
33366
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
33367
+ }
33368
+ /**
33369
+ * * Field Name: ID
33370
+ * * Display Name: ID
33371
+ * * SQL Data Type: uniqueidentifier
33372
+ * * Default Value: newsequentialid()
33373
+ */
33374
+ get ID() {
33375
+ return this.Get('ID');
33376
+ }
33377
+ set ID(value) {
33378
+ this.Set('ID', value);
33379
+ }
33380
+ /**
33381
+ * * Field Name: AgentID
33382
+ * * Display Name: Agent
33383
+ * * SQL Data Type: uniqueidentifier
33384
+ * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)
33385
+ */
33386
+ get AgentID() {
33387
+ return this.Get('AgentID');
33388
+ }
33389
+ set AgentID(value) {
33390
+ this.Set('AgentID', value);
33391
+ }
33392
+ /**
33393
+ * * Field Name: SearchScopeID
33394
+ * * Display Name: Search Scope
33395
+ * * SQL Data Type: uniqueidentifier
33396
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
33397
+ */
33398
+ get SearchScopeID() {
33399
+ return this.Get('SearchScopeID');
33400
+ }
33401
+ set SearchScopeID(value) {
33402
+ this.Set('SearchScopeID', value);
33403
+ }
33404
+ /**
33405
+ * * Field Name: Phase
33406
+ * * Display Name: Execution Phase
33407
+ * * SQL Data Type: nvarchar(20)
33408
+ * * Default Value: Both
33409
+ * * Value List Type: List
33410
+ * * Possible Values
33411
+ * * AgentInvoked
33412
+ * * Both
33413
+ * * PreExecution
33414
+ * * Description: When this scope is used: PreExecution (injected as retrieved context before the agent runs), AgentInvoked (callable via the scoped search Action), or Both.
33415
+ */
33416
+ get Phase() {
33417
+ return this.Get('Phase');
33418
+ }
33419
+ set Phase(value) {
33420
+ this.Set('Phase', value);
33421
+ }
33422
+ /**
33423
+ * * Field Name: Status
33424
+ * * Display Name: Status
33425
+ * * SQL Data Type: nvarchar(20)
33426
+ * * Default Value: Active
33427
+ * * Value List Type: List
33428
+ * * Possible Values
33429
+ * * Active
33430
+ * * Inactive
33431
+ * * Description: Lifecycle status. Only Active rows are considered at runtime.
33432
+ */
33433
+ get Status() {
33434
+ return this.Get('Status');
33435
+ }
33436
+ set Status(value) {
33437
+ this.Set('Status', value);
33438
+ }
33439
+ /**
33440
+ * * Field Name: StartAt
33441
+ * * Display Name: Start At
33442
+ * * SQL Data Type: datetimeoffset
33443
+ * * Description: Time-windowed activation for this agent-scope assignment. NULL = immediately active.
33444
+ */
33445
+ get StartAt() {
33446
+ return this.Get('StartAt');
33447
+ }
33448
+ set StartAt(value) {
33449
+ this.Set('StartAt', value);
33450
+ }
33451
+ /**
33452
+ * * Field Name: EndAt
33453
+ * * Display Name: End At
33454
+ * * SQL Data Type: datetimeoffset
33455
+ * * Description: Time-windowed deactivation for this agent-scope assignment. NULL = no expiry.
33456
+ */
33457
+ get EndAt() {
33458
+ return this.Get('EndAt');
33459
+ }
33460
+ set EndAt(value) {
33461
+ this.Set('EndAt', value);
33462
+ }
33463
+ /**
33464
+ * * Field Name: Priority
33465
+ * * Display Name: Priority
33466
+ * * SQL Data Type: int
33467
+ * * Default Value: 100
33468
+ * * Description: Ordering within Phase. Lower = higher priority. Used for pre-execution ordering and as default preference for agent-invoked scope selection.
33469
+ */
33470
+ get Priority() {
33471
+ return this.Get('Priority');
33472
+ }
33473
+ set Priority(value) {
33474
+ this.Set('Priority', value);
33475
+ }
33476
+ /**
33477
+ * * Field Name: MaxResults
33478
+ * * Display Name: Max Results
33479
+ * * SQL Data Type: int
33480
+ * * Description: Override max results for this scope when used by this agent. NULL = use scope/engine default.
33481
+ */
33482
+ get MaxResults() {
33483
+ return this.Get('MaxResults');
33484
+ }
33485
+ set MaxResults(value) {
33486
+ this.Set('MaxResults', value);
33487
+ }
33488
+ /**
33489
+ * * Field Name: MinScore
33490
+ * * Display Name: Minimum Score
33491
+ * * SQL Data Type: decimal(5, 4)
33492
+ * * Description: Override min score threshold (0.0000–1.0000). NULL = use engine default.
33493
+ */
33494
+ get MinScore() {
33495
+ return this.Get('MinScore');
33496
+ }
33497
+ set MinScore(value) {
33498
+ this.Set('MinScore', value);
33499
+ }
33500
+ /**
33501
+ * * Field Name: QueryTemplateID
33502
+ * * Display Name: Query Template
33503
+ * * SQL Data Type: uniqueidentifier
33504
+ * * Related Entity/Foreign Key: MJ: Templates (vwTemplates.ID)
33505
+ * * Description: FK to Templates. MJ Template used to generate the search query from conversation context (lastUserMessage, recentMessages, payload, etc.). NULL = use lastUserMessage as-is. Can be further specialized per-provider via SearchScopeProvider.QueryTransformTemplateID.
33506
+ */
33507
+ get QueryTemplateID() {
33508
+ return this.Get('QueryTemplateID');
33509
+ }
33510
+ set QueryTemplateID(value) {
33511
+ this.Set('QueryTemplateID', value);
33512
+ }
33513
+ /**
33514
+ * * Field Name: FusionWeightsOverride
33515
+ * * Display Name: Fusion Weights Override
33516
+ * * SQL Data Type: nvarchar(MAX)
33517
+ * * Description: JSON override for RRF per-provider fusion weights when this agent uses this scope. Resolution order: AIAgentSearchScope.FusionWeightsOverride > SearchScope.ScopeConfig.fusionWeights > engine defaults. Example: { "vector": 2.0, "fulltext": 1.0, "entity": 1.0 }.
33518
+ */
33519
+ get FusionWeightsOverride() {
33520
+ return this.Get('FusionWeightsOverride');
33521
+ }
33522
+ set FusionWeightsOverride(value) {
33523
+ this.Set('FusionWeightsOverride', value);
33524
+ }
33525
+ /**
33526
+ * * Field Name: IsDefault
33527
+ * * Display Name: Is Default Scope
33528
+ * * SQL Data Type: bit
33529
+ * * Default Value: 0
33530
+ * * Description: If true, this is the agent's default scope when no scope is specified in a tool call.
33531
+ */
33532
+ get IsDefault() {
33533
+ return this.Get('IsDefault');
33534
+ }
33535
+ set IsDefault(value) {
33536
+ this.Set('IsDefault', value);
33537
+ }
33538
+ /**
33539
+ * * Field Name: __mj_CreatedAt
33540
+ * * Display Name: Created At
33541
+ * * SQL Data Type: datetimeoffset
33542
+ * * Default Value: getutcdate()
33543
+ */
33544
+ get __mj_CreatedAt() {
33545
+ return this.Get('__mj_CreatedAt');
33546
+ }
33547
+ /**
33548
+ * * Field Name: __mj_UpdatedAt
33549
+ * * Display Name: Updated At
33550
+ * * SQL Data Type: datetimeoffset
33551
+ * * Default Value: getutcdate()
33552
+ */
33553
+ get __mj_UpdatedAt() {
33554
+ return this.Get('__mj_UpdatedAt');
33555
+ }
33556
+ /**
33557
+ * * Field Name: Agent
33558
+ * * Display Name: Agent Name
33559
+ * * SQL Data Type: nvarchar(255)
33560
+ */
33561
+ get Agent() {
33562
+ return this.Get('Agent');
33563
+ }
33564
+ /**
33565
+ * * Field Name: SearchScope
33566
+ * * Display Name: Search Scope Name
33567
+ * * SQL Data Type: nvarchar(200)
33568
+ */
33569
+ get SearchScope() {
33570
+ return this.Get('SearchScope');
33571
+ }
33572
+ /**
33573
+ * * Field Name: QueryTemplate
33574
+ * * Display Name: Query Template Name
33575
+ * * SQL Data Type: nvarchar(255)
33576
+ */
33577
+ get QueryTemplate() {
33578
+ return this.Get('QueryTemplate');
33579
+ }
33580
+ };
33581
+ MJAIAgentSearchScopeEntity = __decorate([
33582
+ RegisterClass(BaseEntity, 'MJ: AI Agent Search Scopes')
33583
+ ], MJAIAgentSearchScopeEntity);
33584
+ export { MJAIAgentSearchScopeEntity };
32683
33585
  /**
32684
33586
  * MJ: AI Agent Step Paths - strongly typed entity sub-class
32685
33587
  * * Schema: __mj
@@ -33755,7 +34657,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33755
34657
  }
33756
34658
  /**
33757
34659
  * * Field Name: ParentID
33758
- * * Display Name: Parent
34660
+ * * Display Name: Parent Agent
33759
34661
  * * SQL Data Type: uniqueidentifier
33760
34662
  * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)
33761
34663
  * * Description: References the parent agent in the hierarchical structure. If NULL, this is a root (top-level) agent.
@@ -33824,7 +34726,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33824
34726
  }
33825
34727
  /**
33826
34728
  * * Field Name: ContextCompressionMessageThreshold
33827
- * * Display Name: Context Compression Message Threshold
34729
+ * * Display Name: Message Threshold
33828
34730
  * * SQL Data Type: int
33829
34731
  * * Description: Number of messages that triggers context compression when EnableContextCompression is true.
33830
34732
  */
@@ -33836,7 +34738,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33836
34738
  }
33837
34739
  /**
33838
34740
  * * Field Name: ContextCompressionPromptID
33839
- * * Display Name: Context Compression Prompt
34741
+ * * Display Name: Compression Prompt
33840
34742
  * * SQL Data Type: uniqueidentifier
33841
34743
  * * Related Entity/Foreign Key: MJ: AI Prompts (vwAIPrompts.ID)
33842
34744
  */
@@ -33848,7 +34750,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33848
34750
  }
33849
34751
  /**
33850
34752
  * * Field Name: ContextCompressionMessageRetentionCount
33851
- * * Display Name: Context Compression Message Retention Count
34753
+ * * Display Name: Retention Count
33852
34754
  * * SQL Data Type: int
33853
34755
  * * Description: Number of recent messages to keep uncompressed when context compression is applied.
33854
34756
  */
@@ -33860,7 +34762,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33860
34762
  }
33861
34763
  /**
33862
34764
  * * Field Name: TypeID
33863
- * * Display Name: Type
34765
+ * * Display Name: Agent Type
33864
34766
  * * SQL Data Type: uniqueidentifier
33865
34767
  * * Related Entity/Foreign Key: MJ: AI Agent Types (vwAIAgentTypes.ID)
33866
34768
  * * Description: Reference to the AIAgentType that defines the category and system-level behavior for this agent. Cannot be null.
@@ -33932,7 +34834,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33932
34834
  }
33933
34835
  /**
33934
34836
  * * Field Name: PayloadDownstreamPaths
33935
- * * Display Name: Payload Downstream Paths
34837
+ * * Display Name: Downstream Paths
33936
34838
  * * SQL Data Type: nvarchar(MAX)
33937
34839
  * * Default Value: ["*"]
33938
34840
  * * Description: JSON array of paths that define which parts of the payload should be sent downstream to sub-agents. Use ["*"] to send entire payload, or specify paths like ["customer.id", "campaign.*", "analysis.sentiment"]
@@ -33945,7 +34847,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33945
34847
  }
33946
34848
  /**
33947
34849
  * * Field Name: PayloadUpstreamPaths
33948
- * * Display Name: Payload Upstream Paths
34850
+ * * Display Name: Upstream Paths
33949
34851
  * * SQL Data Type: nvarchar(MAX)
33950
34852
  * * Default Value: ["*"]
33951
34853
  * * Description: JSON array of paths that define which parts of the payload sub-agents are allowed to write back upstream. Use ["*"] to allow all writes, or specify paths like ["analysis.results", "recommendations.*"]
@@ -33958,7 +34860,7 @@ let MJAIAgentEntity = class MJAIAgentEntity extends BaseEntity {
33958
34860
  }
33959
34861
  /**
33960
34862
  * * Field Name: PayloadSelfReadPaths
33961
- * * Display Name: Payload Self Read Paths
34863
+ * * Display Name: Self Read Paths
33962
34864
  * * SQL Data Type: nvarchar(MAX)
33963
34865
  * * Description: JSON array of paths that specify what parts of the payload the agent's own prompt can read. Controls downstream data
33964
34866
  flow when the agent executes its own prompt step.
@@ -33971,7 +34873,7 @@ flow when the agent executes its own prompt step.
33971
34873
  }
33972
34874
  /**
33973
34875
  * * Field Name: PayloadSelfWritePaths
33974
- * * Display Name: Payload Self Write Paths
34876
+ * * Display Name: Self Write Paths
33975
34877
  * * SQL Data Type: nvarchar(MAX)
33976
34878
  * * Description: JSON array of paths that specify what parts of the payload the agent's own prompt can write back. Controls upstream
33977
34879
  data flow when the agent executes its own prompt step.
@@ -34008,7 +34910,7 @@ data flow when the agent executes its own prompt step.
34008
34910
  }
34009
34911
  /**
34010
34912
  * * Field Name: FinalPayloadValidationMode
34011
- * * Display Name: Final Payload Validation Mode
34913
+ * * Display Name: Final Validation Mode
34012
34914
  * * SQL Data Type: nvarchar(25)
34013
34915
  * * Default Value: Retry
34014
34916
  * * Value List Type: List
@@ -34026,7 +34928,7 @@ data flow when the agent executes its own prompt step.
34026
34928
  }
34027
34929
  /**
34028
34930
  * * Field Name: FinalPayloadValidationMaxRetries
34029
- * * Display Name: Final Payload Validation Max Retries
34931
+ * * Display Name: Max Validation Retries
34030
34932
  * * SQL Data Type: int
34031
34933
  * * Default Value: 3
34032
34934
  * * Description: Maximum number of retry attempts allowed when FinalPayloadValidation fails with
@@ -34128,7 +35030,7 @@ if this limit is exceeded.
34128
35030
  }
34129
35031
  /**
34130
35032
  * * Field Name: StartingPayloadValidationMode
34131
- * * Display Name: Starting Payload Validation Mode
35033
+ * * Display Name: Starting Validation Mode
34132
35034
  * * SQL Data Type: nvarchar(25)
34133
35035
  * * Default Value: Fail
34134
35036
  * * Value List Type: List
@@ -34145,7 +35047,7 @@ if this limit is exceeded.
34145
35047
  }
34146
35048
  /**
34147
35049
  * * Field Name: DefaultPromptEffortLevel
34148
- * * Display Name: Default Prompt Effort Level
35050
+ * * Display Name: Default Effort Level
34149
35051
  * * SQL Data Type: int
34150
35052
  * * Description: Default effort level for all prompts executed by this agent (1-100, where 1=minimal effort, 100=maximum effort). Takes precedence over individual prompt EffortLevel settings but can be overridden by runtime parameters. Inherited by sub-agents unless explicitly overridden.
34151
35053
  */
@@ -34187,7 +35089,7 @@ if this limit is exceeded.
34187
35089
  }
34188
35090
  /**
34189
35091
  * * Field Name: OwnerUserID
34190
- * * Display Name: Owner User
35092
+ * * Display Name: Owner
34191
35093
  * * SQL Data Type: uniqueidentifier
34192
35094
  * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
34193
35095
  * * Default Value: ECAFCCEC-6A37-EF11-86D4-000D3A4E707E
@@ -34274,7 +35176,7 @@ if this limit is exceeded.
34274
35176
  }
34275
35177
  /**
34276
35178
  * * Field Name: MaxNotesToInject
34277
- * * Display Name: Max Notes To Inject
35179
+ * * Display Name: Max Notes to Inject
34278
35180
  * * SQL Data Type: int
34279
35181
  * * Default Value: 5
34280
35182
  * * Description: Maximum number of notes to inject into agent context per request.
@@ -34318,7 +35220,7 @@ if this limit is exceeded.
34318
35220
  }
34319
35221
  /**
34320
35222
  * * Field Name: MaxExamplesToInject
34321
- * * Display Name: Max Examples To Inject
35223
+ * * Display Name: Max Examples to Inject
34322
35224
  * * SQL Data Type: int
34323
35225
  * * Default Value: 3
34324
35226
  * * Description: Maximum number of examples to inject into agent context per request.
@@ -34393,7 +35295,7 @@ if this limit is exceeded.
34393
35295
  }
34394
35296
  /**
34395
35297
  * * Field Name: AttachmentStorageProviderID
34396
- * * Display Name: Attachment Storage Provider
35298
+ * * Display Name: Storage Provider
34397
35299
  * * SQL Data Type: uniqueidentifier
34398
35300
  * * Related Entity/Foreign Key: MJ: File Storage Providers (vwFileStorageProviders.ID)
34399
35301
  * * Description: File storage provider for large attachments. Overrides the default from AIConfiguration. NULL uses system default.
@@ -34406,7 +35308,7 @@ if this limit is exceeded.
34406
35308
  }
34407
35309
  /**
34408
35310
  * * Field Name: AttachmentRootPath
34409
- * * Display Name: Attachment Root Path
35311
+ * * Display Name: Root Path
34410
35312
  * * SQL Data Type: nvarchar(500)
34411
35313
  * * Description: Base path within the storage provider for this agent's attachments. Agent run ID and sequence number are appended to create unique paths. Format: /folder/subfolder
34412
35314
  */
@@ -34418,7 +35320,7 @@ if this limit is exceeded.
34418
35320
  }
34419
35321
  /**
34420
35322
  * * Field Name: InlineStorageThresholdBytes
34421
- * * Display Name: Inline Storage Threshold Bytes
35323
+ * * Display Name: Inline Storage Threshold
34422
35324
  * * SQL Data Type: int
34423
35325
  * * Description: File size threshold for inline storage. Files <= this size are stored as base64 inline, larger files use MJStorage. NULL uses system default (1MB). Set to 0 to always use MJStorage.
34424
35326
  */
@@ -34430,7 +35332,7 @@ if this limit is exceeded.
34430
35332
  }
34431
35333
  /**
34432
35334
  * * Field Name: AgentTypePromptParams
34433
- * * Display Name: Agent Type Prompt Params
35335
+ * * Display Name: Prompt Parameters
34434
35336
  * * SQL Data Type: nvarchar(MAX)
34435
35337
  * * Description: JSON object containing parameter values that customize how this agent's type-level system prompt is rendered. The schema is defined by the agent type's PromptParamsSchema field. Allows per-agent control over which prompt sections are included, enabling token savings by excluding unused documentation.
34436
35338
  */
@@ -34518,7 +35420,7 @@ if this limit is exceeded.
34518
35420
  }
34519
35421
  /**
34520
35422
  * * Field Name: AllowEphemeralClientTools
34521
- * * Display Name: Allow Ephemeral Client Tools
35423
+ * * Display Name: Allow Ephemeral Tools
34522
35424
  * * SQL Data Type: bit
34523
35425
  * * Default Value: 1
34524
35426
  * * Description: When true (default), this agent accepts runtime-registered ephemeral client tools that are not defined in metadata. Set to false for agents that require strict tool governance.
@@ -34531,7 +35433,7 @@ if this limit is exceeded.
34531
35433
  }
34532
35434
  /**
34533
35435
  * * Field Name: DefaultStorageAccountID
34534
- * * Display Name: Default Storage Account ID
35436
+ * * Display Name: Default Storage Account
34535
35437
  * * SQL Data Type: uniqueidentifier
34536
35438
  * * Related Entity/Foreign Key: MJ: File Storage Accounts (vwFileStorageAccounts.ID)
34537
35439
  * * Description: Default file storage account for this specific agent. Overrides both Type-level and Category-level defaults. Can be further overridden at runtime via ExecuteAgentParams.override.storageAccountId. FK to FileStorageAccount.
@@ -34543,6 +35445,24 @@ if this limit is exceeded.
34543
35445
  this.Set('DefaultStorageAccountID', value);
34544
35446
  }
34545
35447
  /**
35448
+ * * Field Name: SearchScopeAccess
35449
+ * * Display Name: Search Scope Access
35450
+ * * SQL Data Type: nvarchar(20)
35451
+ * * Default Value: None
35452
+ * * Value List Type: List
35453
+ * * Possible Values
35454
+ * * All
35455
+ * * Assigned
35456
+ * * None
35457
+ * * Description: Controls the agent's search capability. All = may use any scope including Global; search action does not restrict. Assigned = may use ONLY scopes explicitly linked via AIAgentSearchScope; scoped search action enforces this. None = agent has no search capability; the scoped search action rejects all requests.
35458
+ */
35459
+ get SearchScopeAccess() {
35460
+ return this.Get('SearchScopeAccess');
35461
+ }
35462
+ set SearchScopeAccess(value) {
35463
+ this.Set('SearchScopeAccess', value);
35464
+ }
35465
+ /**
34546
35466
  * * Field Name: Parent
34547
35467
  * * Display Name: Parent Name
34548
35468
  * * SQL Data Type: nvarchar(255)
@@ -34552,7 +35472,7 @@ if this limit is exceeded.
34552
35472
  }
34553
35473
  /**
34554
35474
  * * Field Name: ContextCompressionPrompt
34555
- * * Display Name: Context Compression Prompt
35475
+ * * Display Name: Compression Prompt Name
34556
35476
  * * SQL Data Type: nvarchar(255)
34557
35477
  */
34558
35478
  get ContextCompressionPrompt() {
@@ -34576,7 +35496,7 @@ if this limit is exceeded.
34576
35496
  }
34577
35497
  /**
34578
35498
  * * Field Name: OwnerUser
34579
- * * Display Name: Owner User Name
35499
+ * * Display Name: Owner Name
34580
35500
  * * SQL Data Type: nvarchar(100)
34581
35501
  */
34582
35502
  get OwnerUser() {
@@ -34584,7 +35504,7 @@ if this limit is exceeded.
34584
35504
  }
34585
35505
  /**
34586
35506
  * * Field Name: AttachmentStorageProvider
34587
- * * Display Name: Attachment Storage Provider Name
35507
+ * * Display Name: Storage Provider Name
34588
35508
  * * SQL Data Type: nvarchar(50)
34589
35509
  */
34590
35510
  get AttachmentStorageProvider() {
@@ -34600,7 +35520,7 @@ if this limit is exceeded.
34600
35520
  }
34601
35521
  /**
34602
35522
  * * Field Name: DefaultStorageAccount
34603
- * * Display Name: Default Storage Account
35523
+ * * Display Name: Default Storage Account Name
34604
35524
  * * SQL Data Type: nvarchar(200)
34605
35525
  */
34606
35526
  get DefaultStorageAccount() {
@@ -61468,7 +62388,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61468
62388
  }
61469
62389
  /**
61470
62390
  * * Field Name: EntityID
61471
- * * Display Name: Entity ID
62391
+ * * Display Name: Entity
61472
62392
  * * SQL Data Type: uniqueidentifier
61473
62393
  * * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)
61474
62394
  */
@@ -61487,7 +62407,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61487
62407
  }
61488
62408
  /**
61489
62409
  * * Field Name: Name
61490
- * * Display Name: Name
62410
+ * * Display Name: Field Name
61491
62411
  * * SQL Data Type: nvarchar(255)
61492
62412
  * * Description: Name of the field within the database table
61493
62413
  */
@@ -61571,7 +62491,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61571
62491
  }
61572
62492
  /**
61573
62493
  * * Field Name: Type
61574
- * * Display Name: Data Type
62494
+ * * Display Name: SQL Type
61575
62495
  * * SQL Data Type: nvarchar(100)
61576
62496
  * * Description: SQL Data type (auto maintained by CodeGen)
61577
62497
  */
@@ -61771,7 +62691,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61771
62691
  }
61772
62692
  /**
61773
62693
  * * Field Name: IncludeInUserSearchAPI
61774
- * * Display Name: Include In User Search
62694
+ * * Display Name: Include In Search
61775
62695
  * * SQL Data Type: bit
61776
62696
  * * Default Value: 0
61777
62697
  * * Description: If set to 1, this column will be included in user search queries for both traditional and full text search
@@ -61809,7 +62729,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61809
62729
  }
61810
62730
  /**
61811
62731
  * * Field Name: IncludeInGeneratedForm
61812
- * * Display Name: Include In Generated Form
62732
+ * * Display Name: Include In Form
61813
62733
  * * SQL Data Type: bit
61814
62734
  * * Default Value: 1
61815
62735
  * * Description: If set to 1, this field will be included in the generated form by CodeGen. If set to 0, this field will be excluded from the generated form. For custom forms, this field has no effect as the layout is controlled independently.
@@ -61822,7 +62742,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61822
62742
  }
61823
62743
  /**
61824
62744
  * * Field Name: GeneratedFormSection
61825
- * * Display Name: Generated Form Section
62745
+ * * Display Name: Form Section
61826
62746
  * * SQL Data Type: nvarchar(10)
61827
62747
  * * Default Value: Details
61828
62748
  * * Value List Type: List
@@ -61843,7 +62763,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61843
62763
  * * Display Name: Is Virtual
61844
62764
  * * SQL Data Type: bit
61845
62765
  * * Default Value: 0
61846
- * * Description: NULL
62766
+ * * Description: When 1, this field is read-only at the API layer (excluded from spCreate / spUpdate / GraphQL input types). Set automatically when the column is either (a) not present in the base table — e.g., a joined name lookup in the base view, or (b) a SQL Server computed column or PostgreSQL generated column. Cases (a) and (b) are distinguished by the IsComputed flag: IsVirtual=1, IsComputed=0 means view-only; IsVirtual=1, IsComputed=1 means computed/generated and physically present in the base table.
61847
62767
  */
61848
62768
  get IsVirtual() {
61849
62769
  return this.Get('IsVirtual');
@@ -61980,7 +62900,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
61980
62900
  }
61981
62901
  /**
61982
62902
  * * Field Name: ValuesToPackWithSchema
61983
- * * Display Name: Values To Pack With Schema
62903
+ * * Display Name: Values To Pack
61984
62904
  * * SQL Data Type: nvarchar(10)
61985
62905
  * * Default Value: Auto
61986
62906
  * * Value List Type: List
@@ -62016,7 +62936,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62016
62936
  }
62017
62937
  /**
62018
62938
  * * Field Name: AutoUpdateIsNameField
62019
- * * Display Name: Auto Update Is Name Field
62939
+ * * Display Name: Auto Update Name Field
62020
62940
  * * SQL Data Type: bit
62021
62941
  * * Default Value: 1
62022
62942
  * * Description: When 1, allows system/LLM to auto-update IsNameField; when 0, user has locked this field
@@ -62029,7 +62949,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62029
62949
  }
62030
62950
  /**
62031
62951
  * * Field Name: AutoUpdateDefaultInView
62032
- * * Display Name: Auto Update Default In View
62952
+ * * Display Name: Auto Update View Default
62033
62953
  * * SQL Data Type: bit
62034
62954
  * * Default Value: 1
62035
62955
  * * Description: When 1, allows system/LLM to auto-update DefaultInView; when 0, user has locked this field
@@ -62159,7 +63079,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62159
63079
  }
62160
63080
  /**
62161
63081
  * * Field Name: RelatedEntityJoinFields
62162
- * * Display Name: Related Entity Join Fields
63082
+ * * Display Name: Related Join Fields
62163
63083
  * * SQL Data Type: nvarchar(MAX)
62164
63084
  * * Description: JSON configuration for additional fields to join from the related entity into this entity's base view. Supports modes: extend (add to NameField), override (replace NameField), disable (no joins). Schema: { mode?: string, fields?: [{ field: string, alias?: string }] }
62165
63085
  */
@@ -62183,7 +63103,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62183
63103
  }
62184
63104
  /**
62185
63105
  * * Field Name: JSONTypeIsArray
62186
- * * Display Name: JSON Type Is Array
63106
+ * * Display Name: JSON Is Array
62187
63107
  * * SQL Data Type: bit
62188
63108
  * * Default Value: 0
62189
63109
  * * Description: If true, the field holds a JSON array of JSONType items. The Object accessor returns Array<JSONType> | null and the setter accepts Array<JSONType> | null.
@@ -62208,9 +63128,15 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62208
63128
  }
62209
63129
  /**
62210
63130
  * * Field Name: UserSearchPredicateAPI
62211
- * * Display Name: User Search Predicate
63131
+ * * Display Name: Search Predicate
62212
63132
  * * SQL Data Type: nvarchar(20)
62213
63133
  * * Default Value: Contains
63134
+ * * Value List Type: List
63135
+ * * Possible Values
63136
+ * * BeginsWith
63137
+ * * Contains
63138
+ * * EndsWith
63139
+ * * Exact
62214
63140
  * * Description: Search predicate controlling how user search queries match against this field. Valid values: BeginsWith, Contains, EndsWith, Exact.
62215
63141
  */
62216
63142
  get UserSearchPredicateAPI() {
@@ -62234,7 +63160,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62234
63160
  }
62235
63161
  /**
62236
63162
  * * Field Name: AutoUpdateFullTextSearch
62237
- * * Display Name: Auto Update Full Text Search
63163
+ * * Display Name: Auto Update Full Text
62238
63164
  * * SQL Data Type: bit
62239
63165
  * * Default Value: 1
62240
63166
  * * Description: When true, CodeGen LLM can auto-set the FullTextSearchEnabled value during code generation runs.
@@ -62259,6 +63185,19 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62259
63185
  this.Set('AutoUpdateExtendedType', value);
62260
63186
  }
62261
63187
  /**
63188
+ * * Field Name: IsComputed
63189
+ * * Display Name: Is Computed
63190
+ * * SQL Data Type: bit
63191
+ * * Default Value: 0
63192
+ * * Description: When 1, this field is a SQL Server computed column or PostgreSQL generated column — physically present in the base table but read-only at the SQL layer. Distinct from IsVirtual, which means the column is not in the base table at all (e.g., joined name lookups in the base view). A computed column has both IsVirtual=1 (read-only at the API layer) and IsComputed=1 (physically in the table). The difference matters for base-view JOIN target selection: when an FK's related Name Field is computed, the generated view joins to the related entity's base table instead of its view.
63193
+ */
63194
+ get IsComputed() {
63195
+ return this.Get('IsComputed');
63196
+ }
63197
+ set IsComputed(value) {
63198
+ this.Set('IsComputed', value);
63199
+ }
63200
+ /**
62262
63201
  * * Field Name: FieldCodeName
62263
63202
  * * Display Name: Field Code Name
62264
63203
  * * SQL Data Type: nvarchar(MAX)
@@ -62332,7 +63271,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62332
63271
  }
62333
63272
  /**
62334
63273
  * * Field Name: RelatedEntityBaseTable
62335
- * * Display Name: Related Entity Table
63274
+ * * Display Name: Related Entity Base Table
62336
63275
  * * SQL Data Type: nvarchar(255)
62337
63276
  */
62338
63277
  get RelatedEntityBaseTable() {
@@ -62340,7 +63279,7 @@ let MJEntityFieldEntity = class MJEntityFieldEntity extends BaseEntity {
62340
63279
  }
62341
63280
  /**
62342
63281
  * * Field Name: RelatedEntityBaseView
62343
- * * Display Name: Related Entity View
63282
+ * * Display Name: Related Entity Base View
62344
63283
  * * SQL Data Type: nvarchar(255)
62345
63284
  */
62346
63285
  get RelatedEntityBaseView() {
@@ -78961,6 +79900,234 @@ MJSchemaInfoEntity = __decorate([
78961
79900
  RegisterClass(BaseEntity, 'MJ: Schema Info')
78962
79901
  ], MJSchemaInfoEntity);
78963
79902
  export { MJSchemaInfoEntity };
79903
+ /**
79904
+ * MJ: Search Execution Logs - strongly typed entity sub-class
79905
+ * * Schema: __mj
79906
+ * * Base Table: SearchExecutionLog
79907
+ * * Base View: vwSearchExecutionLogs
79908
+ * * @description One row per SearchEngine.search invocation. Populated by SearchEngine's post-fusion logging hook (Phase 3.2). Read by the Knowledge Hub Search Analytics dashboard (Phase 3.3) and the per-scope tuning CSV export (Phase 3.4).
79909
+ * * Primary Key: ID
79910
+ * @extends {BaseEntity}
79911
+ * @class
79912
+ * @public
79913
+ */
79914
+ let MJSearchExecutionLogEntity = class MJSearchExecutionLogEntity extends BaseEntity {
79915
+ /**
79916
+ * Loads the MJ: Search Execution Logs record from the database
79917
+ * @param ID: string - primary key value to load the MJ: Search Execution Logs record.
79918
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
79919
+ * @returns {Promise<boolean>} - true if successful, false otherwise
79920
+ * @public
79921
+ * @async
79922
+ * @memberof MJSearchExecutionLogEntity
79923
+ * @method
79924
+ * @override
79925
+ */
79926
+ async Load(ID, EntityRelationshipsToLoad) {
79927
+ const compositeKey = new CompositeKey();
79928
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
79929
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
79930
+ }
79931
+ /**
79932
+ * * Field Name: ID
79933
+ * * Display Name: ID
79934
+ * * SQL Data Type: uniqueidentifier
79935
+ * * Default Value: newsequentialid()
79936
+ */
79937
+ get ID() {
79938
+ return this.Get('ID');
79939
+ }
79940
+ set ID(value) {
79941
+ this.Set('ID', value);
79942
+ }
79943
+ /**
79944
+ * * Field Name: SearchScopeID
79945
+ * * Display Name: Search Scope
79946
+ * * SQL Data Type: uniqueidentifier
79947
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
79948
+ * * Description: The SearchScope this invocation targeted. NULL for unscoped global search.
79949
+ */
79950
+ get SearchScopeID() {
79951
+ return this.Get('SearchScopeID');
79952
+ }
79953
+ set SearchScopeID(value) {
79954
+ this.Set('SearchScopeID', value);
79955
+ }
79956
+ /**
79957
+ * * Field Name: UserID
79958
+ * * Display Name: User
79959
+ * * SQL Data Type: uniqueidentifier
79960
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
79961
+ * * Description: The User who initiated the search. NULL for system / unauthenticated callers.
79962
+ */
79963
+ get UserID() {
79964
+ return this.Get('UserID');
79965
+ }
79966
+ set UserID(value) {
79967
+ this.Set('UserID', value);
79968
+ }
79969
+ /**
79970
+ * * Field Name: AIAgentID
79971
+ * * Display Name: AI Agent
79972
+ * * SQL Data Type: uniqueidentifier
79973
+ * * Related Entity/Foreign Key: MJ: AI Agents (vwAIAgents.ID)
79974
+ * * Description: The AIAgent identity if the search was invoked from an agent (e.g. ScopedSearchAction). NULL for direct human-initiated searches.
79975
+ */
79976
+ get AIAgentID() {
79977
+ return this.Get('AIAgentID');
79978
+ }
79979
+ set AIAgentID(value) {
79980
+ this.Set('AIAgentID', value);
79981
+ }
79982
+ /**
79983
+ * * Field Name: Query
79984
+ * * Display Name: Query
79985
+ * * SQL Data Type: nvarchar(MAX)
79986
+ * * Description: Raw query string the user / agent submitted. NVARCHAR(MAX) because some queries are long (full sentences, snippets). Stored verbatim for analytics — do NOT rely on this for permission decisions.
79987
+ */
79988
+ get Query() {
79989
+ return this.Get('Query');
79990
+ }
79991
+ set Query(value) {
79992
+ this.Set('Query', value);
79993
+ }
79994
+ /**
79995
+ * * Field Name: TotalDurationMs
79996
+ * * Display Name: Total Duration (ms)
79997
+ * * SQL Data Type: int
79998
+ * * Description: End-to-end search duration in milliseconds, measured at the SearchEngine.search call boundary (provider runs + fusion + rerank + permission filter + enrichment).
79999
+ */
80000
+ get TotalDurationMs() {
80001
+ return this.Get('TotalDurationMs');
80002
+ }
80003
+ set TotalDurationMs(value) {
80004
+ this.Set('TotalDurationMs', value);
80005
+ }
80006
+ /**
80007
+ * * Field Name: ResultCount
80008
+ * * Display Name: Result Count
80009
+ * * SQL Data Type: int
80010
+ * * Default Value: 0
80011
+ * * Description: Number of results returned to the caller after permission filtering, deduplication, and score-threshold trimming. Use this as the hit-rate denominator (rows where ResultCount > 0).
80012
+ */
80013
+ get ResultCount() {
80014
+ return this.Get('ResultCount');
80015
+ }
80016
+ set ResultCount(value) {
80017
+ this.Set('ResultCount', value);
80018
+ }
80019
+ /**
80020
+ * * Field Name: RerankerName
80021
+ * * Display Name: Reranker Name
80022
+ * * SQL Data Type: nvarchar(100)
80023
+ * * Description: BaseReRanker.Name of the reranker that ran (e.g. 'Cohere', 'Voyage', 'OpenAI', 'BGE', 'NoopReRanker'). NULL when no rerank stage executed for this invocation.
80024
+ */
80025
+ get RerankerName() {
80026
+ return this.Get('RerankerName');
80027
+ }
80028
+ set RerankerName(value) {
80029
+ this.Set('RerankerName', value);
80030
+ }
80031
+ /**
80032
+ * * Field Name: RerankerCostCents
80033
+ * * Display Name: Reranker Cost (Cents)
80034
+ * * SQL Data Type: decimal(10, 4)
80035
+ * * Description: Total reranker spend in cents for this invocation, populated from the BaseReRanker.CostReporter callback via RerankerBudgetGuard. NULL when no rerank ran or no real-provider cost was incurred (Noop / BGE).
80036
+ */
80037
+ get RerankerCostCents() {
80038
+ return this.Get('RerankerCostCents');
80039
+ }
80040
+ set RerankerCostCents(value) {
80041
+ this.Set('RerankerCostCents', value);
80042
+ }
80043
+ /**
80044
+ * * Field Name: Status
80045
+ * * Display Name: Status
80046
+ * * SQL Data Type: nvarchar(20)
80047
+ * * Value List Type: List
80048
+ * * Possible Values
80049
+ * * Failure
80050
+ * * Forbidden
80051
+ * * Success
80052
+ * * Description: Outcome of the search: 'Success' (results returned, possibly empty), 'Failure' (an exception bubbled out — see FailureReason), 'Forbidden' (the caller lacked SearchScopePermission for the requested scope). Constrained by CK_SearchExecutionLog_Status.
80053
+ */
80054
+ get Status() {
80055
+ return this.Get('Status');
80056
+ }
80057
+ set Status(value) {
80058
+ this.Set('Status', value);
80059
+ }
80060
+ /**
80061
+ * * Field Name: FailureReason
80062
+ * * Display Name: Failure Reason
80063
+ * * SQL Data Type: nvarchar(500)
80064
+ * * Description: Short human-readable failure reason when Status = 'Failure' or 'Forbidden'. NULL on success.
80065
+ */
80066
+ get FailureReason() {
80067
+ return this.Get('FailureReason');
80068
+ }
80069
+ set FailureReason(value) {
80070
+ this.Set('FailureReason', value);
80071
+ }
80072
+ /**
80073
+ * * Field Name: ProvidersJSON
80074
+ * * Display Name: Providers Breakdown
80075
+ * * SQL Data Type: nvarchar(MAX)
80076
+ * * Description: JSON array of per-provider breakdown entries: [{"Provider":"Vector","DurationMs":123,"ResultCount":5,"ErrorMessage":null}, ...]. Used by the analytics dashboard for p50/p95 latency-by-provider charts and to spot consistently slow providers.
80077
+ */
80078
+ get ProvidersJSON() {
80079
+ return this.Get('ProvidersJSON');
80080
+ }
80081
+ set ProvidersJSON(value) {
80082
+ this.Set('ProvidersJSON', value);
80083
+ }
80084
+ /**
80085
+ * * Field Name: __mj_CreatedAt
80086
+ * * Display Name: Created At
80087
+ * * SQL Data Type: datetimeoffset
80088
+ * * Default Value: getutcdate()
80089
+ */
80090
+ get __mj_CreatedAt() {
80091
+ return this.Get('__mj_CreatedAt');
80092
+ }
80093
+ /**
80094
+ * * Field Name: __mj_UpdatedAt
80095
+ * * Display Name: Updated At
80096
+ * * SQL Data Type: datetimeoffset
80097
+ * * Default Value: getutcdate()
80098
+ */
80099
+ get __mj_UpdatedAt() {
80100
+ return this.Get('__mj_UpdatedAt');
80101
+ }
80102
+ /**
80103
+ * * Field Name: SearchScope
80104
+ * * Display Name: Search Scope Name
80105
+ * * SQL Data Type: nvarchar(200)
80106
+ */
80107
+ get SearchScope() {
80108
+ return this.Get('SearchScope');
80109
+ }
80110
+ /**
80111
+ * * Field Name: User
80112
+ * * Display Name: User Name
80113
+ * * SQL Data Type: nvarchar(100)
80114
+ */
80115
+ get User() {
80116
+ return this.Get('User');
80117
+ }
80118
+ /**
80119
+ * * Field Name: AIAgent
80120
+ * * Display Name: AI Agent Name
80121
+ * * SQL Data Type: nvarchar(255)
80122
+ */
80123
+ get AIAgent() {
80124
+ return this.Get('AIAgent');
80125
+ }
80126
+ };
80127
+ MJSearchExecutionLogEntity = __decorate([
80128
+ RegisterClass(BaseEntity, 'MJ: Search Execution Logs')
80129
+ ], MJSearchExecutionLogEntity);
80130
+ export { MJSearchExecutionLogEntity };
78964
80131
  /**
78965
80132
  * MJ: Search Providers - strongly typed entity sub-class
78966
80133
  * * Schema: __mj
@@ -79208,6 +80375,1140 @@ MJSearchProviderEntity = __decorate([
79208
80375
  RegisterClass(BaseEntity, 'MJ: Search Providers')
79209
80376
  ], MJSearchProviderEntity);
79210
80377
  export { MJSearchProviderEntity };
80378
+ /**
80379
+ * MJ: Search Scope Entities - strongly typed entity sub-class
80380
+ * * Schema: __mj
80381
+ * * Base Table: SearchScopeEntity
80382
+ * * Base View: vwSearchScopeEntities
80383
+ * * @description Controls which entities participate in entity and full-text search within a scope, with optional per-entity filter and user-search-string overrides.
80384
+ * * Primary Key: ID
80385
+ * @extends {BaseEntity}
80386
+ * @class
80387
+ * @public
80388
+ */
80389
+ let MJSearchScopeEntityEntity = class MJSearchScopeEntityEntity extends BaseEntity {
80390
+ /**
80391
+ * Loads the MJ: Search Scope Entities record from the database
80392
+ * @param ID: string - primary key value to load the MJ: Search Scope Entities record.
80393
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
80394
+ * @returns {Promise<boolean>} - true if successful, false otherwise
80395
+ * @public
80396
+ * @async
80397
+ * @memberof MJSearchScopeEntityEntity
80398
+ * @method
80399
+ * @override
80400
+ */
80401
+ async Load(ID, EntityRelationshipsToLoad) {
80402
+ const compositeKey = new CompositeKey();
80403
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
80404
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
80405
+ }
80406
+ /**
80407
+ * * Field Name: ID
80408
+ * * Display Name: ID
80409
+ * * SQL Data Type: uniqueidentifier
80410
+ * * Default Value: newsequentialid()
80411
+ */
80412
+ get ID() {
80413
+ return this.Get('ID');
80414
+ }
80415
+ set ID(value) {
80416
+ this.Set('ID', value);
80417
+ }
80418
+ /**
80419
+ * * Field Name: SearchScopeID
80420
+ * * Display Name: Search Scope ID
80421
+ * * SQL Data Type: uniqueidentifier
80422
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
80423
+ */
80424
+ get SearchScopeID() {
80425
+ return this.Get('SearchScopeID');
80426
+ }
80427
+ set SearchScopeID(value) {
80428
+ this.Set('SearchScopeID', value);
80429
+ }
80430
+ /**
80431
+ * * Field Name: EntityID
80432
+ * * Display Name: Entity ID
80433
+ * * SQL Data Type: uniqueidentifier
80434
+ * * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)
80435
+ */
80436
+ get EntityID() {
80437
+ return this.Get('EntityID');
80438
+ }
80439
+ set EntityID(value) {
80440
+ this.Set('EntityID', value);
80441
+ }
80442
+ /**
80443
+ * * Field Name: ExtraFilter
80444
+ * * Display Name: Extra Filter
80445
+ * * SQL Data Type: nvarchar(MAX)
80446
+ * * Description: Optional SQL filter applied to this entity's search within this scope. Example: Status='Published' AND DepartmentID='abc'. Rendered as a Nunjucks template with SearchContext variables for multi-tenant filtering.
80447
+ */
80448
+ get ExtraFilter() {
80449
+ return this.Get('ExtraFilter');
80450
+ }
80451
+ set ExtraFilter(value) {
80452
+ this.Set('ExtraFilter', value);
80453
+ }
80454
+ /**
80455
+ * * Field Name: UserSearchString
80456
+ * * Display Name: User Search String
80457
+ * * SQL Data Type: nvarchar(MAX)
80458
+ * * Description: Optional override for the UserSearchString passed to RunView for this entity within this scope. Nunjucks template (e.g., "{{ query }} AND type:policy"). NULL = pass the user's actual query through as-is.
80459
+ */
80460
+ get UserSearchString() {
80461
+ return this.Get('UserSearchString');
80462
+ }
80463
+ set UserSearchString(value) {
80464
+ this.Set('UserSearchString', value);
80465
+ }
80466
+ /**
80467
+ * * Field Name: __mj_CreatedAt
80468
+ * * Display Name: Created At
80469
+ * * SQL Data Type: datetimeoffset
80470
+ * * Default Value: getutcdate()
80471
+ */
80472
+ get __mj_CreatedAt() {
80473
+ return this.Get('__mj_CreatedAt');
80474
+ }
80475
+ /**
80476
+ * * Field Name: __mj_UpdatedAt
80477
+ * * Display Name: Updated At
80478
+ * * SQL Data Type: datetimeoffset
80479
+ * * Default Value: getutcdate()
80480
+ */
80481
+ get __mj_UpdatedAt() {
80482
+ return this.Get('__mj_UpdatedAt');
80483
+ }
80484
+ /**
80485
+ * * Field Name: SearchScope
80486
+ * * Display Name: Search Scope
80487
+ * * SQL Data Type: nvarchar(200)
80488
+ */
80489
+ get SearchScope() {
80490
+ return this.Get('SearchScope');
80491
+ }
80492
+ /**
80493
+ * * Field Name: Entity
80494
+ * * Display Name: Entity
80495
+ * * SQL Data Type: nvarchar(255)
80496
+ */
80497
+ get Entity() {
80498
+ return this.Get('Entity');
80499
+ }
80500
+ };
80501
+ MJSearchScopeEntityEntity = __decorate([
80502
+ RegisterClass(BaseEntity, 'MJ: Search Scope Entities')
80503
+ ], MJSearchScopeEntityEntity);
80504
+ export { MJSearchScopeEntityEntity };
80505
+ /**
80506
+ * MJ: Search Scope External Indexes - strongly typed entity sub-class
80507
+ * * Schema: __mj
80508
+ * * Base Table: SearchScopeExternalIndex
80509
+ * * Base View: vwSearchScopeExternalIndexes
80510
+ * * @description Scoped external/provider-owned indexes. Generic — covers vector stores (Pinecone, Qdrant, PGVector) and text/hybrid engines (Elasticsearch, Typesense, Azure AI Search, OpenSearch). A single scope can mix types; each row is consumed only by the provider matching its IndexType.
80511
+ * * Primary Key: ID
80512
+ * @extends {BaseEntity}
80513
+ * @class
80514
+ * @public
80515
+ */
80516
+ let MJSearchScopeExternalIndexEntity = class MJSearchScopeExternalIndexEntity extends BaseEntity {
80517
+ /**
80518
+ * Loads the MJ: Search Scope External Indexes record from the database
80519
+ * @param ID: string - primary key value to load the MJ: Search Scope External Indexes record.
80520
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
80521
+ * @returns {Promise<boolean>} - true if successful, false otherwise
80522
+ * @public
80523
+ * @async
80524
+ * @memberof MJSearchScopeExternalIndexEntity
80525
+ * @method
80526
+ * @override
80527
+ */
80528
+ async Load(ID, EntityRelationshipsToLoad) {
80529
+ const compositeKey = new CompositeKey();
80530
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
80531
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
80532
+ }
80533
+ /**
80534
+ * Validate() method override for MJ: Search Scope External Indexes entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
80535
+ * * Table-Level: To ensure search functionality works correctly, vector-based indexes must have a Vector Index ID assigned, while all other index types must have an External Index Name specified.
80536
+ * @public
80537
+ * @method
80538
+ * @override
80539
+ */
80540
+ Validate() {
80541
+ const result = super.Validate();
80542
+ this.ValidateIndexTypeRequirements(result);
80543
+ result.Success = result.Success && (result.Errors.length === 0);
80544
+ return result;
80545
+ }
80546
+ /**
80547
+ * To ensure search functionality works correctly, vector-based indexes must have a Vector Index ID assigned, while all other index types must have an External Index Name specified.
80548
+ * @param result - the ValidationResult object to add any errors or warnings to
80549
+ * @public
80550
+ * @method
80551
+ */
80552
+ ValidateIndexTypeRequirements(result) {
80553
+ // If the index is a Vector type, ensure a Vector Index ID is provided
80554
+ if (this.IndexType === 'Vector' && this.VectorIndexID == null) {
80555
+ result.Errors.push(new ValidationErrorInfo("VectorIndexID", "A Vector Index ID is required when the Index Type is set to 'Vector'.", this.VectorIndexID, ValidationErrorType.Failure));
80556
+ }
80557
+ // If the index is not a Vector type, ensure an External Index Name is provided
80558
+ if (this.IndexType !== 'Vector' && (this.ExternalIndexName == null || this.ExternalIndexName.length === 0)) {
80559
+ result.Errors.push(new ValidationErrorInfo("ExternalIndexName", "An External Index Name is required for the selected Index Type.", this.ExternalIndexName, ValidationErrorType.Failure));
80560
+ }
80561
+ }
80562
+ /**
80563
+ * * Field Name: ID
80564
+ * * Display Name: ID
80565
+ * * SQL Data Type: uniqueidentifier
80566
+ * * Default Value: newsequentialid()
80567
+ */
80568
+ get ID() {
80569
+ return this.Get('ID');
80570
+ }
80571
+ set ID(value) {
80572
+ this.Set('ID', value);
80573
+ }
80574
+ /**
80575
+ * * Field Name: SearchScopeID
80576
+ * * Display Name: Search Scope ID
80577
+ * * SQL Data Type: uniqueidentifier
80578
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
80579
+ */
80580
+ get SearchScopeID() {
80581
+ return this.Get('SearchScopeID');
80582
+ }
80583
+ set SearchScopeID(value) {
80584
+ this.Set('SearchScopeID', value);
80585
+ }
80586
+ /**
80587
+ * * Field Name: IndexType
80588
+ * * Display Name: Index Type
80589
+ * * SQL Data Type: nvarchar(40)
80590
+ * * Default Value: Vector
80591
+ * * Value List Type: List
80592
+ * * Possible Values
80593
+ * * AzureAISearch
80594
+ * * Elasticsearch
80595
+ * * OpenSearch
80596
+ * * Other
80597
+ * * Typesense
80598
+ * * Vector
80599
+ * * Description: Discriminator. Determines which provider class consumes this row: Vector | Elasticsearch | Typesense | AzureAISearch | OpenSearch | Other.
80600
+ */
80601
+ get IndexType() {
80602
+ return this.Get('IndexType');
80603
+ }
80604
+ set IndexType(value) {
80605
+ this.Set('IndexType', value);
80606
+ }
80607
+ /**
80608
+ * * Field Name: VectorIndexID
80609
+ * * Display Name: Vector Index ID
80610
+ * * SQL Data Type: uniqueidentifier
80611
+ * * Related Entity/Foreign Key: MJ: Vector Indexes (vwVectorIndexes.ID)
80612
+ * * Description: FK to VectorIndex. REQUIRED when IndexType='Vector'. NULL for all other IndexType values.
80613
+ */
80614
+ get VectorIndexID() {
80615
+ return this.Get('VectorIndexID');
80616
+ }
80617
+ set VectorIndexID(value) {
80618
+ this.Set('VectorIndexID', value);
80619
+ }
80620
+ /**
80621
+ * * Field Name: ExternalIndexName
80622
+ * * Display Name: External Index Name
80623
+ * * SQL Data Type: nvarchar(400)
80624
+ * * Description: For non-vector IndexTypes: the remote engine's index/collection/alias name (e.g., Elasticsearch index "kb_docs_v3", Typesense collection "articles"). NULL for IndexType='Vector' (VectorIndexID resolves the name instead).
80625
+ */
80626
+ get ExternalIndexName() {
80627
+ return this.Get('ExternalIndexName');
80628
+ }
80629
+ set ExternalIndexName(value) {
80630
+ this.Set('ExternalIndexName', value);
80631
+ }
80632
+ /**
80633
+ * * Field Name: ExternalIndexConfig
80634
+ * * Display Name: External Index Config
80635
+ * * SQL Data Type: nvarchar(MAX)
80636
+ * * Description: JSON with extra connection/config hints the provider needs (cluster alias, routing key, custom analyzer, etc.). Provider-interpreted.
80637
+ */
80638
+ get ExternalIndexConfig() {
80639
+ return this.Get('ExternalIndexConfig');
80640
+ }
80641
+ set ExternalIndexConfig(value) {
80642
+ this.Set('ExternalIndexConfig', value);
80643
+ }
80644
+ /**
80645
+ * * Field Name: MetadataFilter
80646
+ * * Display Name: Metadata Filter
80647
+ * * SQL Data Type: nvarchar(MAX)
80648
+ * * Description: JSON filter expression applied as a native metadata filter on the remote engine. Pinecone/Qdrant/PGVector metadata filter, or Elasticsearch filter DSL, etc. Rendered as a Nunjucks template so SearchContext.PrimaryScopeRecordID and SearchContext.SecondaryScopes.* can be interpolated for multi-tenant filtering.
80649
+ */
80650
+ get MetadataFilter() {
80651
+ return this.Get('MetadataFilter');
80652
+ }
80653
+ set MetadataFilter(value) {
80654
+ this.Set('MetadataFilter', value);
80655
+ }
80656
+ /**
80657
+ * * Field Name: __mj_CreatedAt
80658
+ * * Display Name: Created At
80659
+ * * SQL Data Type: datetimeoffset
80660
+ * * Default Value: getutcdate()
80661
+ */
80662
+ get __mj_CreatedAt() {
80663
+ return this.Get('__mj_CreatedAt');
80664
+ }
80665
+ /**
80666
+ * * Field Name: __mj_UpdatedAt
80667
+ * * Display Name: Updated At
80668
+ * * SQL Data Type: datetimeoffset
80669
+ * * Default Value: getutcdate()
80670
+ */
80671
+ get __mj_UpdatedAt() {
80672
+ return this.Get('__mj_UpdatedAt');
80673
+ }
80674
+ /**
80675
+ * * Field Name: SearchScope
80676
+ * * Display Name: Search Scope
80677
+ * * SQL Data Type: nvarchar(200)
80678
+ */
80679
+ get SearchScope() {
80680
+ return this.Get('SearchScope');
80681
+ }
80682
+ /**
80683
+ * * Field Name: VectorIndex
80684
+ * * Display Name: Vector Index
80685
+ * * SQL Data Type: nvarchar(255)
80686
+ */
80687
+ get VectorIndex() {
80688
+ return this.Get('VectorIndex');
80689
+ }
80690
+ };
80691
+ MJSearchScopeExternalIndexEntity = __decorate([
80692
+ RegisterClass(BaseEntity, 'MJ: Search Scope External Indexes')
80693
+ ], MJSearchScopeExternalIndexEntity);
80694
+ export { MJSearchScopeExternalIndexEntity };
80695
+ /**
80696
+ * MJ: Search Scope Permissions - strongly typed entity sub-class
80697
+ * * Schema: __mj
80698
+ * * Base Table: SearchScopePermission
80699
+ * * Base View: vwSearchScopePermissions
80700
+ * * @description Per-user or per-role permission grant on a SearchScope. Exactly one of UserID or RoleID is set on each row; the other is NULL. PermissionLevel is one of None, Read, Search, Manage. Combined with AIAgent.SearchScopeAccess for agent-side fallbacks via the SearchScopePermissionResolver.
80701
+ * * Primary Key: ID
80702
+ * @extends {BaseEntity}
80703
+ * @class
80704
+ * @public
80705
+ */
80706
+ let MJSearchScopePermissionEntity = class MJSearchScopePermissionEntity extends BaseEntity {
80707
+ /**
80708
+ * Loads the MJ: Search Scope Permissions record from the database
80709
+ * @param ID: string - primary key value to load the MJ: Search Scope Permissions record.
80710
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
80711
+ * @returns {Promise<boolean>} - true if successful, false otherwise
80712
+ * @public
80713
+ * @async
80714
+ * @memberof MJSearchScopePermissionEntity
80715
+ * @method
80716
+ * @override
80717
+ */
80718
+ async Load(ID, EntityRelationshipsToLoad) {
80719
+ const compositeKey = new CompositeKey();
80720
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
80721
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
80722
+ }
80723
+ /**
80724
+ * Validate() method override for MJ: Search Scope Permissions entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
80725
+ * * Table-Level: Each record must be assigned to either a specific user or a specific role, but not both. This ensures that permissions or scopes are clearly defined for a single entity type and prevents ambiguous assignments.
80726
+ * @public
80727
+ * @method
80728
+ * @override
80729
+ */
80730
+ Validate() {
80731
+ const result = super.Validate();
80732
+ this.ValidateUserIDAndRoleIDExclusiveAssignment(result);
80733
+ result.Success = result.Success && (result.Errors.length === 0);
80734
+ return result;
80735
+ }
80736
+ /**
80737
+ * Each record must be assigned to either a specific user or a specific role, but not both. This ensures that permissions or scopes are clearly defined for a single entity type and prevents ambiguous assignments.
80738
+ * @param result - the ValidationResult object to add any errors or warnings to
80739
+ * @public
80740
+ * @method
80741
+ */
80742
+ ValidateUserIDAndRoleIDExclusiveAssignment(result) {
80743
+ // Check if both fields are null (violates the requirement that at least one must be set)
80744
+ if (this.UserID == null && this.RoleID == null) {
80745
+ result.Errors.push(new ValidationErrorInfo("UserID", "Each record must be assigned to either a User or a Role.", this.UserID, ValidationErrorType.Failure));
80746
+ }
80747
+ // Check if both fields are populated (violates the requirement that only one can be set)
80748
+ if (this.UserID != null && this.RoleID != null) {
80749
+ result.Errors.push(new ValidationErrorInfo("UserID", "A record cannot be assigned to both a User and a Role simultaneously.", this.UserID, ValidationErrorType.Failure));
80750
+ }
80751
+ }
80752
+ /**
80753
+ * * Field Name: ID
80754
+ * * Display Name: ID
80755
+ * * SQL Data Type: uniqueidentifier
80756
+ * * Default Value: newsequentialid()
80757
+ * * Description: Primary key. Auto-generated.
80758
+ */
80759
+ get ID() {
80760
+ return this.Get('ID');
80761
+ }
80762
+ set ID(value) {
80763
+ this.Set('ID', value);
80764
+ }
80765
+ /**
80766
+ * * Field Name: SearchScopeID
80767
+ * * Display Name: Search Scope
80768
+ * * SQL Data Type: uniqueidentifier
80769
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
80770
+ * * Description: The SearchScope this permission row applies to.
80771
+ */
80772
+ get SearchScopeID() {
80773
+ return this.Get('SearchScopeID');
80774
+ }
80775
+ set SearchScopeID(value) {
80776
+ this.Set('SearchScopeID', value);
80777
+ }
80778
+ /**
80779
+ * * Field Name: UserID
80780
+ * * Display Name: User
80781
+ * * SQL Data Type: uniqueidentifier
80782
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
80783
+ * * Description: The user this permission applies to. Mutually exclusive with RoleID — exactly one must be set.
80784
+ */
80785
+ get UserID() {
80786
+ return this.Get('UserID');
80787
+ }
80788
+ set UserID(value) {
80789
+ this.Set('UserID', value);
80790
+ }
80791
+ /**
80792
+ * * Field Name: RoleID
80793
+ * * Display Name: Role
80794
+ * * SQL Data Type: uniqueidentifier
80795
+ * * Related Entity/Foreign Key: MJ: Roles (vwRoles.ID)
80796
+ * * Description: The role this permission applies to. Mutually exclusive with UserID — exactly one must be set. Permissions granted via roles flow to all users in that role.
80797
+ */
80798
+ get RoleID() {
80799
+ return this.Get('RoleID');
80800
+ }
80801
+ set RoleID(value) {
80802
+ this.Set('RoleID', value);
80803
+ }
80804
+ /**
80805
+ * * Field Name: PermissionLevel
80806
+ * * Display Name: Permission Level
80807
+ * * SQL Data Type: nvarchar(20)
80808
+ * * Value List Type: List
80809
+ * * Possible Values
80810
+ * * Manage
80811
+ * * None
80812
+ * * Read
80813
+ * * Search
80814
+ * * Description: Capability granted on this SearchScope. None = explicit deny (overrides role grants), Read = view scope metadata, Search = invoke ScopedSearchAction, Manage = full edit including authoring of permission rows. The resolver picks the highest level when multiple grants apply (direct + role).
80815
+ */
80816
+ get PermissionLevel() {
80817
+ return this.Get('PermissionLevel');
80818
+ }
80819
+ set PermissionLevel(value) {
80820
+ this.Set('PermissionLevel', value);
80821
+ }
80822
+ /**
80823
+ * * Field Name: __mj_CreatedAt
80824
+ * * Display Name: Created At
80825
+ * * SQL Data Type: datetimeoffset
80826
+ * * Default Value: getutcdate()
80827
+ */
80828
+ get __mj_CreatedAt() {
80829
+ return this.Get('__mj_CreatedAt');
80830
+ }
80831
+ /**
80832
+ * * Field Name: __mj_UpdatedAt
80833
+ * * Display Name: Updated At
80834
+ * * SQL Data Type: datetimeoffset
80835
+ * * Default Value: getutcdate()
80836
+ */
80837
+ get __mj_UpdatedAt() {
80838
+ return this.Get('__mj_UpdatedAt');
80839
+ }
80840
+ /**
80841
+ * * Field Name: SearchScope
80842
+ * * Display Name: Search Scope Name
80843
+ * * SQL Data Type: nvarchar(200)
80844
+ */
80845
+ get SearchScope() {
80846
+ return this.Get('SearchScope');
80847
+ }
80848
+ /**
80849
+ * * Field Name: User
80850
+ * * Display Name: User Name
80851
+ * * SQL Data Type: nvarchar(100)
80852
+ */
80853
+ get User() {
80854
+ return this.Get('User');
80855
+ }
80856
+ /**
80857
+ * * Field Name: Role
80858
+ * * Display Name: Role Name
80859
+ * * SQL Data Type: nvarchar(50)
80860
+ */
80861
+ get Role() {
80862
+ return this.Get('Role');
80863
+ }
80864
+ };
80865
+ MJSearchScopePermissionEntity = __decorate([
80866
+ RegisterClass(BaseEntity, 'MJ: Search Scope Permissions')
80867
+ ], MJSearchScopePermissionEntity);
80868
+ export { MJSearchScopePermissionEntity };
80869
+ /**
80870
+ * MJ: Search Scope Providers - strongly typed entity sub-class
80871
+ * * Schema: __mj
80872
+ * * Base Table: SearchScopeProvider
80873
+ * * Base View: vwSearchScopeProviders
80874
+ * * @description Controls which SearchProviders participate in a given SearchScope. Each row enables one provider within one scope, with optional overrides.
80875
+ * * Primary Key: ID
80876
+ * @extends {BaseEntity}
80877
+ * @class
80878
+ * @public
80879
+ */
80880
+ let MJSearchScopeProviderEntity = class MJSearchScopeProviderEntity extends BaseEntity {
80881
+ /**
80882
+ * Loads the MJ: Search Scope Providers record from the database
80883
+ * @param ID: string - primary key value to load the MJ: Search Scope Providers record.
80884
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
80885
+ * @returns {Promise<boolean>} - true if successful, false otherwise
80886
+ * @public
80887
+ * @async
80888
+ * @memberof MJSearchScopeProviderEntity
80889
+ * @method
80890
+ * @override
80891
+ */
80892
+ async Load(ID, EntityRelationshipsToLoad) {
80893
+ const compositeKey = new CompositeKey();
80894
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
80895
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
80896
+ }
80897
+ /**
80898
+ * * Field Name: ID
80899
+ * * Display Name: ID
80900
+ * * SQL Data Type: uniqueidentifier
80901
+ * * Default Value: newsequentialid()
80902
+ */
80903
+ get ID() {
80904
+ return this.Get('ID');
80905
+ }
80906
+ set ID(value) {
80907
+ this.Set('ID', value);
80908
+ }
80909
+ /**
80910
+ * * Field Name: SearchScopeID
80911
+ * * Display Name: Search Scope
80912
+ * * SQL Data Type: uniqueidentifier
80913
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
80914
+ */
80915
+ get SearchScopeID() {
80916
+ return this.Get('SearchScopeID');
80917
+ }
80918
+ set SearchScopeID(value) {
80919
+ this.Set('SearchScopeID', value);
80920
+ }
80921
+ /**
80922
+ * * Field Name: SearchProviderID
80923
+ * * Display Name: Search Provider
80924
+ * * SQL Data Type: uniqueidentifier
80925
+ * * Related Entity/Foreign Key: MJ: Search Providers (vwSearchProviders.ID)
80926
+ */
80927
+ get SearchProviderID() {
80928
+ return this.Get('SearchProviderID');
80929
+ }
80930
+ set SearchProviderID(value) {
80931
+ this.Set('SearchProviderID', value);
80932
+ }
80933
+ /**
80934
+ * * Field Name: Enabled
80935
+ * * Display Name: Enabled
80936
+ * * SQL Data Type: bit
80937
+ * * Default Value: 1
80938
+ * * Description: Whether this provider is active for this scope. Lets an admin toggle providers off per-scope without deleting the row.
80939
+ */
80940
+ get Enabled() {
80941
+ return this.Get('Enabled');
80942
+ }
80943
+ set Enabled(value) {
80944
+ this.Set('Enabled', value);
80945
+ }
80946
+ /**
80947
+ * * Field Name: MaxResultsOverride
80948
+ * * Display Name: Max Results Override
80949
+ * * SQL Data Type: int
80950
+ * * Description: Override the max-results value for this provider within this scope. NULL = use the provider's default.
80951
+ */
80952
+ get MaxResultsOverride() {
80953
+ return this.Get('MaxResultsOverride');
80954
+ }
80955
+ set MaxResultsOverride(value) {
80956
+ this.Set('MaxResultsOverride', value);
80957
+ }
80958
+ /**
80959
+ * * Field Name: ProviderConfigOverride
80960
+ * * Display Name: Provider Config Override
80961
+ * * SQL Data Type: nvarchar(MAX)
80962
+ * * Description: JSON override for provider-specific configuration within this scope. Provider interprets.
80963
+ */
80964
+ get ProviderConfigOverride() {
80965
+ return this.Get('ProviderConfigOverride');
80966
+ }
80967
+ set ProviderConfigOverride(value) {
80968
+ this.Set('ProviderConfigOverride', value);
80969
+ }
80970
+ /**
80971
+ * * Field Name: QueryTransformTemplateID
80972
+ * * Display Name: Query Transform Template
80973
+ * * SQL Data Type: uniqueidentifier
80974
+ * * Related Entity/Foreign Key: MJ: Templates (vwTemplates.ID)
80975
+ * * Description: Optional FK to Templates. When set, the user/agent query is rewritten through this Template before being sent to this provider. Lets vector providers get a chunk-shaped rewrite while FTS providers get keyword extraction within the same scope. Resolution order: this > AIAgentSearchScope.QueryTemplateID > raw lastUserMessage.
80976
+ */
80977
+ get QueryTransformTemplateID() {
80978
+ return this.Get('QueryTransformTemplateID');
80979
+ }
80980
+ set QueryTransformTemplateID(value) {
80981
+ this.Set('QueryTransformTemplateID', value);
80982
+ }
80983
+ /**
80984
+ * * Field Name: __mj_CreatedAt
80985
+ * * Display Name: Created At
80986
+ * * SQL Data Type: datetimeoffset
80987
+ * * Default Value: getutcdate()
80988
+ */
80989
+ get __mj_CreatedAt() {
80990
+ return this.Get('__mj_CreatedAt');
80991
+ }
80992
+ /**
80993
+ * * Field Name: __mj_UpdatedAt
80994
+ * * Display Name: Updated At
80995
+ * * SQL Data Type: datetimeoffset
80996
+ * * Default Value: getutcdate()
80997
+ */
80998
+ get __mj_UpdatedAt() {
80999
+ return this.Get('__mj_UpdatedAt');
81000
+ }
81001
+ /**
81002
+ * * Field Name: SearchScope
81003
+ * * Display Name: Search Scope Name
81004
+ * * SQL Data Type: nvarchar(200)
81005
+ */
81006
+ get SearchScope() {
81007
+ return this.Get('SearchScope');
81008
+ }
81009
+ /**
81010
+ * * Field Name: SearchProvider
81011
+ * * Display Name: Search Provider Name
81012
+ * * SQL Data Type: nvarchar(200)
81013
+ */
81014
+ get SearchProvider() {
81015
+ return this.Get('SearchProvider');
81016
+ }
81017
+ /**
81018
+ * * Field Name: QueryTransformTemplate
81019
+ * * Display Name: Query Transform Template Name
81020
+ * * SQL Data Type: nvarchar(255)
81021
+ */
81022
+ get QueryTransformTemplate() {
81023
+ return this.Get('QueryTransformTemplate');
81024
+ }
81025
+ };
81026
+ MJSearchScopeProviderEntity = __decorate([
81027
+ RegisterClass(BaseEntity, 'MJ: Search Scope Providers')
81028
+ ], MJSearchScopeProviderEntity);
81029
+ export { MJSearchScopeProviderEntity };
81030
+ /**
81031
+ * MJ: Search Scope Storage Accounts - strongly typed entity sub-class
81032
+ * * Schema: __mj
81033
+ * * Base Table: SearchScopeStorageAccount
81034
+ * * Base View: vwSearchScopeStorageAccounts
81035
+ * * @description Controls which file storage accounts/folders participate in a scope.
81036
+ * * Primary Key: ID
81037
+ * @extends {BaseEntity}
81038
+ * @class
81039
+ * @public
81040
+ */
81041
+ let MJSearchScopeStorageAccountEntity = class MJSearchScopeStorageAccountEntity extends BaseEntity {
81042
+ /**
81043
+ * Loads the MJ: Search Scope Storage Accounts record from the database
81044
+ * @param ID: string - primary key value to load the MJ: Search Scope Storage Accounts record.
81045
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
81046
+ * @returns {Promise<boolean>} - true if successful, false otherwise
81047
+ * @public
81048
+ * @async
81049
+ * @memberof MJSearchScopeStorageAccountEntity
81050
+ * @method
81051
+ * @override
81052
+ */
81053
+ async Load(ID, EntityRelationshipsToLoad) {
81054
+ const compositeKey = new CompositeKey();
81055
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
81056
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
81057
+ }
81058
+ /**
81059
+ * * Field Name: ID
81060
+ * * Display Name: ID
81061
+ * * SQL Data Type: uniqueidentifier
81062
+ * * Default Value: newsequentialid()
81063
+ */
81064
+ get ID() {
81065
+ return this.Get('ID');
81066
+ }
81067
+ set ID(value) {
81068
+ this.Set('ID', value);
81069
+ }
81070
+ /**
81071
+ * * Field Name: SearchScopeID
81072
+ * * Display Name: Search Scope
81073
+ * * SQL Data Type: uniqueidentifier
81074
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
81075
+ */
81076
+ get SearchScopeID() {
81077
+ return this.Get('SearchScopeID');
81078
+ }
81079
+ set SearchScopeID(value) {
81080
+ this.Set('SearchScopeID', value);
81081
+ }
81082
+ /**
81083
+ * * Field Name: FileStorageAccountID
81084
+ * * Display Name: Storage Account
81085
+ * * SQL Data Type: uniqueidentifier
81086
+ * * Related Entity/Foreign Key: MJ: File Storage Accounts (vwFileStorageAccounts.ID)
81087
+ */
81088
+ get FileStorageAccountID() {
81089
+ return this.Get('FileStorageAccountID');
81090
+ }
81091
+ set FileStorageAccountID(value) {
81092
+ this.Set('FileStorageAccountID', value);
81093
+ }
81094
+ /**
81095
+ * * Field Name: FolderPath
81096
+ * * Display Name: Folder Path
81097
+ * * SQL Data Type: nvarchar(1000)
81098
+ * * Description: Optional folder path restriction. NULL = entire storage account. Example: /policies/hr/. Rendered as a Nunjucks template with SearchContext variables so platforms can do per-tenant folder routing like /tenants/{{ context.PrimaryScopeRecordID }}/.
81099
+ */
81100
+ get FolderPath() {
81101
+ return this.Get('FolderPath');
81102
+ }
81103
+ set FolderPath(value) {
81104
+ this.Set('FolderPath', value);
81105
+ }
81106
+ /**
81107
+ * * Field Name: __mj_CreatedAt
81108
+ * * Display Name: Created At
81109
+ * * SQL Data Type: datetimeoffset
81110
+ * * Default Value: getutcdate()
81111
+ */
81112
+ get __mj_CreatedAt() {
81113
+ return this.Get('__mj_CreatedAt');
81114
+ }
81115
+ /**
81116
+ * * Field Name: __mj_UpdatedAt
81117
+ * * Display Name: Updated At
81118
+ * * SQL Data Type: datetimeoffset
81119
+ * * Default Value: getutcdate()
81120
+ */
81121
+ get __mj_UpdatedAt() {
81122
+ return this.Get('__mj_UpdatedAt');
81123
+ }
81124
+ /**
81125
+ * * Field Name: SearchScope
81126
+ * * Display Name: Search Scope Name
81127
+ * * SQL Data Type: nvarchar(200)
81128
+ */
81129
+ get SearchScope() {
81130
+ return this.Get('SearchScope');
81131
+ }
81132
+ /**
81133
+ * * Field Name: FileStorageAccount
81134
+ * * Display Name: Storage Account Name
81135
+ * * SQL Data Type: nvarchar(200)
81136
+ */
81137
+ get FileStorageAccount() {
81138
+ return this.Get('FileStorageAccount');
81139
+ }
81140
+ };
81141
+ MJSearchScopeStorageAccountEntity = __decorate([
81142
+ RegisterClass(BaseEntity, 'MJ: Search Scope Storage Accounts')
81143
+ ], MJSearchScopeStorageAccountEntity);
81144
+ export { MJSearchScopeStorageAccountEntity };
81145
+ /**
81146
+ * MJ: Search Scope Test Queries - strongly typed entity sub-class
81147
+ * * Schema: __mj
81148
+ * * Base Table: SearchScopeTestQuery
81149
+ * * Base View: vwSearchScopeTestQueries
81150
+ * * @description Canonical test queries owned by a SearchScope. Used by scope authors to validate tuning changes — re-run a saved query after swapping the reranker or adjusting fusion weights and compare results to the prior run.
81151
+ * * Primary Key: ID
81152
+ * @extends {BaseEntity}
81153
+ * @class
81154
+ * @public
81155
+ */
81156
+ let MJSearchScopeTestQueryEntity = class MJSearchScopeTestQueryEntity extends BaseEntity {
81157
+ /**
81158
+ * Loads the MJ: Search Scope Test Queries record from the database
81159
+ * @param ID: string - primary key value to load the MJ: Search Scope Test Queries record.
81160
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
81161
+ * @returns {Promise<boolean>} - true if successful, false otherwise
81162
+ * @public
81163
+ * @async
81164
+ * @memberof MJSearchScopeTestQueryEntity
81165
+ * @method
81166
+ * @override
81167
+ */
81168
+ async Load(ID, EntityRelationshipsToLoad) {
81169
+ const compositeKey = new CompositeKey();
81170
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
81171
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
81172
+ }
81173
+ /**
81174
+ * * Field Name: ID
81175
+ * * Display Name: ID
81176
+ * * SQL Data Type: uniqueidentifier
81177
+ * * Default Value: newsequentialid()
81178
+ */
81179
+ get ID() {
81180
+ return this.Get('ID');
81181
+ }
81182
+ set ID(value) {
81183
+ this.Set('ID', value);
81184
+ }
81185
+ /**
81186
+ * * Field Name: SearchScopeID
81187
+ * * Display Name: Search Scope
81188
+ * * SQL Data Type: uniqueidentifier
81189
+ * * Related Entity/Foreign Key: MJ: Search Scopes (vwSearchScopes.ID)
81190
+ * * Description: The SearchScope this test query belongs to. Cascade-restricted via FK so accidental scope deletion preserves test history.
81191
+ */
81192
+ get SearchScopeID() {
81193
+ return this.Get('SearchScopeID');
81194
+ }
81195
+ set SearchScopeID(value) {
81196
+ this.Set('SearchScopeID', value);
81197
+ }
81198
+ /**
81199
+ * * Field Name: Label
81200
+ * * Display Name: Label
81201
+ * * SQL Data Type: nvarchar(200)
81202
+ * * Description: Short human-readable label for the test query, shown in the form's test-query grid (e.g. "VIP customer escalation", "expense reimbursement policy").
81203
+ */
81204
+ get Label() {
81205
+ return this.Get('Label');
81206
+ }
81207
+ set Label(value) {
81208
+ this.Set('Label', value);
81209
+ }
81210
+ /**
81211
+ * * Field Name: Query
81212
+ * * Display Name: Query
81213
+ * * SQL Data Type: nvarchar(MAX)
81214
+ * * Description: The query text itself. NVARCHAR(MAX) because canonical queries can be full sentences or chunks of natural-language context.
81215
+ */
81216
+ get Query() {
81217
+ return this.Get('Query');
81218
+ }
81219
+ set Query(value) {
81220
+ this.Set('Query', value);
81221
+ }
81222
+ /**
81223
+ * * Field Name: ExpectedTopResultEntity
81224
+ * * Display Name: Expected Top Result Entity
81225
+ * * SQL Data Type: nvarchar(255)
81226
+ * * Description: Optional MJ entity name (e.g. "Contacts", "Documents") of the expected top result. When set together with ExpectedTopResultRecordID, lets the test runner assert that the tuned scope returns the right record at rank #1 — a regression tripwire for fusion / reranker changes.
81227
+ */
81228
+ get ExpectedTopResultEntity() {
81229
+ return this.Get('ExpectedTopResultEntity');
81230
+ }
81231
+ set ExpectedTopResultEntity(value) {
81232
+ this.Set('ExpectedTopResultEntity', value);
81233
+ }
81234
+ /**
81235
+ * * Field Name: ExpectedTopResultRecordID
81236
+ * * Display Name: Expected Top Result Record ID
81237
+ * * SQL Data Type: uniqueidentifier
81238
+ * * Description: Optional record ID of the expected top result, paired with ExpectedTopResultEntity. NULL = no assertion (the query is exploratory).
81239
+ */
81240
+ get ExpectedTopResultRecordID() {
81241
+ return this.Get('ExpectedTopResultRecordID');
81242
+ }
81243
+ set ExpectedTopResultRecordID(value) {
81244
+ this.Set('ExpectedTopResultRecordID', value);
81245
+ }
81246
+ /**
81247
+ * * Field Name: Notes
81248
+ * * Display Name: Notes
81249
+ * * SQL Data Type: nvarchar(MAX)
81250
+ * * Description: Free-form notes explaining why this query is canonical or what edge case it represents.
81251
+ */
81252
+ get Notes() {
81253
+ return this.Get('Notes');
81254
+ }
81255
+ set Notes(value) {
81256
+ this.Set('Notes', value);
81257
+ }
81258
+ /**
81259
+ * * Field Name: __mj_CreatedAt
81260
+ * * Display Name: Created At
81261
+ * * SQL Data Type: datetimeoffset
81262
+ * * Default Value: getutcdate()
81263
+ */
81264
+ get __mj_CreatedAt() {
81265
+ return this.Get('__mj_CreatedAt');
81266
+ }
81267
+ /**
81268
+ * * Field Name: __mj_UpdatedAt
81269
+ * * Display Name: Updated At
81270
+ * * SQL Data Type: datetimeoffset
81271
+ * * Default Value: getutcdate()
81272
+ */
81273
+ get __mj_UpdatedAt() {
81274
+ return this.Get('__mj_UpdatedAt');
81275
+ }
81276
+ /**
81277
+ * * Field Name: SearchScope
81278
+ * * Display Name: Search Scope Name
81279
+ * * SQL Data Type: nvarchar(200)
81280
+ */
81281
+ get SearchScope() {
81282
+ return this.Get('SearchScope');
81283
+ }
81284
+ };
81285
+ MJSearchScopeTestQueryEntity = __decorate([
81286
+ RegisterClass(BaseEntity, 'MJ: Search Scope Test Queries')
81287
+ ], MJSearchScopeTestQueryEntity);
81288
+ export { MJSearchScopeTestQueryEntity };
81289
+ /**
81290
+ * MJ: Search Scopes - strongly typed entity sub-class
81291
+ * * Schema: __mj
81292
+ * * Base Table: SearchScope
81293
+ * * Base View: vwSearchScopes
81294
+ * * @description A named, reusable boundary defining WHICH content participates in a search (providers, external indexes, entities, storage accounts). Combined with a runtime SearchContext, it enables multi-tenant, permission-aware, agent-friendly retrieval. See plans/search-scopes-rag-plus.md.
81295
+ * * Primary Key: ID
81296
+ * @extends {BaseEntity}
81297
+ * @class
81298
+ * @public
81299
+ */
81300
+ let MJSearchScopeEntity = class MJSearchScopeEntity extends BaseEntity {
81301
+ /**
81302
+ * Loads the MJ: Search Scopes record from the database
81303
+ * @param ID: string - primary key value to load the MJ: Search Scopes record.
81304
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
81305
+ * @returns {Promise<boolean>} - true if successful, false otherwise
81306
+ * @public
81307
+ * @async
81308
+ * @memberof MJSearchScopeEntity
81309
+ * @method
81310
+ * @override
81311
+ */
81312
+ async Load(ID, EntityRelationshipsToLoad) {
81313
+ const compositeKey = new CompositeKey();
81314
+ compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
81315
+ return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
81316
+ }
81317
+ /**
81318
+ * * Field Name: ID
81319
+ * * Display Name: ID
81320
+ * * SQL Data Type: uniqueidentifier
81321
+ * * Default Value: newsequentialid()
81322
+ */
81323
+ get ID() {
81324
+ return this.Get('ID');
81325
+ }
81326
+ set ID(value) {
81327
+ this.Set('ID', value);
81328
+ }
81329
+ /**
81330
+ * * Field Name: Name
81331
+ * * Display Name: Name
81332
+ * * SQL Data Type: nvarchar(200)
81333
+ * * Description: Human-readable scope name (e.g., "HR Policies", "Engineering Docs"). Unique across the system.
81334
+ */
81335
+ get Name() {
81336
+ return this.Get('Name');
81337
+ }
81338
+ set Name(value) {
81339
+ this.Set('Name', value);
81340
+ }
81341
+ /**
81342
+ * * Field Name: Description
81343
+ * * Display Name: Description
81344
+ * * SQL Data Type: nvarchar(MAX)
81345
+ * * Description: Detailed description of what this scope covers. Surfaced to agents in the available-scopes prompt injection so the LLM can choose a scope.
81346
+ */
81347
+ get Description() {
81348
+ return this.Get('Description');
81349
+ }
81350
+ set Description(value) {
81351
+ this.Set('Description', value);
81352
+ }
81353
+ /**
81354
+ * * Field Name: Icon
81355
+ * * Display Name: Icon
81356
+ * * SQL Data Type: nvarchar(200)
81357
+ * * Description: Font Awesome (or equivalent) icon class used by the scope selector UI.
81358
+ */
81359
+ get Icon() {
81360
+ return this.Get('Icon');
81361
+ }
81362
+ set Icon(value) {
81363
+ this.Set('Icon', value);
81364
+ }
81365
+ /**
81366
+ * * Field Name: IsGlobal
81367
+ * * Display Name: Is Global
81368
+ * * SQL Data Type: bit
81369
+ * * Default Value: 0
81370
+ * * Description: If true, this scope includes everything (equivalent to no scope filtering). Exactly one Global scope should exist; it is seeded via metadata sync.
81371
+ */
81372
+ get IsGlobal() {
81373
+ return this.Get('IsGlobal');
81374
+ }
81375
+ set IsGlobal(value) {
81376
+ this.Set('IsGlobal', value);
81377
+ }
81378
+ /**
81379
+ * * Field Name: IsDefault
81380
+ * * Display Name: Is Default
81381
+ * * SQL Data Type: bit
81382
+ * * Default Value: 0
81383
+ * * Description: If true, this is the default scope for users/agents that do not specify one.
81384
+ */
81385
+ get IsDefault() {
81386
+ return this.Get('IsDefault');
81387
+ }
81388
+ set IsDefault(value) {
81389
+ this.Set('IsDefault', value);
81390
+ }
81391
+ /**
81392
+ * * Field Name: OwnerUserID
81393
+ * * Display Name: Owner User
81394
+ * * SQL Data Type: uniqueidentifier
81395
+ * * Related Entity/Foreign Key: MJ: Users (vwUsers.ID)
81396
+ * * Description: NULL = organization-wide scope. Set = personal scope owned by this user (visible/usable only by that user unless explicitly shared).
81397
+ */
81398
+ get OwnerUserID() {
81399
+ return this.Get('OwnerUserID');
81400
+ }
81401
+ set OwnerUserID(value) {
81402
+ this.Set('OwnerUserID', value);
81403
+ }
81404
+ /**
81405
+ * * Field Name: Status
81406
+ * * Display Name: Status
81407
+ * * SQL Data Type: nvarchar(20)
81408
+ * * Default Value: Active
81409
+ * * Value List Type: List
81410
+ * * Possible Values
81411
+ * * Active
81412
+ * * Inactive
81413
+ * * Description: Lifecycle status. Only Active scopes are considered at query time.
81414
+ */
81415
+ get Status() {
81416
+ return this.Get('Status');
81417
+ }
81418
+ set Status(value) {
81419
+ this.Set('Status', value);
81420
+ }
81421
+ /**
81422
+ * * Field Name: StartAt
81423
+ * * Display Name: Start At
81424
+ * * SQL Data Type: datetimeoffset
81425
+ * * Description: Optional time-window activation. Scope is inactive before StartAt. NULL = immediately active.
81426
+ */
81427
+ get StartAt() {
81428
+ return this.Get('StartAt');
81429
+ }
81430
+ set StartAt(value) {
81431
+ this.Set('StartAt', value);
81432
+ }
81433
+ /**
81434
+ * * Field Name: EndAt
81435
+ * * Display Name: End At
81436
+ * * SQL Data Type: datetimeoffset
81437
+ * * Description: Optional time-window deactivation. Scope is inactive after EndAt. NULL = no expiry.
81438
+ */
81439
+ get EndAt() {
81440
+ return this.Get('EndAt');
81441
+ }
81442
+ set EndAt(value) {
81443
+ this.Set('EndAt', value);
81444
+ }
81445
+ /**
81446
+ * * Field Name: ScopeConfig
81447
+ * * Display Name: Scope Configuration
81448
+ * * SQL Data Type: nvarchar(MAX)
81449
+ * * Description: JSON configuration for advanced scope behavior. Recognized keys: rrfK (RRF k parameter), fusionWeights (per-provider weights), reRanker (optional re-ranker stage config: driverClass, inputTopN, outputTopN, config), permissionOverfetchFactor.
81450
+ */
81451
+ get ScopeConfig() {
81452
+ return this.Get('ScopeConfig');
81453
+ }
81454
+ set ScopeConfig(value) {
81455
+ this.Set('ScopeConfig', value);
81456
+ }
81457
+ /**
81458
+ * * Field Name: SearchContextConfig
81459
+ * * Display Name: Search Context Configuration
81460
+ * * SQL Data Type: nvarchar(MAX)
81461
+ * * Description: JSON defining available multi-tenant SearchContext dimensions, inheritance modes, and validation rules. Uses the SecondaryScopeConfig structure shared with the agent memory system (@memberjunction/ai-core-plus). NULL = scope is not multi-tenant aware.
81462
+ */
81463
+ get SearchContextConfig() {
81464
+ return this.Get('SearchContextConfig');
81465
+ }
81466
+ set SearchContextConfig(value) {
81467
+ this.Set('SearchContextConfig', value);
81468
+ }
81469
+ /**
81470
+ * * Field Name: RerankerBudgetCents
81471
+ * * Display Name: Reranker Budget (Cents)
81472
+ * * SQL Data Type: int
81473
+ * * Description: Optional cap on reranker spend (in cents) per search invocation against this scope. NULL means uncapped — existing behavior. When set, the SearchEngine's budget guard short-circuits any reranker call whose projected cost would push the run total past this value, and accumulates actual post-call cost via each reranker's CostReporter callback (BaseReRanker.CostReporter). Real-provider rerankers (Cohere, Voyage, OpenAI) report cost; NoopReRanker and BGEReRanker report zero (local / pass-through).
81474
+ */
81475
+ get RerankerBudgetCents() {
81476
+ return this.Get('RerankerBudgetCents');
81477
+ }
81478
+ set RerankerBudgetCents(value) {
81479
+ this.Set('RerankerBudgetCents', value);
81480
+ }
81481
+ /**
81482
+ * * Field Name: __mj_CreatedAt
81483
+ * * Display Name: Created At
81484
+ * * SQL Data Type: datetimeoffset
81485
+ * * Default Value: getutcdate()
81486
+ */
81487
+ get __mj_CreatedAt() {
81488
+ return this.Get('__mj_CreatedAt');
81489
+ }
81490
+ /**
81491
+ * * Field Name: __mj_UpdatedAt
81492
+ * * Display Name: Updated At
81493
+ * * SQL Data Type: datetimeoffset
81494
+ * * Default Value: getutcdate()
81495
+ */
81496
+ get __mj_UpdatedAt() {
81497
+ return this.Get('__mj_UpdatedAt');
81498
+ }
81499
+ /**
81500
+ * * Field Name: OwnerUser
81501
+ * * Display Name: Owner User Name
81502
+ * * SQL Data Type: nvarchar(100)
81503
+ */
81504
+ get OwnerUser() {
81505
+ return this.Get('OwnerUser');
81506
+ }
81507
+ };
81508
+ MJSearchScopeEntity = __decorate([
81509
+ RegisterClass(BaseEntity, 'MJ: Search Scopes')
81510
+ ], MJSearchScopeEntity);
81511
+ export { MJSearchScopeEntity };
79211
81512
  /**
79212
81513
  * MJ: Skills - strongly typed entity sub-class
79213
81514
  * * Schema: __mj