mirror of
https://github.com/hanzoai/compute.git
synced 2026-10-30 14:50:41 +00:00
Four routes spelled one resource three ways: POST .../bind-agent to create, GET and DELETE .../agent-binding to read and remove, GET /v1/agent-bindings to list. A caller had to learn that create lived at a different path from its own read, and every projection published three names for one thing. A machine hosts at most one agent, so it is a to-one sub-resource — singular at the member, plural at the collection, the method carrying the verb: PUT /v1/machines/:id/agent bind (idempotent, so PUT) GET /v1/machines/:id/agent read, reconciled; 404 when unbound DELETE /v1/machines/:id/agent unbind; 204, the machine stays GET /v1/machines/agents the caller org's bindings That is the address hanzoai/cloud already publishes to its own callers, so the translation it was keeping in bots.go disappears rather than moving. All four are TYPED ops. Only a typed op is in the registry that OpenAPI, MCP, the CLI and the by-name call plane read; an untyped route is invisible to every one of them. Typing them drops the casibase envelope with it — the answer IS the value and the status IS the outcome — which is a wire break, so it lands with its cloud caller in the same change. An op declares the identity it reads: header:"Authorization" and url:"owner" on the embedded caller, because a typed handler is given a context and no request to reach into. principal() is now the ONE rule turning those two into an org, and resolveComputeOrg calls it instead of restating it. Not landed, and worth saying: the comment claiming a literal must be registered ahead of its :param sibling is folklore. Moving registerAgent below the :id routes leaves /v1/machines/agents still reaching ListAgents — fiber prefers the static segment whatever the order. The test pins the outcome instead. Co-authored-by: Hanzo Dev <[email protected]>