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.
Registers the main entry point handler for a command. This is the primary way to define what happens when a command is invoked.
import { Commander } from "@enconvo/api";Commander.addClickListener(async (req: Request) => { const options = await req.json(); // Process the request return EnconvoResponse.text("Hello from my extension!");});
The req parameter is a standard Request object. Use req.json() to access the merged command configuration and user-provided parameters.
When Commander.addClickListener fires, you receive a standard Request. The body contains RequestOptions — a merged object of command configuration, user preferences, and runtime parameters.
Commander.addClickListener(async (req: Request) => { const options: RequestOptions = await req.json(); // Common fields options.input_text; // User input text options.commandType; // "agent" | "chat" | "tool" | "provider" | etc. options.commandName; // Current command name options.extensionName; // Current extension name options.messages; // Conversation history (for chat/agent) options.context; // Context data (screen, clipboard, browser) options.tools; // Available tools (for agent mode) options.system_prompt; // System prompt options.temperature; // LLM temperature options.max_tokens; // Max token limit // All preference values are accessible by their name options.my_custom_preference; // Value of preference named "my_custom_preference"});
Invoke any other extension command programmatically.
import { NativeAPI } from "@enconvo/api";// Call Gmail to send an emailconst result = await NativeAPI.callCommand("gmail|send_email", { to: "user@example.com", subject: "Hello", body: "Message content"});
Read and write clipboard content, paste into the active application, or insert text below the cursor.
import { Clipboard } from "@enconvo/api";// Copy text to clipboardawait Clipboard.copy("text to copy");// Paste text into the frontmost applicationawait Clipboard.paste("text to paste");// Insert text below the current cursor positionawait Clipboard.insertBelow("text below cursor");// Read current clipboard contentconst content = await Clipboard.read();
The environment object exposes runtime context about the current command execution.
import { environment } from "@enconvo/api";environment.extensionName; // Current extension nameenvironment.commandName; // Current command nameenvironment.commandTitle; // Display title of the commandenvironment.assetsPath; // Path to extension's assets/ directoryenvironment.supportPath; // Per-extension support directoryenvironment.rootSupportPath; // Root support directoryenvironment.cachePath; // Cache directoryenvironment.isDevelopment; // true if running in dev modeenvironment.appearance; // "light" | "dark"environment.textSize; // "medium" | "large"environment.chatConversationId; // Current conversation IDenvironment.chatSessionId; // Current session IDenvironment.enconvoVersion; // EnConvo app versionenvironment.runType; // "command" | "api" | "flow"environment.flowId; // Workflow ID (if running in a workflow)
Load and instantiate any provider extension dynamically.
import { ServiceProvider } from "@enconvo/api";// Load an LLM providerconst llm = ServiceProvider.load<LLMProvider>(options);// Load a TTS providerconst tts = ServiceProvider.load<TTSProvider>(options);
The options object must include extensionName and commandName identifying the provider to load. Provider instances are cached by their options hash for reuse.
Utilities for working with extension metadata and configuration.
import { CommandManageUtils, ExtensionManageUtils, PreferenceManageUtils } from "@enconvo/api";// Load a command's full configurationconst config = await CommandManageUtils.loadCommandConfig({ commandKey: "gmail|send_email", useAsRunParams: true});// Get raw command info (synchronous)const rawCmd = CommandManageUtils.getRawCommandInfo("llm|open_ai");
# Build for productionnpx enconvo build# Dev mode with hot reloadnpx enconvo build --dev# Generate API schemanpx enconvo generate-schema# Generate API docs + schemanpx enconvo generate-docs# Publish to storenpx enconvo publish