@mastractl/shared

v0.10.0

Published

Shared error primitives and utilities for the mastractl SDK.

Readme

@mastractl/shared

Shared error primitives and utilities for the mastractl SDK.

⚠ Alpha — API surface may change between 0.7.x releases.

Install

npm install @mastractl/shared

What's in here

  • AppError — typed error class with id, domain, status, and details. Used consistently across the REST API; import it to match on specific error IDs in client code.

Usage

import { AppError } from "@mastractl/shared";

try {
  await mastractl.agents.heartbeat("my-agent", { userMessage: "hello" });
} catch (err) {
  if (err instanceof AppError && err.id === "AGENT_BUDGET_EXCEEDED") {
    console.log("budget capped — top up monthly spend limit");
  }
}

Part of the mastractl SDK

| Package | Purpose | |---|---| | @mastractl/shared | Error primitives (this package) | | @mastractl/agent | AgentSpec types + BYO Mastra Agent adapter | | @mastractl/client | Typed REST client |

Requires a running mastractl server.