busybits 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +21 -0
  3. package/README.es.md +27 -27
  4. package/README.fr.md +26 -26
  5. package/README.md +63 -34
  6. package/README.pt-BR.md +28 -28
  7. package/dist/build.json +2 -2
  8. package/dist/cli/busybits.js +302 -35
  9. package/dist/client/bundle/app-BXRp9yel.js +24 -0
  10. package/dist/client/bundle/{app-CoDOLwxe.css → app-Y2N0l58V.css} +1 -1
  11. package/dist/client/bundle/city-SSVRvwxu.js +1 -0
  12. package/dist/client/bundle/{daystats-DGzYOP8l.js → daystats-B5wgtYEK.js} +1 -1
  13. package/dist/client/bundle/{dom-D2vx0KTo.js → dom-DTwIMOMe.js} +1 -1
  14. package/dist/client/bundle/{en-DBfNt5uV.js → en-C1UkXkY6.js} +25 -5
  15. package/dist/client/bundle/{es-pnWdszTE.js → es-DrTXrvU-.js} +25 -5
  16. package/dist/client/bundle/{format-C7qb6Cn-.js → format-COWnO8aN.js} +1 -1
  17. package/dist/client/bundle/{fr-CY8q9pj4.js → fr-DSvgQnax.js} +25 -5
  18. package/dist/client/bundle/{main-DktU0GfB.js → main-CjRdSA5N.js} +2 -2
  19. package/dist/client/bundle/{ptypane-NIZ2Y8QM.js → ptypane-BU6MDOyh.js} +1 -1
  20. package/dist/client/bundle/{room-name-CFJfHE5L.js → room-name-DefEKN7q.js} +1 -1
  21. package/dist/client/bundle/{simulator-BnBPS_Ws.js → simulator-BhSq5TwZ.js} +1 -1
  22. package/dist/client/bundle/world-model-D6tSJZPE.js +1 -0
  23. package/dist/client/bundle/{world-stream-BRkL9Eme.js → world-stream-pGb-glkT.js} +1 -1
  24. package/dist/client/index.html +1 -1
  25. package/dist/server/index.js +1030 -450
  26. package/mod/README.md +144 -144
  27. package/mod/habblaud/.claude-plugin/plugin.json +1 -1
  28. package/mod/habblaud-mensagens/.claude-plugin/plugin.json +1 -1
  29. package/mod/habblaud-permissoes/.claude-plugin/plugin.json +1 -1
  30. package/mod/habblaud-pi/package.json +1 -1
  31. package/package.json +7 -2
  32. package/dist/client/bundle/app-AwZeKIeu.js +0 -24
  33. package/dist/client/bundle/city-YoIG0FsX.js +0 -1
  34. package/dist/client/bundle/world-model-BIYmgAWC.js +0 -1
