feat(chat): work-status panel, and MCP auth and settings fixes (#2776)
Adds a work-status panel beside the transcript. Context fill, model and cost, todos, running subagents and the permission requests blocking them, branch and working-tree state, MCP servers, pinned messages and context sources were scattered across the header, the composer and the context panel — a blocked subagent was reported nowhere at all. The panel reads them from live channels rather than persisted history, and becomes an overlay where the chat is too narrow to seat a column. It is on by default, including for existing installs. Because it now carries these readouts, the desktop header and composer drop the ones it duplicates: todo and changed-files chips, usage and MCP tabs. VS Code and mobile keep theirs — neither hosts the panel. Fixes MCP authorization, which was broken from the panel, invalidated by a directory switch through a redirect URI that encoded the working directory, and left the desktop app in the background because browsers will not follow a custom-protocol link without a user gesture. The settings page no longer asks the user to understand the MCP spec before adding a server: one field takes the command or the link, with the kind inferred and a visible override, and client-registration fields appear only when a server actually asks for its own credentials. Also: skills load from the panel instead of only when the composer's slash autocomplete opens; the header button names the current instance rather than falling through to the word "Instance" for relay hosts. Three new optional UI settings keys, all migrated. No change to stored MCP server configuration.
This commit is contained in:
@@ -357,6 +357,11 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
||||
const entry = {
|
||||
name,
|
||||
directory: normalizePendingString(req.body?.directory),
|
||||
// Which surface started the flow. It belongs here rather than in the
|
||||
// redirect URI: that URI is written into the server's config once and
|
||||
// deliberately never rewritten, so anything encoded in it would be
|
||||
// frozen at whatever runtime authorised first.
|
||||
origin: normalizePendingString(req.body?.origin),
|
||||
expiresAt: Date.now() + PENDING_MCP_AUTH_TTL_MS,
|
||||
};
|
||||
pendingMcpAuthContextByState.set(state, entry);
|
||||
@@ -366,6 +371,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
||||
context: {
|
||||
name: entry.name,
|
||||
directory: entry.directory,
|
||||
origin: entry.origin,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -176,6 +176,16 @@ export const createSettingsHelpers = (dependencies) => {
|
||||
const normalized = normalizeDirectoryPath(candidate.opencodeBinary).trim();
|
||||
result.opencodeBinary = normalized;
|
||||
}
|
||||
if (typeof candidate.workStatusPanelEnabled === 'boolean') {
|
||||
result.workStatusPanelEnabled = candidate.workStatusPanelEnabled;
|
||||
}
|
||||
if (Array.isArray(candidate.workStatusHiddenSections)) {
|
||||
// Ids are validated on the client, which owns the section list; here we
|
||||
// only guarantee the shape, so a malformed payload cannot land on disk.
|
||||
result.workStatusHiddenSections = [
|
||||
...new Set(candidate.workStatusHiddenSections.filter((entry) => typeof entry === 'string' && entry.length > 0)),
|
||||
];
|
||||
}
|
||||
if (typeof candidate.desktopLanAccessEnabled === 'boolean') {
|
||||
result.desktopLanAccessEnabled = candidate.desktopLanAccessEnabled;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { createOpencodeClient } from '@opencode-ai/sdk/v2';
|
||||
import { buildDeferredRestartResponse } from './config-mutation-response.js';
|
||||
|
||||
/**
|
||||
* Matches how OpenCode reads its own boolean env flags: any value other than
|
||||
* unset, empty, "0" or "false" enables the flag.
|
||||
*/
|
||||
const isEnvFlagEnabled = (value) => {
|
||||
if (typeof value !== 'string') return false;
|
||||
const normalized = value.trim().toLowerCase();
|
||||
return normalized.length > 0 && normalized !== '0' && normalized !== 'false';
|
||||
};
|
||||
|
||||
export const registerSkillRoutes = (app, dependencies) => {
|
||||
const {
|
||||
fs,
|
||||
@@ -250,7 +260,24 @@ export const registerSkillRoutes = (app, dependencies) => {
|
||||
};
|
||||
});
|
||||
|
||||
res.json({ skills: enrichedSkills });
|
||||
// OpenCode decides which external skill roots it loads from process
|
||||
// env, and the browser cannot read that. Report the flags alongside the
|
||||
// scan so the client can narrow its list to what the agent can actually
|
||||
// invoke.
|
||||
//
|
||||
// OpenCode's own skill-list endpoint is not usable for this: on 1.18.14
|
||||
// it returns only global and builtin skills, omitting the project
|
||||
// `.agents`/`.claude` skills the agent demonstrably has.
|
||||
res.json({
|
||||
skills: enrichedSkills,
|
||||
externalSkills: {
|
||||
// `OPENCODE_DISABLE_CLAUDE_CODE` is the broad switch; the specific
|
||||
// one wins independently — OpenCode ORs them.
|
||||
claudeDisabled: isEnvFlagEnabled(process.env.OPENCODE_DISABLE_CLAUDE_CODE)
|
||||
|| isEnvFlagEnabled(process.env.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS),
|
||||
allDisabled: isEnvFlagEnabled(process.env.OPENCODE_DISABLE_EXTERNAL_SKILLS),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to list skills:', error);
|
||||
res.status(500).json({ error: 'Failed to list skills' });
|
||||
|
||||
Reference in New Issue
Block a user