fix(acp): pass server auth to internal client (#25591)

This commit is contained in:
Shoubhit Dash 2026-05-03 18:42:24 +05:30 committed by GitHub
parent 2ad1eb56d3
commit 7a503de606
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ import { ACP } from "@/acp/agent"
import { Server } from "@/server/server"
import { createOpencodeClient } from "@opencode-ai/sdk/v2"
import { withNetworkOptions, resolveNetworkOptions } from "../network"
import { Flag } from "@opencode-ai/core/flag/flag"
const log = Log.create({ service: "acp-command" })
@ -26,6 +27,13 @@ export const AcpCommand = effectCmd({
const sdk = createOpencodeClient({
baseUrl: `http://${server.hostname}:${server.port}`,
headers: Flag.OPENCODE_SERVER_PASSWORD
? {
Authorization: `Basic ${Buffer.from(
`${Flag.OPENCODE_SERVER_USERNAME ?? "opencode"}:${Flag.OPENCODE_SERVER_PASSWORD}`,
).toString("base64")}`,
}
: undefined,
})
const input = new WritableStream<Uint8Array>({