diff --git a/cli/src/api/apiMachine.ts b/cli/src/api/apiMachine.ts index 81dedfca..bfbded40 100644 --- a/cli/src/api/apiMachine.ts +++ b/cli/src/api/apiMachine.ts @@ -66,6 +66,7 @@ import { collectMachineHealth } from '@/utils/machineHealth' import { inspectCursorChatStore } from '@/cursor/cursorChatStoreStatus' import { homedir } from 'node:os' import type { CursorChatStoreStatus } from '@hapi/protocol/apiTypes' +import { getAgentAvailabilityResponse } from '@/agent/agentAvailability' import { MachinePathPolicy } from './machinePathPolicy' type MachineRpcHandlers = { @@ -188,6 +189,11 @@ export class ApiMachineClient { } ) + this.rpcHandlerManager.registerHandler, AgentAvailabilityResponse>( + RPC_METHODS.AgentAvailability, + async () => getAgentAvailabilityResponse() + ) + this.rpcHandlerManager.registerHandler(RPC_METHODS.ListMachineDirectory, async (params) => { if (!this.normalizedWorkspaceRoots?.length) { return { success: false, error: 'Workspace browsing is not enabled for this machine' } diff --git a/cli/src/modules/common/codexSessions.test.ts b/cli/src/modules/common/codexSessions.test.ts index c4188230..48a50b0c 100644 --- a/cli/src/modules/common/codexSessions.test.ts +++ b/cli/src/modules/common/codexSessions.test.ts @@ -136,6 +136,33 @@ describe('listLocalCodexSessionSummaries', () => { rmSync(root, { recursive: true, force: true }) }) + it('keeps the summary scan bounded for large transcripts while retaining the tail preview', () => { + const root = mkdtempSync(join(tmpdir(), 'codex-home-')) + process.env.CODEX_HOME = root + const sessionsDir = join(root, 'sessions', '2026', '07', '19') + mkdirSync(sessionsDir, { recursive: true }) + const sessionFile = join(sessionsDir, 'large.jsonl') + const lastMessage = JSON.stringify({ + type: 'response_item', + payload: { type: 'message', role: 'user', content: [{ type: 'input_text', text: 'last prompt' }] } + }) + writeFileSync(sessionFile, [ + JSON.stringify({ type: 'session_meta', payload: { id: 'large-session-id', cwd: '/tmp/project' } }), + JSON.stringify({ type: 'response_item', payload: { type: 'message', role: 'user', content: [{ type: 'input_text', text: 'first prompt' }] } }), + 'x'.repeat(96 * 1024), + lastMessage + ].join('\n')) + + expect(listLocalCodexSessionSummaries()).toEqual([ + expect.objectContaining({ + id: 'large-session-id', + lastUserMessage: 'last prompt' + }) + ]) + + rmSync(root, { recursive: true, force: true }) + }) + it('skips subagent transcripts', () => { const root = mkdtempSync(join(tmpdir(), 'codex-home-')) process.env.CODEX_HOME = root diff --git a/cli/src/modules/common/codexSessions.ts b/cli/src/modules/common/codexSessions.ts index b0dcda98..bfa9f101 100644 --- a/cli/src/modules/common/codexSessions.ts +++ b/cli/src/modules/common/codexSessions.ts @@ -1,4 +1,4 @@ -import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, statSync } from 'node:fs' +import { closeSync, existsSync, fstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, renameSync, statSync } from 'node:fs' import { randomUUID } from 'node:crypto' import { basename, dirname, join, relative } from 'node:path' import { homedir } from 'node:os' @@ -6,6 +6,7 @@ import { AGENT_MESSAGE_PAYLOAD_TYPE } from '@hapi/protocol' import { isCodexSubagentSource } from '@/codex/utils/codexSessionMetadata' const DEFAULT_CODEX_SESSION_SCAN_LIMIT = 200 +const CODEX_SESSION_SUMMARY_READ_BYTES = 64 * 1024 type CodexSessionIndexTitle = { threadName: string @@ -142,6 +143,39 @@ function readCodexSessionIndexTitles(): Map { return titles } +function readFileChunk(descriptor: number, position: number, length: number): string { + const buffer = Buffer.alloc(length) + const bytesRead = readSync(descriptor, buffer, 0, length, position) + return buffer.toString('utf-8', 0, bytesRead) +} + +function readCodexSessionSummaryContent(filePath: string): { head: string; tail: string; modifiedAt: number } | null { + let descriptor: number + try { + descriptor = openSync(filePath, 'r') + } catch { + return null + } + + try { + const fileStats = fstatSync(descriptor) + const modifiedAt = fileStats.mtimeMs + const fileSize = fileStats.size + const headLength = Math.min(fileSize, CODEX_SESSION_SUMMARY_READ_BYTES) + const head = readFileChunk(descriptor, 0, headLength) + if (fileSize <= CODEX_SESSION_SUMMARY_READ_BYTES) { + return { head, tail: head, modifiedAt } + } + + const tail = readFileChunk(descriptor, fileSize - CODEX_SESSION_SUMMARY_READ_BYTES, CODEX_SESSION_SUMMARY_READ_BYTES) + return { head, tail, modifiedAt } + } catch { + return null + } finally { + closeSync(descriptor) + } +} + function extractCodexChangedTitle(record: Record): string | null { if (record.type === 'response_item') { const payload = asRecord(record.payload) @@ -304,9 +338,24 @@ function parseCodexLocalSession( includeMessages: boolean, sessionIndexTitles = new Map() ): LocalCodexSessionWithMessages | LocalCodexSessionSummary | null { - let content: string - try { content = readFileSync(filePath, 'utf-8') } catch { return null } - const lines = content.split(/\r?\n/).filter(Boolean) + let lines: string[] + let summaryTailLines: string[] + let modifiedAt = Date.now() + if (includeMessages) { + let content: string + try { + content = readFileSync(filePath, 'utf-8') + modifiedAt = statSync(filePath).mtimeMs + } catch { return null } + lines = content.split(/\r?\n/).filter(Boolean) + summaryTailLines = lines + } else { + const content = readCodexSessionSummaryContent(filePath) + if (!content) return null + lines = content.head.split(/\r?\n/).filter(Boolean) + summaryTailLines = content.tail.split(/\r?\n/).filter(Boolean) + modifiedAt = content.modifiedAt + } const headLines = lines.slice(0, 200) let sessionId: string | null = null let cwd: string | null = null @@ -356,10 +405,8 @@ function parseCodexLocalSession( sessionId = sessionId ?? inferSessionIdFromFileName(filePath) if (!sessionId) return null const sessionIndexTitle = sessionIndexTitles.get(sessionId)?.threadName ?? null - const changedTitle = getLatestCodexChangedTitle(lines) - const lastUserMessage = getLatestCodexUserMessage(lines) - let modifiedAt = Date.now() - try { modifiedAt = statSync(filePath).mtimeMs } catch {} + const changedTitle = getLatestCodexChangedTitle(summaryTailLines) + const lastUserMessage = getLatestCodexUserMessage(summaryTailLines) const summary = { id: sessionId, title: getCodexSessionTitle(cwd, sessionId, sessionIndexTitle, changedTitle, firstUserMessage), diff --git a/cli/src/modules/common/copilotModels.test.ts b/cli/src/modules/common/copilotModels.test.ts new file mode 100644 index 00000000..f76ec22a --- /dev/null +++ b/cli/src/modules/common/copilotModels.test.ts @@ -0,0 +1,20 @@ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { listCopilotModelsForCwd } from './copilotModels' + +describe('Copilot model discovery', () => { + afterEach(() => { + vi.unstubAllEnvs() + }) + + it('returns an availability error without spawning a missing Copilot CLI', async () => { + vi.stubEnv('COPILOT_CLI_PATH', '/definitely/missing/copilot') + + await expect(listCopilotModelsForCwd('/tmp/hapi-copilot-unavailable')) + .resolves.toMatchObject({ + success: false, + error: 'Copilot CLI is not installed or not on PATH', + availableModels: [], + currentModelId: null, + }) + }) +}) diff --git a/cli/src/modules/common/copilotModels.ts b/cli/src/modules/common/copilotModels.ts index 5eb73402..ef4c2d30 100644 --- a/cli/src/modules/common/copilotModels.ts +++ b/cli/src/modules/common/copilotModels.ts @@ -3,6 +3,7 @@ import { createMessageConnection, StreamMessageReader, StreamMessageWriter } fro import { asString, isObject } from '@hapi/protocol'; import type { CopilotModelsResponse, CopilotModelSummary } from '@hapi/protocol/apiTypes'; import { createCopilotBackend } from '@/copilot/utils/copilotBackend'; +import { getAgentAvailability } from '@/agent/agentAvailability'; import { getErrorMessage } from './rpcResponses'; export interface ListCopilotModelsForCwdRequest { @@ -167,6 +168,16 @@ async function listModelsViaAcpProbe(cwd: string): Promise<{ } async function runCopilotProbe(cwd: string): Promise { + const availability = getAgentAvailability('copilot'); + if (!availability.available) { + return { + success: false, + error: `Copilot CLI ${availability.reason === 'invalid_configuration' ? 'configuration is invalid' : 'is not installed or not on PATH'}`, + availableModels: [], + currentModelId: null, + }; + } + try { // Prefer SDK headless models.list — subscription-aware (Student → auto only). const sdkModels = await listModelsViaSdkHeadless(); diff --git a/web/src/components/NewSession/AgentSelector.tsx b/web/src/components/NewSession/AgentSelector.tsx index 24886e17..455481c0 100644 --- a/web/src/components/NewSession/AgentSelector.tsx +++ b/web/src/components/NewSession/AgentSelector.tsx @@ -35,6 +35,11 @@ export function AgentSelector(props: { {getFlavorLabel(agentType)} ))} + {props.agents.length === 0 ? ( + + {t('newSession.agentUnavailable')} + + ) : null} ) diff --git a/web/src/components/NewSession/index.test.tsx b/web/src/components/NewSession/index.test.tsx index bca6c8a5..0c91b2df 100644 --- a/web/src/components/NewSession/index.test.tsx +++ b/web/src/components/NewSession/index.test.tsx @@ -30,6 +30,7 @@ const mocks = vi.hoisted(() => ({ piModels: [] as PiModelSummary[], piModelsLoading: false, piModelsError: null as string | null, + agentAvailability: [] as Array<{ agent: string; available: boolean; reason?: string }>, opencodeModels: [] as Array<{ modelId: string; name?: string }>, opencodeModelsLoading: false, nextModelValue: 'gpt-5.6-terra', @@ -56,6 +57,15 @@ vi.mock('@/hooks/mutations/useSpawnSession', () => ({ vi.mock('@/hooks/queries/useSessions', () => ({ useSessions: () => ({ sessions: [], refetch: mocks.refetchSessions }) })) +vi.mock('@/hooks/queries/useAgentAvailability', () => ({ + useAgentAvailability: () => ({ + agents: mocks.agentAvailability, + isLoading: false, + error: null, + upgradeRequired: false, + refetch: vi.fn() + }) +})) vi.mock('@/hooks/useRecentPaths', () => ({ useRecentPaths: () => ({ getRecentPaths: () => [], @@ -358,6 +368,7 @@ describe('NewSession launch preferences', () => { mocks.piModels = [] mocks.piModelsLoading = false mocks.piModelsError = null + mocks.agentAvailability = [] mocks.nextModelValue = 'gpt-5.6-terra' mocks.refetchSessions.mockReset() mocks.refetchSessions.mockResolvedValue(undefined) @@ -394,6 +405,30 @@ describe('NewSession launch preferences', () => { }) }) + it('hides agents unavailable on the selected machine by default', async () => { + mocks.agentAvailability = [ + { agent: 'claude', available: true }, + { agent: 'codex', available: true }, + { agent: 'copilot', available: false, reason: 'not_found' }, + ] + + render( + {}} + /> + ) + + expect(screen.getByDisplayValue('claude')).toBeInTheDocument() + expect(screen.getByDisplayValue('codex')).toBeInTheDocument() + expect(screen.queryByDisplayValue('copilot')).not.toBeInTheDocument() + }) + it('does not migrate a legacy YOLO value owned by a non-Codex agent', async () => { savePreferredAgent('claude') savePreferredYoloMode(true) diff --git a/web/src/components/NewSession/index.tsx b/web/src/components/NewSession/index.tsx index d15be1a9..b8054eb7 100644 --- a/web/src/components/NewSession/index.tsx +++ b/web/src/components/NewSession/index.tsx @@ -14,6 +14,7 @@ import { useOpencodeModelsForCwd } from '@/hooks/queries/useOpencodeModelsForCwd import { useGrokModelsForCwd } from '@/hooks/queries/useGrokModelsForCwd' import { useCopilotModelsForCwd } from '@/hooks/queries/useCopilotModelsForCwd' import { usePiModelsForMachine } from '@/hooks/queries/usePiModelsForMachine' +import { useAgentAvailability } from '@/hooks/queries/useAgentAvailability' import { useSessions } from '@/hooks/queries/useSessions' import { useActiveSuggestions, type Suggestion } from '@/hooks/useActiveSuggestions' import { useDirectorySuggestions } from '@/hooks/useDirectorySuggestions' @@ -82,6 +83,7 @@ import { ConfirmDialog } from '@/components/ui/ConfirmDialog' import { formatRunnerSpawnError } from '../../utils/formatRunnerSpawnError' import { markCodexSessionsImported } from '@/lib/codexImportedSessions' import { useToast } from '@/lib/toast-context' +import { useShowUnavailableAgents } from '@/hooks/useShowUnavailableAgents' @@ -107,6 +109,7 @@ export function NewSession(props: { const { spawnSession, isPending, error: spawnError } = useSpawnSession(props.api) const { sessions, refetch: refetchSessions } = useSessions(props.api) const { getRecentPaths, addRecentPath, getLastUsedMachineId, setLastUsedMachineId } = useRecentPaths() + const { showUnavailableAgents } = useShowUnavailableAgents() const [machineId, setMachineId] = useState(props.initialMachineId ?? null) const [directory, setDirectory] = useState(props.initialDirectory ?? '') @@ -332,15 +335,54 @@ export function NewSession(props: { () => (machineId ? props.machines.find((machine) => machine.id === machineId) ?? null : null), [machineId, props.machines] ) + const agentAvailabilityState = useAgentAvailability({ + api: props.api, + machineId, + }) + const availableAgentFlavors = useMemo( + () => new Set( + agentAvailabilityState.agents + .filter((entry) => entry.available) + .map((entry) => entry.agent) + ), + [agentAvailabilityState.agents] + ) + // Only a concrete response can identify which agents are installed. An + // older runner (upgradeRequired) falls back to the legacy full list so it + // remains usable while its model probes keep working. + const agentAvailabilityKnown = agentAvailabilityState.agents.length > 0 + const visibleAgentFlavors = useMemo( + () => agentAvailabilityKnown && !showUnavailableAgents + ? CREATABLE_AGENT_FLAVORS.filter((flavor) => availableAgentFlavors.has(flavor)) + : CREATABLE_AGENT_FLAVORS, + [agentAvailabilityKnown, availableAgentFlavors, showUnavailableAgents] + ) + const canUseSelectedAgent = !agentAvailabilityKnown || availableAgentFlavors.has(agent) + + useEffect(() => { + if (!agentAvailabilityKnown || showUnavailableAgents || visibleAgentFlavors.length === 0) { + return + } + if (!availableAgentFlavors.has(agent)) { + setAgent(visibleAgentFlavors[0]!) + } + }, [agent, agentAvailabilityKnown, availableAgentFlavors, showUnavailableAgents, visibleAgentFlavors]) + + const agentIsAvailableForQueries = useCallback((flavor: AgentType): boolean => { + return agentAvailabilityKnown + ? availableAgentFlavors.has(flavor) + : agentAvailabilityState.upgradeRequired + }, [agentAvailabilityKnown, agentAvailabilityState.upgradeRequired, availableAgentFlavors]) + const codexModelsState = useCodexModels({ api: props.api, machineId, - enabled: agent === 'codex' && Boolean(machineId) + enabled: agent === 'codex' && Boolean(machineId) && agentIsAvailableForQueries('codex') }) const dshModelsState = useDshModels({ api: props.api, machineId, - enabled: agent === 'dsh' && Boolean(machineId) + enabled: agent === 'dsh' && Boolean(machineId) && agentIsAvailableForQueries('dsh') }) const [agySelectedModel, setAgySelectedModel] = useState(null) const [claudeCustomModels, setClaudeCustomModels] = useState([]) @@ -495,7 +537,7 @@ export function NewSession(props: { const cursorModelsState = useCursorModelsForMachine({ api: props.api, machineId, - enabled: agent === 'cursor' && Boolean(machineId) + enabled: agent === 'cursor' && Boolean(machineId) && agentIsAvailableForQueries('cursor') }) const cursorPicker = useMemo( () => buildNewSessionCursorPickerState( @@ -665,7 +707,7 @@ export function NewSession(props: { // Gate on positive existence: typing partial paths must not spawn an // expensive `opencode acp` probe for a non-existent cwd while the // existence check is in flight. - enabled: shouldEnableOpencodeModelDiscovery({ + enabled: agentIsAvailableForQueries('opencode') && shouldEnableOpencodeModelDiscovery({ agent, machineId, cwd: deferredDirectory, @@ -676,7 +718,7 @@ export function NewSession(props: { api: props.api, machineId, cwd: deferredDirectory, - enabled: shouldEnableGrokModelDiscovery({ + enabled: agentIsAvailableForQueries('grok') && shouldEnableGrokModelDiscovery({ agent, machineId, cwd: deferredDirectory, @@ -687,7 +729,9 @@ export function NewSession(props: { api: props.api, machineId, cwd: deferredDirectory, - enabled: agent === 'copilot' && deferredDirectoryExists === true + enabled: agent === 'copilot' + && agentIsAvailableForQueries('copilot') + && deferredDirectoryExists === true }) const copilotModelOptions = useMemo( () => [ @@ -725,12 +769,12 @@ export function NewSession(props: { const agyModelsState = useAgyModels({ api: props.api, machineId, - enabled: agent === 'agy' && Boolean(machineId) + enabled: agent === 'agy' && Boolean(machineId) && agentIsAvailableForQueries('agy') }) const piModelsState = usePiModelsForMachine({ api: props.api, machineId, - enabled: agent === 'pi' && Boolean(machineId) + enabled: agent === 'pi' && Boolean(machineId) && agentIsAvailableForQueries('pi') }) // Pi models are grouped by provider (optionSource: 'machine' in the agent // config descriptor). Option values are provider-qualified @@ -2057,6 +2101,7 @@ export function NewSession(props: { && !missingWorktreeDirectory && !isLaunchPreferenceValidationPending && !fastModeSelectionPending + && canUseSelectedAgent ) return ( @@ -2132,10 +2177,15 @@ export function NewSession(props: { /> + {agentAvailabilityKnown && !canUseSelectedAgent ? ( +
+ {t('newSession.agentUnavailableOnMachine')} +
+ ) : null} {sessionType !== 'team' && !props.teamId && agent === 'claude' ? ( void +} { + const [showUnavailableAgents, setShowUnavailableAgentsState] = useState(readPreference) + + useEffect(() => { + if (!isBrowser()) return + const onStorage = (event: StorageEvent) => { + if (event.key === STORAGE_KEY) { + setShowUnavailableAgentsState(event.newValue === 'true') + } + } + window.addEventListener('storage', onStorage) + return () => window.removeEventListener('storage', onStorage) + }, []) + + const setShowUnavailableAgents = useCallback((value: boolean) => { + setShowUnavailableAgentsState(value) + if (!isBrowser()) return + try { + if (value === DEFAULT_SHOW_UNAVAILABLE_AGENTS) { + localStorage.removeItem(STORAGE_KEY) + } else { + localStorage.setItem(STORAGE_KEY, String(value)) + } + } catch { + // Ignore storage errors. + } + }, []) + + return { showUnavailableAgents, setShowUnavailableAgents } +} diff --git a/web/src/lib/locales/en.ts b/web/src/lib/locales/en.ts index 76960598..356aba8a 100644 --- a/web/src/lib/locales/en.ts +++ b/web/src/lib/locales/en.ts @@ -399,6 +399,8 @@ export default { 'newSession.type.worktree.desc': 'Create a new worktree next to repo (Cursor uses native ~/.cursor/worktrees)', 'newSession.type.worktree.placeholder': 'feature-x (default 1228-xxxx)', 'newSession.agent': 'Agent', + 'newSession.agentUnavailable': 'No agents are available on the selected machine.', + 'newSession.agentUnavailableOnMachine': 'This agent is not available on the selected machine.', 'newSession.model': 'Model', 'newSession.effort': 'Effort', 'newSession.model.optional': 'optional', @@ -858,6 +860,8 @@ export default { 'settings.general.agents.description': 'Hub-wide defaults for how agents behave in new and resumed sessions.', 'settings.general.sessionSummaryContract': 'Ask agents to emit session status summary', 'settings.general.sessionSummaryContract.desc': 'When on, Claude, Codex, OpenCode, and remote Grok sessions are asked to end each turn with an AGENT_NOTIFY_SUMMARY line for denser ready notifications. Off by default. Local Grok and Cursor are not covered yet. Applies to new/resumed sessions.', + 'settings.general.showUnavailableAgents': 'Show unavailable agents', + 'settings.general.showUnavailableAgents.desc': 'Show agent types whose CLI is not installed or configured on the selected machine. Off by default.', 'settings.general.sessionSummaryInChat': 'Show session status summary in chat', 'settings.general.sessionSummaryInChat.desc': 'When on, assistant messages show a compact status row instead of raw AGENT_NOTIFY_SUMMARY JSON. Off by default (hidden from chat and copy). Stored messages, notifications, and capture are unchanged.', 'settings.language.title': 'Language', diff --git a/web/src/lib/locales/zh-CN.ts b/web/src/lib/locales/zh-CN.ts index 6b4e41fe..2c026ef0 100644 --- a/web/src/lib/locales/zh-CN.ts +++ b/web/src/lib/locales/zh-CN.ts @@ -403,6 +403,8 @@ export default { 'newSession.type.worktree.desc': '在仓库旁创建新工作树(Cursor 使用原生 ~/.cursor/worktrees)', 'newSession.type.worktree.placeholder': 'feature-x (默认 1228-xxxx)', 'newSession.agent': '代理', + 'newSession.agentUnavailable': '所选设备上没有可用的智能体。', + 'newSession.agentUnavailableOnMachine': '所选设备上没有可用的这个智能体。', 'newSession.model': '模型', 'newSession.effort': '思考强度', 'newSession.model.optional': '可选', @@ -857,6 +859,8 @@ export default { 'settings.general.agents.description': '适用于新建与恢复会话的中心级智能体默认行为。', 'settings.general.sessionSummaryContract': '要求智能体输出会话状态摘要', 'settings.general.sessionSummaryContract.desc': '开启后,Claude、Codex、OpenCode 以及远程 Grok 会话会在每轮结束时追加 AGENT_NOTIFY_SUMMARY 行,便于更清晰的就绪通知。默认关闭。本地 Grok 与 Cursor 暂不覆盖。对新开/恢复的会话生效。', + 'settings.general.showUnavailableAgents': '显示不可用的智能体', + 'settings.general.showUnavailableAgents.desc': '显示所选设备上未安装或未正确配置 CLI 的智能体。默认关闭。', 'settings.general.sessionSummaryInChat': '在聊天中显示会话状态摘要', 'settings.general.sessionSummaryInChat.desc': '开启后,助手消息以紧凑状态行显示,而不是原始 AGENT_NOTIFY_SUMMARY JSON。默认关闭(聊天与复制中隐藏)。已存储消息、通知与采集路径不受影响。', 'settings.language.title': '语言', diff --git a/web/src/routes/settings/general.tsx b/web/src/routes/settings/general.tsx index db2b2826..e85c439f 100644 --- a/web/src/routes/settings/general.tsx +++ b/web/src/routes/settings/general.tsx @@ -4,6 +4,7 @@ import { useAppContext } from '@/lib/app-context' import { CompanionPairing } from '@/components/settings/CompanionPairing' import { SettingsChoiceGroup, SettingsPageContent, SettingsSection, SettingsSwitch } from '@/components/settings/SettingsPrimitives' import { queryKeys } from '@/lib/query-keys' +import { useShowUnavailableAgents } from '@/hooks/useShowUnavailableAgents' const locales: ReadonlyArray<{ value: Locale; label: string }> = [ { value: 'en', label: 'English' }, @@ -26,6 +27,7 @@ function getNamespace(token: string | null): string | null { export default function SettingsGeneralPage() { const { t, locale, setLocale } = useTranslation() const { api, baseUrl, token } = useAppContext() + const { showUnavailableAgents, setShowUnavailableAgents } = useShowUnavailableAgents() const queryClient = useQueryClient() const isOwner = getNamespace(token) === 'default' @@ -56,46 +58,59 @@ export default function SettingsGeneralPage() { {isOwner ? ( - - {hubSettingsQuery.data ? ( - <> - { - if (hubSettingsMutation.isPending) return - hubSettingsMutation.mutate({ sessionSummaryContract: checked }) - }} - /> - { - if (hubSettingsMutation.isPending) return - hubSettingsMutation.mutate({ sessionSummaryInChat: checked }) - }} - /> - { - if (hubSettingsMutation.isPending) return - hubSettingsMutation.mutate({ teamsEnabled: checked }) - }} - /> - - ) : null} - + <> + + {hubSettingsQuery.data ? ( + <> + { + if (hubSettingsMutation.isPending) return + hubSettingsMutation.mutate({ sessionSummaryContract: checked }) + }} + /> + { + if (hubSettingsMutation.isPending) return + hubSettingsMutation.mutate({ sessionSummaryInChat: checked }) + }} + /> + { + if (hubSettingsMutation.isPending) return + hubSettingsMutation.mutate({ teamsEnabled: checked }) + }} + /> + + ) : null} + + + + + ) : null}