Hecate Plugin SDK

View Source

The contract between the Hecate daemon and plugins.

Plugins are OTP applications that load into the daemon VM. The SDK provides:

  • Platform dependencies — pinned versions, one {hecate_sdk, "~> 0.5"} dep
  • Plugin behaviourhecate_plugin callbacks the daemon calls
  • Observability — structured JSON logging, metrics, health reporting (auto-wired)
  • Helpers — paths, store setup, cowboy routes, WebSocket, validation, scheduling, rate limiting, file I/O

Quick Start

%% rebar.config
{deps, [
    {hecate_sdk, "~> 0.5"}
]}.

Implement the hecate_plugin behaviour:

-module(my_plugin).
-behaviour(hecate_plugin).
-include_lib("hecate_sdk/include/hecate_plugin.hrl").

-export([init/1, routes/0, store_config/0, static_dir/0, manifest/0]).

init(_Config) ->
    {ok, #{}}.

routes() ->
    [{"/items", my_plugin_items_api, []},
     {"/items/:id", my_plugin_item_api, []}].

store_config() ->
    #hecate_store_config{
        store_id = my_items_store,
        dir_name = "items",
        description = "My plugin items store"
    }.

static_dir() ->
    code:priv_dir(my_plugin) ++ "/static".

manifest() ->
    #{
        name => <<"my-plugin">>,
        version => <<"0.1.0">>,
        min_sdk_version => <<"0.1.0">>,
        description => <<"My awesome plugin">>,
        native_capabilities => #{
            notifications => true
        }
    }.

What You Get

Platform Dependencies (all come transitively)

ConcernLibrary
Event Sourcingevoq
Event Storereckon_db + reckon_gater + reckon_evoq
HTTP/WebSocketcowboy
Read Modelsesqlite (SQLite)
Meshmacula
HTTP Clienthackney
Timeqdate
AI/MLfaber_tweann + faber_neuroevolution
Protobufgpb (optional)

Plus OTP builtins: json, ets, pg, logger, crypto, calendar, mnesia.

SDK Helpers

ModulePurpose
hecate_pluginBehaviour definition
hecate_plugin_metricsCounters + gauges (lock-free)
hecate_plugin_telemetryAuto-attach to evoq/reckon-db events
hecate_plugin_loggerJSON log formatter for OTP logger
hecate_plugin_pathsStandard directory layout
hecate_plugin_storeReckonDB store creation + dispatch
hecate_plugin_cowboyRoute prefixing + static serving
hecate_plugin_wsWebSocket upgrade + JSON framing
hecate_plugin_validateInput validation rules
hecate_plugin_schedulerCron-like recurring tasks
hecate_plugin_ratelimitToken bucket rate limiter
hecate_plugin_filesUpload/download helpers
hecate_plugin_apiJSON request/response utilities for Cowboy handlers
hecate_plugin_routesRoute discovery from OTP app metadata
hecate_plugin_llmCapability-based LLM model selection
hecate_plugin_codegenCode generation for plugin scaffolding (plugin, division, desk, integration)

Frontend

Plugin frontends are static assets (HTML/JS/CSS) served by the daemon at /plugin/{name}/. Build with any framework (SvelteKit, React, plain HTML) — just output to priv/static/.

Your frontend talks to the backend via:

  • REST: fetch('/plugin/{name}/api/...')
  • WebSocket: new WebSocket('ws://localhost:4444/plugin/{name}/ws')

For native OS access (file pickers, notifications, clipboard), use the Tauri bridge:

window.__hecate_bridge.request({ action: 'file-picker', options: {} })

License

Apache-2.0