donkey / docs /reference /README.md
manelmoura's picture
Sync from manelsen/donkey via hub-sync
60402f0 verified
|
Raw History Blame Contribute Delete
2.98 kB

API Reference

Complete documentation for all public APIs

Overview

This reference documents all public APIs in Donkey. Types and functions marked with * are exported.

Core Modules

Ports (Interfaces)

Module Description
hook Hook system interface
channel Channel abstraction
provider LLM provider interface
memory Memory system interface
tool Tool abstraction

Core

Module Description
types Core types (UserId, SessionId...)
session Session management
orchestrator Message orchestration

Domain

Module Description
message Message types
agent_message Internal agent messages
subagents Subagent policy, budgets and runtime

Commands

Module Description
command_routing Command parsing and routing
command_catalog Command metadata catalog

Adapters

Channel Adapters

Adapter File Description
Telegram adapters/channel/telegram.nim Telegram Bot API
Discord adapters/channel/discord.nim Discord WebSocket
Slack adapters/channel/slack.nim Slack API

Provider Adapters

Adapter File Description
Anthropic adapters/provider/anthropic.nim Claude API
OpenAI adapters/provider/openai.nim GPT API
OpenRouter adapters/provider/openrouter.nim Multi-provider
Gemini adapters/provider/gemini.nim Google AI

Memory Adapters

Adapter File Description
MdFile adapters/memory/md_file.nim Markdown files
SQLite MAGMA adapters/memory/sqlite_magma_store.nim Default SQLite-first graph storage
Postgres adapters/memory/postgres.nim Optional PostgreSQL-backed MAGMA

Configuration

Document Description
Configuration Complete donkey.toml reference
Types Configuration types

Examples

Creating a Hook

import donkey/ports/hook

proc myHook*(ctx: HookContext): HookResult =
  # Process context
  var modified = ctx
  modified.metadata["processed"] = "true"
  newHookResultContinue(modified)

# Register hook
let definition = HookDefinition(
  name: "my_hook",
  phase: hpPreLlm,
  handler: myHook
)
executor.registerHook(definition)

Using Memory

import donkey/adapters/memory/md_file

let memory = newMdFileAdapter("~/.donkey/paddocks")
let userDoc = memory.readUserDoc(userId, "MEMORY.md")

Configuration Loading

import donkey/config/loader

let config = loadConfig("~/.config/donkey/donkey.toml").get()