Skip to content

Commit 604ab1b

Browse files
committed
core: restore plugin serverUrl getter so plugins can connect to local server
1 parent fbd9b7c commit 604ab1b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/opencode/src/plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export namespace Plugin {
3535
worktree: Instance.worktree,
3636
directory: Instance.directory,
3737
get serverUrl(): URL {
38-
throw new Error("Server URL is no longer supported in plugins")
38+
return Server.url ?? new URL("http://localhost:4096")
3939
},
4040
$: Bun.$,
4141
}

packages/opencode/src/server/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,17 @@ export namespace Server {
585585
return result
586586
}
587587

588+
/** @deprecated do not use this dumb shit */
589+
export let url: URL
590+
588591
export function listen(opts: {
589592
port: number
590593
hostname: string
591594
mdns?: boolean
592595
mdnsDomain?: string
593596
cors?: string[]
594597
}) {
598+
url = new URL(`http://${opts.hostname}:${opts.port}`)
595599
const app = createApp(opts)
596600
const args = {
597601
hostname: opts.hostname,

0 commit comments

Comments
 (0)