import type { RequestContext } from '@mastra/core/request-context'; import type { Body, PathParams, QueryParams, RouteResponse } from '../route-types.generated.js'; import type { ClientOptions, ListWorkflowRunsParams, SerializedRouteResponse } from '../types.js'; import { BaseResource } from './base.js'; export type AgentBuilderActionRequest = Omit, 'requestContext'> & { /** SDK convenience input serialized before the route request. */ requestContext?: RequestContext; }; type AgentBuilderResumeRequest = Omit, 'requestContext'> & { /** SDK convenience input serialized before the route request. */ requestContext?: RequestContext; }; type AgentBuilderWorkflowResult = RouteResponse<'POST /agent-builder/:actionId/start-async'>; /** SDK transformation of the route's generic workflow execution result. */ export interface AgentBuilderActionResult { success: boolean; applied: boolean; branchName?: string; message: string; validationResults?: unknown; error?: string; errors?: string[]; stepResults?: unknown; } /** * Agent Builder resource: operations related to agent-builder workflows via server endpoints. */ export declare class AgentBuilder extends BaseResource { private actionId; constructor(options: ClientOptions, actionId: string); transformWorkflowResult(result: AgentBuilderWorkflowResult): AgentBuilderActionResult; private createRecordParserTransform; /** * Creates a new agent builder action run and returns the runId. * This calls `/agent-builder/:actionId/create-run`. */ createRun(params?: QueryParams<'POST /agent-builder/:actionId/create-run'>): Promise>; /** * Starts agent builder action asynchronously and waits for completion. * This calls `/agent-builder/:actionId/start-async`. */ startAsync(params: AgentBuilderActionRequest, runId?: string): Promise; /** * Starts an existing agent builder action run. * This calls `/agent-builder/:actionId/start`. */ startActionRun(params: AgentBuilderActionRequest, runId: string): Promise>; /** * Resumes a suspended agent builder action step. * This calls `/agent-builder/:actionId/resume`. */ resume(params: AgentBuilderResumeRequest, runId: string): Promise>; /** * Resumes a suspended agent builder action step asynchronously. * This calls `/agent-builder/:actionId/resume-async`. */ resumeAsync(params: AgentBuilderResumeRequest, runId: string): Promise; /** * Streams agent builder action progress in real-time. * This calls `/agent-builder/:actionId/stream`. */ stream(params: AgentBuilderActionRequest, runId: string): Promise>; /** * Observes an existing agent builder action run stream. * Replays cached execution from the beginning, then continues with live stream. * This is the recommended method for recovery after page refresh/hot reload. * This calls `/agent-builder/:actionId/observe` */ observeStream(params: { runId: string; }): Promise>; /** * Observes an existing agent builder action run stream using legacy streaming API. * Replays cached execution from the beginning, then continues with live stream. * This calls `/agent-builder/:actionId/observe-stream-legacy`. */ observeStreamLegacy(params: { runId: string; }): Promise>; /** * Resumes a suspended agent builder action and streams the results. * This calls `/agent-builder/:actionId/resume-stream`. */ resumeStream(params: AgentBuilderResumeRequest & { runId: string; }): Promise>; /** * Gets a specific action run by its ID. * This calls `/agent-builder/:actionId/runs/:runId`. * @param runId - The ID of the action run to retrieve * @param options - Optional configuration * @param options.fields - Optional array of fields to return (e.g., ['result', 'steps']). Available fields: result, error, payload, steps, activeStepsPath, serializedStepGraph. Metadata fields (runId, workflowName, resourceId, createdAt, updatedAt) and status are always included. * @param options.withNestedWorkflows - Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance when you don't need nested workflow details. * @returns Promise containing the action run details with metadata and processed execution state */ runById(runId: PathParams<'GET /agent-builder/:actionId/runs/:runId'>['runId'], options?: { /** SDK convenience serialized to the route's comma-separated `fields` query value. */ fields?: string[]; withNestedWorkflows?: boolean; }): Promise>; /** * Gets details about this agent builder action. * This calls `/agent-builder/:actionId`. */ details(): Promise>; /** * Gets all runs for this agent builder action. * This calls `/agent-builder/:actionId/runs`. */ runs(params?: ListWorkflowRunsParams): Promise; /** * Cancels an agent builder action run. * This calls `/agent-builder/:actionId/runs/:runId/cancel`. */ cancelRun(runId: PathParams<'POST /agent-builder/:actionId/runs/:runId/cancel'>['runId']): Promise>; } export {}; //# sourceMappingURL=agent-builder.d.ts.map