// PEP-10/27/53: «Новый терминал», runner settings (project / story) and a runner's stories.
import { Plus, SquareTerminal } from "lucide-react";
import {
RUNNER_CONTEXT_RU,
RUNNER_CONTEXTS,
RUNNER_MODE_RU,
RUNNER_MODES,
RUNNER_WORKSPACE_RU,
RUNNER_WORKSPACES,
RUNNER_ISOLATION_RU,
RUNNER_ISOLATIONS,
HOST_STATUS_RU,
type RunnerHost,
type RunnerSettings,
type RunnerSettingsPatch,
type RunnerTaskView,
type SessionView,
} from "@peppa/core";
import { promoteRunnerAction, queueOnRunnerAction, renameRunnerAction, setRunnerSettingsAction, startFreeRunnerAction } from "@/app/(app)/actions";
import { Hidden } from "@/components/cards";
import { Key, StatusBadge } from "@/components/common";
import { PanelSection } from "@/components/ActivityAside";
import { Button } from "@/components/ui/button";
import { Input, Label, NativeSelect, Textarea } from "@/components/ui/input";
import { VoiceInput } from "@/components/VoiceInput";
/** Free runner form: project (or fixed), name, agent, prompt with voice input. */
export function NewRunnerForm({ projects, projectId, back }: { projects?: Array<{ id: number; key: string; name: string }>; projectId?: number; back: string }) {
const promptId = `runner-prompt-${projectId ?? "any"}`;
return (
);
}
const inherit = (label: string) => `Как выше: ${label}`;
/** «⋯ Настройки проекта → Раннеры»: overrides of the project; empty = system. */
export function RunnerSettingsPanel({ projectId, own, inherited, back, hosts = [] }: { projectId: number; own: RunnerSettingsPatch; inherited: RunnerSettings; back: string; hosts?: Pick[] }) {
const hostNames = (ids: number[]) => (ids.length ? ids.map((id) => hosts.find((h) => h.id === id)?.name ?? `#${id}`).join(", ") : "Mac Пеппы");
return (
);
}
/** Story page: mode/context for this story only. */
export function TaskRunnerSettings({ taskKey, own, inherited, back }: { taskKey: string; own: { mode?: string; context?: string }; inherited: RunnerSettings; back: string }) {
return (
);
}
/** Runner details: name, stories (history and queue), «Оформить стори» for a free runner. */
export function RunnerStories({ s, history, queue, back }: { s: SessionView; history: RunnerTaskView[]; queue: RunnerTaskView[]; back: string }) {
const alive = !["done", "failed"].includes(s.status);
return (
<>
{s.workspacePath && worktree: {s.workspacePath}
}
{!s.taskId && (
)}
{(history.length > 0 || queue.length > 0 || (alive && s.taskId)) && (
{queue.map((r) => (
-
в очереди{r.front ? " (первой)" : ""}
{r.taskKey}
{r.taskTitle}
))}
{history.map((r) => (
-
{r.status === "active" ? "ведёт" : "вёл"}
{r.taskKey}
{r.taskTitle}
))}
{alive && s.taskId && (
)}
)}
>
);
}