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
Make the labels of app actions follow the language chosen (#56)
Rayanne B. Lima83e4d4e3f51a
diff --git a/src/core/apps.ts b/src/core/apps.tsindex e030917..78856c9 100644--- a/src/core/apps.ts+++ b/src/core/apps.ts@@ -199,7 +199,7 @@ const inner = (n: Node): string => {return ''}-const ROLE: Record<string, string> = {+const ROLE = (): Record<string, string> => ({button: L('botão', 'button'),menuitem: L('item de menu', 'menu item'),menubaritem: 'menu',@@ -222,7 +222,7 @@ const ROLE: Record<string, string> = {document: L('documento', 'document'),listbox: L('lista', 'list'),menu: 'menu'-}+})const clean = (s: unknown): string =>String(s ?? '').replace(/[-]/g, '')@@ -249,7 +249,7 @@ export function itemize(tree: Node | undefined, max = MAX_LINES): { items: Item[...(n.available_actions?.length ? { actions: n.available_actions } : {})}items.push(item)- if (lines.length < max) lines.push(`${' '.repeat(Math.min(depth, 4))}#${item.n} ${ROLE[role] ?? role}${name ? ` "${name}"` : ''}${item.value ? ` = "${item.value.slice(0, 200)}"` : ''}`)+ if (lines.length < max) lines.push(`${' '.repeat(Math.min(depth, 4))}#${item.n} ${ROLE()[role] ?? role}${name ? ` "${name}"` : ''}${item.value ? ` = "${item.value.slice(0, 200)}"` : ''}`)else more++} else if (role === 'statictext' && (name || value) && lines.length < max) lines.push(`${' '.repeat(Math.min(depth, 4))}${L('texto', 'text')} "${(name || value).slice(0, 200)}"`)for (const c of n.children ?? []) visit(c, depth + 1)@@ -434,7 +434,7 @@ function changeTools(app: Record<string, unknown>, alvo: Record<string, unknown>]}-const DONE: Record<string, string> = {+const DONE = (): Record<string, string> => ({apps_listar: L('Viu os apps', 'Checked the apps'),app_abrir: L('Abriu', 'Opened'),app_ver: L('Leu', 'Read'),@@ -442,11 +442,11 @@ const DONE: Record<string, string> = {app_clicar: L('Clicou em', 'Clicked'),app_escrever: L('Escreveu em', 'Typed in'),app_tecla: L('Apertou', 'Pressed')-}+})export function appStep(name: string, args: Record<string, unknown>): { label: string; detail: string } {const s = (k: string): string => String(args[k] ?? '').trim()const detail = name === 'app_clicar' || name === 'app_escrever' ? `${s('alvo')} · ${s('app')}` : name === 'app_tecla' ? `${s('tecla')} · ${s('app')}` : s('app')- return { label: DONE[name] ?? name, detail }+ return { label: DONE()[name] ?? name, detail }}export interface AppOutcome {diff --git a/test/apps.test.ts b/test/apps.test.tsindex 8d9f8b2..616da4d 100644--- a/test/apps.test.ts+++ b/test/apps.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from 'vitest'-import { appTools, DesktopApps, grantOf, itemize, keyFor, parseLsappinfo, pick, riskyClick, riskyKey, run, typeKeys, type Cli, type Envelope } from '../src/core/apps'+import { setLang } from '../src/shared/lang'+import { appStep, appTools, DesktopApps, grantOf, itemize, keyFor, parseLsappinfo, pick, riskyClick, riskyKey, run, typeKeys, type Cli, type Envelope } from '../src/core/apps'import type { Agent } from '../src/shared/types'// A Notes window as agent-desktop describes it.@@ -296,3 +297,12 @@ describe('on Windows and Linux', () => {expect(calls.find((c) => c[0] === 'set-value')).toEqual(['set-value', '@s1:e1', 'oi'])})})++describe('labels of what happens in an app', () => {+ it('follow the language chosen, not the one at startup', () => {+ setLang('en')+ expect(appStep('app_ver', {}).label).toBe('Read')+ setLang('pt')+ expect(appStep('app_ver', {}).label).toBe('Leu')+ })+})