{"openapi":"3.1.0","info":{"title":"Meu Agente API","version":"1.0.0","description":"API do Meu Agente (bichinho virtual + assistente). Autenticação: entre por /api/auth/sign-in/email (ou Google) e use o token do cabeçalho de resposta `set-auth-token` em `Authorization: Bearer <token>`. Informe o app em `X-Client` (web, extensao, celular). Erros: `{ error: { code, message, field? } }`."},"servers":[{"url":"https://evobit.app"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"responses":{"Error":{"description":"Erro com código estável (unauthorized, not_found, invalid, game_rule, focus_early, agent_daily_limit...).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string"}}}}}}}}}},"paths":{"/api/v1/me":{"get":{"summary":"Pessoa logada","responses":{"200":{"description":"Perfil"},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Muda nome, fuso, idioma e avisos","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"timezone":{"type":"string"},"locale":{"type":"string","enum":["pt-BR","en","es"]},"morningHour":{"type":"integer","minimum":0,"maximum":23},"nudges":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Perfil"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/pet":{"get":{"summary":"O bichinho agora (humor, fome, energia, moedas, nível, sequência)","responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Nome ou visual","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":24},"skin":{"type":"string","enum":["mascote","artista","cidadao","astrologo"]}}}}}},"responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/shop":{"get":{"summary":"Itens da loja","responses":{"200":{"description":"{ items }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/shop/buy":{"post":{"summary":"Compra um item (comida é usada na hora)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"item":{"type":"string","enum":["cafe","energetico","pizza","salada","protetor","artista","cidadao","astrologo"]}},"required":["item"]}}}},"responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/tasks":{"get":{"summary":"Lista tarefas","parameters":[{"name":"status","in":"query","schema":{"enum":["abertas","concluidas","todas"]}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}}],"responses":{"200":{"description":"{ tasks }"},"default":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Cria tarefa","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"notes":{"type":"string","maxLength":2000},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"remindAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["title"]}}}},"responses":{"201":{"description":"Tarefa"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/tasks/{id}":{"patch":{"summary":"Edita (done: true conclui)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"notes":{"type":"string","maxLength":2000},"dueDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"remindAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"done":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Tarefa"},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Apaga","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/tasks/{id}/complete":{"post":{"summary":"Conclui: { task, reward, pet }","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Conclusão"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/focus":{"get":{"summary":"Foco em andamento","responses":{"200":{"description":"{ focus }"},"default":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Começa foco","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"minutes":{"default":25,"type":"integer","minimum":5,"maximum":90},"taskId":{"type":"string"}}}}}},"responses":{"201":{"description":"Foco"}}}},"/api/v1/focus/{id}/finish":{"post":{"summary":"Conclui foco (o servidor confere o tempo)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ focus, reward, pet }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/focus/{id}/cancel":{"post":{"summary":"Cancela foco","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/agent":{"get":{"summary":"Histórico da conversa","responses":{"200":{"description":"{ messages }"},"default":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Fala com o agente (ele executa ações)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":2000},"client":{"type":"string","description":"voz, quando veio de fala"}}}}}},"responses":{"200":{"description":"{ reply, actions, pet, simulated }"},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Apaga o histórico","responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/agent/page":{"post":{"summary":"Resume a página aberta ou extrai dela as tarefas (cria)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"action":{"type":"string","enum":["resumir","tarefas"]},"url":{"type":"string","maxLength":2000},"title":{"type":"string","maxLength":300},"text":{"type":"string","minLength":40,"maxLength":60000}},"required":["action","text"]}}}},"responses":{"200":{"description":"{ reply, actions, pet, simulated }"},"default":{"$ref":"#/components/responses/Error"}}}},"/api/v1/push":{"get":{"summary":"Chave pública VAPID","security":[],"responses":{"200":{"description":"{ publicKey }"},"default":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Liga notificações neste aparelho","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"endpoint":{"type":"string","format":"uri"},"keys":{"type":"object","properties":{"p256dh":{"type":"string","minLength":10},"auth":{"type":"string","minLength":5}},"required":["p256dh","auth"]},"label":{"type":"string","maxLength":60}},"required":["endpoint","keys"]}}}},"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Desliga notificações neste aparelho","responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}}}}}}