fix(acp): pass server auth to internal client (#25591)
This commit is contained in:
@@ -6,6 +6,7 @@ import { ACP } from "@/acp/agent"
|
|||||||
import { Server } from "@/server/server"
|
import { Server } from "@/server/server"
|
||||||
import { createOpencodeClient } from "@opencode-ai/sdk/v2"
|
import { createOpencodeClient } from "@opencode-ai/sdk/v2"
|
||||||
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
||||||
|
import { Flag } from "@opencode-ai/core/flag/flag"
|
||||||
|
|
||||||
const log = Log.create({ service: "acp-command" })
|
const log = Log.create({ service: "acp-command" })
|
||||||
|
|
||||||
@@ -26,6 +27,13 @@ export const AcpCommand = effectCmd({
|
|||||||
|
|
||||||
const sdk = createOpencodeClient({
|
const sdk = createOpencodeClient({
|
||||||
baseUrl: `http://${server.hostname}:${server.port}`,
|
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>({
|
const input = new WritableStream<Uint8Array>({
|
||||||
|
|||||||
Reference in New Issue
Block a user