mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Preserve hidden harness defaults when editing
Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
useAvailableAcpRuntimes,
|
||||
useCreateChannelManagedAgentsMutation,
|
||||
} from "@/features/agents/hooks";
|
||||
import { useGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { useImplicitGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import type { CreateChannelManagedAgentsResult } from "@/features/agents/channelAgents";
|
||||
import {
|
||||
emptyResolvedTeamPersonas,
|
||||
@@ -54,7 +54,7 @@ export function AddTeamToChannelDialog({
|
||||
onOpenChange,
|
||||
onDeployed,
|
||||
}: AddTeamToChannelDialogProps) {
|
||||
const { globalConfig } = useGlobalAgentConfig();
|
||||
const { globalConfig } = useImplicitGlobalAgentConfig();
|
||||
const channelsQuery = useChannelsQuery();
|
||||
const providersQuery = useAvailableAcpRuntimes();
|
||||
const [channelId, setChannelId] = React.useState("");
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
useStopManagedAgentMutation,
|
||||
useDeleteManagedAgentMutation,
|
||||
} from "@/features/agents/hooks";
|
||||
import { useGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { useImplicitGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { useChannelsQuery } from "@/features/channels/hooks";
|
||||
import { usePresenceQuery } from "@/features/presence/hooks";
|
||||
import type {
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
} from "../lib/instanceInputForDefinition";
|
||||
|
||||
export function useManagedAgentActions() {
|
||||
const { globalConfig } = useGlobalAgentConfig();
|
||||
const { globalConfig } = useImplicitGlobalAgentConfig();
|
||||
const relayAgentsQuery = useRelayAgentsQuery();
|
||||
const managedAgentsQuery = useManagedAgentsQuery();
|
||||
const [shouldLoadChannels, setShouldLoadChannels] = React.useState(false);
|
||||
|
||||
@@ -33,7 +33,6 @@ export function useGlobalAgentConfig(): {
|
||||
globalConfig: GlobalAgentConfig;
|
||||
isLoading: boolean;
|
||||
} {
|
||||
const disabledRuntimeIds = useDisabledAcpRuntimeIds();
|
||||
const { data, isPending } = useQuery({
|
||||
queryKey: globalAgentConfigQueryKey,
|
||||
queryFn: getGlobalAgentConfig,
|
||||
@@ -43,17 +42,33 @@ export function useGlobalAgentConfig(): {
|
||||
// Never show a stale empty flash while a background refetch runs.
|
||||
placeholderData: EMPTY_CONFIG,
|
||||
});
|
||||
const globalConfig = React.useMemo(
|
||||
() =>
|
||||
maskDisabledAcpRuntimePreference(
|
||||
data ?? EMPTY_CONFIG,
|
||||
disabledRuntimeIds,
|
||||
),
|
||||
[data, disabledRuntimeIds],
|
||||
);
|
||||
|
||||
return {
|
||||
globalConfig,
|
||||
globalConfig: data ?? EMPTY_CONFIG,
|
||||
isLoading: isPending,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load global defaults for a new implicit runtime choice.
|
||||
*
|
||||
* Existing agent edit surfaces must use useGlobalAgentConfig so a hidden
|
||||
* harness can still inherit its persisted provider and model. Start paths use
|
||||
* this hook to ignore a hidden preferred harness and its dependent defaults.
|
||||
*/
|
||||
export function useImplicitGlobalAgentConfig(): {
|
||||
globalConfig: GlobalAgentConfig;
|
||||
isLoading: boolean;
|
||||
} {
|
||||
const { globalConfig, isLoading } = useGlobalAgentConfig();
|
||||
const disabledRuntimeIds = useDisabledAcpRuntimeIds();
|
||||
const implicitGlobalConfig = React.useMemo(
|
||||
() => maskDisabledAcpRuntimePreference(globalConfig, disabledRuntimeIds),
|
||||
[disabledRuntimeIds, globalConfig],
|
||||
);
|
||||
|
||||
return {
|
||||
globalConfig: implicitGlobalConfig,
|
||||
isLoading,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
useAcpRuntimesQuery,
|
||||
useManagedAgentsQuery,
|
||||
} from "@/features/agents/hooks";
|
||||
import { useGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { clearActiveTurnsForAgentOnStop } from "@/features/agents/managedAgentRuntimeHooks";
|
||||
import { useImplicitGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { useCommunities } from "@/features/communities/useCommunities";
|
||||
import { welcomeKickoffMarker } from "@/features/onboarding/devFreshOnboarding";
|
||||
import { resolveAgentReadiness } from "@/features/onboarding/ui/agentReadiness";
|
||||
@@ -496,7 +496,8 @@ export function useWelcomeKickoff(
|
||||
const { activeCommunity } = useCommunities();
|
||||
const runtimesQuery = useAcpRuntimesQuery();
|
||||
const managedAgentsQuery = useManagedAgentsQuery();
|
||||
const { globalConfig, isLoading: configLoading } = useGlobalAgentConfig();
|
||||
const { globalConfig, isLoading: configLoading } =
|
||||
useImplicitGlobalAgentConfig();
|
||||
const channelId = activeChannel?.id ?? null;
|
||||
const isActiveWelcome = isWelcomeChannel(activeChannel);
|
||||
const focusedWelcomeChannelRef = React.useRef<string | null>(null);
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
useUpdateManagedAgentMutation,
|
||||
useUpdatePersonaMutation,
|
||||
} from "@/features/agents/hooks";
|
||||
import { useGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { useImplicitGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
|
||||
import { AddAgentToChannelDialog } from "@/features/agents/ui/AddAgentToChannelDialog";
|
||||
import {
|
||||
availableRuntimesForStart,
|
||||
@@ -122,7 +122,7 @@ export function UserProfilePanel({
|
||||
widthPx,
|
||||
transparentChrome = false,
|
||||
}: UserProfilePanelProps) {
|
||||
const { globalConfig } = useGlobalAgentConfig();
|
||||
const { globalConfig } = useImplicitGlobalAgentConfig();
|
||||
const isOverlay = useIsThreadPanelOverlay();
|
||||
const isSplitLayout = layout === "split";
|
||||
useEscapeKey(onClose, isOverlay || isSinglePanelView);
|
||||
|
||||
Reference in New Issue
Block a user