Files
agent-radar 2ed3415fb7
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
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

113 lines
3.6 KiB
TypeScript

import type {
AgentGUIProvider,
AgentGUIProviderReadinessGate,
AgentGUIProviderReadinessGateAction
} from "../../../types";
export interface AgentGUIProviderReadinessLabels {
providerGateCheckingTitle: string;
providerGateCheckingDescription: string;
providerGateCheckingAgentsDescription: string;
providerGateInstallTitle: string;
providerGateInstallDescription: string;
providerGateInstallAction: string;
providerGateLoginTitle: string;
providerGateLoginDescription: string;
providerGateLoginAction: string;
providerGateModelPlanAction: string;
providerGateComingSoonTitle: string;
providerGateComingSoonDescription: string;
providerGateComingSoonAction: string;
providerGateUnavailableTitle: string;
providerGateUnavailableDescription: string;
providerGateRetryAction: string;
providerGateRuntimeSelectionTitle: string;
providerGateRuntimeSelectionDescription: string;
providerGateRuntimeSelectionAction: string;
}
export function resolveAgentGUIProviderReadinessGateForView(input: {
activeConversationId: string | null;
providerReadinessGates:
| Partial<Record<AgentGUIProvider, AgentGUIProviderReadinessGate | null>>
| null
| undefined;
selectedProvider: AgentGUIProvider;
}): AgentGUIProviderReadinessGate | null {
if (input.activeConversationId !== null) {
return null;
}
return input.providerReadinessGates?.[input.selectedProvider] ?? null;
}
export function isAgentGUIProviderReady(
gate: AgentGUIProviderReadinessGate | null
): boolean {
return gate === null;
}
export function resolveAgentGUIProviderReadinessContent(
status: AgentGUIProviderReadinessGate["status"],
labels: AgentGUIProviderReadinessLabels,
options: { showAllProviders?: boolean } = {}
): { title: string; description: string; actionLabel?: string } {
switch (status) {
case "checking":
return {
title: labels.providerGateCheckingTitle,
description:
options.showAllProviders === true
? labels.providerGateCheckingAgentsDescription
: labels.providerGateCheckingDescription
};
case "not_installed":
return {
title: labels.providerGateInstallTitle,
description: labels.providerGateInstallDescription,
actionLabel: labels.providerGateInstallAction
};
case "auth_required":
return {
title: labels.providerGateLoginTitle,
description: labels.providerGateLoginDescription,
actionLabel: labels.providerGateLoginAction
};
case "coming_soon":
return {
title: labels.providerGateComingSoonTitle,
description: labels.providerGateComingSoonDescription,
actionLabel: labels.providerGateComingSoonAction
};
case "runtime_selection":
return {
title: labels.providerGateRuntimeSelectionTitle,
description: labels.providerGateRuntimeSelectionDescription,
actionLabel: labels.providerGateRuntimeSelectionAction
};
case "unavailable":
return {
title: labels.providerGateUnavailableTitle,
description: labels.providerGateUnavailableDescription,
actionLabel: labels.providerGateRetryAction
};
}
}
export function resolveAgentGUIProviderReadinessAction(
status: AgentGUIProviderReadinessGate["status"]
): AgentGUIProviderReadinessGateAction | null {
switch (status) {
case "not_installed":
return "install";
case "auth_required":
return "login";
case "runtime_selection":
return "choose";
case "unavailable":
return "refresh";
case "coming_soon":
case "checking":
return null;
}
}