fix: filter hidden internal agents from UI and updated sdk version

This commit is contained in:
Bohdan Triapitsyn
2025-12-18 19:02:42 +02:00
parent b878c620b9
commit e6b07a0563
12 changed files with 80 additions and 20 deletions
+22
View File
@@ -30,6 +30,21 @@ export interface AgentConfig {
disable?: boolean;
}
// Extended Agent type for API properties not in SDK types
export type AgentWithExtras = Agent & { native?: boolean; hidden?: boolean };
// Helper to check if agent is built-in (handles both SDK 'builtIn' and API 'native')
export const isAgentBuiltIn = (agent: Agent): boolean =>
agent.builtIn || (agent as AgentWithExtras).native === true;
// Helper to check if agent is hidden (internal agents like title, compaction, summary)
export const isAgentHidden = (agent: Agent): boolean =>
(agent as AgentWithExtras).hidden === true;
// Helper to filter only visible (non-hidden) agents
export const filterVisibleAgents = (agents: Agent[]): Agent[] =>
agents.filter((agent) => !isAgentHidden(agent));
const CONFIG_EVENT_SOURCE = "useAgentsStore";
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const MAX_HEALTH_WAIT_MS = 20000;
@@ -51,6 +66,8 @@ interface AgentsStore {
updateAgent: (name: string, config: Partial<AgentConfig>) => Promise<boolean>;
deleteAgent: (name: string) => Promise<boolean>;
getAgentByName: (name: string) => Agent | undefined;
// Returns only visible agents (excludes hidden internal agents)
getVisibleAgents: () => Agent[];
}
declare global {
@@ -264,6 +281,11 @@ export const useAgentsStore = create<AgentsStore>()(
const { agents } = get();
return agents.find((a) => a.name === name);
},
getVisibleAgents: () => {
const { agents } = get();
return filterVisibleAgents(agents);
},
}),
{
name: "agents-store",
+7
View File
@@ -7,6 +7,7 @@ import { scopeMatches, subscribeToConfigChanges } from "@/lib/configSync";
import type { ModelMetadata } from "@/types";
import { getSafeStorage } from "./utils/safeStorage";
import type { SessionStore } from "./types/sessionTypes";
import { filterVisibleAgents } from "./useAgentsStore";
const MODELS_DEV_API_URL = "https://models.dev/api.json";
const MODELS_DEV_PROXY_URL = "/api/openchamber/models-metadata";
@@ -230,6 +231,8 @@ interface ConfigStore {
getCurrentModel: () => ProviderModel | undefined;
getCurrentAgent: () => Agent | undefined;
getModelMetadata: (providerId: string, modelId: string) => ModelMetadata | undefined;
// Returns only visible agents (excludes hidden internal agents like title, compaction, summary)
getVisibleAgents: () => Agent[];
}
declare global {
@@ -522,6 +525,10 @@ export const useConfigStore = create<ConfigStore>()(
const { modelsMetadata } = get();
return modelsMetadata.get(key);
},
getVisibleAgents: () => {
const { agents } = get();
return filterVisibleAgents(agents);
},
}),
{
name: "config-store",