Member Junction
    Preparing search index...

    Helper class for managing AI Agent permissions. Provides methods to check user permissions, get accessible agents, and uses AIEngineBase cached metadata.

    Index

    Constructors

    Methods

    • Narrows agents to the ones user may run: the 'run' permission, and Active only unless includeInactive. Keeps the input order.

      This is the filter the Find Best Agent / Find Candidate Agents actions apply to their search results, and the one agent decision discovery applies to the whole catalog, so both offer the same agents.

      Type Parameters

      Parameters

      • agents: T[]

        The agents to filter, e.g. search results or the whole catalog

      • user: UserInfo

        The user who would run them

      • includeInactive: boolean = false

        Keep agents whose Status is not 'Active'. Default false.

      Returns Promise<T[]>

      The agents the user may run, in their original order

    • Gets all agents that a user has access to with a specific permission level. Uses cached metadata from AIEngineBase instead of querying database.

      Parameters

      • user: UserInfo

        The user to check permissions for

      • permission: "view" | "run" | "edit" | "delete"

        The minimum permission level required ('view', 'run', 'edit', or 'delete')

      Returns Promise<MJAIAgentEntity[]>

      Array of agents the user can access with the specified permission

    • Gets the aggregate permissions for a user on a specific agent. Implements hierarchical permission logic:

      • Delete implies Edit, Run, and View
      • Edit implies Run and View
      • Run implies View

      Default behavior when no permission records exist:

      • Anyone can View and Run (open by default)
      • Only owner can Edit and Delete

      Checks ownership first, then combines all matching user and role permissions.

      Parameters

      • agentId: string

        The ID of the agent

      • user: UserInfo

        The user to check permissions for

      Returns Promise<EffectiveAgentPermissions>

      Object containing all effective permissions and ownership status

    • Checks if a user has a specific permission for an agent.

      Parameters

      • agentId: string

        The ID of the agent to check

      • user: UserInfo

        The user to check permissions for

      • permission: "view" | "run" | "edit" | "delete"

        The permission level to check ('view', 'run', 'edit', or 'delete')

      Returns Promise<boolean>

      True if the user has the specified permission

    • Whether an agent is meant to be found and delegated to directly. Sub-Agents and child agents are meant to be called by other agents, not discovered directly, so an agent whose InvocationMode is 'Sub-Agent', or that has a ParentID, is not.

      Parameters

      • agent: Pick<MJAIAgentEntity, "InvocationMode" | "ParentID">

        The agent to check

      Returns boolean

      True when the agent can be discovered directly