Show opencode auth list in OpenCode diagnostic
Helps diagnose missing subscription models — surfaces which providers the daemon-spawned opencode sees as authenticated.
This commit is contained in:
@@ -49,7 +49,7 @@ import {
|
|||||||
import { findExecutable, isCommandAvailable } from "../../../utils/executable.js";
|
import { findExecutable, isCommandAvailable } from "../../../utils/executable.js";
|
||||||
import { terminateWithTreeKill } from "../../../utils/tree-kill.js";
|
import { terminateWithTreeKill } from "../../../utils/tree-kill.js";
|
||||||
import { withTimeout } from "../../../utils/promise-timeout.js";
|
import { withTimeout } from "../../../utils/promise-timeout.js";
|
||||||
import { spawnProcess } from "../../../utils/spawn.js";
|
import { execCommand, spawnProcess } from "../../../utils/spawn.js";
|
||||||
import { buildToolCallDisplayModel } from "../../../shared/tool-call-display.js";
|
import { buildToolCallDisplayModel } from "../../../shared/tool-call-display.js";
|
||||||
import { mapOpencodeToolCall } from "./opencode/tool-call-mapper.js";
|
import { mapOpencodeToolCall } from "./opencode/tool-call-mapper.js";
|
||||||
import {
|
import {
|
||||||
@@ -1228,6 +1228,20 @@ export class OpenCodeAgentClient implements AgentClient {
|
|||||||
serverStatus = `Unavailable (${toDiagnosticErrorMessage(error)})`;
|
serverStatus = `Unavailable (${toDiagnosticErrorMessage(error)})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let authValue = "Not checked";
|
||||||
|
if (resolvedBinary) {
|
||||||
|
try {
|
||||||
|
const { stdout, stderr } = await execCommand(resolvedBinary, ["auth", "list"], {
|
||||||
|
...createProviderEnvSpec(),
|
||||||
|
timeout: 5_000,
|
||||||
|
});
|
||||||
|
const text = (stdout.trim() || stderr.trim()).trim();
|
||||||
|
authValue = text ? `\n ${text.replace(/\n/g, "\n ")}` : "(empty)";
|
||||||
|
} catch (error) {
|
||||||
|
authValue = `Error - ${toDiagnosticErrorMessage(error)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (available) {
|
if (available) {
|
||||||
try {
|
try {
|
||||||
const models = await this.listModels({ cwd: homedir(), force: false });
|
const models = await this.listModels({ cwd: homedir(), force: false });
|
||||||
@@ -1263,6 +1277,7 @@ export class OpenCodeAgentClient implements AgentClient {
|
|||||||
value: resolvedBinary ? await resolveBinaryVersion(resolvedBinary) : "unknown",
|
value: resolvedBinary ? await resolveBinaryVersion(resolvedBinary) : "unknown",
|
||||||
},
|
},
|
||||||
{ label: "Server", value: serverStatus },
|
{ label: "Server", value: serverStatus },
|
||||||
|
{ label: "Auth", value: authValue },
|
||||||
{ label: "Models", value: modelsValue },
|
{ label: "Models", value: modelsValue },
|
||||||
{ label: "Status", value: status },
|
{ label: "Status", value: status },
|
||||||
]),
|
]),
|
||||||
|
|||||||
Reference in New Issue
Block a user