Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An application for configuring agents to use CoreInfra.

Start Wizard, sign in to CoreInfra Hub and select the Hub to charge. Keep Wizard running and ask for a video in a new ChatGPT Work or Codex chat, or invoke `$coreinfra-video`. Wizard automatically installs the skill and registers its MCP server at startup.

The bundled skill and the `coreinfra_video` MCP registration live in the profile selected by `CODEX_HOME`. Wizard listens at `http://127.0.0.1:33789/mcp` and publishes a new local bearer on each start. **ChatGPT / Codex → Видеомодели CoreInfra → Отключить** revokes local access and removes the managed registration and unmodified skill files. The opt-out persists across restarts.
The bundled skill and the `coreinfra_video` MCP registration live in the profile selected by `CODEX_HOME`. Wizard listens at `http://127.0.0.1:33789/mcp` and publishes a new local bearer on each start. Turning off **Подключить `coreinfra-video` для видео-моделей** under **Дополнительные модели** on the ChatGPT / Codex page revokes local access and removes the managed registration and unmodified skill files. The opt-out persists across restarts.

`video_models` returns the public catalog and prices in RUB per second. `video_create` submits one paid job. Save the full returned `job` object and pass it to `video_result` to poll, including after restarting Wizard. The original Hub and key must still be available. A completed download returns a local MP4 in **Downloads/CoreInfra Video**. Use `download: false` to poll without creating a file. fal also returns its signed result URL in this mode. Repeating a submission after a network timeout can incur another charge.

Expand Down
2 changes: 2 additions & 0 deletions crates/wizard-gui/wizard-ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MotionConfig } from "motion/react";
import { startPreviewMocks, type Scenario } from "../src/preview/mocks";
import { initializeTheme, setTheme } from "../src/settings/theme";
import { SubscriptionTokenPreviewContext } from "../src/agents/connection_preview";
import { systemProxyBannerDismissedKey } from "../src/overview/SystemProxyBanner";
import "../src/styles.css";
import "../src/components/BrandIcons.css";

