Commit Graph

15 Commits

Author SHA1 Message Date
Rodribm10
47f32b540b fix(captain/mcp): generate_pix prefere assistant.captain_unit + 3 checks runtime
resolve_unit agora prioriza Captain::Assistant.captain_unit_id sobre o
mapping legado CaptainInbox (que falha quando 2 agentes — interno e
Hermes — compartilham a mesma inbox).

Caso real: Juliana Hermes (unit Qnn01) compartilhava inbox 1 com Juliana
captain_interno (unit Recanto), mas o CaptainInbox da inbox 1 estava
mapeado pra unit Dolce Amore (id=4) por contaminação anterior. Tool
resolvia unit errada, generate_pix retornava "categoria não reconhecida"
e o agente travava em " Um momento — vou verificar." sem retomar.

bin/hermes-validate ganha 3 checks novos:
- CaptainInbox.unit == Assistant.unit (FAIL — exatamente o bug acima)
- Pricing dry-run (calcula preço da 1ª categoria sem erro)
- Credenciais Inter completas (WARN se faltar cert/key — cai no fallback)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:09:04 -03:00
Rodribm10
9cfd131dcf feat(hermes): script de validação + sed anti-vazamento Dolce Amore
- bin/hermes-validate <slug>: 44 checks de saúde (DB, filesystem, systemd,
  routing, MCP tools, humanização). Saída textual ou --json. Exit 0 sem FAIL.
- bin/hermes-provision: sed adicional substitui exemplos hardcoded de
  categorias Dolce Amore (Mini Chalé 45 etc) pelas 3 primeiras categorias
  da unidade nova; evita resíduo em descrições de tools.
- Fix bash: trocar `|| echo 0` por `|| true` em greps (evita "0\n0" quando
  grep -c não acha e ainda imprime contagem).

Validado em juliana_qnn1: 43 PASS / 0 FAIL / 1 WARN (gallery seed pendente).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 14:53:35 -03:00
Rodribm10
bc87b496a4 fix(captain/hermes): SOUL.md vem da Valentina (template) com sed identity + Pix flow no skill 2026-05-02 14:39:36 -03:00
Rodribm10
d02cb72336 fix(captain/hermes): anti-leak entre unidades — desliga memória + guard SOUL.md
Bug: Juliana de Qnn01 oferecia categorias do Dolce Amore (Apartamento,
Mini Chalé 45, Suíte Ouro). Vazamento via:
1. Hermes daemon memory_enabled+user_profile_enabled — acumula contexto
   entre turnos no mesmo profile.
2. Codex/ChatGPT memória user-level — todos os profiles compartilham o
   mesmo OAuth (borbamachadoo@gmail.com), então ChatGPT lembra de
   conversas com Valentina e bleeda no LLM da Juliana.
3. Tool descriptions com exemplos motel-flavored (já corrigido em commit
   anterior).

Fix permanente no script hermes-provision:
- sed do config.yaml zera memory_enabled e user_profile_enabled
- append no SOUL.md adiciona "REGRA CRÍTICA — IGNORE OUTRAS UNIDADES"
  com lista explícita de categorias válidas (extraída do spec.categories)
  e instrução pro LLM ignorar memória de outras unidades.

Aplicado retroativamente em juliana_qnn1 + sessions/state.db limpos.

Próximos agentes do Construtor nascem com essa proteção por padrão.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 14:19:37 -03:00
Rodribm10
ec50496d21 fix(captain/hermes): hermes-provision usa hermes_profile_name como chave
Bug: find_or_initialize_by(name: ...) batia em captain_interno existente
com mesmo nome (ex: 'Juliana') e SOBRESCREVIA engine='hermes'. Resultado:
Juliana captain_interno virou Hermes, atendimento legado quebrou.

Fix: chave passa a ser (account_id, hermes_profile_name=slug). Auto-sufixa
nome com ' · Hermes' se colidir com captain_interno do mesmo nome (a não
ser que já tenha 'Hermes' no nome). Também grava captain_unit_id no
record (relação direta agora que existe a coluna).

