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

104 lines
3.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { AgentGUIProviderReadinessGate } from "../../../types";
import {
isAgentGUIProviderReady,
resolveAgentGUIProviderReadinessAction,
resolveAgentGUIProviderReadinessContent,
resolveAgentGUIProviderReadinessGateForView
} from "./agentGuiProviderReadiness";
const labels = {
providerGateCheckingTitle: "checking-title",
providerGateCheckingDescription: "checking-description",
providerGateCheckingAgentsDescription: "checking-agents-description",
providerGateInstallTitle: "install-title",
providerGateInstallDescription: "install-description",
providerGateInstallAction: "install-action",
providerGateLoginTitle: "login-title",
providerGateLoginDescription: "login-description",
providerGateLoginAction: "login-action",
providerGateModelPlanAction: "model-plan-action",
providerGateComingSoonTitle: "coming-soon-title",
providerGateComingSoonDescription: "coming-soon-description",
providerGateComingSoonAction: "coming-soon-action",
providerGateUnavailableTitle: "unavailable-title",
providerGateUnavailableDescription: "unavailable-description",
providerGateRetryAction: "retry-action",
providerGateRuntimeSelectionTitle: "runtime-selection-title",
providerGateRuntimeSelectionDescription: "runtime-selection-description",
providerGateRuntimeSelectionAction: "runtime-selection-action"
};
describe("agent gui provider readiness", () => {
it("keeps active conversations outside provider setup readiness", () => {
const checkingGate = {
status: "checking"
} satisfies AgentGUIProviderReadinessGate;
expect(
resolveAgentGUIProviderReadinessGateForView({
activeConversationId: "session-claude",
providerReadinessGates: {
"claude-code": checkingGate,
codex: null
},
selectedProvider: "codex"
})
).toBeNull();
});
it("uses the selected provider gate on the new conversation surface", () => {
const loginGate = {
status: "auth_required"
} satisfies AgentGUIProviderReadinessGate;
expect(
resolveAgentGUIProviderReadinessGateForView({
activeConversationId: null,
providerReadinessGates: {
"claude-code": loginGate,
codex: null
},
selectedProvider: "claude-code"
})
).toBe(loginGate);
});
it("does not project checking into a connect action", () => {
expect(isAgentGUIProviderReady({ status: "checking" })).toBe(false);
expect(isAgentGUIProviderReady(null)).toBe(true);
expect(resolveAgentGUIProviderReadinessAction("checking")).toBeNull();
expect(resolveAgentGUIProviderReadinessContent("checking", labels)).toEqual(
{
description: "checking-description",
title: "checking-title"
}
);
});
it("only exposes setup actions for explicit daemon statuses", () => {
expect(resolveAgentGUIProviderReadinessAction("not_installed")).toBe(
"install"
);
expect(resolveAgentGUIProviderReadinessAction("auth_required")).toBe(
"login"
);
expect(resolveAgentGUIProviderReadinessAction("unavailable")).toBe(
"refresh"
);
expect(resolveAgentGUIProviderReadinessAction("runtime_selection")).toBe(
"choose"
);
});
it("guides the user to choose a runtime instead of retrying", () => {
expect(
resolveAgentGUIProviderReadinessContent("runtime_selection", labels)
).toEqual({
title: "runtime-selection-title",
description: "runtime-selection-description",
actionLabel: "runtime-selection-action"
});
});
});