Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.
TypeScript agent-teamagentic-aiai-agentsai-assistantclaude-codecodexcursorelectrongrokgrok-bot-alternativelinuxlocal-firstmacosmcpmulti-agentopenclaw-alternativeopencodewindows
Errors in people's words, toasts, a real confirm dialog and motion polish (#96)
Eduardo Machadodef245877585
diff --git a/src/core/connectors.ts b/src/core/connectors.tsindex d81737a..9ebfa79 100644--- a/src/core/connectors.ts+++ b/src/core/connectors.ts@@ -10,6 +10,7 @@ import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js'import { L } from '../shared/lang'+import { friendly } from '../shared/errors'import type { CoreEvent } from '../shared/rpc'import type { Connector, ConnectorInput, ConnectorStatus, ConnectorTool } from '../shared/types'import type { Db } from './db'@@ -21,6 +22,24 @@ const CALL_TIMEOUT_MS = 120_000const CONNECT_TIMEOUT_MS = 20_000const MAX_STDIO_FAILURES = 3+// The authorization page sent the browser back without a code: why, and what to do.+export function notAuthorized(url: URL): string {+ const error = url.searchParams.get('error')+ if (error === 'access_denied') return L('Você recusou o acesso na página do serviço. Tente de novo e clique em Permitir.', 'You declined access on the service’s page. Try again and click Allow.')+ const why = url.searchParams.get('error_description') ?? error ?? L('o endereço não tem o código', 'the address has no code')+ return L(`Autorização não concluída: ${why}. Tente de novo pelo app.`, `Authorization not completed: ${why}. Try again from the app.`)+}++// Why a server didn't open, in words that say what to do; the SDK's own text otherwise.+export function connectError(e: unknown): string {+ const raw = (e instanceof Error ? e.message : String(e)).trim()+ const f = friendly(raw)+ if (f.detail === raw) return f.text // a case it knows: no Node.js, no internet, a refused login…+ if (/ENOENT/.test(raw)) return L('O comando do conector não foi encontrado. Se ele usa npx, instale o Node.js (nodejs.org).', "The connector's command wasn't found. If it uses npx, install Node.js (nodejs.org).")+ if (/connection closed/i.test(raw)) return L('O servidor fechou logo ao abrir. Confira o comando e os argumentos do conector.', 'The server closed right after opening. Check the connector’s command and arguments.')+ return raw+}+export interface ConnectorDeps {db: Dbsecrets: Secrets@@ -185,7 +204,11 @@ export class ConnectorManager {if (refused && c.auth === 'token') {// With a token there is no browser to go to: the server refused it, or there is none yet.await client.close().catch(() => {})- this.setStatus(id, 'error', L('O servidor recusou. Salve um token válido neste conector.', 'The server refused. Save a valid token on this connector.'))+ this.setStatus(id, 'error', L('O servidor recusou o token. Salve um token válido neste conector.', 'The server refused the token. Save a valid token on this connector.'))+ } else if (refused && c.auth !== 'oauth') {+ // Added with no sign-in at all, and the server asks for one.+ await client.close().catch(() => {})+ this.setStatus(id, 'error', L('O servidor pede autorização. Adicione de novo com OAuth ou token.', 'The server asks for authorization. Add it again with OAuth or a token.'))} else if (refused) {this.setStatus(id, 'needs_auth', interactive ? L('Conclua a autorização no navegador.', 'Finish the authorization in the browser.') : L('Precisa autorizar.', 'Needs authorization.'))} else if (e instanceof Error && /dynamic client registration/i.test(e.message)) {@@ -203,7 +226,7 @@ export class ConnectorManager {await client.close().catch(() => {})this.setStatus(id, 'error', L(`O servidor não respondeu em ${CONNECT_TIMEOUT_MS / 1000} s. Confira o endereço e a sua rede.`, `The server didn't answer in ${CONNECT_TIMEOUT_MS / 1000} s. Check the address and your network.`))} else {- this.setStatus(id, 'error', e instanceof Error ? e.message : String(e))+ this.setStatus(id, 'error', connectError(e))}return}@@ -282,7 +305,7 @@ export class ConnectorManager {throw new Error(L('Isso não parece um endereço. Copie o endereço inteiro da barra do navegador.', "That doesn't look like an address. Copy the whole address from the browser's bar."))}const code = url.searchParams.get('code')- if (!code) throw new Error(L(`Autorização não concluída: ${url.searchParams.get('error_description') ?? url.searchParams.get('error') ?? 'o endereço não tem o código'}.`, `Authorization not completed: ${url.searchParams.get('error_description') ?? url.searchParams.get('error') ?? 'the address has no code'}.`))+ if (!code) throw new Error(notAuthorized(url))return this.finishOAuth(url.searchParams.get('state') ?? '', code)}diff --git a/src/core/engines/cli.ts b/src/core/engines/cli.tsindex db92a31..ca1945b 100644--- a/src/core/engines/cli.ts+++ b/src/core/engines/cli.ts@@ -2,6 +2,7 @@ import { spawn } from 'node:child_process'import { createInterface } from 'node:readline'import { isWin, killTree, spawnable } from '../platform'import type { EngineEvent } from './types'+import { OUT_OF_QUOTA } from '../../shared/errors'// A parser turns the CLI's JSONL stdout into engine events. It is pure so it// can be tested against recorded output from the real CLIs.@@ -76,7 +77,6 @@ export function parseJson(line: string): Record<string, unknown> | null {// "You've hit your limit" and 5-hour or weekly limit, Codex's "usage limit", Gemini's quota// (RESOURCE_EXHAUSTED), OpenCode's and the providers' 429s. Not Tucano's own monthly limit,// which never reaches here as an engine error.-const OUT_OF_QUOTA = /usage limit|hit your (?:[\w-]+ ){0,2}limit|limit reached|limit_reached|quota|resource_exhausted|rate.?limit|too many requests|\b429\b|insufficient_quota|credit balance is too low|out of (extra )?usage/iexport const outOfQuota = (message: string): boolean => OUT_OF_QUOTA.test(message)export const num = (v: unknown): number => (typeof v === 'number' && Number.isFinite(v) ? v : 0)diff --git a/src/core/index.ts b/src/core/index.tsindex 2236c44..c67982e 100644--- a/src/core/index.ts+++ b/src/core/index.ts@@ -12,6 +12,7 @@ import { basename, join } from 'node:path'import { randomUUID } from 'node:crypto'import type { MessagePortMain } from 'electron'import { L, langOf, locale, setLang, type Lang } from '../shared/lang'+import { friendly } from '../shared/errors'import type { Api, CoreEvent, Method, Request, Wire } from '../shared/rpc'import { channelName, ENGINES, inQuietHours, modelInfo, rememberModels, usable, WEBHOOK_PORT, type Account, type AccountEngine, type Agent, type BrowserReply, type Message, type EngineId, type EngineStatus, type Settings } from '../shared/types'import { listModels, quietClaude, quietCodex, withChoice } from './harness'@@ -28,7 +29,7 @@ import { fakeEngine } from './engines/fake'import { DesktopApps, macApps, SELF } from './apps'import { linuxApps, windowsApps, type SystemApp } from './apps-os'import type { Engine } from './engines/types'-import { ConnectorManager } from './connectors'+import { ConnectorManager, notAuthorized } from './connectors'import { harnessMcps, publicMcp, type FoundMcp } from './harness-mcp'import { Gateway } from './gateway'import { createServer } from 'node:http'@@ -245,8 +246,9 @@ function toPhone(e: CoreEvent): void {}// Desktop notification, and the same on the phone.-const notifyAll = (title: string, shortText: string, conversationId?: string, fullText?: string): void => {- toMain({ type: 'notify', title, body: shortText, conversationId, sound: settings().sounds !== false })+// `fullText`: the whole reply, for the phone; `page`: a click opens that screen instead of a conversation.+const notifyAll = (title: string, shortText: string, conversationId?: string, fullText?: string, more: { kind?: 'approval'; page?: 'skills' } = {}): void => {+ toMain({ type: 'notify', title, body: shortText, conversationId, ...more, sound: settings().sounds !== false })void telegram?.notice(title, fullText ?? shortText)}@@ -256,7 +258,7 @@ type ToMain =| { type: 'open_path'; path: string }| { type: 'open_local'; path: string; how: 'open' | 'reveal' }| { type: 'wiki_dir'; path: string } // the wiki's folder, which the app may open- | { type: 'notify'; title: string; body: string; conversationId?: string; kind?: 'approval' | 'question' | 'done'; sound?: boolean }+ | { type: 'notify'; title: string; body: string; conversationId?: string; kind?: 'approval' | 'question' | 'done'; page?: 'skills'; sound?: boolean }| { type: 'login_item'; open: boolean }| { type: 'busy'; busy: boolean }| { type: 'lang'; lang: Lang }@@ -428,10 +430,7 @@ const connectors = new ConnectorManager({gateway.route('/oauth/callback', async (url) => {const code = url.searchParams.get('code')const state = url.searchParams.get('state') ?? ''- if (!code) {- const why = url.searchParams.get('error_description') ?? url.searchParams.get('error') ?? L('sem código', 'no code')- return L(`Autorização não concluída: ${why}.`, `Authorization not completed: ${why}.`)- }+ if (!code) return notAuthorized(url)return (await connectors.finishOAuth(state, code))? L('Conector autorizado. Pode fechar esta aba e voltar pro Tucano.', 'Connector authorized. You can close this tab and go back to Tucano.'): L('Esse pedido de autorização expirou. Tente de novo pelo app.', 'This authorization request expired. Try again from the app.')@@ -465,7 +464,8 @@ const routines = new Routines({notify: notifyAll})-const skills = new Skills({ db, emit, notify: (title, body) => notifyAll(title, body) })+// A proposal waits for a decision: the knock at the door, and a click opens Skills.+const skills = new Skills({ db, emit, notify: (title, body) => notifyAll(title, body, undefined, undefined, { kind: 'approval', page: 'skills' }) })// The wiki's folder is the truth (Markdown, as Obsidian opens it); TUCANO_WIKI points it elsewhere.// The default folder keeps wiki.db; another folder gets an index of its own, so going back finds the old one.const wikiHome = join(dataDir, 'wiki')@@ -1182,7 +1182,8 @@ function handle(port: MessagePortMain, req: Request): void {(result) => reply({ result }),(e: unknown) => {console.error(`[core] ${req.method}`, e)- reply({ error: e instanceof Error ? e.message : String(e) })+ // The page shows it as it comes: in people's words, the raw text stays in the log above.+ reply({ error: friendly(e).text })})}diff --git a/src/core/routines.ts b/src/core/routines.tsindex ea01524..e238399 100644--- a/src/core/routines.ts+++ b/src/core/routines.ts@@ -4,6 +4,7 @@import { createHash, randomBytes, randomUUID } from 'node:crypto'import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'import { L, locale } from '../shared/lang'+import { firstSentence } from '../shared/errors'import type { CoreEvent } from '../shared/rpc'import { describeSchedule, MAX_AGENT_ROUTINES, nextRun, routineCap, validTime, type Agent, type Connector, type Conversation, type Message, type Routine, type RoutineInput, type Trigger } from '../shared/types'import type { Db } from './db'@@ -385,7 +386,8 @@ export async function retrying(const wait = RETRY_WAITS_MS[i]!const base = reply.run.error ?? ''const min = Math.round(wait / 60_000)- note(reply, `${plain(base)}. ${L(`Tento de novo em ${min} min (tentativa ${i + 2} de ${tries}).`, `Trying again in ${min} min (try ${i + 2} of ${tries}).`)}`)+ // The headline only: the rest of the error says "try again later", and this is the later.+ note(reply, `${firstSentence(plain(base))} ${L(`Tento de novo em ${min} min (tentativa ${i + 2} de ${tries}).`, `Trying again in ${min} min (try ${i + 2} of ${tries}).`)}`)await deps.wait(wait)const now = deps.db.message(reply.id)if (now?.run?.status !== 'failed' || !deps.enabled()) {@@ -415,7 +417,8 @@ export function outcome(reply: Message): string {case 'paused':return L('Pausou no teto da resposta. Abra pra continuar.', "Paused at the reply's cap. Open it to go on.")case 'failed':- return `${L('Falhou', 'Failed')}: ${reply.run.error ?? L('erro desconhecido', 'unknown error')}`+ // The headline only (what happened); the rest is in the conversation.+ return `${reply.run.error ? firstSentence(reply.run.error) : L('Falhou.', 'Failed.')} ${L('Abra pra resolver.', 'Open it to fix it.')}`case 'stopped':return L('Foi interrompida.', 'Was interrupted.')}diff --git a/src/core/runs.ts b/src/core/runs.tsindex f898887..4846c89 100644--- a/src/core/runs.ts+++ b/src/core/runs.ts@@ -2,6 +2,7 @@ import { mkdirSync, writeFileSync } from 'node:fs'import { join } from 'node:path'import { randomUUID } from 'node:crypto'import { L, locale } from '../shared/lang'+import { friendly, toolLabel } from '../shared/errors'import type { CoreEvent } from '../shared/rpc'import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'import { ACCESS_REQUEST, CACHE_READ_WEIGHT, describeSchedule, workIn, ENGINES, ERRORS_STOP, usable, modelInfo, REPEAT_STOP, REPEAT_WARN, RUN_BUDGET_PCT, RUN_STALL_MINUTES, IMAGE_MIMES, MAX_IMAGE_BYTES, MAX_IMAGES_PER_MESSAGE, type Account, type Agent, type Approval, type Artifact, type ImageUpload, type Connector, type ConnectorTool, type Conversation, type EngineId, type Message, type Quota, type Receipt, type Routine, type Run, type RunStatus, type Settings, type Step, wikiAccess } from '../shared/types'@@ -1018,7 +1019,7 @@ export class Runner {emit({ type: 'approval', approval })msg.run = { ...msg.run!, approvalId: approval.id }addSteps({ id: randomUUID(), label: L('Pediu aprovação', 'Asked for approval'), detail, status: 'done' })- this.deps.notify?.(L(`${agent.name} pede aprovação`, `${agent.name} asks for approval`), `${detail}${approval.why ? `: ${approval.why}` : ''}`, conv.id, 'approval')+ this.deps.notify?.(L(`${agent.name} pede aprovação`, `${agent.name} asks for approval`), `${toolLabel(current.name)} · ${hit.connector.name}${approval.why ? `: ${approval.why}` : ''}`, conv.id, 'approval')return textResult(L(`Pedido de aprovação criado. A ação ainda NÃO foi executada. Encerre sua resposta agora dizendo em uma frase o que pediu. Quando ${settings.workspaceName} decidir, você recebe o resultado numa nova mensagem.`,@@ -1090,6 +1091,7 @@ export class Runner {let progress = { tokens: 0, cacheRead: 0 }let result: { text: string; usage: Omit<Receipt, 'model' | 'ms'> } | null = nulllet error: string | null = null+ let thrown: unknown // what the engine threw, if it did: a bug reads differently from a CLI's own words// Images I attached: every message says which it had; the newest go in as images.const ids = new Set(history.map((m) => m.id))@@ -1164,6 +1166,7 @@ export class Runner {}} catch (e) {error = e instanceof Error ? e.message : String(e)+ thrown = e}// The main model's subscription is out before it did anything: the same reply goes to the reserve, once.// After a tool call it doesn't, since that would run the call again; the next reply starts on the main model.@@ -1181,6 +1184,7 @@ export class Runner {const to = `${engineLabel}${account ? ` (${account.name})` : ''}`addSteps({ id: randomUUID(), label: L('Foi pro modelo reserva', 'Moved to the reserve model'), detail: L(`${from} está sem limite agora; segue no ${to}`, `${from} is out of quota for now; going on with ${to}`), status: 'done' })error = null+ thrown = undefinedprogress = { tokens: 0, cacheRead: 0 }}} finally {@@ -1248,7 +1252,9 @@ export class Runner {if (question) this.deps.notify?.(L(`${agent.name} te perguntou`, `${agent.name} asked you`), question, conv.id, 'question')else if (!approval && !this.chain(agent, conv, msg, opts.depth) && !opts.routine) this.deps.notify?.(L(`${agent.name} terminou`, `${agent.name} is done`), outcome(msg) || L('Respondeu na conversa.', 'Replied in the conversation.'), conv.id, 'done')} else {- save({ run: { ...base, ...again, status: 'failed', steps: closeThinking('error', L('Falhou', 'Failed')), error: error ?? L('O motor terminou sem resposta.', 'The engine ended without a reply.') } })+ // What happened and what to do; the CLI's own words go folded under it.+ const failure = error === null ? { text: L('O motor terminou sem resposta.', 'The engine ended without a reply.') } : friendly(thrown ?? error, { engine: ENGINES[engineId].label, doing: L('responder', 'replying') })+ save({ run: { ...base, ...again, status: 'failed', steps: closeThinking('error', L('Falhou', 'Failed')), error: failure.text, ...(failure.detail ? { errorDetail: failure.detail } : {}) } })}// Stopped short on its own (a loop, the limit, a failure): you'd want to know. Not when you stopped it.const st = msg.run?.statusdiff --git a/src/core/skills.ts b/src/core/skills.tsindex 99d85d4..040364a 100644--- a/src/core/skills.ts+++ b/src/core/skills.ts@@ -225,7 +225,10 @@ export class Skills {createdAt: waiting?.createdAt ?? at,updatedAt: at})- this.deps.notify?.(L(`${agent.name} propõe ${current ? 'mudar a skill' : 'uma skill'}`, `${agent.name} proposes ${current ? 'a change to a skill' : 'a skill'}`), `${name}: ${description}`)+ this.deps.notify?.(+ L(`${agent.name} propõe ${current ? 'mudar a skill' : 'uma skill'}`, `${agent.name} proposes ${current ? 'a change to a skill' : 'a skill'}`),+ `${name}: ${description.replace(/[.\s]+$/, '')}. ${L('Revise em Skills.', 'Review it in Skills.')}`+ )return {reply: L(`Proposta enviada (${current ? 'mudança na skill' : 'skill nova'} "${name}"). Ela só vale depois que o usuário aprovar, na tela de Skills.`,diff --git a/src/core/telegram.ts b/src/core/telegram.tsindex 38245a7..d55b285 100644--- a/src/core/telegram.ts+++ b/src/core/telegram.ts@@ -4,6 +4,7 @@// reach this Mac. It answers only the chat paired with a code shown in the app.import { randomInt } from 'node:crypto'import { L } from '../shared/lang'+import { offline, UserError } from '../shared/errors'import type { Approval, Message, TelegramInfo } from '../shared/types'import type { Secrets } from './secrets'@@ -14,6 +15,16 @@ const POLL_SECONDS = 50const RETRY_MS = 15_000const MAX_TEXT = 3_500 // Telegram allows 4096 per message+// Telegram's refusal, in what to do: the token was revoked, or another app reads the same bot.+export const refused = (status: number, description?: string): UserError =>+ new UserError(+ status === 401+ ? L('O token do bot não vale mais. Cole um novo do @BotFather.', "The bot's token isn't valid anymore. Paste a new one from @BotFather.")+ : status === 409+ ? L('Outro app está lendo este bot (outro Tucano ou um webhook). Feche o outro ou troque o token.', 'Another app is reading this bot (another Tucano, or a webhook). Close the other one or change the token.')+ : L(`O Telegram recusou: ${description ?? status}.`, `Telegram refused: ${description ?? status}.`)+ )+type Fetch = typeof fetchtype Update = {update_id: number@@ -112,7 +123,7 @@ export class Telegram {signal: signal ?? AbortSignal.timeout(15_000)})const body = (await res.json().catch(() => null)) as { ok?: boolean; result?: unknown; description?: string } | null- if (!body?.ok) throw new Error(body?.description ?? `Telegram ${res.status}`)+ if (!body?.ok) throw refused(res.status, body?.description)return body.result}@@ -127,7 +138,7 @@ export class Telegram {signal: AbortSignal.any([ctl.signal, AbortSignal.timeout((POLL_SECONDS + 10) * 1000)])})const body = (await res.json()) as { ok: boolean; result?: Update[]; description?: string }- if (!body.ok) throw new Error(body.description ?? `Telegram ${res.status}`)+ if (!body.ok) throw refused(res.status, body.description)for (const u of body.result ?? []) {this.offset = u.update_id + 1await this.handle(u).catch((e: unknown) => console.error('[telegram]', e))@@ -138,7 +149,13 @@ export class Telegram {}} catch (e) {if (ctl.signal.aborted) return- const why = e instanceof Error ? e.message : String(e)+ // Telegram said no (and why), or it didn't answer at all: the loop asks again in a moment.+ const why =+ e instanceof UserError+ ? e.message+ : offline(e)+ ? L('Sem internet; tento de novo sozinho.', 'No internet; I’ll try again on my own.')+ : L('O Telegram não respondeu direito; tento de novo sozinho.', 'Telegram didn’t answer properly; I’ll try again on my own.')if (why !== this.error) {this.error = whythis.deps.changed()diff --git a/src/core/tuca.ts b/src/core/tuca.tsindex f8a25cf..c28c460 100644--- a/src/core/tuca.ts+++ b/src/core/tuca.ts@@ -22,7 +22,13 @@ export const tucaInstructions = (): string =>'- O modelo mais simples que dá conta; esforço alto só pra tarefa difícil.','- Um agente por tarefa clara. Se pedirem algo enorme, sugira dividir em dois.','- Depois que a pessoa criar, sugira uma primeira tarefa pra testar.',- '- Você não cria nada sozinho: a proposta vira um card e a pessoa decide.'+ '- Você não cria nada sozinho: a proposta vira um card e a pessoa decide.',+ '',+ 'Sua voz:',+ '- Fale como um colega competente, na primeira pessoa e em português do dia a dia: "pra", não "para"; "a gente", não "nós".',+ '- Frases curtas, uma ideia em cada. Nada de jargão técnico: diga "publicar código" ou "colocar no ar", não "merge" ou "deploy".',+ '- Notícia ruim vem sempre com o próximo passo ("Não achei o Linear. Conecte em Conectores e eu sigo.").',+ '- Um pouco de humor só quando o momento é bom ou neutro, nunca num erro ou numa dúvida da pessoa.'].join('\n'),["You are Tuca, the one who builds this team's agents. The person tells you a task or an area they want to hand off, and you design the right agent for it.",@@ -33,7 +39,13 @@ export const tucaInstructions = (): string =>'- The simplest model that does the job; high effort only for a hard task.','- One agent per clear task. If they ask for something huge, suggest splitting it in two.','- Once the person creates it, suggest a first task to test it.',- "- You don't create anything on your own: the proposal becomes a card and the person decides."+ "- You don't create anything on your own: the proposal becomes a card and the person decides.",+ '',+ 'Your voice:',+ '- Talk like a capable colleague: first person, plain everyday English, contractions welcome.',+ '- Short sentences, one idea each. No technical jargon: say "publish code" or "put it live", not "merge" or "deploy".',+ '- Bad news always comes with the next step ("I couldn\'t find Linear. Connect it in Connectors and I\'ll carry on.").',+ "- A bit of humor only when the moment is good or neutral, never in an error or when the person is unsure."].join('\n'))@@ -194,6 +206,6 @@ export function tucaAgent(modelId: string, taken: string[], limit: number): Agenexport const tucaHello = (): string =>L(- 'Oi, eu sou o Tuca. Eu monto os agentes do seu time. Me conta uma tarefa que você queria tirar do seu prato, com um exemplo de verdade, e eu desenho o agente certo pra ela.',+ 'Oi, eu sou o Tuca. Monto os agentes do seu time. Me conta uma tarefa que você queria tirar do prato, com um exemplo de verdade, e eu desenho o agente certo pra ela.',"Hi, I'm Tuca. I build your team's agents. Tell me about a task you'd like off your plate, with a real example, and I'll design the right agent for it.")diff --git a/src/core/wiki.ts b/src/core/wiki.tsindex bfd4ac7..af9359b 100644--- a/src/core/wiki.ts+++ b/src/core/wiki.ts@@ -9,6 +9,7 @@ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSimport { basename, join, relative, resolve, sep } from 'node:path'import { DatabaseSync } from 'node:sqlite'import { L, locale } from '../shared/lang'+import { UserError } from '../shared/errors'import type { WikiChange, WikiFinding, WikiHit, WikiImport, WikiOp, WikiPage, WikiPageInfo, WikiSource, WikiVersion } from '../shared/types'import type { ToolDef } from './gateway'@@ -20,7 +21,7 @@ const LOG = 'registro.md'const CHUNK = 1500 // characters per search chunk: a long page answers with the right partconst KIND_OTHER = () => L('Outros', 'Other')-export class WikiConflict extends Error {+export class WikiConflict extends UserError {constructor() {super(L('Essa página mudou desde que foi aberta. Recarregue e faça a mudança de novo.', 'This page changed since it was opened. Reload it and make the change again.'))}diff --git a/src/main/browser.ts b/src/main/browser.tsindex 4fd2155..d8d3cea 100644--- a/src/main/browser.ts+++ b/src/main/browser.ts@@ -3,6 +3,7 @@// between conversations. The core decides what to do; this file only drives the// page and reports back. "Assumir" shows the same window so I can log in.import { BrowserWindow, session, type WebContents } from 'electron'+import { L } from '../shared/lang'import { POINT, PICK, SNAPSHOT, TEXT } from '../shared/page'import type { BrowserOp, BrowserReply as Reply } from '../shared/types'@@ -28,10 +29,17 @@ const KEYS: Record<string, { code: string; char?: string }> = {export class Browsers {private wins = new Map<string, BrowserWindow>()private reopening = new Map<string, Promise<void>>()+ private titles = new Map<string, string>() // "Lia's browser · close the window to hand it back", from the coreprivate quitting = falseconstructor(private onShown: (agentId: string, shown: boolean) => void) {}+ // "{page} — Lia's browser · close the window to hand it back".+ private titled(agentId: string, page: string): string {+ const own = this.titles.get(agentId) ?? L('Navegador', 'Browser')+ return page ? `${page} — ${own}` : own+ }+quit(): void {this.quitting = truefor (const w of this.wins.values()) w.destroy()@@ -55,9 +63,14 @@ export class Browsers {width: W,height: H,useContentSize: true,- title: 'Navegador',+ title: L('Navegador', 'Browser'),webPreferences: { partition: this.partition(agentId), sandbox: true, contextIsolation: true, nodeIntegration: false, backgroundThrottling: false }})+ // The page's own title would hide whose browser this is and how to hand it back: it goes in front.+ win.on('page-title-updated', (e, title) => {+ e.preventDefault()+ win.setTitle(this.titled(agentId, title))+ })// New tabs open in place while the agent drives; as real windows while I do.win.webContents.setWindowOpenHandler(({ url }) => {if (win.isVisible()) return { action: 'allow', overrideBrowserWindowOptions: { webPreferences: { partition: this.partition(agentId), sandbox: true } } }@@ -114,7 +127,8 @@ export class Browsers {switch (op) {case 'show':- if (typeof args['title'] === 'string') win.setTitle(args['title'])+ if (typeof args['title'] === 'string') this.titles.set(agentId, args['title'])+ win.setTitle(this.titled(agentId, wc.getTitle()))win.show()win.focus()return here()@@ -124,7 +138,7 @@ export class Browsers {return { url: wc.getURL(), title: wc.getTitle(), shown: false }case 'open': {const url = String(args['url'] ?? '')- if (!/^https?:\/\//.test(url)) throw new Error('Só endereços http e https.')+ if (!/^https?:\/\//.test(url)) throw new Error(L('Só endereços http e https.', 'Only http and https addresses.'))await Promise.race([wc.loadURL(url).catch((e: Error) => {// A redirect or a page that changes itself aborts the first load; the page still comes.@@ -139,7 +153,7 @@ export class Browsers {return { ...(await iso<Reply>(SNAPSHOT)), shown: win.isVisible() }case 'click': {const at = typeof args['ref'] === 'number' ? await iso<{ x: number; y: number } | null>(POINT(args['ref'], false)) : { x: Number(args['x']), y: Number(args['y']) }- if (!at || !Number.isFinite(at.x) || !Number.isFinite(at.y)) throw new Error('Esse elemento não está mais na página. Leia a página de novo.')+ if (!at || !Number.isFinite(at.x) || !Number.isFinite(at.y)) throw new Error(L('Esse elemento não está mais na página. Leia a página de novo.', "That element isn't on the page anymore. Read the page again."))await wait(80) // after scrolling it into viewthis.click(wc, at.x, at.y)await this.settle(wc)@@ -149,10 +163,10 @@ export class Browsers {const ref = Number(args['ref'])const text = String(args['text'] ?? '')const at = await iso<{ x: number; y: number; select: boolean } | null>(POINT(ref, false))- if (!at) throw new Error('Esse campo não está mais na página. Leia a página de novo.')+ if (!at) throw new Error(L('Esse campo não está mais na página. Leia a página de novo.', "That field isn't on the page anymore. Read the page again."))if (at.select) {const r = await iso<true | string[]>(PICK(ref, text))- if (r !== true) throw new Error(`Essa lista não tem "${text}". As opções são: ${r.join(', ')}.`)+ if (r !== true) throw new Error(L(`Essa lista não tem "${text}". As opções são: ${r.join(', ')}.`, `That list has no "${text}". The options are: ${r.join(', ')}.`))} else {await wait(80)this.click(wc, at.x, at.y)@@ -167,7 +181,7 @@ export class Browsers {}case 'key': {const key = String(args['key'] ?? '').toLowerCase().replace(/[^a-z]/g, '')- if (!KEYS[key]) throw new Error(`Tecla desconhecida. Use uma destas: ${Object.keys(KEYS).join(', ')}.`)+ if (!KEYS[key]) throw new Error(L(`Tecla desconhecida. Use uma destas: ${Object.keys(KEYS).join(', ')}.`, `Unknown key. Use one of these: ${Object.keys(KEYS).join(', ')}.`))this.key(wc, key)await this.settle(wc)return { ...here(), frame: await this.frame(win) }diff --git a/src/main/index.ts b/src/main/index.tsindex 0a8b069..33874e6 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -62,7 +62,11 @@ function startCore(): UtilityProcess {child.on('message', (msg: CoreRequest) => handleCore(child, msg))child.on('exit', (code) => {console.error(`[main] core exited with code ${code}`)- if (core === child) core = null+ if (core !== child) return+ core = null+ // Not while quitting: the window would say so on its way out. Reloading the page+ // connects again, and connecting starts a new core.+ if (!quitting && mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send('core:down')})return child}@@ -73,7 +77,7 @@ type CoreRequest =| { type: 'open_path'; path: string }| { type: 'open_local'; path: string; how: 'open' | 'reveal' }| { type: 'wiki_dir'; path: string }- | { type: 'notify'; title: string; body: string; conversationId?: string; kind?: 'approval' | 'question' | 'done'; sound?: boolean }+ | { type: 'notify'; title: string; body: string; conversationId?: string; kind?: 'approval' | 'question' | 'done'; page?: 'skills'; sound?: boolean }| { type: 'login_item'; open: boolean }| { type: 'busy'; busy: boolean }| { type: 'lang'; lang: Lang }@@ -158,7 +162,10 @@ function stillOpen(): void {new Notification({...noteIcon(),title: L(`O ${NAME} continua aberto`, `${NAME} is still open`),- body: L('As rotinas seguem rodando. Pra voltar, use o ícone do tucano perto do relógio ou abra o Tucano de novo.', 'Routines keep running. To get back, use the toucan icon by the clock or open Tucano again.'),+ body:+ process.platform === 'win32'+ ? L('As rotinas seguem rodando. Pra voltar, use o ícone do tucano na bandeja, perto do relógio (talvez dentro da setinha ^), ou abra o Tucano de novo.', 'Routines keep running. To get back, use the toucan icon in the tray by the clock (maybe inside the little ^ arrow), or open Tucano again.')+ : L('As rotinas seguem rodando. Pra voltar, use o ícone do tucano perto do relógio ou abra o Tucano de novo.', 'Routines keep running. To get back, use the toucan icon by the clock or open Tucano again.'),silent: true}).show()}@@ -176,9 +183,25 @@ function handleCore(child: UtilityProcess, msg: CoreRequest): void {"This Linux has no keyring open (GNOME Keyring or KWallet), and Tucano doesn't keep passwords unencrypted. Open or enable KWallet, or install gnome-keyring, log in again and try once more."))- if (!safeStorage.isEncryptionAvailable()) throw new Error(L('O cofre do sistema não está disponível.', "The system's vault isn't available."))- const data =- msg.op === 'encrypt' ? safeStorage.encryptString(msg.data).toString('base64') : safeStorage.decryptString(Buffer.from(msg.data, 'base64'))+ if (!safeStorage.isEncryptionAvailable())+ throw new Error(+ process.platform === 'darwin'+ ? L('O Tucano não conseguiu usar as Chaves do macOS. Reinicie o Tucano e, se o Mac pedir, clique em Permitir.', "Tucano couldn't use the macOS Keychain. Restart Tucano and, if the Mac asks, click Allow.")+ : process.platform === 'win32'+ ? L('O Tucano não conseguiu usar a proteção de dados do Windows. Reinicie o Tucano e entre de novo na sua conta do Windows se continuar.', "Tucano couldn't use Windows data protection. Restart Tucano, and sign in to Windows again if it keeps happening.")+ : L('O Tucano não conseguiu usar o chaveiro do sistema. Reinicie o Tucano e tente de novo.', "Tucano couldn't use the system's keyring. Restart Tucano and try again.")+ )+ let data: string+ if (msg.op === 'encrypt') data = safeStorage.encryptString(msg.data).toString('base64')+ else {+ try {+ data = safeStorage.decryptString(Buffer.from(msg.data, 'base64'))+ } catch (e) {+ // Saved under another key (the system's changed, or the data came from another computer).+ console.error('[main] decrypt', e)+ throw new Error(L('Não consegui abrir as credenciais salvas (a chave do sistema mudou). Conecte de novo.', "I couldn't open the saved credentials (the system's key changed). Connect again."))+ }+ }child.postMessage({ type: 'secret-result', id: msg.id, data })} catch (e) {child.postMessage({ type: 'secret-result', id: msg.id, error: e instanceof Error ? e.message : String(e) })@@ -202,7 +225,7 @@ function handleCore(child: UtilityProcess, msg: CoreRequest): void {if (sound) chirp(sound)if (!Notification.isSupported()) returnconst n = new Notification({ title: msg.title, body: msg.body, silent: true, ...noteIcon() })- n.on('click', () => showWindow(msg.conversationId))+ n.on('click', () => showWindow(msg.conversationId, msg.page))n.show()} else if (msg.type === 'busy') {if (msg.busy && awakeBlocker === null) awakeBlocker = powerSaveBlocker.start('prevent-app-suspension')@@ -241,7 +264,7 @@ const wait = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms)// Loads the page in a hidden window with its own throwaway session (no cookies// from anything else) and captures it.async function screenshot(o: { url: string; width: number; height: number; fullPage: boolean }): Promise<Buffer> {- if (!/^https?:\/\//.test(o.url)) throw new Error('só http e https')+ if (!/^https?:\/\//.test(o.url)) throw new Error(L('Só dá pra capturar endereços http e https.', 'Only http and https addresses can be captured.'))const win = new BrowserWindow({show: false,width: o.width,@@ -251,7 +274,7 @@ async function screenshot(o: { url: string; width: number; height: number; fullP})win.webContents.setWindowOpenHandler(() => ({ action: 'deny' }))try {- await Promise.race([win.loadURL(o.url), wait(30_000).then(() => Promise.reject(new Error('a página não carregou em 30 s')))])+ await Promise.race([win.loadURL(o.url), wait(30_000).then(() => Promise.reject(new Error(L('A página não carregou em 30 s. Confira o endereço ou tente de novo.', "The page didn't load in 30 s. Check the address or try again."))))])await wait(1200) // fonts, charts and client-side renderingif (o.fullPage) {const h = Number(await win.webContents.executeJavaScript('Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)'))@@ -303,13 +326,13 @@ ipcMain.on('core:connect', (event) => {// The app's own window; agents' browsers are windows too, hidden, and never count as it.let mainWindow: BrowserWindow | null = null-function showWindow(conversationId?: string): void {+function showWindow(conversationId?: string, page?: 'skills'): void {const win = mainWindow && !mainWindow.isDestroyed() ? mainWindow : createWindow()if (win.isMinimized()) win.restore()win.show()win.focus()- if (!conversationId) return- const go = (): void => win.webContents.send('navigate', conversationId)+ if (!conversationId && !page) return+ const go = (): void => (page ? win.webContents.send('navigate-page', page) : win.webContents.send('navigate', conversationId))if (win.webContents.isLoading()) win.webContents.once('did-finish-load', go)else go()}diff --git a/src/main/updates.ts b/src/main/updates.tsindex 9c9013f..ea8034d 100644--- a/src/main/updates.ts+++ b/src/main/updates.ts@@ -5,6 +5,8 @@// latest.yml, for Windows, from the workflows that build those installers.import { app } from 'electron'import electronUpdater from 'electron-updater'+import { offline } from '../shared/errors'+import { L } from '../shared/lang'import type { UpdateState } from '../shared/types'const FIRST_CHECK_MS = 20_000 // after opening, once the app has settled@@ -24,12 +26,20 @@ export class Updates {this.updater.logger = nullthis.updater.autoDownload = truethis.updater.autoInstallOnAppQuit = true- this.updater.on('checking-for-update', () => this.set({ status: 'checking', error: undefined }))+ this.updater.on('checking-for-update', () => this.set({ status: 'checking', error: undefined, errorKind: undefined }))this.updater.on('update-not-available', () => this.set({ status: 'latest', checkedAt: Date.now() }))this.updater.on('update-available', (info) => this.set({ status: 'downloading', next: info.version, percent: 0, checkedAt: Date.now() }))this.updater.on('download-progress', (p) => this.set({ status: 'downloading', percent: Math.round(p.percent) }))this.updater.on('update-downloaded', (info) => this.set({ status: 'ready', next: info.version, percent: undefined }))- this.updater.on('error', (e) => this.set({ status: 'error', error: e instanceof Error ? e.message : String(e) }))+ // No internet just waits for the next check; anything else may need the new version by hand.+ this.updater.on('error', (e) => {+ console.error('[updates]', e)+ this.set(+ offline(e)+ ? { status: 'error', errorKind: 'offline', error: L('Sem internet pra procurar uma versão nova. Tento de novo mais tarde.', 'No internet to look for a new version. I’ll try again later.') }+ : { status: 'error', errorKind: 'other', error: L('Não consegui atualizar sozinho. Baixe a versão nova na página de versões do Tucano.', 'I couldn’t update on my own. Download the new version from Tucano’s releases page.') }+ )+ })}get(): UpdateState {diff --git a/src/preload/index.ts b/src/preload/index.tsindex 03bc220..ea4ac6b 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -16,6 +16,14 @@ contextBridge.exposeInMainWorld('tucano', {onNavigate: (cb: (conversationId: string) => void): void => {ipcRenderer.on('navigate', (_e, id: unknown) => typeof id === 'string' && cb(id))},+ // …or a screen (a skill proposal opens Skills).+ onNavigatePage: (cb: (page: 'skills') => void): void => {+ ipcRenderer.on('navigate-page', (_e, page: unknown) => page === 'skills' && cb(page))+ },+ // The core's process ended: the page says so and offers to reload, which starts a new one.+ onCoreDown: (cb: () => void): void => {+ ipcRenderer.on('core:down', () => cb())+ },// The conversation on screen: the Mac doesn't notify about the one you're reading.viewing: (conversationId: string | null): void => ipcRenderer.send('viewing', conversationId),// The app's own updates.diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 4aac7bb..84e50db 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -13,6 +13,7 @@ import { SkillsPage } from './components/Skills'import { ReportPage } from './components/Report'import { Onboarding } from './components/Onboarding'import { Dialogs } from './components/Dialogs'+import { CoreDown, Toasts } from './components/Toast'import { Icon } from './components/ui'export function App(): ReactNode {@@ -54,13 +55,21 @@ export function App(): ReactNode {return () => window.removeEventListener('keydown', keys)}, [intro, mac])- if (!view) return <div className="boot" />+ // The core may stop before the app shows: the banner says so even then.+ if (!view)+ return (+ <div className="boot">+ <CoreDown />+ </div>+ )// Dialogs too: connecting a tool from the introduction may open one (on a server).if (intro)return (<><Onboarding /><Dialogs />+ <Toasts />+ <CoreDown /></>)if (view.kind === 'tuca')@@ -68,6 +77,8 @@ export function App(): ReactNode {<><Onboarding build from={view.from} /><Dialogs />+ <Toasts />+ <CoreDown /></>)@@ -95,6 +106,8 @@ export function App(): ReactNode {</main><Dialogs /><Lightbox />+ <Toasts />+ <CoreDown /></div>)}diff --git a/src/renderer/src/components/Apps.tsx b/src/renderer/src/components/Apps.tsxindex 346a6db..1187978 100644--- a/src/renderer/src/components/Apps.tsx+++ b/src/renderer/src/components/Apps.tsx@@ -81,7 +81,7 @@ export function AppsCard({ apps, onChange }: { apps: AgentApp[]; onChange: (apps? L('Falta a permissão de Acessibilidade: libere o Tucano em Ajustes → Privacidade e Segurança → Acessibilidade.', 'The Accessibility permission is missing: allow Tucano in Settings → Privacy & Security → Accessibility.'): os === 'linux'? L('O serviço de acessibilidade do Linux (AT-SPI) não respondeu: sem ele não dá pra ler os apps.', "Linux's accessibility service (AT-SPI) didn't answer: without it the apps can't be read.")- : L('O Windows não deixou ler os apps agora.', "Windows didn't let the apps be read just now.")}+ : L('O Windows não deixou ler os apps agora. Clique em Verificar de novo em alguns segundos.', "Windows didn't let the apps be read just now. Click Check again in a few seconds.")}{os !== 'mac' && status.suggestion && <small className="apps-setup__how">{status.suggestion}</small>}</span>{os === 'mac' && (@@ -126,7 +126,7 @@ export function AppsCard({ apps, onChange }: { apps: AgentApp[]; onChange: (apps<AppPicker all={all} has={has} onPick={(n) => add(n)} onClose={() => setPicking(false)} />) : (<button className="btn btn--sm apps-add" onClick={() => setPicking(true)}>- <Icon name="plus" size={14} /> {apps.length ? L('Liberar outro app', 'Give another app') : L('Liberar um app', 'Give an app')}+ <Icon name="plus" size={14} /> {apps.length ? L('Liberar outro app', 'Allow another app') : L('Liberar um app', 'Allow an app')}</button>)}</div>@@ -143,7 +143,7 @@ function AppPicker({ all, has, onPick, onClose }: { all: InstalledApp[] | null;const tile = (a: InstalledApp): ReactNode => {const given = has(a.name)return (- <button key={a.bundleId ?? a.name} className={`app-tile ${given ? 'is-given' : ''}`} disabled={given} onClick={() => onPick(a.name)} title={given ? L('Já liberado', 'Already given') : a.name}>+ <button key={a.bundleId ?? a.name} className={`app-tile ${given ? 'is-given' : ''}`} disabled={given} onClick={() => onPick(a.name)} title={given ? L('Já liberado', 'Already allowed') : a.name}><span className="app-tile__ic"><AppIcon app={a} size={40} />{given && (diff --git a/src/renderer/src/components/Conversation.tsx b/src/renderer/src/components/Conversation.tsxindex dede962..ef77052 100644--- a/src/renderer/src/components/Conversation.tsx+++ b/src/renderer/src/components/Conversation.tsx@@ -1,4 +1,4 @@-import { L } from '../../../shared/lang'+import { L, lang, locale } from '../../../shared/lang'import { CODE_SPANS } from '../../../shared/types'import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'import Markdown, { defaultUrlTransform } from 'react-markdown'@@ -19,12 +19,14 @@ import {modelById,navigate,openDm,+ openTuca,removeRoutine,retryRun,continueRun,ACCESS_REQUEST,countedTokens,sendMessage,+ setTab,stopRun,summarizeNow,useStore,@@ -43,12 +45,58 @@ import {transcribe,voiceStatus} from '../store'+import { AgentAvatar, Icon, MeAvatar, duration, time, tokens, usd, useJustEnded } from './ui'import { canRecord, NoSound, record, type Recording } from '../voice'import { useVoice, VoicePopover } from './VoiceSetup'-import { AgentAvatar, Icon, MeAvatar, duration, time, tokens, usd } from './ui'import { ArtifactCard, BrowserCard, ServiceCard, SidePanel } from './Panel'import { when } from './Routines'import { AgentProposal } from './Tuca'+import { FoldToggle } from './Fold'++// Something exact a person may want to check (the raw error, a tool's arguments), folded until asked.+export function Details({ label, initiallyOpen = false, children }: { label: string; initiallyOpen?: boolean; children: ReactNode }): ReactNode {+ const [open, setOpen] = useState(initiallyOpen)+ return (+ <div className="note">+ <FoldToggle open={open} onToggle={() => setOpen(!open)}>+ {label}+ </FoldToggle>+ {open && children}+ </div>+ )+}++// A tool's name as words: "create_issue" → "create issue", "getPullRequest" → "get pull request".+export const toolWords = (name: string): string =>+ name+ .replace(/^mcp__[^_]+__/, '')+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')+ .replace(/[_\-.]+/g, ' ')+ .trim()+ .toLowerCase()++// An approval's arguments a person can read at a glance: the plain values, named in words.+// Nested ones stay in the exact details.+function argSummary(args: Record<string, unknown>): { shown: [string, string][]; more: boolean } {+ const plain = (v: unknown): string | undefined =>+ typeof v === 'string' ? (v.length > 160 ? `${v.slice(0, 160)}…` : v) : typeof v === 'number' || typeof v === 'boolean' ? String(v) : Array.isArray(v) && v.every((x) => typeof x === 'string' || typeof x === 'number') ? v.join(', ') : undefined+ const all = Object.entries(args).filter(([, v]) => v !== undefined && v !== null && v !== '')+ const shown = all+ .map(([k, v]): [string, string | undefined] => [toolWords(k), plain(v)])+ .filter((e): e is [string, string] => !!e[1]?.trim())+ .slice(0, 5)+ // What the glance leaves out (a long text cut, a nested value, a sixth field) is said, not hidden.+ return { shown, more: shown.length < all.length || all.some(([, v]) => typeof v === 'string' && v.length > 160) }+}++// "Vale até as 14:30." / "Good until 2:30 PM.", with the day when it isn't today.+function until(at: number): string {+ const d = new Date(at)+ const hm = d.toLocaleTimeString(locale(), lang() === 'en' ? { hour: 'numeric', minute: '2-digit' } : { hour: '2-digit', minute: '2-digit' })+ if (d.toDateString() === new Date().toDateString()) return L(`Vale até as ${hm}.`, `Good until ${hm}.`)+ const day = d.toLocaleDateString(locale(), { day: 'numeric', month: 'short' }).replace('.', '')+ return L(`Vale até ${day}, às ${hm}.`, `Good until ${day}, ${hm}.`)+}export function ConversationView({ id }: { id: string }): ReactNode {const conv = useStore((s) => s.conversations.find((c) => c.id === id))@@ -63,8 +111,23 @@ export function ConversationView({ id }: { id: string }): ReactNode {const messages = useStore((s) => s.messages.filter((m) => m.conversationId === id))const focus = useStore((s) => (s.view?.kind === 'conversation' && s.view.id === id ? s.view.message : undefined))const [showSummary, setShowSummary] = useState(false)+ const firstChannel = useStore((s) => s.conversations.find((c) => c.kind === 'channel'))- if (!conv) return <div className="empty">{L('Conversa não encontrada.', 'Conversation not found.')}</div>+ if (!conv)+ return (+ <div className="empty">+ <p>{L('Essa conversa não existe mais: pode ter sido apagada.', 'This conversation no longer exists: it may have been deleted.')}</p>+ {firstChannel ? (+ <button className="btn btn--primary btn--sm" onClick={() => navigate({ kind: 'conversation', id: firstChannel.id })}>+ {L(`Voltar pra #${firstChannel.name}`, `Back to #${firstChannel.name}`)}+ </button>+ ) : (+ <button className="btn btn--primary btn--sm" onClick={openTuca}>+ {L('Falar com o Tuca', 'Talk to Tuca')}+ </button>+ )}+ </div>+ )const dmAgent = conv.kind === 'dm' ? members[0] : undefinedreturn (@@ -105,7 +168,7 @@ export function ConversationView({ id }: { id: string }): ReactNode {{showSummary && <SummaryPanel conv={conv} messages={messages} onClose={() => setShowSummary(false)} />}<MessageList messages={messages} conversationId={id} empty={conv.kind === 'channel' && members.length === 0} focus={focus} />- <Composer conversationId={id} members={members} placeholder={dmAgent ? L(`Mensagem para ${dmAgent.name}`, `Message ${dmAgent.name}`) : L(`Mensagem em #${title}`, `Message #${title}`)} />+ <Composer conversationId={id} members={members} placeholder={dmAgent ? L(`Mensagem pra ${dmAgent.name}`, `Message ${dmAgent.name}`) : L(`Mensagem em #${title}`, `Message #${title}`)} /></section><SidePanel /></div>@@ -115,6 +178,11 @@ export function ConversationView({ id }: { id: string }): ReactNode {export function MessageList({ messages, conversationId, empty, focus }: { messages: Message[]; conversationId: string; empty?: boolean; focus?: string }): ReactNode {const ref = useRef<HTMLDivElement>(null)const stick = useRef(true)+ // In a DM, whose it is (for the empty state).+ const dmName = useStore((s) => {+ const c = s.conversations.find((x) => x.id === conversationId)+ return c?.kind === 'dm' && c.members[0] ? agentById(s, c.members[0])?.name : undefined+ })// Opened on a message (a routine's run, say): scroll to it and flash it once.useEffect(() => {@@ -159,7 +227,7 @@ export function MessageList({ messages, conversationId, empty, focus }: { messag<div className="empty"><Icon name="spark" size={22} /><p>{L('Nada por aqui ainda.', 'Nothing here yet.')}</p>- <p className="muted">{L('Mencione um agente com @ ou escreva e deixe o router decidir quem responde.', 'Mention an agent with @, or just write and let the router decide who replies.')}</p>+ <p className="muted">{dmName ? L(`Escreva o que precisa: ${dmName} sempre responde aqui.`, `Write what you need: ${dmName} always replies here.`) : L('Escreva e quem estiver no canal responde. Pra chamar alguém, use @.', 'Write and whoever is in the channel replies. To call on someone, use @.')}</p></div></div>)@@ -280,6 +348,13 @@ function MessageRow({ message, grouped }: { message: Message; grouped: boolean }{message.run?.status === 'stopped' && <div className="note">{L('Interrompido por você.', 'Stopped by you.')}</div>}{message.run?.status === 'interrupted' && <div className="note">{L('Interrompido: o app fechou no meio da resposta.', 'Interrupted: the app closed in the middle of the reply.')}</div>}{message.run?.error && <div className="note note--error">{message.run.error}</div>}+ {message.run?.errorDetail && (+ <Details label={L('Detalhes', 'Details')}>+ <div className="mono small" style={{ whiteSpace: 'pre-wrap' }}>+ {message.run.errorDetail}+ </div>+ </Details>+ )}{message.run?.status === 'paused' && (<><div className="note">{L(`Pausei: cheguei no teto desta resposta (${tokens(message.run.budget ?? 0)} tokens). Continuo de onde parei?`, `Paused: I hit this reply’s ceiling (${tokens(message.run.budget ?? 0)} tokens). Shall I pick up where I left off?`)}</div>@@ -288,11 +363,17 @@ function MessageRow({ message, grouped }: { message: Message; grouped: boolean }</button></>)}- {message.run && ['failed', 'stopped', 'interrupted', 'limit_reached'].includes(message.run.status) && (+ {/* At the limit, trying again only helps once the limit went up: until then, the way out is raising it. */}+ {message.run && (['failed', 'stopped', 'interrupted'].includes(message.run.status) || (message.run.status === 'limit_reached' && (!agent || agent.used < agent.limit))) && (<button className="btn btn--xs retry" onClick={() => retryRun(message.id)}>{L('Tentar de novo', 'Try again')}</button>)}+ {message.run?.status === 'limit_reached' && agent && agent.used >= agent.limit && (+ <button className="btn btn--xs retry" onClick={() => (setTab('agent', 'perfil'), navigate({ kind: 'agent', id: agent.id }))}>+ {L(`Aumentar o limite de ${agent.name}`, `Raise ${agent.name}’s limit`)}+ </button>+ )}{message.run?.status === 'done' && message.text.trim() && !message.run.wikiChanges?.length && <KeepInWiki messageId={message.id} />}{message.run?.receipt && <ReceiptLine receipt={message.run.receipt} />}</div>@@ -345,7 +426,7 @@ function CodeBlock({ children }: { children?: ReactNode }): ReactNode {<div className="md-code"><pre ref={ref}>{children}</pre><button- className="icon-btn icon-btn--sm md-code__copy"+ className={`icon-btn icon-btn--sm md-code__copy ${copied ? 'is-copied' : ''}`}title={L(copied ? 'Copiado' : 'Copiar', copied ? 'Copied' : 'Copy')}aria-label={L(copied ? 'Copiado' : 'Copiar código', copied ? 'Copied' : 'Copy code')}onClick={() =>@@ -507,6 +588,8 @@ function RunSteps({ message }: { message: Message }): ReactNode {const [open, setOpen] = useState(false)const working = run.status === 'working'const now = useNow(working)+ // Just finished: the pulse turns into a green check for a moment, then the chevron is back.+ const justDone = useJustEnded(working, 1600) && run.status === 'done'if (run.steps.length === 0 && !working) return nullconst total = run.steps.reduce((acc, st) => acc + (st.ms ?? 0), 0)@@ -518,15 +601,28 @@ function RunSteps({ message }: { message: Message }): ReactNode {<button className="steps__toggle" onClick={() => setOpen(!open)}>{working ? (<span className="steps__pulse" />+ ) : justDone ? (+ <span className="steps__done">+ <Icon name="check" size={12} />+ </span>) : (<span className="steps__chev"><Icon name="chevron" size={12} /></span>)}{working ? (- <span className="shimmer">{current ? `${current.label}…` : L('Pensando…', 'Thinking…')}</span>+ <span className="shimmer">+ {current+ ? `${current.label}…`+ : now - message.at > 60_000+ ? L('Ainda trabalhando: tarefas longas demoram mesmo', 'Still working: long tasks do take a while')+ : run.steps.length === 0+ ? L('Lendo o pedido…', 'Reading the request…')+ : L('Pensando…', 'Thinking…')}+ </span>) : (- <span>+ <span className="steps__summary">+ {run.status === 'done' && failed === 0 && `${L('Pronto', 'Done')} · `}{run.steps.length} {L(`passo${run.steps.length === 1 ? '' : 's'}`, `step${run.steps.length === 1 ? '' : 's'}`)}{total > 0 && ` · ${duration(total)}`}</span>@@ -606,27 +702,17 @@ export function ApprovalCard({ approval, compact }: { approval: Approval; compacconst me = useStore((s) => s.me)const [refusing, setRefusing] = useState(false)const [reason, setReason] = useState('')- const [hold, setHold] = useState(0)- const timer = useRef<number | null>(null)-- const startHold = (): void => {- const started = performance.now()- const tick = (): void => {- const p = Math.min(1, (performance.now() - started) / 1500)- setHold(p)- if (p >= 1) {- timer.current = null- decideApproval(approval.id, 'approved')- return- }- timer.current = requestAnimationFrame(tick)+ const summary = argSummary(approval.args)+ // Hold to approve: CSS fills the button in 1.5s (.is-holding); the approval goes when+ // that fill ends while still held. Letting go drains it back. Space or Enter hold too.+ const [holding, setHolding] = useState(false)+ const startHold = (): void => setHolding(true)+ const cancelHold = (): void => setHolding(false)+ const holdFilled = (e: React.TransitionEvent<HTMLButtonElement>): void => {+ if (holding && e.propertyName === 'transform' && e.pseudoElement === '::before') {+ setHolding(false)+ decideApproval(approval.id, 'approved')}- timer.current = requestAnimationFrame(tick)- }- const cancelHold = (): void => {- if (timer.current) cancelAnimationFrame(timer.current)- timer.current = null- setHold(0)}const decided = approval.state !== 'pending'@@ -673,20 +759,34 @@ export function ApprovalCard({ approval, compact }: { approval: Approval; compac</>) : (<>- {agent?.name ?? L('Agente', 'Agent')} {L('quer usar', 'wants to use')} <strong>{approval.tool.replace(/_/g, ' ')}</strong> {L('no', 'in')} {approval.connectorName}+ {agent?.name ?? L('Agente', 'Agent')} {L('quer usar', 'wants to use')} <strong>{toolWords(approval.tool)}</strong> {L('no', 'in')} {approval.connectorName}</>)}</div>{approval.why && <p className="approval__why">{approval.why}</p>}- <div className="approval__call">- <code>- {approval.connectorName} · {approval.tool}- </code>- <pre>{JSON.stringify(approval.args, null, 2)}</pre>- </div>+ {/* The title already says it all for an access request, an app or the browser. */}+ {approval.tool !== ACCESS_REQUEST && approval.connectorId !== 'apps' && approval.connectorId !== 'navegador' && summary.shown.length > 0 && (+ <div className="approval__args small">+ {summary.shown.map(([k, v], i) => (+ <p key={i}>+ <span className="muted">{k}:</span> {v}+ </p>+ ))}+ {summary.more && <p className="muted">{L('Tem mais nos detalhes exatos.', 'There’s more in the exact details.')}</p>}+ </div>+ )}+ {/* High risk: what is being approved shows in full, not behind a click. */}+ <Details label={L('Ver detalhes exatos', 'See exact details')} initiallyOpen={approval.highRisk && !decided}>+ <div className="approval__call">+ <code>+ {approval.connectorName} · {approval.tool}+ </code>+ <pre>{JSON.stringify(approval.args, null, 2)}</pre>+ </div>+ </Details><p className="approval__bound">{L('A aprovação cobre só esta chamada, com estes valores. Se mudar qualquer coisa, o agente pede de novo.', 'The approval covers only this call, with these values. If anything changes, the agent asks again.')}- {!decided && L(` Expira ${time(approval.expiresAt)}.`, ` Expires ${time(approval.expiresAt)}.`)}+ {!decided && ` ${until(approval.expiresAt)}`}</p>{decided ? (@@ -724,13 +824,16 @@ export function ApprovalCard({ approval, compact }: { approval: Approval; compac<div className="row">{approval.highRisk ? (<button- className="btn btn--primary btn--hold"+ className={`btn btn--primary btn--hold ${holding ? 'is-holding' : ''}`}onPointerDown={startHold}onPointerUp={cancelHold}onPointerLeave={cancelHold}- style={{ ['--hold' as string]: `${hold * 100}%` }}+ onKeyDown={(e) => (e.key === ' ' || e.key === 'Enter') && !e.repeat && (e.preventDefault(), startHold())}+ onKeyUp={(e) => (e.key === ' ' || e.key === 'Enter') && cancelHold()}+ onBlur={cancelHold}+ onTransitionEnd={holdFilled}>- <span>{hold > 0 ? L('Segure…', 'Hold…') : L('Segure para aprovar', 'Hold to approve')}</span>+ <span>{holding ? L('Segure…', 'Hold…') : L('Segure pra aprovar · ação de alto risco', 'Hold to approve · high-risk action')}</span></button>) : (<>@@ -738,7 +841,7 @@ export function ApprovalCard({ approval, compact }: { approval: Approval; compac{L('Aprovar', 'Approve')}</button>{approval.tool !== ACCESS_REQUEST && approval.tool !== 'abrir_pr' && approval.connectorId !== 'navegador' && approval.connectorId !== 'apps' && (- <button className="btn" title={L(`Daqui pra frente ${agent?.name ?? 'o agente'} usa ${approval.tool} no ${approval.connectorName} sem pedir. Dá pra tirar na página dele.`, `From now on ${agent?.name ?? 'the agent'} uses ${approval.tool} in ${approval.connectorName} without asking. You can take it back on its page.`)} onClick={() => decideApproval(approval.id, 'approved', undefined, true)}>+ <button className="btn" title={L(`Daqui pra frente ${agent?.name ?? 'o agente'} usa “${toolWords(approval.tool)}” no ${approval.connectorName} sem pedir. Dá pra tirar na página dele.`, `From now on ${agent?.name ?? 'the agent'} uses “${toolWords(approval.tool)}” in ${approval.connectorName} without asking. You can take it back on its page.`)} onClick={() => decideApproval(approval.id, 'approved', undefined, true)}>{L('Aprovar e sempre permitir', 'Approve and always allow')}</button>)}@@ -791,7 +894,7 @@ async function prepareImage(file: File): Promise<Attached | string> {const url = blob === file ? src : await dataUrlOf(blob)return { name: file.name || L('imagem', 'image'), mime: blob.type, data: url.slice(url.indexOf(',') + 1), url }} catch {- return L(`Não consegui abrir ${file.name}.`, `Couldn't open ${file.name}.`)+ return L(`Não deu pra abrir ${file.name}. Tente salvar de novo ou mandar outra imagem.`, `${file.name} couldn't be opened. Try saving it again or send another image.`)}}@@ -1279,7 +1382,7 @@ export function Composer({ conversationId, members, placeholder }: { conversatio}}/><span className={`composer__hint ${note ? 'composer__hint--warn' : ''}`}>- {note || (members[0]?.kind === 'tuca' ? L('Nada é criado sem você', 'Nothing is created without you') : isDm ? L('O agente sempre responde na DM', 'The agent always replies in a DM') : L('@ chama um agente · sem menção, o router decide', '@ calls an agent · without a mention, the router decides'))}+ {note || (members[0]?.kind === 'tuca' ? L('Nada é criado sem você', 'Nothing is created without you') : isDm ? L(`${members[0]?.name ?? 'O agente'} sempre responde aqui`, `${members[0]?.name ?? 'The agent'} always replies here`) : L('Quem estiver no canal responde · pra chamar alguém, use @', 'Whoever is in the channel replies · to call on someone, use @'))}</span>{working.length > 0 ? (<button className="btn btn--sm" onClick={() => working.forEach((m) => stopRun(m.id))}>diff --git a/src/renderer/src/components/Dialogs.tsx b/src/renderer/src/components/Dialogs.tsxindex 6ff07c4..d6928fc 100644--- a/src/renderer/src/components/Dialogs.tsx+++ b/src/renderer/src/components/Dialogs.tsx@@ -2,13 +2,74 @@// right-click menu. Which window is open lives in the store, so the sidebar's// menu and the channel's header open the same ones.import { L } from '../../../shared/lang'-import { useEffect, useRef, useState, type ReactNode } from 'react'+import { useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'import { agentById, archiveAgent, isTeam, openTuca, createChannel, finishConnectorAuth, getState, navigate, openDialog, openDm, renameChannel, setChannelMembers, setTopic, shortcut, useStore, type State, type View } from '../store'import { AgentAvatar, Icon, type IconName } from './ui'const message = (e: unknown): string => (e instanceof Error ? e.message.replace(/^Error invoking.*?: /, '') : String(e))export function Dialogs(): ReactNode {+ return (+ <>+ <DialogBody />+ <ConfirmHost />+ </>+ )+}++// ---------- asking before something is deleted, archived or removed ----------+// confirmDialog({ title, body, confirm, danger }) opens a small window over the app and+// resolves true when the person clicks the confirm button (named with the verb and the+// thing: “Excluir #lancamento”), false on Cancelar, Esc or a click outside. danger is for+// what can't be undone: red button, and Cancelar holds the focus so Enter doesn't destroy.+type Ask = { title: string; body?: string; confirm: string; danger?: boolean; resolve: (ok: boolean) => void }+let asking: Ask | null = null+const askListeners = new Set<() => void>()+const setAsking = (a: Ask | null): void => {+ asking = a+ askListeners.forEach((l) => l())+}++export function confirmDialog(o: { title: string; body?: string; confirm: string; danger?: boolean }): Promise<boolean> {+ asking?.resolve(false)+ return new Promise((resolve) => setAsking({ ...o, resolve }))+}++function ConfirmHost(): ReactNode {+ const ask = useSyncExternalStore(+ (l) => {+ askListeners.add(l)+ return () => askListeners.delete(l)+ },+ () => asking+ )+ if (!ask) return null+ const answer = (ok: boolean): void => {+ if (asking !== ask) return+ setAsking(null)+ ask.resolve(ok)+ }+ return (+ <Modal title={ask.title} onClose={() => answer(false)}>+ {ask.body?.split('\n\n').map((p, i) => (+ <p key={i} className="small modal__lead">+ {p}+ </p>+ ))}+ <footer className="modal__foot">+ <span className="grow" />+ <button className="btn btn--ghost btn--sm" autoFocus={ask.danger} onClick={() => answer(false)}>+ {L('Cancelar', 'Cancel')}+ </button>+ <button className={`btn btn--sm ${ask.danger ? 'btn--danger' : 'btn--primary'}`} autoFocus={!ask.danger} onClick={() => answer(true)}>+ {ask.confirm}+ </button>+ </footer>+ </Modal>+ )+}++function DialogBody(): ReactNode {const dialog = useStore((s) => s.dialog)const conv = useStore((s) => (s.dialog && 'id' in s.dialog ? s.conversations.find((c) => c.id === (s.dialog as { id: string }).id) : undefined))const close = (): void => openDialog(null)@@ -24,17 +85,45 @@ export function Dialogs(): ReactNode {return <TextDialog title={L(`Tema de #${conv.name}`, `Topic of #${conv.name}`)} label={L('Tema', 'Topic')} value={conv.topic ?? ''} hint={L('Uma linha no topo do canal dizendo pra que ele serve. Vazio, some.', 'One line at the top of the channel saying what it is for. Empty, it goes away.')} onSave={(v) => setTopic(conv.id, v)} onClose={close} allowEmpty />}+// Open windows, newest last: Esc and Tab belong to the one on top only.+const openModals: object[] = []+const FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'+function Modal({ title, onClose, children }: { title: string; onClose: () => void; children: ReactNode }): ReactNode {+ const card = useRef<HTMLDivElement>(null)+ const close = useRef(onClose)+ close.current = onCloseuseEffect(() => {- const esc = (e: KeyboardEvent): void => {- if (e.key === 'Escape') onClose()+ const me = {}+ openModals.push(me)+ const before = document.activeElement as HTMLElement | null+ if (!card.current?.contains(document.activeElement)) card.current?.querySelector<HTMLElement>(FOCUSABLE)?.focus()+ // Captured before the page's own keys, so an Esc here doesn't also close what's behind.+ const keys = (e: KeyboardEvent): void => {+ if (openModals[openModals.length - 1] !== me) return+ if (e.key === 'Escape') {+ e.stopImmediatePropagation()+ e.preventDefault()+ close.current()+ } else if (e.key === 'Tab' && card.current) {+ const all = [...card.current.querySelectorAll<HTMLElement>(FOCUSABLE)]+ if (!all.length) return+ const [first, last] = [all[0]!, all[all.length - 1]!]+ const inside = card.current.contains(document.activeElement)+ if (e.shiftKey && (document.activeElement === first || !inside)) (e.preventDefault(), last.focus())+ else if (!e.shiftKey && (document.activeElement === last || !inside)) (e.preventDefault(), first.focus())+ }}- window.addEventListener('keydown', esc)- return () => window.removeEventListener('keydown', esc)- }, [onClose])+ window.addEventListener('keydown', keys, true)+ return () => {+ window.removeEventListener('keydown', keys, true)+ openModals.splice(openModals.indexOf(me), 1)+ if (before?.isConnected) before.focus()+ }+ }, [])return (<div className="modal" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>- <div className="modal__card" role="dialog" aria-label={title}>+ <div className="modal__card" role="dialog" aria-modal="true" aria-label={title} ref={card}><header className="modal__head"><strong>{title}</strong><button className="icon-btn icon-btn--sm" title={L('Fechar', 'Close')} onClick={onClose}>@@ -58,7 +147,7 @@ function MembersDialog({ id, name, members, onClose }: { id: string; name: strinconst inRoom = picked.filter((a) => agents.some((x) => x.id === a))return (<Modal title={L(`Agentes em #${name}`, `Agents in #${name}`)} onClose={onClose}>- <p className="muted small modal__lead">{L('Quem está no canal lê a conversa e pode responder. Sem @menção, o router escolhe entre eles.', 'Whoever is in the channel reads the conversation and can reply. Without an @mention, the router picks among them.')}</p>+ <p className="muted small modal__lead">{L('Quem está no canal lê a conversa e pode responder. Pra chamar alguém específico, use @.', 'Whoever is in the channel reads the conversation and can reply. To call on someone specific, use @.')}</p><div className="member-list">{agents.map((a) => {const on = picked.includes(a.id)@@ -96,17 +185,24 @@ function MembersDialog({ id, name, members, onClose }: { id: string; name: strinfunction TextDialog(p: { title: string; label: string; value: string; hint: string; prefix?: string; allowEmpty?: boolean; onSave: (v: string) => Promise<void>; onClose: () => void }): ReactNode {const [value, setValue] = useState(p.value)const [error, setError] = useState<string | null>(null)+ // Enter on an empty name: the field shakes and goes red, instead of nothing happening.+ const [invalid, setInvalid] = useState(false)+ const [shaking, setShaking] = useState(false)const save = (): void => {- if (!p.allowEmpty && !value.trim()) return+ if (!p.allowEmpty && !value.trim()) {+ setInvalid(true)+ setShaking(true)+ return+ }p.onSave(value).then(p.onClose, (e: unknown) => setError(message(e)))}return (<Modal title={p.title} onClose={p.onClose}><label className="field"><span className="field__label">{p.label}</span>- <span className="row row--center modal__input">+ <span className={`row row--center modal__input ${invalid ? 'is-invalid' : ''} ${shaking ? 'is-shaking' : ''}`} onAnimationEnd={() => setShaking(false)}>{p.prefix && <span className="muted">{p.prefix}</span>}- <input autoFocus className="grow" value={value} onChange={(e) => setValue(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && save()} />+ <input autoFocus className="grow" value={value} onChange={(e) => (setValue(e.target.value), setInvalid(false))} onKeyDown={(e) => e.key === 'Enter' && save()} /></span><span className="hint">{p.hint}</span></label>@@ -186,7 +282,7 @@ function Archived({ onClose }: { onClose: () => void }): ReactNode {const agents = useStore((s) => s.agents.filter((a) => a.archived))return (<Modal title={L('Agentes arquivados', 'Archived agents')} onClose={onClose}>- <p className="muted small modal__lead">{L('Não respondem, não rodam rotinas e não aparecem pro router. O histórico e os recibos continuam. Reativado, o agente volta aos canais em que estava; as rotinas dele você liga de novo em Rotinas.', 'They don’t reply, don’t run routines and the router doesn’t see them. History and receipts stay. Brought back, an agent returns to the channels it was in; you turn its routines back on in Routines.')}</p>+ <p className="muted small modal__lead">{L('Não respondem, não rodam rotinas e não são escolhidos pra responder nos canais. O histórico e os recibos continuam. Reativado, o agente volta aos canais em que estava; as rotinas dele você liga de novo em Rotinas.', 'They don’t reply, don’t run routines and aren’t picked to answer in channels. History and receipts stay. Once reactivated, an agent returns to the channels it was in; you turn its routines back on in Routines.')}</p>{agents.length === 0 ? (<p className="muted small">{L('Nenhum agente arquivado.', 'No archived agents.')}</p>) : (@@ -211,7 +307,7 @@ function Archived({ onClose }: { onClose: () => void }): ReactNode {{L('Ver', 'See')}</button><button className="btn btn--sm" onClick={() => void archiveAgent(a.id, false)}>- {L('Reativar', 'Bring back')}+ {L('Reativar', 'Reactivate')}</button></div>))}@@ -270,13 +366,13 @@ function Search({ onClose }: { onClose: () => void }): ReactNode {}return (<div className="modal modal--top" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>- <div className="search" role="dialog" aria-label={L('Ir para', 'Go to')}>+ <div className="search" role="dialog" aria-label={L('Ir pra', 'Go to')}><div className="search__input"><Icon name="spark" size={16} /><inputautoFocusvalue={q}- placeholder={L('Ir para um canal, agente ou tela…', 'Go to a channel, agent or page…')}+ placeholder={L('Ir pra um canal, agente ou tela…', 'Go to a channel, agent or page…')}onChange={(e) => {setQ(e.target.value)setAt(0)diff --git a/src/renderer/src/components/Harness.tsx b/src/renderer/src/components/Harness.tsxindex 8103a37..8c05c9d 100644--- a/src/renderer/src/components/Harness.tsx+++ b/src/renderer/src/components/Harness.tsx@@ -21,8 +21,10 @@ import {installEngine,loginEngine,modelInfo,+ navigate,openExternal,rememberModels,+ setTab,testEngine,updateSettings,useStore,@@ -104,7 +106,15 @@ export function ModelPicker({ value, onChange, engines, jev }: { value: string;// A harness's own card passes just that harness: it's already chosen there, so no select.const fixed = engines?.length === 1 && !jev- if (!engine && !jev) return <p className="hint hint--warn">{L('Nenhum harness pronto. Veja em Configurações → Modelos.', 'No harness ready. See Settings → Models.')}</p>+ if (!engine && !jev)+ return (+ <p className="hint hint--warn">+ {L('Nenhum Claude Code ou Codex pronto ainda.', 'No Claude Code or Codex ready yet.')}{' '}+ <button className="link" onClick={() => (setTab('settings', 'modelos'), navigate({ kind: 'settings' }))}>+ {L('Configurar', 'Set up')}+ </button>+ </p>+ )return (<div className="model-picker">{!fixed && (@@ -257,7 +267,7 @@ function HarnessRow({ engine, st, picked, toggle }: { engine: EngineId; st: Engi</div>{manual && !st.loggedIn && (<div className="harness__body">- <span className="hint">{L('Não achei um terminal pra abrir. Pra entrar, cole no seu terminal:', "Couldn't find a terminal to open. To sign in, paste in your terminal:")}</span>+ <span className="hint">{L('Não deu pra abrir um terminal daqui. Pra entrar, cole isto no seu terminal:', "A terminal couldn't be opened from here. To sign in, paste this in your terminal:")}</span><code className="harness__cmd">{manual}</code></div>)}@@ -279,7 +289,7 @@ function HarnessRow({ engine, st, picked, toggle }: { engine: EngineId; st: Engi)}{st.warning && <p className="hint hint--warn harness__body">{st.warning}</p>}{st.route === 'gateway' && picked && <p className="hint harness__body">{L(`Os agentes usam esse mesmo gateway. A telemetria do ${ENGINES[engine].label} fica desligada, pra nada sair por fora dele.`, `Agents use this same gateway. ${ENGINES[engine].label}'s telemetry stays off, so nothing leaves around it.`)}</p>}- {st.soon && st.installed && <p className="hint harness__body">{L(`Já achei a sua configuração. O Tucano ainda não roda agentes no ${ENGINES[engine].label}: chega numa próxima versão.`, `Found your setup. Tucano doesn't run agents on ${ENGINES[engine].label} yet: it's coming in a future version.`)}</p>}+ {st.soon && st.installed && <p className="hint harness__body">{L(`A sua configuração já foi encontrada. O Tucano ainda não roda agentes no ${ENGINES[engine].label}: chega numa próxima versão.`, `Your setup was found. Tucano doesn't run agents on ${ENGINES[engine].label} yet: it's coming in a future version.`)}</p>}{testing && (<div className="harness__body"><div className="harness__test">@@ -341,7 +351,7 @@ export function HarnessMcps({ onAdded }: { onAdded: (id: string) => void }): Reareturn (<section className="card from-harness"><div className="from-harness__head">- <strong>{L('Nos seus harnesses', 'In your harnesses')}</strong>+ <strong>{L('No Claude Code, Codex e outros que você usa', 'In Claude Code, Codex and others you use')}</strong><span className="muted small">{L('Os servidores MCP que você já configurou. Ao adicionar, os agentes passam a usar pelo Tucano, com as permissões e aprovações daqui.', 'The MCP servers you already set up. Once added, agents use them through Tucano, with the permissions and approvals set here.')}</span></div>{found.map((m) => (@@ -400,7 +410,7 @@ export function AccountsCard(): ReactNode {</p>{manual[a.id] && !a.loggedIn && (<>- <span className="hint">{L('Não achei um terminal pra abrir. Pra entrar, cole no seu terminal:', "Couldn't find a terminal to open. To sign in, paste in your terminal:")}</span>+ <span className="hint">{L('Não deu pra abrir um terminal daqui. Pra entrar, cole isto no seu terminal:', "A terminal couldn't be opened from here. To sign in, paste this in your terminal:")}</span><code className="harness__cmd">{manual[a.id]}</code></>)}@@ -434,7 +444,14 @@ export function AccountsCard(): ReactNode {{L('Adicionar e entrar', 'Add and sign in')}</button></div>- {removing && <p className="hint hint--warn">{L('Os agentes dessa conta voltam pro login de sempre do harness, e o login dela sai deste computador.', 'Its agents go back to the harness’s usual login, and its sign-in leaves this computer.')}</p>}+ {removing && (+ <p className="hint hint--warn">+ {L(+ `Os agentes dessa conta voltam pro login de sempre do ${ENGINES[accounts.find((a) => a.id === removing)?.engine ?? 'claude'].label}, e o login dela sai deste computador.`,+ `Its agents go back to ${ENGINES[accounts.find((a) => a.id === removing)?.engine ?? 'claude'].label}’s usual login, and its sign-in leaves this computer.`+ )}+ </p>+ )}</div>)}diff --git a/src/renderer/src/components/Onboarding.tsx b/src/renderer/src/components/Onboarding.tsxindex 90c5130..b2d534b 100644--- a/src/renderer/src/components/Onboarding.tsx+++ b/src/renderer/src/components/Onboarding.tsx@@ -45,7 +45,7 @@ import { ColorPicker, JevKey, LanguagePicker, LookPicker, ModelSelect, Toggle }import { Splash } from './Splash'import { Composer, MessageList } from './Conversation'import { draftAgent, UseDraft } from './Tuca'-import { AgentAvatar, Icon, MeAvatar, type IconName } from './ui'+import { AgentAvatar, Icon, MeAvatar, TucaMark, type IconName } from './ui'type Computer = 'none' | 'linux' | 'mac'@@ -198,7 +198,13 @@ export function Onboarding({ build = false, from }: { build?: boolean; from?: Viconst models = readyModels(settings.engines)const ready = usableEngines(settings)const at = steps.indexOf(step)- const go = (s: Step): void => setStep(s)+ // Which way the next step slides in: forward from the right, back from the left.+ const [dir, setDir] = useState<'next' | 'back'>('next')+ const [cheer, setCheer] = useState(false)+ const go = (s: Step): void => {+ setDir(steps.indexOf(s) < at ? 'back' : 'next')+ setStep(s)+ }const next = (): void => go(steps[at + 1]!)const back = (): void => go(steps[at - 1]!)const patch = (p: Partial<Agent>): void => setAgent((a) => ({ ...a, ...p }))@@ -269,6 +275,11 @@ export function Onboarding({ build = false, from }: { build?: boolean; from?: Viawait saveAgent(a, [channelId])if (fromTuca) settleDraft(fromTuca.messageId, a.id) // his card shows it was createdawait Promise.all(skills.map((source) => linkSkill(source).catch(() => undefined))) // for every agent; who uses each changes in Skills+ // A beat for the Tuca to cheer before the channel opens (none with reduced motion).+ if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {+ setCheer(true)+ await new Promise((done) => setTimeout(done, 650))+ }updateSettings({ workspaceName: name.trim() || settings.workspaceName, context: context.trim(), routerModel, memoryModel, onboarding: { done: true } })navigate({ kind: 'conversation', id: channelId })sendMessage(channelId, `@${a.handle} ${task.trim()}`)@@ -295,7 +306,7 @@ export function Onboarding({ build = false, from }: { build?: boolean; from?: Vi<div className="onb__scroll"><BuildMode.Provider value={build}>- <div className="onb__stage" key={step}>+ <div className="onb__stage" key={step} data-dir={dir}>{step === 'welcome' && <Welcome name={name} setName={setName} onNext={next} />}{step === 'engine' && <Harnesses ready={ready.length > 0} onBack={back} onNext={next} />}{step === 'models' && <Models ready={ready} router={routerModel} setRouter={setRouterModel} memory={memoryModel} setMemory={setMemoryModel} onBack={back} onNext={next} />}@@ -313,6 +324,11 @@ export function Onboarding({ build = false, from }: { build?: boolean; from?: Vi</div></BuildMode.Provider></div>+ {cheer && (+ <div className="onb-cheer" aria-hidden>+ <TucaMark size={96} happy />+ </div>+ )}</div>)}@@ -345,14 +361,14 @@ function Welcome({ name, setName, onNext }: { name: string; setName: (v: string)<h1>{L('Um time de agentes de IA, trabalhando no seu computador.', 'A team of AI agents, working on your computer.')}</h1><p className="onb__lead">{L('Você conversa com eles em canais, como num chat do trabalho. Eles pesquisam, escrevem, programam e usam as suas ferramentas, e você decide até onde cada um vai.', 'You talk to them in channels, like a work chat. They research, write, code and use your tools, and you decide how far each one goes.')}</p><ul className="onb__points">- <Point icon="zap" title={L('No harness que você já usa', 'On the harness you already use')}>+ <Point icon="zap" title={L('Nos programas que você já usa', 'In the tools you already use')}>{L('Claude Code, Codex, OpenCode ou Pi, como você configurou: no seu plano, no gateway da empresa ou nos seus provedores.', 'Claude Code, Codex, OpenCode or Pi, the way you set them up: on your plan, your company’s gateway or your providers.')}</Point><Point icon="shield" title={L('Você no controle', 'You’re in control')}>{L('Cada agente só usa o que você liberar. Comprar, publicar, enviar e apagar sempre esperam o seu ok.', 'Each agent only uses what you allow. Buying, publishing, sending and deleting always wait for your OK.')}</Point><Point icon="lock" title={L('Tudo fica aqui', 'Everything stays here')}>- {L('Conversas, memória e logins ficam no seu computador. Nada passa por servidor nosso.', 'Conversations, memory and logins stay on your computer. Nothing goes through a server of ours.')}+ {L('Conversas, memória e logins ficam no seu computador. Nada passa por um servidor do Tucano.', 'Conversations, memory and logins stay on your computer. Nothing goes through a Tucano server.')}</Point></ul><label className="onb__field">@@ -437,13 +453,13 @@ function Harnesses({ ready, onBack, onNext }: { ready: boolean; onBack: () => voreturn (<div className="onb__split"><section className="onb__main">- <span className="onb__kicker">{L('Passo 1 · Os harnesses', 'Step 1 · The harnesses')}</span>- <h1>{L('Quais harnesses seus agentes vão usar?', 'Which harnesses will your agents use?')}</h1>- <p className="onb__lead">{L('Os agentes rodam nos programas que já estão no seu computador, do jeito que você configurou cada um. O Tucano só lê essa configuração: nunca vê nem guarda as suas senhas e chaves.', 'The agents run on the programs already on your computer, the way you set up each one. Tucano only reads that setup: it never sees or stores your passwords and keys.')}</p>+ <span className="onb__kicker">{L('Passo 1 · Onde rodam', 'Step 1 · Where they run')}</span>+ <h1>{L('Onde seus agentes vão rodar?', 'Where will your agents run?')}</h1>+ <p className="onb__lead">{L('No Claude Code, no Codex ou em outro que você já usa, do jeito que configurou cada um. O Tucano só lê essa configuração: nunca vê nem guarda as suas senhas e chaves.', 'In Claude Code, Codex or another one you already use, the way you set up each. Tucano only reads that setup: it never sees or stores your passwords and keys.')}</p><HarnessList />{!ready && (<p className="onb__wait">- <span className="pulse" /> {L('Esperando um deles ficar pronto…', 'Waiting for one of them to be ready…')}+ <span className="pulse" /> {L('Entre em um deles (no terminal que abriu) e eu sigo sozinho.', 'Sign in to one of them (in the terminal that opened) and I’ll move on.')}</p>)}<Nav onBack={onBack} onNext={onNext} disabled={!ready} />@@ -453,7 +469,7 @@ function Harnesses({ ready, onBack, onNext }: { ready: boolean; onBack: () => vo<Icon name="zap" size={16} /><div><p>- <strong>{L('O que eu leio de cada um', 'What I read from each one')}</strong>+ <strong>{L('O que o Tucano lê de cada um', 'What Tucano reads from each one')}</strong></p><ul className="harness__guide"><li>@@ -484,7 +500,7 @@ function Models(p: { ready: EngineId[]; router: string; setRouter: (v: string) =<h1>{L('Quem decide e quem lembra.', 'Who decides and who remembers.')}</h1><p className="onb__lead">{L('Dois trabalhos pequenos rodam o tempo todo, fora dos agentes. Escolha um modelo rápido pra cada um; dá pra trocar depois em Configurações.', 'Two small jobs run all the time, outside the agents. Pick a fast model for each; you can change them later in Settings.')}</p><p className="onb-note">- <Icon name="zap" size={14} /> {L('Primeiro o harness, depois o modelo da lista dele. Se o seu não aparece, escolha', 'First the harness, then a model from its list. If yours isn’t there, pick')} <b>{L('Outro modelo…', 'Other model…')}</b> {L('e digite o nome.', 'and type its name.')}+ <Icon name="zap" size={14} /> {L('Primeiro o programa (Claude Code, Codex…), depois o modelo da lista dele. Se o seu não aparece, escolha', 'First the tool (Claude Code, Codex…), then a model from its list. If yours isn’t there, pick')} <b>{L('Outro modelo…', 'Other model…')}</b> {L('e digite o nome.', 'and type its name.')}</p><div className="onb-pair"><div className="onb-pick">@@ -524,7 +540,7 @@ const STATUS = (): Record<string, { label: string; tone: string }> => ({connected: { label: L('conectado', 'connected'), tone: 'tag--ok' },connecting: { label: L('conectando…', 'connecting…'), tone: '' },needs_auth: { label: L('precisa autorizar', 'needs authorization'), tone: 'tag--warn' },- error: { label: L('erro', 'error'), tone: 'tag--danger' },+ error: { label: L('não conectou', 'didn’t connect'), tone: 'tag--danger' },disconnected: { label: L('desconectado', 'disconnected'), tone: 'tag--warn' }})@@ -654,13 +670,13 @@ function SkillsStep({ picked, setPicked, onBack, onNext }: { picked: string[]; s// ---------- 3. you -----------const ABOUT_EXAMPLES = (): string[] => (lang() === 'en' ? ['I’m a developer working on…', 'I run an online store that sells…', 'I’m studying for…', 'I prefer short, direct answers.'] : ['Sou dev e trabalho com…', 'Tenho uma loja online de…', 'Estudo para…', 'Prefiro respostas curtas e diretas.'])+const ABOUT_EXAMPLES = (): string[] => (lang() === 'en' ? ['I’m a developer working on…', 'I run an online store that sells…', 'I’m studying for…', 'I prefer short, direct answers.'] : ['Sou dev e trabalho com…', 'Tenho uma loja online de…', 'Estudo pra…', 'Prefiro respostas curtas e diretas.'])function You({ name, context, setContext, onBack, onNext }: { name: string; context: string; setContext: (v: string) => void; onBack: () => void; onNext: () => void }): ReactNode {return (<section className="onb__main"><span className="onb__kicker">{L('Passo 3 · Você', 'Step 3 · You')}</span>- <h1>{name.trim() ? L(`${name.trim().split(' ')[0]}, conta um pouco sobre você.`, `${name.trim().split(' ')[0]}, tell us a bit about yourself.`) : L('Conta um pouco sobre você.', 'Tell us a bit about yourself.')}</h1>+ <h1>{name.trim() ? L(`${name.trim().split(' ')[0]}, conta um pouco sobre você.`, `${name.trim().split(' ')[0]}, tell me a bit about yourself.`) : L('Conta um pouco sobre você.', 'Tell me a bit about yourself.')}</h1><p className="onb__lead">{L('Todo agente lê isso antes de cada resposta, então ninguém precisa te perguntar de novo. Seu trabalho, seus projetos, como você gosta das respostas.', 'Every agent reads this before each reply, so nobody has to ask you again. Your work, your projects, how you like your answers.')}</p><textareaclassName="onb__textarea"@@ -743,8 +759,8 @@ function MeetTuca({ conv: session, onUse, onManual, onBack }: { conv: { id?: str<h1>{L('Conte pro Tuca o que você quer delegar', 'Tell Tuca what you want to delegate')}</h1><p className="onb__lead">{build- ? L('Ele faz duas ou três perguntas e propõe um agente. Nada é criado sem você.', 'It asks two or three questions and proposes an agent. Nothing is created without you.')- : L('O Tuca monta os agentes do seu time. Ele faz duas ou três perguntas e propõe um; nada é criado sem você. Depois ele fica na barra lateral pra montar os próximos.', 'Tuca builds your team’s agents. It asks two or three questions and proposes one; nothing is created without you. Then it stays in the sidebar to build the next ones.')}+ ? L('Ele faz duas ou três perguntas e propõe um agente. Nada é criado sem você.', 'He asks two or three questions and proposes an agent. Nothing is created without you.')+ : L('O Tuca monta os agentes do seu time. Ele faz duas ou três perguntas e propõe um; nada é criado sem você. Depois ele fica na barra lateral pra montar os próximos.', 'Tuca builds your team’s agents. He asks two or three questions and proposes one; nothing is created without you. Then he stays in the sidebar to build the next ones.')}</p><div className="onb__field onb__field--tuca-model"><span>{L('Modelo do Tuca', 'Tuca’s model')}</span>@@ -789,7 +805,7 @@ function MeetTuca({ conv: session, onUse, onManual, onBack }: { conv: { id?: str{tuca && <AgentAvatar agent={tuca} size={64} />}<h2>Tuca</h2><span className="muted">{L('Monta agentes', 'Builds agents')}</span>- <p className="muted small">{L('A proposta dele aparece aqui: nome, o que faz, modelo e o que pode acessar.', 'Its proposal shows up here: name, what it does, model and what it can access.')}</p>+ <p className="muted small">{L('A proposta dele aparece aqui: nome, o que faz, modelo e o que pode acessar.', 'His proposal shows up here: name, what it does, model and what it can access.')}</p></div>)}</aside>@@ -813,7 +829,7 @@ function MakeAgent(p: {<section className="onb__main"><span className="onb__kicker">{useContext(BuildMode) ? L('Novo agente', 'New agent') : L('Passo 6 · Seu primeiro agente', 'Step 6 · Your first agent')}</span><h1>{L('Quem vai trabalhar com você?', 'Who’s going to work with you?')}</h1>- <p className="onb__lead">{L('Comece por um modelo e ajuste o que quiser. Depois você monta o resto do time.', 'Start from a template and adjust anything. You build the rest of the team later.')}</p>+ <p className="onb__lead">{L('Comece por um dos exemplos e ajuste o que quiser. Depois você monta o resto do time.', 'Start from one of the examples and adjust anything. You build the rest of the team later.')}</p><div className="onb-templates">{TEMPLATES().map((t) => (<button key={t.id} className={`onb-template ${p.template.id === t.id ? 'is-active' : ''}`} onClick={() => p.pick(t)}>@@ -831,7 +847,7 @@ function MakeAgent(p: {<input value={agent.name} placeholder={L('Ex.: Iris', 'E.g. Iris')} onChange={(e) => patch({ name: e.target.value })} /></label><label className="onb__field">- <span>{L('Função', 'Role')}</span>+ <span>{L('Papel', 'Role')}</span><input value={agent.role} placeholder={L('Ex.: Pesquisa', 'E.g. Research')} onChange={(e) => patch({ role: e.target.value })} /></label></div>@@ -967,7 +983,7 @@ function Powers(p: {{computer === 'linux' && <p className="hint">{L('Um computador só dele, separado do seu. Instala e roda o que precisar sem pedir. Precisa do Docker rodando.', 'A computer of its own, apart from yours. It installs and runs what it needs without asking. Needs Docker running.')}</p>}{computer === 'mac' && (<p className="hint hint--warn">- <Icon name="lock" size={13} /> {L(`${agent.name.trim() || 'O agente'} roda comandos no seu computador como se fosse você, com tudo o que você tem instalado. Escolha só se confia nessa função.`, `${agent.name.trim() || 'The agent'} runs commands on your computer as if it were you, with everything you have installed. Only choose this if you trust that role.`)}+ <Icon name="lock" size={13} /> {L(`${agent.name.trim() || 'O agente'} roda comandos no seu computador como se fosse você, com tudo o que você tem instalado. Escolha só se confia nesse papel.`, `${agent.name.trim() || 'The agent'} runs commands on your computer as if it were you, with everything you have installed. Only choose this if you trust that role.`)}</p>)}</div>@@ -1096,7 +1112,7 @@ const firstChannel = (s: State): View => {}const ITEMS = (): Item[] => [- { id: 'agent', title: L('Criar seu primeiro agente', 'Create your first agent'), how: L('Feito na introdução.', 'Done in the introduction.'), done: (s) => s.agents.some(isTeam), go: () => ({ kind: 'tuca' }), action: L('Criar', 'Create') },+ { id: 'agent', title: L('Criar seu primeiro agente', 'Create your first agent'), how: L('Converse com o Tuca e ele monta um pra você.', 'Chat with Tuca and he builds one for you.'), done: (s) => s.agents.some(isTeam), go: () => ({ kind: 'tuca' }), action: L('Criar', 'Create') },{id: 'reply',title: L('Ver um agente trabalhando', 'Watch an agent work'),@@ -1217,7 +1233,7 @@ export function GettingStarted(): ReactNode {</span></span><span className="getting__track">- <span style={{ width: `${(count / items.length) * 100}%` }} />+ <span style={{ transform: `scaleX(${count / items.length})` }} /></span></button></div>diff --git a/src/renderer/src/components/Pages.tsx b/src/renderer/src/components/Pages.tsxindex 572dc33..072884e 100644--- a/src/renderer/src/components/Pages.tsx+++ b/src/renderer/src/components/Pages.tsx@@ -68,7 +68,8 @@ import { voiceRefusal } from '../../../shared/voice'import { useVoice, VOICE_CHOICES, VoiceSetup } from './VoiceSetup'import { AccountPicker, AccountsCard, HarnessList, HarnessMcps, ModelPicker, onGateway, OutsideGateway, usableEngines } from './Harness'import { AppsCard } from './Apps'-import { ApprovalCard } from './Conversation'+import { ApprovalCard, toolWords } from './Conversation'+import { confirmDialog } from './Dialogs'import { AgentAvatar, AVATARS, Icon, NumberInput, SleepingToucan, time, tokens, UsageBar } from './ui'import { UpdateSettings } from './Update'import exportSkill from '../assets/tucano-export-skill.md?raw'@@ -201,7 +202,7 @@ export function LookPicker({ agent, patch }: { agent: Pick<Agent, 'name' | 'coloonChange={(e) => {const file = e.target.files?.[0]e.target.value = ''- if (file) pictureFrom(file).then((picture) => (setError(''), patch({ picture, avatar: undefined })), () => setError(L('Não consegui abrir essa imagem.', "I couldn't open that image.")))+ if (file) pictureFrom(file).then((picture) => (setError(''), patch({ picture, avatar: undefined })), () => setError(L('Essa imagem não abriu. Tente outra, em PNG ou JPG.', "That image didn't open. Try another one, in PNG or JPG.")))}}/></label>@@ -300,10 +301,16 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d{!isNew && !archived && (<buttonclassName="btn btn--ghost"- title={L('Tira da barra lateral e para de responder; dá pra reativar', 'Takes it out of the sidebar and it stops replying; you can bring it back')}- onClick={() => {- if (confirm(L(`Arquivar ${draft.name}?\n\nSai da barra lateral e para de responder; as rotinas dele desligam. O histórico e os recibos ficam, e dá pra reativar em "Arquivados", no fim da lista de agentes.`, `Archive ${draft.name}?\n\nIt leaves the sidebar and stops replying; its routines turn off. History and receipts stay, and you can bring it back from "Archived", at the end of the agent list.`))) void archiveAgent(draft.id, true)- }}+ title={L('Tira da barra lateral e para de responder; dá pra reativar', 'Takes it out of the sidebar and it stops replying; you can reactivate it')}+ onClick={() =>+ void confirmDialog({+ title: L(`Arquivar ${draft.name}?`, `Archive ${draft.name}?`),+ body: L('Sai da barra lateral e para de responder; as rotinas dele desligam. O histórico e os recibos ficam, e dá pra reativar em "Arquivados", no fim da lista de agentes.', 'It leaves the sidebar and stops replying; its routines turn off. History and receipts stay, and you can reactivate it from "Archived", at the end of the agent list.'),+ confirm: L(`Arquivar ${draft.name}`, `Archive ${draft.name}`)+ }).then((ok) => {+ if (ok) void archiveAgent(draft.id, true)+ })+ }>{L('Arquivar', 'Archive')}</button>@@ -317,12 +324,12 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d>{archived && (<div className="archived-banner">- <Icon name="layers" size={15} />+ <Icon name="archive" size={15} /><span className="grow">- <strong>{L(`${draft.name} está arquivado.`, `${draft.name} is archived.`)}</strong> {L('Não responde, não roda rotinas e não aparece pro router.', 'It doesn’t reply, doesn’t run routines and the router doesn’t see it.')}+ <strong>{L(`${draft.name} está arquivado.`, `${draft.name} is archived.`)}</strong> {L('Não responde, não roda rotinas e não é escolhido pra responder nos canais.', 'It doesn’t reply, doesn’t run routines and isn’t picked to answer in channels.')}</span><button className="btn btn--sm btn--primary" onClick={() => void archiveAgent(draft.id, false)}>- {L('Reativar', 'Bring back')}+ {L('Reativar', 'Reactivate')}</button></div>)}@@ -344,7 +351,7 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d/></Field></div>- <Field label={L('Papel', 'Role')} hint={L('Uma linha. O router usa isso pra decidir quem responde.', 'One line. The router uses it to decide who replies.')}>+ <Field label={L('Papel', 'Role')} hint={L('Uma linha. Ajuda a decidir quem responde nos canais.', 'One line. It helps decide who replies in channels.')}><input value={draft.role} placeholder={L('Ex.: Engenharia', 'E.g. Engineering')} onChange={(e) => patch({ role: e.target.value })} /></Field><Field label={L('Cor', 'Color')}>@@ -458,7 +465,7 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d})}</div><p className="hint">- <Icon name="shield" size={13} /> {L('Ferramentas sensíveis (merge, deploy, apagar, enviar) viram pedido de aprovação no chat, a não ser as que você marcou como "sempre permitir".', 'Sensitive tools (merge, deploy, delete, send) become an approval request in the chat, except the ones you marked as "always allow".')}+ <Icon name="shield" size={13} /> {L('Ferramentas sensíveis (publicar código, colocar no ar, apagar, enviar algo pra fora) viram pedido de aprovação no chat, a não ser as que você marcou como "sempre permitir".', 'Sensitive tools (publishing code, putting things live, deleting, sending something out) become an approval request in the chat, except the ones you marked as "always allow".')}</p>{!isNew && (draft.autoApprove?.length ?? 0) > 0 && (<div className="always">@@ -467,7 +474,7 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; dconst [cid, tool] = rule.split(':')return (<span key={rule} className="chip is-on always__rule">- {connectors.find((c) => c.id === cid)?.name ?? L('conector', 'connector')} · {tool}+ {connectors.find((c) => c.id === cid)?.name ?? L('conector', 'connector')} · {toolWords(tool ?? '')}<buttonclassName="always__x"title={L('Voltar a pedir aprovação', 'Ask for approval again')}@@ -530,7 +537,14 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d</button><buttonclassName="btn btn--sm btn--ghost"- onClick={() => confirm(L(`Apagar os logins, cookies e histórico do navegador de ${draft.name}?`, `Delete the logins, cookies and history of ${draft.name}'s browser?`)) && browserAction(draft.id, 'clear')}+ onClick={() =>+ void confirmDialog({+ title: L(`Apagar os logins do navegador de ${draft.name}?`, `Delete the logins in ${draft.name}'s browser?`),+ body: L(`Saem os logins, os cookies e o histórico. ${draft.name} vai precisar que você entre de novo nas contas (pelo Assumir).`, `Logins, cookies and history go. ${draft.name} will need you to sign in to the accounts again (via Take over).`),+ confirm: L('Apagar logins', 'Delete logins'),+ danger: true+ }).then((ok) => ok && browserAction(draft.id, 'clear'))+ }>{L('Apagar logins', 'Delete logins')}</button>@@ -628,20 +642,27 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d)}{pane('perfil') && (- <Card title={L('Harness e modelo', 'Harness and model')} lead={L('O agente roda num dos harnesses que você usa, como você o configurou: no seu plano, no gateway da empresa ou no seu provedor.', 'The agent runs on one of the harnesses you use, the way you set it up: on your plan, your company’s gateway or your provider.')}>+ <Card title={L('Onde roda e modelo', 'Where it runs and model')} lead={L('O agente roda no Claude Code, no Codex ou em outro que você já usa, do jeito que você configurou: no seu plano, no gateway da empresa ou no seu provedor.', 'The agent runs in Claude Code, Codex or another one you already use, the way you set it up: on your plan, your company’s gateway or your provider.')}><ModelPicker value={draft.modelId} onChange={(modelId) => patch({ modelId })} /><AccountPicker draft={draft} patch={patch} /><ReserveModel draft={draft} patch={patch} />{!engineStatus.loggedIn && !draft.accountId && (<p className="hint hint--warn"><Icon name="lock" size={13} />{' '}- {L(- `O ${ENGINES[engine].label} ${engineStatus.off ? 'está desligado nos harnesses' : engineStatus.soon ? 'ainda não roda agentes' : 'não está pronto'}: ${draft.name || 'o agente'} não responde até você trocar o modelo ou resolver.`,- `${ENGINES[engine].label} ${engineStatus.off ? 'is off in the harnesses' : engineStatus.soon ? 'doesn’t run agents yet' : 'isn’t ready'}: ${draft.name || 'the agent'} won’t reply until you change the model or fix it.`- )}{' '}- <button className="link" onClick={() => navigate({ kind: 'settings' })}>- {L('Configurações', 'Settings')}- </button>+ {engineStatus.soon+ ? L(+ `O ${ENGINES[engine].label} ainda não roda agentes: troque o modelo pra ${draft.name || 'o agente'} responder.`,+ `${ENGINES[engine].label} doesn’t run agents yet: change the model so ${draft.name || 'the agent'} can reply.`+ )+ : L(+ `O ${ENGINES[engine].label} ${engineStatus.off ? 'está desligado' : 'não está pronto'}: ${draft.name || 'o agente'} não responde até você ${engineStatus.off ? 'ligar o' : 'entrar no'} ${ENGINES[engine].label} (Configurações → Modelos) ou trocar o modelo.`,+ `${ENGINES[engine].label} ${engineStatus.off ? 'is off' : 'isn’t ready'}: ${draft.name || 'the agent'} won’t reply until you ${engineStatus.off ? 'turn on' : 'sign in to'} ${ENGINES[engine].label} (Settings → Models) or change the model.`+ )}{' '}+ {!engineStatus.soon && (+ <button className="link" onClick={() => (setTab('settings', 'modelos'), navigate({ kind: 'settings' }))}>+ {L('Abrir Modelos', 'Open Models')}+ </button>+ )}</p>)}<div className="grid2">@@ -725,8 +746,8 @@ const COMPUTER_STATE = (): Record<string, { label: string; tone: string }> => ({stopped: { label: L('parado', 'stopped'), tone: 'tag--warn' },starting: { label: L('ligando', 'starting'), tone: 'tag--warn' },running: { label: L('ligado', 'running'), tone: 'tag--ok' },- no_docker: { label: L('sem Docker', 'no Docker'), tone: 'tag--danger' },- error: { label: L('com problema', 'having trouble'), tone: 'tag--danger' }+ no_docker: { label: L('sem Docker', 'no Docker'), tone: 'tag--warn' },+ error: { label: L('não ligou', 'didn’t start'), tone: 'tag--danger' }})type ComputerChoice = 'none' | 'linux' | 'mac'@@ -782,13 +803,13 @@ function ComputerCard({ agentId, kind, onChange }: { agentId: string; kind: Comp</p><p className="muted small">{L(- 'Continua valendo: cada comando aparece no chat, as travas de loop e de teto seguem, e as chaves do app (GitHub, Telegram, conectores) não vão junto. Os comandos começam na pasta dele. Dá pra voltar pro Linux ou desligar quando quiser.',- 'Still true: every command shows up in the chat, the loop and ceiling guards still apply, and the app’s keys (GitHub, Telegram, connectors) don’t come along. Commands start in its folder. You can go back to Linux or turn it off any time.'+ 'Continua valendo: cada comando aparece no chat, as travas de loop e de limite seguem, e as chaves do app (GitHub, Telegram, conectores) não vão junto. Os comandos começam na pasta dele. Dá pra voltar pro Linux ou desligar quando quiser.',+ 'Still true: every command shows up in the chat, the loop and limit guards still apply, and the app’s keys (GitHub, Telegram, connectors) don’t come along. Commands start in its folder. You can go back to Linux or turn it off any time.')}</p><div className="row"><button className="btn btn--sm btn--danger" onClick={() => (setConfirmMac(false), onChange('mac'))}>- {L('Liberar o computador pra ele', 'Give it this computer')}+ {L('Liberar o computador pra ele', 'Let it use this computer')}</button><button className="btn btn--sm btn--ghost" onClick={() => setConfirmMac(false)}>{L('Cancelar', 'Cancel')}@@ -817,8 +838,14 @@ function ComputerCard({ agentId, kind, onChange }: { agentId: string; kind: Comp<><div className="computer"><span className={`tag ${st.tone}`}>{st.label}</span>- <span className="muted small grow">{info?.detail ?? (state === 'running' ? L('Pronto. Pasta de trabalho: /work', 'Ready. Work folder: /work') : state === 'stopped' ? L('Liga sozinho quando ele precisar.', 'Starts on its own when it needs to.') : '')}</span>- {state === 'stopped' && (+ <span className="muted small grow">+ {state === 'no_docker'+ ? `${info?.detail ?? L('Precisa do Docker aberto. Abra o Docker Desktop (ou instale).', 'It needs Docker open. Open Docker Desktop (or install it).')} ${L('Depois, clique em Verificar de novo.', 'Then click Check again.')}`+ : state === 'error'+ ? `${info?.detail ? `${info.detail} ` : ''}${L('Tente ligar de novo; se continuar, apague o computador e comece do zero.', 'Try starting it again; if it keeps failing, erase the computer and start fresh.')}`+ : (info?.detail ?? (state === 'running' ? L('Pronto. Pasta de trabalho: /work', 'Ready. Work folder: /work') : state === 'stopped' ? L('Liga sozinho quando ele precisar.', 'Starts on its own when it needs to.') : ''))}+ </span>+ {(state === 'stopped' || state === 'error') && (<button className="btn btn--sm" onClick={() => computerAction(agentId, 'start')}>{L('Ligar agora', 'Start now')}</button>@@ -929,7 +956,7 @@ function LentFolders({ agentId }: { agentId: string }): ReactNode {</div>))}</div>- <p className="hint">{L('Emprestar ou devolver reinicia o computador: os serviços param, o que ele instalou fica. Sem credenciais lá dentro, push e deploy ficam com você.', 'Lending or giving back restarts the computer: services stop, what it installed stays. With no credentials inside, push and deploy stay with you.')}</p>+ <p className="hint">{L('Emprestar ou devolver reinicia o computador: os serviços param, o que ele instalou fica. Sem credenciais lá dentro, publicar o código e colocar no ar ficam com você.', 'Lending or giving back restarts the computer: services stop, what it installed stays. With no credentials inside, publishing the code and putting it live stay with you.')}</p></>)}{error && <p className="field__error">{error}</p>}@@ -969,6 +996,7 @@ export function ApprovalsPage(): ReactNode {const pending = approvals.filter((a) => a.state === 'pending')const past = approvals.filter((a) => a.state !== 'pending').sort((a, b) => (b.decidedAt ?? 0) - (a.decidedAt ?? 0))const conversations = useStore((s) => s.conversations)+ const agents = useStore((s) => s.agents)return (<Page title={L('Aprovações', 'Approvals')} subtitle={L('Nada sensível acontece sem você. Cada aprovação cobre uma ação exata.', 'Nothing sensitive happens without you. Each approval covers one exact action.')}>@@ -976,17 +1004,18 @@ export function ApprovalsPage(): ReactNode {<div className="empty empty--rest"><SleepingToucan /><p>{L('Nada esperando por você.', 'Nothing waiting for you.')}</p>- <p className="muted">{L('Quando um agente quiser mergear, fazer deploy, apagar ou enviar algo pra fora, o pedido aparece aqui e na conversa.', 'When an agent wants to merge, deploy, delete or send something out, the request shows up here and in the conversation.')}</p>+ <p className="muted">{L('Quando um agente quiser publicar código, colocar algo no ar, apagar ou enviar algo pra fora, o pedido aparece aqui e na conversa.', 'When an agent wants to publish code, put something live, delete or send something out, the request shows up here and in the conversation.')}</p></div>) : (<div className="stack-list">{pending.map((a) => {const conv = conversations.find((c) => c.id === a.conversationId)+ const who = agents.find((x) => x.id === a.agentId)?.namereturn (<div key={a.id}><div className="row row--between small muted list-meta"><span>- {L('em', 'in')} {conv?.kind === 'channel' ? `#${conv.name}` : 'DM'} · {time(a.createdAt)}+ {conv?.kind === 'channel' ? L(`em #${conv.name}`, `in #${conv.name}`) : who ? L(`na DM com ${who}`, `in the DM with ${who}`) : L('na DM', 'in the DM')} · {time(a.createdAt)}</span><button className="link" onClick={() => navigate({ kind: 'conversation', id: a.conversationId })}>{L('Ver na conversa', 'See in the conversation')}@@ -1020,10 +1049,10 @@ function HistoryRow({ id }: { id: string }): ReactNode {<div className="table__row">{agent && <AgentAvatar agent={agent} size={22} />}<span className="grow">- {a.tool.replace(/_/g, ' ')} <span className="muted">· {a.connectorName}</span>+ {toolWords(a.tool)} <span className="muted">· {a.connectorName}</span></span>{a.outcome && <span className="muted small">{a.outcome}</span>}- <span className={`tag ${a.state === 'approved' ? 'tag--ok' : 'tag--danger'}`}>{a.state === 'approved' ? L('aprovado', 'approved') : a.state === 'refused' ? L('recusado', 'refused') : L('expirado', 'expired')}</span>+ <span className={`tag ${a.state === 'approved' ? 'tag--ok' : a.state === 'refused' ? 'tag--danger' : ''}`}>{a.state === 'approved' ? L('aprovado', 'approved') : a.state === 'refused' ? L('recusado', 'refused') : L('expirado', 'expired')}</span><span className="muted small">{a.decidedAt ? time(a.decidedAt) : ''}</span></div>)@@ -1037,7 +1066,7 @@ const STATUS = (): Record<Connector['status'], { label: string; tone: string }>connected: { label: L('conectado', 'connected'), tone: 'tag--ok' },connecting: { label: L('conectando…', 'connecting…'), tone: '' },needs_auth: { label: L('precisa autorizar', 'needs authorization'), tone: 'tag--warn' },- error: { label: L('com problema', 'having trouble'), tone: 'tag--danger' },+ error: { label: L('não conectou', 'didn’t connect'), tone: 'tag--danger' },disconnected: { label: L('desconectado', 'disconnected'), tone: 'tag--warn' }})@@ -1097,8 +1126,8 @@ export function ConnectorsPage(): ReactNode {{connectors.length === 0 && !adding && (<div className="empty empty--card"><Icon name="plug" size={22} />- <p>{L('Nenhum conector ainda.', 'No connectors yet.')}</p>- <p className="muted">{L('Adicione um servidor MCP remoto (GitHub, Linear, Sentry…) ou um local, que roda como processo no seu computador.', 'Add a remote MCP server (GitHub, Linear, Sentry…) or a local one, which runs as a process on your computer.')}</p>+ <p>{L('Conecte Linear, GitHub, Notion… e os agentes passam a ler e agir neles, sempre com a sua permissão.', 'Connect Linear, GitHub, Notion… and the agents can read and act in them, always with your permission.')}</p>+ <p className="muted small">{L('Funciona com qualquer servidor MCP: remoto, por URL, ou local, rodando como processo no seu computador.', 'Works with any MCP server: remote, by URL, or local, running as a process on your computer.')}</p></div>)}<div className="stack-list">@@ -1136,7 +1165,12 @@ export function ConnectorsPage(): ReactNode {<Icon name="terminal" size={14} /> {L('Conector local: roda um processo no seu computador com o seu usuário.', 'Local connector: runs a process on your computer as your user.')}</p>)}- {c.error && <p className="note note--error">{c.error}</p>}+ {c.error && (+ <p className="note note--error">+ {c.error}+ {c.status === 'error' && ` ${L('Clique em Conectar de novo. Se continuar, confira o endereço e o login.', 'Click Reconnect. If it keeps happening, check the address and the sign-in.')}`}+ </p>+ )}{c.kind === 'remote' && c.auth === 'token' && <ConnectorToken id={c.id} />}<div className="row connector__actions">{c.status === 'needs_auth' && (@@ -1152,9 +1186,13 @@ export function ConnectorsPage(): ReactNode {<span className="grow" /><buttonclassName="btn btn--ghost btn--sm"- onClick={() => {- if (confirm(L(`Remover ${c.name}? Os agentes perdem acesso às ferramentas dele.`, `Remove ${c.name}? The agents lose access to its tools.`))) removeConnector(c.id)- }}+ onClick={() =>+ void confirmDialog({+ title: L(`Remover ${c.name}?`, `Remove ${c.name}?`),+ body: L('Os agentes perdem acesso às ferramentas dele. Pra voltar, é só adicionar o conector de novo.', 'The agents lose access to its tools. To get it back, just add the connector again.'),+ confirm: L(`Remover ${c.name}`, `Remove ${c.name}`)+ }).then((ok) => ok && removeConnector(c.id))+ }>{L('Remover', 'Remove')}</button>@@ -1418,8 +1456,8 @@ function ReserveModel({ draft, patch }: { draft: Agent; patch: (p: Partial<Agent<strong>{L('Modelo reserva', 'Reserve model')}</strong><p className="muted small">{L(- `Quando a assinatura do modelo principal chega no limite (o de 5 horas ou o semanal), a resposta segue no reserva, que pode ser outro harness ou outra conta. Na resposta seguinte, ${draft.name || 'o agente'} tenta o principal de novo.`,- `When the main model’s subscription hits its limit (the 5-hour or the weekly one), the reply goes on with the reserve, which can be another harness or another account. On the next reply, ${draft.name || 'the agent'} tries the main one again.`+ `Quando a assinatura do modelo principal chega no limite (o de 5 horas ou o semanal), a resposta segue no reserva, que pode estar em outro programa (Claude Code, Codex…) ou em outra conta. Na resposta seguinte, ${draft.name || 'o agente'} tenta o principal de novo.`,+ `When the main model’s subscription hits its limit (the 5-hour or the weekly one), the reply goes on with the reserve, which can be in another program (Claude Code, Codex…) or another account. On the next reply, ${draft.name || 'the agent'} tries the main one again.`)}</p></div>@@ -1450,7 +1488,7 @@ function ReserveModel({ draft, patch }: { draft: Agent; patch: (p: Partial<Agent<p className="hint hint--warn">{draft.fallbackModelId === draft.modelId? L('É o mesmo modelo, na mesma conta do principal: a reserva não vai ser usada.', 'It’s the same model, on the same account as the main one: the reserve won’t be used.')- : L('É o mesmo harness, na mesma conta do principal: se o limite for da assinatura, ele também vai estar sem.', 'It’s the same harness, on the same account as the main one: if the limit is the subscription’s, it’ll be out too.')}+ : L('É o mesmo programa, na mesma conta do principal: se o limite for da assinatura, ele também vai estar sem.', 'It’s the same program, on the same account as the main one: if the limit is the subscription’s, it’ll be out too.')}{reserveAccounts.length > 0 ? L(' Escolha outra conta em “Conta da reserva”.', ' Pick another one under “Reserve account”.') : ''}</p>)}@@ -1685,14 +1723,23 @@ function PhoneCard({ info }: { info?: TelegramInfo }): ReactNode {{info.bot} {L('manda pra', 'sends to')} <strong>{info.chat}</strong>.</span><button className="btn btn--sm btn--ghost" onClick={() => unpairTelegram()}>- {L('Desparear', 'Unpair')}+ {L('Desconectar este chat', 'Disconnect this chat')}</button><button className="btn btn--sm btn--ghost" onClick={() => save(null)}>{L('Remover bot', 'Remove bot')}</button></div>)}- {(error || info?.error) && <p className="note note--error">{error || L(`O Telegram não está respondendo: ${info?.error}`, `Telegram isn't responding: ${info?.error}`)}</p>}+ {error ? (+ <p className="note note--error">{error}</p>+ ) : (+ info?.error && (+ <div className="note note--error">+ <p>{L('O Telegram não respondeu. Confira a internet ou troque o token do bot.', 'Telegram didn’t respond. Check the internet connection or change the bot token.')}</p>+ <p className="small muted mono">{info.error}</p>+ </div>+ )+ )}<p className="hint"><Icon name="shield" size={13} /> {L('O Telegram recebe o texto das aprovações e perguntas (ferramenta, argumentos, motivo) e as respostas das rotinas. O token fica no cofre do sistema. Uma ação de alto risco pede dois toques.', 'Telegram receives the text of approvals and questions (tool, arguments, reason) and the routines’ replies. The token stays in the system’s vault. A high-risk action takes two taps.')}</p>@@ -1892,8 +1939,8 @@ export function SettingsPage(): ReactNode {)}{pane('modelos') && (- <Card title="Router" lead={L('Modelo pequeno que lê a conversa e decide quem responde. Não concede permissão nenhuma.', 'A small model that reads the conversation and decides who replies. It grants no permissions at all.')}>- <Field label={L('Modelo do router', 'Router model')} hint={L('Prefira um modelo rápido: ele roda antes de cada resposta num canal.', 'Go for a fast model: it runs before every reply in a channel.')}>+ <Card title={L('Roteador', 'Router')} lead={L('Modelo pequeno que lê a conversa e decide quem responde nos canais. Não concede permissão nenhuma.', 'A small model that reads the conversation and decides who replies in channels. It grants no permissions at all.')}>+ <Field label={L('Modelo do roteador', 'Router model')} hint={L('Prefira um modelo rápido: ele roda antes de cada resposta num canal.', 'Go for a fast model: it runs before every reply in a channel.')}><ModelSelect value={settings.routerModel} onChange={(routerModel) => updateSettings({ routerModel })} jev /></Field>{settings.routerModel === 'jev' && <JevKey saved={!!settings.jevKey} />}@@ -1987,7 +2034,7 @@ export function SettingsPage(): ReactNode {onChange={(n) => updateSettings({ defaultLimit: Math.max(0, Math.round(n * 1_000_000)) })}/></Field>- <Field label={L('Teto por resposta (% do limite do mês)', 'Ceiling per reply (% of the monthly limit)')} hint={L('Chegou nele, o agente pausa e você decide se continua.', 'When it hits it, the agent pauses and you decide whether it continues.')}>+ <Field label={L('Limite por resposta (% do limite do mês)', 'Limit per reply (% of the monthly limit)')} hint={L('Chegou nele, o agente pausa e você decide se continua.', 'When it hits it, the agent pauses and you decide whether it continues.')}><NumberInputmin={1}max={100}@@ -1995,7 +2042,7 @@ export function SettingsPage(): ReactNode {onChange={(n) => updateSettings({ runBudgetPct: Math.min(100, Math.max(1, Math.round(n))) })}/></Field>- <Field label={L('Travado depois de (minutos sem sinal)', 'Stalled after (minutes without a sign)')} hint={L('Sem texto nem ferramenta terminando. Trabalho longo que anda não é cortado.', 'No text and no tool finishing. Long work that’s moving isn’t cut off.')}>+ <Field label={L('Considerar travado após (min sem sinal)', 'Treat as stuck after (min with no sign)')} hint={L('Sem texto nem ferramenta terminando. Trabalho longo que anda não é cortado.', 'No text and no tool finishing. Long work that’s moving isn’t cut off.')}><NumberInputmin={5}value={settings.runStallMinutes ?? RUN_STALL_MINUTES}diff --git a/src/renderer/src/components/Panel.tsx b/src/renderer/src/components/Panel.tsxindex 85ecd75..79577f8 100644--- a/src/renderer/src/components/Panel.tsx+++ b/src/renderer/src/components/Panel.tsx@@ -169,7 +169,7 @@ function BrowserScreen({ agentId, onOpen }: { agentId: string; onOpen?: () => vo<div className={`screen ${onOpen ? 'screen--button' : ''}`} onClick={onOpen} role={onOpen ? 'button' : undefined}><img className="screen__frame" src={view.frame} alt={view.title} draggable={false} />{c && !view.shown && agent && (- <span className={`screen__cursor c-${agent.color} ${live ? '' : 'is-idle'}`} style={{ ...ownColor(agent), left: `${c.x * 100}%`, top: `${c.y * 100}%` }}>+ <span className={`screen__cursor c-${agent.color} ${live ? '' : 'is-idle'}`} style={{ ...ownColor(agent), transform: `translate(${c.x * 100}%, ${c.y * 100}%)` }}><i key={c.at} className="screen__ripple" /><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden><path d="m4 2 16 8-7 2-3 7L4 2Z" />@@ -290,7 +290,7 @@ export function BrowserCard({ agentId, big }: { agentId: string; big?: boolean }const name = useStore((s) => agentById(s, agentId)?.name ?? L('agente', 'agent'))const open = useStore((s) => s.panel?.kind === 'browser' && s.panel.agentId === agentId)const show = (): void => openPanel({ kind: 'browser', agentId })- const status = view?.shown ? L('você está no controle', 'you’re in control') : view?.doing ? `${view.doing.label.toLowerCase()} ${view.doing.detail}` : view?.log.at(-1)?.label.toLowerCase() ?? L('parado', 'idle')+ const status = view?.shown ? L('você está no controle', 'you’re in control') : view?.doing ? `${view.doing.label.toLowerCase()}${view.doing.detail ? ` ${view.doing.detail}` : ''}` : view?.log.at(-1)?.label.toLowerCase() ?? L('em espera', 'idle')if (big)return (@@ -401,9 +401,9 @@ export function SidePanel(): ReactNode {// Same origin is the service's own (127.0.0.1:port), not the app's.<iframe key={reload} src={reachable(service.url)} sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-modals" title={service.name} />) : (- <p className="empty">{L('Esse serviço não está rodando.', 'This service isn’t running.')}</p>+ <p className="empty">{L('Esse serviço parou. Peça pro agente subir de novo na conversa.', 'This service stopped. Ask the agent in the conversation to start it again.')}</p>))}- {panel.kind === 'artifact' && !artifact && <p className="empty">{L('Arquivo não encontrado.', 'File not found.')}</p>}+ {panel.kind === 'artifact' && !artifact && <p className="empty">{L('Esse arquivo não existe mais. Peça pro agente gerar de novo.', 'This file no longer exists. Ask the agent to make it again.')}</p>}{panel.kind === 'browser' && <BrowserPanel agentId={panel.agentId} />}</div></aside>@@ -418,8 +418,8 @@ function ArtifactView({ artifact }: { artifact: Artifact }): ReactNode {setText(null)if (textual)void call('artifactText', { id: artifact.id }).then(- (t) => setText(t ?? L('(não consegui abrir o arquivo)', '(couldn’t open the file)')),- () => setText(L('(não consegui abrir o arquivo)', '(couldn’t open the file)'))+ (t) => setText(t ?? L('(o arquivo não abriu: pode ter sido movido ou apagado. Peça pro agente gerar de novo.)', '(the file didn’t open: it may have been moved or deleted. Ask the agent to make it again.)')),+ () => setText(L('(o arquivo não abriu: pode ter sido movido ou apagado. Peça pro agente gerar de novo.)', '(the file didn’t open: it may have been moved or deleted. Ask the agent to make it again.)')))}, [artifact.id, textual])diff --git a/src/renderer/src/components/Report.tsx b/src/renderer/src/components/Report.tsxindex 1aab30b..ad4b985 100644--- a/src/renderer/src/components/Report.tsx+++ b/src/renderer/src/components/Report.tsx@@ -20,7 +20,7 @@ const day = (at: number): string => new Date(at).toLocaleDateString(locale(), {const PROBLEM = (): Record<Problem['kind'], string> => ({failed: L('Falhou', 'Failed'),cut: L('Foi cortada (loop ou travou)', 'Cut off (a loop, or it stalled)'),- paused: L('Parou no teto de tokens', 'Stopped at the token ceiling'),+ paused: L('Parou no limite por resposta', 'Stopped at the per-reply limit'),refused: L('Você recusou uma ação', 'You refused an action')})@@ -83,7 +83,7 @@ export function ReportPage(): ReactNode {}>{!report ? (- <p className="read-empty">{L('Calculando…', 'Crunching…')}</p>+ <p className="read-empty">{L('Fazendo as contas…', 'Doing the math…')}</p>) : (<><Headline report={report} thisWeek={thisWeek} />diff --git a/src/renderer/src/components/Routines.tsx b/src/renderer/src/components/Routines.tsxindex 529140f..2c222d3 100644--- a/src/renderer/src/components/Routines.tsx+++ b/src/renderer/src/components/Routines.tsx@@ -550,7 +550,8 @@ function Popover({ occ, rect, now, onClose, onEdit }: { occ: Occ; rect: DOMRect;{r?.trigger?.kind === 'webhook' && <Hook token={r.trigger.token} />}{r?.trigger?.kind === 'poll' && r.trigger.error && (<p className="cal-pop__error" title={r.trigger.error}>- {L('A última olhada falhou', 'The last check failed')}: {r.trigger.error}+ {L(`Não deu pra ler o ${connector?.name ?? 'conector'}: confira se ele está conectado em Conectores.`, `Couldn’t read ${connector?.name ?? 'the connector'}: check that it’s connected in Connectors.`)}+ <span className="muted small"> ({r.trigger.error})</span></p>)}{history.length > 0 && (@@ -569,7 +570,7 @@ function Popover({ occ, rect, now, onClose, onEdit }: { occ: Occ; rect: DOMRect;<div className="cal-pop__acts">{confirm ? (<>- <span className="small">{L('Apagar a rotina?', 'Delete the routine?')}</span>+ <span className="small">{L(`Apagar “${occ.name}”? As respostas que ela já gerou ficam nas conversas.`, `Delete “${occ.name}”? The replies it already produced stay in the conversations.`)}</span><span className="grow" /><button className="btn btn--sm btn--ghost" onClick={() => setConfirm(false)}>{L('Cancelar', 'Cancel')}@@ -644,7 +645,12 @@ function RoutineForm({ draft, onChange, onClose }: { draft: Draft; onChange: (d:const x = withArgs(t)if (!x) returnsetPreview(L('Olhando…', 'Checking…'))- checkTrigger(x).then(setPreview, (e: unknown) => setPreview(`${L('Falhou', 'Failed')}: ${e instanceof Error ? e.message.replace(/^Error invoking.*?: /, '') : String(e)}`))+ const name = x.kind === 'poll' ? connectors.find((c) => c.id === x.connectorId)?.name : undefined+ checkTrigger(x).then(setPreview, (e: unknown) =>+ setPreview(+ `${L(`Não deu pra ler o ${name ?? 'conector'}: confira se ele está conectado em Conectores.`, `Couldn’t read ${name ?? 'the connector'}: check that it’s connected in Connectors.`)} (${e instanceof Error ? e.message.replace(/^Error invoking.*?: /, '') : String(e)})`+ )+ )}const save = async (): Promise<void> => {diff --git a/src/renderer/src/components/Sidebar.tsx b/src/renderer/src/components/Sidebar.tsxindex 8b599e1..4a70c93 100644--- a/src/renderer/src/components/Sidebar.tsx+++ b/src/renderer/src/components/Sidebar.tsx@@ -20,11 +20,11 @@ import {} from '../store'import { addGroup, arrange, moveChannel, nudgeChannel, removeGroup, renameGroup, type ChannelLayout } from '../../../shared/channel-layout'import { call } from '../rpc'-import { ContextMenu, type MenuItem, type MenuState } from './Dialogs'+import { ContextMenu, confirmDialog, type MenuItem, type MenuState } from './Dialogs'import { FoldToggle, useFold } from './Fold'import { GettingStarted } from './Onboarding'import { UpdateNote } from './Update'-import { AgentAvatar, Icon, TucaMark, type IconName } from './ui'+import { AgentAvatar, Icon, TucaMark, useJustEnded, type IconName } from './ui'// The wiki stays lit on any of its pages.const same = (a: View | null, b: View): boolean => (b.kind === 'wiki' ? a?.kind === 'wiki' : JSON.stringify(a) === JSON.stringify(b))@@ -35,7 +35,11 @@ function NavItem({ view, icon, label, badge }: { view: View; icon: IconName; lab<button className={`nav-item ${active ? 'is-active' : ''}`} onClick={() => navigate(view)}><Icon name={icon} /><span className="nav-item__label">{label}</span>- {badge ? <span className="badge">{badge}</span> : null}+ {badge ? (+ <span key={badge} className="badge">+ {badge}+ </span>+ ) : null}</button>)}@@ -60,7 +64,11 @@ function Section({ id, label, unread = 0, action, children }: { id: string; labe{label}</FoldToggle>{/* A closed section still says when something in it is waiting. */}- {!open && unread > 0 && <span className="badge badge--soft">{unread}</span>}+ {!open && unread > 0 && (+ <span key={unread} className="badge badge--soft">+ {unread}+ </span>+ )}{action}</div>{children}@@ -167,9 +175,15 @@ export function Sidebar(): ReactNode {label: L('Excluir canal…', 'Delete channel…'),icon: 'trash',danger: true,- onClick: () => {- if (confirm(L(`Excluir #${c.name}?\n\nAs mensagens e as rotinas que postam nele vão junto. Os agentes continuam existindo. Não dá pra desfazer.`, `Delete #${c.name}?\n\nIts messages and the routines that post in it go too. The agents stay. This can't be undone.`))) void deleteConversation(c.id)- }+ onClick: () =>+ void confirmDialog({+ title: L(`Excluir #${c.name}?`, `Delete #${c.name}?`),+ body: L('As mensagens e as rotinas que postam nele vão junto. Os agentes continuam no time. Não dá pra desfazer.', "Its messages and the routines that post in it go too. The agents stay on the team. This can't be undone."),+ confirm: L(`Excluir #${c.name}`, `Delete #${c.name}`),+ danger: true+ }).then((ok) => {+ if (ok) void deleteConversation(c.id)+ })}]const dmMenu = (id: string, agentId: string, agentName: string): MenuItem[] => [@@ -181,9 +195,15 @@ export function Sidebar(): ReactNode {label: L('Apagar a conversa…', 'Delete the conversation…'),icon: 'trash',danger: true,- onClick: () => {- if (confirm(L(`Apagar a conversa com ${agentName}?\n\nAs mensagens e as rotinas desta DM vão junto. ${agentName} continua existindo.`, `Delete the conversation with ${agentName}?\n\nThe messages and routines of this DM go too. ${agentName} stays.`))) void deleteConversation(id)- }+ onClick: () =>+ void confirmDialog({+ title: L(`Apagar a conversa com ${agentName}?`, `Delete the conversation with ${agentName}?`),+ body: L(`As mensagens e as rotinas desta DM vão junto. ${agentName} continua no time. Não dá pra desfazer.`, `The messages and routines of this DM go too. ${agentName} stays on the team. This can't be undone.`),+ confirm: L('Apagar a conversa', 'Delete the conversation'),+ danger: true+ }).then((ok) => {+ if (ok) void deleteConversation(id)+ })}]const agentMenu = (agentId: string, agentName: string): MenuItem[] => [@@ -192,11 +212,15 @@ export function Sidebar(): ReactNode {'separator',{label: L('Arquivar…', 'Archive…'),- icon: 'trash',- danger: true,- onClick: () => {- if (confirm(L(`Arquivar ${agentName}?\n\nSai da barra lateral e para de responder; as rotinas dele desligam. O histórico e os recibos ficam, e dá pra reativar em "Arquivados", no fim da lista de agentes.`, `Archive ${agentName}?\n\nIt leaves the sidebar and stops replying; its routines turn off. History and receipts stay, and you can bring it back from "Archived", at the end of the agent list.`))) void archiveAgent(agentId, true)- }+ icon: 'archive',+ onClick: () =>+ void confirmDialog({+ title: L(`Arquivar ${agentName}?`, `Archive ${agentName}?`),+ body: L('Sai da barra lateral e para de responder; as rotinas dele desligam. O histórico e os recibos ficam, e dá pra reativar em "Arquivados", no fim da lista de agentes.', 'It leaves the sidebar and stops replying; its routines turn off. History and receipts stay, and you can reactivate it from "Archived", at the end of the agent list.'),+ confirm: L(`Arquivar ${agentName}`, `Archive ${agentName}`)+ }).then((ok) => {+ if (ok) void archiveAgent(agentId, true)+ })}]@@ -350,12 +374,19 @@ function ChannelItem({ id, name, unread }: { id: string; name: string; unread?:<button className={`nav-item ${active ? 'is-active' : ''} ${unread ? 'is-unread' : ''}`} onClick={() => navigate({ kind: 'conversation', id })}><Icon name="hash" /><span className="nav-item__label">{name}</span>- {working && <span className="pulse" title={L('Trabalhando', 'Working')} />}- {unread ? <span className="badge badge--soft">{unread}</span> : null}+ <LiveDot working={working} />+ {unread ? <span key={unread} className="badge badge--soft">{unread}</span> : null}</button>)}+// Working: the dot pulses. Just finished: it turns green for a moment and fades out, instead of vanishing.+function LiveDot({ working }: { working: boolean }): ReactNode {+ const done = useJustEnded(working, 1500)+ if (!working && !done) return null+ return <span className={`pulse ${done ? 'is-done' : ''}`} title={working ? L('Trabalhando', 'Working') : undefined} />+}+function DmItem({ id, agent, unread }: { id: string; agent: Agent; unread?: number }): ReactNode {const name = agent.nameconst active = useStore((s) => s.view?.kind === 'conversation' && s.view.id === id)@@ -364,8 +395,8 @@ function DmItem({ id, agent, unread }: { id: string; agent: Agent; unread?: numb<button className={`nav-item ${active ? 'is-active' : ''} ${unread ? 'is-unread' : ''}`} onClick={() => navigate({ kind: 'conversation', id })}><AgentAvatar agent={agent} size={18} busy={working} /><span className="nav-item__label">{name}</span>- {working && <span className="pulse" title={L('Trabalhando', 'Working')} />}- {unread ? <span className="badge badge--soft">{unread}</span> : null}+ <LiveDot working={working} />+ {unread ? <span key={unread} className="badge badge--soft">{unread}</span> : null}</button>)}@@ -387,7 +418,7 @@ function AgentItem({ id }: { id: string }): ReactNode {<Icon name="laptop" size={13} /></span>)}- {pct >= 0.8 && <span className={`dot ${pct >= 1 ? 'dot--danger' : 'dot--warn'}`} title={L('Orçamento acima de 80%', 'Budget above 80%')} />}+ {pct >= 0.8 && <span className={`dot ${pct >= 1 ? 'dot--danger' : 'dot--warn'}`} title={pct >= 1 ? L('Bateu o limite do mês', 'Hit the monthly limit') : L('Já usou mais de 80% do limite', 'Over 80% of the limit used')} />}</button>)}diff --git a/src/renderer/src/components/Skills.tsx b/src/renderer/src/components/Skills.tsxindex 3d19d61..2a06bd5 100644--- a/src/renderer/src/components/Skills.tsx+++ b/src/renderer/src/components/Skills.tsx@@ -25,6 +25,7 @@ import {isTeam} from '../store'import { Card, Field, Sheet } from './Pages'+import { confirmDialog } from './Dialogs'import { ago, AgentAvatar, Icon, time } from './ui'type Place = { kind: 'list' } | { kind: 'skill'; id: string } | { kind: 'review' }@@ -147,9 +148,19 @@ export function SkillsPage(): ReactNode {<span className="skill-line__desc">{k.description}</span></span><button className="text-btn" onClick={() => archiveSkill(k.id, false)}>- {L('Reativar', 'Bring back')}+ {L('Reativar', 'Reactivate')}</button>- <button className="text-btn" onClick={() => removeSkill(k.id)}>+ <button+ className="text-btn"+ onClick={() =>+ void confirmDialog({+ title: L(`Apagar a skill “${k.name}”?`, `Delete the skill “${k.name}”?`),+ body: L('Ela some da lista e nenhum agente volta a usar. Não dá pra desfazer.', "It leaves the list and no agent uses it again. This can't be undone."),+ confirm: L(`Apagar “${k.name}”`, `Delete “${k.name}”`),+ danger: true+ }).then((ok) => ok && removeSkill(k.id))+ }+ >{L('Apagar', 'Delete')}</button></div>@@ -386,7 +397,7 @@ function History({ skill }: { skill: Skill }): ReactNode {useEffect(() => {void skillVersions(skill.id).then(setVersions)}, [skill.id, skill.updatedAt])- if (!versions) return <p className="muted small">{L('Carregando…', 'Loading…')}</p>+ if (!versions) return <p className="muted small">{L('Buscando o histórico…', 'Fetching the history…')}</p>if (versions.length === 0) return <p className="muted small">{L('Nenhuma mudança ainda: esta é a primeira versão.', 'No changes yet: this is the first version.')}</p>return (<div className="skill__history">diff --git a/src/renderer/src/components/Splash.tsx b/src/renderer/src/components/Splash.tsxindex 679a0fe..2a18645 100644--- a/src/renderer/src/components/Splash.tsx+++ b/src/renderer/src/components/Splash.tsx@@ -141,6 +141,7 @@ const ICON = `<svg viewBox="0 0 100 100" aria-hidden="true"><defs><clipPath id="export function Splash({ onDone }: { onDone: () => void }): ReactNode {const root = useRef<HTMLDivElement>(null)+ const skipRef = useRef<() => void>(onDone)useEffect(() => {const el = root.current@@ -281,11 +282,21 @@ export function Splash({ onDone }: { onDone: () => void }): ReactNode {const a = Math.atan2(e.clientY - (r.top + r.height / 2), e.clientX - (r.left + r.width / 2))gsap.to(pupil, { attr: { cx: 66 + Math.cos(a) * 18, cy: -384 + Math.sin(a) * 18 }, duration: 0.2, overwrite: true })}- const skip = (): void => onDone()+ // Skipping fades out (and the sound with it) instead of cutting: the same exit as the end, faster.+ let skipping = false+ const skip = (): void => {+ if (skipping) return+ skipping = true+ tl.pause()+ gsap.to(audio, { volume: 0, duration: 0.25 })+ gsap.to(el, { autoAlpha: 0, duration: 0.25, ease: 'power1.in', onComplete: onDone })+ }+ skipRef.current = skipwindow.addEventListener('pointermove', follow)window.addEventListener('keydown', skip)return () => {tl.kill()+ gsap.killTweensOf([el, audio])audio.pause()window.removeEventListener('pointermove', follow)window.removeEventListener('keydown', skip)@@ -293,7 +304,7 @@ export function Splash({ onDone }: { onDone: () => void }): ReactNode {}, [onDone])return (- <div className="splash" ref={root} onClick={onDone}>+ <div className="splash" ref={root} onClick={() => skipRef.current()}><div className="splash__scene" dangerouslySetInnerHTML={{ __html: SCENE }} /><div className="sp-black"><div className="sp-mark">diff --git a/src/renderer/src/components/Toast.tsx b/src/renderer/src/components/Toast.tsxnew file mode 100644index 0000000..8854560--- /dev/null+++ b/src/renderer/src/components/Toast.tsx@@ -0,0 +1,58 @@+import type { ReactNode } from "react";+import { L } from "../../../shared/lang";+import { dismissToast, holdToasts, useStore } from "../store";+import { Icon } from "./ui";++// Short notes at the bottom of the window: an action that didn't go through, and why.+// They go away on their own after a few seconds, unless someone is on them.+export function Toasts(): ReactNode {+ const toasts = useStore((s) => s.toasts);+ return (+ <div+ className="toasts"+ role="status"+ aria-live="polite"+ onPointerEnter={() => holdToasts(true)}+ onPointerLeave={() => holdToasts(false)}+ onFocus={() => holdToasts(true)}+ onBlur={(e) =>+ !e.currentTarget.contains(e.relatedTarget) && holdToasts(false)+ }+ >+ {toasts.map((t) => (+ <div key={t.id} className={`toast ${t.leaving ? "is-leaving" : ""}`}>+ <span className="toast__text">{t.text}</span>+ <button+ className="icon-btn toast__close"+ aria-label={L("Fechar", "Close")}+ onClick={() => dismissToast(t.id)}+ >+ <Icon name="x" size={14} />+ </button>+ </div>+ ))}+ </div>+ );+}++// The core's process ended: what's saved is safe, and reloading the page starts a new one.+export function CoreDown(): ReactNode {+ const down = useStore((s) => s.coreDown);+ if (!down) return null;+ return (+ <div className="core-down" role="alert">+ <span>+ {L(+ "O Tucano parou de funcionar. Seus agentes e conversas estão salvos.",+ "Tucano stopped working. Your agents and conversations are saved."+ )}+ </span>+ <button+ className="btn btn--primary btn--sm"+ onClick={() => location.reload()}+ >+ {L("Reabrir", "Reopen")}+ </button>+ </div>+ );+}diff --git a/src/renderer/src/components/Tuca.tsx b/src/renderer/src/components/Tuca.tsxindex fbf4910..b791096 100644--- a/src/renderer/src/components/Tuca.tsx+++ b/src/renderer/src/components/Tuca.tsx@@ -9,6 +9,7 @@ import {modelInfo,navigate,newAgentDraft,+ openDm,sendMessage,settleDraft,slug,@@ -87,15 +88,20 @@ export function AgentProposal({ message }: { message: Message }): ReactNode {<div className="draft-card__actions">{d.state === 'created' ? (<>- <span className="tag tag--ok">{L('criado', 'created')}</span>+ <span className="tag tag--ok">{created ? L(`${created.name} entrou no time`, `${created.name} joined the team`) : L('criado', 'created')}</span>{created && (- <button className="link" onClick={() => navigate({ kind: 'agent', id: created.id })}>- {L('Ver', 'See')} {created.name}- </button>+ <>+ <button className="btn btn--primary btn--sm" onClick={() => void openDm(created.id)}>+ {L('Abrir conversa', 'Open conversation')}+ </button>+ <button className="link" onClick={() => navigate({ kind: 'agent', id: created.id })}>+ {L('Ver perfil', 'See profile')}+ </button>+ </>)}</>) : d.state === 'dismissed' ? (- <span className="tag">{L('descartado', 'dismissed')}</span>+ <span className="tag">{L('descartado', 'discarded')}</span>) : replaced ? (<span className="muted small">{L('Trocada por uma proposta mais nova.', 'Replaced by a newer proposal.')}</span>) : use ? (@@ -111,7 +117,7 @@ export function AgentProposal({ message }: { message: Message }): ReactNode {{L('Editar antes', 'Edit first')}</button><button className="btn btn--ghost btn--sm" onClick={() => settleDraft(message.id)}>- {L('Descartar', 'Dismiss')}+ {L('Descartar', 'Discard')}</button></>)}diff --git a/src/renderer/src/components/Update.tsx b/src/renderer/src/components/Update.tsxindex 2a6cee1..1a3e597 100644--- a/src/renderer/src/components/Update.tsx+++ b/src/renderer/src/components/Update.tsx@@ -3,6 +3,7 @@import { useSyncExternalStore, type ReactNode } from 'react'import { L } from '../../../shared/lang'import type { UpdateState } from '../../../shared/types'+import { useStore } from '../store'import { ago } from './ui'const RELEASES = 'https://github.com/eduwxyz/tucano/releases'@@ -35,19 +36,29 @@ function useUpdate(): UpdateState | null {const notes = (version?: string): string => (version ? `${RELEASES}/tag/v${version}` : RELEASES)+// How many agents are in the middle of a reply: restarting now would cut them off.+const useWorking = (): number => useStore((s) => new Set(s.messages.filter((m) => m.run?.status === 'working' && m.author.kind === 'agent').map((m) => (m.author.kind === 'agent' ? m.author.id : ''))).size)++const workingNote = (n: number): string => (n === 1 ? L('1 agente trabalhando: reinicie quando ele terminar.', '1 agent working: restart once it’s done.') : L(`${n} agentes trabalhando: reinicie quando terminarem.`, `${n} agents working: restart once they’re done.`))+export function UpdateNote(): ReactNode {const u = useUpdate()+ const working = useWorking()if (u?.status !== 'ready') return nullreturn (<div className="update-note"><div className="update-note__text"><strong>{L(`Tucano ${u.next} pronto`, `Tucano ${u.next} is ready`)}</strong>- <a href={notes(u.next)} target="_blank" rel="noreferrer">- {L('O que mudou', 'What’s new')}- </a>+ {working > 0 ? (+ <span className="muted small">{workingNote(working)}</span>+ ) : (+ <a href={notes(u.next)} target="_blank" rel="noreferrer">+ {L('O que mudou', 'What’s new')}+ </a>+ )}</div>- <button className="btn btn--primary btn--sm" onClick={() => window.tucano.installUpdate()}>- {L('Reiniciar', 'Restart')}+ <button className={`btn btn--sm ${working > 0 ? '' : 'btn--primary'}`} onClick={() => window.tucano.installUpdate()}>+ {working > 0 ? L('Reiniciar mesmo assim', 'Restart anyway') : L('Reiniciar', 'Restart')}</button></div>)@@ -64,7 +75,11 @@ function status(u: UpdateState): string {case 'ready':return L(`O Tucano ${u.next} está pronto. Ele entra quando você reiniciar ou fechar o app.`, `Tucano ${u.next} is ready. It goes in when you restart or quit the app.`)case 'error':- return L('Não deu pra procurar uma versão nova agora. Tente de novo mais tarde.', 'Couldn’t look for a new version just now. Try again later.')+ return u.errorKind === 'other'+ ? L('Não deu pra atualizar sozinho. Baixe a versão nova em Releases.', 'Couldn’t update on its own. Download the new version from Releases.')+ : u.errorKind === 'offline'+ ? L('Sem internet pra procurar uma versão nova. O Tucano tenta de novo sozinho mais tarde.', 'No internet to look for a new version. Tucano tries again on its own later.')+ : L('Não deu pra procurar uma versão nova agora. Tente de novo mais tarde.', 'Couldn’t look for a new version just now. Try again later.')default:return u.checkedAt? L(`É a versão mais recente. Conferido ${ago(u.checkedAt)}.`, `It’s the latest version. Checked ${ago(u.checkedAt)}.`)@@ -74,6 +89,7 @@ function status(u: UpdateState): string {export function UpdateSettings(): ReactNode {const u = useUpdate()+ const working = useWorking()if (!u) return nullconst busy = u.status === 'checking' || u.status === 'downloading'return (@@ -81,17 +97,23 @@ export function UpdateSettings(): ReactNode {<span className="hint">{L(`Você está na versão ${u.version}. `, `You’re on version ${u.version}. `)}{status(u)}+ {u.status === 'ready' && working > 0 && ` ${workingNote(working)}`}</span><div className="row">{u.status === 'ready' ? (- <button className="btn btn--primary btn--sm" onClick={() => window.tucano.installUpdate()}>- {L('Reiniciar e atualizar', 'Restart and update')}+ <button className={`btn btn--sm ${working > 0 ? '' : 'btn--primary'}`} onClick={() => window.tucano.installUpdate()}>+ {working > 0 ? L('Reiniciar mesmo assim', 'Restart anyway') : L('Reiniciar e atualizar', 'Restart and update')}</button>) : (<button className="btn btn--sm" disabled={u.status === 'off' || busy} onClick={() => window.tucano.checkUpdates()}>{L('Procurar atualizações', 'Check for updates')}</button>)}+ {u.status === 'error' && u.errorKind === 'other' && (+ <a className="btn btn--sm btn--primary" href={`${RELEASES}/latest`} target="_blank" rel="noreferrer">+ {L('Baixar em Releases', 'Download from Releases')}+ </a>+ )}<a className="link" href={notes(u.status === 'ready' ? u.next : u.version)} target="_blank" rel="noreferrer">{L('Notas da versão', 'Release notes')}</a>diff --git a/src/renderer/src/components/Usage.tsx b/src/renderer/src/components/Usage.tsxindex 8ef7dfd..8e99a09 100644--- a/src/renderer/src/components/Usage.tsx+++ b/src/renderer/src/components/Usage.tsx@@ -76,7 +76,7 @@ export function UsagePage(): ReactNode {return (<Sheet wide title={L('Uso e limites', 'Usage and limits')} lede={subtitle}>{!u ? (- <p className="read-empty">{L('Calculando…', 'Crunching…')}</p>+ <p className="read-empty">{L('Fazendo as contas…', 'Doing the math…')}</p>) : (<><Month u={u} claude={billing.find((b) => b.id === 'claude')?.status} />diff --git a/src/renderer/src/components/Wiki.tsx b/src/renderer/src/components/Wiki.tsxindex bcb6164..bc4644a 100644--- a/src/renderer/src/components/Wiki.tsx+++ b/src/renderer/src/components/Wiki.tsx@@ -11,6 +11,7 @@ import remarkGfm from 'remark-gfm'import { call } from '../rpc'import { agentById, navigate, updateSettings, useStore, type View, type WikiChange, type WikiFinding, type WikiHit, type WikiImport, type WikiPage, type WikiPageInfo, type WikiReview, type WikiSource, type WikiVersion } from '../store'import { Sheet, Toggle } from './Pages'+import { confirmDialog } from './Dialogs'import { AgentAvatar, Icon, type IconName } from './ui'const DEFAULT_KINDS = (): string[] => [L('Pessoa', 'Person'), L('Projeto', 'Project'), L('Assunto', 'Topic'), L('Decisão', 'Decision')]@@ -996,7 +997,14 @@ function WikiSettingsDialog({ data, onClose, onImport }: { data: WikiData | nullclassName="btn btn--sm"onClick={() =>void pick().then((p) => {- if (p && confirm(L(`Usar ${p} como a pasta da wiki?\n\nAs páginas da pasta atual continuam lá; a wiki passa a mostrar o que está na nova.`, `Use ${p} as the wiki's folder?\n\nThe pages in the current folder stay there; the wiki shows what's in the new one.`))) move(p)+ if (!p) return+ void confirmDialog({+ title: L('Trocar a pasta da wiki?', "Change the wiki's folder?"),+ body: L(`A wiki passa a mostrar o que está em ${p}. As páginas da pasta atual continuam lá.`, `The wiki will show what's in ${p}. The pages in the current folder stay there.`),+ confirm: L('Usar essa pasta', 'Use this folder')+ }).then((ok) => {+ if (ok) move(p)+ })})}>@@ -1604,10 +1612,14 @@ function WikiPageView({ title, data }: { title: string; data: WikiData | null }))const missing = new Set(page.missing.map((t) => t.toLowerCase()))const cited = sourcesIn(page.body)- const remove = (): void => {- if (!confirm(L(`Apagar "${page.title}"? Dá pra restaurar pelo histórico.`, `Delete "${page.title}"? It can be restored from the history.`))) return- void call('wikiRemove', { title: page.title }).then(() => navigate({ kind: 'wiki' }))- }+ const remove = (): void =>+ void confirmDialog({+ title: L(`Apagar “${page.title}”?`, `Delete “${page.title}”?`),+ body: L('Dá pra restaurar pelo histórico.', 'It can be restored from the history.'),+ confirm: L(`Apagar “${page.title}”`, `Delete “${page.title}”`)+ }).then((ok) => {+ if (ok) void call('wikiRemove', { title: page.title }).then(() => navigate({ kind: 'wiki' }))+ })const kindOf = (t: string): string => data?.pages.find((p) => p.title === t)?.kind ?? ''return (<article className="wk-page" style={{ ['--k' as string]: kindColor(page.kind) }}>diff --git a/src/renderer/src/components/ui.tsx b/src/renderer/src/components/ui.tsxindex d9e91d9..35697ce 100644--- a/src/renderer/src/components/ui.tsx+++ b/src/renderer/src/components/ui.tsx@@ -117,7 +117,8 @@ const PATHS: Record<string, ReactNode> = {</>),volume: <path d="M4 9v6h4l5 4V5L8 9H4ZM16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12" />,- trash: <path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 11v6M14 11v6" />+ trash: <path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 11v6M14 11v6" />,+ archive: <path d="M3 4h18v4H3V4ZM5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M10 12h4" />}export type IconName = keyof typeof PATHS@@ -142,9 +143,10 @@ export function Icon({ name, size = 16 }: { name: IconName; size?: number }): Re}// The Tuca wears the app's own toucan: he belongs to the app, not to the team.-export function TucaMark({ size = 32 }: { size?: number }): ReactNode {+// busy: his lower beak goes while he works; happy: one squint when he's done.+export function TucaMark({ size = 32, busy, happy }: { size?: number; busy?: boolean; happy?: boolean }): ReactNode {return (- <svg className="avatar avatar--tuca" width={size} height={size} viewBox="0 0 100 100" aria-label="Tuca">+ <svg className={`avatar avatar--tuca ${busy ? 'is-busy' : ''} ${happy ? 'is-happy' : ''}`} width={size} height={size} viewBox="0 0 100 100" aria-label="Tuca"><defs><clipPath id="tuca-clip"><rect width="100" height="100" rx="28" />@@ -153,16 +155,34 @@ export function TucaMark({ size = 32 }: { size?: number }): ReactNode {<g clipPath="url(#tuca-clip)"><rect width="100" height="100" fill="#F1ECE2" /><circle cx="27" cy="73" r="48" fill="#121212" />- <circle cx="38" cy="47" r="14" fill="#fff" />- <circle cx="43" cy="47" r="5.5" fill="#121212" />+ <g className="tuca__eye">+ <circle cx="38" cy="47" r="14" fill="#fff" />+ <circle cx="43" cy="47" r="5.5" fill="#121212" />+ </g>+ <path className="tuca__jaw" d="M53 57 L95 57 Q86 70 53 71 Z" fill="#E5531F" /><path d="M53 24 Q84 25 93 44 L96 57 L53 57 Z" fill="#FF8C24" />- <path d="M53 57 L95 57 Q86 70 53 71 Z" fill="#E5531F" /><path d="M83 57 A9 12 0 0 1 97 47 L97 57 Z" fill="#121212" /></g></svg>)}+// True for `ms` right after `on` goes from true to false (a run just ended), never on+// mount: the cue for a small "done" moment, which then goes back to rest.+export function useJustEnded(on: boolean, ms: number): boolean {+ const was = useRef(on)+ const [ended, setEnded] = useState(false)+ useEffect(() => {+ const fell = was.current && !on+ was.current = on+ setEnded(fell)+ if (!fell) return+ const t = setTimeout(() => setEnded(false), ms)+ return () => clearTimeout(t)+ }, [on, ms])+ return ended+}+// The toucan asleep: an empty page with nothing waiting. The z's drift up.export function SleepingToucan({ size = 120 }: { size?: number }): ReactNode {return (@@ -190,10 +210,10 @@ const HEX: Record<AgentColor, string> = { sky: '#3b9eea', indigo: '#5b6cf0', vio// A drawn avatar. Big ones and busy ones move (busy: thinking); the rest are one still SVG,// so a long chat stays light. The biggest follow the pointer with their eyes.-function DrawnAvatar({ definition, color, size, busy }: { definition: AvatarDefinition; color: string; size: number; busy?: boolean }): ReactNode {+function DrawnAvatar({ definition, color, size, busy, happy }: { definition: AvatarDefinition; color: string; size: number; busy?: boolean; happy?: boolean }): ReactNode {const host = useRef<HTMLSpanElement>(null)const avatar = useRef<MountedAvatar | null>(null)- const options: AvatarOptions = { definition, color, mood: busy ? 'thinking' : 'idle', still: size < 40 && !busy, followPointer: size >= 64, label: '' }+ const options: AvatarOptions = { definition, color, mood: busy ? 'thinking' : happy ? 'happy' : 'idle', still: size < 40 && !busy && !happy, followPointer: size >= 64, label: '' }useEffect(() => {avatar.current = mountAvatar(host.current!, options)return () => avatar.current?.destroy()@@ -203,18 +223,19 @@ function DrawnAvatar({ definition, color, size, busy }: { definition: AvatarDefi}// busy: the eyes read, left to right, while the agent works. Otherwise they blink now and then.-// A picture wins over a drawn avatar, and both over the face.+// Right after the work ends, one happy squint. A picture wins over a drawn avatar, and both over the face.export function AgentAvatar({ agent, size = 32, busy }: { agent: Pick<Agent, 'name' | 'color'> & Partial<Pick<Agent, 'kind' | 'customColor' | 'picture' | 'avatar'>>; size?: number; busy?: boolean }): ReactNode {- if (agent.kind === 'tuca') return <TucaMark size={size} />+ const happy = useJustEnded(!!busy, 600)+ if (agent.kind === 'tuca') return <TucaMark size={size} busy={busy} happy={happy} />if (!agent.picture && agent.avatar)return (<span className="avatar avatar--drawn" style={{ width: size, height: size }}>- <DrawnAvatar definition={agent.avatar} color={agent.customColor ?? HEX[agent.color]} size={size} busy={busy} />+ <DrawnAvatar definition={agent.avatar} color={agent.customColor ?? HEX[agent.color]} size={size} busy={busy} happy={happy} /><span className="sr-only">{agent.name}</span></span>)return (- <span className={`avatar avatar--agent c-${agent.color} ${busy ? 'is-busy' : ''}`} style={{ width: size, height: size, fontSize: size * 0.42, ...ownColor(agent) }}>+ <span className={`avatar avatar--agent c-${agent.color} ${busy ? 'is-busy' : ''} ${happy ? 'is-happy' : ''}`} style={{ width: size, height: size, fontSize: size * 0.42, ...ownColor(agent) }}>{agent.picture ? (<img className="avatar__photo" src={agent.picture} alt="" />) : (@@ -304,7 +325,7 @@ export function UsageBar({ used, limit }: { used: number; limit: number }): Reacconst tone = pct >= 100 ? 'danger' : pct >= 80 ? 'warn' : 'ok'return (<span className={`budget budget--${tone}`} role="meter" aria-valuenow={Math.round(pct)} aria-valuemin={0} aria-valuemax={100}>- <span className="budget__fill" style={{ width: `${pct}%` }} />+ <span className="budget__fill" style={{ transform: `scaleX(${pct / 100})` }} /></span>)}diff --git a/src/renderer/src/rpc.ts b/src/renderer/src/rpc.tsindex a1db89b..6365cd1 100644--- a/src/renderer/src/rpc.ts+++ b/src/renderer/src/rpc.ts@@ -1,3 +1,4 @@+import { L } from '../../shared/lang'import type { CoreEvent, Method, Params, Request, Result, Wire } from '../../shared/rpc'import type { UpdateState } from '../../shared/types'@@ -8,6 +9,8 @@ declare global {pickFolder: () => Promise<string | null>pathOf?: (file: File) => string // a dropped or picked file's path on this computer (desktop only)onNavigate: (cb: (conversationId: string) => void) => void+ onNavigatePage?: (cb: (page: 'skills') => void) => void // desktop only+ onCoreDown?: (cb: () => void) => void // desktop only: a browser reloads on its ownviewing: (conversationId: string | null) => voidupdateState: () => Promise<UpdateState>onUpdate: (cb: (state: UpdateState) => void) => void@@ -44,8 +47,18 @@ export function connect(onEvent: (e: CoreEvent) => void): Promise<void> {})}+// The core's process ended: nothing in flight will be answered, and nothing new goes out.+let down = false+const downError = (): Error => new Error(L('O Tucano parou de funcionar. Reabra pra continuar.', 'Tucano stopped working. Reopen it to go on.'))+export function disconnect(): void {+ down = true+ port = null+ for (const p of pending.values()) p.reject(downError())+ pending.clear()+}+export function call<M extends Method>(method: M, ...params: Params<M> extends undefined ? [] : [Params<M>]): Promise<Result<M>> {- if (!port) return Promise.reject(new Error('core not connected'))+ if (!port) return Promise.reject(down ? downError() : new Error(L('O Tucano ainda está abrindo. Tente de novo em instantes.', 'Tucano is still starting. Try again in a moment.')))const id = ++seqconst req: Request = { id, method, params: params[0] }return new Promise((resolve, reject) => {diff --git a/src/renderer/src/store.ts b/src/renderer/src/store.tsindex ec20441..858bb65 100644--- a/src/renderer/src/store.ts+++ b/src/renderer/src/store.ts@@ -2,7 +2,7 @@// is kept in sync by its events; actions go to the core over RPC.import { useRef, useSyncExternalStore } from 'react'import { L, setLang } from '../../shared/lang'-import type { CoreEvent } from '../../shared/rpc'+import type { CoreEvent, Method, Params } from '../../shared/rpc'import {type Account,type AccountEngine,@@ -42,7 +42,7 @@ import {type VoiceModelId,type VoiceStatus} from '../../shared/types'-import { call, connect } from './rpc'+import { call, connect, disconnect } from './rpc'export * from '../../shared/types'@@ -88,6 +88,14 @@ export interface State {dialog: Dialog | null // a small window: a channel's members, name or topic; archived agents; new channel; searchtabs: Record<string, string> // the open tab of each page with tabs, kept while the app is opendemoServer?: { command: string; args: string[] }+ toasts: Toast[] // short notes at the bottom: an action that didn't go through+ coreDown: boolean // the core's process ended; a banner offers to reopen+}++export interface Toast {+ id: number+ text: string+ leaving?: boolean // fading out}export type Dialog = { kind: 'members' | 'rename' | 'topic'; id: string } | { kind: 'archived' | 'new-channel' | 'search' } | { kind: 'oauth'; id: string; url: string }@@ -138,7 +146,9 @@ let state: State = {packaged: false,panel: null,dialog: null,- tabs: {}+ tabs: {},+ toasts: [],+ coreDown: false}// ---------- store plumbing ----------@@ -275,6 +285,11 @@ function apply(e: CoreEvent): void {export async function start(): Promise<void> {window.tucano.onNavigate((id) => navigate({ kind: 'conversation', id }))+ window.tucano.onNavigatePage?.((page) => navigate({ kind: page }))+ window.tucano.onCoreDown?.(() => {+ disconnect()+ set((s) => ({ ...s, coreDown: true }))+ })let viewing: string | null = nullsubscribe(() => {const id = state.view?.kind === 'conversation' ? state.view.id : null@@ -322,6 +337,49 @@ export function conversationTitle(s: State, c: Conversation): string {return agentById(s, c.name)?.name ?? L('Agente', 'Agent')}+// ---------- toasts ----------++const TOAST_MS = 5_000+const TOAST_EXIT_MS = 160 // the fade out, in styles.css++let toastSeq = 0+const toastTimers = new Map<number, ReturnType<typeof setTimeout>>()+let toastsHeld = false+const toastLater = (id: number): void => void toastTimers.set(id, setTimeout(() => dismissToast(id), TOAST_MS))+export function toast(text: string): void {+ const id = ++toastSeq+ set((s) => ({ ...s, toasts: [...s.toasts.slice(-2), { id, text }] })) // three at most+ if (!toastsHeld) toastLater(id)+}++// While the pointer or the focus is on them, the toasts wait: someone is reading, or about to close one.+export function holdToasts(hold: boolean): void {+ if (hold === toastsHeld) return+ toastsHeld = hold+ for (const t of toastTimers.values()) clearTimeout(t)+ toastTimers.clear()+ if (!hold) for (const t of state.toasts) if (!t.leaving) toastLater(t.id)+}++export function dismissToast(id: number): void {+ clearTimeout(toastTimers.get(id))+ toastTimers.delete(id)+ if (!state.toasts.some((t) => t.id === id && !t.leaving)) return+ set((s) => ({ ...s, toasts: s.toasts.map((t) => (t.id === id ? { ...t, leaving: true } : t)) }))+ setTimeout(() => set((s) => ({ ...s, toasts: s.toasts.filter((t) => t.id !== id) })), TOAST_EXIT_MS)+}++// An action nobody waits on: if the core says no, a toast says what didn't happen, and why.+// With the core down the banner already says it.+function fire<M extends Method>(failed: string, method: M, ...params: Params<M> extends undefined ? [] : [Params<M>]): Promise<void> {+ return call(method, ...params).then(+ () => {},+ (e: unknown) => {+ if (!state.coreDown) toast(`${failed} ${e instanceof Error && e.message ? e.message : L('Tente de novo.', 'Try again.')}`)+ }+ )+}+// ---------- actions ----------export const setNav = (navOpen: boolean): void => set((s) => ({ ...s, navOpen }))@@ -338,10 +396,10 @@ export const navigate = (view: View): void =>export function updateSettings(patch: Partial<Omit<Settings, 'engines'>>): void {set((s) => withSettings(s, { ...s.settings, ...patch })) // optimistic, so typing stays instant- void call('updateSettings', { patch })+ void fire(L('Não consegui salvar a configuração.', "I couldn't save the setting."), 'updateSettings', { patch })}-export const refreshEngines = (): void => void call('refreshEngines')+export const refreshEngines = (): void => void fire(L('Não consegui conferir os modelos.', "I couldn't check the models."), 'refreshEngines')export const voiceStatus = (): Promise<VoiceStatus> => call('voiceStatus')export const voiceDownload = (model: VoiceModelId): Promise<void> => call('voiceDownload', { model })export const voiceCancelDownload = (): Promise<void> => call('voiceCancelDownload')@@ -360,7 +418,7 @@ export type InstalledApp = { name: string; bundleId?: string; path?: string; runexport const installedApps = (): Promise<InstalledApp[]> => call('installedApps')export const openApps = (): Promise<{ name: string; bundleId?: string }[]> => call('openApps')export const installDesktop = (): Promise<{ opened: boolean; command: string; needsNode?: boolean }> => call('installDesktop')-export const desktopPermissions = (): void => void call('desktopPermissions')+export const desktopPermissions = (): void => void fire(L('Não consegui abrir as permissões.', "I couldn't open the permissions."), 'desktopPermissions')export function saveAgent(agent: Agent, channelIds: string[]): Promise<void> {return call('saveAgent', { agent, channelIds })@@ -402,7 +460,7 @@ export const ensureTuca = (modelId?: string, fresh = false): Promise<{ agentId:export const createFromDraft = (messageId: string): Promise<{ agentId: string; conversationId: string }> => call('createFromDraft', { messageId })// The builder screen, in place of the app; closing it comes back here.export const openTuca = (): void => navigate({ kind: 'tuca', from: state.view?.kind === 'tuca' ? state.view.from : (state.view ?? undefined) })-export const settleDraft = (messageId: string, agentId?: string): void => void call('settleDraft', { messageId, agentId })+export const settleDraft = (messageId: string, agentId?: string): void => void fire(L('Não consegui salvar o cartão.', "I couldn't save the card."), 'settleDraft', { messageId, agentId })export async function openDm(agentId: string): Promise<void> {const id = await call('openDm', { agentId })@@ -415,15 +473,18 @@ export function setGrant(agentId: string, connectorId: string, level: GrantLevel}export const updateTool = (connectorId: string, name: string, patch: Partial<Pick<ConnectorTool, 'cls' | 'enabled' | 'highRisk'>>): void =>- void call('updateTool', { connectorId, name, patch })+ void fire(L('Não consegui salvar a ferramenta.', "I couldn't save the tool."), 'updateTool', { connectorId, name, patch })export const addConnector = (input: ConnectorInput): Promise<string> => call('addConnector', { input })-export const removeConnector = (id: string): void => void call('removeConnector', { id })-export const reconnectConnector = (id: string): void => void call('reconnectConnector', { id })+export const removeConnector = (id: string): void => void fire(L('Não consegui remover o conector.', "I couldn't remove the connector."), 'removeConnector', { id })+export const reconnectConnector = (id: string): void => void fire(L('Não consegui reconectar.', "I couldn't reconnect."), 'reconnectConnector', { id })export const setConnectorToken = (id: string, token: string): Promise<void> => call('setConnectorToken', { id, token })// On a server the authorization page comes back to be opened here, then pasted back.export const authorizeConnector = (id: string): void =>- void call('authorizeConnector', { id }).then((r) => r.url && openDialog({ kind: 'oauth', id, url: r.url }))+ void call('authorizeConnector', { id }).then(+ (r) => r.url && openDialog({ kind: 'oauth', id, url: r.url }),+ (e: unknown) => state.coreDown || toast(`${L('Não consegui abrir a autorização.', "I couldn't open the authorization.")} ${e instanceof Error ? e.message : ''}`.trim())+ )export const finishConnectorAuth = (url: string): Promise<boolean> => call('finishConnectorAuth', { url })export const harnessMcps = (): Promise<HarnessMcp[]> => call('harnessMcps')export const importHarnessMcp = (key: string): Promise<string> => call('importHarnessMcp', { key })@@ -436,31 +497,32 @@ export const deleteConversation = (id: string): Promise<void> => call('deleteConexport const markRead = (id: string): void => set((s) => ({ ...s, conversations: s.conversations.map((c) => (c.id === id ? { ...c, unread: 0 } : c)) }))export const sendMessage = (conversationId: string, text: string, images: ImageUpload[] = []): void => {- if (text.trim() || images.length) void call('sendMessage', { conversationId, text, ...(images.length ? { images } : {}) })+ if (text.trim() || images.length) void fire(L('Não consegui enviar a mensagem.', "I couldn't send the message."), 'sendMessage', { conversationId, text, ...(images.length ? { images } : {}) })}-export const stopRun = (messageId: string): void => void call('stopRun', { messageId })-export const retryRun = (messageId: string): void => void call('retryRun', { messageId })-export const continueRun = (messageId: string): void => void call('continueRun', { messageId })+export const stopRun = (messageId: string): void => void fire(L('Não consegui parar a resposta.', "I couldn't stop the reply."), 'stopRun', { messageId })+export const retryRun = (messageId: string): void => void fire(L('Não consegui tentar de novo.', "I couldn't try again."), 'retryRun', { messageId })+export const continueRun = (messageId: string): void => void fire(L('Não consegui continuar a resposta.', "I couldn't continue the reply."), 'continueRun', { messageId })export const decideApproval = (id: string, decision: 'approved' | 'refused', reason?: string, always?: boolean): void =>- void call('decideApproval', { id, decision, reason, always })--export const addMemory = (scope: MemoryScope, text: string): void => void call('addMemory', { scope, text })-export const editMemory = (id: string, text: string): void => void call('editMemory', { id, text })-export const confirmMemory = (id: string): void => void call('confirmMemory', { id })-export const decideMemory = (id: string, accept: boolean): void => void call('decideMemory', { id, accept })-export const forgetMemory = (id: string, reason?: string): void => void call('forgetMemory', { id, reason })-export const purgeMemory = (id: string): void => void call('purgeMemory', { id })-export const editSummary = (conversationId: string, text: string): void => void call('editSummary', { conversationId, text })-export const summarizeNow = (conversationId: string): void => void call('summarizeNow', { conversationId })+ void fire(decision === 'approved' ? L('Não consegui aprovar.', "I couldn't approve it.") : L('Não consegui recusar.', "I couldn't refuse it."), 'decideApproval', { id, decision, reason, always })++const memoryFailed = (): string => L('Não consegui salvar a memória.', "I couldn't save the memory.")+export const addMemory = (scope: MemoryScope, text: string): void => void fire(memoryFailed(), 'addMemory', { scope, text })+export const editMemory = (id: string, text: string): void => void fire(memoryFailed(), 'editMemory', { id, text })+export const confirmMemory = (id: string): void => void fire(memoryFailed(), 'confirmMemory', { id })+export const decideMemory = (id: string, accept: boolean): void => void fire(memoryFailed(), 'decideMemory', { id, accept })+export const forgetMemory = (id: string, reason?: string): void => void fire(L('Não consegui esquecer a memória.', "I couldn't forget the memory."), 'forgetMemory', { id, reason })+export const purgeMemory = (id: string): void => void fire(L('Não consegui apagar a memória.', "I couldn't delete the memory."), 'purgeMemory', { id })+export const editSummary = (conversationId: string, text: string): void => void fire(L('Não consegui salvar o resumo.', "I couldn't save the summary."), 'editSummary', { conversationId, text })+export const summarizeNow = (conversationId: string): void => void fire(L('Não consegui resumir a conversa.', "I couldn't summarize the conversation."), 'summarizeNow', { conversationId })// Saves one field of a stored agent without touching the rest of its page.export function patchAgent(agentId: string, patch: Partial<Agent>): void {const agent = agentById(state, agentId)if (!agent) returnconst channelIds = state.conversations.filter((c) => c.kind === 'channel' && c.members.includes(agentId)).map((c) => c.id)- void saveAgent({ ...agent, ...patch }, channelIds)+ void fire(L('Não consegui salvar o agente.', "I couldn't save the agent."), 'saveAgent', { agent: { ...agent, ...patch }, channelIds })}export const localPath = (messageId: string, path: string): Promise<LocalInfo | null> => call('localPath', { messageId, path })@@ -473,9 +535,9 @@ export const moveLightbox = (by: number): void =>export const openDialog = (dialog: Dialog | null): void => set((s) => ({ ...s, dialog, navOpen: dialog ? false : s.navOpen }))export const setTab = (page: string, tab: string): void => set((s) => ({ ...s, tabs: { ...s.tabs, [page]: tab } }))export const computerAction = (agentId: string, action: 'start' | 'restart' | 'erase' | 'open_folder' | 'refresh'): void =>- void call('computerAction', { agentId, action })-export const stopService = (agentId: string, name: string): void => void call('stopService', { agentId, name })-export const browserAction = (agentId: string, action: 'show' | 'hide' | 'clear'): void => void call('browserAction', { agentId, action })+ void fire(L('Não consegui mexer no computador do agente.', "I couldn't act on the agent's computer."), 'computerAction', { agentId, action })+export const stopService = (agentId: string, name: string): void => void fire(L('Não consegui parar o serviço.', "I couldn't stop the service."), 'stopService', { agentId, name })+export const browserAction = (agentId: string, action: 'show' | 'hide' | 'clear'): void => void fire(L('Não consegui mexer no navegador do agente.', "I couldn't act on the agent's browser."), 'browserAction', { agentId, action })// Tucano as a server: the page is in a browser and the agent's has no window, so I// drive it from its picture in the panel.export const windowless = (): boolean => !!(window as { __TUCANO_WEB__?: boolean }).__TUCANO_WEB__@@ -485,7 +547,7 @@ export const reachable = (url: string): string => (windowless() ? url.replace(/^export const browserInput = (agentId: string, input: BrowserInput): void => void call('browserInput', { agentId, input }).catch(() => {})// In a browser (Tucano as a server) the page opens it itself: the server has no screen.export const openExternal = (url: string): void =>- (window as { __TUCANO_WEB__?: boolean }).__TUCANO_WEB__ ? void window.open(url, '_blank', 'noopener') : void call('openExternal', { url })+ (window as { __TUCANO_WEB__?: boolean }).__TUCANO_WEB__ ? void window.open(url, '_blank', 'noopener') : void fire(L('Não consegui abrir o link.', "I couldn't open the link."), 'openExternal', { url })export const saveRoutine = (routine: RoutineInput): Promise<Routine> => call('saveRoutine', { routine })export const setJevKey = (key: string | null): Promise<void> => call('setJevKey', { key })@@ -494,24 +556,26 @@ export const testEngine = (model: string): Promise<{ ok: boolean; message: strinexport const saveSkill = (skill: SkillInput): Promise<Skill> => call('saveSkill', { skill })export const localSkills = (): Promise<LocalSkill[]> => call('localSkills')export const linkSkill = (source: string, agents: string[] = []): Promise<Skill> => call('linkSkill', { source, agents })-export const decideSkill = (id: string, approve: boolean): void => void call('decideSkill', { id, approve })-export const restoreSkill = (skillId: string, versionId: number): void => void call('restoreSkill', { skillId, versionId })-export const archiveSkill = (id: string, archived: boolean): void => void call('archiveSkill', { id, archived })-export const removeSkill = (id: string): void => void call('removeSkill', { id })+export const decideSkill = (id: string, approve: boolean): void =>+ void fire(approve ? L('Não consegui aprovar a skill.', "I couldn't approve the skill.") : L('Não consegui recusar a skill.', "I couldn't refuse the skill."), 'decideSkill', { id, approve })+export const restoreSkill = (skillId: string, versionId: number): void => void fire(L('Não consegui restaurar a versão.', "I couldn't restore the version."), 'restoreSkill', { skillId, versionId })+export const archiveSkill = (id: string, archived: boolean): void =>+ void fire(archived ? L('Não consegui arquivar a skill.', "I couldn't archive the skill.") : L('Não consegui reativar a skill.', "I couldn't bring the skill back."), 'archiveSkill', { id, archived })+export const removeSkill = (id: string): void => void fire(L('Não consegui remover a skill.', "I couldn't remove the skill."), 'removeSkill', { id })export const skillVersions = (skillId: string): Promise<SkillVersion[]> => call('skillVersions', { skillId })export const checkTrigger = (trigger: Trigger): Promise<string> => call('checkTrigger', { trigger })export const setTelegramToken = (token: string | null): Promise<void> => call('setTelegramToken', { token })-export const unpairTelegram = (): void => void call('unpairTelegram')+export const unpairTelegram = (): void => void fire(L('Não consegui desconectar o Telegram.', "I couldn't disconnect Telegram."), 'unpairTelegram')export const setGithubToken = (token: string | null): Promise<void> => call('setGithubToken', { token })export const exportTeam = (): Promise<string> => call('exportTeam')export const importTeam = (text: string): Promise<string> => call('importTeam', { text })export const importAgents = (p: { path?: string; data?: string }): Promise<string> => call('importAgents', p)export const backupNow = (): Promise<string> => call('backupNow')-export const openBackups = (): void => void call('openBackups')+export const openBackups = (): void => void fire(L('Não consegui abrir a pasta de backups.', "I couldn't open the backups folder."), 'openBackups')export const loadReport = (week?: number): Promise<Report> => call('report', { week })export const loadUsage = (): Promise<UsageReport> => call('usage')-export const removeRoutine = (id: string): void => void call('removeRoutine', { id })-export const runRoutine = (id: string): void => void call('runRoutine', { id })+export const removeRoutine = (id: string): void => void fire(L('Não consegui remover a rotina.', "I couldn't remove the routine."), 'removeRoutine', { id })+export const runRoutine = (id: string): void => void fire(L('Não consegui rodar a rotina.', "I couldn't run the routine."), 'runRoutine', { id })// A @handle from a name: "Lúcia M." → "luciam".export const slug = (name: string): string =>name@@ -536,4 +600,5 @@ export async function lendFolder(agentId: string): Promise<string | null> {}}-export const folderAction = (agentId: string, name: string, action: 'read_only' | 'read_write' | 'return'): void => void call('folderAction', { agentId, name, action })+export const folderAction = (agentId: string, name: string, action: 'read_only' | 'read_write' | 'return'): void =>+ void fire(L('Não consegui mudar o acesso à pasta.', "I couldn't change the folder's access."), 'folderAction', { agentId, name, action })diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.cssindex c10b4bf..02038d4 100644--- a/src/renderer/src/styles.css+++ b/src/renderer/src/styles.css@@ -40,7 +40,23 @@--radius: 9px;--radius-lg: 14px;- --ease: cubic-bezier(0.2, 0.8, 0.2, 1);+ /* Motion: one set of beats for the whole app. Instant answers a press, fast is a+ hover, base a small change (a chevron, a toggle, a menu), enter something+ arriving, slow a step or a bar, data a chart drawing itself, loop a pulse. */+ --dur-instant: 80ms;+ --dur-fast: 120ms;+ --dur-base: 180ms;+ --dur-enter: 240ms;+ --dur-slow: 400ms;+ --dur-data: 700ms;+ --dur-loop: 1.4s;+ --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);+ --ease-in: cubic-bezier(0.4, 0, 1, 1);+ --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);+ --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);+ --ease: var(--ease-out); /* alias */+ /* What a control eases on hover, focus and press. */+ --transition-ui: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);--font: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;--mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;color-scheme: light;@@ -138,6 +154,8 @@ button {padding: 0;cursor: pointer;text-align: inherit;+ /* Hover, focus and press ease the same everywhere; a class with its own transition wins. */+ transition: var(--transition-ui);}input,textarea,@@ -150,7 +168,7 @@ select {padding: 7px 10px;width: 100%;outline: none;- transition: border-color 0.12s, box-shadow 0.12s;+ transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);}input:focus,textarea:focus,@@ -158,6 +176,14 @@ select:focus {border-color: var(--accent);box-shadow: 0 0 0 3px var(--accent-soft);}+/* The keyboard's focus wears the fields' ring, on buttons and links too. */+button:focus-visible,+a:focus-visible,+[role='button']:focus-visible,+[role='switch']:focus-visible {+ outline: none;+ box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);+}textarea {resize: vertical;}@@ -219,9 +245,12 @@ h3 {}.link {color: var(--accent);+ text-decoration: underline;+ text-decoration-color: transparent;+ transition: var(--transition-ui), text-decoration-color var(--dur-fast) var(--ease-out);}.link:hover {- text-decoration: underline;+ text-decoration-color: currentColor;}::-webkit-scrollbar {width: 10px;@@ -254,12 +283,116 @@ h3 {box-shadow: var(--shadow-panel);}.main > * {- animation: view-in 0.22s var(--ease) both;+ animation: rise var(--dur-enter) var(--ease-out) both;+}++/* ---------- motion: the few moves everything uses ---------- */+/* Their knobs don't inherit: a step that slides sideways mustn't send its messages sideways too. */+@property --rise {+ syntax: '<length>';+ inherits: false;+ initial-value: 4px;+}+@property --rise-x {+ syntax: '<length>';+ inherits: false;+ initial-value: 0px;+}+@property --pop-y {+ syntax: '<length>';+ inherits: false;+ initial-value: 4px;+}+@property --pop-scale {+ syntax: '<number>';+ inherits: false;+ initial-value: 0.98;+}+@property --pulse-min {+ syntax: '<number>';+ inherits: false;+ initial-value: 0.3;+}+@property --halo-scale {+ syntax: '<number>';+ inherits: false;+ initial-value: 2.5;+}+@property --halo-from {+ syntax: '<number>';+ inherits: false;+ initial-value: 0.35;+}+@property --flash-spread {+ syntax: '<length>';+ inherits: false;+ initial-value: 0px;+}+@property --happy-y {+ syntax: '<length-percentage>';+ inherits: false;+ initial-value: -20%;+}+/* Something arriving: up a few pixels (--rise), or across (--rise-x), from clear. */+@keyframes rise {+ from {+ opacity: 0;+ transform: translate(var(--rise-x, 0), var(--rise, 4px));+ }}-@keyframes view-in {+/* Something opening over the page (a window, a menu, a badge): from a bit smaller. */+@keyframes pop {from {opacity: 0;- transform: translateY(4px);+ transform: translateY(var(--pop-y, 4px)) scale(var(--pop-scale, 0.98));+ }+}+@keyframes fade {+ from {+ opacity: 0;+ }+}+/* Alive by opacity alone: down to --pulse-min and back (it moves nothing, so it stays with reduced motion). */+@keyframes fade-pulse {+ 50% {+ opacity: var(--pulse-min, 0.3);+ }+}+/* A ring leaving a dot (the dot's ::after, background: inherit): it grows and fades. */+@keyframes halo {+ from {+ opacity: var(--halo-from, 0.35);+ transform: scale(1);+ }+ to {+ opacity: 0;+ transform: scale(var(--halo-scale, 2.5));+ }+}+/* Once, to say "this is new": a tint that holds and goes (--flash). */+@keyframes flash {+ 0%,+ 40% {+ background-color: var(--flash, var(--accent-soft));+ box-shadow: 0 0 0 var(--flash-spread, 0) var(--flash, var(--accent-soft));+ }+}+/* A field that won't take what was typed: no, no. */+@keyframes shake {+ 25% {+ transform: translateX(-4px);+ }+ 50% {+ transform: translateX(4px);+ }+ 75% {+ transform: translateX(-2px);+ }+}+/* A check drawn by its own pen (stroke-dasharray on the path). */+@keyframes draw {+ from {+ stroke-dashoffset: var(--draw-length, 26);}}@@ -344,7 +477,7 @@ h3 {}.fold-toggle svg {flex-shrink: 0;- transition: transform 0.15s var(--ease);+ transition: transform var(--dur-base) var(--ease-out);}.fold-toggle[aria-expanded='true'] svg {transform: rotate(90deg);@@ -353,6 +486,10 @@ h3 {.is-folded .nav-item:not(.is-active) {display: none;}+/* A row that shows up (a new one, or its section unfolding) rises into place. */+.section .nav-item {+ animation: rise var(--dur-enter) var(--ease-out) backwards;+}.nav-item {width: 100%;display: flex;@@ -362,7 +499,7 @@ h3 {border-radius: 8px;color: var(--text-2);min-height: 31px;- transition: background 0.15s var(--ease), color 0.15s var(--ease);+ transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);}.nav-item:hover {background: var(--hover);@@ -405,6 +542,10 @@ h3 {line-height: 18px;min-width: 18px;text-align: center;+ /* A new count pops in (the badge is keyed by its number, so it pops on each one). */+ --pop-scale: 0.6;+ --pop-y: 0;+ animation: pop var(--dur-enter) var(--ease-spring) backwards;}.badge--soft {background: var(--accent);@@ -425,12 +566,13 @@ h3 {height: 7px;border-radius: 50%;background: var(--accent);- animation: pulse 1.2s ease-in-out infinite;+ animation: fade-pulse var(--dur-loop) var(--ease-in-out) infinite;+ transition: background-color var(--dur-base) var(--ease-out);}-@keyframes pulse {- 50% {- opacity: 0.3;- }+/* Just finished: green for a moment, then it fades out instead of vanishing. */+.pulse.is-done {+ background: var(--ok);+ animation: fade var(--dur-enter) var(--ease-in) 1.2s reverse forwards;}.inline-form {display: flex;@@ -449,6 +591,7 @@ h3 {place-items: center;border-radius: 6px;color: var(--text-2);+ transition: var(--transition-ui);}.icon-btn:hover {background: var(--hover);@@ -512,7 +655,7 @@ h3 {.c-graphite .avatar__eyes i { animation-duration: 5.3s; animation-delay: 2.8s; }/* At work: the eyes read, left to right, and come back. */.avatar.is-busy .avatar__eyes {- animation: read 1.8s var(--ease) infinite;+ animation: read 1.8s var(--ease-out) infinite;}@keyframes read {0%,@@ -526,6 +669,36 @@ h3 {transform: translate(14%, 8%);}}+/* Just finished: one happy squint (eyes squashed into arcs), then back to blinking. */+.avatar.is-happy .avatar__eyes i {+ animation: happy 500ms var(--ease-out);+}+@keyframes happy {+ 30%,+ 70% {+ transform: scaleY(0.4) translateY(var(--happy-y, -20%));+ border-radius: 50% 50% 12% 12%;+ }+}+/* The Tuca at work: his lower beak goes, as if muttering. Done: the same squint. */+.avatar--tuca .tuca__jaw {+ transform-origin: 53px 57px;+}+.avatar--tuca.is-busy .tuca__jaw {+ animation: chew 1.2s var(--ease-in-out) infinite;+}+@keyframes chew {+ 50% {+ transform: rotate(7deg);+ }+}+.avatar--tuca .tuca__eye {+ transform-origin: 38px 47px;+}+.avatar--tuca.is-happy .tuca__eye {+ --happy-y: 0;+ animation: happy 500ms var(--ease-out);+}.c-sky { --agent: var(--c-sky); }.c-indigo { --agent: var(--c-indigo); }.c-violet { --agent: var(--c-violet); }@@ -636,11 +809,37 @@ h3 {font-weight: 500;font-size: 13px;white-space: nowrap;- transition: background 0.12s, border-color 0.12s;+ transition: var(--transition-ui);}.btn:hover {background: var(--hover);}+/* A press answers at once: buttons give a little under the pointer; rows that span+ the width darken instead (a whole row shrinking reads as a glitch). */+.btn:active:not(:disabled),+.icon-btn:active,+.segmented button:active,+.days button:active,+.cal-nav button:active:not(:disabled),+.onb-chip:active {+ transform: scale(0.97);+ transition-duration: var(--dur-instant);+}+.nav-item:active:not(.is-active),+.member:active,+.search__hit:active,+.mention-menu__item:active,+.table__row--btn:active,+.usage-agent:active {+ background-color: var(--active);+ transition-duration: var(--dur-instant);+}+.menu__item:active {+ background-color: color-mix(in srgb, var(--accent) 86%, #000);+}+.menu__item.is-danger:active {+ background-color: color-mix(in srgb, var(--danger) 86%, #000);+}.btn:disabled {opacity: 0.45;cursor: default;@@ -685,12 +884,20 @@ h3 {overflow: hidden;user-select: none;}+/* Held, the light fills the button in 1.5s (linear: it's a clock) and the approval+ goes on transitionend; let go and it drains back. */.btn--hold::before {content: '';position: absolute;inset: 0;- width: var(--hold, 0%);background: rgba(255, 255, 255, 0.28);+ transform: scaleX(0);+ transform-origin: left;+ transition: transform var(--dur-base) var(--ease-out);+}+.btn--hold.is-holding::before {+ transform: scaleX(1);+ transition: transform 1.5s linear;}.btn--hold span {position: relative;@@ -699,6 +906,7 @@ h3 {color: var(--ok);font-size: 12.5px;font-weight: 500;+ animation: fade var(--dur-fast) var(--ease-out) backwards;}/* ---------- conversation ---------- */@@ -741,7 +949,7 @@ h3 {.sleeping-toucan__z {fill: var(--text-3);font-family: var(--font);- animation: drift 3.2s var(--ease) infinite;+ animation: drift 3.2s var(--ease-out) infinite;}.sleeping-toucan__z--2 {animation-delay: 1.6s;@@ -776,13 +984,13 @@ h3 {}/* What just arrived comes in, lightly. */.msg:nth-last-child(-n + 2) {- animation: msg-in 0.26s var(--ease) both;+ --rise: 6px;+ animation: rise var(--dur-enter) var(--ease-out) both;}-@keyframes msg-in {- from {- opacity: 0;- transform: translateY(6px);- }+/* A reply's text, arriving after its steps, rises in on its own. */+.msg--agent:nth-last-child(-n + 2) .md {+ --rise: 4px;+ animation: rise var(--dur-base) var(--ease-out) backwards;}.msg--grouped {padding-top: 1px;@@ -873,6 +1081,15 @@ h3 {right: 6px;background: var(--code-bg);}+/* Copied: the check pops in green. */+.md-code__copy.is-copied {+ color: var(--ok);+}+.md-code__copy.is-copied .icon {+ --pop-scale: 0.6;+ --pop-y: 0;+ animation: pop var(--dur-enter) var(--ease-spring);+}.md table {display: block; /* a wide table scrolls by itself, with its words whole */overflow-x: auto;@@ -926,36 +1143,6 @@ h3 {color: var(--text-3);margin-top: 4px;}-.typing {- display: flex;- gap: 4px;- padding: 8px 0;-}-.typing i {- width: 6px;- height: 6px;- border-radius: 50%;- background: var(--text-3);- animation: typing 1s infinite ease-in-out;-}-.typing i:nth-child(2) {- animation-delay: 0.15s;-}-.typing i:nth-child(3) {- animation-delay: 0.3s;-}-@keyframes typing {- 0%,- 80%,- 100% {- opacity: 0.25;- transform: translateY(0);- }- 40% {- opacity: 1;- transform: translateY(-3px);- }-}/* run steps: one quiet line, alive while working; the list opens on a click */.steps {@@ -971,7 +1158,7 @@ h3 {margin-left: -7px;border-radius: 8px;color: var(--text-3);- transition: background 0.15s var(--ease), color 0.15s var(--ease);+ transition: var(--transition-ui);}.steps__toggle:hover {background: var(--hover);@@ -979,26 +1166,42 @@ h3 {}.steps__chev {display: inline-flex;- transition: transform 0.18s var(--ease);+ transition: transform var(--dur-base) var(--ease-out);+}+/* Done: the label crossfades from the shimmer to the count, the chevron comes back. */+.steps__chev,+.steps__summary,+.steps__failed {+ animation: fade var(--dur-base) var(--ease-out) backwards;}.steps.is-open .steps__chev {transform: rotate(90deg);}.steps__pulse {+ position: relative;width: 8px;height: 8px;border-radius: 50%;background: var(--accent);- box-shadow: 0 0 0 0 var(--accent-soft);- animation: alive 1.4s var(--ease) infinite;}-@keyframes alive {- 70% {- box-shadow: 0 0 0 6px transparent;- }- 100% {- box-shadow: 0 0 0 0 transparent;- }+/* The live dots ring outward: a ::after that grows and fades (transform and opacity, no repaint). */+.steps__pulse::after,+.cal-watch__chip > i::after {+ content: '';+ position: absolute;+ inset: 0;+ border-radius: 50%;+ background: inherit;+ pointer-events: none;+ animation: halo var(--dur-loop) var(--ease-out) infinite;+}+/* Finished: the pulse becomes a green check, with a small bounce. */+.steps__done {+ display: inline-flex;+ color: var(--ok);+ --pop-scale: 0.5;+ --pop-y: 0;+ animation: pop var(--dur-enter) var(--ease-spring) backwards;}.steps__elapsed {font-variant-numeric: tabular-nums;@@ -1015,7 +1218,7 @@ h3 {margin: 4px 0 6px 3px;padding: 2px 0 2px 14px;border-left: 2px solid var(--border);- animation: view-in 0.2s var(--ease) both;+ animation: rise var(--dur-base) var(--ease-out) both;}.step {display: flex;@@ -1030,6 +1233,7 @@ h3 {display: grid;place-items: center;flex: none;+ transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);}.step--done .step__icon {background: var(--ok-soft);@@ -1095,7 +1299,7 @@ h3 {color: var(--text-3);font-variant-numeric: tabular-nums;opacity: 0;- transition: opacity 0.15s var(--ease);+ transition: opacity var(--dur-fast) var(--ease-out);}.msg:hover .receipt__line,.receipt:has(.receipt__table) .receipt__line {@@ -1127,6 +1331,7 @@ h3 {/* approval card */.approval {+ position: relative;margin: 10px 0 4px;max-width: 560px;border: 1px solid var(--border-strong);@@ -1135,6 +1340,44 @@ h3 {padding: 12px 14px;background: var(--panel);box-shadow: var(--shadow);+ transition: border-left-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);+}+/* A request (or a question) arriving: it rises in, rings twice to be seen, and goes quiet. */+.approval--pending,+.question:not(.is-answered) {+ --rise: 6px;+ animation: rise 280ms var(--ease-out) backwards;+}+.approval--pending::after,+.question:not(.is-answered)::after {+ content: '';+ position: absolute;+ inset: -1px;+ border-radius: inherit;+ box-shadow: 0 0 0 4px var(--ring, var(--warn-soft));+ opacity: 0;+ pointer-events: none;+ --pulse-min: 1;+ animation: fade-pulse 800ms var(--ease-in-out) 280ms 2;+}+.approval--pending::after {+ inset: -1px -1px -1px -3px;+}+.approval--pending .approval__badge .icon {+ animation: nudge var(--dur-slow) var(--ease-spring) 280ms backwards;+}+@keyframes nudge {+ from {+ transform: rotate(-8deg);+ }+}+/* Decided: the badge pops into its new word and color. */+.approval--approved .approval__badge,+.approval--refused .approval__badge,+.approval--expired .approval__badge {+ --pop-scale: 0.8;+ --pop-y: 0;+ animation: pop var(--dur-enter) var(--ease-spring) backwards;}.approval--approved {border-left-color: var(--ok);@@ -1219,7 +1462,7 @@ h3 {border-radius: 20px;background: var(--panel);box-shadow: var(--shadow);- transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);+ transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);}.composer:focus-within {border-color: var(--border-strong);@@ -1258,6 +1501,8 @@ h3 {box-shadow: var(--shadow-lg);padding: 4px;z-index: 10;+ transform-origin: bottom left;+ animation: pop var(--dur-fast) var(--ease-out) backwards;}.mention-menu__item {width: 100%;@@ -1266,6 +1511,7 @@ h3 {gap: 8px;padding: 6px 8px;border-radius: 6px;+ transition: var(--transition-ui);}.mention-menu__item.is-active,.mention-menu__item:hover {@@ -1362,6 +1608,7 @@ h3 {}.field.has-error input {border-color: var(--danger);+ animation: shake 280ms var(--ease-out);}/* A field right after a loose hint line needs air, or its label reads as part of the hint. */.hint + .field {@@ -1404,7 +1651,7 @@ h3 {border-radius: 10px;background: transparent;box-shadow: inset 0 0 0 1px var(--border);- transition: box-shadow 0.12s;+ transition: box-shadow var(--dur-fast) var(--ease-out);}.look:hover {box-shadow: inset 0 0 0 1px var(--text-3);@@ -1418,7 +1665,7 @@ h3 {border-radius: 8px;background: var(--agent);box-shadow: 0 0 0 2px var(--panel), 0 0 0 2px transparent;- transition: box-shadow 0.12s;+ transition: box-shadow var(--dur-fast) var(--ease-out);}.swatch.is-active {box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--agent);@@ -1478,6 +1725,7 @@ h3 {border-radius: 6px;color: var(--text-2);white-space: nowrap;+ transition: var(--transition-ui);}.segmented button.is-active {background: var(--panel);@@ -1573,12 +1821,14 @@ h3 {overflow: hidden;width: 100%;}+/* The fill is full width, scaled to the share (transform: no layout on each change). */.budget__fill {display: block;+ width: 100%;height: 100%;- border-radius: 6px;background: var(--ok);- transition: width 0.4s ease;+ transform-origin: left;+ transition: transform var(--dur-slow) var(--ease-out), background-color var(--dur-base) var(--ease-out);}.budget--warn .budget__fill {background: var(--warn);@@ -1591,6 +1841,9 @@ h3 {flex-direction: column;gap: 16px;}+.stack-list > * {+ animation: rise var(--dur-enter) var(--ease-out) backwards;+}.stack-list .approval {max-width: 640px;margin: 0;@@ -1615,6 +1868,9 @@ h3 {.table__row:last-child {border-bottom: 0;}+.table > .table__row {+ animation: rise var(--dur-enter) var(--ease-out) backwards;+}.table__row--btn:hover {background: var(--hover);}@@ -1645,7 +1901,7 @@ h3 {.chev {display: inline-flex;color: var(--text-3);- transition: transform 0.15s;+ transition: transform var(--dur-base) var(--ease-out);}.chev.is-open {transform: rotate(90deg);@@ -1690,7 +1946,7 @@ h3 {border-radius: 10px;background: var(--border-strong);position: relative;- transition: background 0.15s;+ transition: background-color var(--dur-base) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);}.toggle::after {content: '';@@ -1701,7 +1957,8 @@ h3 {height: 14px;border-radius: 50%;background: #fff;- transition: transform 0.15s;+ transform-origin: left;+ transition: transform var(--dur-base) var(--ease-out);box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);}.toggle.is-on {@@ -1709,6 +1966,14 @@ h3 {}.toggle.is-on::after {transform: translateX(14px);+ transform-origin: right;+}+/* Pressed, the knob stretches toward where it's going. */+.toggle:active::after {+ transform: scaleX(1.15);+}+.toggle.is-on:active::after {+ transform: translateX(14px) scaleX(1.15);}.key-row {display: flex;@@ -1731,9 +1996,15 @@ h3 {flex-shrink: 0;}+/* An error arrives calm: it rises in on a red tint that fades, no shake. */.note--error {color: var(--danger);white-space: pre-wrap;+ border-radius: 4px;+ --rise: 4px;+ --flash: var(--danger-soft);+ --flash-spread: 4px;+ animation: rise var(--dur-base) var(--ease-out) backwards, flash 1.2s var(--ease-out);}.warn-text {color: var(--warn);@@ -1744,20 +2015,19 @@ h3 {}.system-line.is-pending p {- animation: pulse-text 1.4s ease-in-out infinite;-}-@keyframes pulse-text {- 50% {- opacity: 0.45;- }+ --pulse-min: 0.45;+ animation: fade-pulse var(--dur-loop) var(--ease-in-out) infinite;}.question {+ position: relative;+ --ring: var(--accent-soft);margin-top: 8px;border: 1px solid var(--accent);background: var(--accent-soft);border-radius: var(--radius);padding: 10px 12px;max-width: 560px;+ transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);}.question p {margin: 2px 0 0;@@ -1800,6 +2070,9 @@ h3 {/* ---------- memory ---------- */.summary {+ --rise: 0;+ --rise-x: 16px;+ animation: rise var(--dur-enter) var(--ease-out) backwards;margin: 0 20px;padding: 12px 14px;border: 1px solid var(--border);@@ -1825,6 +2098,7 @@ h3 {background: var(--active);}.memory-chip {+ animation: rise var(--dur-base) var(--ease-out) backwards;margin-top: 8px;display: flex;align-items: center;@@ -1912,7 +2186,11 @@ h3 {flex: 1;min-width: 0;}+/* The side panel slides in from its edge. */.side-panel {+ --rise: 0;+ --rise-x: 16px;+ animation: rise var(--dur-enter) var(--ease-out) backwards;width: min(48%, 760px);min-width: 360px;display: flex;@@ -2087,12 +2365,8 @@ h3 {height: 6px;border-radius: 50%;background: currentColor;- animation: live-pulse 1.4s ease-in-out infinite;-}-@keyframes live-pulse {- 50% {- opacity: 0.25;- }+ --pulse-min: 0.25;+ animation: fade-pulse var(--dur-loop) var(--ease-in-out) infinite;}.url-bar {display: flex;@@ -2153,15 +2427,17 @@ h3 {color: var(--text-3);font-size: 12.5px;}+/* As big as the screen and moved by transform (translate in % of itself, so of the+ screen): its top-left corner is where the agent points. No layout while it glides. */.screen__cursor {position: absolute;+ inset: 0;z-index: 2;pointer-events: none;line-height: 1;transition:- left 0.55s cubic-bezier(0.3, 0.7, 0.2, 1),- top 0.55s cubic-bezier(0.3, 0.7, 0.2, 1),- opacity 0.6s;+ transform var(--dur-slow) cubic-bezier(0.3, 0.7, 0.2, 1),+ opacity var(--dur-data) var(--ease-out);}.screen__cursor.is-idle {opacity: 0;@@ -2198,7 +2474,7 @@ h3 {border-radius: 50%;border: 2px solid var(--agent);opacity: 0;- animation: screen-ripple 0.9s ease-out 0.45s;+ animation: screen-ripple var(--dur-data) var(--ease-out) var(--dur-slow);}@keyframes screen-ripple {0% {@@ -2811,12 +3087,15 @@ table.csv th {display: flex;gap: 6px;}+/* The step you're on is longer: it stretches (scaleX) and the ones after it move+ over (translate), so the row never lays out again. */.onb__dots span {width: 22px;height: 4px;border-radius: 2px;background: var(--border-strong);- transition: background 0.3s, width 0.3s;+ transform-origin: left;+ transition: background-color var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);}.onb__dots span.is-done {background: var(--accent);@@ -2824,7 +3103,10 @@ table.csv th {}.onb__dots span.is-now {background: var(--accent);- width: 36px;+ transform: scaleX(1.6364); /* 36px */+}+.onb__dots span.is-now ~ span {+ transform: translateX(14px);}.onb__scroll {flex: 1;@@ -2836,12 +3118,41 @@ table.csv th {width: 100%;margin: auto; /* centered when it fits, scrolls from the top when it doesn't */padding: 28px 40px 48px;- animation: onb-in 0.35s ease both;+ /* Forward comes in from the right, back from the left (data-dir). */+ --rise: 0;+ --rise-x: 12px;+ animation: rise var(--dur-slow) var(--ease-out) both;}-@keyframes onb-in {- from {+.onb__stage[data-dir='back'] {+ --rise-x: -12px;+}+/* The end of the introduction: the Tuca cheers, then the channel opens. */+.onb-cheer {+ position: absolute;+ inset: 0;+ z-index: 5;+ display: grid;+ place-items: center;+ background: color-mix(in srgb, var(--bg) 72%, transparent);+ animation: fade var(--dur-base) var(--ease-out) both;+}+.onb-cheer .avatar--tuca {+ animation: cheer 650ms var(--ease-out) both;+}+@keyframes cheer {+ 0% {opacity: 0;- transform: translateY(8px);+ transform: scale(0.4) rotate(-12deg);+ }+ 45% {+ opacity: 1;+ transform: scale(1.08) rotate(8deg);+ }+ 70% {+ transform: scale(1) rotate(-5deg);+ }+ 100% {+ transform: none;}}.onb__split {@@ -3072,7 +3383,7 @@ table.csv th {flex-direction: column;align-items: flex-start;gap: 10px;- transition: border-color 0.2s, box-shadow 0.2s;+ transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);}.onb-engine.is-ready {border-color: var(--ok);@@ -3142,7 +3453,7 @@ table.csv th {font-size: 12px;color: var(--text-2);line-height: 1.35;- transition: border-color 0.15s, transform 0.15s;+ transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out);}.onb-template:hover {transform: translateY(-1px);@@ -3229,7 +3540,7 @@ table.csv th {border-radius: 999px;border: 1px dashed var(--border-strong);color: var(--text-3);- transition: all 0.2s;+ transition: border-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);}.onb-power.is-on {border: 1px solid var(--ok);@@ -3250,7 +3561,7 @@ table.csv th {margin: 0;}.onb-card .avatar {- transition: background 0.25s;+ transition: background-color var(--dur-enter) var(--ease-out);}/* powers */@@ -3382,6 +3693,8 @@ table.csv th {padding: 0 8px 8px;}.getting__bar {+ position: relative;+ overflow: hidden;display: flex;flex-direction: column;gap: 7px;@@ -3410,6 +3723,21 @@ table.csv th {.getting__bar.is-all .getting__label {color: var(--ok);}+/* All done: one gentle shine crosses the bar. */+.getting__bar.is-all::after {+ content: '';+ position: absolute;+ inset: 0;+ background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--ok) 22%, transparent) 50%, transparent 70%);+ transform: translateX(-100%);+ pointer-events: none;+ animation: shine 1.2s var(--ease-in-out) 300ms forwards;+}+@keyframes shine {+ to {+ transform: translateX(100%);+ }+}.getting__track {height: 4px;border-radius: 2px;@@ -3418,10 +3746,11 @@ table.csv th {}.getting__track span {display: block;+ width: 100%;height: 100%;background: var(--accent);- border-radius: 2px;- transition: width 0.5s ease;+ transform-origin: left;+ transition: transform var(--dur-slow) var(--ease-out), background-color var(--dur-base) var(--ease-out);}.getting__bar.is-all .getting__track span {background: var(--ok);@@ -3438,7 +3767,8 @@ table.csv th {border-radius: 14px;box-shadow: var(--shadow-lg);z-index: 40;- animation: onb-in 0.2s ease both;+ transform-origin: bottom left;+ animation: pop var(--dur-base) var(--ease-out) both;}.getting__head {display: flex;@@ -3488,6 +3818,14 @@ table.csv th {.getting__list li.is-done .getting__check {background: var(--ok);border-color: var(--ok);+ --pop-scale: 0.5;+ --pop-y: 0;+ animation: pop var(--dur-enter) var(--ease-spring) backwards;+}+/* Its check draws itself, a beat after the circle lands. */+.getting__check path {+ stroke-dasharray: 26;+ animation: draw 300ms var(--ease-out) 120ms backwards;}.getting__foot {display: flex;@@ -3528,12 +3866,7 @@ table.csv th {font-size: 12px;color: rgba(255, 253, 248, 0.75);text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);- animation: splash-fade 0.6s ease 1.5s both;-}-@keyframes splash-fade {- from {- opacity: 0;- }+ animation: fade var(--dur-data) var(--ease-out) 1.5s both;}.sp-black {position: absolute;@@ -3999,6 +4332,8 @@ table.csv th {background: var(--panel);border: 1px solid var(--border);box-shadow: var(--shadow-lg);+ transform-origin: top left;+ animation: pop var(--dur-fast) var(--ease-out) backwards;}.menu__item {display: flex;@@ -4009,6 +4344,7 @@ table.csv th {border-radius: 6px;font-size: 13px;color: var(--text);+ transition: var(--transition-ui);}.menu__item .icon {color: var(--text-2);@@ -4047,6 +4383,13 @@ table.csv th {display: grid;place-items: center;background: rgba(10, 10, 12, 0.35);+ animation: fade var(--dur-base) var(--ease-out) backwards;+}+/* Every window opens the same way: the shade fades, the card pops. */+.modal__card,+.form-modal,+.search {+ animation: pop var(--dur-base) var(--ease-out) backwards;}.modal__card {width: min(460px, calc(100vw - 32px));@@ -4081,6 +4424,14 @@ table.csv th {.modal__input input {margin-left: 4px;}+/* Saved empty: the field says no (a short shake) and stays red until you type. */+.modal__input.is-shaking {+ animation: shake 280ms var(--ease-out);+}+.modal__input.is-invalid input {+ border-color: var(--danger);+ box-shadow: 0 0 0 3px var(--danger-soft);+}.member-list {display: flex;flex-direction: column;@@ -4142,7 +4493,7 @@ table.csv th {font-size: 13.5px;color: var(--text-2);border-bottom: 2px solid transparent;- transition: color 0.15s var(--ease), border-color 0.15s var(--ease);+ transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);}.tabs button:hover {color: var(--text);@@ -4276,7 +4627,7 @@ kbd {background: rgba(0, 0, 0, 0.6);color: #fff;opacity: 0;- transition: opacity 0.12s;+ transition: opacity var(--dur-fast) var(--ease-out);}.composer__image:hover .composer__image-x {opacity: 1;@@ -4293,8 +4644,10 @@ kbd {background: var(--accent-soft);backdrop-filter: blur(2px);pointer-events: none;+ animation: fade var(--dur-fast) var(--ease-out) backwards;}.drop-overlay__card {+ animation: pop var(--dur-fast) var(--ease-out) backwards;display: flex;flex-direction: column;align-items: center;@@ -4428,7 +4781,28 @@ kbd {*::after {animation-duration: 0.01ms !important;animation-iteration-count: 1 !important;+ animation-delay: 0s !important;transition-duration: 0.01ms !important;+ transition-delay: 0s !important;+ }+ /* Status that only fades stays alive: an opacity pulse moves nothing on screen. */+ .pulse:not(.is-done),+ .live-badge i,+ .system-line.is-pending p {+ animation-duration: var(--dur-loop) !important;+ animation-iteration-count: infinite !important;+ }+ .shimmer {+ animation-duration: 1.6s !important;+ animation-iteration-count: infinite !important;+ }+ .pulse.is-done {+ animation-duration: var(--dur-enter) !important;+ animation-delay: 1.2s !important;+ }+ /* Holding to approve is a clock, not decoration: it keeps its 1.5s. */+ .btn--hold.is-holding::before {+ transition-duration: 1.5s !important;}}@@ -4539,7 +4913,7 @@ kbd {display: flex;align-items: flex-end;border-radius: 5px 5px 0 0;- transition: background 0.15s var(--ease);+ transition: background-color var(--dur-fast) var(--ease-out);}.usage-chart__day.is-hover {background: var(--hover);@@ -4551,7 +4925,7 @@ kbd {border-radius: 4px 4px 0 0;overflow: hidden;transform-origin: bottom;- animation: usage-grow 0.6s var(--ease) both;+ animation: usage-grow var(--dur-data) var(--ease-out) both;}.usage-chart__stack {animation-delay: calc(var(--i, 0) * 12ms);@@ -4606,18 +4980,13 @@ kbd {font-size: 12px;pointer-events: none;z-index: 2;- animation: usage-tip-in 0.12s var(--ease);+ --rise: 2px;+ animation: rise var(--dur-fast) var(--ease-out);}.usage-tip.is-left {left: auto;right: calc(100% - var(--x) + 16px);}-@keyframes usage-tip-in {- from {- opacity: 0;- transform: translateY(2px);- }-}.usage-tip__total {color: var(--text-2);margin-bottom: 3px;@@ -4694,7 +5063,7 @@ kbd {.usage-ring__fill {stroke: var(--accent);stroke-linecap: round;- transition: stroke-dashoffset 0.8s var(--ease);+ transition: stroke-dashoffset var(--dur-data) var(--ease-out);}.usage-ring.is-warn .usage-ring__fill {stroke: var(--warn);@@ -4719,7 +5088,7 @@ kbd {text-align: left;color: inherit;cursor: pointer;- transition: background 0.15s var(--ease);+ transition: background-color var(--dur-fast) var(--ease-out);}.usage-agent + .usage-agent {box-shadow: 0 -1px 0 var(--border);@@ -4734,7 +5103,7 @@ kbd {.usage-agent > .icon {color: var(--text-3);opacity: 0;- transition: opacity 0.15s var(--ease);+ transition: opacity var(--dur-fast) var(--ease-out);}.usage-agent:hover > .icon {opacity: 1;@@ -4787,7 +5156,7 @@ kbd {.usage-meter__fill {background: var(--ok);min-width: 3px;- animation: usage-fill 0.8s var(--ease) both;+ animation: usage-fill var(--dur-data) var(--ease-out) both;transform-origin: left;}.usage-meter__proj {@@ -4936,10 +5305,6 @@ kbd {.status-dot.is-danger {background: var(--danger);}-.status-dot.is-live {- background: var(--accent);- animation: alive 1.4s ease-in-out infinite;-}/* ---------- sheet: the cleaner page ---------- */.sheet {@@ -5027,7 +5392,7 @@ kbd {background: none;color: var(--text-3);font-size: 13.5px;- transition: color 0.15s var(--ease), border-color 0.15s var(--ease);+ transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);}.tabs-line > button:hover {color: var(--text);@@ -5146,7 +5511,7 @@ kbd {max-height: 0;opacity: 0;overflow: hidden;- transition: max-height 0.18s var(--ease), opacity 0.15s var(--ease), margin 0.18s var(--ease);+ transition: max-height var(--dur-base) var(--ease-out), opacity var(--dur-fast) var(--ease-out), margin var(--dur-base) var(--ease-out);}.read-line:hover .read-line__meta,.read-line:focus-within .read-line__meta,@@ -5259,7 +5624,7 @@ kbd {background: none;padding: 3px;border-radius: 9px;- transition: opacity 0.15s var(--ease), background 0.15s var(--ease);+ transition: opacity var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);}.cal-people button:hover {background: var(--hover);@@ -5299,16 +5664,16 @@ kbd {color: var(--text);}.cal-watch__chip > i {+ position: relative;width: 6px;height: 6px;border-radius: 50%;background: var(--ok);- animation: watch 2.2s ease-in-out infinite;}-@keyframes watch {- 50% {- box-shadow: 0 0 0 4px var(--ok-soft);- }+/* Watching is calmer than working: a slower ring (the halo above). */+.cal-watch__chip > i::after {+ --halo-scale: 2.4;+ animation-duration: 2.2s;}.cal-watch__chip.is-dim {opacity: 0.4;@@ -5426,14 +5791,9 @@ kbd {background: color-mix(in srgb, var(--agent) 14%, var(--panel));color: color-mix(in srgb, var(--agent) 60%, var(--text));box-shadow: inset 2.5px 0 0 var(--agent);- transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);- animation: cal-in 0.3s var(--ease) both;-}-@keyframes cal-in {- from {- opacity: 0;- transform: translateY(3px);- }+ transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);+ --rise: 3px;+ animation: rise var(--dur-enter) var(--ease-out) both;}.cal__ev:hover {transform: translateY(-1px);@@ -5475,7 +5835,8 @@ kbd {}.cal__ev.is-live {background: color-mix(in srgb, var(--agent) 20%, var(--panel));- animation: cal-live 1.6s ease-in-out infinite;+ /* Clipped (overflow: hidden), so its ring stays a box-shadow, on the shared beat. */+ animation: cal-live var(--dur-loop) var(--ease-in-out) infinite;}@keyframes cal-live {50% {@@ -5593,13 +5954,7 @@ kbd {border-radius: 14px;background: var(--panel);box-shadow: 0 0 0 1px rgba(60, 40, 20, 0.08), var(--shadow-lg);- animation: cal-pop 0.16s var(--ease);-}-@keyframes cal-pop {- from {- opacity: 0;- transform: translateY(4px) scale(0.98);- }+ animation: pop var(--dur-base) var(--ease-out);}.cal-pop__top {display: flex;@@ -5672,7 +6027,7 @@ kbd {border: 0;border-radius: 3px;background: var(--border-strong);- transition: transform 0.12s var(--ease);+ transition: transform var(--dur-fast) var(--ease-out);}.cal-pop__runs button:hover {transform: scale(1.35);@@ -5710,7 +6065,6 @@ kbd {overflow-y: auto;border-radius: var(--radius-lg);box-shadow: var(--shadow-lg);- animation: cal-pop 0.18s var(--ease);}.form-modal .card {margin: 0;@@ -5718,15 +6072,9 @@ kbd {/* A message opened from elsewhere (a routine's run) flashes once. */.messages > .is-flash {- animation: flash 1.8s var(--ease);+ animation: flash 1.8s var(--ease-out);border-radius: 12px;}-@keyframes flash {- 0%,- 40% {- background: var(--accent-soft);- }-}.sheet .page__scroll {overflow-x: hidden;@@ -5803,7 +6151,7 @@ kbd {color: var(--text-3);opacity: 0;transform: translateX(-4px);- transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);+ transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out);}.skill-line:hover > .icon {opacity: 1;@@ -6259,7 +6607,7 @@ kbd {font-size: 12.5px;color: var(--text-3);opacity: 0;- transition: opacity 0.15s var(--ease);+ transition: opacity var(--dur-fast) var(--ease-out);}.rep-problems button:hover .rep-problems__go {opacity: 1;@@ -6362,7 +6710,7 @@ kbd {z-index: 60;padding-top: env(safe-area-inset-top);transform: translateX(-102%);- transition: transform 0.22s var(--ease);+ transition: transform var(--dur-enter) var(--ease-out);box-shadow: var(--shadow-panel);}.app.is-nav-open .sidebar {@@ -6376,7 +6724,7 @@ kbd {background: rgba(0, 0, 0, 0.35);opacity: 0;pointer-events: none;- transition: opacity 0.2s var(--ease);+ transition: opacity var(--dur-base) var(--ease-out);}.app.is-nav-open .nav-shade {opacity: 1;@@ -6705,60 +7053,55 @@ kbd {.wk-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; border-top: 1px solid var(--border); }.wk-watch { margin: -4px 32px 12px; }.wk-watch__chip span:not(.wk-spin) { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.wk-watch__chip--pending > i { background: var(--accent); animation-name: wk-watch-accent; }-.wk-watch__chip--care > i { background: var(--warn); animation-name: wk-watch-warn; }-@keyframes wk-watch-accent { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }-@keyframes wk-watch-warn { 50% { box-shadow: 0 0 0 4px var(--warn-soft); } }+.wk-watch__chip--pending > i { background: var(--accent); }+.wk-watch__chip--care > i { background: var(--warn); }.wk-watch .wk-spin { width: 9px; height: 9px; color: var(--text-3); }.wk-foot { gap: 20px; }.wk-foot .text-btn { display: inline-flex; align-items: center; gap: 6px; }.wk-foot .grow { flex: 1; }-.wk-search-btn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 7px 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text-3); font: inherit; cursor: pointer; transition: border-color 0.15s, color 0.15s; }+.wk-search-btn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 7px 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text-3); font: inherit; cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }.wk-search-btn:hover { border-color: var(--border-strong); color: var(--text); }.wk-search-btn kbd, .wk-palette kbd { font: 600 10.5px var(--font); color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--bg); }.wk-icon-btn { width: 30px; padding: 0; justify-content: center; }.wk-kinds { display: flex; gap: 2px; padding-right: 12px; margin-right: 4px; border-right: 1px solid var(--border); }-.wk-kinds button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 0; border-radius: 7px; background: none; font: 500 12.5px var(--font); color: var(--text-2); cursor: pointer; transition: opacity 0.15s, background 0.15s; }+.wk-kinds button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 0; border-radius: 7px; background: none; font: 500 12.5px var(--font); color: var(--text-2); cursor: pointer; transition: opacity var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }.wk-kinds button:hover { background: var(--hover); }.wk-kinds button i { width: 8px; height: 8px; border-radius: 50%; background: var(--k); }.wk-kinds button.is-on { background: color-mix(in srgb, var(--k) 14%, transparent); color: var(--text); font-weight: 600; }.wk-kinds button.is-dim { opacity: 0.45; }-.wk-panel { position: absolute; z-index: 3; top: 12px; right: 12px; bottom: 12px; width: 560px; max-width: calc(100% - 24px); overflow-y: auto; background: var(--panel); border-radius: 18px; box-shadow: 0 0 0 1px var(--border), 0 24px 60px -20px rgba(40, 25, 10, 0.28), 0 8px 20px -12px rgba(40, 25, 10, 0.18); animation: wk-slide 0.34s var(--ease) both; }-@keyframes wk-slide { from { opacity: 0; transform: translateX(24px); } }+.wk-panel { position: absolute; z-index: 3; top: 12px; right: 12px; bottom: 12px; width: 560px; max-width: calc(100% - 24px); overflow-y: auto; background: var(--panel); border-radius: 18px; box-shadow: 0 0 0 1px var(--border), 0 24px 60px -20px rgba(40, 25, 10, 0.28), 0 8px 20px -12px rgba(40, 25, 10, 0.18); --rise: 0; --rise-x: 24px; animation: rise var(--dur-slow) var(--ease-out) both; }.wk-panel__close { position: sticky; top: 14px; float: right; margin: 14px 14px -44px 0; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; border: 0; background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(6px); color: var(--text-3); cursor: pointer; }.wk-panel__close:hover { background: var(--hover); color: var(--text); }-.wk-drop { position: absolute; inset: 12px; z-index: 5; display: grid; place-items: center; border-radius: 18px; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(4px); pointer-events: none; animation: wk-fade 0.15s both; }+.wk-drop { position: absolute; inset: 12px; z-index: 5; display: grid; place-items: center; border-radius: 18px; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(4px); pointer-events: none; animation: rise var(--dur-fast) var(--ease-out) both; }.wk-drop div { display: grid; justify-items: center; gap: 8px; color: var(--accent); }.wk-drop b { font-size: 18px; color: var(--text); }.wk-drop small { color: var(--text-2); }-@keyframes wk-fade { from { opacity: 0; transform: translateY(4px); } }/* pills, people, little badges */.wk-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 12px; border: 0; background: color-mix(in srgb, var(--k) 12%, transparent); color: color-mix(in srgb, var(--k) 78%, var(--text)); font: 600 12px var(--font); white-space: nowrap; }.wk-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--k); }.wk-pill--sm { height: 21px; font-size: 11.5px; padding: 0 8px 0 7px; }.wk-pill--ghost { --k: var(--text-3); background: transparent; border: 1px dashed var(--border-strong); color: var(--text-3); }-button.wk-pill { cursor: pointer; transition: background 0.15s, box-shadow 0.15s; }+button.wk-pill { cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }button.wk-pill:hover { background: color-mix(in srgb, var(--k) 20%, transparent); }button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(in srgb, var(--k) 20%, transparent); }.wk-who { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-weight: 700; }.wk-who--curator { background: linear-gradient(135deg, var(--accent), #f2a65a); color: #fff; }.wk-badge-file { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: color-mix(in srgb, var(--k) 13%, transparent); color: color-mix(in srgb, var(--k) 85%, var(--text)); font: 800 9.5px var(--font); letter-spacing: 0.03em; }.wk-badge-file--icon { --k: var(--text-3); color: var(--text-2); background: var(--hover); }-.wk-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: wk-spin 0.8s linear infinite; vertical-align: -1px; }-@keyframes wk-spin { to { transform: rotate(360deg); } }+.wk-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: -1px; }.wk-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }/* links in the text, and what they point to */-.wiki-link { display: inline; padding: 0 2px; margin: 0; border-radius: 4px; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; border: 0; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: background 0.12s, text-decoration-color 0.12s; }+.wiki-link { display: inline; padding: 0 2px; margin: 0; border-radius: 4px; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; border: 0; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: background-color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out); }.wiki-link:hover { background: var(--accent-soft); text-decoration-color: var(--accent); }.wiki-link.is-missing { color: var(--text-2); text-decoration-style: dashed; text-decoration-color: var(--text-3); }.wiki-link--source { display: inline-flex; align-items: center; gap: 3px; padding: 0 5px; text-decoration: none; color: var(--text-3); font-weight: 500; font-size: 0.78em; vertical-align: 1px; border-radius: 6px; background: var(--hover); }.wiki-link--source:hover { color: var(--text); background: var(--active); }-.wk-peek { position: fixed; z-index: 60; width: 320px; padding: 14px 16px; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); display: grid; gap: 6px; justify-items: start; animation: wk-fade 0.16s var(--ease) both; pointer-events: none; }+.wk-peek { position: fixed; z-index: 60; width: 320px; padding: 14px 16px; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); display: grid; gap: 6px; justify-items: start; animation: pop var(--dur-fast) var(--ease-out) both; pointer-events: none; }.wk-peek b { font-size: 15px; }.wk-peek p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }.wk-peek small { color: var(--text-3); font-size: 11.5px; }@@ -6767,25 +7110,24 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i.wk-canvas { position: absolute; inset: 0; cursor: grab; touch-action: none; user-select: none; background-image: radial-gradient(circle, color-mix(in srgb, var(--text-3) 32%, transparent) 1px, transparent 1.3px); }.wk-canvas.is-panning { cursor: grabbing; }.wk-canvas > svg { display: block; position: absolute; inset: 0; }-.wk-canvas__edges line { stroke: color-mix(in srgb, var(--text-3) 45%, transparent); stroke-width: 1.3; transition: opacity 0.25s, stroke 0.25s; }+.wk-canvas__edges line { stroke: color-mix(in srgb, var(--text-3) 45%, transparent); stroke-width: 1.3; transition: opacity var(--dur-enter) var(--ease-out), stroke var(--dur-enter) var(--ease-out); }.wk-canvas__edges line.is-hot { stroke: var(--accent); stroke-width: 2; }.wk-canvas__edges line.is-dim { opacity: 0.18; }-.wk-node { cursor: pointer; transition: opacity 0.25s; animation: wk-pop 0.6s var(--ease) both; animation-delay: calc(var(--i) * 22ms); }-@keyframes wk-pop { from { opacity: 0; } }+.wk-node { cursor: pointer; transition: opacity var(--dur-enter) var(--ease-out); animation: fade var(--dur-data) var(--ease-out) both; animation-delay: calc(var(--i) * 22ms); }.wk-node__hit { fill: transparent; }.wk-node__dot { fill: var(--k); stroke: var(--bg); stroke-width: 2.5; }-.wk-node__halo { fill: var(--k); opacity: 0; transition: opacity 0.2s; }+.wk-node__halo { fill: var(--k); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }.wk-node:hover .wk-node__halo, .wk-node.is-lit .wk-node__halo { opacity: 0.16; }-.wk-node.is-sel .wk-node__halo { opacity: 0.22; animation: wk-breathe 2.6s ease-in-out infinite; }+.wk-node.is-sel .wk-node__halo { opacity: 0.22; animation: wk-breathe 2.6s var(--ease-in-out) infinite; }@keyframes wk-breathe { 50% { opacity: 0.08; } }-.wk-node__ping { fill: none; stroke: var(--accent); stroke-width: 1.5; animation: wk-ping 2s ease-out infinite; transform-box: fill-box; transform-origin: center; }+.wk-node__ping { fill: none; stroke: var(--accent); stroke-width: 1.5; animation: wk-ping 2s var(--ease-out) infinite; transform-box: fill-box; transform-origin: center; }@keyframes wk-ping { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }-.wk-node text { font: 500 12px var(--font); fill: var(--text-2); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; transition: fill 0.2s; }+.wk-node text { font: 500 12px var(--font); fill: var(--text-2); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; transition: fill var(--dur-base) var(--ease-out); }.wk-node.is-lit text, .wk-node.is-sel text { fill: var(--text); font-weight: 650; }.wk-node.is-dim { opacity: 0.2; }.wk-node.is-missing .wk-node__dot { fill: var(--bg); stroke: var(--text-3); stroke-dasharray: 2.5 2.5; stroke-width: 1.4; }.wk-node.is-missing text { fill: var(--text-3); font-style: italic; }-.wk-zoom { position: absolute; bottom: 16px; z-index: 2; display: flex; border-radius: 10px; background: var(--panel); box-shadow: 0 0 0 1px var(--border), var(--shadow); overflow: hidden; transition: right 0.34s var(--ease); }+.wk-zoom { position: absolute; bottom: 16px; z-index: 2; display: flex; border-radius: 10px; background: var(--panel); box-shadow: 0 0 0 1px var(--border), var(--shadow); overflow: hidden; transition: right var(--dur-slow) var(--ease-out); }.wk-zoom button { width: 32px; height: 30px; border: 0; background: none; color: var(--text-2); font: 500 16px var(--font); cursor: pointer; display: grid; place-items: center; }.wk-zoom button + button { border-left: 1px solid var(--border); }.wk-zoom button:hover { background: var(--hover); color: var(--text); }@@ -6794,7 +7136,7 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i.wk-empty > * { max-width: 540px; }.wk-empty__art { width: 360px; max-width: 100%; overflow: visible; margin-bottom: 6px; }.wk-empty__art line { stroke: var(--border-strong); stroke-width: 1.4; stroke-dasharray: 3 4; }-.wk-empty__art circle { animation: wk-float 5s ease-in-out infinite; animation-delay: calc(var(--i) * -0.8s); }+.wk-empty__art circle { animation: wk-float 5s var(--ease-in-out) infinite; animation-delay: calc(var(--i) * -0.8s); }@keyframes wk-float { 50% { transform: translateY(-5px); } }.wk-empty h2 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }.wk-empty p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.6; }@@ -6802,7 +7144,7 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i/* search */.wk-palette-back { align-items: flex-start; padding-top: 12vh; }-.wk-palette { width: min(640px, 92vw); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); overflow: hidden; animation: wk-fade 0.16s var(--ease) both; }+.wk-palette { width: min(640px, 92vw); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); overflow: hidden; animation: pop var(--dur-base) var(--ease-out) both; }.wk-palette__input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); color: var(--text-3); }.wk-palette__input input, .wk-palette__input input:focus { flex: 1; border: 0; outline: 0; box-shadow: none; padding: 0; background: transparent; font: inherit; font-size: 17px; color: var(--text); }.wk-palette__list { max-height: 56vh; overflow-y: auto; padding: 8px; }@@ -6820,7 +7162,7 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i.wk-palette__new b { color: var(--text); }/* settings */-.wk-settings { width: min(560px, 94vw); display: grid; gap: 4px; padding: 22px 24px 24px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); animation: wk-fade 0.18s var(--ease) both; max-height: 88vh; overflow-y: auto; }+.wk-settings { width: min(560px, 94vw); display: grid; gap: 4px; padding: 22px 24px 24px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); animation: pop var(--dur-base) var(--ease-out) both; max-height: 88vh; overflow-y: auto; }.wk-settings header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }.wk-settings h2 { margin: 0; font-size: 19px; }.wk-settings section { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--border); }@@ -6881,7 +7223,7 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i.wk-add { display: grid; gap: 10px; }.wk-add__tile { display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); }-.wk-add__tile--file { cursor: pointer; border-style: dashed; border-width: 1.5px; transition: border-color 0.15s, background 0.15s; }+.wk-add__tile--file { cursor: pointer; border-style: dashed; border-width: 1.5px; transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }.wk-add__tile--file:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }.wk-add__tile b { font-size: 14px; margin-top: 4px; }.wk-add__tile small { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }@@ -6946,18 +7288,18 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i/* the editor */.wiki-editor { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; padding: 0 32px 24px; }.wiki-editor__head { display: grid; gap: 12px; }-.wiki-editor__title { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; padding: 4px 0; border: 0; border-bottom: 2px solid var(--border); background: transparent; color: var(--text); outline: 0; transition: border-color 0.2s; }+.wiki-editor__title { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; padding: 4px 0; border: 0; border-bottom: 2px solid var(--border); background: transparent; color: var(--text); outline: 0; transition: border-color var(--dur-base) var(--ease-out); }.wiki-editor__title:focus { border-color: var(--k, var(--accent)); }.wiki-editor__kinds { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }.wiki-editor__kind { width: 140px; height: 24px; padding: 0 10px; border-radius: 12px; border: 1px dashed var(--border-strong); background: transparent; font: inherit; font-size: 12px; color: var(--text); }.wiki-editor__panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }-.wiki-editor__text { resize: none; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); font: 13.5px/1.65 var(--mono); color: var(--text); outline: 0; transition: border-color 0.15s, box-shadow 0.15s; }+.wiki-editor__text { resize: none; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); font: 13.5px/1.65 var(--mono); color: var(--text); outline: 0; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }.wiki-editor__text:focus { border-color: var(--border-strong); box-shadow: var(--shadow); }.wiki-editor__preview { overflow: auto; padding: 18px 24px; border-radius: 14px; border: 1px dashed var(--border); }/* in the conversation */.wiki-chip .wiki-link { margin-right: 4px; }-.wiki-keep { display: inline-block; margin: 2px 0 0; font-size: 12px; opacity: 0; transition: opacity 0.15s; }+.wiki-keep { display: inline-block; margin: 2px 0 0; font-size: 12px; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }.msg:hover .wiki-keep, .wiki-keep:has(.field__error) { opacity: 1; }@media (max-width: 900px) {@@ -6982,6 +7324,127 @@ button.wk-pill.is-on { box-shadow: 0 0 0 1.5px var(--k); background: color-mix(i.wk-import__stats span { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--hover); color: var(--text-2); font-size: 12.5px; }.wk-import__stats b { font-size: 26px; letter-spacing: -0.02em; color: var(--text); }.wiki-link--file { cursor: default; }++/* Copy pass: an approval's plain arguments, and the exact details folded under it */+.approval__args {+ margin: 0 0 8px;+ color: var(--text-2);+}+.approval__args p {+ margin: 0 0 2px;+ overflow-wrap: anywhere;+}+.approval .fold-toggle,+.msg__body .note > .fold-toggle {+ margin: 2px 0 6px;+}++/* Toasts and the core-down banner */+.toasts {+ position: fixed;+ bottom: 20px;+ left: 50%;+ transform: translateX(-50%);+ z-index: 1000;+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 8px;+ width: min(440px, calc(100vw - 32px));+ pointer-events: none;+}+.toast {+ display: flex;+ align-items: flex-start;+ gap: 8px;+ width: 100%;+ padding: 10px 8px 10px 14px;+ border-radius: var(--radius);+ background: var(--primary);+ color: var(--primary-text);+ box-shadow: var(--shadow-lg);+ font-size: 13px;+ line-height: 1.4;+ pointer-events: auto;+ animation: toast-in var(--dur-enter, 240ms) var(--ease-out, var(--ease)) both;+}+.toast.is-leaving {+ animation: toast-out 160ms ease-in both;+}+.toast__text {+ flex: 1;+ min-width: 0;+ padding-top: 2px;+ overflow-wrap: anywhere;+}+.toast__close {+ flex: none;+ color: inherit;+ opacity: 0.7;+}+.toast__close:hover {+ /* the toast's own text color, faint: shows on the dark toast and on the light one in dark mode */+ background: color-mix(in srgb, var(--primary-text) 14%, transparent);+ color: inherit;+ opacity: 1;+}+@keyframes toast-in {+ from {+ opacity: 0;+ transform: translateY(8px);+ }+}+@keyframes toast-out {+ to {+ opacity: 0;+ }+}+.core-down {+ position: fixed;+ top: 14px;+ left: 50%;+ transform: translateX(-50%);+ z-index: 1001;+ display: flex;+ align-items: center;+ gap: 12px;+ width: max-content;+ max-width: calc(100vw - 32px);+ padding: 10px 10px 10px 16px;+ border: 1px solid var(--danger);+ border-radius: var(--radius-lg);+ background: var(--panel);+ color: var(--text);+ box-shadow: var(--shadow-lg);+ font-size: 13px;+ line-height: 1.4;+ animation: toast-in var(--dur-enter, 240ms) var(--ease-out, var(--ease)) both;+}+.core-down .btn {+ flex: none;+}+/* The app fades in once the core answers. */+.app {+ animation: app-in 200ms var(--ease-out, var(--ease)) both;+}+@keyframes app-in {+ from {+ opacity: 0;+ }+}+@media (max-width: 640px) {+ .core-down {+ flex-wrap: wrap;+ }+}+@media (prefers-reduced-motion: reduce) {+ .toast,+ .toast.is-leaving,+ .core-down,+ .app {+ animation: none;+ }+}/* A group's channels sit a step in, along a thin line, so it's clear where the group ends. */.channel-group > [draggable] {position: relative;diff --git a/src/shared/errors.ts b/src/shared/errors.tsnew file mode 100644index 0000000..2c16df2--- /dev/null+++ b/src/shared/errors.ts@@ -0,0 +1,225 @@+// Errors a person reads: what happened and what to do, in their language. The raw text+// (a CLI's stderr, a system code) stays as the detail, for the log or a "details" fold.+import { L } from "./lang";++// An error already written for people (L('…', '…')): it goes through as it is.+export class UserError extends Error {}++export interface Friendly {+ text: string;+ detail?: string; // the raw text, when it isn't the headline+}++export interface FriendlyContext {+ engine?: string; // the harness that failed, e.g. "Claude Code"+ doing?: string; // what was being done, for the fallback: "responder", "salvar"+}++// A status code counts only when the text says it is one: "API Error: 503", "HTTP 401",+// "status 429". A bare number can be a line in a stack trace (index.js:503:17).+const status = (codes: string): string =>+ `(?:API Error|HTTP(?:\\/\\d(?:\\.\\d)?)?|status(?: code)?|code)[\\s:=]*(?:${codes})\\b`;+const AUTH = new RegExp(+ `${status(+ "401"+ )}|\\b401 Unauthorized|authentication_error|invalid[ _-]?(x-)?api[ _-]?key|run \`?\\/login|not (logged|signed) in|log ?in again|oauth token has expired|token (has )?expired|invalid authentication credentials|\\bunauthorized\\b`,+ "i"+);+// The plan ran out. The engines share it: a reserve model takes over on the same words.+export const OUT_OF_QUOTA = new RegExp(+ `usage limit|hit your (?:[\\w-]+ ){0,2}limit|limit reached|limit_reached|quota|resource_exhausted|rate.?limit|too many requests|${status(+ "429"+ )}|insufficient_quota|credit balance is too low|out of (extra )?usage`,+ "i"+);+// No network, as Node says it (ENOTFOUND…) and as Chromium does, for the updater (net::ERR_…).+const OFFLINE =+ /ENOTFOUND|EAI_AGAIN|ECONNREFUSED|ECONNRESET|ENETUNREACH|getaddrinfo|fetch failed|network (error|is unreachable)|socket hang up|net::ERR_(INTERNET_DISCONNECTED|NAME_NOT_RESOLVED|NAME_RESOLUTION_FAILED|NETWORK_CHANGED|NETWORK_ACCESS_DENIED|ADDRESS_UNREACHABLE|CONNECTION_(REFUSED|RESET|CLOSED|FAILED|ABORTED)|PROXY_CONNECTION_FAILED)/i;+const SLOW =+ /ETIMEDOUT|\btimed? ?out\b|due to timeout|net::ERR_(TIMED_OUT|CONNECTION_TIMED_OUT)/i;+const MISSING = /spawn (\S+) ENOENT/i;+const DOWN = new RegExp(+ `overloaded|internal server error|service unavailable|bad gateway|gateway timeout|${status(+ "5\\d\\d"+ )}|\\b(?:502 Bad Gateway|503 Service Unavailable|504 Gateway Timeout)`,+ "i"+);+const BUSY = /SQLITE_BUSY|database is locked/i;+// When the plan frees up again, as the CLI said it: "resets 5pm", "will reset at 3pm",+// "try again in 6.5s". Up to the end of the sentence; "try again later" says no time.+const RESETS =+ /(?:will reset|resets|try again)(?: at| in| on)?\s+(?!later\b)([^·∙\n]{1,40}?)(?:\.(?=\s|$)|[·∙\n]|$)/i;++const message = (e: unknown): string =>+ e instanceof Error ? e.message : typeof e === "string" ? e : String(e);+// Not ours: a bug (TypeError…), a library's own error, or a system code (ENOENT, SQLITE_…).+// A plain Error in this code base is written with L() and reads fine.+const unexpected = (e: unknown): boolean =>+ e instanceof Error+ ? e.constructor !== Error || "code" in e+ : typeof e !== "string";++// The raw text, mapped to what a person can do about it. An engine's error comes as a+// string, "headline\nstderr": the stderr goes to the detail.+export function friendly(e: unknown, ctx: FriendlyContext = {}): Friendly {+ const raw = message(e).trim();+ if (e instanceof UserError) return { text: raw };+ const who = ctx.engine;+ const mapped = (text: string): Friendly => ({ text, detail: raw });+ if (AUTH.test(raw))+ return mapped(+ who+ ? L(+ `O ${who} saiu da sua conta. Entre de novo em Configurações › Modelos.`,+ `${who} is signed out. Sign in again in Settings › Models.`+ )+ : L(+ "O serviço recusou o login. Entre de novo e tente outra vez.",+ "The service refused the sign-in. Sign in again and try once more."+ )+ );+ if (OUT_OF_QUOTA.test(raw)) {+ const when = RESETS.exec(raw)?.[1]?.trim();+ const plan = who+ ? L(`Seu plano do ${who}`, `Your ${who} plan`)+ : L("Seu plano", "Your plan");+ // The time goes in the first sentence: a notification keeps only that one.+ return mapped(+ `${L(`${plan} chegou no limite`, `${plan} hit its limit`)}${+ when ? ` (${L("libera", "resets")}: ${when})` : ""+ }. ${L("Tente de novo mais tarde.", "Try again later.")}`+ );+ }+ const missing = MISSING.exec(raw)?.[1];+ if (missing) {+ const node = /^(npx|npm|node)(\.cmd|\.exe)?$/i.test(missing);+ return mapped(+ node+ ? L(+ `O comando \`${missing}\` não foi encontrado. Instale o Node.js (nodejs.org) e tente de novo.`,+ `The \`${missing}\` command wasn't found. Install Node.js (nodejs.org) and try again.`+ )+ : L(+ `O comando \`${missing}\` não foi encontrado. Confira se ele está instalado.`,+ `The \`${missing}\` command wasn't found. Check that it's installed.`+ )+ );+ }+ if (OFFLINE.test(raw))+ return mapped(+ L(+ "Sem conexão com a internet, ou o serviço não respondeu. Confira a rede e tente de novo.",+ "No internet connection, or the service didn't answer. Check the network and try again."+ )+ );+ if (SLOW.test(raw))+ return mapped(+ L(+ "Demorou demais pra responder. Confira a internet e tente de novo.",+ "It took too long to answer. Check the internet and try again."+ )+ );+ if (DOWN.test(raw))+ return mapped(+ who+ ? L(+ `O serviço do ${who} está fora do ar ou sobrecarregado agora. Tente de novo em alguns minutos.`,+ `${who}'s service is down or overloaded right now. Try again in a few minutes.`+ )+ : L(+ "O serviço está fora do ar ou sobrecarregado agora. Tente de novo em alguns minutos.",+ "The service is down or overloaded right now. Try again in a few minutes."+ )+ );+ if (BUSY.test(raw))+ return mapped(+ L(+ "O Tucano está ocupado salvando. Tente de novo em instantes.",+ "Tucano is busy saving. Try again in a moment."+ )+ );+ // A file the system wouldn't open, said with the file: the generic "restart" wouldn't help.+ const code =+ e instanceof Error && "code" in e+ ? String((e as { code: unknown }).code)+ : "";+ const file =+ e instanceof Error &&+ "path" in e &&+ typeof (e as { path: unknown }).path === "string"+ ? `\`${(e as { path: string }).path}\``+ : "";+ if (code === "EACCES" || code === "EPERM")+ return mapped(+ file+ ? L(+ `Sem permissão pra acessar ${file}. Confira as permissões e tente de novo.`,+ `No permission to access ${file}. Check the permissions and try again.`+ )+ : L(+ "Sem permissão pra acessar esse arquivo. Confira as permissões e tente de novo.",+ "No permission to access that file. Check the permissions and try again."+ )+ );+ if (code === "ENOENT")+ return mapped(+ file+ ? L(+ `Não achei ${file}. Ele pode ter sido movido ou apagado.`,+ `Couldn't find ${file}. It may have been moved or deleted.`+ )+ : L(+ "Não achei esse arquivo. Ele pode ter sido movido ou apagado.",+ "Couldn't find that file. It may have been moved or deleted."+ )+ );+ if (code === "ENOSPC")+ return mapped(+ L(+ "O disco está cheio. Libere espaço e tente de novo.",+ "The disk is full. Free up some space and try again."+ )+ );+ if (code === "EBUSY")+ return mapped(+ L(+ "O arquivo está aberto em outro programa. Feche ele e tente de novo.",+ "The file is open in another program. Close it and try again."+ )+ );+ if (unexpected(e) || !raw) {+ const doing = ctx.doing ? L(` ao ${ctx.doing}`, ` while ${ctx.doing}`) : "";+ return {+ text: L(+ `Algo deu errado${doing}. Tente de novo; se continuar, reinicie o Tucano.`,+ `Something went wrong${doing}. Try again; if it keeps happening, restart Tucano.`+ ),+ detail: raw || undefined,+ };+ }+ if (typeof e !== "string") return { text: raw };+ const [head = "", ...rest] = raw.split("\n");+ return rest.length+ ? { text: head.trim(), detail: rest.join("\n").trim() }+ : { text: raw };+}++// No internet (or the other side didn't answer), as opposed to a refusal or a bug.+export const offline = (e: unknown): boolean =>+ OFFLINE.test(message(e)) || SLOW.test(message(e));++// The first sentence, for a notification: "O Claude Code saiu da sua conta."+export function firstSentence(text: string): string {+ const s = (/^[\s\S]*?[.!?](?=\s|$)/.exec(text.trim())?.[0] ?? text.trim())+ .split("\n")[0]!+ .trim();+ return /[.!?]$/.test(s) ? s : `${s}.`;+}++// A tool's name as a person says it: send_email → "send email".+export const toolLabel = (name: string): string =>+ name+ .replace(/[_-]+/g, " ")+ .replace(/([a-z])([A-Z])/g, "$1 $2")+ .toLowerCase()+ .trim();diff --git a/src/shared/types.ts b/src/shared/types.tsindex 49e85f4..5999d9a 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -30,7 +30,8 @@ export interface UpdateState {next?: string // the newer version, while it downloads and once it's readypercent?: numbercheckedAt?: number- error?: string+ error?: string // what went wrong, for people+ errorKind?: 'offline' | 'other' // 'other': the app can be downloaded by hand from the releases page}export interface EngineStatus {@@ -156,7 +157,8 @@ export interface Run {steps: Step[]receipt?: ReceiptapprovalId?: string- error?: string+ error?: string // what happened and what to do, for people (src/shared/errors.ts)+ errorDetail?: string // the raw text behind it (a CLI's stderr), shown foldeddepth?: number // 1 when a human message triggered it, +1 for each agent-to-agent hopquestion?: string // asked with ask_user; answered by the next human message herememoryIds?: string[] // memories saved or proposed with `lembrar` in this replydiff --git a/test/connectors.test.ts b/test/connectors.test.tsindex bd5cc07..bd8f8ba 100644--- a/test/connectors.test.ts+++ b/test/connectors.test.ts@@ -102,7 +102,8 @@ describe('OAuth signed in from a page on another machine (Tucano as a server)',it('says what went wrong with an address that is no answer', async () => {await expect(connectors.finishOAuthFromUrl('não é um endereço')).rejects.toThrow()- await expect(connectors.finishOAuthFromUrl('http://127.0.0.1:1/oauth/callback?error=access_denied')).rejects.toThrow(/access_denied/)+ await expect(connectors.finishOAuthFromUrl('http://127.0.0.1:1/oauth/callback?error=access_denied')).rejects.toThrow(/recusou o acesso.*Permitir/)+ await expect(connectors.finishOAuthFromUrl('http://127.0.0.1:1/oauth/callback?error=server_error')).rejects.toThrow(/server_error/)})})diff --git a/test/errors.test.ts b/test/errors.test.tsnew file mode 100644index 0000000..ce22fa2--- /dev/null+++ b/test/errors.test.ts@@ -0,0 +1,267 @@+import { afterEach, describe, expect, it } from "vitest";+import { connectError, notAuthorized } from "../src/core/connectors";+import { refused } from "../src/core/telegram";+import {+ firstSentence,+ friendly,+ offline,+ toolLabel,+ UserError,+} from "../src/shared/errors";+import { setLang } from "../src/shared/lang";++afterEach(() => setLang("pt"));++// A system error as Node makes it: a plain Error with a code.+const sys = (message: string, code: string): Error =>+ Object.assign(new Error(message), { code });++describe("errors in people’s words", () => {+ it("says the harness is signed out, and where to sign in again", () => {+ const f = friendly("Invalid API key · Please run /login", {+ engine: "Claude Code",+ });+ expect(f).toEqual({+ text: "O Claude Code saiu da sua conta. Entre de novo em Configurações › Modelos.",+ detail: "Invalid API key · Please run /login",+ });+ expect(+ friendly(+ 'API Error: 401 {"type":"error","error":{"type":"authentication_error"}}',+ { engine: "Codex" }+ ).text+ ).toMatch(/^O Codex saiu da sua conta/);+ setLang("en");+ expect(+ friendly("OAuth token has expired", { engine: "Claude Code" }).text+ ).toBe("Claude Code is signed out. Sign in again in Settings › Models.");+ });++ it("says the plan hit its limit, with when it frees up when the CLI says", () => {+ expect(+ friendly("usage limit reached", { engine: "Claude Code" }).text+ ).toBe(+ "Seu plano do Claude Code chegou no limite. Tente de novo mais tarde."+ );+ expect(+ friendly("You've hit your limit · resets 5pm", { engine: "Claude Code" })+ .text+ ).toBe(+ "Seu plano do Claude Code chegou no limite (libera: 5pm). Tente de novo mais tarde."+ );+ // Claude Code's session limit, and the ways a CLI says when it frees up+ expect(+ friendly("Session limit reached ∙ resets 3pm", { engine: "Claude Code" })+ .text+ ).toBe(+ "Seu plano do Claude Code chegou no limite (libera: 3pm). Tente de novo mais tarde."+ );+ expect(+ friendly(+ "5-hour limit reached. Your limit will reset at 3pm (America/Sao_Paulo)."+ ).text+ ).toBe(+ "Seu plano chegou no limite (libera: 3pm (America/Sao_Paulo)). Tente de novo mais tarde."+ );+ expect(friendly("Rate limit exceeded, try again in 6.5s.").text).toBe(+ "Seu plano chegou no limite (libera: 6.5s). Tente de novo mais tarde."+ );+ expect(friendly("Too many requests, try again later.").text).toBe(+ "Seu plano chegou no limite. Tente de novo mais tarde."+ );+ expect(friendly("429 Too Many Requests").text).toBe(+ "Seu plano chegou no limite. Tente de novo mais tarde."+ );+ });++ it("tells no internet, a slow answer, a missing command and a busy database apart", () => {+ expect(+ friendly(sys("getaddrinfo ENOTFOUND api.anthropic.com", "ENOTFOUND")).text+ ).toMatch(/^Sem conexão com a internet/);+ expect(friendly(new TypeError("fetch failed")).text).toMatch(+ /^Sem conexão com a internet/+ );+ expect(friendly("Request timed out").text).toMatch(/^Demorou demais/);+ expect(friendly(sys("spawn npx ENOENT", "ENOENT"))).toEqual({+ text: "O comando `npx` não foi encontrado. Instale o Node.js (nodejs.org) e tente de novo.",+ detail: "spawn npx ENOENT",+ });+ expect(friendly(sys("spawn uvx ENOENT", "ENOENT")).text).toBe(+ "O comando `uvx` não foi encontrado. Confira se ele está instalado."+ );+ expect(friendly(sys("database is locked", "SQLITE_BUSY")).text).toBe(+ "O Tucano está ocupado salvando. Tente de novo em instantes."+ );+ expect(+ friendly('API Error: 529 {"type":"overloaded_error"}', {+ engine: "Claude Code",+ }).text+ ).toMatch(/^O serviço do Claude Code está fora do ar ou sobrecarregado/);+ });++ it("lets an error written for people through as it is", () => {+ expect(friendly(new UserError("O token do bot não vale mais."))).toEqual({+ text: "O token do bot não vale mais.",+ });+ expect(+ friendly(new Error("Essa página mudou desde que foi aberta."))+ ).toEqual({ text: "Essa página mudou desde que foi aberta." });+ // Not even a pattern touches it: it was meant as it is.+ expect(friendly(new UserError("Request timed out at the gate"))).toEqual({+ text: "Request timed out at the gate",+ });+ });++ it("turns a bug into what to do, with the raw text as the detail", () => {+ const f = friendly(+ new TypeError("Cannot read properties of undefined (reading 'id')"),+ { doing: "responder" }+ );+ expect(f).toEqual({+ text: "Algo deu errado ao responder. Tente de novo; se continuar, reinicie o Tucano.",+ detail: "Cannot read properties of undefined (reading 'id')",+ });+ setLang("en");+ expect(+ friendly(new RangeError("Invalid array length"), { doing: "saving" }).text+ ).toBe(+ "Something went wrong while saving. Try again; if it keeps happening, restart Tucano."+ );+ });++ it('says which file the system refused, instead of "restart"', () => {+ const fs = (message: string, code: string, path: string): Error =>+ Object.assign(new Error(message), { code, path });+ expect(+ friendly(+ fs(+ "EACCES: permission denied, open '/x/notas.md'",+ "EACCES",+ "/x/notas.md"+ )+ )+ ).toEqual({+ text: "Sem permissão pra acessar `/x/notas.md`. Confira as permissões e tente de novo.",+ detail: "EACCES: permission denied, open '/x/notas.md'",+ });+ expect(+ friendly(+ fs(+ "ENOENT: no such file or directory, open '/x/a.md'",+ "ENOENT",+ "/x/a.md"+ )+ ).text+ ).toBe("Não achei `/x/a.md`. Ele pode ter sido movido ou apagado.");+ expect(+ friendly(sys("ENOSPC: no space left on device, write", "ENOSPC")).text+ ).toBe("O disco está cheio. Libere espaço e tente de novo.");+ });++ it("reads a status code only where the text says it is one, not in a stack trace", () => {+ const crash =+ "O Gemini CLI saiu sem resposta (código 1).\nTypeError: x is not a function\n at run (/usr/lib/node_modules/@google/gemini-cli/dist/index.js:503:17)\n at main (index.js:401:3)\n at next (index.js:429:9)";+ expect(friendly(crash, { engine: "Gemini CLI" }).text).toBe(+ "O Gemini CLI saiu sem resposta (código 1)."+ );+ expect(+ friendly("Request failed with status code 503", { engine: "Gemini CLI" })+ .text+ ).toMatch(/^O serviço do Gemini CLI está fora do ar/);+ expect(friendly("HTTP 401: invalid token").text).toMatch(+ /^O serviço recusou o login/+ );+ expect(friendly("[API Error: got status: 429]").text).toMatch(+ /chegou no limite/+ );+ });++ it("knows the updater's offline, in Chromium's words", () => {+ expect(offline(new Error("net::ERR_INTERNET_DISCONNECTED"))).toBe(true);+ expect(offline(new Error("net::ERR_NAME_NOT_RESOLVED"))).toBe(true);+ expect(offline(new Error("net::ERR_CONNECTION_TIMED_OUT"))).toBe(true);+ });++ it("keeps an engine's headline and folds its stderr", () => {+ expect(+ friendly(+ "O Codex saiu sem resposta (código 1).\nthread panicked at src/main.rs\nnote: run with RUST_BACKTRACE=1"+ )+ ).toEqual({+ text: "O Codex saiu sem resposta (código 1).",+ detail: "thread panicked at src/main.rs\nnote: run with RUST_BACKTRACE=1",+ });+ // The stderr says why: that wins over the headline.+ expect(+ friendly(+ "O Claude Code saiu sem resposta (código 1).\nError: Invalid API key · Please run /login",+ { engine: "Claude Code" }+ ).text+ ).toMatch(/saiu da sua conta/);+ });++ it("keeps the first sentence for a notification, and says tools as people do", () => {+ expect(+ firstSentence(+ "O Claude Code saiu da sua conta. Entre de novo em Configurações › Modelos."+ )+ ).toBe("O Claude Code saiu da sua conta.");+ expect(+ firstSentence(+ "O comando `npx` não foi encontrado. Instale o Node.js (nodejs.org) e tente de novo."+ )+ ).toBe("O comando `npx` não foi encontrado.");+ expect(firstSentence("boom")).toBe("boom.");+ expect(toolLabel("send_email")).toBe("send email");+ expect(toolLabel("createIssue")).toBe("create issue");+ expect(offline(new TypeError("fetch failed"))).toBe(true);+ expect(+ offline(+ new Error("Cannot find latest-mac.yml in the latest release artifacts")+ )+ ).toBe(false);+ });+});++describe("connectors and Telegram, in what to do", () => {+ it("says to install Node.js, or to check the command, instead of the SDK error", () => {+ expect(connectError(sys("spawn npx ENOENT", "ENOENT"))).toBe(+ "O comando `npx` não foi encontrado. Instale o Node.js (nodejs.org) e tente de novo."+ );+ expect(connectError(new Error("MCP error -32000: Connection closed"))).toBe(+ "O servidor fechou logo ao abrir. Confira o comando e os argumentos do conector."+ );+ expect(connectError(new Error("Servidor respondeu 500"))).toBe(+ "Servidor respondeu 500"+ );+ });++ it("says the person declined, and how to try again", () => {+ expect(+ notAuthorized(new URL("http://127.0.0.1/cb?error=access_denied"))+ ).toBe(+ "Você recusou o acesso na página do serviço. Tente de novo e clique em Permitir."+ );+ expect(+ notAuthorized(+ new URL(+ "http://127.0.0.1/cb?error=invalid_scope&error_description=bad+scope"+ )+ )+ ).toBe("Autorização não concluída: bad scope. Tente de novo pelo app.");+ });++ it("says what Telegram's refusal means", () => {+ expect(refused(401, "Unauthorized").message).toBe(+ "O token do bot não vale mais. Cole um novo do @BotFather."+ );+ expect(+ refused(409, "Conflict: terminated by other getUpdates request").message+ ).toBe(+ "Outro app está lendo este bot (outro Tucano ou um webhook). Feche o outro ou troque o token."+ );+ expect(refused(400, "Bad Request: chat not found").message).toBe(+ "O Telegram recusou: Bad Request: chat not found."+ );+ });+});diff --git a/test/lang.test.ts b/test/lang.test.tsindex 704b09f..a759947 100644--- a/test/lang.test.ts+++ b/test/lang.test.ts@@ -21,7 +21,7 @@ describe('the app in English', () => {expect(describeSchedule({ days: [1, 3, 5], time: '18:30' })).toBe('Mon, Wed and Fri at 18:30')expect(describeSchedule({ days: [0, 1, 2, 3, 4, 5, 6], time: '07:00', once: true })).toBe('Once, at 7:00')const failed = { id: 'm', conversationId: 'c', author: { kind: 'agent', id: 'a1' }, text: '', at: 0, run: { status: 'failed', steps: [], error: 'boom' } } as Message- expect(outcome(failed)).toBe('Failed: boom')+ expect(outcome(failed)).toBe('boom. Open it to fix it.')expect(MODELS[0]!.hint).toBe('Good for most things')expect(EFFORTS.map((e) => e.label)).toEqual(['Low', 'Medium', 'High', 'Max'])expect(linuxTools()[0]!.description).toMatch(/^Runs a bash command/)diff --git a/test/reserve.test.ts b/test/reserve.test.tsindex a109d4a..6251d48 100644--- a/test/reserve.test.ts+++ b/test/reserve.test.ts@@ -100,7 +100,7 @@ describe('the reserve model', () => {r = runner(claude)await r.send('d1', 'oi')await r.idle()- expect(reply().run).toMatchObject({ status: 'failed', error: 'usage limit reached' })+ expect(reply().run).toMatchObject({ status: 'failed', error: expect.stringContaining('chegou no limite') as string, errorDetail: 'usage limit reached' })expect(codex.turns).toHaveLength(0)}})diff --git a/test/routines.test.ts b/test/routines.test.tsindex 4a69551..6ddab4a 100644--- a/test/routines.test.ts+++ b/test/routines.test.ts@@ -379,7 +379,7 @@ describe('routine retries', () => {expect(reply!.run).toMatchObject({ status: 'failed' })expect(reply!.run!.error).toBe('o provedor caiu (3). Tentei 3 vezes.')expect(notes).toHaveLength(1)- expect(notes[0]).toBe('Falhou: o provedor caiu (3). Tentei 3 vezes.')+ expect(notes[0]).toBe('o provedor caiu (3). Abra pra resolver.') // the headline, and what to do})it('waiting, the reply says when the next try is', async () => {diff --git a/test/runner.test.ts b/test/runner.test.tsindex 1475a0c..aaab12e 100644--- a/test/runner.test.ts+++ b/test/runner.test.ts@@ -238,7 +238,8 @@ describe('Runner', () => {const r = runner(broken)await r.send('d1', 'oi')await r.idle()- expect(agentMessages()[0]?.run).toMatchObject({ status: 'failed', error: 'usage limit reached' })+ // In what to do, with the CLI's own words kept as the detail.+ expect(agentMessages()[0]?.run).toMatchObject({ status: 'failed', error: 'Seu plano do Claude Code chegou no limite. Tente de novo mais tarde.', errorDetail: 'usage limit reached' })})})