Skip to content

Commit ddcb32a

Browse files
authored
refactor(tui): replace Bun-specific APIs with portable alternatives (#18304)
1 parent 2c056c9 commit ddcb32a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,12 +907,12 @@ export function Session() {
907907
const filename = options.filename.trim()
908908
const filepath = path.join(exportDir, filename)
909909

910-
await Bun.write(filepath, transcript)
910+
await Filesystem.write(filepath, transcript)
911911

912912
// Open with EDITOR if available
913913
const result = await Editor.open({ value: transcript, renderer })
914914
if (result !== undefined) {
915-
await Bun.write(filepath, result)
915+
await Filesystem.write(filepath, result)
916916
}
917917

918918
toast.show({ message: `Session exported to ${filename}`, variant: "success" })

packages/opencode/src/cli/cmd/tui/worker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { upgrade } from "@/cli/upgrade"
88
import { Config } from "@/config/config"
99
import { GlobalBus } from "@/bus/global"
1010
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/v2"
11-
import type { BunWebSocketData } from "hono/bun"
1211
import { Flag } from "@/flag/flag"
1312
import { setTimeout as sleep } from "node:timers/promises"
1413

@@ -38,7 +37,7 @@ GlobalBus.on("event", (event) => {
3837
Rpc.emit("global.event", event)
3938
})
4039

41-
let server: Bun.Server<BunWebSocketData> | undefined
40+
let server: Awaited<ReturnType<typeof Server.listen>> | undefined
4241

4342
const eventStream = {
4443
abort: undefined as AbortController | undefined,
@@ -120,7 +119,7 @@ export const rpc = {
120119
},
121120
async server(input: { port: number; hostname: string; mdns?: boolean; cors?: string[] }) {
122121
if (server) await server.stop(true)
123-
server = Server.listen(input)
122+
server = await Server.listen(input)
124123
return { url: server.url.toString() }
125124
},
126125
async checkUpgrade(input: { directory: string }) {
@@ -143,7 +142,7 @@ export const rpc = {
143142
Log.Default.info("worker shutting down")
144143
if (eventStream.abort) eventStream.abort.abort()
145144
await Instance.disposeAll()
146-
if (server) server.stop(true)
145+
if (server) await server.stop(true)
147146
},
148147
}
149148

0 commit comments

Comments
 (0)