@@ -17,7 +17,7 @@ function applyBusybitsAliases(env) {
17
17
  applyBusybitsAliases(process.env);
18
18
 
19
19
  // server/index.ts
20
- import { existsSync as existsSync13, readFileSync as readFileSync29 } from "node:fs";
20
+ import { existsSync as existsSync13, readFileSync as readFileSync30 } from "node:fs";
21
21
  import http4 from "node:http";
22
22
  import { join as join33 } from "node:path";
23
23
 
@@ -2543,13 +2543,13 @@ var EN = {
2543
2543
  // scripts/hooks-install.ts
2544
2544
  "--timeout precisa de um n\xFAmero de segundos entre 5 e 86400 (24 h).": "--timeout needs a number of seconds between 5 and 86400 (24 h).",
2545
2545
  // scripts/remote-mdns.ts
2546
- "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido no .env: rode npm run remote:setup.": "[remote-mdns] no valid HABBLAUD_REMOTE_NAME in .env: run npm run remote:setup.",
2546
+ "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido na configura\xE7\xE3o: rode npm run remote:setup.": "[remote-mdns] no valid HABBLAUD_REMOTE_NAME in the settings: run npm run remote:setup.",
2547
2547
  "[remote-mdns] sem rede: an\xFAncio suspenso.": "[remote-mdns] no network: announcement paused.",
2548
2548
  "[remote-mdns] {0} sem suporte: use o IP ou um endere\xE7o no DNS do roteador.": "[remote-mdns] {0} not supported: use the IP or an address in the router's DNS.",
2549
2549
  "[remote-mdns] n\xE3o deu para rodar {0}: {1}": "[remote-mdns] couldn't run {0}: {1}",
2550
2550
  "[remote-mdns] anunciando {0}.local -> {1}": "[remote-mdns] announcing {0}.local -> {1}",
2551
2551
  // scripts/remote-setup.ts
2552
- "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: habblaud)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do .env e o servi\xE7o; mant\xE9m a CA)": "Usage: npm run remote:setup [-- options]\n\nTurns on phone access (https://<name>.local) with username, password and HTTPS.\n\n --user <name> login username (default: your system username)\n --name <name> address <name>.local (default: habblaud)\n --domain <address> own address, e.g. myclaude.home (needs an entry in the router's DNS)\n --port <n> port on the computer (default: 443 if free, otherwise 4748)\n --allow <list> what the phone can do: permissions, messages, terminal, spawn, none (default: permissions)\n --password-stdin reads the password from standard input (automation) instead of asking\n --no-service doesn't install the <name>.local announcement service (run npm run remote:mdns yourself)\n --off turns off phone access (removes the lines from .env and the service; keeps the CA)",
2552
+ "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: busybits)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do arquivo de configura\xE7\xE3o e o servi\xE7o; mant\xE9m a CA)": "Usage: npm run remote:setup [-- options]\n\nTurns on phone access (https://<name>.local) with username, password and HTTPS.\n\n --user <name> login username (default: your system username)\n --name <name> address <name>.local (default: busybits)\n --domain <address> own address, e.g. myclaude.home (needs an entry in the router's DNS)\n --port <n> port on the computer (default: 443 if free, otherwise 4748)\n --allow <list> what the phone can do: permissions, messages, terminal, spawn, none (default: permissions)\n --password-stdin reads the password from standard input (automation) instead of asking\n --no-service doesn't install the <name>.local announcement service (run npm run remote:mdns yourself)\n --off turns off phone access (removes the lines from the settings file and the service; keeps the CA)",
2553
2553
  "falta o valor de {0}": "missing value for {0}",
2554
2554
  "op\xE7\xE3o desconhecida: {0}": "unknown option: {0}",
2555
2555
  "porta inv\xE1lida": "invalid port",
@@ -2559,10 +2559,15 @@ var EN = {
2559
2559
  "sem terminal para perguntar a senha: use --password-stdin": "no terminal to ask for the password: use --password-stdin",
2560
2560
  "servi\xE7o {0} ligado (log: ~/.habblaud/logs/remote-mdns.log)": "service {0} enabled (log: ~/.habblaud/logs/remote-mdns.log)",
2561
2561
  "n\xE3o consegui ligar o servi\xE7o: {0}": "couldn't enable the service: {0}",
2562
- "Habblaud: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits: announces the .local address for phone access",
2563
- "servi\xE7o habblaud-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "habblaud-remote-mdns service enabled (to keep it on while logged out: loginctl enable-linger)",
2562
+ "Busybits: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits: announces the .local address for phone access",
2563
+ "servi\xE7o busybits-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "busybits-remote-mdns service enabled (to keep it on while logged out: loginctl enable-linger)",
2564
2564
  "{0}: sem servi\xE7o autom\xE1tico; deixe npm run remote:mdns rodando ou use o IP": "{0}: no automatic service; keep npm run remote:mdns running or use the IP",
2565
- "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls). Agora: npm run docker:up": "[remote-setup] Phone access turned off (the CA stays in ~/.habblaud/remote-tls). Now: npm run docker:up",
2565
+ "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls).": "[remote-setup] Phone access turned off (the CA stays in ~/.habblaud/remote-tls).",
2566
+ " Configura\xE7\xE3o: {0} (lida pelo servidor Node: servi\xE7o ou npm start)": " Settings: {0} (read by the Node server: service or npm start)",
2567
+ " Configura\xE7\xE3o: {0} (lida pelo Docker: npm run docker:up)": " Settings: {0} (read by Docker: npm run docker:up)",
2568
+ " Agora rode: {0}": " Now run: {0}",
2569
+ " Agora rode: {0} (reinicia o servi\xE7o do Busybits para ler as novas configura\xE7\xF5es)": " Now run: {0} (restarts the Busybits service so it reads the new settings)",
2570
+ " Agora: reinicie o servidor do Busybits (npm start) para ler as novas configura\xE7\xF5es": " Now: restart the Busybits server (npm start) so it reads the new settings",
2566
2571
  "Usu\xE1rio do login": "Login username",
2567
2572
  "usu\xE1rio inv\xE1lido (sem espa\xE7os)": "invalid username (no spaces)",
2568
2573
  "senha recusada: {0}": "password rejected: {0}",
@@ -2581,7 +2586,7 @@ var EN = {
2581
2586
  "{0} (depois de criar no roteador: {1} -> {2})": "{0} (after creating it in the router: {1} -> {2})",
2582
2587
  "IP deste computador": "this computer's IP",
2583
2588
  "[remote-setup] Pronto.{0}": "[remote-setup] Done.{0}",
2584
- ' .env: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' .env: user "{0}", password stored only as a hash (scrypt), port {1}',
2589
+ ' Acesso: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' Access: user "{0}", password stored only as a hash (scrypt), port {1}',
2585
2590
  " Certificado: {0}": " Certificate: {0}",
2586
2591
  " An\xFAncio: {0}": " Announcing: {0}",
2587
2592
  " Agora rode: npm run docker:up": " Now run: npm run docker:up",
@@ -3657,7 +3662,7 @@ var EN = {
3657
3662
  "Estilo padr\xE3o salvo para novos agentes.": "Default style saved for new agents.",
3658
3663
  "Estilo padr\xE3o restaurado para aleat\xF3rio.": "Default style restored to random.",
3659
3664
  "N\xE3o foi poss\xEDvel salvar o estilo padr\xE3o (erro {0}).": "Could not save the default style (error {0}).",
3660
- 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': 'Usage: busybits <command> [options]\n\nCommands:\n setup install or update Busybits extensions and services\n start start the server in the foreground\n status show status of installed components and services\n update update Busybits to the latest version\n uninstall remove installed extensions and services\n pair pair this machine as a satellite to a central Busybits\n\nOptions for setup:\n --service install and start the user service (systemd/launchd)\n --port <n> server port\n --no-claude leave Claude Code alone\n --no-pi leave Pi alone\n --no-codex leave the Codex hooks alone\n --dry-run only show what would be done\n --after-update used by "busybits update": restart the service even if the unit did not change\n --rebuild rebuild (install from a clone)\n --ignore-node skip the Node version check\n\nOptions for update:\n --check only shows the current and the latest version\n --rollback goes back to the previous version\n --to <version> updates to that version instead of the latest\n --global also updates the global busybits (npm i -g)\n\nOptions for uninstall:\n --purge also delete the Busybits data\n --dry-run only show what would be done\n\nOptions for pair:\n --pairing <text> pairing text from the central (default: standard input)\n --label <name> how this machine appears in the office\n --codex-wait install the Codex hooks and wait for your answer\n\nGlobal options:\n --help, -h show this help\n --version, -v show installed version',
3665
+ 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n post deixa um item na mesa do seu escrit\xF3rio (a caixa de entrada)\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es de post:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio)\n --body <texto> detalhes em texto simples\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item (e o reabre se estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': 'Usage: busybits <command> [options]\n\nCommands:\n setup install or update Busybits extensions and services\n start start the server in the foreground\n status show status of installed components and services\n update update Busybits to the latest version\n uninstall remove installed extensions and services\n pair pair this machine as a satellite to a central Busybits\n post leave an item on your office desk (the inbox)\n\nOptions for setup:\n --service install and start the user service (systemd/launchd)\n --port <n> server port\n --no-claude leave Claude Code alone\n --no-pi leave Pi alone\n --no-codex leave the Codex hooks alone\n --dry-run only show what would be done\n --after-update used by "busybits update": restart the service even if the unit did not change\n --rebuild rebuild (install from a clone)\n --ignore-node skip the Node version check\n\nOptions for update:\n --check only shows the current and the latest version\n --rollback goes back to the previous version\n --to <version> updates to that version instead of the latest\n --global also updates the global busybits (npm i -g)\n\nOptions for uninstall:\n --purge also delete the Busybits data\n --dry-run only show what would be done\n\nOptions for pair:\n --pairing <text> pairing text from the central (default: standard input)\n --label <name> how this machine appears in the office\n --codex-wait install the Codex hooks and wait for your answer\n\nOptions for post:\n --title <text> item title (required)\n --body <text> details as plain text\n --link <url> http(s) link the item opens\n --key <key> the same key updates the item (and reopens it if it was resolved)\n --source <name> who is leaving the item (shown when it is not an agent)\n\nGlobal options:\n --help, -h show this help\n --version, -v show installed version',
3661
3666
  "No Windows, use scripts/windows/install-satellite.ps1 a partir de um clone (o busybits ainda n\xE3o instala servi\xE7o no Windows).": "On Windows, use scripts/windows/install-satellite.ps1 from a clone (busybits does not install a service on Windows yet).",
3662
3667
  "comando desconhecido: {0}": "unknown command: {0}",
3663
3668
  "{0} precisa de um valor": "{0} needs a value",
@@ -3681,7 +3686,46 @@ var EN = {
3681
3686
  "Voltei para a v{0}.": "Went back to v{0}.",
3682
3687
  "a vers\xE3o {0} n\xE3o tem um payload completo em {1}": "version {0} has no complete payload in {1}",
3683
3688
  "O Busybits precisa do Node 22.12+ ou 24, e nenhum foi encontrado. Instale um (por exemplo com o nvm: nvm install 24) e rode de novo.": "Busybits needs Node 22.12+ or 24, and none was found. Install one (for example with nvm: nvm install 24) and run it again.",
3684
- "servi\xE7o antigo {0} removido": "old service {0} removed"
3689
+ "servi\xE7o antigo {0} removido": "old service {0} removed",
3690
+ "os itens da mesa s\xF3 s\xE3o resolvidos pelo pr\xF3prio computador (http://localhost ou http://127.0.0.1)": "desk items are only resolved from the computer itself (http://localhost or http://127.0.0.1)",
3691
+ "s\xF3 o pr\xF3prio computador deixa itens na mesa (http://localhost ou http://127.0.0.1)": "only the computer itself leaves items on the desk (http://localhost or http://127.0.0.1)",
3692
+ "a mesa s\xF3 vale pelo pr\xF3prio computador ou pelo acesso remoto com login": "the desk only works from the computer itself or through remote access with login",
3693
+ "a mesa j\xE1 tem {0} itens abertos: resolva alguns antes de deixar outros": "the desk already has {0} open items: resolve some before leaving more",
3694
+ "item n\xE3o encontrado": "item not found",
3695
+ "inbox.json ileg\xEDvel ({0}); come\xE7ando sem itens.": "inbox.json unreadable ({0}); starting with no items.",
3696
+ "corpo inv\xE1lido": "invalid body",
3697
+ "t\xEDtulo obrigat\xF3rio": "title required",
3698
+ "t\xEDtulo longo demais (m\xE1x. {0} caracteres)": "title too long (max {0} characters)",
3699
+ "texto inv\xE1lido": "invalid text",
3700
+ "texto longo demais (m\xE1x. {0} KB)": "text too long (max {0} KB)",
3701
+ "link inv\xE1lido": "invalid link",
3702
+ "o link precisa ser http ou https": "the link must be http or https",
3703
+ "chave inv\xE1lida": "invalid key",
3704
+ "chave longa demais (m\xE1x. {0} caracteres)": "key too long (max {0} characters)",
3705
+ "origem inv\xE1lida": "invalid source",
3706
+ "ancestrais inv\xE1lidos": "invalid ancestors",
3707
+ 'Uso: busybits post --title <texto> [op\xE7\xF5es]\n\nDeixa um item na mesa do seu escrit\xF3rio (o painel "Mesa" abre ao clicar no monte de pap\xE9is).\n\nOp\xE7\xF5es:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio, at\xE9 200 caracteres)\n --body <texto> detalhes em texto simples (at\xE9 8 KB)\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item em vez de duplicar (e o reabre se j\xE1 estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nExemplo:\n busybits post --title "ROO7-1234 rejeitado no QA" --link https://example.com/ROO7-1234 --key ROO7-1234': 'Usage: busybits post --title <text> [options]\n\nLeaves an item on your office desk (the "Desk" panel opens when you click the stack of papers).\n\nOptions:\n --title <text> item title (required, up to 200 characters)\n --body <text> details as plain text (up to 8 KB)\n --link <url> http(s) link the item opens\n --key <key> the same key updates the item instead of duplicating it (and reopens it if it was already resolved)\n --source <name> who is leaving the item (shown when it is not an agent)\n\nExample:\n busybits post --title "ROO7-1234 rejected in QA" --link https://example.com/ROO7-1234 --key ROO7-1234',
3708
+ "falta --title": "missing --title",
3709
+ "N\xE3o consegui falar com o Busybits na porta {0}. Ele est\xE1 rodando? (busybits start; outra porta: HABBLAUD_PORT)": "Could not reach Busybits on port {0}. Is it running? (busybits start; another port: HABBLAUD_PORT)",
3710
+ "O Busybits recusou o item ({0}): {1}": "Busybits refused the item ({0}): {1}",
3711
+ "Item reaberto na mesa: {0}": "Item reopened on the desk: {0}",
3712
+ "Item atualizado na mesa: {0}": "Item updated on the desk: {0}",
3713
+ "Item deixado na mesa: {0}": "Item left on the desk: {0}",
3714
+ "A mesa s\xF3 funciona com o escrit\xF3rio ao vivo.": "The desk only works with the live office.",
3715
+ "N\xE3o foi poss\xEDvel resolver o item (erro {0}).": "Could not resolve the item (error {0}).",
3716
+ "um agente": "an agent",
3717
+ "um script": "a script",
3718
+ "resolvido {0}": "resolved {0}",
3719
+ "de {0}": "from {0}",
3720
+ "Resolver": "Resolve",
3721
+ "Nada por aqui.": "Nothing here.",
3722
+ "Sua mesa est\xE1 limpa: nada esperando.": "Your desk is clear: nothing waiting.",
3723
+ "Ocultar resolvidos": "Hide resolved",
3724
+ "Mostrar resolvidos ({0})": "Show resolved ({0})",
3725
+ "Itens deixados na sua mesa. Clique para abrir.": "Items left on your desk. Click to open.",
3726
+ "na mesa": "on desk",
3727
+ "Na sua mesa": "On your desk",
3728
+ "Mensageiro": "Courier"
3685
3729
  };
3686
3730
 
3687
3731
  // shared/locales/es.ts
@@ -6201,13 +6245,13 @@ var ES = {
6201
6245
  // scripts/hooks-install.ts
6202
6246
  "--timeout precisa de um n\xFAmero de segundos entre 5 e 86400 (24 h).": "--timeout necesita un n\xFAmero de segundos entre 5 y 86400 (24 h).",
6203
6247
  // scripts/remote-mdns.ts
6204
- "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido no .env: rode npm run remote:setup.": "[remote-mdns] sin HABBLAUD_REMOTE_NAME v\xE1lido en el .env: ejecuta npm run remote:setup.",
6248
+ "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido na configura\xE7\xE3o: rode npm run remote:setup.": "[remote-mdns] sin HABBLAUD_REMOTE_NAME v\xE1lido en la configuraci\xF3n: ejecuta npm run remote:setup.",
6205
6249
  "[remote-mdns] sem rede: an\xFAncio suspenso.": "[remote-mdns] sin red: anuncio suspendido.",
6206
6250
  "[remote-mdns] {0} sem suporte: use o IP ou um endere\xE7o no DNS do roteador.": "[remote-mdns] {0} no compatible: usa la IP o una direcci\xF3n en el DNS del router.",
6207
6251
  "[remote-mdns] n\xE3o deu para rodar {0}: {1}": "[remote-mdns] no se pudo ejecutar {0}: {1}",
6208
6252
  "[remote-mdns] anunciando {0}.local -> {1}": "[remote-mdns] anunciando {0}.local -> {1}",
6209
6253
  // scripts/remote-setup.ts
6210
- "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: habblaud)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do .env e o servi\xE7o; mant\xE9m a CA)": "Uso: npm run remote:setup [-- opciones]\n\nActiva el acceso desde el celular (https://<nombre>.local) con usuario, contrase\xF1a y HTTPS.\n\n --user <nombre> usuario del inicio de sesi\xF3n (por defecto: tu usuario del sistema)\n --name <nombre> direcci\xF3n <nombre>.local (por defecto: habblaud)\n --domain <dominio> direcci\xF3n propia, p. ej., miclaude.home (necesita una entrada en el DNS del router)\n --port <n> puerto en el equipo (por defecto: 443 si est\xE1 libre, si no 4748)\n --allow <lista> lo que puede hacer el celular: permissions, messages, terminal, spawn, none (por defecto: permissions)\n --password-stdin lee la contrase\xF1a de la entrada est\xE1ndar (automatizaci\xF3n), en vez de preguntarla\n --no-service no instala el servicio de anuncio de <nombre>.local (ejecuta npm run remote:mdns t\xFA mismo)\n --off desactiva el acceso desde el celular (quita las l\xEDneas del .env y el servicio; mantiene la CA)",
6254
+ "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: busybits)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do arquivo de configura\xE7\xE3o e o servi\xE7o; mant\xE9m a CA)": "Uso: npm run remote:setup [-- opciones]\n\nActiva el acceso desde el celular (https://<nombre>.local) con usuario, contrase\xF1a y HTTPS.\n\n --user <nombre> usuario del inicio de sesi\xF3n (por defecto: tu usuario del sistema)\n --name <nombre> direcci\xF3n <nombre>.local (por defecto: busybits)\n --domain <dominio> direcci\xF3n propia, p. ej., miclaude.home (necesita una entrada en el DNS del router)\n --port <n> puerto en el equipo (por defecto: 443 si est\xE1 libre, si no 4748)\n --allow <lista> lo que puede hacer el celular: permissions, messages, terminal, spawn, none (por defecto: permissions)\n --password-stdin lee la contrase\xF1a de la entrada est\xE1ndar (automatizaci\xF3n), en vez de preguntarla\n --no-service no instala el servicio de anuncio de <nombre>.local (ejecuta npm run remote:mdns t\xFA mismo)\n --off desactiva el acceso desde el celular (quita las l\xEDneas del archivo de configuraci\xF3n y el servicio; mantiene la CA)",
6211
6255
  "falta o valor de {0}": "falta el valor de {0}",
6212
6256
  "op\xE7\xE3o desconhecida: {0}": "opci\xF3n desconocida: {0}",
6213
6257
  "porta inv\xE1lida": "puerto inv\xE1lido",
@@ -6217,10 +6261,15 @@ var ES = {
6217
6261
  "sem terminal para perguntar a senha: use --password-stdin": "sin terminal para pedir la contrase\xF1a: usa --password-stdin",
6218
6262
  "servi\xE7o {0} ligado (log: ~/.habblaud/logs/remote-mdns.log)": "servicio {0} activado (log: ~/.habblaud/logs/remote-mdns.log)",
6219
6263
  "n\xE3o consegui ligar o servi\xE7o: {0}": "no se pudo activar el servicio: {0}",
6220
- "Habblaud: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits: anuncia la direcci\xF3n .local del acceso desde el celular",
6221
- "servi\xE7o habblaud-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "servicio habblaud-remote-mdns activado (para que siga activo sin sesi\xF3n iniciada: loginctl enable-linger)",
6264
+ "Busybits: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits: anuncia la direcci\xF3n .local del acceso desde el m\xF3vil",
6265
+ "servi\xE7o busybits-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "servicio busybits-remote-mdns activado (para que siga activo sin sesi\xF3n: loginctl enable-linger)",
6222
6266
  "{0}: sem servi\xE7o autom\xE1tico; deixe npm run remote:mdns rodando ou use o IP": "{0}: sin servicio autom\xE1tico; deja npm run remote:mdns corriendo o usa la IP",
6223
- "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls). Agora: npm run docker:up": "[remote-setup] Acceso desde el celular desactivado (la CA sigue en ~/.habblaud/remote-tls). Ahora: npm run docker:up",
6267
+ "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls).": "[remote-setup] Acceso desde el m\xF3vil desactivado (la CA sigue en ~/.habblaud/remote-tls).",
6268
+ " Configura\xE7\xE3o: {0} (lida pelo servidor Node: servi\xE7o ou npm start)": " Configuraci\xF3n: {0} (lo lee el servidor Node: servicio o npm start)",
6269
+ " Configura\xE7\xE3o: {0} (lida pelo Docker: npm run docker:up)": " Configuraci\xF3n: {0} (lo lee Docker: npm run docker:up)",
6270
+ " Agora rode: {0}": " Ahora ejecuta: {0}",
6271
+ " Agora rode: {0} (reinicia o servi\xE7o do Busybits para ler as novas configura\xE7\xF5es)": " Ahora ejecuta: {0} (reinicia el servicio de Busybits para que lea la nueva configuraci\xF3n)",
6272
+ " Agora: reinicie o servidor do Busybits (npm start) para ler as novas configura\xE7\xF5es": " Ahora: reinicia el servidor de Busybits (npm start) para que lea la nueva configuraci\xF3n",
6224
6273
  "Usu\xE1rio do login": "Usuario de inicio de sesi\xF3n",
6225
6274
  "usu\xE1rio inv\xE1lido (sem espa\xE7os)": "usuario inv\xE1lido (sin espacios)",
6226
6275
  "senha recusada: {0}": "contrase\xF1a rechazada: {0}",
@@ -6239,7 +6288,7 @@ var ES = {
6239
6288
  "{0} (depois de criar no roteador: {1} -> {2})": "{0} (despu\xE9s de crearla en el router: {1} -> {2})",
6240
6289
  "IP deste computador": "IP de este equipo",
6241
6290
  "[remote-setup] Pronto.{0}": "[remote-setup] Listo.{0}",
6242
- ' .env: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' .env: usuario "{0}", contrase\xF1a guardada solo como hash (scrypt), puerto {1}',
6291
+ ' Acesso: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' Acceso: usuario "{0}", contrase\xF1a guardada solo como hash (scrypt), puerto {1}',
6243
6292
  " Certificado: {0}": " Certificado: {0}",
6244
6293
  " An\xFAncio: {0}": " Anuncio: {0}",
6245
6294
  " Agora rode: npm run docker:up": " Ejecuta: npm run docker:up",
@@ -7315,7 +7364,7 @@ var ES = {
7315
7364
  "Estilo padr\xE3o salvo para novos agentes.": "Estilo predeterminado guardado para nuevos agentes.",
7316
7365
  "Estilo padr\xE3o restaurado para aleat\xF3rio.": "Estilo predeterminado restaurado a aleatorio.",
7317
7366
  "N\xE3o foi poss\xEDvel salvar o estilo padr\xE3o (erro {0}).": "No se pudo guardar el estilo predeterminado (error {0}).",
7318
- 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': 'Uso: busybits <comando> [opciones]\n\nComandos:\n setup instala o actualiza las extensiones y servicios de Busybits\n start inicia el servidor en primer plano\n status muestra el estado de la instalaci\xF3n y los servicios\n update actualiza Busybits a la \xFAltima versi\xF3n\n uninstall desinstala extensiones y servicios instalados\n pair empareja este equipo como sat\xE9lite de un Busybits central\n\nOpciones de setup:\n --service instala e inicia el servicio de usuario (systemd/launchd)\n --port <n> puerto del servidor\n --no-claude no toca Claude Code\n --no-pi no toca Pi\n --no-codex no toca los hooks de Codex\n --dry-run solo muestra lo que se har\xEDa\n --after-update usado por "busybits update": reinicia el servicio aunque la unidad no haya cambiado\n --rebuild recompila (instalaci\xF3n desde un clon)\n --ignore-node omite la comprobaci\xF3n de la versi\xF3n de Node\n\nOpciones de update:\n --check solo muestra la versi\xF3n actual y la \xFAltima\n --rollback vuelve a la versi\xF3n anterior\n --to <versi\xF3n> actualiza a esa versi\xF3n en lugar de la \xFAltima\n --global actualiza tambi\xE9n el busybits global (npm i -g)\n\nOpciones de uninstall:\n --purge borra tambi\xE9n los datos de Busybits\n --dry-run solo muestra lo que se har\xEDa\n\nOpciones de pair:\n --pairing <texto> texto de emparejamiento de la central (por defecto: entrada est\xE1ndar)\n --label <nombre> c\xF3mo aparece esta m\xE1quina en la oficina\n --codex-wait instala los hooks de Codex y espera su respuesta\n\nOpciones globales:\n --help, -h muestra esta ayuda\n --version, -v muestra la versi\xF3n instalada',
7367
+ 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n post deixa um item na mesa do seu escrit\xF3rio (a caixa de entrada)\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es de post:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio)\n --body <texto> detalhes em texto simples\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item (e o reabre se estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': 'Uso: busybits <comando> [opciones]\n\nComandos:\n setup instala o actualiza las extensiones y servicios de Busybits\n start inicia el servidor en primer plano\n status muestra el estado de la instalaci\xF3n y los servicios\n update actualiza Busybits a la \xFAltima versi\xF3n\n uninstall desinstala extensiones y servicios instalados\n pair empareja este equipo como sat\xE9lite de un Busybits central\n post deja un elemento en el escritorio de tu oficina (la bandeja)\n\nOpciones de setup:\n --service instala e inicia el servicio de usuario (systemd/launchd)\n --port <n> puerto del servidor\n --no-claude no toca Claude Code\n --no-pi no toca Pi\n --no-codex no toca los hooks de Codex\n --dry-run solo muestra lo que se har\xEDa\n --after-update usado por "busybits update": reinicia el servicio aunque la unidad no haya cambiado\n --rebuild recompila (instalaci\xF3n desde un clon)\n --ignore-node omite la comprobaci\xF3n de la versi\xF3n de Node\n\nOpciones de update:\n --check solo muestra la versi\xF3n actual y la \xFAltima\n --rollback vuelve a la versi\xF3n anterior\n --to <versi\xF3n> actualiza a esa versi\xF3n en lugar de la \xFAltima\n --global actualiza tambi\xE9n el busybits global (npm i -g)\n\nOpciones de uninstall:\n --purge borra tambi\xE9n los datos de Busybits\n --dry-run solo muestra lo que se har\xEDa\n\nOpciones de pair:\n --pairing <texto> texto de emparejamiento de la central (por defecto: entrada est\xE1ndar)\n --label <nombre> c\xF3mo aparece esta m\xE1quina en la oficina\n --codex-wait instala los hooks de Codex y espera su respuesta\n\nOpciones de post:\n --title <texto> t\xEDtulo del elemento (obligatorio)\n --body <texto> detalles en texto simple\n --link <url> enlace http(s) que abre el elemento\n --key <clave> la misma clave actualiza el elemento (y lo reabre si estaba resuelto)\n --source <nombre> qui\xE9n deja el elemento (se muestra cuando no es un agente)\n\nOpciones globales:\n --help, -h muestra esta ayuda\n --version, -v muestra la versi\xF3n instalada',
7319
7368
  "No Windows, use scripts/windows/install-satellite.ps1 a partir de um clone (o busybits ainda n\xE3o instala servi\xE7o no Windows).": "En Windows, usa scripts/windows/install-satellite.ps1 desde un clon (busybits a\xFAn no instala servicio en Windows).",
7320
7369
  "comando desconhecido: {0}": "comando desconocido: {0}",
7321
7370
  "{0} precisa de um valor": "{0} necesita un valor",
@@ -7339,7 +7388,46 @@ var ES = {
7339
7388
  "Voltei para a v{0}.": "Volv\xED a la v{0}.",
7340
7389
  "a vers\xE3o {0} n\xE3o tem um payload completo em {1}": "la versi\xF3n {0} no tiene un payload completo en {1}",
7341
7390
  "O Busybits precisa do Node 22.12+ ou 24, e nenhum foi encontrado. Instale um (por exemplo com o nvm: nvm install 24) e rode de novo.": "Busybits necesita Node 22.12+ o 24, y no se encontr\xF3 ninguno. Instala uno (por ejemplo con nvm: nvm install 24) y ejec\xFAtalo de nuevo.",
7342
- "servi\xE7o antigo {0} removido": "servicio antiguo {0} eliminado"
7391
+ "servi\xE7o antigo {0} removido": "servicio antiguo {0} eliminado",
7392
+ "os itens da mesa s\xF3 s\xE3o resolvidos pelo pr\xF3prio computador (http://localhost ou http://127.0.0.1)": "los elementos del escritorio solo se resuelven desde el propio ordenador (http://localhost o http://127.0.0.1)",
7393
+ "s\xF3 o pr\xF3prio computador deixa itens na mesa (http://localhost ou http://127.0.0.1)": "solo el propio ordenador deja elementos en el escritorio (http://localhost o http://127.0.0.1)",
7394
+ "a mesa s\xF3 vale pelo pr\xF3prio computador ou pelo acesso remoto com login": "el escritorio solo vale desde el propio ordenador o por el acceso remoto con inicio de sesi\xF3n",
7395
+ "a mesa j\xE1 tem {0} itens abertos: resolva alguns antes de deixar outros": "el escritorio ya tiene {0} elementos abiertos: resuelve algunos antes de dejar m\xE1s",
7396
+ "item n\xE3o encontrado": "elemento no encontrado",
7397
+ "inbox.json ileg\xEDvel ({0}); come\xE7ando sem itens.": "inbox.json ilegible ({0}); empezando sin elementos.",
7398
+ "corpo inv\xE1lido": "cuerpo inv\xE1lido",
7399
+ "t\xEDtulo obrigat\xF3rio": "t\xEDtulo obligatorio",
7400
+ "t\xEDtulo longo demais (m\xE1x. {0} caracteres)": "t\xEDtulo demasiado largo (m\xE1x. {0} caracteres)",
7401
+ "texto inv\xE1lido": "texto inv\xE1lido",
7402
+ "texto longo demais (m\xE1x. {0} KB)": "texto demasiado largo (m\xE1x. {0} KB)",
7403
+ "link inv\xE1lido": "enlace inv\xE1lido",
7404
+ "o link precisa ser http ou https": "el enlace debe ser http o https",
7405
+ "chave inv\xE1lida": "clave inv\xE1lida",
7406
+ "chave longa demais (m\xE1x. {0} caracteres)": "clave demasiado larga (m\xE1x. {0} caracteres)",
7407
+ "origem inv\xE1lida": "origen inv\xE1lido",
7408
+ "ancestrais inv\xE1lidos": "ancestros inv\xE1lidos",
7409
+ 'Uso: busybits post --title <texto> [op\xE7\xF5es]\n\nDeixa um item na mesa do seu escrit\xF3rio (o painel "Mesa" abre ao clicar no monte de pap\xE9is).\n\nOp\xE7\xF5es:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio, at\xE9 200 caracteres)\n --body <texto> detalhes em texto simples (at\xE9 8 KB)\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item em vez de duplicar (e o reabre se j\xE1 estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nExemplo:\n busybits post --title "ROO7-1234 rejeitado no QA" --link https://example.com/ROO7-1234 --key ROO7-1234': 'Uso: busybits post --title <texto> [opciones]\n\nDeja un elemento en el escritorio de tu oficina (el panel "Escritorio" se abre al hacer clic en la pila de papeles).\n\nOpciones:\n --title <texto> t\xEDtulo del elemento (obligatorio, hasta 200 caracteres)\n --body <texto> detalles en texto simple (hasta 8 KB)\n --link <url> enlace http(s) que abre el elemento\n --key <clave> la misma clave actualiza el elemento en lugar de duplicarlo (y lo reabre si ya estaba resuelto)\n --source <nombre> qui\xE9n deja el elemento (se muestra cuando no es un agente)\n\nEjemplo:\n busybits post --title "ROO7-1234 rechazado en QA" --link https://example.com/ROO7-1234 --key ROO7-1234',
7410
+ "falta --title": "falta --title",
7411
+ "N\xE3o consegui falar com o Busybits na porta {0}. Ele est\xE1 rodando? (busybits start; outra porta: HABBLAUD_PORT)": "No pude hablar con Busybits en el puerto {0}. \xBFEst\xE1 en marcha? (busybits start; otro puerto: HABBLAUD_PORT)",
7412
+ "O Busybits recusou o item ({0}): {1}": "Busybits rechaz\xF3 el elemento ({0}): {1}",
7413
+ "Item reaberto na mesa: {0}": "Elemento reabierto en el escritorio: {0}",
7414
+ "Item atualizado na mesa: {0}": "Elemento actualizado en el escritorio: {0}",
7415
+ "Item deixado na mesa: {0}": "Elemento dejado en el escritorio: {0}",
7416
+ "A mesa s\xF3 funciona com o escrit\xF3rio ao vivo.": "El escritorio solo funciona con la oficina en vivo.",
7417
+ "N\xE3o foi poss\xEDvel resolver o item (erro {0}).": "No se pudo resolver el elemento (error {0}).",
7418
+ "um agente": "un agente",
7419
+ "um script": "un script",
7420
+ "resolvido {0}": "resuelto {0}",
7421
+ "de {0}": "de {0}",
7422
+ "Resolver": "Resolver",
7423
+ "Nada por aqui.": "Nada por aqu\xED.",
7424
+ "Sua mesa est\xE1 limpa: nada esperando.": "Tu escritorio est\xE1 despejado: nada esperando.",
7425
+ "Ocultar resolvidos": "Ocultar resueltos",
7426
+ "Mostrar resolvidos ({0})": "Mostrar resueltos ({0})",
7427
+ "Itens deixados na sua mesa. Clique para abrir.": "Elementos dejados en tu escritorio. Haz clic para abrir.",
7428
+ "na mesa": "en el escritorio",
7429
+ "Na sua mesa": "En tu escritorio",
7430
+ "Mensageiro": "Mensajero"
7343
7431
  };
7344
7432
 
7345
7433
  // shared/locales/fr.ts
@@ -9867,13 +9955,13 @@ var FR = {
9867
9955
  // scripts/hooks-install.ts
9868
9956
  "--timeout precisa de um n\xFAmero de segundos entre 5 e 86400 (24 h).": "--timeout attend un nombre de secondes entre 5 et 86400 (24 h).",
9869
9957
  // scripts/remote-mdns.ts
9870
- "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido no .env: rode npm run remote:setup.": "[remote-mdns] pas de HABBLAUD_REMOTE_NAME valide dans le .env : lancez npm run remote:setup.",
9958
+ "[remote-mdns] sem HABBLAUD_REMOTE_NAME v\xE1lido na configura\xE7\xE3o: rode npm run remote:setup.": "[remote-mdns] pas de HABBLAUD_REMOTE_NAME valide dans la configuration : lancez npm run remote:setup.",
9871
9959
  "[remote-mdns] sem rede: an\xFAncio suspenso.": "[remote-mdns] pas de r\xE9seau : annonce suspendue.",
9872
9960
  "[remote-mdns] {0} sem suporte: use o IP ou um endere\xE7o no DNS do roteador.": "[remote-mdns] {0} non pris en charge : utilisez l'IP ou une adresse dans le DNS du routeur.",
9873
9961
  "[remote-mdns] n\xE3o deu para rodar {0}: {1}": "[remote-mdns] impossible de lancer {0} : {1}",
9874
9962
  "[remote-mdns] anunciando {0}.local -> {1}": "[remote-mdns] annonce de {0}.local -> {1}",
9875
9963
  // scripts/remote-setup.ts
9876
- "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: habblaud)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do .env e o servi\xE7o; mant\xE9m a CA)": "Usage : npm run remote:setup [-- options]\n\nActive l'acc\xE8s depuis le t\xE9l\xE9phone (https://<nom>.local) avec nom d'utilisateur, mot de passe et HTTPS.\n\n --user <nom> nom d'utilisateur de connexion (par d\xE9faut : votre nom d'utilisateur syst\xE8me)\n --name <nom> adresse <nom>.local (par d\xE9faut : habblaud)\n --domain <adresse> adresse personnalis\xE9e, ex. : monclaude.home (n\xE9cessite une entr\xE9e dans le DNS du routeur)\n --port <n> port sur l'ordinateur (par d\xE9faut : 443 s'il est libre, sinon 4748)\n --allow <liste> ce que le t\xE9l\xE9phone peut faire : permissions, messages, terminal, spawn, none (par d\xE9faut : permissions)\n --password-stdin lit le mot de passe sur l'entr\xE9e standard (automatisation) au lieu de le demander\n --no-service n'installe pas le service d'annonce de <nom>.local (lancez npm run remote:mdns vous-m\xEAme)\n --off d\xE9sactive l'acc\xE8s depuis le t\xE9l\xE9phone (retire les lignes du .env et le service ; garde la CA)",
9964
+ "Uso: npm run remote:setup [-- op\xE7\xF5es]\n\nLiga o acesso pelo celular (https://<nome>.local) com usu\xE1rio, senha e HTTPS.\n\n --user <nome> usu\xE1rio do login (padr\xE3o: o seu usu\xE1rio do sistema)\n --name <nome> endere\xE7o <nome>.local (padr\xE3o: busybits)\n --domain <endere\xE7o> endere\xE7o pr\xF3prio, ex.: meuclaude.home (precisa de uma entrada no DNS do roteador)\n --port <n> porta no computador (padr\xE3o: 443 se estiver livre, sen\xE3o 4748)\n --allow <lista> o que o celular pode fazer: permissions, messages, terminal, spawn, none (padr\xE3o: permissions)\n --password-stdin l\xEA a senha da entrada padr\xE3o (automa\xE7\xE3o), em vez de perguntar\n --no-service n\xE3o instala o servi\xE7o do an\xFAncio <nome>.local (rode npm run remote:mdns voc\xEA mesmo)\n --off desliga o acesso pelo celular (tira as linhas do arquivo de configura\xE7\xE3o e o servi\xE7o; mant\xE9m a CA)": "Usage : npm run remote:setup [-- options]\n\nActive l'acc\xE8s depuis le t\xE9l\xE9phone (https://<nom>.local) avec nom d'utilisateur, mot de passe et HTTPS.\n\n --user <nom> nom d'utilisateur de connexion (par d\xE9faut : votre nom d'utilisateur syst\xE8me)\n --name <nom> adresse <nom>.local (par d\xE9faut : busybits)\n --domain <adresse> adresse personnalis\xE9e, ex. : monclaude.home (n\xE9cessite une entr\xE9e dans le DNS du routeur)\n --port <n> port sur l'ordinateur (par d\xE9faut : 443 s'il est libre, sinon 4748)\n --allow <liste> ce que le t\xE9l\xE9phone peut faire : permissions, messages, terminal, spawn, none (par d\xE9faut : permissions)\n --password-stdin lit le mot de passe sur l'entr\xE9e standard (automatisation) au lieu de le demander\n --no-service n'installe pas le service d'annonce de <nom>.local (lancez npm run remote:mdns vous-m\xEAme)\n --off d\xE9sactive l'acc\xE8s depuis le t\xE9l\xE9phone (retire les lignes du fichier de configuration et le service ; garde la CA)",
9877
9965
  "falta o valor de {0}": "valeur manquante pour {0}",
9878
9966
  "op\xE7\xE3o desconhecida: {0}": "option inconnue : {0}",
9879
9967
  "porta inv\xE1lida": "port invalide",
@@ -9883,10 +9971,15 @@ var FR = {
9883
9971
  "sem terminal para perguntar a senha: use --password-stdin": "pas de terminal pour demander le mot de passe : utilisez --password-stdin",
9884
9972
  "servi\xE7o {0} ligado (log: ~/.habblaud/logs/remote-mdns.log)": "service {0} activ\xE9 (journal : ~/.habblaud/logs/remote-mdns.log)",
9885
9973
  "n\xE3o consegui ligar o servi\xE7o: {0}": "impossible d'activer le service : {0}",
9886
- "Habblaud: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits : annonce l'adresse .local de l'acc\xE8s depuis le t\xE9l\xE9phone",
9887
- "servi\xE7o habblaud-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "service habblaud-remote-mdns activ\xE9 (pour qu'il reste actif sans session ouverte : loginctl enable-linger)",
9974
+ "Busybits: anuncia o endere\xE7o .local do acesso pelo celular": "Busybits : annonce l'adresse .local de l'acc\xE8s depuis le t\xE9l\xE9phone",
9975
+ "servi\xE7o busybits-remote-mdns ligado (para seguir ligado sem login: loginctl enable-linger)": "service busybits-remote-mdns activ\xE9 (pour qu'il reste actif sans session : loginctl enable-linger)",
9888
9976
  "{0}: sem servi\xE7o autom\xE1tico; deixe npm run remote:mdns rodando ou use o IP": "{0} : pas de service automatique ; laissez tourner npm run remote:mdns ou utilisez l'IP",
9889
- "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls). Agora: npm run docker:up": "[remote-setup] Acc\xE8s depuis le t\xE9l\xE9phone d\xE9sactiv\xE9 (la CA reste dans ~/.habblaud/remote-tls). Maintenant : npm run docker:up",
9977
+ "[remote-setup] Acesso pelo celular desligado (a CA continua em ~/.habblaud/remote-tls).": "[remote-setup] Acc\xE8s depuis le t\xE9l\xE9phone d\xE9sactiv\xE9 (la CA reste dans ~/.habblaud/remote-tls).",
9978
+ " Configura\xE7\xE3o: {0} (lida pelo servidor Node: servi\xE7o ou npm start)": " Configuration : {0} (lue par le serveur Node : service ou npm start)",
9979
+ " Configura\xE7\xE3o: {0} (lida pelo Docker: npm run docker:up)": " Configuration : {0} (lue par Docker : npm run docker:up)",
9980
+ " Agora rode: {0}": " Lancez maintenant : {0}",
9981
+ " Agora rode: {0} (reinicia o servi\xE7o do Busybits para ler as novas configura\xE7\xF5es)": " Lancez maintenant : {0} (red\xE9marre le service Busybits pour qu'il lise la nouvelle configuration)",
9982
+ " Agora: reinicie o servidor do Busybits (npm start) para ler as novas configura\xE7\xF5es": " Maintenant : red\xE9marrez le serveur Busybits (npm start) pour qu'il lise la nouvelle configuration",
9890
9983
  "Usu\xE1rio do login": "Nom d'utilisateur de connexion",
9891
9984
  "usu\xE1rio inv\xE1lido (sem espa\xE7os)": "nom d'utilisateur invalide (sans espaces)",
9892
9985
  "senha recusada: {0}": "mot de passe refus\xE9 : {0}",
@@ -9905,7 +9998,7 @@ var FR = {
9905
9998
  "{0} (depois de criar no roteador: {1} -> {2})": "{0} (apr\xE8s l'avoir cr\xE9\xE9e dans le routeur : {1} -> {2})",
9906
9999
  "IP deste computador": "IP de cet ordinateur",
9907
10000
  "[remote-setup] Pronto.{0}": "[remote-setup] C'est fait.{0}",
9908
- ' .env: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' .env : utilisateur "{0}", mot de passe stock\xE9 uniquement sous forme de hash (scrypt), port {1}',
10001
+ ' Acesso: usu\xE1rio "{0}", senha guardada s\xF3 como hash (scrypt), porta {1}': ' Acc\xE8s : utilisateur "{0}", mot de passe stock\xE9 uniquement sous forme de hash (scrypt), port {1}',
9909
10002
  " Certificado: {0}": " Certificat : {0}",
9910
10003
  " An\xFAncio: {0}": " Annonce : {0}",
9911
10004
  " Agora rode: npm run docker:up": " Lancez : npm run docker:up",
@@ -10988,7 +11081,7 @@ var FR = {
10988
11081
  "Estilo padr\xE3o salvo para novos agentes.": "Style par d\xE9faut enregistr\xE9 pour les nouveaux agents.",
10989
11082
  "Estilo padr\xE3o restaurado para aleat\xF3rio.": "Style par d\xE9faut restaur\xE9 \xE0 al\xE9atoire.",
10990
11083
  "N\xE3o foi poss\xEDvel salvar o estilo padr\xE3o (erro {0}).": "Impossible d'enregistrer le style par d\xE9faut (erreur {0}).",
10991
- 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': "Utilisation\xA0: busybits <commande> [options]\n\nCommandes\xA0:\n setup installe ou met \xE0 jour les extensions et services Busybits\n start d\xE9marre le serveur au premier plan\n status affiche l'\xE9tat de l'installation et des services\n update met \xE0 jour Busybits vers la derni\xE8re version\n uninstall supprime les extensions et services install\xE9s\n pair associe cette machine comme satellite d'un Busybits central\n\nOptions de setup :\n --service installe et d\xE9marre le service utilisateur (systemd/launchd)\n --port <n> port du serveur\n --no-claude ne touche pas \xE0 Claude Code\n --no-pi ne touche pas \xE0 Pi\n --no-codex ne touche pas aux hooks Codex\n --dry-run montre seulement ce qui serait fait\n --after-update utilis\xE9 par \xAB busybits update \xBB : red\xE9marre le service m\xEAme si l'unit\xE9 n'a pas chang\xE9\n --rebuild recompile (installation depuis un clone)\n --ignore-node ignore la v\xE9rification de la version de Node\n\nOptions de update :\n --check affiche seulement la version actuelle et la derni\xE8re\n --rollback revient \xE0 la version pr\xE9c\xE9dente\n --to <version> met \xE0 jour vers cette version au lieu de la derni\xE8re\n --global met aussi \xE0 jour le busybits global (npm i -g)\n\nOptions de uninstall :\n --purge supprime aussi les donn\xE9es de Busybits\n --dry-run montre seulement ce qui serait fait\n\nOptions de pair :\n --pairing <texte> texte d'appairage de la centrale (par d\xE9faut : entr\xE9e standard)\n --label <nom> comment cette machine appara\xEEt dans le bureau\n --codex-wait installe les hooks Codex et attend votre r\xE9ponse\n\nOptions globales\xA0:\n --help, -h affiche cette aide\n --version, -v affiche la version install\xE9e",
11084
+ 'Uso: busybits <comando> [op\xE7\xF5es]\n\nComandos:\n setup instala ou atualiza as extens\xF5es e servi\xE7os do Busybits\n start inicia o servidor em primeiro plano\n status mostra o estado da instala\xE7\xE3o e dos servi\xE7os\n update atualiza o Busybits para a vers\xE3o mais recente\n uninstall remove extens\xF5es e servi\xE7os instalados\n pair emparelha esta m\xE1quina como sat\xE9lite de um Busybits central\n post deixa um item na mesa do seu escrit\xF3rio (a caixa de entrada)\n\nOp\xE7\xF5es de setup:\n --service instala e inicia o servi\xE7o de usu\xE1rio (systemd/launchd)\n --port <n> porta do servidor\n --no-claude n\xE3o mexe no Claude Code\n --no-pi n\xE3o mexe no Pi\n --no-codex n\xE3o mexe nos hooks do Codex\n --dry-run s\xF3 mostra o que seria feito\n --after-update usado por "busybits update": reinicia o servi\xE7o mesmo sem mudan\xE7a na unidade\n --rebuild refaz o build (instala\xE7\xE3o a partir de um clone)\n --ignore-node ignora a verifica\xE7\xE3o da vers\xE3o do Node\n\nOp\xE7\xF5es de update:\n --check s\xF3 mostra a vers\xE3o atual e a mais recente\n --rollback volta para a vers\xE3o anterior\n --to <vers\xE3o> atualiza para essa vers\xE3o em vez da mais recente\n --global atualiza tamb\xE9m o busybits global (npm i -g)\n\nOp\xE7\xF5es de uninstall:\n --purge apaga tamb\xE9m os dados do Busybits\n --dry-run s\xF3 mostra o que seria feito\n\nOp\xE7\xF5es de pair:\n --pairing <texto> texto de pareamento da central (padr\xE3o: entrada padr\xE3o)\n --label <nome> como esta m\xE1quina aparece no escrit\xF3rio\n --codex-wait instala os hooks do Codex com espera pela sua resposta\n\nOp\xE7\xF5es de post:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio)\n --body <texto> detalhes em texto simples\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item (e o reabre se estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nOp\xE7\xF5es globais:\n --help, -h mostra esta ajuda\n --version, -v mostra a vers\xE3o instalada': "Utilisation\xA0: busybits <commande> [options]\n\nCommandes\xA0:\n setup installe ou met \xE0 jour les extensions et services Busybits\n start d\xE9marre le serveur au premier plan\n status affiche l'\xE9tat de l'installation et des services\n update met \xE0 jour Busybits vers la derni\xE8re version\n uninstall supprime les extensions et services install\xE9s\n pair associe cette machine comme satellite d'un Busybits central\n post d\xE9pose un \xE9l\xE9ment sur le bureau de votre bureau (la bo\xEEte de r\xE9ception)\n\nOptions de setup :\n --service installe et d\xE9marre le service utilisateur (systemd/launchd)\n --port <n> port du serveur\n --no-claude ne touche pas \xE0 Claude Code\n --no-pi ne touche pas \xE0 Pi\n --no-codex ne touche pas aux hooks Codex\n --dry-run montre seulement ce qui serait fait\n --after-update utilis\xE9 par \xAB busybits update \xBB : red\xE9marre le service m\xEAme si l'unit\xE9 n'a pas chang\xE9\n --rebuild recompile (installation depuis un clone)\n --ignore-node ignore la v\xE9rification de la version de Node\n\nOptions de update :\n --check affiche seulement la version actuelle et la derni\xE8re\n --rollback revient \xE0 la version pr\xE9c\xE9dente\n --to <version> met \xE0 jour vers cette version au lieu de la derni\xE8re\n --global met aussi \xE0 jour le busybits global (npm i -g)\n\nOptions de uninstall :\n --purge supprime aussi les donn\xE9es de Busybits\n --dry-run montre seulement ce qui serait fait\n\nOptions de pair :\n --pairing <texte> texte d'appairage de la centrale (par d\xE9faut : entr\xE9e standard)\n --label <nom> comment cette machine appara\xEEt dans le bureau\n --codex-wait installe les hooks Codex et attend votre r\xE9ponse\n\nOptions de post :\n --title <texte> titre de l'\xE9l\xE9ment (obligatoire)\n --body <texte> d\xE9tails en texte simple\n --link <url> lien http(s) que l'\xE9l\xE9ment ouvre\n --key <cl\xE9> la m\xEAme cl\xE9 met \xE0 jour l'\xE9l\xE9ment (et le rouvre s'il \xE9tait r\xE9solu)\n --source <nom> qui d\xE9pose l'\xE9l\xE9ment (affich\xE9 quand ce n'est pas un agent)\n\nOptions globales\xA0:\n --help, -h affiche cette aide\n --version, -v affiche la version install\xE9e",
10992
11085
  "No Windows, use scripts/windows/install-satellite.ps1 a partir de um clone (o busybits ainda n\xE3o instala servi\xE7o no Windows).": "Sous Windows, utilisez scripts/windows/install-satellite.ps1 depuis un clone (busybits n'installe pas encore de service sous Windows).",
10993
11086
  "comando desconhecido: {0}": "commande inconnue\xA0: {0}",
10994
11087
  "{0} precisa de um valor": "{0} n\xE9cessite une valeur",
@@ -11012,7 +11105,58 @@ var FR = {
11012
11105
  "Voltei para a v{0}.": "Retour \xE0 la v{0}.",
11013
11106
  "a vers\xE3o {0} n\xE3o tem um payload completo em {1}": "la version {0} n'a pas de payload complet dans {1}",
11014
11107
  "O Busybits precisa do Node 22.12+ ou 24, e nenhum foi encontrado. Instale um (por exemplo com o nvm: nvm install 24) e rode de novo.": "Busybits a besoin de Node 22.12+ ou 24, et aucun n'a \xE9t\xE9 trouv\xE9. Installez-en un (par exemple avec nvm : nvm install 24) et relancez.",
11015
- "servi\xE7o antigo {0} removido": "ancien service {0} supprim\xE9"
11108
+ "servi\xE7o antigo {0} removido": "ancien service {0} supprim\xE9",
11109
+ "os itens da mesa s\xF3 s\xE3o resolvidos pelo pr\xF3prio computador (http://localhost ou http://127.0.0.1)": "les \xE9l\xE9ments du bureau ne se r\xE9solvent que depuis l'ordinateur lui-m\xEAme (http://localhost ou http://127.0.0.1)",
11110
+ "s\xF3 o pr\xF3prio computador deixa itens na mesa (http://localhost ou http://127.0.0.1)": "seul l'ordinateur lui-m\xEAme d\xE9pose des \xE9l\xE9ments sur le bureau (http://localhost ou http://127.0.0.1)",
11111
+ "a mesa s\xF3 vale pelo pr\xF3prio computador ou pelo acesso remoto com login": "le bureau ne fonctionne que depuis l'ordinateur lui-m\xEAme ou par l'acc\xE8s \xE0 distance avec connexion",
11112
+ "a mesa j\xE1 tem {0} itens abertos: resolva alguns antes de deixar outros": "le bureau a d\xE9j\xE0 {0} \xE9l\xE9ments ouverts : r\xE9solvez-en avant d'en d\xE9poser d'autres",
11113
+ "item n\xE3o encontrado": "\xE9l\xE9ment introuvable",
11114
+ "inbox.json ileg\xEDvel ({0}); come\xE7ando sem itens.": "inbox.json illisible ({0}) ; d\xE9marrage sans \xE9l\xE9ments.",
11115
+ "corpo inv\xE1lido": "corps invalide",
11116
+ "t\xEDtulo obrigat\xF3rio": "titre obligatoire",
11117
+ "t\xEDtulo longo demais (m\xE1x. {0} caracteres)": "titre trop long (max {0} caract\xE8res)",
11118
+ "texto inv\xE1lido": "texte invalide",
11119
+ "texto longo demais (m\xE1x. {0} KB)": "texte trop long (max {0} Ko)",
11120
+ "link inv\xE1lido": "lien invalide",
11121
+ "o link precisa ser http ou https": "le lien doit \xEAtre http ou https",
11122
+ "chave inv\xE1lida": "cl\xE9 invalide",
11123
+ "chave longa demais (m\xE1x. {0} caracteres)": "cl\xE9 trop longue (max {0} caract\xE8res)",
11124
+ "origem inv\xE1lida": "source invalide",
11125
+ "ancestrais inv\xE1lidos": "anc\xEAtres invalides",
11126
+ 'Uso: busybits post --title <texto> [op\xE7\xF5es]\n\nDeixa um item na mesa do seu escrit\xF3rio (o painel "Mesa" abre ao clicar no monte de pap\xE9is).\n\nOp\xE7\xF5es:\n --title <texto> t\xEDtulo do item (obrigat\xF3rio, at\xE9 200 caracteres)\n --body <texto> detalhes em texto simples (at\xE9 8 KB)\n --link <url> link http(s) que o item abre\n --key <chave> a mesma chave atualiza o item em vez de duplicar (e o reabre se j\xE1 estava resolvido)\n --source <nome> quem est\xE1 deixando o item (aparece quando n\xE3o \xE9 um agente)\n\nExemplo:\n busybits post --title "ROO7-1234 rejeitado no QA" --link https://example.com/ROO7-1234 --key ROO7-1234': `Utilisation : busybits post --title <texte> [options]
11127
+
11128
+ D\xE9pose un \xE9l\xE9ment sur le bureau de votre bureau (le panneau \xAB Bureau \xBB s'ouvre en cliquant sur la pile de papiers).
11129
+
11130
+ Options :
11131
+ --title <texte> titre de l'\xE9l\xE9ment (obligatoire, jusqu'\xE0 200 caract\xE8res)
11132
+ --body <texte> d\xE9tails en texte simple (jusqu'\xE0 8 Ko)
11133
+ --link <url> lien http(s) que l'\xE9l\xE9ment ouvre
11134
+ --key <cl\xE9> la m\xEAme cl\xE9 met \xE0 jour l'\xE9l\xE9ment au lieu de le dupliquer (et le rouvre s'il \xE9tait d\xE9j\xE0 r\xE9solu)
11135
+ --source <nom> qui d\xE9pose l'\xE9l\xE9ment (affich\xE9 quand ce n'est pas un agent)
11136
+
11137
+ Exemple :
11138
+ busybits post --title "ROO7-1234 rejet\xE9 en QA" --link https://example.com/ROO7-1234 --key ROO7-1234`,
11139
+ "falta --title": "--title manquant",
11140
+ "N\xE3o consegui falar com o Busybits na porta {0}. Ele est\xE1 rodando? (busybits start; outra porta: HABBLAUD_PORT)": "Impossible de joindre Busybits sur le port {0}. Est-il lanc\xE9 ? (busybits start ; autre port : HABBLAUD_PORT)",
11141
+ "O Busybits recusou o item ({0}): {1}": "Busybits a refus\xE9 l'\xE9l\xE9ment ({0}) : {1}",
11142
+ "Item reaberto na mesa: {0}": "\xC9l\xE9ment rouvert sur le bureau : {0}",
11143
+ "Item atualizado na mesa: {0}": "\xC9l\xE9ment mis \xE0 jour sur le bureau : {0}",
11144
+ "Item deixado na mesa: {0}": "\xC9l\xE9ment d\xE9pos\xE9 sur le bureau : {0}",
11145
+ "A mesa s\xF3 funciona com o escrit\xF3rio ao vivo.": "Le bureau ne fonctionne qu'avec le bureau en direct.",
11146
+ "N\xE3o foi poss\xEDvel resolver o item (erro {0}).": "Impossible de r\xE9soudre l'\xE9l\xE9ment (erreur {0}).",
11147
+ "um agente": "un agent",
11148
+ "um script": "un script",
11149
+ "resolvido {0}": "r\xE9solu {0}",
11150
+ "de {0}": "de {0}",
11151
+ "Resolver": "R\xE9soudre",
11152
+ "Nada por aqui.": "Rien ici.",
11153
+ "Sua mesa est\xE1 limpa: nada esperando.": "Votre bureau est d\xE9gag\xE9 : rien en attente.",
11154
+ "Ocultar resolvidos": "Masquer les r\xE9solus",
11155
+ "Mostrar resolvidos ({0})": "Afficher les r\xE9solus ({0})",
11156
+ "Itens deixados na sua mesa. Clique para abrir.": "\xC9l\xE9ments laiss\xE9s sur votre bureau. Cliquez pour ouvrir.",
11157
+ "na mesa": "sur le bureau",
11158
+ "Na sua mesa": "Sur votre bureau",
11159
+ "Mensageiro": "Coursier"
11016
11160
  };
11017
11161
 
11018
11162
  // shared/locales/all.ts
@@ -11204,10 +11348,10 @@ var ALIAS_TOOLS = {
11204
11348
  dir: /\bCODEX_HOME=(?:"([^"]*)"|'([^']*)'|([^\s;&|]+))/
11205
11349
  }
11206
11350
  };
11207
- function parseToolAliases(text2, home, tool) {
11351
+ function parseToolAliases(text3, home, tool) {
11208
11352
  const { invokes, dir: dirRe } = ALIAS_TOOLS[tool];
11209
11353
  const out = [];
11210
- for (const line2 of text2.split(/\r?\n/)) {
11354
+ for (const line2 of text3.split(/\r?\n/)) {
11211
11355
  const m = ALIAS_RE.exec(line2);
11212
11356
  if (!m) continue;
11213
11357
  const body2 = m[2] ?? m[3]?.replace(/\\(.)/g, "$1") ?? "";
@@ -12052,12 +12196,12 @@ function readBody(req, max = 8 * 1024) {
12052
12196
  });
12053
12197
  }
12054
12198
  var CA_PATH = "/remote/ca.crt";
12055
- function esc(text2) {
12056
- return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
12199
+ function esc(text3) {
12200
+ return text3.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
12057
12201
  }
12058
12202
  function loginPage(opts) {
12059
12203
  const ca = opts.caDownload ? `<p class="ca">${esc(tr("Primeira vez neste celular?"))} <a href="${CA_PATH}" download="habblaud-ca.crt">${esc(tr("Instale o certificado do Habblaud"))}</a> ${esc(tr("para tirar o aviso de seguran\xE7a (confira a impress\xE3o digital que o npm run remote:setup mostrou)."))}</p>` : "";
12060
- const js = (text2) => JSON.stringify(text2).replace(/</g, "\\u003c");
12204
+ const js = (text3) => JSON.stringify(text3).replace(/</g, "\\u003c");
12061
12205
  return `<!doctype html>
12062
12206
  <html lang="${getLocale()}">
12063
12207
  <head>
@@ -12417,6 +12561,11 @@ function namespaceDelivery(machine, d) {
12417
12561
  function namespaceDetail(machine, d) {
12418
12562
  return { ...d, agent: namespaceAgent(machine, d.agent) };
12419
12563
  }
12564
+ function namespaceInboxItem(machine, i) {
12565
+ const out = { ...i, id: pre(machine, i.id), machine };
12566
+ if (i.from.kind === "agent") out.from = { kind: "agent", agentId: pre(machine, i.from.agentId) };
12567
+ return out;
12568
+ }
12420
12569
  function namespaceState(machine, s2) {
12421
12570
  const online = machine.state === "online";
12422
12571
  const id = machine.id;
@@ -12592,9 +12741,9 @@ function userEnvFile(env = process.env, home = env.HOME || homedir3()) {
12592
12741
  if (explicit) return resolve3(explicit.replace(/^~(?=\/|$)/, home));
12593
12742
  return join4(env.XDG_CONFIG_HOME?.trim() || join4(home, ".config"), "habblaud", "env");
12594
12743
  }
12595
- function parseEnvFile(text2) {
12744
+ function parseEnvFile(text3) {
12596
12745
  const out = {};
12597
- for (const raw of text2.split(/\r?\n/)) {
12746
+ for (const raw of text3.split(/\r?\n/)) {
12598
12747
  const line2 = raw.trim().replace(/^export\s+/, "");
12599
12748
  if (!line2 || line2.startsWith("#")) continue;
12600
12749
  const eq = line2.indexOf("=");
@@ -12609,14 +12758,14 @@ function parseEnvFile(text2) {
12609
12758
  }
12610
12759
  function applyUserEnvFile(env = process.env, home = env.HOME || homedir3()) {
12611
12760
  const file = userEnvFile(env, home);
12612
- let text2;
12761
+ let text3;
12613
12762
  try {
12614
- text2 = readFileSync4(file, "utf8");
12763
+ text3 = readFileSync4(file, "utf8");
12615
12764
  } catch {
12616
12765
  return void 0;
12617
12766
  }
12618
12767
  const keys = [];
12619
- for (const [k, v] of Object.entries(parseEnvFile(text2))) {
12768
+ for (const [k, v] of Object.entries(parseEnvFile(text3))) {
12620
12769
  if (env[k] !== void 0) continue;
12621
12770
  env[k] = v;
12622
12771
  keys.push(k);
@@ -12836,11 +12985,11 @@ function domainOf(url) {
12836
12985
  function str3(v) {
12837
12986
  return typeof v === "string" ? v : "";
12838
12987
  }
12839
- function make(kind, icon, text2, detail) {
12988
+ function make(kind, icon, text3, detail) {
12840
12989
  return {
12841
12990
  kind,
12842
12991
  icon,
12843
- text: truncate(maskSecrets(text2.slice(0, MAX_TEXT * 8)), MAX_TEXT),
12992
+ text: truncate(maskSecrets(text3.slice(0, MAX_TEXT * 8)), MAX_TEXT),
12844
12993
  ...detail ? { detail: truncate(maskSecrets(detail.slice(0, MAX_DETAIL * 4)), MAX_DETAIL) } : {}
12845
12994
  };
12846
12995
  }
@@ -13230,9 +13379,9 @@ function describeWords(w, depth) {
13230
13379
  if (!w.length) return void 0;
13231
13380
  const prog = basename3(w[0]);
13232
13381
  const args = w.slice(1);
13233
- const text2 = w.join(" ");
13382
+ const text3 = w.join(" ");
13234
13383
  const mk = (kind, icon, t) => make(kind, icon, t);
13235
- if (/\b(vitest|jest|pytest|phpunit|mocha|ava|rspec)\b|\b(go|cargo|deno|bun)\s+test\b|playwright\s+test|\b(npm|pnpm|yarn|bun)\s+(run\s+)?test\b|\bnode\s+--test\b|-m\s+(pytest|unittest)\b/.test(text2)) {
13384
+ if (/\b(vitest|jest|pytest|phpunit|mocha|ava|rspec)\b|\b(go|cargo|deno|bun)\s+test\b|playwright\s+test|\b(npm|pnpm|yarn|bun)\s+(run\s+)?test\b|\bnode\s+--test\b|-m\s+(pytest|unittest)\b/.test(text3)) {
13236
13385
  return mk("test", "\u{1F9EA}", tr("Rodando testes"));
13237
13386
  }
13238
13387
  if (prog === "git") {
@@ -13243,19 +13392,19 @@ function describeWords(w, depth) {
13243
13392
  return mk("git", icon, t);
13244
13393
  }
13245
13394
  if (prog === "gh") return mk("git", "\u{1F419}", tr("GitHub CLI: gh {0}", [args.slice(0, 2).join(" ")]).trim());
13246
- if (/\b(npm|pnpm|yarn|bun)\s+(i|install|add|ci)\b|\bpip3?\s+install\b|\bbrew\s+install\b|\bcomposer\s+(install|require)\b|\bpoetry\s+(add|install)\b|\bcargo\s+add\b|\bgo\s+get\b|\buv\s+(add|sync|pip\s+install)\b/.test(text2)) {
13395
+ if (/\b(npm|pnpm|yarn|bun)\s+(i|install|add|ci)\b|\bpip3?\s+install\b|\bbrew\s+install\b|\bcomposer\s+(install|require)\b|\bpoetry\s+(add|install)\b|\bcargo\s+add\b|\bgo\s+get\b|\buv\s+(add|sync|pip\s+install)\b/.test(text3)) {
13247
13396
  return mk("run", "\u{1F4E6}", tr("Instalando depend\xEAncias"));
13248
13397
  }
13249
- if (prog === "tsc" && args.includes("--noEmit") || /\b(npm|pnpm|yarn|bun)\s+(run\s+)?(typecheck|type-check|check-types)\b/.test(text2)) {
13398
+ if (prog === "tsc" && args.includes("--noEmit") || /\b(npm|pnpm|yarn|bun)\s+(run\s+)?(typecheck|type-check|check-types)\b/.test(text3)) {
13250
13399
  return mk("run", "\u{1F50D}", tr("Conferindo os tipos (TypeScript)"));
13251
13400
  }
13252
- if (/\b(npm|pnpm|yarn|bun)\s+(run\s+)?build\b|\bvite\s+build\b|^tsc\b|\bwebpack\b|\bcargo\s+build\b|\bgo\s+build\b|^make\b|\bgradle\b|\bmvn\b|\besbuild\b|\brollup\b/.test(text2)) {
13401
+ if (/\b(npm|pnpm|yarn|bun)\s+(run\s+)?build\b|\bvite\s+build\b|^tsc\b|\bwebpack\b|\bcargo\s+build\b|\bgo\s+build\b|^make\b|\bgradle\b|\bmvn\b|\besbuild\b|\brollup\b/.test(text3)) {
13253
13402
  return mk("run", "\u{1F3D7}\uFE0F", tr("Compilando o projeto"));
13254
13403
  }
13255
- if (/\b(npm|pnpm|yarn|bun)\s+(run\s+)?(dev|start|serve|preview)\b|^vite(\s|$)(?!build)|^(next|nuxt|astro)\s+dev\b|^expo\s+start\b|^nodemon\b|^tsx\s+watch\b/.test(text2)) {
13256
- return mk("run", "\u25B6\uFE0F", /\bpreview\b/.test(text2) ? tr("Subindo o preview do build") : tr("Subindo o servidor de dev"));
13404
+ if (/\b(npm|pnpm|yarn|bun)\s+(run\s+)?(dev|start|serve|preview)\b|^vite(\s|$)(?!build)|^(next|nuxt|astro)\s+dev\b|^expo\s+start\b|^nodemon\b|^tsx\s+watch\b/.test(text3)) {
13405
+ return mk("run", "\u25B6\uFE0F", /\bpreview\b/.test(text3) ? tr("Subindo o preview do build") : tr("Subindo o servidor de dev"));
13257
13406
  }
13258
- if (/\b(eslint|prettier|ruff|black|biome|rubocop|phpcs|stylelint|oxlint)\b|\b(npm|pnpm|yarn)\s+(run\s+)?(lint|format)\b/.test(text2)) {
13407
+ if (/\b(eslint|prettier|ruff|black|biome|rubocop|phpcs|stylelint|oxlint)\b|\b(npm|pnpm|yarn)\s+(run\s+)?(lint|format)\b/.test(text3)) {
13259
13408
  return mk("run", "\u{1F9F9}", tr("Rodando o linter"));
13260
13409
  }
13261
13410
  if (/^(npm|pnpm|yarn|bun)$/.test(prog) && args[0] === "run" && args[1]) return mk("run", "\u25B6\uFE0F", tr("Rodando o script {0}", [args[1]]));
@@ -13328,8 +13477,8 @@ function describeWords(w, depth) {
13328
13477
  if (/^(\.{0,2}\/|~\/)/.test(w[0]) || /\.(sh|bash|zsh|py|rb|mjs|js|ts)$/.test(w[0])) return mk("run", "\u25B6\uFE0F", tr("Executando {0}", [prog]));
13329
13478
  return void 0;
13330
13479
  }
13331
- function describeLine(text2, depth) {
13332
- const lines = text2.replace(/\\\r?\n/g, " ").split(/\r?\n/);
13480
+ function describeLine(text3, depth) {
13481
+ const lines = text3.replace(/\\\r?\n/g, " ").split(/\r?\n/);
13333
13482
  for (let li = 0; li < lines.length; li++) {
13334
13483
  const line2 = lines[li].trim();
13335
13484
  if (!line2 || line2.startsWith("#")) continue;
@@ -13378,8 +13527,8 @@ function describeCommand(command, description) {
13378
13527
  const desc = description?.trim();
13379
13528
  if (desc && looksPortuguese(desc)) return make("run", "\u{1F4BB}", desc, detail);
13380
13529
  const prog = basename3(found.prog ?? "");
13381
- const text2 = /^[A-Za-z][\w.+-]{0,23}$/.test(prog) ? tr("Rodando {0}", [prog]) : tr("Rodando um comando no terminal");
13382
- return make("run", "\u{1F4BB}", text2, desc ? `${desc} \u2014 ${detail}` : detail);
13530
+ const text3 = /^[A-Za-z][\w.+-]{0,23}$/.test(prog) ? tr("Rodando {0}", [prog]) : tr("Rodando um comando no terminal");
13531
+ return make("run", "\u{1F4BB}", text3, desc ? `${desc} \u2014 ${detail}` : detail);
13383
13532
  }
13384
13533
  function humanize(id) {
13385
13534
  return id.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").trim().toLowerCase();
@@ -13515,8 +13664,8 @@ function describeTool(name, rawInput) {
13515
13664
  return make("other", "\u{1F6E0}\uFE0F", tr("Usando {0}", [name]));
13516
13665
  }
13517
13666
  }
13518
- function describePrompt(text2) {
13519
- return make("prompt", "\u{1F4E8}", tr("Nova tarefa: \u201C{0}\u201D", [truncate(text2, 30)]), text2);
13667
+ function describePrompt(text3) {
13668
+ return make("prompt", "\u{1F4E8}", tr("Nova tarefa: \u201C{0}\u201D", [truncate(text3, 30)]), text3);
13520
13669
  }
13521
13670
  function formatDuration(ms) {
13522
13671
  const s2 = Math.round(ms / 1e3);
@@ -13548,7 +13697,7 @@ function fitLabel(prefix, label, suffix = "") {
13548
13697
  }
13549
13698
  var SPECIAL = {
13550
13699
  think: () => make("think", "\u{1F4AD}", tr("Pensando\u2026")),
13551
- respond: (text2) => make("respond", "\u{1F4AC}", tr("Escrevendo a resposta"), text2),
13700
+ respond: (text3) => make("respond", "\u{1F4AC}", tr("Escrevendo a resposta"), text3),
13552
13701
  turnDone: (ms) => make("done", "\u2705", ms ? tr("Concluiu em {0}", [formatDuration(ms)]) : tr("Concluiu")),
13553
13702
  error: (tool, detail) => make("error", "\u26A0\uFE0F", tool ? tr("Erro em {0}", [tool]) : tr("Algo deu errado"), detail),
13554
13703
  interrupted: () => make("wait", "\u270B", tr("Interrompido por voc\xEA")),
@@ -13654,9 +13803,9 @@ function readSubagentMeta(metaPath) {
13654
13803
  }
13655
13804
  }
13656
13805
  var JOURNAL_DONE = /^(completed?|finished|done|failed|errored|error|killed|cancell?ed|stopped|succeeded|result)$/i;
13657
- function parseJournal(text2) {
13806
+ function parseJournal(text3) {
13658
13807
  const out = /* @__PURE__ */ new Map();
13659
- for (const line2 of text2.split("\n")) {
13808
+ for (const line2 of text3.split("\n")) {
13660
13809
  if (!line2.trim()) continue;
13661
13810
  let j;
13662
13811
  try {
@@ -13959,8 +14108,8 @@ function scriptSegments(command) {
13959
14108
  let q = null;
13960
14109
  let depth = 0;
13961
14110
  const cut3 = (end, next) => {
13962
- const text2 = src.slice(start, end).trim();
13963
- if (text2) segs.push({ words: shellWords(text2), next });
14111
+ const text3 = src.slice(start, end).trim();
14112
+ if (text3) segs.push({ words: shellWords(text3), next });
13964
14113
  else if (segs.length && next) segs[segs.length - 1].next = next;
13965
14114
  };
13966
14115
  for (let i = 0; i < src.length; i++) {
@@ -14173,8 +14322,8 @@ function ciFromJson(j) {
14173
14322
  }
14174
14323
  return void 0;
14175
14324
  }
14176
- function parseJson(text2) {
14177
- const t = text2.trim();
14325
+ function parseJson(text3) {
14326
+ const t = text3.trim();
14178
14327
  if (!t || t[0] !== "{" && t[0] !== "[" || t.length > 2e5) return void 0;
14179
14328
  try {
14180
14329
  return JSON.parse(t);
@@ -14182,10 +14331,10 @@ function parseJson(text2) {
14182
14331
  return void 0;
14183
14332
  }
14184
14333
  }
14185
- function ciFromText(text2, ops) {
14334
+ function ciFromText(text3, ops) {
14186
14335
  const run3 = ops.includes("run_watch") || ops.includes("run_view");
14187
14336
  if (run3) {
14188
- const h = RUN_HEADER.exec(text2);
14337
+ const h = RUN_HEADER.exec(text3);
14189
14338
  if (h?.[1] === "*") return "pending";
14190
14339
  if (h) {
14191
14340
  const r = { result: h[1] === "\u2713" || h[1] === "\u2714" ? "passed" : "failed", branch: h[2] };
@@ -14193,14 +14342,14 @@ function ciFromText(text2, ops) {
14193
14342
  if (wf) r.workflow = wf;
14194
14343
  return r;
14195
14344
  }
14196
- const d = RUN_DONE.exec(text2);
14345
+ const d = RUN_DONE.exec(text3);
14197
14346
  const c = d ? conclusion(d[2]) : void 0;
14198
14347
  if (d && c) return { result: c, workflow: d[1].slice(0, 40) };
14199
14348
  }
14200
- const whole = parseJson(text2);
14349
+ const whole = parseJson(text3);
14201
14350
  const fromWhole = whole === void 0 ? void 0 : ciFromJson(whole);
14202
14351
  if (fromWhole) return fromWhole;
14203
- const lines = text2.split("\n").map((l) => l.trim()).filter(Boolean);
14352
+ const lines = text3.split("\n").map((l) => l.trim()).filter(Boolean);
14204
14353
  if (run3) {
14205
14354
  for (const l of lines.slice(0, 20)) {
14206
14355
  const j = parseJson(l);
@@ -14213,16 +14362,16 @@ function ciFromText(text2, ops) {
14213
14362
  if (c && ops.includes("run_view")) return { result: c };
14214
14363
  }
14215
14364
  if (ops.includes("pr_checks")) {
14216
- if (/\bAll checks were successful\b/.test(text2)) return { result: "passed" };
14217
- if (/\bSome checks were not successful\b/.test(text2) || /\b[1-9]\d* failing\b/.test(text2)) return { result: "failed" };
14218
- if (/\bSome checks are still pending\b/.test(text2)) return "pending";
14365
+ if (/\bAll checks were successful\b/.test(text3)) return { result: "passed" };
14366
+ if (/\bSome checks were not successful\b/.test(text3) || /\b[1-9]\d* failing\b/.test(text3)) return { result: "failed" };
14367
+ if (/\bSome checks are still pending\b/.test(text3)) return "pending";
14219
14368
  const states = lines.map((l) => /^(.+?)\t(pass|fail|pending|skipping|cancel)\t/.exec(l)).filter((m) => !!m).map((m) => ({ name: m[1], state: m[2] }));
14220
14369
  return aggregateChecks(states);
14221
14370
  }
14222
14371
  return void 0;
14223
14372
  }
14224
- function exitCodeOf(text2) {
14225
- const m = /^Exit code (\d+)/.exec(text2.trimStart());
14373
+ function exitCodeOf(text3) {
14374
+ const m = /^Exit code (\d+)/.exec(text3.trimStart());
14226
14375
  return m ? Number(m[1]) : void 0;
14227
14376
  }
14228
14377
  function ciFromExit(call2, code2) {
@@ -14266,41 +14415,41 @@ function gitOperationEvent(call2, tur) {
14266
14415
  return void 0;
14267
14416
  }
14268
14417
  function detectGitHubResult(call2, r) {
14269
- let text2 = textOf(r.content);
14270
- if (!text2 && typeof r.tur.stdout === "string") text2 = `${r.tur.stdout}
14418
+ let text3 = textOf(r.content);
14419
+ if (!text3 && typeof r.tur.stdout === "string") text3 = `${r.tur.stdout}
14271
14420
  ${typeof r.tur.stderr === "string" ? r.tur.stderr : ""}`;
14272
- text2 = text2.slice(0, 2e5);
14421
+ text3 = text3.slice(0, 2e5);
14273
14422
  const ops = call2.ops;
14274
- if (call2.tool !== "Bash") return mcpEvent(call2, text2, r.isError, r.branch);
14423
+ if (call2.tool !== "Bash") return mcpEvent(call2, text3, r.isError, r.branch);
14275
14424
  if (!r.isError) {
14276
14425
  const fromOp = gitOperationEvent(call2, r.tur);
14277
14426
  if (fromOp) return fromOp;
14278
14427
  }
14279
- if (ops.includes("pr_merge") && !call2.auto && !r.isError && !MERGE_FAIL.test(text2)) {
14428
+ if (ops.includes("pr_merge") && !call2.auto && !r.isError && !MERGE_FAIL.test(text3)) {
14280
14429
  const ev = { kind: "pr_merged" };
14281
- const n2 = call2.number ?? num2(/\bpull request (?:[\w.-]+\/[\w.-]+)?#(\d+)/i.exec(text2)?.[1]);
14430
+ const n2 = call2.number ?? num2(/\bpull request (?:[\w.-]+\/[\w.-]+)?#(\d+)/i.exec(text3)?.[1]);
14282
14431
  if (n2 !== void 0) ev.number = n2;
14283
14432
  if (call2.repo) ev.repo = call2.repo;
14284
14433
  return ev;
14285
14434
  }
14286
- if (ops.includes("pr_create") && !r.isError && !PR_EXISTS.test(text2)) {
14287
- const urls = [...text2.matchAll(PR_URL)];
14435
+ if (ops.includes("pr_create") && !r.isError && !PR_EXISTS.test(text3)) {
14436
+ const urls = [...text3.matchAll(PR_URL)];
14288
14437
  const m = urls.at(-1);
14289
14438
  if (m) return { kind: "pr_opened", number: Number(m[2]), repo: m[1], url: m[0] };
14290
14439
  }
14291
14440
  if (ops.includes("release_create") && !call2.draft && !r.isError) {
14292
- const m = RELEASE_URL.exec(text2);
14441
+ const m = RELEASE_URL.exec(text3);
14293
14442
  if (m && !m[2].startsWith("untagged-")) return { kind: "release", tag: safeDecode(m[2]).slice(0, 60), repo: m[1], url: m[0] };
14294
14443
  }
14295
14444
  if (ops.some((o) => o === "run_watch" || o === "run_view" || o === "pr_checks")) {
14296
- const read = ciFromText(text2, ops);
14297
- const code2 = r.isError ? exitCodeOf(text2) : 0;
14445
+ const read = ciFromText(text3, ops);
14446
+ const code2 = r.isError ? exitCodeOf(text3) : 0;
14298
14447
  const ci = read === "pending" ? void 0 : read ?? (code2 !== void 0 ? ciFromExit(call2, code2) : void 0);
14299
14448
  if (ci) return ciEvent(call2, ci, r.branch);
14300
14449
  }
14301
- if (ops.includes("push") && !call2.noPush && !PUSH_FAIL.test(text2)) {
14302
- const to = PUSH_TO.exec(text2);
14303
- const m = to ? PUSH_OK.exec(text2.slice(to.index)) : null;
14450
+ if (ops.includes("push") && !call2.noPush && !PUSH_FAIL.test(text3)) {
14451
+ const to = PUSH_TO.exec(text3);
14452
+ const m = to ? PUSH_OK.exec(text3.slice(to.index)) : null;
14304
14453
  if (m) return { kind: "push", branch: m[1].replace(/^refs\/heads\//, "") };
14305
14454
  }
14306
14455
  return void 0;
@@ -14312,13 +14461,13 @@ function safeDecode(s2) {
14312
14461
  return s2;
14313
14462
  }
14314
14463
  }
14315
- function mcpEvent(call2, text2, isError, branch) {
14464
+ function mcpEvent(call2, text3, isError, branch) {
14316
14465
  if (isError) return void 0;
14317
14466
  const op = call2.ops[0];
14318
- const j = parseJson(text2);
14467
+ const j = parseJson(text3);
14319
14468
  const o = j && typeof j === "object" && !Array.isArray(j) ? j : void 0;
14320
14469
  if (op === "pr_create") {
14321
- const m = [...text2.matchAll(PR_URL)][0];
14470
+ const m = [...text3.matchAll(PR_URL)][0];
14322
14471
  const n2 = (m ? Number(m[2]) : void 0) ?? num2(o?.number);
14323
14472
  if (n2 === void 0) return void 0;
14324
14473
  const ev = { kind: "pr_opened", number: n2 };
@@ -14328,7 +14477,7 @@ function mcpEvent(call2, text2, isError, branch) {
14328
14477
  return ev;
14329
14478
  }
14330
14479
  if (op === "pr_merge") {
14331
- const merged = o ? o.merged === true : /\bmerged\b/i.test(text2) && !MERGE_FAIL.test(text2);
14480
+ const merged = o ? o.merged === true : /\bmerged\b/i.test(text3) && !MERGE_FAIL.test(text3);
14332
14481
  if (!merged) return void 0;
14333
14482
  const ev = { kind: "pr_merged" };
14334
14483
  if (call2.number !== void 0) ev.number = call2.number;
@@ -14708,8 +14857,8 @@ function firstLine(s2, max = 140) {
14708
14857
  const line2 = s2.split("\n").find((l) => l.trim());
14709
14858
  return line2 ? truncate(line2.replace(/<\/?[a-z_-]+>/gi, ""), max) : void 0;
14710
14859
  }
14711
- function parseTaskNotification(text2) {
14712
- const tag = (name) => new RegExp(`<${name}>([\\s\\S]*?)</${name}>`).exec(text2)?.[1]?.trim() || void 0;
14860
+ function parseTaskNotification(text3) {
14861
+ const tag = (name) => new RegExp(`<${name}>([\\s\\S]*?)</${name}>`).exec(text3)?.[1]?.trim() || void 0;
14713
14862
  return {
14714
14863
  taskId: tag("task-id") ?? tag("task_id"),
14715
14864
  toolUseId: tag("tool-use-id") ?? tag("tool_use_id"),
@@ -14929,8 +15078,8 @@ var LineParser = class {
14929
15078
  if (cur?.kind === "think" && (cur.msgId === msgId || this.at - cur.at < 3e4)) return;
14930
15079
  this.push(SPECIAL.think(), { suffix, msgId });
14931
15080
  } else if (b.type === "text") {
14932
- const text2 = str5(b.text);
14933
- if (text2) this.push(SPECIAL.respond(text2), { suffix, msgId });
15081
+ const text3 = str5(b.text);
15082
+ if (text3) this.push(SPECIAL.respond(text3), { suffix, msgId });
14934
15083
  } else if (b.type === "tool_use") {
14935
15084
  this.toolUse(b, suffix, msgId);
14936
15085
  }
@@ -15065,15 +15214,15 @@ var LineParser = class {
15065
15214
  this.push(SPECIAL.interrupted(), { suffix: ":int" });
15066
15215
  }
15067
15216
  userText(raw) {
15068
- const text2 = raw.trimStart();
15069
- if (!text2) return;
15070
- if (text2.includes("<task-notification>")) return this.notification(text2, true);
15071
- if (INTERRUPTED.test(text2)) return this.interrupted();
15072
- if (SYSTEM_TAG.test(text2) || text2.startsWith("Caveat:")) return;
15073
- let prompt = text2;
15074
- if (/^<command-(name|message|args)>/.test(text2)) {
15075
- const cmd = /<command-name>([\s\S]*?)<\/command-name>/.exec(text2)?.[1]?.trim();
15076
- const args = /<command-args>([\s\S]*?)<\/command-args>/.exec(text2)?.[1]?.trim() ?? "";
15217
+ const text3 = raw.trimStart();
15218
+ if (!text3) return;
15219
+ if (text3.includes("<task-notification>")) return this.notification(text3, true);
15220
+ if (INTERRUPTED.test(text3)) return this.interrupted();
15221
+ if (SYSTEM_TAG.test(text3) || text3.startsWith("Caveat:")) return;
15222
+ let prompt = text3;
15223
+ if (/^<command-(name|message|args)>/.test(text3)) {
15224
+ const cmd = /<command-name>([\s\S]*?)<\/command-name>/.exec(text3)?.[1]?.trim();
15225
+ const args = /<command-args>([\s\S]*?)<\/command-args>/.exec(text3)?.[1]?.trim() ?? "";
15077
15226
  if (!cmd || LOCAL_COMMANDS.has(cmd)) return;
15078
15227
  prompt = `${cmd} ${args}`.trim();
15079
15228
  }
@@ -15081,8 +15230,8 @@ var LineParser = class {
15081
15230
  this.meta("lastPrompt", truncate(maskSecrets(prompt.slice(0, 1e3)), 200));
15082
15231
  this.push(describePrompt(prompt));
15083
15232
  }
15084
- notification(text2, withActivity) {
15085
- const n2 = parseTaskNotification(text2);
15233
+ notification(text3, withActivity) {
15234
+ const n2 = parseTaskNotification(text3);
15086
15235
  const sig = { type: "notification" };
15087
15236
  if (n2.toolUseId) sig.toolUseId = n2.toolUseId;
15088
15237
  if (n2.taskId) sig.taskId = n2.taskId;
@@ -15192,9 +15341,9 @@ var LineParser = class {
15192
15341
  }
15193
15342
  }
15194
15343
  };
15195
- function forkDirective(text2) {
15196
- const end = text2.lastIndexOf("</fork-boilerplate>");
15197
- const rest = end >= 0 ? text2.slice(end + "</fork-boilerplate>".length) : text2;
15344
+ function forkDirective(text3) {
15345
+ const end = text3.lastIndexOf("</fork-boilerplate>");
15346
+ const rest = end >= 0 ? text3.slice(end + "</fork-boilerplate>".length) : text3;
15198
15347
  return rest.trim().replace(/^your directive:\s*/i, "").trim();
15199
15348
  }
15200
15349
  var PRESCAN_MIN_CHARS = 64 * 1024;
@@ -15399,8 +15548,8 @@ function marked(p) {
15399
15548
  \u2026` : p.text;
15400
15549
  }
15401
15550
  function oneLine(raw, max, reminders = true) {
15402
- const { text: text2, cut: cut3 } = safeText(raw, max * 4 + TAIL_GUARD * 2, reminders);
15403
- const lines = text2.split("\n");
15551
+ const { text: text3, cut: cut3 } = safeText(raw, max * 4 + TAIL_GUARD * 2, reminders);
15552
+ const lines = text3.split("\n");
15404
15553
  const i = lines.findIndex((l) => l.trim());
15405
15554
  if (i < 0) return "";
15406
15555
  const line2 = truncate(lines[i], max);
@@ -15412,10 +15561,10 @@ function lineAndDetail(raw, max = SYSTEM_TEXT_MAX) {
15412
15561
  return line2.endsWith("\u2026") ? { line: line2, detail: raw } : { line: line2 };
15413
15562
  }
15414
15563
  var TAGS = /* @__PURE__ */ new Map();
15415
- function inner(text2, tag) {
15564
+ function inner(text3, tag) {
15416
15565
  let re = TAGS.get(tag);
15417
15566
  if (!re) TAGS.set(tag, re = new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
15418
- return re.exec(text2)?.[1];
15567
+ return re.exec(text3)?.[1];
15419
15568
  }
15420
15569
  function relPath(p, cwd) {
15421
15570
  if (!cwd || !p.startsWith("/")) return p;
@@ -15452,8 +15601,8 @@ function jsonInput(input, omit = [], cwd) {
15452
15601
  }
15453
15602
  return textInput(json, "json");
15454
15603
  }
15455
- function prefixLines(text2, prefix, budget, sourceCut) {
15456
- const src = text2.replace(/\n$/, "");
15604
+ function prefixLines(text3, prefix, budget, sourceCut) {
15605
+ const src = text3.replace(/\n$/, "");
15457
15606
  const out = [];
15458
15607
  let used = 0;
15459
15608
  let start = 0;
@@ -15482,8 +15631,8 @@ function diffText(oldRaw, newRaw, budget = INPUT_MAX) {
15482
15631
  return [oldPart, newPart].filter(Boolean).join("\n");
15483
15632
  }
15484
15633
  function diffInput(oldRaw, newRaw) {
15485
- const text2 = diffText(oldRaw, newRaw);
15486
- return text2 ? { input: text2, inputKind: "diff" } : {};
15634
+ const text3 = diffText(oldRaw, newRaw);
15635
+ return text3 ? { input: text3, inputKind: "diff" } : {};
15487
15636
  }
15488
15637
  var TODO_MARK = { completed: "\u2612", in_progress: "\u25D0", pending: "\u2610" };
15489
15638
  var TASK_STATUS = { completed: tr("conclu\xEDda"), in_progress: tr("em andamento"), pending: "pendente", deleted: "removida" };
@@ -15516,8 +15665,8 @@ function toolView(name, input, cwd) {
15516
15665
  case "MultiEdit": {
15517
15666
  const edits = Array.isArray(input.edits) ? input.edits.map(rec2).filter((e) => !!e) : [];
15518
15667
  const per = Math.max(200, Math.floor(INPUT_MAX / Math.max(1, edits.length)));
15519
- const text2 = edits.slice(0, 12).map((e) => diffText(typeof e.old_string === "string" ? e.old_string : "", typeof e.new_string === "string" ? e.new_string : "", per)).filter(Boolean).join("\n@@\n");
15520
- return { title: titled("MultiEdit", rel2), ...text2 ? { input: marked(clip(text2, INPUT_MAX)), inputKind: "diff" } : {} };
15668
+ const text3 = edits.slice(0, 12).map((e) => diffText(typeof e.old_string === "string" ? e.old_string : "", typeof e.new_string === "string" ? e.new_string : "", per)).filter(Boolean).join("\n@@\n");
15669
+ return { title: titled("MultiEdit", rel2), ...text3 ? { input: marked(clip(text3, INPUT_MAX)), inputKind: "diff" } : {} };
15521
15670
  }
15522
15671
  case "Write":
15523
15672
  return { title: titled("Write", rel2), ...diffInput("", typeof input.content === "string" ? input.content : "") };
@@ -15651,13 +15800,13 @@ var Parser = class {
15651
15800
  }
15652
15801
  // ---------------------------------------------------------------- entradas
15653
15802
  userEntry(c, raw) {
15654
- const text2 = marked(prepare(raw, TEXT_MAX));
15655
- if (text2) this.emit({ kind: "user", id: `${c.uuid}:u`, at: c.at, text: text2 });
15803
+ const text3 = marked(prepare(raw, TEXT_MAX));
15804
+ if (text3) this.emit({ kind: "user", id: `${c.uuid}:u`, at: c.at, text: text3 });
15656
15805
  }
15657
15806
  /** `text` deve vir numa linha só (oneLine) ou ser fixo; a máscara aqui é a última garantia. */
15658
- sys(c, text2, o = {}) {
15659
- if (!text2) return;
15660
- const e = { kind: "system", id: `${c.uuid}${o.suffix ?? ":s"}`, at: c.at, text: maskSecrets(text2), level: o.level ?? "info" };
15807
+ sys(c, text3, o = {}) {
15808
+ if (!text3) return;
15809
+ const e = { kind: "system", id: `${c.uuid}${o.suffix ?? ":s"}`, at: c.at, text: maskSecrets(text3), level: o.level ?? "info" };
15661
15810
  if (o.turnDone) {
15662
15811
  e.turnDone = true;
15663
15812
  e.doneLabel = tr("pronto {0}", ["{0}"]);
@@ -15680,8 +15829,8 @@ var Parser = class {
15680
15829
  if (j.isMeta === true) return;
15681
15830
  const content = rec2(j.message)?.content;
15682
15831
  if (j.isCompactSummary === true) {
15683
- const text2 = typeof content === "string" ? content : resultText(content);
15684
- this.sys(c, tr("Resumo da conversa compactada"), { detail: text2 });
15832
+ const text3 = typeof content === "string" ? content : resultText(content);
15833
+ this.sys(c, tr("Resumo da conversa compactada"), { detail: text3 });
15685
15834
  return;
15686
15835
  }
15687
15836
  if (typeof content === "string") return this.userText(c, content);
@@ -15709,59 +15858,59 @@ var Parser = class {
15709
15858
  if (texts.length || images && !results) this.userText(c, texts.join("\n"), results ? 0 : images);
15710
15859
  }
15711
15860
  userText(c, raw, images = 0) {
15712
- const text2 = (raw.includes("<system-reminder>") ? raw.replace(REMINDER, "") : raw).trim();
15861
+ const text3 = (raw.includes("<system-reminder>") ? raw.replace(REMINDER, "") : raw).trim();
15713
15862
  const pics = images ? Array.from({ length: Math.min(images, 10) }, () => tr("[imagem]")).join(" ") : "";
15714
- if (!text2) {
15863
+ if (!text3) {
15715
15864
  if (pics) this.userEntry(c, pics);
15716
15865
  return;
15717
15866
  }
15718
- if (text2.startsWith("<task-notification>")) return this.notification(c, text2);
15719
- if (INTERRUPTED2.test(text2)) return this.sys(c, tr("Interrompido pelo usu\xE1rio"), { level: "warn" });
15720
- if (text2.startsWith("Caveat:")) return;
15721
- const tag = /^<([a-z][\w-]*)/.exec(text2)?.[1];
15867
+ if (text3.startsWith("<task-notification>")) return this.notification(c, text3);
15868
+ if (INTERRUPTED2.test(text3)) return this.sys(c, tr("Interrompido pelo usu\xE1rio"), { level: "warn" });
15869
+ if (text3.startsWith("Caveat:")) return;
15870
+ const tag = /^<([a-z][\w-]*)/.exec(text3)?.[1];
15722
15871
  switch (tag) {
15723
15872
  case "command-name":
15724
15873
  case "command-message":
15725
15874
  case "command-args": {
15726
- const msg = inner(text2, "command-message")?.trim();
15727
- const name = inner(text2, "command-name")?.trim() || (msg ? `/${msg}` : void 0);
15875
+ const msg = inner(text3, "command-message")?.trim();
15876
+ const name = inner(text3, "command-name")?.trim() || (msg ? `/${msg}` : void 0);
15728
15877
  if (!name) return;
15729
15878
  const cmd = name.startsWith("/") ? name : `/${name}`;
15730
15879
  this.lastCommand = cmd;
15731
- this.userEntry(c, `${cmd} ${inner(text2, "command-args")?.trim() ?? ""}`.trim());
15880
+ this.userEntry(c, `${cmd} ${inner(text3, "command-args")?.trim() ?? ""}`.trim());
15732
15881
  return;
15733
15882
  }
15734
15883
  case "local-command-stdout":
15735
15884
  case "local-command-stderr":
15736
15885
  case "command-stdout":
15737
15886
  case "command-stderr": {
15738
- const out = OUTPUT_TAGS.map((t) => inner(text2, t)?.trim()).filter(Boolean).join("\n");
15887
+ const out = OUTPUT_TAGS.map((t) => inner(text3, t)?.trim()).filter(Boolean).join("\n");
15739
15888
  if (out) this.sys(c, this.lastCommand ? tr("Sa\xEDda de {0}", [this.lastCommand]) : tr("Sa\xEDda do comando"), { detail: out });
15740
15889
  return;
15741
15890
  }
15742
15891
  case "bash-input": {
15743
- const cmd = inner(text2, "bash-input")?.trim();
15892
+ const cmd = inner(text3, "bash-input")?.trim();
15744
15893
  if (cmd) this.userEntry(c, `! ${cmd}`);
15745
15894
  return;
15746
15895
  }
15747
15896
  case "bash-stdout":
15748
15897
  case "bash-stderr": {
15749
- const out = [inner(text2, "bash-stdout"), inner(text2, "bash-stderr")].map((x) => x?.trim()).filter(Boolean).join("\n");
15898
+ const out = [inner(text3, "bash-stdout"), inner(text3, "bash-stderr")].map((x) => x?.trim()).filter(Boolean).join("\n");
15750
15899
  this.sys(c, tr("Sa\xEDda do comando"), { detail: out || tr("(sem sa\xEDda)") });
15751
15900
  return;
15752
15901
  }
15753
15902
  case "scheduled-task": {
15754
- const body2 = text2.replace(/^<scheduled-task\b[^>]*>/, "").replace(/<\/scheduled-task>\s*$/, "");
15903
+ const body2 = text3.replace(/^<scheduled-task\b[^>]*>/, "").replace(/<\/scheduled-task>\s*$/, "");
15755
15904
  if (body2.trim()) this.userEntry(c, body2);
15756
15905
  return;
15757
15906
  }
15758
15907
  case "fork-boilerplate": {
15759
- const directive = forkDirective(text2);
15908
+ const directive = forkDirective(text3);
15760
15909
  if (directive) this.userEntry(c, directive);
15761
15910
  return;
15762
15911
  }
15763
15912
  case "user-memory-input": {
15764
- const memory = inner(text2, "user-memory-input")?.trim();
15913
+ const memory = inner(text3, "user-memory-input")?.trim();
15765
15914
  if (memory) this.userEntry(c, `# ${memory}`);
15766
15915
  return;
15767
15916
  }
@@ -15771,14 +15920,14 @@ var Parser = class {
15771
15920
  default:
15772
15921
  break;
15773
15922
  }
15774
- this.userEntry(c, pics && !/\[Image\b/.test(text2) ? `${text2}
15775
- ${pics}` : text2);
15923
+ this.userEntry(c, pics && !/\[Image\b/.test(text3) ? `${text3}
15924
+ ${pics}` : text3);
15776
15925
  }
15777
- notification(c, text2) {
15778
- const n2 = parseTaskNotification(text2);
15926
+ notification(c, text3) {
15927
+ const n2 = parseTaskNotification(text3);
15779
15928
  const status2 = n2.status?.toLowerCase();
15780
- const result = inner(text2, "result")?.trim();
15781
- const event = inner(text2, "event")?.trim();
15929
+ const result = inner(text3, "result")?.trim();
15930
+ const event = inner(text3, "event")?.trim();
15782
15931
  let label = tr("Notifica\xE7\xE3o de tarefa em segundo plano");
15783
15932
  let level = "info";
15784
15933
  if (status2 === "completed") label = tr("Tarefa em segundo plano conclu\xEDda");
@@ -15837,8 +15986,8 @@ ${pics}` : text2);
15837
15986
  }
15838
15987
  const synthetic = m.model === "<synthetic>";
15839
15988
  if (c.j.isApiErrorMessage === true || synthetic && str6(c.j.error)) {
15840
- const text2 = blocks.map((b) => rec2(b)?.text).filter((t) => typeof t === "string").join("\n");
15841
- return this.sysContent(c, text2 || tr("Erro da API"), "error");
15989
+ const text3 = blocks.map((b) => rec2(b)?.text).filter((t) => typeof t === "string").join("\n");
15990
+ return this.sysContent(c, text3 || tr("Erro da API"), "error");
15842
15991
  }
15843
15992
  const msgId = str6(m.id) ?? c.uuid;
15844
15993
  blocks.forEach((raw, i) => {
@@ -15853,8 +16002,8 @@ ${pics}` : text2);
15853
16002
  if (!NO_RESPONSE.test(t.trim())) this.sysContent(c, t, "info", void 0, `:${i}`);
15854
16003
  return;
15855
16004
  }
15856
- const text2 = marked(prepare(t, TEXT_MAX));
15857
- if (text2) this.emit({ kind: "assistant", id, at: c.at, text: text2 });
16005
+ const text3 = marked(prepare(t, TEXT_MAX));
16006
+ if (text3) this.emit({ kind: "assistant", id, at: c.at, text: text3 });
15858
16007
  return;
15859
16008
  }
15860
16009
  case "thinking":
@@ -15864,8 +16013,8 @@ ${pics}` : text2);
15864
16013
  if (this.repeated(msgId, `k${t.length}:${t.slice(0, 64)}:${sig.length}:${sig.slice(-24)}`)) return;
15865
16014
  const e = { kind: "thinking", id, at: c.at };
15866
16015
  if (b.type === "thinking" && t.trim()) {
15867
- const text2 = marked(prepare(t, THINKING_MAX));
15868
- if (text2) e.text = text2;
16016
+ const text3 = marked(prepare(t, THINKING_MAX));
16017
+ if (text3) e.text = text3;
15869
16018
  }
15870
16019
  this.emit(e);
15871
16020
  return;
@@ -15924,9 +16073,9 @@ ${pics}` : text2);
15924
16073
  attachment(c) {
15925
16074
  const a = rec2(c.j.attachment);
15926
16075
  if (!a || a.type !== "queued_command" || a.isMeta === true || c.j.isMeta === true) return;
15927
- let text2 = "";
16076
+ let text3 = "";
15928
16077
  let images = 0;
15929
- if (typeof a.prompt === "string") text2 = a.prompt;
16078
+ if (typeof a.prompt === "string") text3 = a.prompt;
15930
16079
  else if (Array.isArray(a.prompt)) {
15931
16080
  const texts = [];
15932
16081
  for (const raw of a.prompt) {
@@ -15934,11 +16083,11 @@ ${pics}` : text2);
15934
16083
  if (b?.type === "text" && typeof b.text === "string") texts.push(b.text);
15935
16084
  else if (b?.type === "image") images++;
15936
16085
  }
15937
- text2 = texts.join("\n");
16086
+ text3 = texts.join("\n");
15938
16087
  }
15939
- if (text2.trimStart().startsWith("<task-notification>")) return this.notification(c, text2.trim());
16088
+ if (text3.trimStart().startsWith("<task-notification>")) return this.notification(c, text3.trim());
15940
16089
  if (a.commandMode !== void 0 && a.commandMode !== "prompt") return;
15941
- this.userText(c, text2, images);
16090
+ this.userText(c, text3, images);
15942
16091
  }
15943
16092
  };
15944
16093
  function createTerminalParser() {
@@ -17184,8 +17333,8 @@ async function readSessionMeta(path, size) {
17184
17333
  function isTitleLine(line2) {
17185
17334
  return TITLE_MARKERS.some((m) => line2.includes(m));
17186
17335
  }
17187
- function splitLines(text2, dropFirst, dropLast) {
17188
- const lines = text2.split("\n");
17336
+ function splitLines(text3, dropFirst, dropLast) {
17337
+ const lines = text3.split("\n");
17189
17338
  if (dropFirst) lines.shift();
17190
17339
  if (dropLast) lines.pop();
17191
17340
  return lines.map((l) => l.replace(/\r$/, "")).filter((l) => l.trim());
@@ -18216,6 +18365,96 @@ function checkFile(path, fs = { realpath: process.platform === "win32" ? realpat
18216
18365
  // server/central/hub.ts
18217
18366
  import { randomBytes as randomBytes3 } from "node:crypto";
18218
18367
 
18368
+ // shared/inbox.ts
18369
+ var INBOX_TITLE_MAX = 200;
18370
+ var INBOX_BODY_MAX_BYTES = 8 * 1024;
18371
+ var INBOX_KEY_MAX = 128;
18372
+ var INBOX_SOURCE_MAX = 64;
18373
+ var INBOX_LINK_MAX = 2048;
18374
+ var INBOX_OPEN_MAX = 200;
18375
+ var INBOX_RESOLVED_KEEP_MS = 7 * 24 * 60 * 60 * 1e3;
18376
+ var INBOX_RESOLVED_SHOWN = 20;
18377
+ var INBOX_ANCESTORS_MAX = 64;
18378
+ var utf8Len = (s2) => new TextEncoder().encode(s2).length;
18379
+ var BAD = /* @__PURE__ */ Symbol("bad");
18380
+ function text2(v) {
18381
+ if (v === void 0 || v === null) return void 0;
18382
+ return typeof v === "string" ? v : BAD;
18383
+ }
18384
+ function isHttpUrl(v) {
18385
+ try {
18386
+ const u = new URL(v);
18387
+ return u.protocol === "http:" || u.protocol === "https:";
18388
+ } catch {
18389
+ return false;
18390
+ }
18391
+ }
18392
+ function parseInboxPost(raw) {
18393
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { ok: false, error: tr("corpo inv\xE1lido") };
18394
+ const r = raw;
18395
+ const rawTitle = text2(r.title);
18396
+ const title = typeof rawTitle === "string" ? rawTitle.trim() : "";
18397
+ if (!title) return { ok: false, error: tr("t\xEDtulo obrigat\xF3rio") };
18398
+ if (title.length > INBOX_TITLE_MAX) return { ok: false, error: tr("t\xEDtulo longo demais (m\xE1x. {0} caracteres)", [INBOX_TITLE_MAX]) };
18399
+ const post = { title, ancestors: [] };
18400
+ const body2 = text2(r.body);
18401
+ if (body2 === BAD) return { ok: false, error: tr("texto inv\xE1lido") };
18402
+ if (body2 !== void 0 && body2.trim()) {
18403
+ if (utf8Len(body2) > INBOX_BODY_MAX_BYTES) return { ok: false, error: tr("texto longo demais (m\xE1x. {0} KB)", [INBOX_BODY_MAX_BYTES / 1024]) };
18404
+ post.body = body2;
18405
+ }
18406
+ const rawLink = text2(r.link);
18407
+ if (rawLink === BAD) return { ok: false, error: tr("link inv\xE1lido") };
18408
+ const link = rawLink?.trim();
18409
+ if (link) {
18410
+ if (link.length > INBOX_LINK_MAX || !isHttpUrl(link)) return { ok: false, error: tr("o link precisa ser http ou https") };
18411
+ post.link = link;
18412
+ }
18413
+ const rawKey = text2(r.key);
18414
+ if (rawKey === BAD) return { ok: false, error: tr("chave inv\xE1lida") };
18415
+ const key = rawKey?.trim();
18416
+ if (key) {
18417
+ if (key.length > INBOX_KEY_MAX) return { ok: false, error: tr("chave longa demais (m\xE1x. {0} caracteres)", [INBOX_KEY_MAX]) };
18418
+ post.key = key;
18419
+ }
18420
+ const rawSource = text2(r.source);
18421
+ if (rawSource === BAD) return { ok: false, error: tr("origem inv\xE1lida") };
18422
+ const source = rawSource?.trim();
18423
+ if (source) post.source = source.slice(0, INBOX_SOURCE_MAX);
18424
+ if (r.ancestors !== void 0) {
18425
+ if (!Array.isArray(r.ancestors)) return { ok: false, error: tr("ancestrais inv\xE1lidos") };
18426
+ post.ancestors = r.ancestors.filter((n2) => Number.isInteger(n2) && n2 > 0).slice(0, INBOX_ANCESTORS_MAX);
18427
+ }
18428
+ return { ok: true, post };
18429
+ }
18430
+ var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
18431
+ var num5 = (v) => typeof v === "number" && Number.isFinite(v);
18432
+ function parseSender(v) {
18433
+ if (!isObj(v)) return void 0;
18434
+ if (v.kind === "agent" && typeof v.agentId === "string" && v.agentId) return { kind: "agent", agentId: v.agentId };
18435
+ if (v.kind === "script" && (v.name === void 0 || typeof v.name === "string")) return { kind: "script", ...typeof v.name === "string" ? { name: v.name } : {} };
18436
+ return void 0;
18437
+ }
18438
+ function parseInboxItem(v) {
18439
+ if (!isObj(v)) return void 0;
18440
+ const from = parseSender(v.from);
18441
+ if (typeof v.id !== "string" || !v.id || typeof v.title !== "string" || !v.title || !from) return void 0;
18442
+ if (v.status !== "open" && v.status !== "resolved") return void 0;
18443
+ if (!num5(v.createdAt) || !num5(v.updatedAt)) return void 0;
18444
+ const item = { id: v.id, title: v.title.slice(0, INBOX_TITLE_MAX), from, scope: "local", status: v.status, createdAt: v.createdAt, updatedAt: v.updatedAt };
18445
+ if (typeof v.key === "string" && v.key) item.key = v.key.slice(0, INBOX_KEY_MAX);
18446
+ if (typeof v.body === "string" && utf8Len(v.body) <= INBOX_BODY_MAX_BYTES) item.body = v.body;
18447
+ if (typeof v.link === "string" && v.link.length <= INBOX_LINK_MAX && isHttpUrl(v.link)) item.link = v.link;
18448
+ if (num5(v.resolvedAt)) item.resolvedAt = v.resolvedAt;
18449
+ if (typeof v.machine === "string" && v.machine) item.machine = v.machine;
18450
+ return item;
18451
+ }
18452
+ function visibleInbox(items, resolvedShown = INBOX_RESOLVED_SHOWN) {
18453
+ const open3 = items.filter((i) => i.status === "open").sort((a, b) => b.updatedAt - a.updatedAt);
18454
+ const done = items.filter((i) => i.status === "resolved").sort((a, b) => (b.resolvedAt ?? b.updatedAt) - (a.resolvedAt ?? a.updatedAt)).slice(0, resolvedShown);
18455
+ return [...open3, ...done];
18456
+ }
18457
+
18219
18458
  // server/host-wait.ts
18220
18459
  var HOST_WAIT_MS = 2e4;
18221
18460
  var HostWait = class {
@@ -18267,11 +18506,11 @@ async function pollWithWait(wait, take, ms, signal) {
18267
18506
  }
18268
18507
 
18269
18508
  // shared/perf.ts
18270
- var num5 = (v) => typeof v === "number" && Number.isFinite(v);
18509
+ var num6 = (v) => typeof v === "number" && Number.isFinite(v);
18271
18510
  var rec3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
18272
- var allNum = (o, keys) => rec3(o) && keys.every((k) => num5(o[k]));
18511
+ var allNum = (o, keys) => rec3(o) && keys.every((k) => num6(o[k]));
18273
18512
  function parsePerfSample(body2) {
18274
- if (!rec3(body2) || !num5(body2.at) || !num5(body2.uptime)) return void 0;
18513
+ if (!rec3(body2) || !num6(body2.at) || !num6(body2.uptime)) return void 0;
18275
18514
  const { cpu, memory, eventLoop, work } = body2;
18276
18515
  if (!allNum(cpu, ["oneCore", "allCores"]) || !allNum(memory, ["rss", "heapUsed", "external"])) return void 0;
18277
18516
  if (!allNum(eventLoop, ["p50", "p99", "max"])) return void 0;
@@ -18482,27 +18721,31 @@ var DELIVERED_GRACE_MS = 5e3;
18482
18721
  var SEEN_MAX2 = 1e3;
18483
18722
  var TICK_MS = 1e3;
18484
18723
  var weigh = (a) => (a.type === "message.send" ? a.text.length + a.images.reduce((n2, i) => n2 + i.data.length, 0) : 0) + 512;
18485
- var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
18724
+ var isObj2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
18486
18725
  var isStr = (v) => typeof v === "string";
18487
18726
  var bad = () => {
18488
18727
  throw new HttpError(400, tr("JSON inv\xE1lido"));
18489
18728
  };
18490
- var all = (v, ok) => Array.isArray(v) && v.every((x) => isObj(x) && ok(x));
18729
+ var all = (v, ok) => Array.isArray(v) && v.every((x) => isObj2(x) && ok(x));
18491
18730
  function validState(body2) {
18492
- if (!isObj(body2) || body2.protocol !== 1 || !isStr(body2.boot) || !body2.boot || typeof body2.seq !== "number" || !Number.isFinite(body2.seq)) return bad();
18731
+ if (!isObj2(body2) || body2.protocol !== 1 || !isStr(body2.boot) || !body2.boot || typeof body2.seq !== "number" || !Number.isFinite(body2.seq)) return bad();
18493
18732
  const s2 = body2.snapshot;
18494
- if (!isObj(s2)) return bad();
18733
+ if (!isObj2(s2)) return bad();
18495
18734
  if (!all(s2.rooms, (r) => isStr(r.id) && isStr(r.name) && isStr(r.path)) || !all(s2.agents, (a) => isStr(a.id) && isStr(a.roomId) && isStr(a.account)) || !all(s2.accounts, (a) => isStr(a.id) && isStr(a.name)))
18496
18735
  return bad();
18497
- if (!all(body2.feed, (f) => isStr(f.id) && isStr(f.agentId) && isStr(f.roomId)) || !all(body2.notices, (n2) => isStr(n2.id)) || !all(body2.relayed, (r) => isStr(r.actionId) && isObj(r.message) && isStr(r.message.id) && isStr(r.message.agentId)))
18736
+ if (!all(body2.feed, (f) => isStr(f.id) && isStr(f.agentId) && isStr(f.roomId)) || !all(body2.notices, (n2) => isStr(n2.id)) || !all(body2.relayed, (r) => isStr(r.actionId) && isObj2(r.message) && isStr(r.message.id) && isStr(r.message.agentId)))
18498
18737
  return bad();
18738
+ if (body2.inbox !== void 0) {
18739
+ if (!Array.isArray(body2.inbox)) return bad();
18740
+ body2.inbox = body2.inbox.map(parseInboxItem).filter((i) => !!i).slice(0, INBOX_OPEN_MAX + INBOX_RESOLVED_SHOWN);
18741
+ }
18499
18742
  if (body2.ptys !== void 0) {
18500
18743
  const ptys2 = body2.ptys;
18501
- if (!isObj(ptys2) || !isObj(ptys2.status) || typeof ptys2.status.enabled !== "boolean" || !Array.isArray(ptys2.list))
18744
+ if (!isObj2(ptys2) || !isObj2(ptys2.status) || typeof ptys2.status.enabled !== "boolean" || !Array.isArray(ptys2.list))
18502
18745
  return bad();
18503
- const num10 = (v) => v === void 0 || typeof v === "number" && Number.isFinite(v);
18746
+ const num11 = (v) => v === void 0 || typeof v === "number" && Number.isFinite(v);
18504
18747
  ptys2.list = ptys2.list.filter(
18505
- (p) => isObj(p) && isStr(p.id) && isStr(p.agentId) && isStr(p.account) && isStr(p.cwd) && typeof p.pid === "number" && Number.isFinite(p.pid) && num10(p.startedAt) && num10(p.exitedAt) && num10(p.exitCode) && (p.fromAgent === void 0 || isStr(p.fromAgent)) && (p.resumed === void 0 || isStr(p.resumed))
18748
+ (p) => isObj2(p) && isStr(p.id) && isStr(p.agentId) && isStr(p.account) && isStr(p.cwd) && typeof p.pid === "number" && Number.isFinite(p.pid) && num11(p.startedAt) && num11(p.exitedAt) && num11(p.exitCode) && (p.fromAgent === void 0 || isStr(p.fromAgent)) && (p.resumed === void 0 || isStr(p.resumed))
18506
18749
  ).slice(0, 32);
18507
18750
  }
18508
18751
  return body2;
@@ -18521,6 +18764,9 @@ var CentralHub = class {
18521
18764
  relayedCbs = /* @__PURE__ */ new Set();
18522
18765
  ptyOutputCbs = /* @__PURE__ */ new Set();
18523
18766
  satellitePerf = /* @__PURE__ */ new Map();
18767
+ /** Per machine: id -> "status:updatedAt" of the inbox items seen; tells a live arrival from the first sight. */
18768
+ inboxSeen = /* @__PURE__ */ new Map();
18769
+ inboxCbs = /* @__PURE__ */ new Set();
18524
18770
  ticker;
18525
18771
  counter = 0;
18526
18772
  constructor(opts) {
@@ -18575,6 +18821,49 @@ var CentralHub = class {
18575
18821
  }
18576
18822
  return out;
18577
18823
  }
18824
+ /**
18825
+ * The office inbox items of the paired machines the office still shows, ids prefixed and `machine` set. An offline
18826
+ * machine keeps its items on the desk (they are still there); resolving one then fails as "offline".
18827
+ */
18828
+ inboxItems() {
18829
+ const now = this.now();
18830
+ const out = [];
18831
+ for (const [id, e] of this.entries) {
18832
+ if (now - e.at >= HIDE_AFTER_MS || !e.state.inbox) continue;
18833
+ for (const i of e.state.inbox) out.push(namespaceInboxItem(id, i));
18834
+ }
18835
+ return out;
18836
+ }
18837
+ /** Called when a machine's inbox changed; `arrived` is a new (or reopened) open item seen live. */
18838
+ onInbox(cb) {
18839
+ this.inboxCbs.add(cb);
18840
+ return () => void this.inboxCbs.delete(cb);
18841
+ }
18842
+ /** The satellite confirmed the resolve: show it now instead of at its next state. */
18843
+ markInboxResolved(machine, localId) {
18844
+ const e = this.entries.get(machine);
18845
+ const item = e?.state.inbox?.find((i) => i.id === localId);
18846
+ if (!item || item.status === "resolved") return;
18847
+ const at = this.now();
18848
+ item.status = "resolved";
18849
+ item.resolvedAt = at;
18850
+ item.updatedAt = at;
18851
+ this.inboxSeen.get(machine)?.set(item.id, `resolved:${item.updatedAt}`);
18852
+ for (const cb of this.inboxCbs) cb();
18853
+ }
18854
+ noteInbox(machine, items) {
18855
+ const seen = this.inboxSeen.get(machine);
18856
+ const next = new Map(items.map((i) => [i.id, `${i.status}:${i.updatedAt}`]));
18857
+ this.inboxSeen.set(machine, next);
18858
+ let changed = next.size !== (seen?.size ?? 0);
18859
+ let arrived;
18860
+ for (const i of items) {
18861
+ const before = seen?.get(i.id);
18862
+ if (before !== next.get(i.id)) changed = true;
18863
+ if (seen && i.status === "open" && (before === void 0 || before.startsWith("resolved:")) && !arrived) arrived = namespaceInboxItem(machine, i);
18864
+ }
18865
+ if (changed || arrived) for (const cb of this.inboxCbs) cb(arrived);
18866
+ }
18578
18867
  isOnline(machine) {
18579
18868
  const e = this.entries.get(machine);
18580
18869
  return !!e && this.now() - e.at < OFFLINE_AFTER_MS;
@@ -18652,6 +18941,7 @@ var CentralHub = class {
18652
18941
  const freshNotices = notices.filter((n2) => this.remember(entry.noticeSeen, n2.id));
18653
18942
  if (freshFeed.length || freshNotices.length) this.office.addRemoteFrames(freshFeed, freshNotices);
18654
18943
  for (const r of s2.relayed) for (const cb of this.relayedCbs) cb(m.id, r);
18944
+ if (s2.inbox || this.inboxSeen.has(m.id)) this.noteInbox(m.id, s2.inbox ?? []);
18655
18945
  this.office.markDirty();
18656
18946
  return reply2();
18657
18947
  }
@@ -18691,7 +18981,7 @@ var CentralHub = class {
18691
18981
  }
18692
18982
  results(m, body2) {
18693
18983
  this.assertPaired(m);
18694
- if (!isObj(body2) || !all(body2.results, (r) => isStr(r.actionId) && typeof r.ok === "boolean")) bad();
18984
+ if (!isObj2(body2) || !all(body2.results, (r) => isStr(r.actionId) && typeof r.ok === "boolean")) bad();
18695
18985
  for (const r of body2.results) {
18696
18986
  const p = this.pending.get(r.actionId);
18697
18987
  if (!p || p.machine !== m.id) continue;
@@ -18702,7 +18992,7 @@ var CentralHub = class {
18702
18992
  ptyOutput(m, ptyId, body2) {
18703
18993
  this.assertPaired(m);
18704
18994
  if (!/^p\d+-\d+$/.test(ptyId)) return bad();
18705
- if (!isObj(body2)) return bad();
18995
+ if (!isObj2(body2)) return bad();
18706
18996
  const sequence = body2.sequence;
18707
18997
  if (typeof sequence !== "number" || !Number.isSafeInteger(sequence) || sequence < 1) return bad();
18708
18998
  let output;
@@ -18845,6 +19135,7 @@ var CentralHub = class {
18845
19135
  revoke(id) {
18846
19136
  this.machines.revoke(id);
18847
19137
  this.entries.delete(id);
19138
+ if (this.inboxSeen.delete(id)) for (const cb of this.inboxCbs) cb();
18848
19139
  this.satellitePerf.delete(id);
18849
19140
  for (const p of [...this.pending.values()]) if (p.machine === id) this.fail(p, "revoked");
18850
19141
  this.closeReads(id, new HubError("revoked"));
@@ -18906,9 +19197,9 @@ var CentralHub = class {
18906
19197
 
18907
19198
  // server/central/reads.ts
18908
19199
  var BUFFER_TIMEOUT_MS = 3e4;
18909
- var isObj2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
19200
+ var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
18910
19201
  function rewriteIds(machine, body2, kind) {
18911
- if (!isObj2(body2)) throw new Error("corpo inesperado");
19202
+ if (!isObj3(body2)) throw new Error("corpo inesperado");
18912
19203
  switch (kind) {
18913
19204
  case "detail":
18914
19205
  return namespaceDetail(machine, body2);
@@ -19601,6 +19892,24 @@ function createApiHandler(deps) {
19601
19892
  } else deps.attention(req, res, path);
19602
19893
  return true;
19603
19894
  }
19895
+ if (path === "/api/inbox" || path.startsWith("/api/inbox/")) {
19896
+ if (!deps.inbox) {
19897
+ req.resume();
19898
+ sendJson2(res, 404, { error: tr("rota desconhecida") });
19899
+ } else if (isRead) {
19900
+ if (!attentionAllowed(req)) sendJson2(res, 403, { error: tr("a mesa s\xF3 vale pelo pr\xF3prio computador ou pelo acesso remoto com login") });
19901
+ else deps.inbox(req, res, path);
19902
+ } else if (path !== "/api/inbox") {
19903
+ if (!trusted(req, "messages")) {
19904
+ req.resume();
19905
+ sendJson2(res, 403, { error: denied(req, tr("os itens da mesa s\xF3 s\xE3o resolvidos pelo pr\xF3prio computador (http://localhost ou http://127.0.0.1)")) });
19906
+ } else deps.inbox(req, res, path);
19907
+ } else if (isRemote(req) || !isLoopbackHost(req.headers.host) || !deps.inDocker && !isLoopbackAddress(req.socket.remoteAddress)) {
19908
+ req.resume();
19909
+ sendJson2(res, 403, { error: tr("s\xF3 o pr\xF3prio computador deixa itens na mesa (http://localhost ou http://127.0.0.1)") });
19910
+ } else deps.inbox(req, res, path);
19911
+ return true;
19912
+ }
19604
19913
  if (path === "/api/avatar") {
19605
19914
  if (!deps.avatar) {
19606
19915
  req.resume();
@@ -20381,16 +20690,16 @@ function centralCertTargets(name, ips) {
20381
20690
  var MESSAGE_MAX = 2e4;
20382
20691
  var MESSAGE_TOOL = "HabblaudMessage";
20383
20692
  var DETAIL_MAX2 = 300;
20384
- function describeMessage(text2, images = 0) {
20385
- const typed = truncate(maskSecrets(text2.slice(0, DETAIL_MAX2 * 4)), DETAIL_MAX2);
20693
+ function describeMessage(text3, images = 0) {
20694
+ const typed = truncate(maskSecrets(text3.slice(0, DETAIL_MAX2 * 4)), DETAIL_MAX2);
20386
20695
  const extra = images > 0 ? images === 1 ? tr("com 1 imagem") : tr("com {0} imagens", [images]) : "";
20387
20696
  const detail = typed && extra ? `${typed} \xB7 ${extra}` : typed || extra;
20388
20697
  return { kind: "communicate", icon: "\u2709\uFE0F", text: tr("Mensagem pelo Habblaud"), tool: MESSAGE_TOOL, ...detail ? { detail } : {} };
20389
20698
  }
20390
20699
  var MESSAGE_IMAGES_MAX = 8;
20391
20700
  var MESSAGE_IMAGE_BYTES_MAX = 15 * 1024 * 1024;
20392
- function isSlashCommand(text2) {
20393
- return /^\s*\/[^\s/]+(?:\s[\s\S]*)?$/.test(text2);
20701
+ function isSlashCommand(text3) {
20702
+ return /^\s*\/[^\s/]+(?:\s[\s\S]*)?$/.test(text3);
20394
20703
  }
20395
20704
 
20396
20705
  // server/messages/registry.ts
@@ -20583,7 +20892,7 @@ var MessageRegistry = class {
20583
20892
  let open3 = 0;
20584
20893
  for (const e of this.messages.values()) if (e.msg.agentId === agent.id && !isFinal(e)) open3++;
20585
20894
  if (open3 >= MAX_OPEN2) return { error: "too-many" };
20586
- let text2 = typed;
20895
+ let text3 = typed;
20587
20896
  let files = 0;
20588
20897
  if (attachments2.length) {
20589
20898
  const images = this.opts.images;
@@ -20597,7 +20906,7 @@ var MessageRegistry = class {
20597
20906
  if (demo) images.discard(taken);
20598
20907
  else {
20599
20908
  try {
20600
- text2 = promptWithAttachments(typed, images.save(taken));
20909
+ text3 = promptWithAttachments(typed, images.save(taken));
20601
20910
  } catch (err) {
20602
20911
  log.warnOnce(`messages-images:${errMsg(err)}`, tr("Mensagens: n\xE3o deu para gravar as imagens ({0}).", [errMsg(err)]));
20603
20912
  return { error: "images", code: "write", reason: tr("n\xE3o deu para guardar as imagens no computador") };
@@ -20606,7 +20915,7 @@ var MessageRegistry = class {
20606
20915
  }
20607
20916
  const now = this.now();
20608
20917
  const id = `m-${now.toString(36)}-${++this.seq}-${randomBytes4(9).toString("base64url")}`;
20609
- const entry = { msg: { id, agentId: agent.id, status: "queued", createdAt: now, updatedAt: now }, text: text2, activity: describeMessage(typed, files), target: agent.sessionId };
20918
+ const entry = { msg: { id, agentId: agent.id, status: "queued", createdAt: now, updatedAt: now }, text: text3, activity: describeMessage(typed, files), target: agent.sessionId };
20610
20919
  if (demo) entry.demo = true;
20611
20920
  else if (real?.provider === "codex") entry.codex = true;
20612
20921
  this.messages.set(id, entry);
@@ -20883,7 +21192,7 @@ function createMessageRoutes(registry, remote) {
20883
21192
  if ("error" in r) return sendJson2(res, r.status, { error: r.error });
20884
21193
  sendJson2(res, 201, r);
20885
21194
  };
20886
- const inbox = async (req, res) => {
21195
+ const inbox2 = async (req, res) => {
20887
21196
  sendJson2(res, 200, { messages: registry.inbox(await readJson(req)) });
20888
21197
  };
20889
21198
  const ack = async (req, res) => {
@@ -20924,7 +21233,7 @@ function createMessageRoutes(registry, remote) {
20924
21233
  }).catch((err) => fail(res, err));
20925
21234
  return;
20926
21235
  }
20927
- if (path === "/api/mod/inbox") return post(req, res, inbox);
21236
+ if (path === "/api/mod/inbox") return post(req, res, inbox2);
20928
21237
  if (path === "/api/mod/inbox/ack") return post(req, res, ack);
20929
21238
  if (path === "/api/mod/commands") return post(req, res, commands);
20930
21239
  const c = COMMANDS.exec(path);
@@ -21005,7 +21314,7 @@ var RemoteMessages = class {
21005
21314
  send(raw) {
21006
21315
  const peek = raw?.agentId;
21007
21316
  if (typeof peek !== "string" || !parseRemoteId(peek)) return void 0;
21008
- const { agentId, text: text2, attachments: attachments2 } = parseSend(raw);
21317
+ const { agentId, text: text3, attachments: attachments2 } = parseSend(raw);
21009
21318
  const ref = parseRemoteId(agentId);
21010
21319
  if (!ref) return void 0;
21011
21320
  if (!this.hub.isOnline(ref.machine)) return { error: "unavailable", reason: ERR_MACHINE_OFFLINE2 };
@@ -21020,7 +21329,7 @@ var RemoteMessages = class {
21020
21329
  if (attachments2.length) {
21021
21330
  const store = this.images;
21022
21331
  if (!store) return { error: "images", code: "off", reason: tr("imagens desligadas") };
21023
- if (isSlashCommand(text2)) return { error: "images", code: "slash", reason: tr("comandos de barra n\xE3o levam imagens: tire as imagens ou mande o comando sozinho") };
21332
+ if (isSlashCommand(text3)) return { error: "images", code: "slash", reason: tr("comandos de barra n\xE3o levam imagens: tire as imagens ou mande o comando sozinho") };
21024
21333
  if (store.peekSize(attachments2) > REMOTE_IMAGES_MAX_BYTES) {
21025
21334
  return { error: "images", code: "size", reason: tr("as imagens passam de {0} MB: mande menos imagens", [REMOTE_IMAGES_MAX_BYTES / (1024 * 1024)]) };
21026
21335
  }
@@ -21035,7 +21344,7 @@ var RemoteMessages = class {
21035
21344
  const action = {
21036
21345
  type: "message.send",
21037
21346
  agentId: ref.local,
21038
- text: text2,
21347
+ text: text3,
21039
21348
  images
21040
21349
  };
21041
21350
  const q = this.hub.enqueue(ref.machine, action, { timeoutMs: QUEUED_TIMEOUT_MS2 });
@@ -21255,8 +21564,8 @@ function codexToolView(tool, input, cwd) {
21255
21564
  const more = files.length > 1 ? ` +${files.length - 1}` : "";
21256
21565
  const title = first ? `apply_patch(${line(relPath2(first.path, cwd), TITLE_ARG_MAX)}${more})` : "apply_patch";
21257
21566
  const name = first ? line(basename3(first.path), TEXT_MAX3) : "";
21258
- const [text2, icon] = files.length > 1 ? [tr("Editando {0} arquivos", [files.length]), "\u270F\uFE0F"] : first?.op === "Add" ? [tr("Criando {0}", [name]), "\u{1F4DD}"] : first?.op === "Delete" ? [tr("Apagando {0}", [name]), "\u{1F5D1}\uFE0F"] : [first ? tr("Editando {0}", [name]) : tr("Aplicando um patch"), "\u270F\uFE0F"];
21259
- return { title, text: truncate(text2, TEXT_MAX3), icon, ...shown(patch, "diff") };
21567
+ const [text3, icon] = files.length > 1 ? [tr("Editando {0} arquivos", [files.length]), "\u270F\uFE0F"] : first?.op === "Add" ? [tr("Criando {0}", [name]), "\u{1F4DD}"] : first?.op === "Delete" ? [tr("Apagando {0}", [name]), "\u{1F5D1}\uFE0F"] : [first ? tr("Editando {0}", [name]) : tr("Aplicando um patch"), "\u270F\uFE0F"];
21568
+ return { title, text: truncate(text3, TEXT_MAX3), icon, ...shown(patch, "diff") };
21260
21569
  }
21261
21570
  case "request_permissions": {
21262
21571
  const view = toolView(tool, input, cwd);
@@ -21417,8 +21726,8 @@ function askFormat(raw) {
21417
21726
  function askCount(raw) {
21418
21727
  if (!Array.isArray(raw)) return 0;
21419
21728
  return raw.filter((q) => {
21420
- const text2 = rec6(q)?.question;
21421
- return typeof text2 === "string" && !!text2.trim();
21729
+ const text3 = rec6(q)?.question;
21730
+ return typeof text3 === "string" && !!text3.trim();
21422
21731
  }).length;
21423
21732
  }
21424
21733
  function fitsFormat(f, a) {
@@ -21583,8 +21892,8 @@ var PermissionRegistry = class {
21583
21892
  const now = this.now();
21584
21893
  const id = `p-${now.toString(36)}-${++this.seq}-${randomBytes5(9).toString("base64url")}`;
21585
21894
  const view = "title" in desc ? desc : toolView(req.tool, req.input, req.cwd);
21586
- const text2 = only && req.promptTitle ? truncate(maskSecrets(req.promptTitle), 120) : desc.text;
21587
- const info = { id, tool: req.tool, title: view.title, text: text2, icon: desc.icon, createdAt: now, expiresAt: now + req.timeoutMs };
21895
+ const text3 = only && req.promptTitle ? truncate(maskSecrets(req.promptTitle), 120) : desc.text;
21896
+ const info = { id, tool: req.tool, title: view.title, text: text3, icon: desc.icon, createdAt: now, expiresAt: now + req.timeoutMs };
21588
21897
  if (codex2) info.provider = "codex";
21589
21898
  if (only) info.terminalOnly = true;
21590
21899
  if (view.input) info.input = view.input;
@@ -21613,8 +21922,8 @@ var PermissionRegistry = class {
21613
21922
  this.opts.office.addActivity(target.id, { id: `${target.id}#perm:${id}`, at: now, kind: "wait", icon: "\u2753", text: truncate(tr("Pergunta: {0}", [first]), 46), detail: truncate(all2, 300), tool: "PermissionRequest" }, false);
21614
21923
  this.opts.office.noticePermission(target.id, `${truncate(first, 120)}${by}`, "question");
21615
21924
  } else {
21616
- this.opts.office.addActivity(target.id, { id: `${target.id}#perm:${id}`, at: now, kind: "wait", icon: "\u{1F510}", text: truncate(tr("Pede permiss\xE3o: {0}", [text2]), 46), detail: view.title, tool: "PermissionRequest" }, false);
21617
- this.opts.office.noticePermission(target.id, only ? `${text2} \xB7 ${view.title}` : `${desc.text}${by}`);
21925
+ this.opts.office.addActivity(target.id, { id: `${target.id}#perm:${id}`, at: now, kind: "wait", icon: "\u{1F510}", text: truncate(tr("Pede permiss\xE3o: {0}", [text3]), 46), detail: view.title, tool: "PermissionRequest" }, false);
21926
+ this.opts.office.noticePermission(target.id, only ? `${text3} \xB7 ${view.title}` : `${desc.text}${by}`);
21618
21927
  }
21619
21928
  this.opts.office.markDirty();
21620
21929
  return { id, expiresAt: info.expiresAt + EXPIRY_GRACE_MS2 };
@@ -22071,8 +22380,8 @@ var CODE_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
22071
22380
  var LABEL_MAX = 40;
22072
22381
  var hashToken = (token) => createHash2("sha256").update(token, "utf8").digest("hex");
22073
22382
  function cleanLabel(label) {
22074
- const text2 = cleanMachineLabel(label).slice(0, LABEL_MAX).trim();
22075
- return text2 || void 0;
22383
+ const text3 = cleanMachineLabel(label).slice(0, LABEL_MAX).trim();
22384
+ return text3 || void 0;
22076
22385
  }
22077
22386
  var MachineStore = class {
22078
22387
  file;
@@ -22551,6 +22860,7 @@ var Satellite = class {
22551
22860
  applied;
22552
22861
  ptyProvider;
22553
22862
  maintenanceCallback;
22863
+ inbox;
22554
22864
  /** Aleatório por processo (P9): a central troca a parte da máquina quando ele muda. */
22555
22865
  boot = randomBytes7(9).toString("base64url");
22556
22866
  seq = Date.now();
@@ -22586,6 +22896,7 @@ var Satellite = class {
22586
22896
  this.now = opts.now ?? (() => performance.now());
22587
22897
  this.ptyProvider = opts.ptys ?? (() => void 0);
22588
22898
  this.maintenanceCallback = opts.maintenance ?? (() => void 0);
22899
+ this.inbox = opts.inbox;
22589
22900
  this.applied = new AppliedActions({ now: Date.now });
22590
22901
  }
22591
22902
  start() {
@@ -22603,6 +22914,7 @@ var Satellite = class {
22603
22914
  else this.notices = [...this.notices, data].slice(-NOTICE_KEEP);
22604
22915
  })
22605
22916
  );
22917
+ if (this.inbox) this.offs.push(this.inbox.onChange(() => this.schedule()));
22606
22918
  this.heartbeat = this.timers.setInterval(() => void this.post(), HEARTBEAT_MS);
22607
22919
  unref(this.heartbeat);
22608
22920
  this.maintenance = this.timers.setInterval(() => this.optsMaintenance(), 1e3);
@@ -22689,6 +23001,7 @@ var Satellite = class {
22689
23001
  const snap = this.snap ?? this.hub.current();
22690
23002
  const meta = { version: snap.meta.version };
22691
23003
  if (snap.meta.messages !== void 0) meta.messages = snap.meta.messages;
23004
+ const inbox2 = this.inbox?.items();
22692
23005
  return {
22693
23006
  protocol: 1,
22694
23007
  boot: this.boot,
@@ -22701,7 +23014,8 @@ var Satellite = class {
22701
23014
  },
22702
23015
  feed,
22703
23016
  notices,
22704
- relayed
23017
+ relayed,
23018
+ ...inbox2 ? { inbox: inbox2 } : {}
22705
23019
  };
22706
23020
  }
22707
23021
  ptys() {
@@ -23783,25 +24097,25 @@ function cut2(s2, max) {
23783
24097
  const sp = head.lastIndexOf(" ");
23784
24098
  return `${(sp > max * 0.6 ? head.slice(0, sp) : head).replace(/[\s,;:.-]+$/, "")}\u2026`;
23785
24099
  }
23786
- function paragraphs(text2) {
23787
- return text2.replace(/`{3}[\s\S]*?`{3}/g, "\n\n").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
24100
+ function paragraphs(text3) {
24101
+ return text3.replace(/`{3}[\s\S]*?`{3}/g, "\n\n").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
23788
24102
  }
23789
24103
  var isProse = (p) => !/^(\||#|>|[-*+]\s|\d+[.)]\s|`{3})/.test(p) && !/^[A-Z_ ]+:\s/.test(p);
23790
- function headlineOf(text2) {
23791
- const first = paragraphs(text2).find(isProse) ?? paragraphs(text2)[0] ?? "";
24104
+ function headlineOf(text3) {
24105
+ const first = paragraphs(text3).find(isProse) ?? paragraphs(text3)[0] ?? "";
23792
24106
  const plain = stripMarkdown(first);
23793
24107
  const m = /^(.+?[.!?])(\s|$)/.exec(plain);
23794
24108
  return cut2(m ? m[1] : plain, HEADLINE_MAX);
23795
24109
  }
23796
- function summaryOf(text2, headline) {
23797
- const paras = paragraphs(text2).filter(isProse);
24110
+ function summaryOf(text3, headline) {
24111
+ const paras = paragraphs(text3).filter(isProse);
23798
24112
  const last = paras[paras.length - 1];
23799
24113
  if (!last || paras.length < 2) return void 0;
23800
24114
  const plain = stripMarkdown(last);
23801
24115
  if (plain.length < 60 || plain.startsWith(headline.replace(/…$/, ""))) return void 0;
23802
24116
  return cut2(plain, SUMMARY_MAX2);
23803
24117
  }
23804
- function linkedFiles(text2, project, platform = process.platform) {
24118
+ function linkedFiles(text3, project, platform = process.platform) {
23805
24119
  const P = platform === "win32" ? win32 : posix;
23806
24120
  const out = /* @__PURE__ */ new Set();
23807
24121
  const add = (raw) => {
@@ -23821,8 +24135,8 @@ function linkedFiles(text2, project, platform = process.platform) {
23821
24135
  p = P.normalize(p);
23822
24136
  if (!pathProblem(p, platform)) out.add(p);
23823
24137
  };
23824
- for (const m of text2.matchAll(LINK_RE)) add(m[1]);
23825
- for (const m of text2.matchAll(BARE_RE)) add(m[1]);
24138
+ for (const m of text3.matchAll(LINK_RE)) add(m[1]);
24139
+ for (const m of text3.matchAll(BARE_RE)) add(m[1]);
23826
24140
  return [...out];
23827
24141
  }
23828
24142
  function newTurn(start) {
@@ -23967,13 +24281,13 @@ var DeliveryIndex = class {
23967
24281
  }
23968
24282
  }
23969
24283
  toDelivery(s2, t, files) {
23970
- const text2 = t.text.trim();
23971
- if (!t.tools || text2.length < MIN_TEXT || t.marksStop && !t.ended) return void 0;
24284
+ const text3 = t.text.trim();
24285
+ if (!t.tools || text3.length < MIN_TEXT || t.marksStop && !t.ended) return void 0;
23972
24286
  const id = `${s2.account}:${s2.sessionId}:${t.start.id}`;
23973
24287
  const attachments2 = [];
23974
24288
  const paths = /* @__PURE__ */ new Map();
23975
24289
  for (const f of t.files) if (!pathProblem(f.path) && !paths.has(f.path)) paths.set(f.path, f.caption);
23976
- for (const p of linkedFiles(text2, s2.project)) if (!paths.has(p)) paths.set(p, void 0);
24290
+ for (const p of linkedFiles(text3, s2.project)) if (!paths.has(p)) paths.set(p, void 0);
23977
24291
  for (const [path, caption] of paths) {
23978
24292
  const ft = fileType(path);
23979
24293
  if (!ft) continue;
@@ -23988,8 +24302,8 @@ var DeliveryIndex = class {
23988
24302
  files.set(aid, { kind: "capture", type: c.type, data: Buffer.from(c.data, "base64"), name });
23989
24303
  attachments2.push({ id: aid, name, kind: "image", caption: tr("Tela capturada pelo agente"), capture: true });
23990
24304
  });
23991
- const headline = headlineOf(text2);
23992
- const summary = summaryOf(text2, headline);
24305
+ const headline = headlineOf(text3);
24306
+ const summary = summaryOf(text3, headline);
23993
24307
  const agentName2 = s2.agentId ? this.opts.agentName?.(s2.agentId) : void 0;
23994
24308
  const provider = s2.provider;
23995
24309
  return {
@@ -24003,7 +24317,7 @@ var DeliveryIndex = class {
24003
24317
  request: cut2(stripMarkdown(t.start.text), REQUEST_MAX),
24004
24318
  headline,
24005
24319
  ...summary ? { summary } : {},
24006
- text: text2.slice(0, 4e4),
24320
+ text: text3.slice(0, 4e4),
24007
24321
  startedAt: t.start.at,
24008
24322
  finishedAt: t.textAt,
24009
24323
  tools: t.tools,
@@ -24014,7 +24328,7 @@ var DeliveryIndex = class {
24014
24328
  };
24015
24329
 
24016
24330
  // server/central/merge.ts
24017
- var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
24331
+ var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
24018
24332
  var partialOf = (r) => r.missing.length ? { partial: true, unavailable: r.missing } : {};
24019
24333
  function withoutRemote(snap) {
24020
24334
  return {
@@ -24036,9 +24350,9 @@ function addTotals(into, from) {
24036
24350
  }
24037
24351
  var cloneTotals = (t) => ({ ...t, ms: { ...t.ms }, counts: { ...t.counts } });
24038
24352
  function validDay(body2) {
24039
- if (!isObj3(body2) || !isObj3(body2.stats)) throw new Error("corpo inesperado");
24353
+ if (!isObj4(body2) || !isObj4(body2.stats)) throw new Error("corpo inesperado");
24040
24354
  const s2 = body2.stats;
24041
- if (!isObj3(s2.totals) || !isObj3(s2.totals.ms) || !isObj3(s2.totals.counts) || !Array.isArray(s2.rooms) || !Array.isArray(s2.accounts) || !Array.isArray(s2.hours) || !Array.isArray(s2.waits)) throw new Error("corpo inesperado");
24355
+ if (!isObj4(s2.totals) || !isObj4(s2.totals.ms) || !isObj4(s2.totals.counts) || !Array.isArray(s2.rooms) || !Array.isArray(s2.accounts) || !Array.isArray(s2.hours) || !Array.isArray(s2.waits)) throw new Error("corpo inesperado");
24042
24356
  return body2;
24043
24357
  }
24044
24358
  function mergeDayStats(local, remotes) {
@@ -24088,7 +24402,7 @@ function createCentralMerge(hub2, opts = {}) {
24088
24402
  const r = await fanOutAll(hub2, "/api/deliveries", {
24089
24403
  timeoutMs,
24090
24404
  map: (m, b) => {
24091
- if (!isObj3(b) || !Array.isArray(b.deliveries)) throw new Error("corpo inesperado");
24405
+ if (!isObj4(b) || !Array.isArray(b.deliveries)) throw new Error("corpo inesperado");
24092
24406
  return b.deliveries.map((d) => namespaceDelivery(m, d));
24093
24407
  }
24094
24408
  });
@@ -24101,7 +24415,7 @@ function createCentralMerge(hub2, opts = {}) {
24101
24415
  const r = await fanOutAll(hub2, "/api/sessions/recent", {
24102
24416
  timeoutMs,
24103
24417
  map: (m, b) => {
24104
- if (!isObj3(b) || !Array.isArray(b.sessions)) throw new Error("corpo inesperado");
24418
+ if (!isObj4(b) || !Array.isArray(b.sessions)) throw new Error("corpo inesperado");
24105
24419
  return b.sessions.map((s2) => namespaceSession(m, s2));
24106
24420
  }
24107
24421
  });
@@ -24122,7 +24436,7 @@ function createCentralMerge(hub2, opts = {}) {
24122
24436
  timeoutMs,
24123
24437
  search,
24124
24438
  map: (_m, b) => {
24125
- if (!isObj3(b) || !Array.isArray(b.days) || !b.days.every((d) => typeof d === "string")) throw new Error("corpo inesperado");
24439
+ if (!isObj4(b) || !Array.isArray(b.days) || !b.days.every((d) => typeof d === "string")) throw new Error("corpo inesperado");
24126
24440
  return b.days;
24127
24441
  }
24128
24442
  });
@@ -24633,8 +24947,8 @@ function demoCodexPermission(id, src, rng, now) {
24633
24947
  }
24634
24948
 
24635
24949
  // shared/demo/terminal.ts
24636
- function startsWithText(text2, key) {
24637
- return text2.startsWith(key.split("{0}")[0]) || text2.startsWith(tr(key, ["\0"]).split("\0")[0]);
24950
+ function startsWithText(text3, key) {
24951
+ return text3.startsWith(key.split("{0}")[0]) || text3.startsWith(tr(key, ["\0"]).split("\0")[0]);
24638
24952
  }
24639
24953
  var POOLS = {
24640
24954
  ts: ["src/app.ts", "src/utils/format.ts", "src/components/Item.tsx", "tests/app.test.ts"],
@@ -24650,7 +24964,7 @@ function pickFiles(pool, seed, n2) {
24650
24964
  return Array.from({ length: Math.min(n2, pool.length) }, (_, k) => pool[(seed + k) % pool.length]);
24651
24965
  }
24652
24966
  var pick = (arr, seed) => arr[seed % arr.length];
24653
- var num6 = (seed, min, max) => min + seed % (max - min + 1);
24967
+ var num7 = (seed, min, max) => min + seed % (max - min + 1);
24654
24968
  var hex = (seed) => seed.toString(16).padStart(8, "0").slice(0, 7);
24655
24969
  function rel(path, ctx) {
24656
24970
  return ctx.root && path.startsWith(`${ctx.root}/`) ? path.slice(ctx.root.length + 1) : path;
@@ -24739,7 +25053,7 @@ function editPair(file, seed) {
24739
25053
  function commandOutput(command, seed, ctx) {
24740
25054
  const branch = ctx.agent.gitBranch ?? "main";
24741
25055
  const [f1, f2] = pickFiles(ctx.pool, seed, 2);
24742
- const n2 = (min, max) => num6(seed, min, max);
25056
+ const n2 = (min, max) => num7(seed, min, max);
24743
25057
  const secs = `${n2(1, 9)}.${n2(10, 99)}`;
24744
25058
  if (/playwright\s+test/.test(command)) return `Running ${n2(8, 30)} tests using 4 workers
24745
25059
 
@@ -24812,7 +25126,7 @@ function isBackground(i, ctx) {
24812
25126
  }
24813
25127
  function shellCall(out, a, i, command, seed, ctx, output) {
24814
25128
  const bg = isBackground(i, ctx);
24815
- const result = bg ? ctx.codex ? tr("Comando rodando em segundo plano (sess\xE3o {0}).", [num6(seed, 1e3, 9999)]) : tr("Comando rodando em segundo plano (id b{0}). Voc\xEA recebe um aviso quando ele terminar.", [hex(seed)]) : output ?? commandOutput(command, seed, ctx);
25129
+ const result = bg ? ctx.codex ? tr("Comando rodando em segundo plano (sess\xE3o {0}).", [num7(seed, 1e3, 9999)]) : tr("Comando rodando em segundo plano (id b{0}). Voc\xEA recebe um aviso quando ele terminar.", [hex(seed)]) : output ?? commandOutput(command, seed, ctx);
24816
25130
  const firstLine5 = command.split("\n")[0];
24817
25131
  const tool = ctx.codex ? "Shell" : "Bash";
24818
25132
  call(out, a, tool, `${tool}(${firstLine5}${command.includes("\n") ? " \u2026" : ""})`, result, { input: command, inputKind: "command" });
@@ -24853,8 +25167,8 @@ function entriesFor(a, i, ctx, out) {
24853
25167
  out.push({ kind: "user", id: `${a.id}:u`, at: a.at, text: detail ?? quoted(a.text) ?? a.text });
24854
25168
  return;
24855
25169
  case "think": {
24856
- const text2 = startsWithText(a.text, tr("Pensando")) ? seed % 3 === 0 ? void 0 : pick(THOUGHTS, seed >>> 3) : tr("Os subagentes terminaram; vou juntar o que cada um encontrou.");
24857
- out.push(text2 ? { kind: "thinking", id: `${a.id}:k`, at: a.at, text: text2 } : { kind: "thinking", id: `${a.id}:k`, at: a.at });
25170
+ const text3 = startsWithText(a.text, tr("Pensando")) ? seed % 3 === 0 ? void 0 : pick(THOUGHTS, seed >>> 3) : tr("Os subagentes terminaram; vou juntar o que cada um encontrou.");
25171
+ out.push(text3 ? { kind: "thinking", id: `${a.id}:k`, at: a.at, text: text3 } : { kind: "thinking", id: `${a.id}:k`, at: a.at });
24858
25172
  return;
24859
25173
  }
24860
25174
  case "respond":
@@ -24897,7 +25211,7 @@ function entriesFor(a, i, ctx, out) {
24897
25211
  return;
24898
25212
  }
24899
25213
  const files = pickFiles(ctx.pool, seed, 1 + seed % 3);
24900
- const matches = files.map((f, k) => `${f}:${num6(hash32(`${a.id}:${k}`), 3, 180)}: ${/^\w+$/.test(pattern) ? `const resultado = ${pattern}(dados);` : pattern}`);
25214
+ const matches = files.map((f, k) => `${f}:${num7(hash32(`${a.id}:${k}`), 3, 180)}: ${/^\w+$/.test(pattern) ? `const resultado = ${pattern}(dados);` : pattern}`);
24901
25215
  if (ctx.codex) shellCall(out, a, i, `rg -n ${JSON.stringify(pattern)}`, seed, ctx, matches.join("\n"));
24902
25216
  else call(out, a, "Grep", `Grep(${pattern})`, matches.join("\n"), { input: '{\n "output_mode": "content"\n}', inputKind: "json" });
24903
25217
  return;
@@ -24960,8 +25274,8 @@ function entriesFor(a, i, ctx, out) {
24960
25274
  });
24961
25275
  return;
24962
25276
  case "done": {
24963
- const text2 = ctx.agent.kind === "sub" && ctx.agent.title ? tr("Entrega: {0}. Resumo enviado ao agente principal.", [ctx.agent.title]) : pick(SUMMARIES, seed);
24964
- out.push({ kind: "assistant", id: `${a.id}:a`, at: a.at, text: text2 });
25277
+ const text3 = ctx.agent.kind === "sub" && ctx.agent.title ? tr("Entrega: {0}. Resumo enviado ao agente principal.", [ctx.agent.title]) : pick(SUMMARIES, seed);
25278
+ out.push({ kind: "assistant", id: `${a.id}:a`, at: a.at, text: text3 });
24965
25279
  const took = /Concluiu em (.+)$/.exec(a.text)?.[1];
24966
25280
  if (took) out.push({ kind: "system", id: `${a.id}:s`, at: a.at, text: tr("Turno conclu\xEDdo em {0}", [took]), level: "info" });
24967
25281
  return;
@@ -25901,8 +26215,8 @@ function githubEventKey(ev) {
25901
26215
  }
25902
26216
  function describeGitHubEvent(ev, agentName2, roomName) {
25903
26217
  const pr = ev.number !== void 0 ? tr("o PR #{0}", [ev.number]) : tr("um PR");
25904
- const act = (icon, text2, detail, error = false) => {
25905
- const d = { kind: "git", icon, text: clean2(text2, MAX_TEXT4), tool: GITHUB_TOOL };
26218
+ const act = (icon, text3, detail, error = false) => {
26219
+ const d = { kind: "git", icon, text: clean2(text3, MAX_TEXT4), tool: GITHUB_TOOL };
25906
26220
  const det = detail ?? ev.url ?? ev.repo;
25907
26221
  if (det) d.detail = clean2(det, 300);
25908
26222
  if (error) d.error = true;
@@ -25954,8 +26268,8 @@ var RoomEffects = class {
25954
26268
  /** Aplica um evento à sala; true se o efeito visível mudou. */
25955
26269
  apply(roomId, ev, now, agentId) {
25956
26270
  const slots = this.rooms.get(roomId) ?? {};
25957
- const make2 = (kind, text2, ms) => {
25958
- const fx = { kind, text: text2, at: now, until: now + ms };
26271
+ const make2 = (kind, text3, ms) => {
26272
+ const fx = { kind, text: text3, at: now, until: now + ms };
25959
26273
  if (agentId) fx.agentId = agentId;
25960
26274
  return fx;
25961
26275
  };
@@ -26238,15 +26552,15 @@ var DemoSimulator = class {
26238
26552
  * atividade "Mensagem pelo Habblaud" e, se ele estava à toa, o próximo turno começa logo, como se respondesse.
26239
26553
  * false = agente desconhecido, subagente ou que já saiu.
26240
26554
  */
26241
- receiveMessage(agentId, text2, now = Date.now()) {
26555
+ receiveMessage(agentId, text3, now = Date.now()) {
26242
26556
  const a = this.agents.get(agentId);
26243
26557
  if (!a || a.info.kind !== "main" || a.removeAt !== void 0 || a.phase === "leaving") return false;
26244
26558
  if (a.info.provider === "codex") {
26245
- (a.inbox ??= []).push(text2);
26246
- a.inboxAt = Math.max(a.inboxAt ?? 0, now + (CODEX_QUEUE_MIN_MS + hash32(`${agentId}:${text2}:${now}`) % CODEX_QUEUE_SPREAD_MS) / this.speed);
26559
+ (a.inbox ??= []).push(text3);
26560
+ a.inboxAt = Math.max(a.inboxAt ?? 0, now + (CODEX_QUEUE_MIN_MS + hash32(`${agentId}:${text3}:${now}`) % CODEX_QUEUE_SPREAD_MS) / this.speed);
26247
26561
  return true;
26248
26562
  }
26249
- this.activity(a, now, describeMessage(text2));
26563
+ this.activity(a, now, describeMessage(text3));
26250
26564
  if (a.phase === "idle") a.phaseUntil = Math.min(a.phaseUntil, now + this.ms(1500, 3e3));
26251
26565
  return true;
26252
26566
  }
@@ -26622,7 +26936,7 @@ var DemoSimulator = class {
26622
26936
  if (a.removeAt !== void 0) return;
26623
26937
  if (a.info.kind === "sub") return this.stepSub(a, now);
26624
26938
  if (a.inbox?.length && a.phase === "idle" && now >= (a.inboxAt ?? 0)) {
26625
- for (const text2 of a.inbox.splice(0)) this.activity(a, now, describeMessage(text2));
26939
+ for (const text3 of a.inbox.splice(0)) this.activity(a, now, describeMessage(text3));
26626
26940
  a.phaseUntil = Math.min(a.phaseUntil, now + 1500 / this.speed);
26627
26941
  a.closeAt = Math.max(a.closeAt, now + 3e4 / this.speed);
26628
26942
  }
@@ -26904,8 +27218,8 @@ var DemoSimulator = class {
26904
27218
  });
26905
27219
  this.dirty = true;
26906
27220
  }
26907
- notice(now, level, text2, agentId, roomId) {
26908
- const n2 = { id: `${this.prefix}${this.tag}-n${++this.seq}`, level, text: text2, at: now };
27221
+ notice(now, level, text3, agentId, roomId) {
27222
+ const n2 = { id: `${this.prefix}${this.tag}-n${++this.seq}`, level, text: text3, at: now };
26909
27223
  if (agentId) n2.agentId = agentId;
26910
27224
  if (roomId) n2.roomId = roomId;
26911
27225
  this.pendingNotices.push(n2);
@@ -28168,8 +28482,8 @@ var Office = class {
28168
28482
  this.addActivity(id, act, true, { feed: live });
28169
28483
  if (!live || outcome === "killed") return;
28170
28484
  const room = this.roomName(info.roomId);
28171
- const text2 = outcome === "ok" ? tr("\u2705 {0}: shell terminou em {1} \u2014 {2}", [info.name, room, job.label]) : tr("\u274C {0}: shell falhou em {1} \u2014 {2}", [info.name, room, job.label]);
28172
- this.notice("shellDone", id, outcome === "ok" ? "success" : "warn", text2, info.roomId, { dedupeKey: `${id}|shellDone|${job.id}` });
28485
+ const text3 = outcome === "ok" ? tr("\u2705 {0}: shell terminou em {1} \u2014 {2}", [info.name, room, job.label]) : tr("\u274C {0}: shell falhou em {1} \u2014 {2}", [info.name, room, job.label]);
28486
+ this.notice("shellDone", id, outcome === "ok" ? "success" : "warn", text3, info.roomId, { dedupeKey: `${id}|shellDone|${job.id}` });
28173
28487
  }
28174
28488
  /**
28175
28489
  * Evento do GitHub visto no transcript (PR aberto/mergeado, push, CI, release; ver shared/github.ts):
@@ -28441,8 +28755,8 @@ var Office = class {
28441
28755
  const info = this.agents.get(id)?.info;
28442
28756
  if (!info) return;
28443
28757
  const room = this.roomName(info.roomId);
28444
- const text2 = kind === "question" ? tr("\u2753 {0} tem uma pergunta em {1}: {2}", [info.name, room, what]) : tr("\u{1F510} {0} pede permiss\xE3o em {1}: {2}", [info.name, room, what]);
28445
- this.notice("wait", id, "alert", text2, info.roomId);
28758
+ const text3 = kind === "question" ? tr("\u2753 {0} tem uma pergunta em {1}: {2}", [info.name, room, what]) : tr("\u{1F510} {0} pede permiss\xE3o em {1}: {2}", [info.name, room, what]);
28759
+ this.notice("wait", id, "alert", text3, info.roomId);
28446
28760
  this.markDirty();
28447
28761
  }
28448
28762
  /** Decisão para um pedido fictício do demo. true = o pedido era do demo (e foi respondido). */
@@ -28464,10 +28778,10 @@ var Office = class {
28464
28778
  return this.demoSnap?.agents.find((a) => a.id === id);
28465
28779
  }
28466
28780
  /** Entrega fictícia de uma mensagem a um agente do demo. false = ele já saiu (ou o demo foi desligado). */
28467
- deliverDemoMessage(agentId, text2) {
28781
+ deliverDemoMessage(agentId, text3) {
28468
28782
  if (!this.demo) return false;
28469
28783
  const now = this.now();
28470
- if (!this.demo.receiveMessage(agentId, text2, now)) return false;
28784
+ if (!this.demo.receiveMessage(agentId, text3, now)) return false;
28471
28785
  this.demoSnap = this.demo.snapshot(now);
28472
28786
  this.markDirty();
28473
28787
  return true;
@@ -28509,8 +28823,8 @@ var Office = class {
28509
28823
  else delete info.parts;
28510
28824
  info.custom = true;
28511
28825
  const room = this.roomName(info.roomId);
28512
- const text2 = before === input.name ? tr("\u270F\uFE0F {0} mudou de visual em {1}", [input.name, room]) : tr("\u270F\uFE0F {0} agora \xE9 {1} em {2}", [before, input.name, room]);
28513
- this.notice("character", id, "info", text2, info.roomId, { dedupeMs: 0 });
28826
+ const text3 = before === input.name ? tr("\u270F\uFE0F {0} mudou de visual em {1}", [input.name, room]) : tr("\u270F\uFE0F {0} agora \xE9 {1} em {2}", [before, input.name, room]);
28827
+ this.notice("character", id, "info", text3, info.roomId, { dedupeMs: 0 });
28514
28828
  this.markDirty();
28515
28829
  return { result: "ok" };
28516
28830
  }
@@ -28792,13 +29106,13 @@ var Office = class {
28792
29106
  for (let i = 0; i < ordered.length; i++) ordered[i].duplicateSession = { count: ordered.length, newest: i === ordered.length - 1 };
28793
29107
  if (!previous || previous.has(key) || this.booting) continue;
28794
29108
  const newest = ordered[ordered.length - 1];
28795
- const text2 = tr("\u{1F6A8} Intrus\xE3o! A conversa de {0} est\xE1 aberta em {1} terminais", [newest.name, ordered.length]);
28796
- const effect = { kind: "intrusion", text: text2, at: now, until: now + ALARM_MS, panicUntil: now + INTRUSION_PANIC_MS, agentIds: ordered.map((agent) => agent.id) };
29109
+ const text3 = tr("\u{1F6A8} Intrus\xE3o! A conversa de {0} est\xE1 aberta em {1} terminais", [newest.name, ordered.length]);
29110
+ const effect = { kind: "intrusion", text: text3, at: now, until: now + ALARM_MS, panicUntil: now + INTRUSION_PANIC_MS, agentIds: ordered.map((agent) => agent.id) };
28797
29111
  this.intrusions.set(key, effect);
28798
29112
  this.buildingEffect = effect;
28799
29113
  const id = `intrusion:${++this.seq}`;
28800
29114
  const roomName = rooms.find((room) => room.id === newest.roomId)?.name ?? newest.roomId;
28801
- const activity = { id, kind: "other", icon: "\u{1F6A8}", text: tr("Intrus\xE3o no pr\xE9dio"), detail: text2, at: now };
29115
+ const activity = { id, kind: "other", icon: "\u{1F6A8}", text: tr("Intrus\xE3o no pr\xE9dio"), detail: text3, at: now };
28802
29116
  this.pushFeed([{
28803
29117
  id,
28804
29118
  agentId: newest.id,
@@ -28808,7 +29122,7 @@ var Office = class {
28808
29122
  account: newest.account,
28809
29123
  activity
28810
29124
  }]);
28811
- this.pendingNotices.push({ id, level: "alert", text: text2, agentId: newest.id, roomId: newest.roomId, at: now });
29125
+ this.pendingNotices.push({ id, level: "alert", text: text3, agentId: newest.id, roomId: newest.roomId, at: now });
28812
29126
  }
28813
29127
  this.duplicateGroups = current2;
28814
29128
  for (const key of this.intrusions.keys()) if (!current2.has(key)) this.intrusions.delete(key);
@@ -28897,7 +29211,7 @@ var Office = class {
28897
29211
  this.feed.push(...items);
28898
29212
  if (this.feed.length > FEED_LIMIT) this.feed.splice(0, this.feed.length - FEED_LIMIT);
28899
29213
  }
28900
- notice(kind, key, level, text2, roomId, opts = {}) {
29214
+ notice(kind, key, level, text3, roomId, opts = {}) {
28901
29215
  if (this.booting) return;
28902
29216
  const now = this.now();
28903
29217
  const k = opts.dedupeKey ?? `${key}|${kind}`;
@@ -28908,7 +29222,7 @@ var Office = class {
28908
29222
  if (this.noticeAt.size > 2e3) {
28909
29223
  for (const [nk, t] of this.noticeAt) if (now - t > Math.max(NOTICE_DEDUPE_MS, SHELL_NOTICE_DEDUPE_MS)) this.noticeAt.delete(nk);
28910
29224
  }
28911
- const n2 = { id: `n-${now.toString(36)}-${++this.seq}`, level, text: text2, at: now };
29225
+ const n2 = { id: `n-${now.toString(36)}-${++this.seq}`, level, text: text3, at: now };
28912
29226
  if (kind !== "room") n2.agentId = key;
28913
29227
  if (roomId) n2.roomId = roomId;
28914
29228
  this.pendingNotices.push(n2);
@@ -29539,6 +29853,261 @@ function createAvatarRoutes(store, hub2) {
29539
29853
  };
29540
29854
  }
29541
29855
 
29856
+ // server/inbox/store.ts
29857
+ import { randomBytes as randomBytes9 } from "node:crypto";
29858
+ import { mkdirSync as mkdirSync13, readFileSync as readFileSync18, renameSync as renameSync12, writeFileSync as writeFileSync12 } from "node:fs";
29859
+ import { dirname as dirname11 } from "node:path";
29860
+ var InboxStore = class {
29861
+ constructor(file, opts = {}) {
29862
+ this.file = file;
29863
+ this.now = opts.now ?? Date.now;
29864
+ this.newId = opts.id ?? (() => randomBytes9(6).toString("hex"));
29865
+ this.items = this.load();
29866
+ this.dropOldResolved();
29867
+ }
29868
+ file;
29869
+ items;
29870
+ now;
29871
+ newId;
29872
+ listeners = /* @__PURE__ */ new Set();
29873
+ /** Every stored item (open and resolved), oldest first. */
29874
+ list() {
29875
+ return structuredClone(this.items);
29876
+ }
29877
+ get(id) {
29878
+ const i = this.items.find((x) => x.id === id);
29879
+ return i ? structuredClone(i) : void 0;
29880
+ }
29881
+ openCount() {
29882
+ return this.items.filter((i) => i.status === "open").length;
29883
+ }
29884
+ onChange(cb) {
29885
+ this.listeners.add(cb);
29886
+ return () => void this.listeners.delete(cb);
29887
+ }
29888
+ post(input, from) {
29889
+ const now = this.now();
29890
+ const existing = input.key ? this.items.find((i) => i.key === input.key) : void 0;
29891
+ const reopened = existing?.status === "resolved";
29892
+ if ((!existing || reopened) && this.openCount() >= INBOX_OPEN_MAX) return { error: "full" };
29893
+ let item;
29894
+ if (existing) {
29895
+ item = existing;
29896
+ item.title = input.title;
29897
+ if (input.body !== void 0) item.body = input.body;
29898
+ else delete item.body;
29899
+ if (input.link !== void 0) item.link = input.link;
29900
+ else delete item.link;
29901
+ item.from = from;
29902
+ item.status = "open";
29903
+ item.updatedAt = now;
29904
+ delete item.resolvedAt;
29905
+ } else {
29906
+ item = { id: this.newId(), title: input.title, from, scope: "local", status: "open", createdAt: now, updatedAt: now };
29907
+ if (input.key) item.key = input.key;
29908
+ if (input.body !== void 0) item.body = input.body;
29909
+ if (input.link !== void 0) item.link = input.link;
29910
+ this.items.push(item);
29911
+ }
29912
+ this.save();
29913
+ const created = !existing;
29914
+ const out = structuredClone(item);
29915
+ this.emit(created || reopened ? { kind: "arrived", item: out } : { kind: "changed" });
29916
+ return { item: out, created, reopened };
29917
+ }
29918
+ /** Marks the item resolved (idempotent); undefined for an unknown id. */
29919
+ resolve(id) {
29920
+ const item = this.items.find((i) => i.id === id);
29921
+ if (!item) return void 0;
29922
+ if (item.status === "open") {
29923
+ const now = this.now();
29924
+ item.status = "resolved";
29925
+ item.resolvedAt = now;
29926
+ item.updatedAt = now;
29927
+ this.save();
29928
+ this.emit({ kind: "changed" });
29929
+ }
29930
+ return structuredClone(item);
29931
+ }
29932
+ /** Drops resolved items older than 7 days; true when something was dropped. */
29933
+ purge() {
29934
+ if (!this.dropOldResolved()) return false;
29935
+ this.save();
29936
+ this.emit({ kind: "changed" });
29937
+ return true;
29938
+ }
29939
+ dropOldResolved() {
29940
+ const limit = this.now() - INBOX_RESOLVED_KEEP_MS;
29941
+ const before = this.items.length;
29942
+ this.items = this.items.filter((i) => !(i.status === "resolved" && (i.resolvedAt ?? i.updatedAt) <= limit));
29943
+ return this.items.length !== before;
29944
+ }
29945
+ emit(e) {
29946
+ for (const cb of this.listeners) cb(e);
29947
+ }
29948
+ load() {
29949
+ if (!this.file) return [];
29950
+ try {
29951
+ const j = JSON.parse(readFileSync18(this.file, "utf8"));
29952
+ if (!Array.isArray(j.items)) return [];
29953
+ return j.items.map(parseInboxItem).filter((i) => !!i);
29954
+ } catch (err) {
29955
+ if (err.code !== "ENOENT") log.warn(tr("inbox.json ileg\xEDvel ({0}); come\xE7ando sem itens.", [errMsg(err)]));
29956
+ return [];
29957
+ }
29958
+ }
29959
+ save() {
29960
+ if (!this.file) return;
29961
+ try {
29962
+ mkdirSync13(dirname11(this.file), { recursive: true });
29963
+ writeFileSync12(`${this.file}.tmp`, JSON.stringify({ version: 1, items: this.items }, null, 2));
29964
+ renameSync12(`${this.file}.tmp`, this.file);
29965
+ } catch (err) {
29966
+ log.warn(tr("N\xE3o consegui gravar {0}: {1}", [this.file, errMsg(err)]));
29967
+ }
29968
+ }
29969
+ };
29970
+
29971
+ // server/inbox/sender.ts
29972
+ var PID_ID = /:(\d+)$/;
29973
+ function senderFor(post, agents2) {
29974
+ const byPid = /* @__PURE__ */ new Map();
29975
+ for (const a of agents2) {
29976
+ if (a.parentId || a.id.startsWith("@")) continue;
29977
+ const m = PID_ID.exec(a.id);
29978
+ if (m) byPid.set(Number(m[1]), a.id);
29979
+ }
29980
+ for (const pid of post.ancestors) {
29981
+ const id = byPid.get(pid);
29982
+ if (id) return { kind: "agent", agentId: id };
29983
+ }
29984
+ return post.source ? { kind: "script", name: post.source } : { kind: "script" };
29985
+ }
29986
+
29987
+ // server/inbox/service.ts
29988
+ var InboxService = class {
29989
+ store;
29990
+ agents;
29991
+ remote;
29992
+ offRemote;
29993
+ frameCbs = /* @__PURE__ */ new Set();
29994
+ constructor(opts) {
29995
+ this.store = opts.store;
29996
+ this.agents = opts.agents;
29997
+ this.store.onChange((e) => this.emit(e.kind === "arrived" ? e.item : void 0));
29998
+ }
29999
+ /** Central: also list (and resolve) the items of the paired machines. */
30000
+ setRemote(remote) {
30001
+ this.offRemote?.();
30002
+ this.remote = remote;
30003
+ this.offRemote = remote?.onChange((arrived) => this.emit(arrived));
30004
+ }
30005
+ /** What the page shows: open items first, then the recently resolved ones. */
30006
+ frame(arrived) {
30007
+ const items = visibleInbox([...this.store.list(), ...this.remote?.items() ?? []]);
30008
+ return arrived ? { items, arrived } : { items };
30009
+ }
30010
+ onFrame(cb) {
30011
+ this.frameCbs.add(cb);
30012
+ return () => void this.frameCbs.delete(cb);
30013
+ }
30014
+ /** Leaves an item on this machine's desk; the sender comes from the CLI's process tree. */
30015
+ post(post) {
30016
+ return this.store.post(post, senderFor(post, this.agents()));
30017
+ }
30018
+ async resolve(id) {
30019
+ if (parseRemoteId(id)) return this.remote ? this.remote.resolve(id) : { ok: false, status: 404, error: "unknown" };
30020
+ const item = this.store.resolve(id);
30021
+ return item ? { ok: true, item } : { ok: false, status: 404, error: "unknown" };
30022
+ }
30023
+ emit(arrived) {
30024
+ if (!this.frameCbs.size) return;
30025
+ const f = this.frame(arrived);
30026
+ for (const cb of this.frameCbs) cb(f);
30027
+ }
30028
+ };
30029
+
30030
+ // server/inbox/http.ts
30031
+ var RESOLVE_ROUTE = /^\/api\/inbox\/([^/]+)\/resolve$/;
30032
+ function createInboxRoutes(service) {
30033
+ const fail3 = (res, err) => {
30034
+ if (res.headersSent) return void res.destroy();
30035
+ if (err instanceof HttpError) sendJson2(res, err.status, { error: err.message });
30036
+ else sendJson2(res, 500, { error: tr("erro interno") });
30037
+ };
30038
+ const post = async (req, res) => {
30039
+ const parsed = parseInboxPost(await readJson(req));
30040
+ if (!parsed.ok) throw new HttpError(400, parsed.error);
30041
+ const r = service.post(parsed.post);
30042
+ if ("error" in r) throw new HttpError(429, tr("a mesa j\xE1 tem {0} itens abertos: resolva alguns antes de deixar outros", [INBOX_OPEN_MAX]));
30043
+ sendJson2(res, r.created ? 201 : 200, { ok: true, item: r.item, created: r.created, ...r.created ? {} : { reopened: r.reopened } });
30044
+ };
30045
+ const resolve14 = async (res, id) => {
30046
+ const r = await service.resolve(id);
30047
+ if (!r.ok) throw new HttpError(r.status, r.status === 404 ? tr("item n\xE3o encontrado") : r.error);
30048
+ sendJson2(res, 200, { ok: true, ...r.item ? { item: r.item } : {} });
30049
+ };
30050
+ return (req, res, path) => {
30051
+ const method = req.method ?? "GET";
30052
+ const m = RESOLVE_ROUTE.exec(path);
30053
+ if (m) {
30054
+ if (method !== "POST") {
30055
+ res.setHeader("Allow", "POST");
30056
+ return sendJson2(res, 405, { error: tr("m\xE9todo n\xE3o permitido") });
30057
+ }
30058
+ let id;
30059
+ try {
30060
+ id = decodeURIComponent(m[1]);
30061
+ } catch {
30062
+ return sendJson2(res, 404, { error: tr("item n\xE3o encontrado") });
30063
+ }
30064
+ req.resume();
30065
+ resolve14(res, id).catch((err) => fail3(res, err));
30066
+ } else if (method === "GET" || method === "HEAD") sendJson2(res, 200, service.frame());
30067
+ else if (method === "POST") post(req, res).catch((err) => fail3(res, err));
30068
+ else {
30069
+ res.setHeader("Allow", "GET, POST");
30070
+ sendJson2(res, 405, { error: tr("m\xE9todo n\xE3o permitido") });
30071
+ }
30072
+ };
30073
+ }
30074
+
30075
+ // server/central/inbox.ts
30076
+ var RemoteInboxItems = class {
30077
+ constructor(hub2) {
30078
+ this.hub = hub2;
30079
+ }
30080
+ hub;
30081
+ items() {
30082
+ return this.hub.inboxItems();
30083
+ }
30084
+ onChange(cb) {
30085
+ return this.hub.onInbox(cb);
30086
+ }
30087
+ async resolve(id) {
30088
+ const ref = parseRemoteId(id);
30089
+ if (!ref) return { ok: false, status: 404, error: "unknown" };
30090
+ const q = this.hub.enqueue(ref.machine, { type: "inbox.resolve", itemId: ref.local });
30091
+ if ("error" in q) return { ok: false, status: 503, error: "offline" };
30092
+ try {
30093
+ const r = await q.result;
30094
+ if (!r.ok) return { ok: false, status: r.data === "not-found" ? 404 : r.status ?? 502, error: r.error ?? "failed" };
30095
+ } catch {
30096
+ return { ok: false, status: 504, error: "timeout" };
30097
+ }
30098
+ this.hub.markInboxResolved(ref.machine, ref.local);
30099
+ return { ok: true };
30100
+ }
30101
+ };
30102
+ function createInboxResolveHandler(opts) {
30103
+ return async (a, deadline) => {
30104
+ if (a.type !== "inbox.resolve") return { actionId: a.id, ok: false, error: "unsupported" };
30105
+ if (Date.now() > deadline) return { actionId: a.id, ok: false, error: "expired" };
30106
+ const item = opts.store.resolve(a.itemId);
30107
+ return item ? { actionId: a.id, ok: true, data: "ok" } : { actionId: a.id, ok: false, data: "not-found", status: 404, error: "not-found" };
30108
+ };
30109
+ }
30110
+
29542
30111
  // server/attention/drain.ts
29543
30112
  function drainAttention(relay, hub2) {
29544
30113
  for (const close of relay.expire()) hub2.broadcast("attention", close);
@@ -29676,8 +30245,8 @@ function findCodexBin(env, isExecutable = canExecute) {
29676
30245
  }
29677
30246
  return void 0;
29678
30247
  }
29679
- function queueArgs(thread, text2) {
29680
- return ["queue", `--thread=${thread}`, `--message=${text2}`];
30248
+ function queueArgs(thread, text3) {
30249
+ return ["queue", `--thread=${thread}`, `--message=${text3}`];
29681
30250
  }
29682
30251
  function firstLine2(s2) {
29683
30252
  const line2 = (s2 ?? "").split(/\r?\n/).map((l) => l.trim()).find(Boolean);
@@ -29705,7 +30274,7 @@ function createCodexQueueRunner(bin, opts = {}) {
29705
30274
  }
29706
30275
 
29707
30276
  // server/messages/images.ts
29708
- import { randomBytes as randomBytes9 } from "node:crypto";
30277
+ import { randomBytes as randomBytes10 } from "node:crypto";
29709
30278
  function sniffImage(data) {
29710
30279
  if (data.length >= 8 && data.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) return { type: "image/png", ext: "png" };
29711
30280
  if (data.length >= 3 && data[0] === 255 && data[1] === 216 && data[2] === 255) return { type: "image/jpeg", ext: "jpg" };
@@ -29736,7 +30305,7 @@ var MessageImages = class {
29736
30305
  constructor(opts = {}) {
29737
30306
  this.store = opts.store ?? new AttachmentStore();
29738
30307
  this.root = opts.root;
29739
- this.folderId = opts.folderId ?? (() => randomBytes9(6).toString("hex"));
30308
+ this.folderId = opts.folderId ?? (() => randomBytes10(6).toString("hex"));
29740
30309
  this.write = opts.write ?? writeAttachments;
29741
30310
  }
29742
30311
  upload(raw) {
@@ -29904,7 +30473,7 @@ function rec8(v) {
29904
30473
  function str10(v) {
29905
30474
  return typeof v === "string" && v.trim() ? v : void 0;
29906
30475
  }
29907
- function num7(v) {
30476
+ function num8(v) {
29908
30477
  return typeof v === "number" && Number.isFinite(v) ? v : void 0;
29909
30478
  }
29910
30479
  function toMs3(v) {
@@ -29961,12 +30530,12 @@ function parseSessionMeta(payload, at) {
29961
30530
  var WINDOW_BY_MINUTES = { 300: "fiveHour", 10080: "sevenDay" };
29962
30531
  function usageWindow(raw) {
29963
30532
  const w = rec8(raw);
29964
- const minutes = num7(w?.window_minutes);
29965
- const used = num7(w?.used_percent);
30533
+ const minutes = num8(w?.window_minutes);
30534
+ const used = num8(w?.used_percent);
29966
30535
  const key = minutes !== void 0 ? WINDOW_BY_MINUTES[minutes] : void 0;
29967
30536
  if (!w || !key || used === void 0) return void 0;
29968
30537
  const window = { utilization: Math.min(100, Math.max(0, used)) };
29969
- const resets = num7(w.resets_at);
30538
+ const resets = num8(w.resets_at);
29970
30539
  if (resets !== void 0) window.resetsAt = resets < 1e12 ? Math.round(resets * 1e3) : Math.round(resets);
29971
30540
  return { key, window };
29972
30541
  }
@@ -30008,8 +30577,8 @@ function fileChanges(raw) {
30008
30577
  const p = str10(path);
30009
30578
  if (!p) return;
30010
30579
  const kind = changeKind(c.type ?? c.kind);
30011
- const text2 = str10(c.unified_diff) ?? str10(c.diff) ?? str10(c.content) ?? "";
30012
- const e = { path: p, kind, text: text2 };
30580
+ const text3 = str10(c.unified_diff) ?? str10(c.diff) ?? str10(c.content) ?? "";
30581
+ const e = { path: p, kind, text: text3 };
30013
30582
  const move = str10(c.move_path) ?? str10(rec8(c.kind)?.move_path);
30014
30583
  if (move) e.movePath = move;
30015
30584
  out.push(e);
@@ -30049,8 +30618,8 @@ function mcpName(server2, tool) {
30049
30618
  }
30050
30619
  function userMessagingText(server2, tool, args) {
30051
30620
  if (!/user_messag(?:e|ing)[_.]*send_message$/i.test(`${String(server2 ?? "")}__${String(tool ?? "")}`)) return void 0;
30052
- const text2 = rec8(args)?.text ?? parseArguments(args).text;
30053
- return typeof text2 === "string" && text2.trim() ? text2 : void 0;
30621
+ const text3 = rec8(args)?.text ?? parseArguments(args).text;
30622
+ return typeof text3 === "string" && text3.trim() ? text3 : void 0;
30054
30623
  }
30055
30624
  var DELIVERY_COMPLETE = "codex:code-mode-delivery:v1:complete";
30056
30625
  var DELIVERY_INCOMPLETE = "codex:code-mode-delivery:v1:incomplete:";
@@ -30058,16 +30627,16 @@ function deliveredMessage(line2) {
30058
30627
  const marker = str10(rec8(line2.metadata)?.delivered_assistant_message);
30059
30628
  const p = rec8(line2.payload);
30060
30629
  if (!marker || !p || p.type !== "message" || p.role !== "assistant") return void 0;
30061
- let text2 = "";
30062
- if (marker === DELIVERY_COMPLETE) text2 = contentText(p.content).text;
30063
- else if (marker.startsWith(DELIVERY_INCOMPLETE)) text2 = marker.slice(DELIVERY_INCOMPLETE.length);
30064
- if (!text2.trim()) return void 0;
30630
+ let text3 = "";
30631
+ if (marker === DELIVERY_COMPLETE) text3 = contentText(p.content).text;
30632
+ else if (marker.startsWith(DELIVERY_INCOMPLETE)) text3 = marker.slice(DELIVERY_INCOMPLETE.length);
30633
+ if (!text3.trim()) return void 0;
30065
30634
  const id = str10(p.id);
30066
- return id ? { id, text: text2 } : { text: text2 };
30635
+ return id ? { id, text: text3 } : { text: text3 };
30067
30636
  }
30068
- function describeCodexPrompt(text2) {
30069
- const shown2 = truncate(maskSecrets(text2.slice(0, 1e3)), 34);
30070
- return { ...describePrompt(text2), text: truncate(tr("Recebeu \u201C{0}\u201D", [shown2]), 46) };
30637
+ function describeCodexPrompt(text3) {
30638
+ const shown2 = truncate(maskSecrets(text3.slice(0, 1e3)), 34);
30639
+ return { ...describePrompt(text3), text: truncate(tr("Recebeu \u201C{0}\u201D", [shown2]), 46) };
30071
30640
  }
30072
30641
  var PLAN_STATUS = /* @__PURE__ */ new Set(["pending", "in_progress", "completed"]);
30073
30642
  function planTasks(args) {
@@ -30165,15 +30734,15 @@ function contentText(content) {
30165
30734
  return { text: texts.join(""), images };
30166
30735
  }
30167
30736
  function promptText(raw) {
30168
- const text2 = raw.trim();
30169
- if (!text2 || INJECTED.test(text2)) return "";
30170
- return text2;
30737
+ const text3 = raw.trim();
30738
+ if (!text3 || INJECTED.test(text3)) return "";
30739
+ return text3;
30171
30740
  }
30172
30741
  function outputOf(raw) {
30173
30742
  if (typeof raw === "string") {
30174
30743
  try {
30175
30744
  const j = rec8(JSON.parse(raw));
30176
- if (j && typeof j.output === "string") return { text: j.output, exitCode: num7(rec8(j.metadata)?.exit_code) };
30745
+ if (j && typeof j.output === "string") return { text: j.output, exitCode: num8(rec8(j.metadata)?.exit_code) };
30177
30746
  } catch {
30178
30747
  }
30179
30748
  const exit = /^Exit code:\s*(-?\d+)/m.exec(raw.slice(0, 500))?.[1];
@@ -30208,7 +30777,7 @@ var RolloutLineParser = class {
30208
30777
  * mais a posição dentro da linha. Uma releitura do arquivo gera as mesmas chaves (o Office não duplica).
30209
30778
  */
30210
30779
  autoKey() {
30211
- const ordinal = num7(this.j.ordinal);
30780
+ const ordinal = num8(this.j.ordinal);
30212
30781
  const base = ordinal !== void 0 ? `o${ordinal}` : `t${this.at.toString(36)}`;
30213
30782
  const n2 = this.autoKeys++;
30214
30783
  return n2 ? `${base}:${n2}` : base;
@@ -30278,7 +30847,7 @@ var RolloutLineParser = class {
30278
30847
  case "task_complete":
30279
30848
  case "turn_complete": {
30280
30849
  this.endTurn(false);
30281
- const ms = num7(p.duration_ms);
30850
+ const ms = num8(p.duration_ms);
30282
30851
  const err = rec8(p.error);
30283
30852
  const turn = str10(p.turn_id) ?? this.autoKey();
30284
30853
  if (err) this.push(SPECIAL.error(void 0, firstLine3(str10(err.message) ?? "")), { key: `${turn}:err`, current: false });
@@ -30301,8 +30870,8 @@ var RolloutLineParser = class {
30301
30870
  case "agent_message": {
30302
30871
  if (this.paginated()) return;
30303
30872
  this.s.mode ??= "legacy";
30304
- const text2 = str10(p.message);
30305
- if (text2) this.push(SPECIAL.respond(text2));
30873
+ const text3 = str10(p.message);
30874
+ if (text3) this.push(SPECIAL.respond(text3));
30306
30875
  this.progress();
30307
30876
  return;
30308
30877
  }
@@ -30311,7 +30880,7 @@ var RolloutLineParser = class {
30311
30880
  return this.think();
30312
30881
  case "exec_command_end":
30313
30882
  if (this.paginated()) return;
30314
- return this.command({ id: str10(p.call_id), command: p.command, exitCode: num7(p.exit_code), output: str10(p.aggregated_output) ?? str10(p.formatted_output) ?? str10(p.stdout) ?? "", status: str10(p.status) });
30883
+ return this.command({ id: str10(p.call_id), command: p.command, exitCode: num8(p.exit_code), output: str10(p.aggregated_output) ?? str10(p.formatted_output) ?? str10(p.stdout) ?? "", status: str10(p.status) });
30315
30884
  case "patch_apply_end":
30316
30885
  if (this.paginated()) return;
30317
30886
  return this.fileChange(str10(p.call_id), p.changes, p.success === false ? "failed" : str10(p.status));
@@ -30339,8 +30908,8 @@ var RolloutLineParser = class {
30339
30908
  tokens(p) {
30340
30909
  const total2 = rec8(rec8(p.info)?.total_token_usage);
30341
30910
  if (total2) {
30342
- const tin = num7(total2.input_tokens) ?? 0;
30343
- const tout = num7(total2.output_tokens) ?? 0;
30911
+ const tin = num8(total2.input_tokens) ?? 0;
30912
+ const tout = num8(total2.output_tokens) ?? 0;
30344
30913
  if (tin !== this.s.stats.tokensIn || tout !== this.s.stats.tokensOut) {
30345
30914
  this.s.stats.tokensIn = tin;
30346
30915
  this.s.stats.tokensOut = tout;
@@ -30362,13 +30931,13 @@ var RolloutLineParser = class {
30362
30931
  this.push(SPECIAL.think(), { key });
30363
30932
  }
30364
30933
  prompt(raw, images, key) {
30365
- const text2 = promptText(raw) || (images ? tr("[imagem]") : "");
30366
- if (!text2) return;
30934
+ const text3 = promptText(raw) || (images ? tr("[imagem]") : "");
30935
+ if (!text3) return;
30367
30936
  if (this.s.title === void 0) {
30368
- this.s.title = truncate(maskSecrets(text2.slice(0, 1e3)), TITLE_MAX2);
30937
+ this.s.title = truncate(maskSecrets(text3.slice(0, 1e3)), TITLE_MAX2);
30369
30938
  this.changed();
30370
30939
  }
30371
- this.push(describeCodexPrompt(text2), { key });
30940
+ this.push(describeCodexPrompt(text3), { key });
30372
30941
  }
30373
30942
  // ---------------------------------------------------------------- item_completed (paginated)
30374
30943
  item(item) {
@@ -30377,13 +30946,13 @@ var RolloutLineParser = class {
30377
30946
  switch (item.type) {
30378
30947
  case "UserMessage": {
30379
30948
  this.sawPaginated();
30380
- const { text: text2, images } = contentText(item.content);
30381
- return this.prompt(text2, images, id);
30949
+ const { text: text3, images } = contentText(item.content);
30950
+ return this.prompt(text3, images, id);
30382
30951
  }
30383
30952
  case "AgentMessage": {
30384
30953
  this.sawPaginated();
30385
- const text2 = contentText(item.content).text.trim();
30386
- if (text2) this.push(SPECIAL.respond(text2), { key: id });
30954
+ const text3 = contentText(item.content).text.trim();
30955
+ if (text3) this.push(SPECIAL.respond(text3), { key: id });
30387
30956
  this.progress();
30388
30957
  return;
30389
30958
  }
@@ -30395,7 +30964,7 @@ var RolloutLineParser = class {
30395
30964
  this.sawPaginated();
30396
30965
  this.s.stats.toolCalls++;
30397
30966
  this.changed();
30398
- return this.command({ id, command: item.command, exitCode: num7(item.exit_code), output: str10(item.aggregated_output) ?? "", status: str10(item.status) });
30967
+ return this.command({ id, command: item.command, exitCode: num8(item.exit_code), output: str10(item.aggregated_output) ?? "", status: str10(item.status) });
30399
30968
  case "FileChange":
30400
30969
  this.sawPaginated();
30401
30970
  this.s.stats.toolCalls++;
@@ -30821,7 +31390,7 @@ function rec9(v) {
30821
31390
  function str11(v) {
30822
31391
  return typeof v === "string" && v.trim() ? v : void 0;
30823
31392
  }
30824
- function num8(v) {
31393
+ function num9(v) {
30825
31394
  return typeof v === "number" && Number.isFinite(v) ? v : void 0;
30826
31395
  }
30827
31396
  function toMs4(v) {
@@ -30914,19 +31483,19 @@ var CodexTerminalParser = class {
30914
31483
  user(id, at, raw, images = 0) {
30915
31484
  const clean4 = promptText(raw);
30916
31485
  const pics = images ? Array.from({ length: Math.min(images, 10) }, () => tr("[imagem]")).join(" ") : "";
30917
- const text2 = marked(prepare([clean4, pics].filter(Boolean).join("\n"), TEXT_MAX));
30918
- if (text2) this.emit({ kind: "user", id: `${id}:u`, at, text: text2 });
31486
+ const text3 = marked(prepare([clean4, pics].filter(Boolean).join("\n"), TEXT_MAX));
31487
+ if (text3) this.emit({ kind: "user", id: `${id}:u`, at, text: text3 });
30919
31488
  }
30920
31489
  assistant(id, at, raw) {
30921
- const text2 = marked(prepare(raw, TEXT_MAX));
30922
- if (text2) this.emit({ kind: "assistant", id, at, text: text2 });
31490
+ const text3 = marked(prepare(raw, TEXT_MAX));
31491
+ if (text3) this.emit({ kind: "assistant", id, at, text: text3 });
30923
31492
  }
30924
31493
  thinking(id, at, raw) {
30925
- const text2 = raw.trim() ? marked(prepare(raw, THINKING_MAX)) : "";
30926
- this.emit(text2 ? { kind: "thinking", id, at, text: text2 } : { kind: "thinking", id, at });
31494
+ const text3 = raw.trim() ? marked(prepare(raw, THINKING_MAX)) : "";
31495
+ this.emit(text3 ? { kind: "thinking", id, at, text: text3 } : { kind: "thinking", id, at });
30927
31496
  }
30928
- sys(id, at, text2, o = {}) {
30929
- const e = { kind: "system", id: `${id}:s`, at, text: maskSecrets(text2), level: o.level ?? "info" };
31497
+ sys(id, at, text3, o = {}) {
31498
+ const e = { kind: "system", id: `${id}:s`, at, text: maskSecrets(text3), level: o.level ?? "info" };
30930
31499
  if (o.turnDone) {
30931
31500
  e.turnDone = true;
30932
31501
  e.doneLabel = tr("pronto {0}", ["{0}"]);
@@ -30959,7 +31528,7 @@ var CodexTerminalParser = class {
30959
31528
  return this.item(rec9(p.item), at, key);
30960
31529
  case "task_complete":
30961
31530
  case "turn_complete": {
30962
- const ms = num8(p.duration_ms);
31531
+ const ms = num9(p.duration_ms);
30963
31532
  const err = rec9(p.error);
30964
31533
  if (err) this.sys(`${str11(p.turn_id) ?? key}:err`, at, tr("Erro: {0}", [oneLine(str11(err.message) ?? tr("desconhecido"), 160)]), { level: "error" });
30965
31534
  if (ms !== void 0 && ms >= 0) this.sys(`${str11(p.turn_id) ?? key}:done`, at, tr("Turno conclu\xEDdo em {0}", [formatDuration(ms)]), { turnDone: true });
@@ -30982,7 +31551,7 @@ var CodexTerminalParser = class {
30982
31551
  return this.thinking(key, at, str11(p.text) ?? "");
30983
31552
  case "exec_command_end":
30984
31553
  if (this.mode === "paginated") return;
30985
- return this.command(str11(p.call_id) ?? key, at, p.command, str11(p.aggregated_output) ?? str11(p.formatted_output) ?? str11(p.stdout) ?? "", num8(p.exit_code), str11(p.status));
31554
+ return this.command(str11(p.call_id) ?? key, at, p.command, str11(p.aggregated_output) ?? str11(p.formatted_output) ?? str11(p.stdout) ?? "", num9(p.exit_code), str11(p.status));
30986
31555
  case "context_compacted":
30987
31556
  if (this.mode === "paginated") return;
30988
31557
  return this.sys(key, at, tr("Conversa compactada"));
@@ -30996,8 +31565,8 @@ var CodexTerminalParser = class {
30996
31565
  switch (item.type) {
30997
31566
  case "UserMessage": {
30998
31567
  this.mode ??= "paginated";
30999
- const { text: text2, images } = contentText(item.content);
31000
- return this.user(id, at, text2, images);
31568
+ const { text: text3, images } = contentText(item.content);
31569
+ return this.user(id, at, text3, images);
31001
31570
  }
31002
31571
  case "AgentMessage":
31003
31572
  this.mode ??= "paginated";
@@ -31009,7 +31578,7 @@ var CodexTerminalParser = class {
31009
31578
  }
31010
31579
  case "CommandExecution":
31011
31580
  this.mode ??= "paginated";
31012
- return this.command(id, at, item.command, str11(item.aggregated_output) ?? "", num8(item.exit_code), str11(item.status));
31581
+ return this.command(id, at, item.command, str11(item.aggregated_output) ?? "", num9(item.exit_code), str11(item.status));
31013
31582
  case "FileChange":
31014
31583
  this.mode ??= "paginated";
31015
31584
  return this.fileChange(id, at, item.changes, str11(item.status));
@@ -31044,8 +31613,8 @@ var CodexTerminalParser = class {
31044
31613
  this.tool(id, at, "Bash", toolView("Bash", { command }, this.cwd));
31045
31614
  if (status2 === "declined") return this.result(id, at, tr("Recusado pelo usu\xE1rio"), true);
31046
31615
  const failed = status2 === "failed" || exitCode !== void 0 && exitCode !== 0;
31047
- const text2 = failed && exitCode !== void 0 && exitCode !== 0 ? tr("C\xF3digo de sa\xEDda {0}\n{1}", [exitCode, output]) : output;
31048
- this.result(id, at, text2, failed);
31616
+ const text3 = failed && exitCode !== void 0 && exitCode !== 0 ? tr("C\xF3digo de sa\xEDda {0}\n{1}", [exitCode, output]) : output;
31617
+ this.result(id, at, text3, failed);
31049
31618
  }
31050
31619
  fileChange(id, at, raw, status2) {
31051
31620
  const changes = fileChanges(raw);
@@ -31093,9 +31662,9 @@ ${body2}`;
31093
31662
  case "custom_tool_call_output": {
31094
31663
  const id = str11(p.call_id);
31095
31664
  if (!id || !this.calls.has(id)) return;
31096
- const text2 = resultText2(p.output);
31097
- const exit = /^Exit code:\s*(-?\d+)/m.exec(text2.slice(0, 500))?.[1];
31098
- return this.result(id, at, text2, exit !== void 0 && exit !== "0");
31665
+ const text3 = resultText2(p.output);
31666
+ const exit = /^Exit code:\s*(-?\d+)/m.exec(text3.slice(0, 500))?.[1];
31667
+ return this.result(id, at, text3, exit !== void 0 && exit !== "0");
31099
31668
  }
31100
31669
  default:
31101
31670
  return;
@@ -32122,10 +32691,10 @@ async function scanPrefix2(path, end, idPrefix, keep) {
32122
32691
 
32123
32692
  // server/sources/gentle-shell/accounts.ts
32124
32693
  import { homedir as homedir6 } from "node:os";
32125
- import { basename as basename8, dirname as dirname11, join as join23, resolve as resolve10 } from "node:path";
32694
+ import { basename as basename8, dirname as dirname12, join as join23, resolve as resolve10 } from "node:path";
32126
32695
 
32127
32696
  // server/sources/gentle-shell/files.ts
32128
- import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync14, readFileSync as readFileSync18, readSync as readSync5, statSync as statSync20 } from "node:fs";
32697
+ import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync14, readFileSync as readFileSync19, readSync as readSync5, statSync as statSync20 } from "node:fs";
32129
32698
  import { join as join22 } from "node:path";
32130
32699
 
32131
32700
  // server/sources/gentle-shell/pi.ts
@@ -32135,7 +32704,7 @@ function rec11(v) {
32135
32704
  function str13(v) {
32136
32705
  return typeof v === "string" && v.trim() ? v : void 0;
32137
32706
  }
32138
- function num9(v) {
32707
+ function num10(v) {
32139
32708
  return typeof v === "number" && Number.isFinite(v) ? v : void 0;
32140
32709
  }
32141
32710
  function toMs5(v) {
@@ -32171,7 +32740,7 @@ function todoTasks(raw) {
32171
32740
  const t = rec11(r);
32172
32741
  const title = str13(t?.title);
32173
32742
  if (!t || !title) return;
32174
- out.push({ id: String(num9(t.id) ?? str13(t.id) ?? i + 1), title: truncate(maskSecrets(title.slice(0, 480)), 120), status: todoStatus(t.status) });
32743
+ out.push({ id: String(num10(t.id) ?? str13(t.id) ?? i + 1), title: truncate(maskSecrets(title.slice(0, 480)), 120), status: todoStatus(t.status) });
32175
32744
  });
32176
32745
  return out;
32177
32746
  }
@@ -32286,8 +32855,8 @@ var PiLineParser = class {
32286
32855
  }
32287
32856
  }
32288
32857
  user(id, m) {
32289
- const { text: text2, images } = contentText2(m.content);
32290
- const clean4 = text2.trim() || (images ? tr("[imagem]") : "");
32858
+ const { text: text3, images } = contentText2(m.content);
32859
+ const clean4 = text3.trim() || (images ? tr("[imagem]") : "");
32291
32860
  this.s.turnOpen = true;
32292
32861
  this.s.turnStartAt = this.at;
32293
32862
  this.s.pending.clear();
@@ -32311,8 +32880,8 @@ var PiLineParser = class {
32311
32880
  if (cur?.kind === "think" && this.at - cur.at < 3e4) return;
32312
32881
  this.push(SPECIAL.think(), `${id}:t${i}`);
32313
32882
  } else if (part.type === "text") {
32314
- const text2 = str13(part.text)?.trim();
32315
- if (text2) this.push(SPECIAL.respond(text2), `${id}:x${i}`);
32883
+ const text3 = str13(part.text)?.trim();
32884
+ if (text3) this.push(SPECIAL.respond(text3), `${id}:x${i}`);
32316
32885
  } else if (part.type === "toolCall") {
32317
32886
  this.toolCall(id, i, part);
32318
32887
  }
@@ -32333,9 +32902,9 @@ var PiLineParser = class {
32333
32902
  }
32334
32903
  usage(u) {
32335
32904
  if (!u) return;
32336
- const tin = (num9(u.input) ?? 0) + (num9(u.cacheRead) ?? 0) + (num9(u.cacheWrite) ?? 0);
32337
- const tout = num9(u.output) ?? 0;
32338
- const cost = num9(rec11(u.cost)?.total);
32905
+ const tin = (num10(u.input) ?? 0) + (num10(u.cacheRead) ?? 0) + (num10(u.cacheWrite) ?? 0);
32906
+ const tout = num10(u.output) ?? 0;
32907
+ const cost = num10(rec11(u.cost)?.total);
32339
32908
  this.s.stats.tokensIn += tin;
32340
32909
  this.s.stats.tokensOut += tout;
32341
32910
  if (cost !== void 0) this.s.stats.costUSD = (this.s.stats.costUSD ?? 0) + cost;
@@ -32423,8 +32992,8 @@ function parsePiHead(lines) {
32423
32992
  } else if (j.type === "message") {
32424
32993
  const m = rec11(j.message);
32425
32994
  if (m?.role !== "user") continue;
32426
- const { text: text2, images } = contentText2(m.content);
32427
- const clean4 = text2.trim() || (images ? tr("[imagem]") : "");
32995
+ const { text: text3, images } = contentText2(m.content);
32996
+ const clean4 = text3.trim() || (images ? tr("[imagem]") : "");
32428
32997
  if (clean4) {
32429
32998
  head.title = truncate(maskSecrets(clean4.slice(0, 1e3)), TITLE_MAX3);
32430
32999
  break;
@@ -32464,7 +33033,7 @@ function parseSessionFileName(name) {
32464
33033
  function readJson2(path, max) {
32465
33034
  try {
32466
33035
  if (statSync20(path).size > max) return void 0;
32467
- return JSON.parse(readFileSync18(path, "utf8"));
33036
+ return JSON.parse(readFileSync19(path, "utf8"));
32468
33037
  } catch {
32469
33038
  return void 0;
32470
33039
  }
@@ -32567,9 +33136,9 @@ function readFirstLine(path, max) {
32567
33136
  try {
32568
33137
  const buf = Buffer.alloc(max);
32569
33138
  const n2 = readSync5(fd, buf, 0, max, 0);
32570
- const text2 = buf.subarray(0, n2).toString("utf8");
32571
- const nl = text2.indexOf("\n");
32572
- return nl === -1 ? n2 < max ? text2 : void 0 : text2.slice(0, nl);
33139
+ const text3 = buf.subarray(0, n2).toString("utf8");
33140
+ const nl = text3.indexOf("\n");
33141
+ return nl === -1 ? n2 < max ? text3 : void 0 : text3.slice(0, nl);
32573
33142
  } finally {
32574
33143
  closeSync5(fd);
32575
33144
  }
@@ -32671,7 +33240,7 @@ function discoverGentleShellDirs(env = process.env, home = env.HOME || homedir6(
32671
33240
  function baseId(dir) {
32672
33241
  const d = resolve10(dir);
32673
33242
  const name = basename8(d);
32674
- if (name === "agent") return basename8(dirname11(d)) || name;
33243
+ if (name === "agent") return basename8(dirname12(d)) || name;
32675
33244
  return name || d;
32676
33245
  }
32677
33246
  function detectGentleShellAccounts(dirs, opts = {}) {
@@ -32767,9 +33336,9 @@ var GentleShellTerminalParser = class {
32767
33336
  if (m.role === "toolResult") return this.result(id, at, m);
32768
33337
  }
32769
33338
  user(id, at, m) {
32770
- const { text: text2, images } = contentText2(m.content);
33339
+ const { text: text3, images } = contentText2(m.content);
32771
33340
  const pics = images ? Array.from({ length: Math.min(images, 10) }, () => tr("[imagem]")).join(" ") : "";
32772
- const shown2 = marked(prepare([text2.trim(), pics].filter(Boolean).join("\n"), TEXT_MAX));
33341
+ const shown2 = marked(prepare([text3.trim(), pics].filter(Boolean).join("\n"), TEXT_MAX));
32773
33342
  if (shown2) this.emit({ kind: "user", id: `${id}:u`, at, text: shown2 });
32774
33343
  }
32775
33344
  assistant(id, at, m) {
@@ -32778,11 +33347,11 @@ var GentleShellTerminalParser = class {
32778
33347
  const part = rec11(raw);
32779
33348
  if (!part) return;
32780
33349
  if (part.type === "thinking") {
32781
- const text2 = str14(part.thinking)?.trim() ? marked(prepare(String(part.thinking), THINKING_MAX)) : "";
32782
- this.emit(text2 ? { kind: "thinking", id: `${id}:t${i}`, at, text: text2 } : { kind: "thinking", id: `${id}:t${i}`, at });
33350
+ const text3 = str14(part.thinking)?.trim() ? marked(prepare(String(part.thinking), THINKING_MAX)) : "";
33351
+ this.emit(text3 ? { kind: "thinking", id: `${id}:t${i}`, at, text: text3 } : { kind: "thinking", id: `${id}:t${i}`, at });
32783
33352
  } else if (part.type === "text") {
32784
- const text2 = marked(prepare(String(part.text ?? ""), TEXT_MAX));
32785
- if (text2) this.emit({ kind: "assistant", id: `${id}:x${i}`, at, text: text2 });
33353
+ const text3 = marked(prepare(String(part.text ?? ""), TEXT_MAX));
33354
+ if (text3) this.emit({ kind: "assistant", id: `${id}:x${i}`, at, text: text3 });
32786
33355
  } else if (part.type === "toolCall") {
32787
33356
  const name = str14(part.name);
32788
33357
  if (!name) return;
@@ -33191,9 +33760,9 @@ var GentleShellSource = class {
33191
33760
  };
33192
33761
 
33193
33762
  // server/sources/agent-hub/source.ts
33194
- import { closeSync as closeSync6, lstatSync as lstatSync2, openSync as openSync6, readFileSync as readFileSync20, readSync as readSync6, readdirSync as readdirSync15 } from "node:fs";
33763
+ import { closeSync as closeSync6, lstatSync as lstatSync2, openSync as openSync6, readFileSync as readFileSync21, readSync as readSync6, readdirSync as readdirSync15 } from "node:fs";
33195
33764
  import { lstat, readdir as readdir3 } from "node:fs/promises";
33196
- import { basename as basename9, dirname as dirname12, isAbsolute as isAbsolute5, join as join26, resolve as resolve12 } from "node:path";
33765
+ import { basename as basename9, dirname as dirname13, isAbsolute as isAbsolute5, join as join26, resolve as resolve12 } from "node:path";
33197
33766
 
33198
33767
  // server/sources/agent-hub/events/agy.ts
33199
33768
  function object(value) {
@@ -33344,18 +33913,18 @@ function adaptCopilotEvent(line2, offset) {
33344
33913
  }
33345
33914
 
33346
33915
  // server/sources/agent-hub/events/plain.ts
33347
- function adaptPlainChunk(text2, offset, at = Date.now()) {
33348
- if (!text2.trim()) return void 0;
33349
- return { id: `offset:${offset}`, at, ...SPECIAL.respond(text2) };
33916
+ function adaptPlainChunk(text3, offset, at = Date.now()) {
33917
+ if (!text3.trim()) return void 0;
33918
+ return { id: `offset:${offset}`, at, ...SPECIAL.respond(text3) };
33350
33919
  }
33351
- function adaptAgentHubEvent(agent, text2, offset) {
33352
- if (agent === "copilot") return adaptCopilotEvent(text2, offset);
33353
- if (agent === "agy") return adaptAgyEvent(text2, offset);
33354
- return adaptPlainChunk(text2, offset);
33920
+ function adaptAgentHubEvent(agent, text3, offset) {
33921
+ if (agent === "copilot") return adaptCopilotEvent(text3, offset);
33922
+ if (agent === "agy") return adaptAgyEvent(text3, offset);
33923
+ return adaptPlainChunk(text3, offset);
33355
33924
  }
33356
33925
 
33357
33926
  // server/sources/agent-hub/terminal.ts
33358
- import { lstatSync, readFileSync as readFileSync19 } from "node:fs";
33927
+ import { lstatSync, readFileSync as readFileSync20 } from "node:fs";
33359
33928
  import { join as join25 } from "node:path";
33360
33929
  var SEEN_MAX5 = 2e4;
33361
33930
  var MAX_PROMPT_BYTES = 128 * 1024;
@@ -33378,7 +33947,7 @@ function readPrompt(jobDir) {
33378
33947
  try {
33379
33948
  const st = lstatSync(path);
33380
33949
  if (!st.isFile() || st.size > MAX_PROMPT_BYTES) return void 0;
33381
- return readFileSync19(path, "utf8").trim() || void 0;
33950
+ return readFileSync20(path, "utf8").trim() || void 0;
33382
33951
  } catch {
33383
33952
  return void 0;
33384
33953
  }
@@ -33389,7 +33958,7 @@ function readResponse(jobDir) {
33389
33958
  try {
33390
33959
  const st = lstatSync(path);
33391
33960
  if (!st.isFile() || st.size > MAX_RESPONSE_BYTES) return void 0;
33392
- return readFileSync19(path, "utf8").trim() || void 0;
33961
+ return readFileSync20(path, "utf8").trim() || void 0;
33393
33962
  } catch {
33394
33963
  return void 0;
33395
33964
  }
@@ -33501,15 +34070,15 @@ var AgentHubTerminalParser = class {
33501
34070
  }
33502
34071
  if (type === "tool.execution_complete") {
33503
34072
  const callId = str15(data.toolCallId) ?? id;
33504
- let text2 = "";
34073
+ let text3 = "";
33505
34074
  const res = data.result;
33506
34075
  if (typeof res === "string") {
33507
- text2 = res;
34076
+ text3 = res;
33508
34077
  } else if (rec12(res)) {
33509
34078
  const r = res;
33510
- text2 = str15(r.content) ?? str15(r.output) ?? str15(r.text) ?? JSON.stringify(r);
34079
+ text3 = str15(r.content) ?? str15(r.output) ?? str15(r.text) ?? JSON.stringify(r);
33511
34080
  }
33512
- const p = prepare(text2, RESULT_MAX, RESULT_MAX_LINES);
34081
+ const p = prepare(text3, RESULT_MAX, RESULT_MAX_LINES);
33513
34082
  const entry = {
33514
34083
  kind: "result",
33515
34084
  id: `${callId}:r`,
@@ -33645,10 +34214,10 @@ var AgentHubTerminalParser = class {
33645
34214
  }
33646
34215
  }
33647
34216
  plain(raw) {
33648
- const text2 = raw.trim();
33649
- if (!text2) return;
34217
+ const text3 = raw.trim();
34218
+ if (!text3) return;
33650
34219
  const at = this.lastAt || this.now();
33651
- const p = prepare(text2, TEXT_MAX);
34220
+ const p = prepare(text3, TEXT_MAX);
33652
34221
  this.emit({
33653
34222
  kind: "assistant",
33654
34223
  id: `plain:${++this.seq}`,
@@ -33702,7 +34271,7 @@ function readPrompt2(jobDir) {
33702
34271
  try {
33703
34272
  const st = lstatSync2(path);
33704
34273
  if (!st.isFile() || st.size > MAX_PROMPT_BYTES2) return void 0;
33705
- return str16(readFileSync20(path, "utf8"));
34274
+ return str16(readFileSync21(path, "utf8"));
33706
34275
  } catch {
33707
34276
  return void 0;
33708
34277
  }
@@ -33824,7 +34393,7 @@ function deriveProject(cwd, repoRoot, repoName) {
33824
34393
  try {
33825
34394
  const st = lstatSync2(gitPath);
33826
34395
  if (st.isFile()) {
33827
- const content = readFileSync20(gitPath, "utf8");
34396
+ const content = readFileSync21(gitPath, "utf8");
33828
34397
  const match = /^gitdir:\s*(.+)$/m.exec(content);
33829
34398
  if (match) {
33830
34399
  let gitDir = match[1].trim();
@@ -33832,9 +34401,9 @@ function deriveProject(cwd, repoRoot, repoName) {
33832
34401
  gitDir = resolve12(candidate, gitDir);
33833
34402
  }
33834
34403
  try {
33835
- const commonRel = readFileSync20(join26(gitDir, "commondir"), "utf8").trim();
34404
+ const commonRel = readFileSync21(join26(gitDir, "commondir"), "utf8").trim();
33836
34405
  const commonDir = resolve12(gitDir, commonRel);
33837
- return basename9(dirname12(commonDir));
34406
+ return basename9(dirname13(commonDir));
33838
34407
  } catch {
33839
34408
  const wtMatch = /^(.*)[/\\]\.git[/\\]worktrees[/\\][^/\\]+$/.exec(gitDir);
33840
34409
  if (wtMatch) {
@@ -33965,7 +34534,7 @@ var AgentHubSource = class {
33965
34534
  if (!cached || cached.mtimeMs !== file.mtimeMs || cached.size !== file.size) {
33966
34535
  let job2;
33967
34536
  try {
33968
- job2 = parseJob(readFileSync20(file.path, "utf8"), file.name, file.mtimeMs, join26(this.opts.runsDir, file.name));
34537
+ job2 = parseJob(readFileSync21(file.path, "utf8"), file.name, file.mtimeMs, join26(this.opts.runsDir, file.name));
33969
34538
  } catch {
33970
34539
  job2 = void 0;
33971
34540
  }
@@ -34169,9 +34738,9 @@ var AgentHubSource = class {
34169
34738
  if (activity) this.addOutputActivity(tracker, id, activity);
34170
34739
  }
34171
34740
  } else if (lines.length) {
34172
- const text2 = `${lines.map(({ line: line2 }) => line2).join("\n")}
34741
+ const text3 = `${lines.map(({ line: line2 }) => line2).join("\n")}
34173
34742
  `;
34174
- const activity = adaptPlainChunk(text2, lines[0].offset, this.now());
34743
+ const activity = adaptPlainChunk(text3, lines[0].offset, this.now());
34175
34744
  if (activity) this.addOutputActivity(tracker, id, activity);
34176
34745
  }
34177
34746
  } catch {
@@ -34209,7 +34778,7 @@ var AgentHubSource = class {
34209
34778
  };
34210
34779
 
34211
34780
  // server/build.ts
34212
- import { readFileSync as readFileSync21, statSync as statSync21 } from "node:fs";
34781
+ import { readFileSync as readFileSync22, statSync as statSync21 } from "node:fs";
34213
34782
  import { join as join27 } from "node:path";
34214
34783
  var BUNDLE = /bundle\/(main-[\w-]+)\.js/;
34215
34784
  function createBuildReader(rootDir) {
@@ -34221,7 +34790,7 @@ function createBuildReader(rootDir) {
34221
34790
  const m = statSync21(file).mtimeMs;
34222
34791
  if (m !== mtime) {
34223
34792
  mtime = m;
34224
- id = BUNDLE.exec(readFileSync21(file, "utf8"))?.[1];
34793
+ id = BUNDLE.exec(readFileSync22(file, "utf8"))?.[1];
34225
34794
  }
34226
34795
  } catch {
34227
34796
  mtime = -1;
@@ -34233,7 +34802,7 @@ function createBuildReader(rootDir) {
34233
34802
  var UNKNOWN = { commit: "unknown", dirty: false };
34234
34803
  function readBuildInfo(rootDir) {
34235
34804
  try {
34236
- const raw = JSON.parse(readFileSync21(join27(rootDir, "dist", "build.json"), "utf8"));
34805
+ const raw = JSON.parse(readFileSync22(join27(rootDir, "dist", "build.json"), "utf8"));
34237
34806
  if (typeof raw.commit !== "string" || !/^([0-9a-f]{40}([0-9a-f]{24})?|unknown)$/.test(raw.commit) || typeof raw.dirty !== "boolean") return { ...UNKNOWN };
34238
34807
  const stamp2 = { commit: raw.commit, dirty: raw.dirty };
34239
34808
  if (typeof raw.builtAt === "string" && raw.builtAt.length <= 40) stamp2.builtAt = raw.builtAt;
@@ -34244,8 +34813,8 @@ function readBuildInfo(rootDir) {
34244
34813
  }
34245
34814
 
34246
34815
  // server/updates/checker.ts
34247
- import { mkdirSync as mkdirSync13, readFileSync as readFileSync22, renameSync as renameSync12, writeFileSync as writeFileSync12 } from "node:fs";
34248
- import { dirname as dirname13 } from "node:path";
34816
+ import { mkdirSync as mkdirSync14, readFileSync as readFileSync23, renameSync as renameSync13, writeFileSync as writeFileSync13 } from "node:fs";
34817
+ import { dirname as dirname14 } from "node:path";
34249
34818
 
34250
34819
  // server/updates/npm.ts
34251
34820
  var NPM_PACKAGE = "busybits";
@@ -34357,7 +34926,7 @@ var UpdateChecker = class {
34357
34926
  const pkg = this.opts.package;
34358
34927
  if (!this.opts.file || !this.enabled || !pkg) return;
34359
34928
  try {
34360
- const j = JSON.parse(readFileSync22(this.opts.file, "utf8"));
34929
+ const j = JSON.parse(readFileSync23(this.opts.file, "utf8"));
34361
34930
  if (j.package !== pkg || typeof j.checkedAt !== "number" || !Number.isFinite(j.checkedAt)) return;
34362
34931
  const latest = typeof j.latest === "string" && parseVersion(j.latest) ? j.latest : void 0;
34363
34932
  this.cache = {
@@ -34443,11 +35012,11 @@ var UpdateChecker = class {
34443
35012
  const file = this.opts.file;
34444
35013
  if (!file || !this.cache) return;
34445
35014
  try {
34446
- mkdirSync13(dirname13(file), { recursive: true });
35015
+ mkdirSync14(dirname14(file), { recursive: true });
34447
35016
  const tmp = `${file}.tmp`;
34448
- writeFileSync12(tmp, `${JSON.stringify(this.cache, null, 2)}
35017
+ writeFileSync13(tmp, `${JSON.stringify(this.cache, null, 2)}
34449
35018
  `);
34450
- renameSync12(tmp, file);
35019
+ renameSync13(tmp, file);
34451
35020
  } catch (err) {
34452
35021
  log.warnOnce("updates:save", tr("N\xE3o deu para gravar {0}: {1}.", [file, errMsg(err)]));
34453
35022
  }
@@ -34473,11 +35042,11 @@ function describeError(err) {
34473
35042
  }
34474
35043
 
34475
35044
  // server/updates/apply.ts
34476
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync15 } from "node:fs";
34477
- import { dirname as dirname14, join as join29 } from "node:path";
35045
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync16 } from "node:fs";
35046
+ import { dirname as dirname15, join as join29 } from "node:path";
34478
35047
 
34479
35048
  // scripts/cli/layout.ts
34480
- import { cpSync, existsSync as existsSync11, mkdirSync as mkdirSync14, readdirSync as readdirSync16, readFileSync as readFileSync23, realpathSync as realpathSync6, renameSync as renameSync13, rmSync as rmSync6, statSync as statSync22, symlinkSync, writeFileSync as writeFileSync13 } from "node:fs";
35049
+ import { cpSync, existsSync as existsSync11, mkdirSync as mkdirSync15, readdirSync as readdirSync16, readFileSync as readFileSync24, realpathSync as realpathSync6, renameSync as renameSync14, rmSync as rmSync6, statSync as statSync22, symlinkSync, writeFileSync as writeFileSync14 } from "node:fs";
34481
35050
  import { isAbsolute as isAbsolute6, join as join28, relative as relative3, resolve as resolve13 } from "node:path";
34482
35051
  function layoutOf(dir) {
34483
35052
  return {
@@ -34493,7 +35062,7 @@ function layoutOf(dir) {
34493
35062
  }
34494
35063
  function readLockPid(l) {
34495
35064
  try {
34496
- const n2 = Number.parseInt(readFileSync23(l.lockFile, "utf8").trim(), 10);
35065
+ const n2 = Number.parseInt(readFileSync24(l.lockFile, "utf8").trim(), 10);
34497
35066
  return Number.isInteger(n2) && n2 > 0 ? n2 : void 0;
34498
35067
  } catch {
34499
35068
  return void 0;
@@ -34527,7 +35096,7 @@ async function startUpdate(o) {
34527
35096
  });
34528
35097
  if (failure) {
34529
35098
  try {
34530
- mkdirSync15(dirname14(o.layout.logFile), { recursive: true });
35099
+ mkdirSync16(dirname15(o.layout.logFile), { recursive: true });
34531
35100
  appendFileSync2(o.layout.logFile, `[${new Date(o.now ?? Date.now()).toISOString()}] could not start the update: ${failure.message}
34532
35101
  `);
34533
35102
  } catch {
@@ -34841,9 +35410,9 @@ var CONTROL3 = /[\x00-\x1f\x7f]/g;
34841
35410
  function clean3(s2, max) {
34842
35411
  return s2.replace(ANSI2, "").replace(CONTROL3, "").trim().slice(0, max);
34843
35412
  }
34844
- function parseJson2(text2) {
35413
+ function parseJson2(text3) {
34845
35414
  try {
34846
- return JSON.parse(text2);
35415
+ return JSON.parse(text3);
34847
35416
  } catch {
34848
35417
  return void 0;
34849
35418
  }
@@ -34876,8 +35445,8 @@ function createHerdrExec(bin, env, timeoutMs = HERDR_TIMEOUT_MS) {
34876
35445
  if (json !== void 0 && !errorOf(json)) return ok({ ok: true, json });
34877
35446
  const e2 = errorOf(json);
34878
35447
  if (e2) return ok({ ok: false, ...e2 });
34879
- const text2 = firstLine4(out, stderr);
34880
- return ok(text2 ? { ok: false, error: text2 } : { ok: false, error: tr("herdr: sa\xEDda inv\xE1lida"), code: "empty_output" });
35448
+ const text3 = firstLine4(out, stderr);
35449
+ return ok(text3 ? { ok: false, error: text3 } : { ok: false, error: tr("herdr: sa\xEDda inv\xE1lida"), code: "empty_output" });
34881
35450
  }
34882
35451
  const e = errorOf(parseJson2(stderr ?? "")) ?? errorOf(parseJson2(out ?? ""));
34883
35452
  if (e) return ok({ ok: false, ...e });
@@ -35016,8 +35585,8 @@ var HerdrClient = class {
35016
35585
  await this.call(["agent", "wait", paneId, "--until", "idle", "--until", "done", "--timeout", String(ms)], ms + TIMEOUT_SLACK_MS);
35017
35586
  }
35018
35587
  /** O texto vai depois de `--`: um pedido que começa com `-` não vira opção do herdr. */
35019
- async prompt(paneId, text2) {
35020
- await this.call(["agent", "prompt", paneId, text2]);
35588
+ async prompt(paneId, text3) {
35589
+ await this.call(["agent", "prompt", paneId, text3]);
35021
35590
  }
35022
35591
  /** Foca o agente do painel; se o herdr recusar, ao menos a aba. */
35023
35592
  async focus(pane) {
@@ -35161,17 +35730,17 @@ async function launchInHerdr(client, req, opts = {}) {
35161
35730
  };
35162
35731
  const takenNames = () => client.agentNames().catch(() => /* @__PURE__ */ new Set());
35163
35732
  const deliverToGentle = async (r, known, at) => {
35164
- const inbox = opts.inbox;
35165
- if (!inbox) return tr("o escrit\xF3rio n\xE3o tem a caixa de entrada de mensagens ligada");
35733
+ const inbox2 = opts.inbox;
35734
+ if (!inbox2) return tr("o escrit\xF3rio n\xE3o tem a caixa de entrada de mensagens ligada");
35166
35735
  const until = Math.min(now() + (opts.inboxWaitMs ?? INBOX_WAIT_MS), end);
35167
35736
  let why = tr("n\xE3o achei a sess\xE3o do Gentle Shell no escrit\xF3rio (a extens\xE3o habblaud-pi est\xE1 instalada e a sess\xE3o aberta?)");
35168
35737
  let wait = pollMs;
35169
35738
  for (; ; ) {
35170
35739
  if (state.over) return late2;
35171
35740
  try {
35172
- const agent = matchGentle(inbox.agents(), known, r.folder, at);
35741
+ const agent = matchGentle(inbox2.agents(), known, r.folder, at);
35173
35742
  if (agent) {
35174
- const res = inbox.send(agent.id, r.prompt);
35743
+ const res = inbox2.send(agent.id, r.prompt);
35175
35744
  if (res.ok) return void 0;
35176
35745
  why = res.reason;
35177
35746
  if (!res.retry) return why;
@@ -35328,8 +35897,8 @@ function startAttachmentsPruner(opts) {
35328
35897
  }
35329
35898
 
35330
35899
  // server/settings/attachments.ts
35331
- import { mkdirSync as mkdirSync16, readFileSync as readFileSync24, renameSync as renameSync14, writeFileSync as writeFileSync14 } from "node:fs";
35332
- import { dirname as dirname15 } from "node:path";
35900
+ import { mkdirSync as mkdirSync17, readFileSync as readFileSync25, renameSync as renameSync15, writeFileSync as writeFileSync15 } from "node:fs";
35901
+ import { dirname as dirname16 } from "node:path";
35333
35902
  var RETENTION_CHOICES = [1, 3, 7, 30];
35334
35903
  var DEFAULT_RETENTION_DAYS = 7;
35335
35904
  function parseRetention(raw) {
@@ -35357,7 +35926,7 @@ var AttachmentSettingsStore = class {
35357
35926
  load() {
35358
35927
  if (!this.file) return null;
35359
35928
  try {
35360
- return parseRetention(JSON.parse(readFileSync24(this.file, "utf8")));
35929
+ return parseRetention(JSON.parse(readFileSync25(this.file, "utf8")));
35361
35930
  } catch (err) {
35362
35931
  if (err.code !== "ENOENT") log.warn(tr("attachments.json ileg\xEDvel ({0}); usando o padr\xE3o de {1} dias.", [errMsg(err), DEFAULT_RETENTION_DAYS]));
35363
35932
  return null;
@@ -35366,9 +35935,9 @@ var AttachmentSettingsStore = class {
35366
35935
  save() {
35367
35936
  if (!this.file) return;
35368
35937
  try {
35369
- mkdirSync16(dirname15(this.file), { recursive: true });
35370
- writeFileSync14(`${this.file}.tmp`, JSON.stringify({ version: 1, ...this.current }, null, 2));
35371
- renameSync14(`${this.file}.tmp`, this.file);
35938
+ mkdirSync17(dirname16(this.file), { recursive: true });
35939
+ writeFileSync15(`${this.file}.tmp`, JSON.stringify({ version: 1, ...this.current }, null, 2));
35940
+ renameSync15(`${this.file}.tmp`, this.file);
35372
35941
  } catch (err) {
35373
35942
  log.warn(tr("N\xE3o consegui gravar {0}: {1}", [this.file, errMsg(err)]));
35374
35943
  }
@@ -35429,7 +35998,7 @@ function recentFolders(sessions, rooms, limit = FOLDERS_LIMIT) {
35429
35998
 
35430
35999
  // server/dictation/whisper.ts
35431
36000
  import { execFile as execFile6 } from "node:child_process";
35432
- import { existsSync as existsSync12, mkdtempSync as mkdtempSync2, readFileSync as readFileSync25, rmSync as rmSync8, writeFileSync as writeFileSync15 } from "node:fs";
36001
+ import { existsSync as existsSync12, mkdtempSync as mkdtempSync2, readFileSync as readFileSync26, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "node:fs";
35433
36002
  import { homedir as homedir7, tmpdir } from "node:os";
35434
36003
  import { delimiter as delimiter2, join as join32 } from "node:path";
35435
36004
  var TRANSCRIBE_TIMEOUT_MS = 12e4;
@@ -35466,8 +36035,8 @@ function run2(bin, args, timeoutMs) {
35466
36035
  }
35467
36036
  function parseWhisperJson(raw) {
35468
36037
  const d = JSON.parse(raw);
35469
- const text2 = (d.transcription ?? []).map((t) => typeof t.text === "string" ? t.text : "").join(" ").replace(/\[(BLANK_AUDIO|MUSIC|Música|SILENCE)\]|\((?:silence|música|music)\)/gi, "").replace(/\s+/g, " ").trim();
35470
- return { text: text2, lang: typeof d.result?.language === "string" ? d.result.language : "" };
36038
+ const text3 = (d.transcription ?? []).map((t) => typeof t.text === "string" ? t.text : "").join(" ").replace(/\[(BLANK_AUDIO|MUSIC|Música|SILENCE)\]|\((?:silence|música|music)\)/gi, "").replace(/\s+/g, " ").trim();
36039
+ return { text: text3, lang: typeof d.result?.language === "string" ? d.result.language : "" };
35471
36040
  }
35472
36041
  function createWhisperTranscriber(setup, timeoutMs = TRANSCRIBE_TIMEOUT_MS) {
35473
36042
  return async (audio) => {
@@ -35475,14 +36044,14 @@ function createWhisperTranscriber(setup, timeoutMs = TRANSCRIBE_TIMEOUT_MS) {
35475
36044
  try {
35476
36045
  const input = join32(dir, "audio.in");
35477
36046
  const wav = join32(dir, "audio.wav");
35478
- writeFileSync15(input, audio, { mode: 384 });
36047
+ writeFileSync16(input, audio, { mode: 384 });
35479
36048
  const conv = await run2(setup.ffmpeg, ["-nostdin", "-loglevel", "error", "-y", "-i", input, "-ar", "16000", "-ac", "1", "-c:a", "pcm_s16le", wav], timeoutMs);
35480
36049
  if (!conv.ok) throw new Error(tr("n\xE3o deu para ler o \xE1udio ({0})", [conv.error]));
35481
36050
  const pass = async (lang) => {
35482
36051
  const out = join32(dir, `out-${lang}`);
35483
36052
  const r = await run2(setup.bin, ["-m", setup.model, "-l", lang, "-f", wav, "-nt", "-np", "-oj", "-of", out], timeoutMs);
35484
36053
  if (!r.ok) throw new Error(tr("o Whisper falhou ({0})", [r.error]));
35485
- return parseWhisperJson(readFileSync25(`${out}.json`, "utf8"));
36054
+ return parseWhisperJson(readFileSync26(`${out}.json`, "utf8"));
35486
36055
  };
35487
36056
  const first = await pass("auto");
35488
36057
  if (!first.lang || setup.langs.includes(first.lang) || !first.text) return first;
@@ -35496,7 +36065,7 @@ function createWhisperTranscriber(setup, timeoutMs = TRANSCRIBE_TIMEOUT_MS) {
35496
36065
 
35497
36066
  // server/deliveries/fetcher.ts
35498
36067
  import { randomUUID as randomUUID4 } from "node:crypto";
35499
- import { readFileSync as readFileSync26 } from "node:fs";
36068
+ import { readFileSync as readFileSync27 } from "node:fs";
35500
36069
  var HOST_PRESENCE_MS3 = 1e4;
35501
36070
  var WAIT_MS = 2e4;
35502
36071
  var CACHE_MAX_BYTES = 80 * 1024 * 1024;
@@ -35579,7 +36148,7 @@ var FileFetcher = class {
35579
36148
  const c = (this.opts.check ?? checkFile)(path);
35580
36149
  if ("error" in c) return { error: c.error, status: c.error === tr("arquivo n\xE3o encontrado") ? 404 : 403 };
35581
36150
  try {
35582
- const data = (this.opts.read ?? readFileSync26)(c.path);
36151
+ const data = (this.opts.read ?? readFileSync27)(c.path);
35583
36152
  this.remember(path, data);
35584
36153
  return { data };
35585
36154
  } catch {
@@ -35937,7 +36506,7 @@ function worldLastError(code2) {
35937
36506
  var RESYNC_GAP_MS = 5e3;
35938
36507
  var MAX_SCENE_PLAYERS = 200;
35939
36508
  var COORD_MAX = 1e6;
35940
- var isObj4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
36509
+ var isObj5 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
35941
36510
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
35942
36511
  var DIRS = ["n", "s", "e", "w"];
35943
36512
  var isDir5 = (v) => typeof v === "string" && DIRS.includes(v);
@@ -35945,20 +36514,20 @@ var isId = (v) => typeof v === "string" && /^[\x21-\x7e]{1,64}$/.test(v);
35945
36514
  var isCount = (v) => isNum(v) && Number.isInteger(v) && v >= 0 && v <= 1e9;
35946
36515
  var CODE_TYPED = /^[A-Za-z0-9 _-]{1,16}$/;
35947
36516
  function parseCityStatus(v) {
35948
- if (!isObj4(v) || !isCount(v.lit)) return void 0;
36517
+ if (!isObj5(v) || !isCount(v.lit)) return void 0;
35949
36518
  const out = { lit: v.lit };
35950
36519
  const g = v.goal;
35951
- if (isObj4(g) && typeof g.id === "string" && g.id.length <= 64 && CITY_GOAL_IDS.includes(g.label) && isNum(g.target) && g.target > 0 && isNum(g.progress) && g.progress >= 0 && isNum(g.until)) {
36520
+ if (isObj5(g) && typeof g.id === "string" && g.id.length <= 64 && CITY_GOAL_IDS.includes(g.label) && isNum(g.target) && g.target > 0 && isNum(g.progress) && g.progress >= 0 && isNum(g.until)) {
35952
36521
  out.goal = { id: g.id, label: g.label, target: g.target, progress: g.progress, until: g.until };
35953
36522
  }
35954
36523
  if (isNum(v.tokensBand) && Number.isInteger(v.tokensBand) && v.tokensBand >= 0 && v.tokensBand <= 5) out.tokensBand = v.tokensBand;
35955
36524
  return out;
35956
36525
  }
35957
36526
  function parseAwaySummary(v) {
35958
- if (!isObj4(v) || typeof v.since !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(v.since) || !isCount(v.visits) || !isCount(v.likes)) return void 0;
36527
+ if (!isObj5(v) || typeof v.since !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(v.since) || !isCount(v.visits) || !isCount(v.likes)) return void 0;
35959
36528
  const stamps = [];
35960
36529
  for (const st of Array.isArray(v.stamps) ? v.stamps : []) {
35961
- if (!isObj4(st) || !STAMP_IDS.includes(st.stampId) || !isCount(st.count) || st.count === 0) continue;
36530
+ if (!isObj5(st) || !STAMP_IDS.includes(st.stampId) || !isCount(st.count) || st.count === 0) continue;
35962
36531
  if (stamps.some((x) => x.stampId === st.stampId)) continue;
35963
36532
  stamps.push({ stampId: st.stampId, count: st.count });
35964
36533
  }
@@ -35968,11 +36537,11 @@ function summaryHasNews(s2) {
35968
36537
  return !!s2 && (s2.visits > 0 || s2.likes > 0 || s2.stamps.some((x) => x.count > 0));
35969
36538
  }
35970
36539
  function position(v) {
35971
- if (!isObj4(v) || !isNum(v.x) || !isNum(v.y)) return void 0;
36540
+ if (!isObj5(v) || !isNum(v.x) || !isNum(v.y)) return void 0;
35972
36541
  return { x: v.x, y: v.y, dir: isDir5(v.dir) ? v.dir : "s", moving: v.moving === true };
35973
36542
  }
35974
36543
  function parseSceneCommand(v) {
35975
- if (!isObj4(v) || typeof v.t !== "string" || !WORLD_SCENE_COMMANDS.includes(v.t)) return null;
36544
+ if (!isObj5(v) || typeof v.t !== "string" || !WORLD_SCENE_COMMANDS.includes(v.t)) return null;
35976
36545
  switch (v.t) {
35977
36546
  case "move": {
35978
36547
  if (!isNum(v.x) || !isNum(v.y) || Math.abs(v.x) > COORD_MAX || Math.abs(v.y) > COORD_MAX) return null;
@@ -36030,18 +36599,18 @@ function reduceSceneBatch(cmds) {
36030
36599
  }
36031
36600
  function sceneMeFrom(welcome) {
36032
36601
  const me = welcome.me;
36033
- if (!isObj4(me) || !isId(me.id) || typeof me.name !== "string" || me.look !== "f" && me.look !== "m") return void 0;
36602
+ if (!isObj5(me) || !isId(me.id) || typeof me.name !== "string" || me.look !== "f" && me.look !== "m") return void 0;
36034
36603
  const out = {
36035
36604
  id: me.id,
36036
36605
  name: me.name,
36037
36606
  look: me.look,
36038
- parts: isObj4(me.parts) ? me.parts : {},
36607
+ parts: isObj5(me.parts) ? me.parts : {},
36039
36608
  traits: Array.isArray(me.traits) ? me.traits.filter((t) => typeof t === "string") : []
36040
36609
  };
36041
36610
  if (typeof me.intro === "string") out.intro = me.intro;
36042
36611
  if (typeof me.country === "string") out.country = me.country;
36043
36612
  const b = welcome.building;
36044
- if (isObj4(b) && isId(b.id)) out.buildingId = b.id;
36613
+ if (isObj5(b) && isId(b.id)) out.buildingId = b.id;
36045
36614
  return out;
36046
36615
  }
36047
36616
  var SceneState = class _SceneState {
@@ -36089,7 +36658,7 @@ var SceneState = class _SceneState {
36089
36658
  this.likesToday = void 0;
36090
36659
  this.summary = void 0;
36091
36660
  this.me = sceneMeFrom(msg);
36092
- const city = isObj4(msg.city) ? msg.city : void 0;
36661
+ const city = isObj5(msg.city) ? msg.city : void 0;
36093
36662
  const d = Array.isArray(city?.districts) ? city.districts[0] : void 0;
36094
36663
  this.district = typeof d === "string" ? d : void 0;
36095
36664
  }
@@ -36135,7 +36704,7 @@ var SceneState = class _SceneState {
36135
36704
  case "players": {
36136
36705
  if (!Array.isArray(msg.players)) return { forward: false };
36137
36706
  for (const e of msg.players) {
36138
- if (!isObj4(e) || !isId(e.id)) continue;
36707
+ if (!isObj5(e) || !isId(e.id)) continue;
36139
36708
  const pos = position(e.pos);
36140
36709
  if (!pos) continue;
36141
36710
  if (e.id === this.me?.id) {
@@ -36145,7 +36714,7 @@ var SceneState = class _SceneState {
36145
36714
  const p = this.players.get(e.id);
36146
36715
  if (!p) continue;
36147
36716
  p.pos = pos;
36148
- if (isObj4(e.greeting) && typeof e.greeting.id === "string" && isNum(e.greeting.until)) {
36717
+ if (isObj5(e.greeting) && typeof e.greeting.id === "string" && isNum(e.greeting.until)) {
36149
36718
  p.greeting = { id: e.greeting.id, until: e.greeting.until };
36150
36719
  }
36151
36720
  }
@@ -36153,7 +36722,7 @@ var SceneState = class _SceneState {
36153
36722
  }
36154
36723
  case "player.join": {
36155
36724
  const p = msg.player;
36156
- if (!isObj4(p) || !isId(p.id) || !position(p.pos) || p.id === this.me?.id) return { forward: false };
36725
+ if (!isObj5(p) || !isId(p.id) || !position(p.pos) || p.id === this.me?.id) return { forward: false };
36157
36726
  if (!this.players.has(p.id) && this.players.size >= MAX_SCENE_PLAYERS) return { forward: false };
36158
36727
  this.players.set(p.id, structuredClone(p));
36159
36728
  return { forward: true };
@@ -36171,7 +36740,7 @@ var SceneState = class _SceneState {
36171
36740
  }
36172
36741
  case "minimap": {
36173
36742
  if (!Array.isArray(msg.blocks)) return { forward: false };
36174
- this.minimap = msg.blocks.filter((b) => isObj4(b) && isNum(b.x) && isNum(b.y) && isNum(b.lit)).map((b) => ({ x: b.x, y: b.y, lit: b.lit }));
36743
+ this.minimap = msg.blocks.filter((b) => isObj5(b) && isNum(b.x) && isNum(b.y) && isNum(b.lit)).map((b) => ({ x: b.x, y: b.y, lit: b.lit }));
36175
36744
  return { forward: true };
36176
36745
  }
36177
36746
  case "afk":
@@ -36194,7 +36763,7 @@ var SceneState = class _SceneState {
36194
36763
  }
36195
36764
  case "profile": {
36196
36765
  const p = msg.player;
36197
- if (!isObj4(p) || !isId(p.id)) return { forward: false };
36766
+ if (!isObj5(p) || !isId(p.id)) return { forward: false };
36198
36767
  if (this.players.has(p.id) && position(p.pos)) this.players.set(p.id, structuredClone(p));
36199
36768
  return { forward: true };
36200
36769
  }
@@ -36268,7 +36837,7 @@ var SceneState = class _SceneState {
36268
36837
  area(msg) {
36269
36838
  if (!isId(msg.chunk) || !isNum(msg.rev) || !Array.isArray(msg.buildings)) return { forward: false };
36270
36839
  const buildings = /* @__PURE__ */ new Map();
36271
- for (const b of msg.buildings) if (isObj4(b) && isId(b.id)) buildings.set(b.id, structuredClone(b));
36840
+ for (const b of msg.buildings) if (isObj5(b) && isId(b.id)) buildings.set(b.id, structuredClone(b));
36272
36841
  this.chunks.set(msg.chunk, { rev: msg.rev, buildings });
36273
36842
  this.resyncAt.delete(msg.chunk);
36274
36843
  return { forward: true };
@@ -36281,7 +36850,7 @@ var SceneState = class _SceneState {
36281
36850
  if (!c) return this.gap(msg.chunk);
36282
36851
  if (msg.rev <= c.rev) return { forward: false };
36283
36852
  if (msg.rev !== c.rev + 1) return this.gap(msg.chunk);
36284
- const changes = msg.changes.filter((x) => isObj4(x) && isId(x.id));
36853
+ const changes = msg.changes.filter((x) => isObj5(x) && isId(x.id));
36285
36854
  if (changes.some((x) => x.lot === void 0 && !c.buildings.has(x.id))) return this.gap(msg.chunk);
36286
36855
  for (const x of changes) {
36287
36856
  const id = x.id;
@@ -36296,7 +36865,7 @@ var SceneState = class _SceneState {
36296
36865
  /** `building`: o interior inteiro, que substitui tudo (mesmo com `rev` menor). Daqui em diante estou dentro. */
36297
36866
  enterBuilding(msg) {
36298
36867
  const d = msg.detail;
36299
- if (!isNum(msg.rev) || !isObj4(d) || !isObj4(d.building) || !isId(d.building.id) || !Array.isArray(d.floors)) return { forward: false };
36868
+ if (!isNum(msg.rev) || !isObj5(d) || !isObj5(d.building) || !isId(d.building.id) || !Array.isArray(d.floors)) return { forward: false };
36300
36869
  this.inside = { id: d.building.id, rev: msg.rev, detail: structuredClone(d) };
36301
36870
  this.buildingResyncAt = void 0;
36302
36871
  return { forward: true };
@@ -36314,7 +36883,7 @@ var SceneState = class _SceneState {
36314
36883
  return { forward: false, resyncBuilding: inside.id };
36315
36884
  }
36316
36885
  if (msg.floors !== void 0 && !Array.isArray(msg.floors)) return { forward: false };
36317
- if (msg.building !== void 0 && (!isObj4(msg.building) || msg.building.id !== inside.id)) return { forward: false };
36886
+ if (msg.building !== void 0 && (!isObj5(msg.building) || msg.building.id !== inside.id)) return { forward: false };
36318
36887
  if (msg.visitors !== void 0 && !isNum(msg.visitors)) return { forward: false };
36319
36888
  const detail = inside.detail;
36320
36889
  if (msg.floors) detail.floors = structuredClone(msg.floors);
@@ -36360,7 +36929,7 @@ var SceneState = class _SceneState {
36360
36929
  var SUMMARY_SEEN_GRACE_MS = 2e4;
36361
36930
  var UNBLOCK_GRACE_MS = 6e4;
36362
36931
  var MAX_BLOCKED = 500;
36363
- var isObj5 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
36932
+ var isObj6 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
36364
36933
  var count = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= 1e9 ? v : void 0;
36365
36934
  var ID_RE = /^[\x21-\x7e]{1,64}$/;
36366
36935
  var CODE_RE = /^HB-[2-9A-HJKMNP-TV-Z]{4}$/;
@@ -36376,10 +36945,10 @@ function summaryWithin(b, a) {
36376
36945
  return b.stamps.every((x) => x.count <= (a.stamps.find((y) => y.stampId === x.stampId)?.count ?? 0));
36377
36946
  }
36378
36947
  function parseMeBuilding(raw) {
36379
- if (!isObj5(raw) || !STATES.includes(raw.state)) return void 0;
36948
+ if (!isObj6(raw) || !STATES.includes(raw.state)) return void 0;
36380
36949
  const lot = raw.lot;
36381
- if (!isObj5(lot) || typeof lot.district !== "string" || lot.district.length > 32 || !Number.isInteger(lot.x) || !Number.isInteger(lot.y)) return void 0;
36382
- const a = isObj5(raw.agents) ? raw.agents : {};
36950
+ if (!isObj6(lot) || typeof lot.district !== "string" || lot.district.length > 32 || !Number.isInteger(lot.x) || !Number.isInteger(lot.y)) return void 0;
36951
+ const a = isObj6(raw.agents) ? raw.agents : {};
36383
36952
  const b = {
36384
36953
  state: raw.state,
36385
36954
  paused: raw.paused === true,
@@ -36389,7 +36958,7 @@ function parseMeBuilding(raw) {
36389
36958
  likes: count(raw.likes) ?? 0,
36390
36959
  firstOnlineMonth: typeof raw.firstOnlineMonth === "string" && /^\d{4}-\d{2}$/.test(raw.firstOnlineMonth) ? raw.firstOnlineMonth : ""
36391
36960
  };
36392
- if (isObj5(raw.tokens)) {
36961
+ if (isObj6(raw.tokens)) {
36393
36962
  const day = band(raw.tokens.day);
36394
36963
  const week = band(raw.tokens.week);
36395
36964
  if (day !== void 0 && week !== void 0) b.tokens = { day, week };
@@ -36406,7 +36975,7 @@ function parseBlocked(raw) {
36406
36975
  const out = [];
36407
36976
  for (const x of raw) {
36408
36977
  if (out.length >= MAX_BLOCKED) break;
36409
- if (!isObj5(x) || typeof x.id !== "string" || !ID_RE.test(x.id) || typeof x.name !== "string" || x.name.length > 64) continue;
36978
+ if (!isObj6(x) || typeof x.id !== "string" || !ID_RE.test(x.id) || typeof x.name !== "string" || x.name.length > 64) continue;
36410
36979
  if (!out.some((y) => y.id === x.id)) out.push({ id: x.id, name: x.name });
36411
36980
  }
36412
36981
  return out;
@@ -36565,7 +37134,7 @@ async function body(req, res) {
36565
37134
  sendError(res, status2, code2, err.message);
36566
37135
  return null;
36567
37136
  }
36568
- if (!isObj5(raw)) {
37137
+ if (!isObj6(raw)) {
36569
37138
  sendError(res, 400, "invalid", tr("esperado um objeto JSON"));
36570
37139
  return null;
36571
37140
  }
@@ -36601,8 +37170,8 @@ function socialRoutes(social) {
36601
37170
  }
36602
37171
 
36603
37172
  // server/world/settings.ts
36604
- import { chmodSync as chmodSync7, mkdirSync as mkdirSync17, readFileSync as readFileSync27, renameSync as renameSync15, rmSync as rmSync9, statSync as statSync24, writeFileSync as writeFileSync16 } from "node:fs";
36605
- import { dirname as dirname16 } from "node:path";
37173
+ import { chmodSync as chmodSync7, mkdirSync as mkdirSync18, readFileSync as readFileSync28, renameSync as renameSync16, rmSync as rmSync9, statSync as statSync24, writeFileSync as writeFileSync17 } from "node:fs";
37174
+ import { dirname as dirname17 } from "node:path";
36606
37175
  var DEVICE_ID_RE = /^[A-Za-z0-9_-]{1,64}$/;
36607
37176
  var TOKEN_RE = /^[A-Za-z0-9_-]{16,256}$/;
36608
37177
  var MAX_FILE = 64 * 1024;
@@ -36648,7 +37217,7 @@ var WorldSettingsStore = class {
36648
37217
  const st = statSync24(this.file);
36649
37218
  if (st.size > MAX_FILE) throw new Error("too large");
36650
37219
  if ((st.mode & 63) !== 0) chmodSync7(this.file, 384);
36651
- const raw = JSON.parse(readFileSync27(this.file, "utf8"));
37220
+ const raw = JSON.parse(readFileSync28(this.file, "utf8"));
36652
37221
  const obj4 = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
36653
37222
  if (isWorldThemeChoice(obj4.theme)) this.theme = obj4.theme;
36654
37223
  this.session = parseWorldSession(raw);
@@ -36711,10 +37280,10 @@ var WorldSettingsStore = class {
36711
37280
  }
36712
37281
  const tmp = `${this.file}.${process.pid}.tmp`;
36713
37282
  try {
36714
- mkdirSync17(dirname16(this.file), { recursive: true });
36715
- writeFileSync16(tmp, JSON.stringify(data), { mode: 384 });
37283
+ mkdirSync18(dirname17(this.file), { recursive: true });
37284
+ writeFileSync17(tmp, JSON.stringify(data), { mode: 384 });
36716
37285
  chmodSync7(tmp, 384);
36717
- renameSync15(tmp, this.file);
37286
+ renameSync16(tmp, this.file);
36718
37287
  log.clearOnce("world-write");
36719
37288
  return true;
36720
37289
  } catch (err) {
@@ -36923,7 +37492,7 @@ var WorldClient = class {
36923
37492
  const signal = o.signal ? AbortSignal.any([timeout, o.signal]) : timeout;
36924
37493
  const fail3 = (status2, code3, retryAfter) => retryAfter === void 0 ? { ok: false, status: status2, code: code3 } : { ok: false, status: status2, code: code3, retryAfter };
36925
37494
  let res;
36926
- let text2;
37495
+ let text3;
36927
37496
  try {
36928
37497
  res = await this.fetchImpl(`${this.base}${path}`, { method, headers, body: body2, redirect: "manual", signal });
36929
37498
  const length = Number(res.headers.get("content-length") ?? "0");
@@ -36931,16 +37500,16 @@ var WorldClient = class {
36931
37500
  await res.body?.cancel().catch(() => void 0);
36932
37501
  return fail3(502, CLIENT_ERROR.badResponse);
36933
37502
  }
36934
- text2 = await res.text();
37503
+ text3 = await res.text();
36935
37504
  } catch (err) {
36936
37505
  o.signal?.throwIfAborted();
36937
37506
  return err?.name === "TimeoutError" || timeout.aborted ? fail3(504, CLIENT_ERROR.timeout) : fail3(502, CLIENT_ERROR.unreachable);
36938
37507
  }
36939
- if (text2.length > max) return fail3(502, CLIENT_ERROR.badResponse);
37508
+ if (text3.length > max) return fail3(502, CLIENT_ERROR.badResponse);
36940
37509
  let raw;
36941
- if (text2.trim()) {
37510
+ if (text3.trim()) {
36942
37511
  try {
36943
- raw = JSON.parse(text2);
37512
+ raw = JSON.parse(text3);
36944
37513
  } catch {
36945
37514
  raw = void 0;
36946
37515
  if (res.ok) return fail3(502, CLIENT_ERROR.badResponse);
@@ -37377,8 +37946,8 @@ function createWorldRoutes(service, viewer, social) {
37377
37946
  }
37378
37947
 
37379
37948
  // server/world/uplink.ts
37380
- import { chmodSync as chmodSync8, mkdirSync as mkdirSync18, readFileSync as readFileSync28, renameSync as renameSync16, rmSync as rmSync10, writeFileSync as writeFileSync17 } from "node:fs";
37381
- import { dirname as dirname17 } from "node:path";
37949
+ import { chmodSync as chmodSync8, mkdirSync as mkdirSync19, readFileSync as readFileSync29, renameSync as renameSync17, rmSync as rmSync10, writeFileSync as writeFileSync18 } from "node:fs";
37950
+ import { dirname as dirname18 } from "node:path";
37382
37951
 
37383
37952
  // shared/world/appearance-flat.ts
37384
37953
  var SKINS = ["#ffe2cc", "#f6cfb0", "#eab894", "#d69f78", "#bd8560", "#9a6444", "#7a4a31", "#5a3623"];
@@ -37745,7 +38314,7 @@ function toWorldAgent(c, widOf, name, input) {
37745
38314
  }
37746
38315
 
37747
38316
  // server/world/ids.ts
37748
- import { randomBytes as randomBytes10, randomInt } from "node:crypto";
38317
+ import { randomBytes as randomBytes11, randomInt } from "node:crypto";
37749
38318
  var ID_LIFETIME_MS = 24 * 36e5;
37750
38319
  var ID_JITTER_MS = 6 * 36e5;
37751
38320
  var toHex = (b) => Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
@@ -37757,7 +38326,7 @@ var WorldIds = class {
37757
38326
  bytes;
37758
38327
  jitter;
37759
38328
  constructor(opts = {}) {
37760
- this.bytes = opts.randomBytes ?? ((n2) => randomBytes10(n2));
38329
+ this.bytes = opts.randomBytes ?? ((n2) => randomBytes11(n2));
37761
38330
  this.jitter = opts.jitter ?? (() => randomInt(-ID_JITTER_MS, ID_JITTER_MS + 1));
37762
38331
  }
37763
38332
  floorId(roomId, now) {
@@ -38439,7 +39008,7 @@ var BuildingUplink = class {
38439
39008
  this.deviceId = s2?.deviceId;
38440
39009
  if (!file) return;
38441
39010
  try {
38442
- const raw = JSON.parse(readFileSync28(file, "utf8"));
39011
+ const raw = JSON.parse(readFileSync29(file, "utf8"));
38443
39012
  const ok = raw && typeof raw === "object" && typeof raw.deviceId === "string" && typeof raw.at === "number" && typeof raw.bytes === "number" && raw.uplink && typeof raw.uplink === "object" && Array.isArray(raw.uplink.floors);
38444
39013
  if (!ok || raw.deviceId !== s2?.deviceId) return this.removeLast();
38445
39014
  this.last = raw;
@@ -38451,10 +39020,10 @@ var BuildingUplink = class {
38451
39020
  if (!file || !this.last) return;
38452
39021
  const tmp = `${file}.${process.pid}.tmp`;
38453
39022
  try {
38454
- mkdirSync18(dirname17(file), { recursive: true });
38455
- writeFileSync17(tmp, JSON.stringify(this.last), { mode: 384 });
39023
+ mkdirSync19(dirname18(file), { recursive: true });
39024
+ writeFileSync18(tmp, JSON.stringify(this.last), { mode: 384 });
38456
39025
  chmodSync8(tmp, 384);
38457
- renameSync16(tmp, file);
39026
+ renameSync17(tmp, file);
38458
39027
  } catch (err) {
38459
39028
  try {
38460
39029
  rmSync10(tmp, { force: true });
@@ -39112,8 +39681,8 @@ var BuildingTokens = class {
39112
39681
  };
39113
39682
 
39114
39683
  // server/world/viewer.ts
39115
- import { randomBytes as randomBytes11 } from "node:crypto";
39116
- var isObj6 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
39684
+ import { randomBytes as randomBytes12 } from "node:crypto";
39685
+ var isObj7 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
39117
39686
  var WorldViewer = class {
39118
39687
  link;
39119
39688
  now;
@@ -39132,7 +39701,7 @@ var WorldViewer = class {
39132
39701
  this.state = new SceneState(this.now);
39133
39702
  this.pingMs = o.pingMs ?? 15e3;
39134
39703
  this.maxBuffered = o.maxBuffered ?? 1024 * 1024;
39135
- this.newId = o.streamId ?? (() => randomBytes11(12).toString("base64url"));
39704
+ this.newId = o.streamId ?? (() => randomBytes12(12).toString("base64url"));
39136
39705
  }
39137
39706
  /** Liga à conexão do prédio (que chama `opened`, `closed` e `message` daqui). */
39138
39707
  attach(link) {
@@ -39208,7 +39777,7 @@ var WorldViewer = class {
39208
39777
  /** POST /api/world/cmd {stream, cmds}. */
39209
39778
  command(body2) {
39210
39779
  const max = WORLD_SCENE_LIMITS.cmdsPerBatch;
39211
- if (!isObj6(body2) || typeof body2.stream !== "string" || !Array.isArray(body2.cmds) || body2.cmds.length === 0 || body2.cmds.length > max) {
39780
+ if (!isObj7(body2) || typeof body2.stream !== "string" || !Array.isArray(body2.cmds) || body2.cmds.length === 0 || body2.cmds.length > max) {
39212
39781
  return { ok: false, status: 400, code: "invalid" };
39213
39782
  }
39214
39783
  const s2 = this.streams.get(body2.stream);
@@ -39686,6 +40255,12 @@ hub.setInitialFrames(() => {
39686
40255
  });
39687
40256
  var avatar = new AvatarStore(join33(config.dataDir, "avatar.json"));
39688
40257
  hub.setInitialFrames(() => [["avatar", avatar.get()]]);
40258
+ var inboxStore = new InboxStore(join33(config.dataDir, "inbox.json"));
40259
+ var inbox = new InboxService({ store: inboxStore, agents: () => office.list() });
40260
+ inbox.onFrame((f) => hub.broadcast("inbox", f));
40261
+ hub.setInitialFrames(() => [["inbox", inbox.frame()]]);
40262
+ var inboxPurgeTimer = setInterval(() => inboxStore.purge(), 60 * 6e4);
40263
+ inboxPurgeTimer.unref();
39689
40264
  hub.setInitialFrames(() => [["defaultLook", defaultLook2.get()]]);
39690
40265
  var perfSampler = new PerfSampler({
39691
40266
  workCounters: {
@@ -39720,6 +40295,7 @@ if (config.satellite) {
39720
40295
  if (!registry) return { actionId: a.id, ok: false, error: tr("permiss\xF5es desligadas nesta m\xE1quina"), status: 403 };
39721
40296
  return createPermissionDecideHandler({ registry })(a, deadline);
39722
40297
  },
40298
+ "inbox.resolve": createInboxResolveHandler({ store: inboxStore }),
39723
40299
  // Leituras da central (detalhe, terminal, comandos, arquivos de entrega): cada uma é um GET na rota local desta máquina.
39724
40300
  ...createReadHandlers({ port: config.port, host: config.host, link: satelliteLink }),
39725
40301
  "pty.create": async (a, deadline) => remoteSatellitePtys?.handlers()["pty.create"]?.(a, deadline) ?? { actionId: a.id, ok: false, status: 503, error: ptyOff ?? tr("desligado nesta m\xE1quina") },
@@ -39736,7 +40312,8 @@ if (config.satellite) {
39736
40312
  handlers,
39737
40313
  perfSampler,
39738
40314
  ptys: () => remoteSatellitePtys,
39739
- maintenance: () => remoteSatellitePtys?.tick()
40315
+ maintenance: () => remoteSatellitePtys?.tick(),
40316
+ inbox: { items: () => visibleInbox(inboxStore.list()), onChange: (cb) => inboxStore.onChange(cb) }
39740
40317
  });
39741
40318
  }
39742
40319
  }
@@ -39857,8 +40434,8 @@ var providers = config.inDocker ? () => DOCKER_PROVIDERS.map((p) => ({ ...p }))
39857
40434
  };
39858
40435
  var gentleInbox = () => messages && {
39859
40436
  agents: () => office.list().filter((a) => a.provider === "gentle-shell" && a.kind === "main").map((a) => ({ id: a.id, cwd: office.roomPath(a.roomId), startedAt: a.startedAt })),
39860
- send: (agentId, text2) => {
39861
- const r = messages.send({ agentId, text: text2 });
40437
+ send: (agentId, text3) => {
40438
+ const r = messages.send({ agentId, text: text3 });
39862
40439
  if ("message" in r) return { ok: true };
39863
40440
  if (r.error === "unavailable") return { ok: false, retry: true, reason: r.reason };
39864
40441
  if (r.error === "too-many") return { ok: false, retry: false, reason: tr("o agente j\xE1 tem mensagens demais esperando") };
@@ -39883,7 +40460,7 @@ var messages = config.messages ? new MessageRegistry({
39883
40460
  office,
39884
40461
  images: messageImages,
39885
40462
  demoAgent: (id) => office.demoAgent(id),
39886
- demoDeliver: (id, text2) => office.deliverDemoMessage(id, text2),
40463
+ demoDeliver: (id, text3) => office.deliverDemoMessage(id, text3),
39887
40464
  codex: {
39888
40465
  run: codexBin ? createCodexQueueRunner(codexBin) : void 0,
39889
40466
  homeOf: (account) => accounts.entriesOf("codex").find((e) => e.id === account)?.detected.configDir
@@ -39991,6 +40568,7 @@ var api = createApiHandler({
39991
40568
  // Central: `remotePermissions` nasce mais abaixo; id que não é remoto cai no registro local.
39992
40569
  permissions: permissions ? createPermissionRoutes(permissions, config.central ? { detail: (id, res) => late.remotePermissions?.detail(id, res) ?? false, decide: async (id, raw) => late.remotePermissions?.decide(id, raw) } : void 0) : void 0,
39993
40570
  attention: createAttentionRoutes(attention, hub),
40571
+ inbox: createInboxRoutes(inbox),
39994
40572
  avatar: createAvatarRoutes(avatar, hub),
39995
40573
  defaultLook: createDefaultLookRoutes(defaultLook2, () => {
39996
40574
  late.office?.markDirty();
@@ -40170,6 +40748,7 @@ if (config.central) {
40170
40748
  late.remotePtys.start();
40171
40749
  late.centralRoutes = createCentralRoutes({ machines, hub: centralHub, name: central.name, port: central.port, fingerprint: () => caFingerprint(tlsPaths(central.tlsBase)) });
40172
40750
  late.remotePermissions = new RemotePermissions({ hub: centralHub });
40751
+ inbox.setRemote(new RemoteInboxItems(centralHub));
40173
40752
  centralHub.start();
40174
40753
  if (messages) {
40175
40754
  late.remoteMessages = new RemoteMessages({ hub: centralHub, office, images: messageImages });
@@ -40203,7 +40782,7 @@ if (config.central) {
40203
40782
  listener = startCentralListener({
40204
40783
  host: bind.host,
40205
40784
  port: central.port,
40206
- tls: { key: readFileSync29(paths.serverKey), cert: readFileSync29(paths.serverCert), ca: readFileSync29(paths.caCert) },
40785
+ tls: { key: readFileSync30(paths.serverKey), cert: readFileSync30(paths.serverCert), ca: readFileSync30(paths.caCert) },
40207
40786
  machines,
40208
40787
  routes: centralHub
40209
40788
  });
@@ -40311,6 +40890,7 @@ function shutdown(signal) {
40311
40890
  centralStopped = true;
40312
40891
  if (centralRetry) clearTimeout(centralRetry);
40313
40892
  if (remoteMessagesTimer) clearInterval(remoteMessagesTimer);
40893
+ clearInterval(inboxPurgeTimer);
40314
40894
  late.remoteMessages?.stop();
40315
40895
  late.remotePtys?.dispose();
40316
40896
  late.centralHub?.stop();