源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
@@ -0,0 +1,98 @@
|
||||
import { useCallback, useMemo, type ReactNode } from "react";
|
||||
import { resolveAgentGUIProviderCatalogIdentity } from "../../../providerIdentityCatalog.ts";
|
||||
import {
|
||||
AgentEnvPanelActionProvider,
|
||||
type OpenAgentEnvPanelAction
|
||||
} from "../../../shared/agentEnv";
|
||||
import {
|
||||
AgentTargetSetupControllerProvider,
|
||||
type AgentTargetSetupController,
|
||||
useCreateAgentTargetSetupController
|
||||
} from "../../../shared/agentEnv/agentTargetSetupController.tsx";
|
||||
import type { AgentGUIAgentTarget } from "../../../types.ts";
|
||||
import {
|
||||
projectAgentGUIManagedHomeTargets,
|
||||
type AgentGUIManagedHomeTargetProjection
|
||||
} from "../model/agentGuiProviderRailOrder.ts";
|
||||
import { AgentTargetSetupGate } from "./AgentTargetSetupGate.tsx";
|
||||
import { useAgentGUIProviderRailPreferences } from "./useAgentGUIProviderRailPreferences.ts";
|
||||
|
||||
export function useAgentTargetSetupRoot(input: {
|
||||
activeConversationId: string | null;
|
||||
agentTargets: readonly AgentGUIAgentTarget[];
|
||||
environmentProvider: string | null | undefined;
|
||||
openEnvironmentSetup?: OpenAgentEnvPanelAction;
|
||||
selectedAgentTarget: AgentGUIAgentTarget;
|
||||
}): {
|
||||
controller: AgentTargetSetupController;
|
||||
environmentSetupVisible: boolean;
|
||||
homeTargetProjection: AgentGUIManagedHomeTargetProjection;
|
||||
openAgentEnvSetup: () => void;
|
||||
} {
|
||||
const { preferences } = useAgentGUIProviderRailPreferences();
|
||||
const homeTargetProjection = useMemo(
|
||||
() =>
|
||||
projectAgentGUIManagedHomeTargets({
|
||||
agentTargets: input.agentTargets,
|
||||
preferences,
|
||||
selectedAgentTarget: input.selectedAgentTarget
|
||||
}),
|
||||
[input.agentTargets, input.selectedAgentTarget, preferences]
|
||||
);
|
||||
const effectiveSelectedTarget =
|
||||
input.activeConversationId === null
|
||||
? (homeTargetProjection.selectedAgentTarget ?? input.selectedAgentTarget)
|
||||
: input.selectedAgentTarget;
|
||||
const controller = useCreateAgentTargetSetupController(
|
||||
effectiveSelectedTarget
|
||||
);
|
||||
const targetRuntimeSetupVisible =
|
||||
effectiveSelectedTarget.ref.setupKind === "target_runtime";
|
||||
const environmentSetupVisible =
|
||||
targetRuntimeSetupVisible ||
|
||||
!!resolveAgentGUIProviderCatalogIdentity(input.environmentProvider ?? "");
|
||||
const openAgentEnvSetup = useCallback(() => {
|
||||
if (targetRuntimeSetupVisible) {
|
||||
controller.setDialogOpen(true);
|
||||
return;
|
||||
}
|
||||
input.openEnvironmentSetup?.({
|
||||
provider: input.environmentProvider,
|
||||
focus: null
|
||||
});
|
||||
}, [
|
||||
controller,
|
||||
input.environmentProvider,
|
||||
input.openEnvironmentSetup,
|
||||
targetRuntimeSetupVisible
|
||||
]);
|
||||
return {
|
||||
controller,
|
||||
environmentSetupVisible,
|
||||
homeTargetProjection,
|
||||
openAgentEnvSetup
|
||||
};
|
||||
}
|
||||
|
||||
export function AgentTargetSetupRoot({
|
||||
children,
|
||||
controller,
|
||||
openEnvironmentSetup
|
||||
}: {
|
||||
children: ReactNode;
|
||||
controller: AgentTargetSetupController;
|
||||
openEnvironmentSetup?: OpenAgentEnvPanelAction;
|
||||
}): React.JSX.Element {
|
||||
return (
|
||||
<AgentEnvPanelActionProvider openPanel={openEnvironmentSetup}>
|
||||
<AgentTargetSetupControllerProvider controller={controller}>
|
||||
{children}
|
||||
<AgentTargetSetupGate
|
||||
carouselMountedExternally={false}
|
||||
dialogOwner
|
||||
gateVisible={false}
|
||||
/>
|
||||
</AgentTargetSetupControllerProvider>
|
||||
</AgentEnvPanelActionProvider>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user