UNPKG

@mastra/core

Version:
40 lines 2.1 kB
import { Agent } from '../agent/index.js'; import { Workspace } from '../workspace/workspace.js'; import { AgentController } from './agent-controller.js'; import type { Session } from './session.js'; import type { AgentControllerConfig } from './types.js'; /** * Create a minimal Workspace instance for testing. * Uses a skills-only config so init() is a no-op (no fs/sandbox/search engine). */ export declare function createMockWorkspace(name?: string): Workspace; /** * Shared test helpers for the AgentController/Session suites. * * Every controller test needs the same boilerplate: an Agent, a default mode, a * storage backend, then `init()` + `createSession()`. These helpers collapse * that into a single call so individual tests only specify what they actually * care about (storage, subagents, omConfig, initialState, a custom agent, ...). */ export declare function createTestAgent(overrides?: Partial<ConstructorParameters<typeof Agent>[0]>): Agent<any, any, any, any>; export type TestControllerConfig<TState = {}> = Partial<AgentControllerConfig<TState>> & { /** Backing agent for the default mode. Ignored if `modes` is provided. */ agent?: Agent<any, any, any, any>; }; /** * Construct an AgentController wired with a single default mode and an in-memory store. * Any field in {@link AgentControllerConfig} can be overridden; pass `agent` to swap the * backing agent of the auto-generated default mode, or `modes` to take over the * mode list entirely. */ export declare function createTestController<TState = {}>(config?: TestControllerConfig<TState>): AgentController<TState>; /** * Construct an AgentController, bring up its shared resources, and mint a single Session * — the standard entry point for controller tests after the multi-session refactor. * Returns both so tests can reach controller-level machinery and the session. */ export declare function createTestSession<TState = {}>(config?: TestControllerConfig<TState>): Promise<{ controller: AgentController<TState>; session: Session<TState>; }>; //# sourceMappingURL=test-utils.d.ts.map