Reverti manualmente Juliana id=1 + criei id=10 'Juliana · Hermes' fix in
DB. Future provisionamentos pelo Construtor usam o caminho corrigido.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:34:07 -03:00
Rodribm10
280d250983 feat(captain/hermes): script hermes-provision pra Construtor autônomo
Bash script em bin/hermes-provision (instalado em /usr/local/bin/ na VPS)
que recebe spec JSON via stdin e provisiona um agente Hermes ponta-a-ponta:
- Valida spec (slug regex, preços 0-5000, períodos/buckets do catálogo)
- Aloca porta livre no range 8650-8699
- Gera HMAC secret via openssl rand
- Cria Captain::Unit (find_or_create), Captain::PricingCategory/Amount,
  Captain::Assistant (engine=hermes) via docker exec rails runner
- Copia template profile da Valentina, patcheia config.yaml com porta +
  X-Captain-Assistant-Id (parent_id se setado, senão self id)
- Escreve SOUL.md/SKILL.md do spec
- Gera webhook_subscriptions.json com secret
- Cria systemd unit hermes@<slug>.service e enable+start
- rsync profile pra repo de backup git local
- Idempotente: re-rodar com mesmo slug não duplica nada (find_or_create)
- --dry-run valida sem escrever
- --rollback <slug> destrói tudo (DB + systemd + filesystem)

Construtor (Hermes daemon) chama via terminal skill nativa:
  echo '<spec>' | /usr/local/bin/hermes-provision

Próximo passo: atualizar SOUL.md/SKILL.md do Construtor pra invocar
o script ao final do fluxo socrático.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 09:59:30 -03:00
Chatwoot Bot
4397ee7d3b
chore: Update translations, add pnpm sync:i18n command (#10893)
Added a command to sync files in the locale/*/ folder. Run `pnpm
sync:i18n` would copy index.js in `dashboard/locale/en` to every other
folder `dashboard/locale/*/`

---------

Co-authored-by: Pranav <pranavrajs@gmail.com>
2025-02-12 17:43:46 -08:00
Shivam Mishra
42f6621afb
feat: Vite + vue 3 💚 (#10047)
Fixes https://github.com/chatwoot/chatwoot/issues/8436
Fixes https://github.com/chatwoot/chatwoot/issues/9767
Fixes https://github.com/chatwoot/chatwoot/issues/10156
Fixes https://github.com/chatwoot/chatwoot/issues/6031
Fixes https://github.com/chatwoot/chatwoot/issues/5696
Fixes https://github.com/chatwoot/chatwoot/issues/9250
Fixes https://github.com/chatwoot/chatwoot/issues/9762

---------

Co-authored-by: Pranav <pranavrajs@gmail.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2024-10-02 00:36:30 -07:00
Sojan Jose
022383d942
chore: Upgrade to Rails 7 (#6719)
fixes: #6736
2023-05-06 10:44:52 +05:30
Sojan Jose
7cbf1857e4
chore: Set statement timeout for Postgres (#6641)
By default, Rails does not set a timeout on database statements. For example, this will run for a full day, even if your ruby process goes away. But it's configurable in the database.yml with the statement_timeout variable.

Hence we are enforcing a 14s timeout by default. Migration commands inside chatwoot will run with a 10 minutes timeout. For specific cases like migrations, we can override this timeout using the environment variable POSTGRES_STATEMENT_TIMEOUT while starting a new rails console.

Test the timeouts from the rails console using.

```
ActiveRecord::Base.connection.execute("SELECT pg_sleep(15);")
```

ref: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts#postgresql
ref: https://til.hashrocket.com/posts/b44baf657d-railspg-statement-timeout-
2023-03-13 18:34:18 +05:30
Sojan Jose
1d9debaee0
feat: IP lookup (#1315)
- feature to store contact IP for accounts
- IP lookup through geocoder gem
- ability to do IP lookup through external APIs
- add commit hook to prevent push to develop and master
- migrations to fix default values for jsonb columns
2020-10-28 02:14:36 +05:30
Pranav Raj S
94c6d6db6f
🚨Fix Rubocop lint errors 2019-10-20 14:17:26 +05:30
Santosh Desani
2ec3dd6e63 [Rubocop] Fixing issues in bin/webpack-dev-server (#89) 2019-10-02 14:13:41 +08:00
Sojan Jose
52194116b3 Upgrade to rails 6 💎 (#11)
- upgraded to rails 6
- fixes various issues
2019-08-19 13:49:57 +05:30
Pranav Raj Sreepuram
2a34255e0b Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com>
Co-authored-by: Manoj <manojmj92@gmail.com>
Co-authored-by: Nithin <webofnithin@gmail.com>
2019-08-14 15:18:44 +05:30