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
Let the number fields be cleared and typed over (#10)
Gian Moraes11e904f7b2b7
diff --git a/src/renderer/src/components/Pages.tsx b/src/renderer/src/components/Pages.tsxindex ec4dee5..e19a9bf 100644--- a/src/renderer/src/components/Pages.tsx+++ b/src/renderer/src/components/Pages.tsx@@ -56,7 +56,7 @@ import {} from '../store'import { HarnessList, HarnessMcps, ModelPicker, onGateway, OutsideGateway } from './Harness'import { ApprovalCard } from './Conversation'-import { AgentAvatar, Icon, SleepingToucan, time, tokens, UsageBar } from './ui'+import { AgentAvatar, Icon, NumberInput, SleepingToucan, time, tokens, UsageBar } from './ui'import { UpdateSettings } from './Update'export function Page({ title, subtitle, actions, children }: { title: ReactNode; subtitle?: ReactNode; actions?: ReactNode; children: ReactNode }): ReactNode {@@ -535,12 +535,11 @@ export function AgentPage({ id, draft: proposed, fromMessage }: { id?: string; d</select></Field><Field label={L('Limite mensal (milhões de tokens)', 'Monthly limit (millions of tokens)')} hint={L(`Conferido antes de cada turno. No limite, ${draft.name || 'o agente'} para e avisa.`, `Checked before every turn. At the limit, ${draft.name || 'the agent'} stops and tells you.`)}>- <input- type="number"+ <NumberInputmin={0}step={0.5}value={draft.limit / 1_000_000}- onChange={(e) => patch({ limit: Math.max(0, Math.round(Number(e.target.value) * 1_000_000)) })}+ onChange={(n) => patch({ limit: Math.max(0, Math.round(n * 1_000_000)) })}className="input--short"/></Field>@@ -1612,29 +1611,26 @@ export function SettingsPage(): ReactNode {<Card title={L('Limites', 'Limits')}><div className="grid2"><Field label={L('Limite padrão por agente (milhões de tokens/mês)', 'Default limit per agent (millions of tokens/month)')}>- <input- type="number"+ <NumberInputmin={0}step={0.5}value={settings.defaultLimit / 1_000_000}- onChange={(e) => updateSettings({ defaultLimit: Math.max(0, Math.round(Number(e.target.value) * 1_000_000)) })}+ 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.')}>- <input- type="number"+ <NumberInputmin={1}max={100}value={settings.runBudgetPct ?? RUN_BUDGET_PCT}- onChange={(e) => updateSettings({ runBudgetPct: Math.min(100, Math.max(1, Math.round(Number(e.target.value)))) })}+ 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.')}>- <input- type="number"+ <NumberInputmin={5}value={settings.runStallMinutes ?? RUN_STALL_MINUTES}- onChange={(e) => updateSettings({ runStallMinutes: Math.max(5, Math.round(Number(e.target.value))) })}+ onChange={(n) => updateSettings({ runStallMinutes: Math.max(5, Math.round(n)) })}/></Field><Field label={L('Expiração de aprovações', 'Approvals expire after')}>diff --git a/src/renderer/src/components/ui.tsx b/src/renderer/src/components/ui.tsxindex 25ac803..6fe595b 100644--- a/src/renderer/src/components/ui.tsx+++ b/src/renderer/src/components/ui.tsx@@ -1,5 +1,5 @@import { L, lang, locale } from '../../../shared/lang'-import type { ReactNode } from 'react'+import { useState, type InputHTMLAttributes, type ReactNode } from 'react'import type { Agent } from '../store'const PATHS: Record<string, ReactNode> = {@@ -267,3 +267,24 @@ export function UsageBar({ used, limit }: { used: number; limit: number }): Reac</span>)}++// A number field that holds the text while you type it: on its own, an emptied+// input hands back '' and Number('') is 0, so the field refills with 0 and you+// can't type over it. The number goes out on every keystroke that parses.+export function NumberInput({ value, onChange, ...rest }: { value: number; onChange: (n: number) => void } & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'type'>): ReactNode {+ const [text, setText] = useState<string | null>(null)+ return (+ <input+ type="number"+ {...rest}+ value={text ?? String(value)}+ onFocus={() => setText(String(value))}+ onBlur={() => setText(null)}+ onChange={(e) => {+ setText(e.target.value)+ const n = Number(e.target.value)+ if (e.target.value.trim() !== '' && Number.isFinite(n)) onChange(n)+ }}+ />+ )+}