walletpress/backend/adapters/eliza.py
cryptorugmunch e13bd4d774
Some checks are pending
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
CI / security (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / license (push) Waiting to run
CI / ai-review (push) Waiting to run
docs: apply fleet-template (16-artifact scaffold)
Adds missing standard artifacts:
- README.md (if missing)
- AGENTS.md (AI agent contract)
- PLAN.md (current sprint)
- STATUS.md (where we are)
- DEVELOPMENT.md (dev workflow)
- DEPLOYMENT.md (deploy procedure)
- TESTING.md (test strategy)
- DECISIONS.md (ADR index + templates)
- .github/CODEOWNERS
- .github/workflows/ci.yml

Preserves all existing artifacts.

Refs: RugMunchMedia/fleet-template
2026-07-02 02:07:06 +07:00

28 lines
1.1 KiB
Python

"""Eliza OS Adapter (plugin) — Use WalletPress tools from Eliza agents."""
from __future__ import annotations
# Eliza plugins import via: https://github.com/elizaos/eliza/tree/main/packages/plugin-goat
# This adapter provides the Eliza-compatible tool format for WalletPress.
def get_actions() -> list[dict]:
"""Get MCP tools as Eliza action format."""
from agent.mcp_server import mcp
actions = []
for t in mcp._tool_manager.list_tools():
actions.append({
"name": t.name,
"description": t.description or t.name,
"similes": [t.name.replace("_", " ")],
"supports_async": True,
"handler": lambda params, tool=t: _handle(tool.name, params),
})
return actions
def _handle(tool_name: str, params: dict) -> dict:
import asyncio
from agent.mcp_server import mcp
for t in mcp._tool_manager.list_tools():
if t.name == tool_name:
if asyncio.iscoroutinefunction(t.fn):
return asyncio.run(t.fn(**params))
return t.fn(**params)
return {"error": f"Tool {tool_name} not found"}