Member Junction
    Preparing search index...

    Enhanced AI Agent form component that extends the auto-generated base form with comprehensive agent management capabilities including test harness integration, related entity management, and execution history tracking.

    • Integrated Test Harness: Built-in access to agent testing capabilities
    • Related Entity Management: Display and manage sub-agents, prompts, and actions
    • Execution History: View recent agent runs with status and timing information
    • Rich UI Components: Enhanced cards, badges, and status indicators
    • Navigation Support: Links to related entities and management functions
    • Agent Details: Basic agent configuration and settings
    • Sub-Agents: Hierarchical agent relationships
    • Prompts: Associated prompts with priority ordering
    • Actions: Available actions and configurations
    • Execution History: Recent runs with detailed status information

    This component is automatically loaded when editing AI Agent entities through the MemberJunction form system. It extends the base generated form with additional functionality while maintaining full compatibility.

    <!-- Automatically used by form system -->
    <mj-ai-agent-form [recordId]="agentId"></mj-ai-agent-form>

    Hierarchy

    • MJAIAgentFormComponent
      • MJAIAgentFormComponentExtended

    Implements

    • OnDestroy
    Index

    Constructors

    Properties

    Accessors

    Methods

    addNote addPrompt addSubAgents BuildOrganicKeyViewParams BuildOrganicKeyViewParamsByNames BuildRelationshipViewParams BuildRelationshipViewParamsByEntityName CancelEdit CheckUserPermission clearContextCompressionPrompt clearPermissionCache collapseAllSections configureActions configureOutputMapping createChildSubAgent createSubAgent debugPendingRecords EndEditMode expandAllSections formatCost formatExecutionTime formatExecutionTimeFromDates FormatField formatSessionDuration formatTokenCount FormatValue getActionCount getActionIcon getAgentIcon getDefaultFormWidthMode getEntityName GetEntityRelationshipByRelatedEntityName getExecutionModeIcon getExecutionResultMessage getExecutionResultPreview getExecutionStatusColor getExecutionStatusIcon getExpandedCount getFormWidthMode GetListsCanAddTo getPriorityBadgeColor getPriorityLabel getPromptCount GetRecordDependencies GetRelatedEntityTabDisplayName getRunningTime getSection getSectionDisplayOrder GetSectionExpanded getSectionOrder GetSectionPanelHeight GetSectionRowCount getSessionStatusColor getSessionStatusIcon getStatusBadgeColor getSubAgentBadgeColor getSubAgentBadgeIcon getSubAgentBadgeText getSubAgentCount getSubAgentIcon getSubAgentPayloadInfo getTotalSectionCount getVisibleSectionCount goToNextPage goToPreviousPage GridEditMode handleHistoryDialog HandleTagsPanel hasCustomSectionOrder hasLogoURL hasSubAgentLogoURL initSections InternalSaveRecord IsSectionExpanded linkRelatedSubAgent LoadPermissionSummary MakeFavorite navigateToEntity navigateToParentAgent NewRecordValues NewRecordValuesByEntityRelationship ngAfterViewInit ngDoCheck ngOnDestroy ngOnInit OnCategoryChange onContextCompressionToggle onCustomSectionStateChange OnDeleteRequested onExecutionSearchChange OnFavoriteToggled onFilterChange OnFormNavigate OnHistoryRequested OnListManagementRequested OnPanelBarStateChange onPermissionsDialogClosed openContextCompressionPromptSelector openExecutionRecord openPermissionsDialog openPromptAdvancedSettings openSessionRecord openSubAgentAdvancedSettings openTestHarness PendingRecordsDirty PopulatePendingRecords RaiseEvent refreshRelatedData refreshSnapshot removeAction removeChildSubAgent RemoveFavorite removePrompt removeSubAgent resetSectionOrder SaveRecord setExecutionHistoryView SetFavoriteStatus setFormWidthMode SetSectionExpanded setSectionOrder SetSectionPanelHeight SetSectionRowCount setSubAgentFilter ShowChanges ShowDependencies splitterLayoutChange StartEditMode toggleExecutionExpanded toggleFormWidthMode ToggleHeaderCollapsed toggleSection unlinkRelatedSubAgent updatePayloadField Validate ValidatePendingRecords Wait

    Constructors

    Properties

    agentActions: MJActionEntity[] = []

    Array of agent action entities for card display

    agentNotes: MJAIAgentNoteEntity[] = []

    Array of agent note entities for display

    agentPrompts: MJAIPromptEntityExtended[] = []

    Array of agent prompt entities for card display

    AgentSearchScopeColumns: SearchScopeChildGridColumn[] = ...

    Column spec for the AIAgentSearchScope child grid (mockup #5).

    agentSessions: AgentSessionHistoryItem[] = []

    Voice/realtime sessions where this agent is the co-agent or the delegation target

    agentType: MJAIAgentTypeEntity | null = null

    The agent type entity for this agent

    agentTypes: any[] = []

    Agent types loaded from the database

    BottomAreaSize: number

    Size of the bottom area as a percentage (0-100) for angular-split. Used by CodeGen-generated templates with as-split.

    CategoryBranchConfig: TreeBranchConfig = ...

    TreeDropdown configuration for the agent category field

    cdr: ChangeDetectorRef
    collapsiblePanels: QueryList<MjCollapsiblePanelComponent>
    Config: EntityFormConfig | null

    Per-instance presentation config (toolbar visibility, related-entity sections, collapsibility, width, in-form navigation). Set by the form host (MjEntityFormHostComponent) or any consumer that instantiates the form directly. Read back by MjRecordFormContainerComponent and the collapsible panels through the FormComponent reference, so it takes effect WITHOUT regenerating the CodeGen-produced template. Null means "use the container's own defaults" (the classic full-page tab behavior).

    CurrentVariantID: string | null

    ID of the currently-rendered variant (null when no override is active and the form is the CodeGen /

    default).

    EditMode: boolean
    elementRef: ElementRef<any>
    executionHistoryCurrentPage: number = 1
    executionHistoryPageSize: number = 20

    Pagination state for execution history

    executionHistoryView: "runs" | "sessions" = 'runs'

    Which record type the Execution History section shows: agent runs (default) or realtime voice sessions

    executionSearchText: string = ''

    Search functionality for execution history

    expandedExecutions: { [key: string]: boolean } = {}

    Track which execution cards are expanded

    FavoriteInitDone: boolean
    filteredExecutions: MJAIAgentRunEntityExtended[] = []
    formStateService: FormStateService
    hasUnsavedChanges: boolean = false

    Flag to indicate if there are unsaved changes

    HeaderCollapsed: boolean = false

    Whether the form header is collapsed to a single compact line

    isHistoryDialogOpen: boolean
    isLoadingData: boolean = true

    Main loading state for initial data load

    isLoadingPage: boolean = false
    IsLoadingPermissions: boolean = false
    IsOpenToEveryone: boolean = true

    True when no explicit permission records exist (agent is open to everyone)

    IsTagsPanelOpen: boolean
    learningCycles: MJAIAgentLearningCycleEntity[] = []

    Array of learning cycle entities for display

    loadingSessions: boolean = false
    loadingStates: {
        actions: boolean;
        customSection: boolean;
        executionHistory: boolean;
        learningCycles: boolean;
        notes: boolean;
        prompts: boolean;
        searchScopes: boolean;
        subAgents: boolean;
    } = ...

    Individual loading states for each section, start off true until loading complete

    modelSelectionModes: { text: string; value: string }[] = ...

    Model selection mode options for the dropdown

    Navigate: EventEmitter<FormNavigationEvent>

    Emitted when navigation is requested (record link, external link, email, new record, etc.)

    Notification: EventEmitter<FormNotificationEvent>

    Emitted when a user-facing notification should be shown

    OnVariantChanged: (variantID: string | null) => void

    Hook called when the user picks a different variant from the picker. Default is a no-op; the Explorer-level single-record component replaces this on the form instance to wire FormResolverService.SetSelectedVariant and reload the record. Kept as a method (not an EventEmitter) so the host doesn't need to subscribe — assignment is enough.

    PermissionSummary: {
        Permissions: {
            Level: string;
            Principal: string;
            PrincipalType: "User" | "Role";
        }[];
        ScopeID: string;
        ScopeName: string;
    }[] = []

    Read-only summary of SearchScopePermission rows that apply to the scopes this agent is assigned to. Drives a small audit table inside the agent form's Search section so an agent owner can see at a glance who has access to the scopes their agent uses, without navigating away to the Knowledge Hub Config dashboard's full audit surface.

    Each entry pairs a scope name with a list of permission rows (principal type + name + level). Rebuilt whenever the agent's AIAgentSearchScope assignments change.

    Provider: IMetadataProvider | null

    If specified, this provider will be used for communication and for all metadata purposes. By default, if not provided, the Metadata and RunView classes are used for this and the default GraphQLDataProvider is used which is connected to the same back-end MJAPI instance as the Metadata and RunView classes. If you want to have this component connect to a different MJAPI back-end, create an instance of a ProviderBase sub-class like GraphQLDataProvider/etc, and configure it as appropriate to connect to the MJAPI back-end you want to use, and then pass it in here.

    recentExecutions: MJAIAgentRunEntityExtended[] = []

    Array of recent execution records for history display

    The AI Agent entity being edited

    RecordDeleted: EventEmitter<RecordDeletedEvent>

    Emitted after a record is deleted successfully

    RecordDeleteFailed: EventEmitter<RecordDeleteFailedEvent>

    Emitted when a record delete fails

    RecordReady: EventEmitter<BaseEntity<unknown>>

    Emitted once after ngOnInit completes and the record is fully initialized (favorites loaded, form state initialized). This is the safe point for the container to start loading badge counts and other record-dependent data.

    RecordSaved: EventEmitter<RecordSavedEvent>

    Emitted after a record is saved successfully

    RecordSaveFailed: EventEmitter<RecordSaveFailedEvent>

    Emitted when a record save fails

    searchFilter: string
    sections: BaseFormSectionInfo<any>[]
    SectionStates: Record<string, boolean> = {}

    Tracked expanded/collapsed state for each panelbar section

    SelectedCategoryKey: CompositeKey | null = null

    Current category selection for the TreeDropdown

    selectedContextCompressionPrompt: any = null

    Currently selected context compression prompt

    showCreateDialog: boolean
    showDeleteDialog: boolean
    showEmptyFields: boolean
    ShowPermissionsDialog: boolean = false

    Controls visibility of the new permissions dialog from @memberjunction/ng-agents

    statusOptions: { text: string; value: string }[] = ...

    Agent status options for the dropdown

    subAgentFilter: SubAgentFilterType = 'all'

    Current filter for sub-agents display

    subAgents: MJAIAgentEntityExtended[] = []

    Array of sub-agent entities for card display (DEPRECATED - use allSubAgents)

    TagCount: number
    toolbarConfig: FormToolbarConfig = CUSTOM_LAYOUT_TOOLBAR_CONFIG

    Toolbar config — hide right-hand section controls since this form has a custom layout

    TopAreaHeight: string

    Height of the top area when a splitter layout is used. Referenced by CodeGen-generated templates for entities with "top area" sections.

    TopAreaSize: number

    Size of the top area as a percentage (0-100) for angular-split. Used by CodeGen-generated templates with as-split.

    totalExecutionHistoryCount: number = 0
    totalSessionCount: number = 0
    ValidationFailed: EventEmitter<ValidationFailedEvent>

    Emitted when validation fails before save

    Variants: {
        ID: string;
        Label: string;
        Scope: "User" | "Role" | "Global";
        Status: "Active" | "Pending" | "Inactive";
    }[]

    Variants applicable to the current (entity, user) tuple, supplied by the Explorer-level form resolver. When more than one entry is present, the record-form-container shows a picker that lets the user switch between variants. Empty / single-entry arrays hide the picker.

    The container reads this via its EffectiveVariants accessor — generated form templates do NOT need to bind it explicitly.

    "ɵdir": unknown
    "ɵfac": unknown

    Accessors

    • get EntityInfo(): EntityInfo | undefined

      Returns EntityInfo | undefined

    • get formContext(): FormContext

      Returns FormContext

    • get HasOrganicKeys(): boolean

      Whether the current entity has any active organic keys with related entities configured.

      Returns boolean

    • get HasRelatedEntities(): boolean

      Returns boolean

    • get IsFavorite(): boolean

      Returns boolean

    • get OrganicKeys(): EntityOrganicKeyInfo[]

      Returns all active organic keys for the current entity, or an empty array if none.

      Returns EntityOrganicKeyInfo[]

    • get PendingRecords(): PendingRecordItem[]

      Returns PendingRecordItem[]

    • get ProviderToUse(): IMetadataProvider

      Returns either the default Metadata provider or the one specified in the Provider property, if it was specified

      Returns IMetadataProvider

    • get RunQueryToUse(): IRunQueryProvider

      Returns either the default RunQuery provider or the one specified in the Provider property, if it was specified

      Returns IRunQueryProvider

    • get RunReportToUse(): IRunReportProvider

      Returns either the default RunReport provider or the one specified in the Provider property, if it was specified

      Returns IRunReportProvider

    • get RunViewToUse(): IRunViewProvider

      Returns either the default RunView provider or the one specified in the Provider property, if it was specified

      Returns IRunViewProvider

    • get UserCanCreate(): boolean

      Returns boolean

    • get UserCanDelete(): boolean

      Returns boolean

    • get UserCanEdit(): boolean

      Returns boolean

    • get UserCanRead(): boolean

      Returns boolean

    Methods

    • Convenience method to build organic key view params by organic key name and related entity name.

      Parameters

      • organicKeyName: string
      • relatedEntityName: string

      Returns RunViewParams

    • Parameters

      • relatedEntityName: string
      • OptionalrelatedEntityJoinField: string

      Returns RunViewParams

    • Parameters

      Returns boolean

    • Returns void

    • Returns void

    • Returns void

    • Parameters

      • entityFieldInfo: EntityFieldInfo
      • value: any
      • Optionaldecimals: number
      • Optionalcurrency: string

      Returns string

    • Parameters

      • fieldName: string
      • Optionaldecimals: number
      • Optionalcurrency: string

      Returns string

    • Returns string

    • Parameters

      • relatedEntityName: string
      • OptionalrelatedEntityJoinField: string

      Returns EntityRelationshipInfo | undefined

    • Returns number

    • Returns "centered" | "full-width"

    • Returns Promise<MJListEntity[]>

    • Returns Promise<RecordDependency[]>

    • Parameters

      • relatedEntityName: string

      Returns string

    • Parameters

      • sectionKey: string

      Returns BaseFormSectionInfo<any> | undefined

    • Parameters

      • sectionKey: string

      Returns number

    • Returns string[]

    • Parameters

      • sectionKey: string

      Returns number | undefined

    • Parameters

      • sectionKey: string

      Returns number | undefined

    • Returns number

    • Returns number

    • Returns "None" | "Save" | "Queue"

    • Returns void

    • Returns void

    • Returns boolean

    • Parameters

      • sections: (
            | BaseFormSectionInfo<any>
            | {
                isExpanded: boolean;
                metadata?: unknown;
                rowCount?: number;
                sectionKey: string;
                sectionName: string;
            }
        )[]

      Returns void

    • Parameters

      • sectionKey: string
      • OptionaldefaultExpanded: boolean

      Returns boolean

    • Returns Promise<void>

    • Parameters

      • relatedEntityName: string

      Returns Record<string, unknown>

    • Parameters

      Returns Record<string, unknown>

    • A callback method that is invoked immediately after Angular has completed initialization of a component's view. It is invoked only once when the view is instantiated.

      Returns void

    • Handles delete requests from the form container. Emits RecordDeleted on success, RecordDeleteFailed on failure. Generated form templates bind this as: (DeleteRequested)="OnDeleteRequested()"

      Returns Promise<void>

    • Handles favorite toggle from the form container. Generated form templates bind this as: (FavoriteToggled)="OnFavoriteToggled()"

      Returns Promise<void>

    • Parameters

      • searchTerm: string

      Returns void

    • Handles navigation events from the form container and related entity grids. Relays the event upward via the Navigate

      Parameters

      Returns void

      for the host application to handle. Generated form templates bind this as: (Navigate)="OnFormNavigate($event)"

    • Handles history view requests from the form container. Generated form templates bind this as: (HistoryRequested)="OnHistoryRequested()"

      Returns void

    • Handles list management requests from the form container. Generated form templates bind this as: (ListManagementRequested)="OnListManagementRequested()"

      Returns void

    • Returns boolean

    • Returns Promise<void>

    • Returns void

    • Parameters

      • StopEditModeAfterSave: boolean

      Returns Promise<boolean>

    • Parameters

      • isFavorite: boolean

      Returns Promise<void>

    • Parameters

      • widthMode: "centered" | "full-width"

      Returns void

    • Parameters

      • sectionKey: string
      • isExpanded: boolean

      Returns void

    • Parameters

      • sectionOrder: string[]

      Returns void

    • Parameters

      • sectionKey: string
      • height: number

      Returns void

    • Parameters

      • sectionKey: string
      • rowCount: number

      Returns void

    • Returns void

    • Returns Promise<void>

    • Called when the splitter layout changes (for entities with "top area" sections). No-op in the generic version; override in host application if splitter resizing is needed.

      Returns void

    • Returns void

    • Returns void

    • Parameters

      • sectionKey: string

      Returns void

    • Returns ValidationResult

    • Returns ValidationResult[]

    • Parameters

      • duration: number

      Returns Promise<void>