mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-03 15:43:45 +00:00
fix: auto upgrade toast message (#4625)
Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: opencode <opencode@sst.dev>
This commit is contained in:
@@ -426,6 +426,15 @@ function App() {
|
||||
})
|
||||
})
|
||||
|
||||
event.on(Installation.Event.UpdateAvailable.type, (evt) => {
|
||||
toast.show({
|
||||
variant: "info",
|
||||
title: "Update Available",
|
||||
message: `OpenCode v${evt.properties.version} is available. Run 'opencode upgrade' to update manually.`,
|
||||
duration: 10000,
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<box
|
||||
width={dimensions().width}
|
||||
|
||||
@@ -99,7 +99,8 @@ export const TuiThreadCommand = cmd({
|
||||
if (!args.prompt) return piped
|
||||
return piped ? piped + "\n" + args.prompt : args.prompt
|
||||
})
|
||||
await tui({
|
||||
|
||||
const tuiPromise = tui({
|
||||
url: server.url,
|
||||
args: {
|
||||
continue: args.continue,
|
||||
@@ -112,5 +113,11 @@ export const TuiThreadCommand = cmd({
|
||||
await client.call("shutdown", undefined)
|
||||
},
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
client.call("checkUpgrade", { directory: cwd }).catch(() => {})
|
||||
}, 1000)
|
||||
|
||||
await tuiPromise
|
||||
},
|
||||
})
|
||||
|
||||
@@ -26,8 +26,6 @@ process.on("uncaughtException", (e) => {
|
||||
})
|
||||
})
|
||||
|
||||
upgrade()
|
||||
|
||||
let server: Bun.Server<undefined>
|
||||
export const rpc = {
|
||||
async server(input: { port: number; hostname: string }) {
|
||||
@@ -42,6 +40,14 @@ export const rpc = {
|
||||
throw e
|
||||
}
|
||||
},
|
||||
async checkUpgrade(input: { directory: string }) {
|
||||
await Instance.provide({
|
||||
directory: input.directory,
|
||||
fn: async () => {
|
||||
await upgrade().catch(() => {})
|
||||
},
|
||||
})
|
||||
},
|
||||
async shutdown() {
|
||||
Log.Default.info("worker shutting down")
|
||||
await Instance.disposeAll()
|
||||
|
||||
Reference in New Issue
Block a user