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
Update the app by itself from GitHub releases (#3)
Eduardo Machadoc1b7a35ba17f
diff --git a/README.md b/README.mdindex 0a74aac..4482464 100644--- a/README.md+++ b/README.md@@ -105,13 +105,15 @@ Prefer Codex? `npm install -g @openai/codex`. You'll sign in from inside Tucano.**2. Install Tucano.** [Download the .dmg](https://github.com/eduwxyz/tucano/releases/latest/download/tucano-mac-arm64.dmg), open it and drag Tucano into **Applications**. The app is signed and notarized by Apple, so it opens with no warning.-Or from the Terminal, which also updates it later:+Or from the Terminal:```bashcurl -fsSL https://github.com/eduwxyz/tucano/releases/latest/download/install.sh | sh```-It downloads the latest release, puts Tucano in **Applications** and opens it. Run the same command to update.+It downloads the latest release, puts Tucano in **Applications** and opens it.++From 0.1.2 on, Tucano updates itself: it downloads a new version in the background and shows **Restart** in the sidebar when it's ready (or it goes in the next time you quit). Earlier versions update with the same download or command.**3. The first run is the setup.** Tucano speaks English and Portuguese; pick one on the first screen, or later in **Settings**. Then, in a few steps: your name; which harnesses agents may use (each with a **Test now** button that sends a real question); the models that route channels and keep memory; what every agent should know about you; your tools (optional); your skills (optional); and your first agent, from a template or from scratch. It ends in a `#general` channel with your agent already working.diff --git a/README.pt-BR.md b/README.pt-BR.mdindex 4be9938..bee7708 100644--- a/README.pt-BR.md+++ b/README.pt-BR.md@@ -105,13 +105,15 @@ Prefere o Codex? `npm install -g @openai/codex`. O login é feito dentro do Tuca**2. Instale o Tucano.** [Baixe o .dmg](https://github.com/eduwxyz/tucano/releases/latest/download/tucano-mac-arm64.dmg), abra e arraste o Tucano pra **Aplicativos**. O app é assinado e notarizado pela Apple, então abre sem aviso.-Ou pelo Terminal, que também serve pra atualizar depois:+Ou pelo Terminal:```bashcurl -fsSL https://github.com/eduwxyz/tucano/releases/latest/download/install.sh | sh```-Ele baixa a última versão, coloca o Tucano em **Aplicativos** e abre. Pra atualizar, rode o mesmo comando.+Ele baixa a última versão, coloca o Tucano em **Aplicativos** e abre.++A partir da 0.1.2, o Tucano se atualiza sozinho: baixa a versão nova em segundo plano e mostra **Reiniciar** na barra lateral quando ela está pronta (ou ela entra na próxima vez que você fechar o app). As versões anteriores se atualizam pelo mesmo download ou comando.**3. A primeira abertura é a configuração.** O Tucano fala português e inglês; escolha na primeira tela, ou depois em **Configurações**. Em seguida, em poucos passos: seu nome; quais harnesses os agentes podem usar (cada um com um **Testar agora** que manda uma pergunta de verdade); os modelos que roteiam os canais e cuidam da memória; o que todo agente deve saber sobre você; suas ferramentas (opcional); suas skills (opcional); e o primeiro agente, de um modelo pronto ou do zero. No fim, um canal `#geral` com o seu agente já trabalhando.diff --git a/package-lock.json b/package-lock.jsonindex 3a572ce..54be0c0 100644--- a/package-lock.json+++ b/package-lock.json@@ -11,6 +11,7 @@"dependencies": {"@fontsource-variable/inter": "^5.3.0","@modelcontextprotocol/sdk": "^1.32.1",+ "electron-updater": "^6.8.11","gsap": "^3.14.2","smol-toml": "^1.9.1"},@@ -2138,7 +2139,6 @@"version": "2.0.1","resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz","integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",- "dev": true,"license": "Python-2.0"},"node_modules/asn1js": {@@ -2399,7 +2399,6 @@"version": "9.7.0","resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.0.tgz","integrity": "sha512-g/kR520giAFYkSXTzcmF3kqQq7wi8F6N6SzeDgZrqTBN+VHdmgWOyTdD1yD7AATDId/yXLvuP34CxW46/BwCdw==",- "dev": true,"license": "MIT","dependencies": {"debug": "^4.3.4",@@ -3214,6 +3213,34 @@"dev": true,"license": "ISC"},+ "node_modules/electron-updater": {+ "version": "6.8.11",+ "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.8.11.tgz",+ "integrity": "sha512-12U/mbzaIKQS3Q543aQ7DjyAZMXeVJy1Wpu0qdq5ne4RXpIQDpWYm25zRjgXngAoo6swMrm4C4owGyiIipelsg==",+ "license": "MIT",+ "dependencies": {+ "builder-util-runtime": "9.7.0",+ "fs-extra": "^10.1.0",+ "js-yaml": "^4.1.0",+ "lazy-val": "^1.0.5",+ "lodash.escaperegexp": "^4.1.2",+ "lodash.isequal": "^4.5.0",+ "semver": "~7.7.3",+ "tiny-typed-emitter": "^2.1.0"+ }+ },+ "node_modules/electron-updater/node_modules/semver": {+ "version": "7.7.4",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",+ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },"node_modules/electron-vite": {"version": "6.0.0","resolved": "https://registry.npmjs.org/electron-vite/-/electron-vite-6.0.0.tgz",@@ -3770,7 +3797,6 @@"version": "10.1.0","resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz","integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",- "dev": true,"license": "MIT","dependencies": {"graceful-fs": "^4.2.0",@@ -4017,7 +4043,6 @@"version": "4.2.11","resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz","integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",- "dev": true,"license": "ISC"},"node_modules/gsap": {@@ -4464,7 +4489,6 @@"version": "4.3.2","resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz","integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",- "dev": true,"funding": [{"type": "github",@@ -4540,7 +4564,6 @@"version": "6.2.1","resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz","integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",- "dev": true,"license": "MIT","dependencies": {"universalify": "^2.0.0"@@ -4563,7 +4586,6 @@"version": "1.0.5","resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz","integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==",- "dev": true,"license": "MIT"},"node_modules/lightningcss": {@@ -4834,6 +4856,19 @@"dev": true,"license": "MIT"},+ "node_modules/lodash.escaperegexp": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz",+ "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==",+ "license": "MIT"+ },+ "node_modules/lodash.isequal": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",+ "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",+ "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.",+ "license": "MIT"+ },"node_modules/longest-streak": {"version": "3.1.0","resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",@@ -6996,7 +7031,6 @@"version": "1.6.1","resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz","integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==",- "dev": true,"license": "BlueOak-1.0.0","engines": {"node": ">=11.0.0"@@ -7485,6 +7519,12 @@"semver": "bin/semver"}},+ "node_modules/tiny-typed-emitter": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",+ "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==",+ "license": "MIT"+ },"node_modules/tinybench": {"version": "2.9.0","resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",@@ -7792,7 +7832,6 @@"version": "2.0.1","resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz","integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",- "dev": true,"license": "MIT","engines": {"node": ">= 10.0.0"diff --git a/package.json b/package.jsonindex 8a6795f..d0884ff 100644--- a/package.json+++ b/package.json@@ -36,12 +36,20 @@"dependencies": {"@fontsource-variable/inter": "^5.3.0","@modelcontextprotocol/sdk": "^1.32.1",+ "electron-updater": "^6.8.11","gsap": "^3.14.2","smol-toml": "^1.9.1"},"build": {"appId": "dev.tucano.app","productName": "Tucano",+ "publish": [+ {+ "provider": "github",+ "owner": "eduwxyz",+ "repo": "tucano"+ }+ ],"directories": {"output": "dist","buildResources": "build"diff --git a/scripts/release.sh b/scripts/release.shindex c1a41ca..b5b581c 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -35,6 +35,17 @@ codesign --sign "$IDENTITY" --timestamp "$DMG"xcrun notarytool submit "$DMG" --keychain-profile "$APPLE_KEYCHAIN_PROFILE" --waitxcrun stapler staple "$DMG"+# latest-mac.yml tells the installed apps about this version (src/main/updates.ts); the+# .dmg was signed and stapled after it was written, so its entry gets the final hash.+node -e '+const fs = require("fs"), crypto = require("crypto")+const [yml, dmg] = process.argv.slice(1)+const data = fs.readFileSync(dmg)+const sha512 = crypto.createHash("sha512").update(data).digest("base64")+const text = fs.readFileSync(yml, "utf8").replace(/(- url: tucano-mac-arm64\.dmg\n\s+sha512: )\S+(\n\s+size: )\d+/, (_, a, b) => a + sha512 + b + data.length)+fs.writeFileSync(yml, text)+' "$OUT/latest-mac.yml" "$DMG"+codesign --verify --deep --strict "$OUT/mac-arm64/Tucano.app"spctl --assess --type execute "$OUT/mac-arm64/Tucano.app"spctl --assess --type open --context context:primary-signature "$DMG"@@ -43,5 +54,5 @@ ls -lh "$OUT"/tucano-mac-arm64.*[ "$1" = "--no-publish" ] && exit 0git push origin HEAD-gh release create "$TAG" "$OUT/tucano-mac-arm64.dmg" "$OUT/tucano-mac-arm64.zip" install.sh \+gh release create "$TAG" "$OUT/tucano-mac-arm64.dmg" "$OUT/tucano-mac-arm64.zip" "$OUT/tucano-mac-arm64.zip.blockmap" "$OUT/latest-mac.yml" install.sh \--target "$(git rev-parse HEAD)" --title "Tucano $VERSION" --notes-file docs/release-notes.mddiff --git a/src/main/index.ts b/src/main/index.tsindex d48c6b1..1707800 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -6,6 +6,7 @@ import { L, langOf, setLang, type Lang } from '../shared/lang'import type { BrowserOp } from '../shared/types'import { Browsers } from './browser'import { bundleOf, moveFromAgentDesk, type Moved } from './migrate'+import { Updates } from './updates'const NAME = 'Tucano'app.setName(NAME)@@ -203,6 +204,28 @@ function showWindow(conversationId?: string): void {else go()}+// New versions: the window shows when one is ready, and restarting puts it in.+const updates = new Updates((state) => {+ if (mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send('update', state)+})+ipcMain.handle('update:state', () => updates.get())+ipcMain.on('update:check', () => updates.check())+ipcMain.on('update:install', () => {+ // A reply in progress would be cut off: the person decides.+ if (awakeBlocker !== null && mainWindow && !mainWindow.isDestroyed()) {+ const answer = dialog.showMessageBoxSync(mainWindow, {+ type: 'question',+ buttons: [L('Reiniciar agora', 'Restart now'), L('Depois', 'Later')],+ defaultId: 1,+ cancelId: 1,+ message: L('Um agente ainda está trabalhando', 'An agent is still working'),+ detail: L('Reiniciar agora interrompe o que ele está fazendo. Se esperar, a atualização entra quando você fechar o Tucano.', 'Restarting now stops what it is doing. If you wait, the update goes in when you quit Tucano.')+ })+ if (answer !== 0) return+ }+ updates.install()+})+// The Mac's folder picker, for a folder lent to an agent's computer. The core checks the choice.ipcMain.handle('pick-folder', async (event) => {const win = BrowserWindow.fromWebContents(event.sender)@@ -307,6 +330,7 @@ if (moved === 'old-app-open' || moved === 'keychain-denied') {powerMonitor.on('suspend', () => core?.postMessage({ type: 'power', awake: false }))powerMonitor.on('resume', () => core?.postMessage({ type: 'power', awake: true }))createWindow()+ updates.start()app.on('activate', () => {if (!mainWindow || mainWindow.isDestroyed()) createWindow()})diff --git a/src/main/updates.ts b/src/main/updates.tsnew file mode 100644index 0000000..8065d5b--- /dev/null+++ b/src/main/updates.ts@@ -0,0 +1,59 @@+// Updates (the installed app only): Tucano looks for a newer release on GitHub,+// downloads it in the background and says so; the person restarts when it suits+// them, or it goes in the next time the app quits. The release carries+// latest-mac.yml next to the .zip (scripts/release.sh), which is what's read here.+import { app } from 'electron'+import electronUpdater from 'electron-updater'+import type { UpdateState } from '../shared/types'++const FIRST_CHECK_MS = 20_000 // after opening, once the app has settled+const EVERY_MS = 4 * 3_600_000++export class Updates {+ private state: UpdateState+ private timer: NodeJS.Timeout | null = null+ private readonly updater = electronUpdater.autoUpdater++ constructor(private readonly onChange: (s: UpdateState) => void) {+ // A test points the app at a local server instead of GitHub.+ const feed = process.env['TUCANO_UPDATE_URL']+ this.state = { version: app.getVersion(), status: app.isPackaged || feed ? 'idle' : 'off' }+ if (this.state.status === 'off') return+ if (feed) this.updater.setFeedURL({ provider: 'generic', url: feed })+ this.updater.logger = null+ this.updater.autoDownload = true+ this.updater.autoInstallOnAppQuit = true+ this.updater.on('checking-for-update', () => this.set({ status: 'checking', error: 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) }))+ }++ get(): UpdateState {+ return this.state+ }++ start(): void {+ if (this.state.status === 'off') return+ setTimeout(() => this.check(), FIRST_CHECK_MS).unref()+ this.timer = setInterval(() => this.check(), EVERY_MS)+ this.timer.unref()+ }++ // Already downloading or ready: nothing new to ask for.+ check(): void {+ if (this.state.status === 'off' || this.state.status === 'checking' || this.state.status === 'downloading' || this.state.status === 'ready') return+ this.updater.checkForUpdates().catch(() => {}) // the 'error' event already says what went wrong+ }++ install(): void {+ if (this.state.status === 'ready') this.updater.quitAndInstall()+ }++ private set(patch: Partial<UpdateState>): void {+ this.state = { ...this.state, ...patch }+ this.onChange(this.state)+ }+}diff --git a/src/preload/index.ts b/src/preload/index.tsindex 8adea53..1659320 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -15,5 +15,12 @@ contextBridge.exposeInMainWorld('tucano', {ipcRenderer.on('navigate', (_e, id: unknown) => typeof id === 'string' && cb(id))},// The conversation on screen: the Mac doesn't notify about the one you're reading.- viewing: (conversationId: string | null): void => ipcRenderer.send('viewing', conversationId)+ viewing: (conversationId: string | null): void => ipcRenderer.send('viewing', conversationId),+ // The app's own updates.+ updateState: (): Promise<unknown> => ipcRenderer.invoke('update:state'),+ onUpdate: (cb: (state: unknown) => void): void => {+ ipcRenderer.on('update', (_e, state: unknown) => cb(state))+ },+ checkUpdates: (): void => ipcRenderer.send('update:check'),+ installUpdate: (): void => ipcRenderer.send('update:install')})diff --git a/src/renderer/src/components/Pages.tsx b/src/renderer/src/components/Pages.tsxindex 9bfd12f..576ab58 100644--- a/src/renderer/src/components/Pages.tsx+++ b/src/renderer/src/components/Pages.tsx@@ -57,6 +57,7 @@ import {import { HarnessList, HarnessMcps, ModelPicker, onGateway, OutsideGateway } from './Harness'import { ApprovalCard } from './Conversation'import { AgentAvatar, Icon, 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 {return (@@ -1499,6 +1500,12 @@ export function SettingsPage(): ReactNode {</Card>)}+ {pane('geral') && (+ <Card title={L('Atualizações', 'Updates')}>+ <UpdateSettings />+ </Card>+ )}+{pane('modelos') && (<Cardtitle="Harnesses"diff --git a/src/renderer/src/components/Sidebar.tsx b/src/renderer/src/components/Sidebar.tsxindex 6b6b875..c64ee96 100644--- a/src/renderer/src/components/Sidebar.tsx+++ b/src/renderer/src/components/Sidebar.tsx@@ -18,6 +18,7 @@ import {} from '../store'import { ContextMenu, type MenuItem, type MenuState } from './Dialogs'import { GettingStarted } from './Onboarding'+import { UpdateNote } from './Update'import { AgentAvatar, Icon, TucaMark, type IconName } from './ui'const same = (a: View | null, b: View): boolean => JSON.stringify(a) === JSON.stringify(b)@@ -195,6 +196,7 @@ export function Sidebar(): ReactNode {{s.settings.onboarding?.done && !s.settings.onboarding.checklistHidden && <GettingStarted />}<ContextMenu menu={menu} onClose={closeMenu} /><div className="sidebar__foot">+ <UpdateNote /><NavItem view={{ kind: 'usage' }} icon="chart" label={L('Uso e limites', 'Usage and limits')} /><NavItem view={{ kind: 'connectors' }} icon="plug" label={L('Conectores', 'Connectors')} /><NavItem view={{ kind: 'settings' }} icon="gear" label={L('Configurações', 'Settings')} />diff --git a/src/renderer/src/components/Update.tsx b/src/renderer/src/components/Update.tsxnew file mode 100644index 0000000..2a6cee1--- /dev/null+++ b/src/renderer/src/components/Update.tsx@@ -0,0 +1,101 @@+// A newer Tucano: a note at the foot of the sidebar once it's downloaded, and the+// state in Settings. The main process looks and downloads (src/main/updates.ts).+import { useSyncExternalStore, type ReactNode } from 'react'+import { L } from '../../../shared/lang'+import type { UpdateState } from '../../../shared/types'+import { ago } from './ui'++const RELEASES = 'https://github.com/eduwxyz/tucano/releases'++let current: UpdateState | null = null+const listeners = new Set<() => void>()+let watching = false++function watch(): void {+ if (watching || !window.tucano?.updateState) return+ watching = true+ const set = (s: UpdateState): void => {+ current = s+ listeners.forEach((l) => l())+ }+ void window.tucano.updateState().then(set)+ window.tucano.onUpdate(set)+}++function useUpdate(): UpdateState | null {+ watch()+ return useSyncExternalStore(+ (l) => {+ listeners.add(l)+ return () => listeners.delete(l)+ },+ () => current+ )+}++const notes = (version?: string): string => (version ? `${RELEASES}/tag/v${version}` : RELEASES)++export function UpdateNote(): ReactNode {+ const u = useUpdate()+ if (u?.status !== 'ready') return null+ return (+ <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>+ </div>+ <button className="btn btn--primary btn--sm" onClick={() => window.tucano.installUpdate()}>+ {L('Reiniciar', 'Restart')}+ </button>+ </div>+ )+}++function status(u: UpdateState): string {+ switch (u.status) {+ case 'off':+ return L('As atualizações funcionam no app instalado.', 'Updates work in the installed app.')+ case 'checking':+ return L('Procurando uma versão nova…', 'Looking for a new version…')+ case 'downloading':+ return L(`Baixando o Tucano ${u.next}… ${u.percent ?? 0}%`, `Downloading Tucano ${u.next}… ${u.percent ?? 0}%`)+ 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.')+ default:+ return u.checkedAt+ ? L(`É a versão mais recente. Conferido ${ago(u.checkedAt)}.`, `It’s the latest version. Checked ${ago(u.checkedAt)}.`)+ : L('O Tucano procura versões novas sozinho e avisa quando uma estiver pronta.', 'Tucano looks for new versions by itself and tells you when one is ready.')+ }+}++export function UpdateSettings(): ReactNode {+ const u = useUpdate()+ if (!u) return null+ const busy = u.status === 'checking' || u.status === 'downloading'+ return (+ <div className="field">+ <span className="hint">+ {L(`Você está na versão ${u.version}. `, `You’re on version ${u.version}. `)}+ {status(u)}+ </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>+ ) : (+ <button className="btn btn--sm" disabled={u.status === 'off' || busy} onClick={() => window.tucano.checkUpdates()}>+ {L('Procurar atualizações', 'Check for updates')}+ </button>+ )}+ <a className="link" href={notes(u.status === 'ready' ? u.next : u.version)} target="_blank" rel="noreferrer">+ {L('Notas da versão', 'Release notes')}+ </a>+ </div>+ </div>+ )+}diff --git a/src/renderer/src/rpc.ts b/src/renderer/src/rpc.tsindex c817bc1..eff1a5d 100644--- a/src/renderer/src/rpc.ts+++ b/src/renderer/src/rpc.ts@@ -1,8 +1,18 @@import type { CoreEvent, Method, Params, Request, Result, Wire } from '../../shared/rpc'+import type { UpdateState } from '../../shared/types'declare global {interface Window {- tucano: { connect: () => void; pickFolder: () => Promise<string | null>; onNavigate: (cb: (conversationId: string) => void) => void; viewing: (conversationId: string | null) => void }+ tucano: {+ connect: () => void+ pickFolder: () => Promise<string | null>+ onNavigate: (cb: (conversationId: string) => void) => void+ viewing: (conversationId: string | null) => void+ updateState: () => Promise<UpdateState>+ onUpdate: (cb: (state: UpdateState) => void) => void+ checkUpdates: () => void+ installUpdate: () => void+ }}}diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.cssindex 694a4be..0c87f06 100644--- a/src/renderer/src/styles.css+++ b/src/renderer/src/styles.css@@ -6192,3 +6192,30 @@ kbd {.cal-nav button:disabled:hover {background: none;}++/* ---------- a new version, ready to go in ---------- */+.update-note {+ display: flex;+ align-items: center;+ gap: 8px;+ margin: 0 0 8px;+ padding: 8px 8px 8px 10px;+ border-radius: 8px;+ background: var(--accent-soft);+}+.update-note__text {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ font-size: 12.5px;+ line-height: 1.35;+}+.update-note__text a {+ color: var(--accent);+ font-size: 12px;+ text-decoration: none;+}+.update-note__text a:hover {+ text-decoration: underline;+}diff --git a/src/shared/types.ts b/src/shared/types.tsindex ec72745..dcd36e0 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -15,6 +15,16 @@ export interface Model {hint: string}+// The app's own updates (src/main/updates.ts): off when run from the code.+export interface UpdateState {+ version: string // the one running+ status: 'off' | 'idle' | 'checking' | 'latest' | 'downloading' | 'ready' | 'error'+ next?: string // the newer version, while it downloads and once it's ready+ percent?: number+ checkedAt?: number+ error?: string+}+export interface EngineStatus {installed: booleanpath?: string