Primary finding
register-agent parses response under data.{id, apiKey} but spec/docs say top-level { id, apiKey }
- src/commands/register-agent.ts:24-26
- src/commands/register-agent.ts:38-46
- src/commands/register-agent.ts:109-121
The code explicitly expects the API to return { id, apiKey } at the top level (comment), and the README also documents that. However, the implementation only reads body.data.id/apiKey. If the platform returns the documented top-level shape, body.data will be undefined and the command will incorrectly throw PLATFORM_API_INVALID_RESPONSE on a successful 200 response.
Recommendation
Make the parser accept the documented top-level shape. E.g., after parsing body, derive id/apiKey as (body as any).id || body?.data?.id and (body as any).apiKey || body?.data?.apiKey. Update RegisterResponse accordingly and keep the comment consistent with the actual API. Optionally log a deprecation notice if a legacy wrapped shape is detected.