@moxxy/sdk is the typed public surface of the framework. It has zero internal dependencies (only zod as a peer). Everything plugin authors need to write, type, and validate comes from here.
What's exported
Define* factories
definePlugin(spec)— bundles tools, providers, modes, compactors, hooksdefineTool({name, description, inputSchema, handler, ...})— one tooldefineProvider({name, models, createClient})— an LLM backenddefineMode({name, run})— a turn topologydefineCompactor({name, shouldCompact, compact})— context-window managementdefinePermission(rule)— declarative allow/deny/prompt ruledefineSkill({frontmatter, body})— programmatic skill (Markdown remains canonical)
Event types
MoxxyEvent discriminated union covers every appended event: user_prompt, assistant_chunk, assistant_message, tool_call_requested, tool_call_approved, tool_call_denied, tool_result, skill_invoked, skill_created, plugin_registered, plugin_unregistered, mode_iteration, compaction, provider_request, provider_response, error, abort, plugin_event.
Interfaces
LLMProvider— provider implementationsModeContext,ModeDef— modesChannel,ChannelHandle— frontends (TUI, Telegram, …)EmbeddingProvider— vector embedders (for memory recall)PermissionResolver,PermissionRule,PermissionDecisionEventLogReader— read-only event logToolContext,ToolDef,ToolCompactPresentation— tool authoringLifecycleHooks,HookDispatcher— hook contract
Re-exports
z— re-exported fromzodso plugin authors don't need to install it- Branded ID types:
EventId,TurnId,ToolCallId,SessionId,PluginId,SkillId skillFrontmatterSchema,pluginManifestSchema— pre-built zod schemas
Compact tool presentation (opt-in)
ToolDef.compact is an optional hint channels MAY use to aggregate consecutive calls of a tool into a single "live block" in chat-like surfaces (e.g. the TUI's Ctrl+O expand mechanism):
defineTool({
name: 'Read',
description: '…',
inputSchema: z.object({ file_path: z.string(), … }),
permission: { action: 'prompt' },
compact: {
verb: 'Reading',
noun: { one: 'file', other: 'files' },
previewKey: 'file_path', // optional — which input field to show as preview
},
handler: async ({ file_path }) => { … },
});A run of compact calls produces summaries like Reading 3 files, searching for 1 pattern…. Tools without compact always render as their own block. Bash, dispatch_agent, and MCP tools intentionally omit it — their output matters per-call.
The hint is purely presentational. The event log, providers, and permission engine see no difference between compact and verbose tools.
Stability
Treat this package as a stable contract. Additive changes are minor versions; removing or renaming an export is a major. The dependency-cruiser CI check enforces that @moxxy/sdk never imports from sibling workspace packages.
