{"openapi":"3.1.0","info":{"title":"Emercoin Agent Gateway (edge)","version":"0.0.1"},"paths":{"/":{"get":{"summary":"Root","description":"Aggregated machine-readable state for agents: node + wallet (via adapter)\nand edge infra (redis). Never 500s — each component is probed independently.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Root  Get"}}}}}}},"/healthz":{"get":{"summary":"Healthz","operationId":"healthz_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Healthz Healthz Get"}}}}}}},"/stats/mcp":{"get":{"summary":"Mcp Stats","description":"Public aggregate usage of the remote MCP server (no per-user identities).","operationId":"mcp_stats_stats_mcp_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Mcp Stats Stats Mcp Get"}}}}}}},"/info":{"get":{"summary":"Info","operationId":"info_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Info Info Get"}}}}}}},"/status":{"get":{"summary":"Status","description":"Node sync status — while syncing, `synced` is false and progress < 1.","operationId":"status_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Status Status Get"}}}}}}},"/auth/login":{"post":{"summary":"Login","description":"Dev/CI bootstrap: caller already holds a GitHub token. Disabled in prod\n(use the device flow); gated behind EDGE_DEV_LOGIN_ENABLED.","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github/device/start":{"post":{"summary":"Github Device Start","description":"Begin GitHub device-flow login. Returns a code the user types at GitHub.","operationId":"github_device_start_auth_github_device_start_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceStartResponse"}}}}}}},"/auth/github/device/poll":{"post":{"summary":"Github Device Poll","description":"Poll for completion. 200 + token once authorized; 202 while pending.","operationId":"github_device_poll_auth_github_device_poll_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevicePollRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github/start":{"get":{"summary":"Github Web Start","description":"Redirect the browser to GitHub's consent screen (web flow).","operationId":"github_web_start_auth_github_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/github/callback":{"get":{"summary":"Github Web Callback","description":"GitHub redirects the browser here with ?code&state. Shared by two flows:\nthe MCP OAuth flow (state owned by the MCP provider → hand back to the client)\nand the browser web-login flow (render a branded result page).","operationId":"github_web_callback_auth_github_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/challenge":{"post":{"summary":"Auth Challenge","operationId":"auth_challenge_auth_challenge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChallengeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChallengeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/agent-login":{"post":{"summary":"Agent Login","description":"Machine-speed login: agent signs the challenge nonce with its address key.\n\nSignature is verified by the node (`verifymessage` via the adapter); the\naddress must match the one bound to this GitHub identity on-chain.","operationId":"agent_login_auth_agent_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me":{"get":{"summary":"Me","operationId":"me_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Principal"}}}}},"security":[{"HTTPBearer":[]}]}},"/nvs/identity":{"post":{"summary":"Create Identity","operationId":"create_identity_nvs_identity_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/nvs/mem":{"post":{"summary":"Create Mem","operationId":"create_mem_nvs_mem_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/nvs/mem/batch":{"post":{"summary":"Create Mem Batch","description":"Atomically store many memory records in one transaction (name_updatemany).","operationId":"create_mem_batch_nvs_mem_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemBatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchWriteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/history/{name}":{"get":{"summary":"Name History","description":"Value history of an NVS name (name_history).","operationId":"name_history_history__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Name History History  Name  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/addresses/{address}/names":{"get":{"summary":"Address Names","description":"All names owned by an address (name_scan_address) — basis for record export.","operationId":"address_names_addresses__address__names_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Address Names Addresses  Address  Names Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/nvs/{name}":{"get":{"summary":"Read Nvs","description":"Read an NVS record (confirmed from the name DB, or `pending` from mempool).","operationId":"read_nvs_nvs__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Nvs Nvs  Name  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AgentLoginRequest":{"properties":{"github_id":{"type":"integer","title":"Github Id"},"address":{"type":"string","title":"Address"},"signature":{"type":"string","title":"Signature","description":"signmessage(address, nonce) from the challenge"}},"type":"object","required":["github_id","address","signature"],"title":"AgentLoginRequest"},"BatchWriteResponse":{"properties":{"txid":{"title":"Txid"},"count":{"type":"integer","title":"Count"},"names":{"items":{"type":"string"},"type":"array","title":"Names"}},"type":"object","required":["txid","count","names"],"title":"BatchWriteResponse"},"ChallengeRequest":{"properties":{"github_id":{"type":"integer","title":"Github Id"}},"type":"object","required":["github_id"],"title":"ChallengeRequest"},"ChallengeResponse":{"properties":{"github_id":{"type":"integer","title":"Github Id"},"nonce":{"type":"string","title":"Nonce","description":"Sign this exact string with the agent's address key"}},"type":"object","required":["github_id","nonce"],"title":"ChallengeResponse"},"DevicePollRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_id"],"title":"DevicePollRequest"},"DeviceStartResponse":{"properties":{"user_code":{"type":"string","title":"User Code","description":"Show this to the user to type at verification_uri"},"verification_uri":{"type":"string","title":"Verification Uri"},"verification_uri_complete":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verification Uri Complete"},"session_id":{"type":"string","title":"Session Id","description":"Poll /auth/github/device/poll with this"},"interval":{"type":"integer","title":"Interval","description":"Seconds to wait between polls"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["user_code","verification_uri","session_id","interval","expires_in"],"title":"DeviceStartResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IdentityRequest":{"properties":{"address":{"type":"string","title":"Address","description":"Agent's Emercoin address; the anchor for signature login"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","default":{}}},"type":"object","required":["address"],"title":"IdentityRequest"},"LoginRequest":{"properties":{"github_token":{"type":"string","title":"Github Token","description":"A GitHub token; resolved to a user via the API"}},"type":"object","required":["github_token"],"title":"LoginRequest"},"MemBatchRequest":{"properties":{"records":{"items":{"$ref":"#/components/schemas/MemRequest"},"type":"array","maxItems":100,"minItems":1,"title":"Records"}},"type":"object","required":["records"],"title":"MemBatchRequest"},"MemRequest":{"properties":{"content_hash":{"type":"string","title":"Content Hash","description":"Hash of the research/memory artifact (body stored off-chain)"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","default":{}}},"type":"object","required":["content_hash"],"title":"MemRequest"},"Principal":{"properties":{"github_id":{"type":"integer","title":"Github Id"},"github_login":{"type":"string","title":"Github Login"},"tariff":{"type":"string","title":"Tariff"}},"type":"object","required":["github_id","github_login","tariff"],"title":"Principal"},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"github_id":{"type":"integer","title":"Github Id"},"github_login":{"type":"string","title":"Github Login"},"tariff":{"type":"string","title":"Tariff"}},"type":"object","required":["access_token","github_id","github_login","tariff"],"title":"TokenResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WriteResponse":{"properties":{"name":{"type":"string","title":"Name"},"result":{"title":"Result"}},"type":"object","required":["name","result"],"title":"WriteResponse"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}