UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

52 lines 2.06 kB
import type { StepResult } from '../../workflows/types.js'; import type { StepExecutionParams, StepExecutionStrategy } from '../types.js'; /** * Auth credential used by `HttpRemoteStrategy` when calling the server's * step-execution endpoint. The server's configured Mastra auth provider * (`authenticateToken`) decides whether to accept the credential — this * strategy just forwards it. * * - `bearer`: send `Authorization: Bearer <token>` (default when only a * token string is available) * - `api-key`: send `x-worker-api-key: <key>` for deployments that prefer * a custom header (the auth provider's `authenticateToken(_, request)` * callback can read it from `request.headers`) * - `header`: arbitrary header / value pair for fully custom schemes */ export type HttpRemoteAuthConfig = { type: 'bearer'; token: string; } | { type: 'api-key'; key: string; } | { type: 'header'; name: string; value: string; }; /** * Executes workflow steps by calling a remote server endpoint over HTTP. * Used in standalone worker deployments where the worker runs orchestration * logic but delegates actual step execution to the server. * * Authentication piggy-backs on Mastra's existing auth pipeline: the route * is marked `requiresAuth: true` and the deployer's `authenticateToken` * provider validates the credential we send here. There is no separate * "worker secret" — whatever auth scheme the rest of the server uses is * what the worker uses too. */ export declare class HttpRemoteStrategy implements StepExecutionStrategy { #private; constructor({ serverUrl, auth, timeoutMs }: { serverUrl: string; auth?: HttpRemoteAuthConfig; timeoutMs?: number; }); executeStep(params: StepExecutionParams): Promise<StepResult<unknown, unknown, unknown, unknown>>; } export declare class StepExecutionError extends Error { readonly status: number; readonly body: string; constructor(status: number, body: string); } //# sourceMappingURL=http-remote-strategy.d.ts.map