Files
mesh-sdk/go/README.md
T
jochen ec80dcfc22 0.1.13: one rule for taking an event, and no handler left by a refused subscribe (hq issue 276)
A handler takes an event by returning and asks for it again by throwing;
any mesh/event answer but an error is taken. Written down in the README
where event handling is, with what follows for a handler: throw only when
the work was not done, and be safe to run twice.

Both SDKs added the handler before asking the runtime and kept it when the
runtime refused, so a module that asks again until it is taken (every Go
consumer does) ran its handler once per attempt for every event. A refused
subscribe now removes its handler; one the Go runtime did not answer in
time is kept, since the runtime may have bound it.
2026-10-06 18:14:58 +02:00

1.2 KiB

mesh-sdk for Go

stdio.Serve("", tools) speaks MCP over stdio to the node's tool runtime, as the module the runtime names (novox/hq ADR 0188, ADR 0193). A Tool is a name, a description, an argument schema and a function; calls run concurrently. A tool named <seat>.<verb> is the seat's implementation. stdio.Emit(type, body) publishes an event as the module, stdio.Subscribe(pattern, handler) receives the module's events (taken when the handler returns nil, offered again when it returns an error — the one rule is in the repository README, "Taking an event") and stdio.Ask(key, body) calls a tool, and stdio.State(name) gets, puts, deletes, lists and watches the module's declared state — all through the runtime (novox/hq ADR 0193, 0198, 0201). Standard library only.

Installing

GOPRIVATE=git.novox.be go get git.novox.be/novox/mesh-sdk/go@latest

Releases are tagged go/vX.Y.Z in this repository, the subdirectory form Go's module system expects, at the same version as the TypeScript package.

What it holds, under ADR 0039's test: the stdio loop and the tool type. Nothing else — no bus, no client, nothing of any module's. go build ./example and pipe a tools/list request into it.