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:
@@ -26,6 +26,7 @@ import {
|
||||
type SessionMetadataRecord,
|
||||
} from "@/lib/sessionReviewMetadata"
|
||||
import { withContextObligatoryMessage, type ContextObligatoryMessage } from "@/lib/contextObligatoryMessages"
|
||||
import { withLinkedIssue, type LinkedIssue } from "@/lib/linkedIssues"
|
||||
import { getImperativeSessionMessageLoader } from "./session-message-loader"
|
||||
import { cleanupPersistedSessionState } from "./session-deletion-cleanup"
|
||||
import { getRuntimeKey } from "@/lib/runtime-switch"
|
||||
@@ -792,6 +793,19 @@ export async function patchSessionMetadata(
|
||||
return updated
|
||||
}
|
||||
|
||||
export async function setLinkedIssue(
|
||||
sessionId: string,
|
||||
directory: string | null | undefined,
|
||||
issue: LinkedIssue,
|
||||
linked: boolean,
|
||||
): Promise<Session> {
|
||||
const updated = await patchSessionMetadata(sessionId, directory, (metadata) =>
|
||||
withLinkedIssue(metadata, issue, linked))
|
||||
const sessionDirectory = (updated as Session & { directory?: string | null }).directory ?? directory ?? undefined
|
||||
mirrorSessionIntoLiveStores(updated, sessionDirectory ?? undefined)
|
||||
return updated
|
||||
}
|
||||
|
||||
export async function setContextObligatoryMessage(
|
||||
sessionId: string,
|
||||
directory: string | null | undefined,
|
||||
|
||||
@@ -3255,14 +3255,20 @@ export function useSessionMessageRecords(
|
||||
// (e.g. multiple ToolParts) request the same session's messages.
|
||||
const _ensureMessagesLoading = new Set<string>()
|
||||
|
||||
export function useEnsureSessionMessages(sessionID: string, directory?: string) {
|
||||
/**
|
||||
* @param enabled Gate for callers that only need a session materialised under
|
||||
* a specific condition — a panel resolving pinned message text, say. Loading a
|
||||
* whole session is not free, so "something is missing" is not on its own a
|
||||
* reason to fetch it.
|
||||
*/
|
||||
export function useEnsureSessionMessages(sessionID: string, directory?: string, enabled = true) {
|
||||
const syncDirectory = useSyncDirectory()
|
||||
const resolvedDirectory = directory ?? syncDirectory
|
||||
const store = useDirectoryStore(resolvedDirectory)
|
||||
const requestGenerationRef = React.useRef(0)
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!sessionID) return
|
||||
if (!sessionID || !enabled) return
|
||||
|
||||
const state = store.getState()
|
||||
// Already loaded into a renderable message/part snapshot — nothing to do.
|
||||
@@ -3288,7 +3294,7 @@ export function useEnsureSessionMessages(sessionID: string, directory?: string)
|
||||
_ensureMessagesLoading.delete(loadingKey)
|
||||
}
|
||||
})()
|
||||
}, [sessionID, store, resolvedDirectory])
|
||||
}, [enabled, sessionID, store, resolvedDirectory])
|
||||
}
|
||||
const EMPTY_MESSAGES: Message[] = []
|
||||
const EMPTY_PARTS: Part[] = []
|
||||
|
||||
Reference in New Issue
Block a user