Skip to main content
This reference is for plugin developers who already have a project from Developing Extensions and need the exact SDK call for a job: reading the request, answering in chat, streaming, calling other commands, using the clipboard, storing data, or building a provider. Each command runs in its own Worker thread inside Enconvo’s Node.js runtime. The runtime talks to the Mac app over a local Unix domain socket, with JSON-RPC-style messages; the SDK wraps all of it.
All imports in this reference come from @enconvo/api unless otherwise noted.

Entry points

A plugin file exports one default function. What it takes and returns depends on what the file is.

Standard command

Provider command

See Providers and AI Model and Voice Plugins.

API route

API routes

Files placed in src/api/ are automatically discovered and registered as API routes during build. No package.json entry is needed.

Single file route

Directory route

JSDoc annotations

Generated files

The build system generates:
  • skills/schemas.json — JSON schema for all API endpoints
  • skills/<plugin name>/SKILL.md — when the file exists, the build updates its front matter and its table of API routes, for AI agent discovery

Requests and responses

Request object

A command receives a standard Request. The body contains RequestOptions — a merged object of command configuration, user preferences, and runtime parameters.

EnconvoResponse

The return type for command handlers. Multiple factory methods create different response types.

EnconvoResponse.text

Returns a simple text response displayed as a chat message.

EnconvoResponse.messages

Returns one or more structured chat messages with rich content.

EnconvoResponse.json

Returns a JSON object as a text response (serialized).

EnconvoResponse.none

Returns nothing — useful for commands that produce side effects only.

EnconvoResponse.error

Returns an error message displayed to the user.

Returning a string

You can also return a plain string, which is automatically wrapped as a text response.

Action

Response actions displayed as buttons below chat messages. Pass them as the second argument of EnconvoResponse.messages.
Enconvo adds a Retry button (Action.Retry) to every response that has actions, so don’t add one yourself.

Streaming with res

The res namespace provides methods for streaming partial results back to the UI during command execution.

res.write

Stream content incrementally to the chat UI.

res.writeLoading

Display a loading indicator in the chat UI.

Write actions

Control how streamed content updates the UI: EnconvoResponse.WriteAction has more members for thinking text, tool messages and workflows; your editor lists them all.

Talk to Enconvo and other plugins

Commander

The Commander namespace handles all communication between extension Worker threads and the Enconvo host process.

Commander.addClickListener

Registers the main entry point handler for a command. The build/runtime adapter uses this registration mechanism. For ordinary plugin command files, use the default-exported handler shown in Entry points, rather than registering the same handler twice.
The req parameter is a standard Request object. Use req.json() to access the merged command configuration and user-provided parameters.

Commander.send

Send a request to the native macOS app. Returns a Promise for the matching response. Use sendAsync only when the operation does not need a result.

Commander.sendRequest

Request/response communication with the native app. Returns a Promise resolved when the host sends back a matching response.
extensionName and commandName default to the current command’s. To read the selection, Clipboard.selectedText() does this for you.

Commander.sendAsync

Non-blocking fire-and-forget message. Does not wait for acknowledgment.

NativeAPI

The NativeAPI namespace provides typed methods for calling native macOS operations and invoking other extension commands.

NativeAPI.callCommand

Invoke any other extension command programmatically, by its key extensionName|commandName.

NativeAPI.request / NativeAPI.api

Call extension API routes (files in src/api/). request is another name for api.

NativeAPI.localApi

Call the local HTTP server API endpoint directly. It returns the HTTP response, so read its body with .json().

NativeEventUtils

Send and listen for events across extensions and the native app.
NativeEventUtils.registerEvent(name, callback) listens for one. Events sent through this system can be hooked by the user via ~/.enconvo/hooks.json (see Hooks).

Mac and app helpers

Clipboard

Read and write clipboard content, paste into the active application, or insert text below the cursor.

Toast & HUD

Display notifications and heads-up messages.

SmartBar & window

Control the SmartBar and window display modes.

environment

The environment object exposes runtime context about the current command execution.

KV (key-value storage)

Persistent key-value storage for extension data. Values persist across command invocations.
KV.getBool takes no default, so set a value before you read it.

Stream

The Stream class provides utilities for working with streaming responses, particularly SSE (Server-Sent Events) from LLM APIs.

Stream.fromSSEResponse

Parse an SSE response into an async iterable of typed objects.

Stream.fromReadableStream

Parse a newline-delimited JSON ReadableStream into typed objects.

Stream.tee

Split a stream into two independent streams that can be read at different speeds.

Stream.toReadableStream

Convert back to a ReadableStream of newline-delimited JSON.

Providers

AI Model and Voice Plugins builds a complete provider plugin step by step. The classes it uses:

LLMProvider base class

The abstract base class for implementing LLM provider extensions. _stream yields Enconvo’s content-block events, not your API’s raw chunks.

LLMProvider.LLMOptions

Key options available on this.options: The conversation (messages), the tools for function calling (tools, as AITool[]), maxTokens and the abort signal arrive with each call in params.

TTSProvider base class

The abstract base class for implementing TTS provider extensions.

ServiceProvider.load

Load and instantiate any provider extension dynamically.
The options object must include extensionName and commandName identifying the provider to load (or a commandKey such as llm|open_ai). Provider instances are cached by their options for reuse, and loaded again when the provider’s code changes.

Extension and command management

Utilities for working with extension metadata and configuration.

Build commands

Next steps

Developing Extensions

Step-by-step guide to creating extensions

AI Model and Voice Plugins

Add your own model or voice to Enconvo’s pickers

Skills

Package AI instructions as reusable skills

Hooks

React to extension events with hooks