Skip to content
Night Owls.dev
Jump to a page

@nightowlsdev/engine-mastra

EngineNative

The default engine as a named package, a mastraEngine() factory + MastraEngine re-export; installing it changes imports, not behavior.

What it does

@nightowlsdev/engine-mastra is the default Mastra engine, re-exported under its own family name so `defineSwarm({ engine })` has an explicit factory to install even though the built-in default is identical. `mastraEngine()` returns `(opts) => new SwarmEngine(opts)`, the SAME engine `defineSwarm` constructs when `engine` is omitted, so installing this package changes only imports, never behavior. It re-exports `MastraEngine` (== `SwarmEngine`), the `Engine` / `EngineCapabilities` / `AssembledEngineOpts` types, and `MASTRA_ENGINE_CAPABILITIES`, the machine-readable descriptor every consumer (react's affordance gating, the runner boot guards) reads to know what this engine supports (full delegation, durable resume, the rich read surface). It also ships a `nightOwlsPlugin` manifest so `owl install engine-mastra` wires `defineSwarm({ engine: mastraEngine() })` into the config template. Today the loop still physically lives in `@nightowlsdev/core` (this is a v0 re-export facade, the loop + its Mastra-backed storage move here as one coordinated wave at core@1.0; see `docs/strategy/2026-07-03-pluggable-engine-architecture.md`).

Install

pnpm add @nightowlsdev/engine-mastra

Key exports

  • mastraEngine
  • MastraEngine (re-export of SwarmEngine)
  • MASTRA_ENGINE_CAPABILITIES
  • types: Engine, EngineCapabilities, AssembledEngineOpts
  • nightOwlsPlugin

Usage

engine-mastra.ts
import { defineSwarm } from "@nightowlsdev/core";
import { mastraEngine, MASTRA_ENGINE_CAPABILITIES } from "@nightowlsdev/engine-mastra";

// Explicit and byte-identical to omitting `engine`, installing this package
// changes imports, not behavior; defineSwarm builds the same engine either way.
const swarm = defineSwarm({ agents, engine: mastraEngine() });

// Every engine exposes a capabilities descriptor, @nightowlsdev/react reads the
// live one via useEngineCapabilities() to gate affordances (e.g. hide Stop when
// cancellation isn't supported); this is the one this engine reports.
console.log(MASTRA_ENGINE_CAPABILITIES.kind); // "native"