AbstractProtectedcreateCreates a prompt and associates it with an agent. Pass the running action's params
so the underlying entity creates bind to the per-request provider (multi-tenant
correctness).
Optionalparams: RunActionParamsProtectedgetResolve the metadata provider for the running action. Pass params from
InternalRunAction so every entity load/save binds to the per-request provider
(params.Provider) rather than the process-global default. Falls back to a default
Metadata helper instance when no provider was passed (e.g. legacy callers).
Optionalparams: RunActionParamsProtectedgetExtract and validate an object parameter
ProtectedgetExtract and validate a string parameter
ProtectedgetGet database provider with transaction support validation
// Example usage for implementing transactions in actions:
const providerResult = this.getTransactionProvider();
if (providerResult.error) return providerResult.error;
const provider = providerResult.provider!;
// Begin transaction for multi-record operations
await provider.BeginTransaction();
try {
// Perform multiple database operations
const agent = await md.GetEntityObject<MJAIAgentEntity>('MJ: AI Agents', contextUser);
await agent.Save();
const prompt = await md.GetEntityObject<MJAIPromptEntity>('MJ: AI Prompts', contextUser);
await prompt.Save();
// Commit transaction - all operations succeeded
await provider.CommitTransaction();
return { Success: true, ResultCode: 'SUCCESS', Message: 'All operations completed successfully' };
} catch (transactionError) {
// Rollback transaction on any error
await provider.RollbackTransaction();
throw transactionError; // Re-throw to be caught by outer try-catch
}
ProtectedgetExtract and validate a UUID parameter
ProtectedhandleProtected AbstractInternalInternal method that must be implemented by derived action classes. This is where the actual action logic should be implemented.
The action execution parameters including typed context
Promise resolving to the action result
ProtectedisValidates if a string is a valid UUID format
ProtectedloadLoad an AI Agent entity by ID. Pass the running action's params so the underlying
entity load uses the per-request provider (multi-tenant correctness).
Optionalparams: RunActionParamsExecutes the action with the provided parameters.
The action execution parameters including context
Promise resolving to the action result
ProtectedvalidateValidates that the action is being called by the Agent Manager agent
ProtectedvalidateValidate agent type exists. Pass the running action's params so the lookup uses
the per-request provider (multi-tenant correctness).
Optionalparams: RunActionParams
Abstract base class for agent management actions. Provides common functionality for validating permissions, loading entities, and managing agent metadata. Only the Agent Manager agent should be able to execute these actions.