Skip to main content

Overview

The @enconvo/api SDK provides the full API surface for building EnConvo extensions. Extensions run as isolated Worker threads communicating with the native macOS app over a Unix Domain Socket using JSON-RPC.
All imports in this reference come from @enconvo/api unless otherwise noted. The SDK is linked locally from enconvo.nodejs/enconvo_api/ during development.

Commander API

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. This is the primary way to define what happens when a command is invoked.
The req parameter is a standard Request object. Use req.json() to access the merged command configuration and user-provided parameters.

Commander.send

Fire-and-forget message to the native macOS app. Returns a Promise that resolves when the host acknowledges.

Commander.sendRequest

Request/response communication with the native app. Returns a Promise resolved when the host sends back a matching response.

Commander.sendAsync

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

Request Object

When Commander.addClickListener fires, you receive 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.

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.

NativeAPI.request / NativeAPI.api

Call extension API routes (files in src/api/).

NativeAPI.localApi

Call the local HTTP server API endpoint directly.

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.

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.

res (Response Streaming)

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:

LLMProvider Base Class

The abstract base class for implementing LLM provider extensions.

LLMProvider.LLMOptions

Key options available on this.options:

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. Provider instances are cached by their options hash for reuse.

Extension & Command Management

Utilities for working with extension metadata and configuration.

NativeEventUtils

Send and listen for events across extensions and the native app.
Events sent through this system can be hooked by the user via ~/.config/enconvo/hooks.json.

Action

Response actions displayed as buttons below chat messages.

src/api/ Auto-Discovery

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/docs.md — Human-readable API documentation
  • skills/SKILL.md — Skill metadata for AI agent discovery

Command Entry Point Pattern

Standard Command

Provider Command

API Route

Building Extensions

Next Steps

Developing Extensions

Step-by-step guide to creating extensions

Built-in Extensions

Explore all available extensions

Skills

Package AI instructions as reusable skills

Hooks

React to extension events with hooks