Documentation
¶
Overview ¶
Package accelclient calls an accelerator's HTTP sidecar over loopback — the Hailo-8L's (server/http_server.py in the Hailo repo) and the Coral Edge TPU's (accelerators/coral/server.py here), which speak one wire contract. It is the harness's accelerator lane (ADR 0024): LOCAL and free like llama-swap, never cloud — but a separate device with its own process, so it gets its own client rather than riding the OpenAI shape. Mirrors nimclient: pure net/http, no SDK, a result is a map the caller shapes.
It was `hailoclient` until the second device arrived (Coral design D2): the package held nothing Hailo-specific but its name and error strings, so it was renamed and given a Device label rather than copied into a second package that would diverge from day one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoSidecarCmd = errors.New("sidecar not running and no launcher configured (hailo_sidecar_cmd / coral_sidecar_cmd / rknpu_sidecar_cmd)")
ErrNoSidecarCmd: the sidecar is down and this box has no way to start it (no <device>_sidecar_cmd configured). One sentinel for every device — callers compare identity, and the device is on the wrapping error's prefix.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client targets one sidecar base (scheme://host:port, no path) for one device.
func New ¶
New builds a Hailo-8L client — the original constructor, kept so the Hailo path and its tests are unchanged. timeout bounds ONE call including a cold HEF load.
func NewDevice ¶
NewDevice builds a client for the named accelerator (an id from config.Accelerators, e.g. "hailo-8l", "coral-edgetpu"). The label is carried on every error so a defer reads "<device>: ..." whichever lane produced it.
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, tool string, args map[string]any) (map[string]any, error)
Call POSTs args to /v1/<tool> and returns the tool's dict. A 200 carrying {"error":true,...} is a STRUCTURED RESULT (the tool refused the input), so it comes back as the map with a nil error — the MCP handler passes it through verbatim. Only transport failures and non-200 statuses are errors.
type Sidecar ¶
type Sidecar struct {
// contains filtered or unexported fields
}
Sidecar starts the HTTP sidecar ON DEMAND (operator decision 2026-08-22: no scheduler, no always-on service — the sidecar self-exits idle, the harness brings it back when needed). Ensure is the single entry point every NPU tool calls first; concurrent callers share one spawn.
func NewSidecar ¶
NewSidecar wires a client to a spawn function (nil = cannot spawn).