fix: keep research available without search keys
This commit is contained in:
@@ -131,19 +131,6 @@ export function composeGraphTools(agent: AgentSettings | undefined, on: boolean)
|
||||
return { ...agent, graphTools: { enabled: on } };
|
||||
}
|
||||
|
||||
/** The research tool runs on the search port — the teacher registry DROPS
|
||||
* it when no engine is live (chat-handler's searchAvailable, the same
|
||||
* /api/search signal the section fetches). Pure — exported for tests.
|
||||
* Teacher-stream flag 2026-09-22: the settings row grays on the SAME
|
||||
* signal, so the row and the actual registry availability can never
|
||||
* disagree. `search === null` (loading/failed) grays NOTHING. */
|
||||
export function researchToolUnavailable(
|
||||
toolId: string,
|
||||
search: { available: boolean } | null,
|
||||
): boolean {
|
||||
return toolId === "research" && search !== null && !search.available;
|
||||
}
|
||||
|
||||
/** Compose: one slot's model/thinking override. Empty model = absent
|
||||
* override (Default — falls to the factory pin); empty thinking = the
|
||||
* tier keeps its resolved thinking budget. Per-field independence, same
|
||||
@@ -792,28 +779,19 @@ export function AgentSection({
|
||||
</SettingsRow>
|
||||
);
|
||||
})()}
|
||||
{TOGGLE_TOOLS.map((id) => {
|
||||
// Research needs a live search engine; the row + toggle gray
|
||||
// on the same signal the registry drops the tool on (see
|
||||
// researchToolUnavailable). The reason rides as the hint.
|
||||
const searchDown = researchToolUnavailable(id, search);
|
||||
return (
|
||||
<SettingsRow
|
||||
key={id}
|
||||
label={`Tool · ${id}`}
|
||||
hint={searchDown ? search?.reason : undefined}
|
||||
testid={`tool-row-${id}`}
|
||||
dimmed={searchDown}
|
||||
>
|
||||
<Toggle
|
||||
checked={agent?.tools?.[id] ?? true}
|
||||
disabled={searchDown}
|
||||
label={`tool ${id}`}
|
||||
onChange={(on) => onSectionChange(composeTool(agent, id, on))}
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
})}
|
||||
{TOGGLE_TOOLS.map((id) => (
|
||||
<SettingsRow
|
||||
key={id}
|
||||
label={`Tool · ${id}`}
|
||||
testid={`tool-row-${id}`}
|
||||
>
|
||||
<Toggle
|
||||
checked={agent?.tools?.[id] ?? true}
|
||||
label={`tool ${id}`}
|
||||
onChange={(on) => onSectionChange(composeTool(agent, id, on))}
|
||||
/>
|
||||
</SettingsRow>
|
||||
))}
|
||||
{(() => {
|
||||
const engine = agent?.search?.engine ?? null;
|
||||
const anyKey = engineKeys.tavily === true || engineKeys.brave === true;
|
||||
|
||||
Reference in New Issue
Block a user