Skip to content

wire

Wire-format contract for @dbx-tools/appkit-mastra: the dependency-free zod schemas + inferred types every consumer (the React client, browser bundles, the server plugin) shares.

Kept free of pg, fastembed, and the Mastra runtime so the client can import these schemas without dragging in server-only dependencies. Three layers live here:

  1. The descriptor published by MastraPlugin.clientConfig() plus the REST payloads its routes return (models, history, suggestions, chart embeds, statement data). The server derives every path from the plugin mount and publishes the resolved paths so the client composes URLs without hard-coding /api/mastra - rename the plugin and the client keeps working.
  2. The ctx.writer event vocabulary: the wire-derived GenieChatEvents from @dbx-tools/genie-shared plus the Mastra-only agent lifecycle events, unified as GenieWriterEvent so subscribers narrow both halves with a single switch (event.type).
  3. The Genie agent’s workflow output shapes (GenieAgentResult and its summary / dataset items).

The route segments live in the sibling routes.ts (MASTRA_ROUTES) and the embed-marker grammar in marker.ts, so this file stays purely declarative (schemas + inferred types). The browser client that drives these routes (MastraPluginClient) ships from @dbx-tools/ui-mastra.