Expand Down Expand Up @@ -99,6 +100,7 @@ const preview: Preview = {
},
beforeEach(context) {
const scenario = (context.parameters.scenario ?? "update") as Scenario;
localStorage.removeItem(systemProxyBannerDismissedKey);
if (scenario !== "startup")
localStorage.setItem("coreinfra.startup.seen", "true");
const environment = startPreviewMocks(scenario, { onboarding: context.parameters.onboarding });
Expand Down
44 changes: 30 additions & 14 deletions crates/wizard-gui/wizard-ui/src/agents/AgentConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CheckIcon } from "@heroicons/react/20/solid";
import {
type AgentChange,
type AgentId,
type ConnectionDraft,
type HubMode,
type RoutingMode,
type TokenChoice,
Expand Down Expand Up @@ -35,6 +36,7 @@ import { ErrorText } from "../components/ErrorText";
import { useSystemProxy } from "../settings/system_proxy";
import { SystemProxyPrompt } from "../settings/SystemProxyPrompt";
import { SubscriptionTokenPreviewContext } from "./connection_preview";
import { VideoConnection, useVideoConnection } from "./VideoConnection";

type ModeOption<M extends string> = {
mode: M;
Expand Down Expand Up @@ -273,7 +275,7 @@ export function RoutingFieldset<M extends string>({
note?: ReactNode;
disabled: boolean;
error?: string;
onPrepare: (change: AgentChange, token: TokenChoice | null) => void;
onPrepare: (draft: ConnectionDraft) => void;
initialMode?: M;
actions?: ReactNode;
actionsClassName?: string;
Expand All @@ -292,8 +294,12 @@ export function RoutingFieldset<M extends string>({
(token.selected?.kind === "create" ||
(token.selected?.kind === "existing" &&
token.selected.token !== agentToken));
const changed =
const routingChanged =
selected !== mode || (enabled && (needsApply || tokenChanged));
const prepareRouting = !editing || routingChanged;
const showVideo = agent === "codex" || agent === "claude" || (agent === "claude_desktop" && selected === "hub");
const video = useVideoConnection(showVideo);
const videoChanged = showVideo && video.needsApply;
const systemProxy = useSystemProxy();
const [proxyPrompt, setProxyPrompt] = useState(false);

Expand All @@ -307,14 +313,25 @@ export function RoutingFieldset<M extends string>({
setProxyPrompt(true);
}

function prepare() {
const includeVideo = showVideo && (video.needsApply || (prepareRouting && video.enabled));
onPrepare({
agent,
routing: prepareRouting ? {
change: toChange(selected),
token: enabled && !proxyOnly ? (token.selected ?? null) : null,
} : undefined,
videoEnabled: includeVideo ? video.enabled : undefined,
});
}

return (
<>
<Panel title="Подключение" className="mt-6" framed={false}>
<Panel title="Подключение" description={note} className="mt-6" framed={false}>
<Fieldset aria-label="Подключение">
{note && <Text>{note}</Text>}
<FieldGroup className={note ? "mt-4" : undefined}>
<FieldGroup>
<RadioGroup
className="agent-routing-options"
className="agent-connection-options"
value={selected}
disabled={disabled}
aria-label="Режим подключения"
Expand All @@ -339,20 +356,19 @@ export function RoutingFieldset<M extends string>({
<TokenNote token={token} hub={hub} disabled={disabled} />
)
)}
{showVideo && (
<VideoConnection video={video} signedIn={hub.signedIn} disabled={disabled} />
)}
<ActionBar leading={actions} className={actionsClassName}>
<Button
type="button"
disabled={
disabled ||
(enabled && (proxyOnly ? !hub.signedIn : !token.ready)) ||
(editing && !changed)
}
onClick={() =>
onPrepare(
toChange(selected),
enabled && !proxyOnly ? (token.selected ?? null) : null,
)
(prepareRouting && enabled && (proxyOnly ? !hub.signedIn : !token.ready)) ||
(showVideo && !video.status && !video.error) ||
(!prepareRouting && !videoChanged)
}
onClick={prepare}
>
{editing ? "Применить" : "Завершить настройку"}
</Button>
Expand Down
14 changes: 7 additions & 7 deletions crates/wizard-gui/wizard-ui/src/agents/AgentConnectionPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useEffect, useRef, useState } from "react";
import { type AgentChange, type AgentId, type AgentStates, type PreparedAgentChange, type RoutingMode, type TokenChoice, prepareAgentChange } from "./agents_state";
import { type AgentChange, type AgentId, type AgentStates, type ConnectionDraft, type ConnectionPlan, type RoutingMode, prepareAgentChange } from "./agents_state";
import { RoutingFieldset, hubModes, routingModes, type Hub } from "./AgentConfiguration";
import { PreparedPlanDialog } from "./PreparedPlanDialog";
import { MissingAgent } from "./MissingAgent";
import { useProxy } from "./proxy";
import { agentPageNames } from "./navigation";
import { AgentIcon, choices } from "../onboarding/agents";
import { AgentIcon, choices, launchChoiceFor } from "../onboarding/agents";
import { useHubTokens } from "../settings/hub_tokens";
import type { HubAccountControl } from "../settings/HubAccount";
import { Identity } from "../components/ui/Identity";
Expand All @@ -20,7 +20,7 @@ export function AgentConnectionPanel({ agent, agents, account, onBack }: {
account: HubAccountControl;
onBack: () => void;
}) {
const [prepared, setPrepared] = useState<PreparedAgentChange>();
const [prepared, setPrepared] = useState<ConnectionPlan>();
const [preparing, setPreparing] = useState(false);
const [error, setError] = useState<string>();
const inFlight = useRef(false);
Expand All @@ -40,12 +40,12 @@ export function AgentConnectionPanel({ agent, agents, account, onBack }: {
const errors = detection.status === "error" ? [detection.data]
: agent === "codex" && agents.codex.status === "found" ? [agents.codex.data.cli, agents.codex.data.desktop].flatMap(part => part.status === "error" ? [part.data] : []) : [];

async function prepare(change: AgentChange, token: TokenChoice | null) {
async function prepare(draft: ConnectionDraft) {
if (inFlight.current || prepared) return;
inFlight.current = true;
setPreparing(true);
setError(undefined);
try { setPrepared(await prepareAgentChange(change, token)); }
try { setPrepared(await prepareAgentChange(draft)); }
catch (cause) { setError(typeof cause === "string" ? cause : "Не удалось подготовить изменения. Попробуйте ещё раз."); }
finally { inFlight.current = false; setPreparing(false); }
}
Expand All @@ -70,12 +70,12 @@ export function AgentConnectionPanel({ agent, agents, account, onBack }: {
needsApply={needsApply} disabled={busy || account.submitting} error={error}
note={agent === "codex" ? "Настройка общая для ChatGPT и Codex." : undefined}
actions={<Button plain disabled={busy || account.submitting} onClick={onBack}>Назад</Button>}
onPrepare={(change, token) => void prepare(change, token)}
onPrepare={prepare}
/> : <>
{detection.status === "not_found" && agent !== "claude_desktop" && <MissingAgent agent={agent} />}
<ActionBar divider><Button outline onClick={onBack}>Назад</Button></ActionBar>
</>}
{prepared && <PreparedPlanDialog prepared={prepared} onReprepared={setPrepared}
{prepared && <PreparedPlanDialog prepared={prepared} launchChoice={launchChoiceFor(agent, agents)} onReprepared={setPrepared}
onClose={() => setPrepared(undefined)} onApplied={onBack} applyLabel="Применить" />}
</>;
}
23 changes: 12 additions & 11 deletions crates/wizard-gui/wizard-ui/src/agents/AgentPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { type ReactNode, useEffect, useRef, useState } from "react";
import {
type AgentChange,
type AgentDetection,
type AgentId,
type AgentStates,
type BackupAgent,
type PreparedAgentChange,
type TokenChoice,
type ConnectionDraft,
type ConnectionPlan,
prepareAgentChange,
} from "./agents_state";
import {
Expand All @@ -18,7 +17,8 @@ import {
import { PreparedPlanDialog } from "./PreparedPlanDialog";
import { BackupDialog } from "./BackupDialog";
import { DesktopVersion } from "./DesktopInstall";
import { VideoConnection } from "./VideoConnection";
import { StandaloneVideoConnection } from "./VideoConnection";
import { launchChoiceFor } from "../onboarding/agents";
import { MissingAgent } from "./MissingAgent";
import { agentPageNames } from "./navigation";
import { useHubTokens } from "../settings/hub_tokens";
Expand Down Expand Up @@ -116,7 +116,7 @@ export function AgentPage({
proxy: ReturnType<typeof useProxy>;
account: HubAccountControl;
}) {
const [preparedChange, setPreparedChange] = useState<PreparedAgentChange>();
const [preparedChange, setPreparedChange] = useState<ConnectionPlan>();
const [isPreparingPlan, setIsPreparingPlan] = useState(false);
const [configurationRevision, setConfigurationRevision] = useState(0);
const pageContent = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -155,14 +155,14 @@ export function AgentPage({
: null,
);

async function prepare(change: AgentChange, token: TokenChoice | null) {
async function prepare(draft: ConnectionDraft) {
if (isChangeInProgress) return;

setIsPreparingPlan(true);
setError(undefined);

try {
setPreparedChange(await prepareAgentChange(change, token));
setPreparedChange(await prepareAgentChange(draft));
} catch (cause: unknown) {
const message = "Не удалось подготовить изменения";
reportError(message, cause);
Expand Down Expand Up @@ -252,7 +252,10 @@ export function AgentPage({
onPrepare={prepare}
/>
)}
<VideoConnection signedIn={account.signedIn} disabled={isChangeInProgress} />
{codex.status !== "found" && (
<StandaloneVideoConnection key={configurationRevision} signedIn={account.signedIn}
disabled={isChangeInProgress} error={pageError} onPrepare={prepare} />
)}
{(codex.status === "not_found" || (codex.status === "found" && codex.data.cli.status === "not_found")) && (
<MissingAgent agent="codex" />
)}
Expand Down Expand Up @@ -292,9 +295,6 @@ export function AgentPage({
onPrepare={prepare}
/>
)}
{claude.status === "found" && claude.data.routing_mode === "hub" && (
<VideoConnection signedIn={account.signedIn} disabled={isChangeInProgress} />
)}
</>
);
break;
Expand Down Expand Up @@ -403,6 +403,7 @@ export function AgentPage({
{preparedChange && (
<PreparedPlanDialog
prepared={preparedChange}
launchChoice={launchChoiceFor(preparedChange.agent, agents)}
onReprepared={setPreparedChange}
onClose={() => setPreparedChange(undefined)}
onApplied={() => setConfigurationRevision((value) => value + 1)}
Expand Down
Loading
Loading