Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.57 KB

File metadata and controls

64 lines (48 loc) · 2.57 KB

nwc for Hermes — dev context

This is the Hermes Agent build of nostrwalletconnect. Sibling repo: ~/development/nwc.app.OC-python.src (the OpenClaw build, which publishes pip install nostrwalletconnect).

What this repo is

A Hermes plugin (per the plugins/ shape: plugin.yaml + __init__.py with register(ctx) + tools.py with handlers) exposing the nostrwalletconnect SDK as five async agent tools.

Why two vendored libs

NWC depends on nostrkey for signing/encryption. Both vendored at the repo root so the plugin is self-contained. Yes, this duplicates nostrkey across the nostrkey and nwc HA plugins on disk — accepted tradeoff for drop-in installability. Same source under both, so they stay in sync as long as we copy from the OC repos.

Layout

nwc.app.HA-python.src/
├── plugin.yaml              # Hermes manifest — kind: backend, async tools, requires NWC_URI
├── __init__.py              # register(ctx) — sys.path shim then ctx.register_tool(... is_async=True)
├── tools.py                 # 5 async handlers, all (args, **kw) -> str
├── after-install.md         # Setup instructions including wallet URI sources
├── nostrwalletconnect/      # Vendored core (mirror of OC src/nostrwalletconnect/)
├── nostrkey/                # Vendored crypto core (NWC dependency)
├── README.md
├── LICENSE
└── CLAUDE.md                # This file

Async tool dispatch

All five tools are registered with is_async=True. Hermes's dispatcher auto-bridges them via _run_async() from model_tools.py. Handlers are declared async def handle_nwc_X(args, **kw).

NWC_URI handling

The wallet URI carries a delegated signing secret and is sensitive. We read it from os.environ["NWC_URI"] at every dispatch — never accept it as a tool argument, so it never enters the LLM context. The plugin manifest declares requires_env: [NWC_URI] so Hermes prompts the operator on first install if it's missing.

A future v0.2 could persist the URI encrypted on disk under a passphrase (like nostrkey's identity file), letting the operator unlock per-session without env vars in .bashrc. Out of scope for v0.1.

Handler kwargs convention

Handlers accept (args, **kw) per the in-tree convention. The dispatcher tolerance fix (PR #1 on HumanjavaEnterprises/hermes-agent, commit dcc43ef6) means def handler(args) would also work, but match the bundled-plugin style.

Page

User-facing landing page at https://loginwithnostr.com/hermes. Source to be added at ~/development/loginwithnostr.web.landingpage.src/docs/hermes/.