2026-02-17 20:07:30 -06:00
|
|
|
import { useState, useEffect } from "react";
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
2026-03-02 16:44:03 -06:00
|
|
|
import { useNavigate } from "@/lib/router";
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
import { useDialog } from "../context/DialogContext";
|
|
|
|
|
import { useCompany } from "../context/CompanyContext";
|
|
|
|
|
import { agentsApi } from "../api/agents";
|
|
|
|
|
import { queryKeys } from "../lib/queryKeys";
|
2026-03-03 08:45:26 -06:00
|
|
|
import { AGENT_ROLES } from "@paperclipai/shared";
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
import {
|
|
|
|
|
Dialog,
|
|
|
|
|
DialogContent,
|
|
|
|
|
} from "@/components/ui/dialog";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import {
|
|
|
|
|
Popover,
|
|
|
|
|
PopoverContent,
|
|
|
|
|
PopoverTrigger,
|
|
|
|
|
} from "@/components/ui/popover";
|
2026-02-17 13:24:33 -06:00
|
|
|
import {
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
Minimize2,
|
2026-02-17 13:24:33 -06:00
|
|
|
Maximize2,
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
Shield,
|
2026-02-17 13:24:33 -06:00
|
|
|
User,
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
} from "lucide-react";
|
2026-03-02 16:44:03 -06:00
|
|
|
import { cn, agentUrl } from "../lib/utils";
|
2026-02-17 20:07:30 -06:00
|
|
|
import { roleLabels } from "./agent-config-primitives";
|
2026-02-20 12:28:42 -06:00
|
|
|
import { AgentConfigForm, type CreateConfigValues } from "./AgentConfigForm";
|
|
|
|
|
import { defaultCreateValues } from "./agent-config-defaults";
|
2026-02-18 13:53:03 -06:00
|
|
|
import { getUIAdapter } from "../adapters";
|
2026-02-23 14:41:21 -06:00
|
|
|
import { AgentIcon } from "./AgentIconPicker";
|
2026-02-18 13:02:23 -06:00
|
|
|
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
export function NewAgentDialog() {
|
|
|
|
|
const { newAgentOpen, closeNewAgent } = useDialog();
|
|
|
|
|
const { selectedCompanyId, selectedCompany } = useCompany();
|
|
|
|
|
const queryClient = useQueryClient();
|
|
|
|
|
const navigate = useNavigate();
|
2026-02-17 13:24:33 -06:00
|
|
|
const [expanded, setExpanded] = useState(true);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
|
|
|
|
|
// Identity
|
|
|
|
|
const [name, setName] = useState("");
|
|
|
|
|
const [title, setTitle] = useState("");
|
|
|
|
|
const [role, setRole] = useState("general");
|
|
|
|
|
const [reportsTo, setReportsTo] = useState("");
|
|
|
|
|
|
2026-02-17 20:07:30 -06:00
|
|
|
// Config values (managed by AgentConfigForm)
|
|
|
|
|
const [configValues, setConfigValues] = useState<CreateConfigValues>(defaultCreateValues);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
|
|
|
|
|
// Popover states
|
|
|
|
|
const [roleOpen, setRoleOpen] = useState(false);
|
|
|
|
|
const [reportsToOpen, setReportsToOpen] = useState(false);
|
|
|
|
|
|
|
|
|
|
const { data: agents } = useQuery({
|
|
|
|
|
queryKey: queryKeys.agents.list(selectedCompanyId!),
|
|
|
|
|
queryFn: () => agentsApi.list(selectedCompanyId!),
|
|
|
|
|
enabled: !!selectedCompanyId && newAgentOpen,
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-05 15:24:20 +01:00
|
|
|
const {
|
|
|
|
|
data: adapterModels,
|
|
|
|
|
error: adapterModelsError,
|
2026-03-05 15:52:59 +01:00
|
|
|
isLoading: adapterModelsLoading,
|
|
|
|
|
isFetching: adapterModelsFetching,
|
2026-03-05 15:24:20 +01:00
|
|
|
} = useQuery({
|
|
|
|
|
queryKey:
|
|
|
|
|
selectedCompanyId
|
|
|
|
|
? queryKeys.agents.adapterModels(selectedCompanyId, configValues.adapterType)
|
|
|
|
|
: ["agents", "none", "adapter-models", configValues.adapterType],
|
|
|
|
|
queryFn: () => agentsApi.adapterModels(selectedCompanyId!, configValues.adapterType),
|
|
|
|
|
enabled: Boolean(selectedCompanyId) && newAgentOpen,
|
2026-02-17 13:24:33 -06:00
|
|
|
});
|
|
|
|
|
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
const isFirstAgent = !agents || agents.length === 0;
|
|
|
|
|
const effectiveRole = isFirstAgent ? "ceo" : role;
|
2026-03-05 15:24:20 +01:00
|
|
|
const [formError, setFormError] = useState<string | null>(null);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
|
2026-02-17 13:24:33 -06:00
|
|
|
// Auto-fill for CEO
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (newAgentOpen && isFirstAgent) {
|
|
|
|
|
if (!name) setName("CEO");
|
|
|
|
|
if (!title) setTitle("CEO");
|
|
|
|
|
}
|
|
|
|
|
}, [newAgentOpen, isFirstAgent]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
|
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
const createAgent = useMutation({
|
|
|
|
|
mutationFn: (data: Record<string, unknown>) =>
|
UI: approval detail page, agent hiring UX, costs breakdown, sidebar badges, and dashboard improvements
Add ApprovalDetail page with comment thread, revision request/resubmit flow,
and ApprovalPayload component for structured payload display. Extend AgentDetail
with permissions management, config revision history, and duplicate action.
Add agent hire dialog with permission-gated access. Rework Costs page with
per-agent breakdown table and period filtering. Add sidebar badge counts for
pending approvals and inbox items. Enhance Dashboard with live metrics and
sparkline trends. Extend Agents list with pending_approval status and bulk
actions. Update IssueDetail with approval linking. Various component improvements
to MetricCard, InlineEditor, CommentThread, and StatusBadge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:03:08 -06:00
|
|
|
agentsApi.hire(selectedCompanyId!, data),
|
|
|
|
|
onSuccess: (result) => {
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(selectedCompanyId!) });
|
UI: approval detail page, agent hiring UX, costs breakdown, sidebar badges, and dashboard improvements
Add ApprovalDetail page with comment thread, revision request/resubmit flow,
and ApprovalPayload component for structured payload display. Extend AgentDetail
with permissions management, config revision history, and duplicate action.
Add agent hire dialog with permission-gated access. Rework Costs page with
per-agent breakdown table and period filtering. Add sidebar badge counts for
pending approvals and inbox items. Enhance Dashboard with live metrics and
sparkline trends. Extend Agents list with pending_approval status and bulk
actions. Update IssueDetail with approval linking. Various component improvements
to MetricCard, InlineEditor, CommentThread, and StatusBadge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:03:08 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.approvals.list(selectedCompanyId!) });
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
reset();
|
|
|
|
|
closeNewAgent();
|
2026-03-02 16:44:03 -06:00
|
|
|
navigate(agentUrl(result.agent));
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
},
|
2026-03-05 15:24:20 +01:00
|
|
|
onError: (error) => {
|
|
|
|
|
setFormError(error instanceof Error ? error.message : "Failed to create agent");
|
|
|
|
|
},
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
|
setName("");
|
|
|
|
|
setTitle("");
|
|
|
|
|
setRole("general");
|
|
|
|
|
setReportsTo("");
|
2026-02-17 20:07:30 -06:00
|
|
|
setConfigValues(defaultCreateValues);
|
2026-02-17 13:24:33 -06:00
|
|
|
setExpanded(true);
|
2026-03-05 15:24:20 +01:00
|
|
|
setFormError(null);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function buildAdapterConfig() {
|
2026-02-18 13:53:03 -06:00
|
|
|
const adapter = getUIAdapter(configValues.adapterType);
|
|
|
|
|
return adapter.buildAdapterConfig(configValues);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleSubmit() {
|
|
|
|
|
if (!selectedCompanyId || !name.trim()) return;
|
2026-03-05 15:24:20 +01:00
|
|
|
setFormError(null);
|
|
|
|
|
if (configValues.adapterType === "opencode_local") {
|
|
|
|
|
const selectedModel = configValues.model.trim();
|
|
|
|
|
if (!selectedModel) {
|
|
|
|
|
setFormError("OpenCode requires an explicit model in provider/model format.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (adapterModelsError) {
|
|
|
|
|
setFormError(
|
|
|
|
|
adapterModelsError instanceof Error
|
|
|
|
|
? adapterModelsError.message
|
|
|
|
|
: "Failed to load OpenCode models.",
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-03-05 15:52:59 +01:00
|
|
|
if (adapterModelsLoading || adapterModelsFetching) {
|
|
|
|
|
setFormError("OpenCode models are still loading. Please wait and try again.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-03-05 15:24:20 +01:00
|
|
|
const discovered = adapterModels ?? [];
|
|
|
|
|
if (!discovered.some((entry) => entry.id === selectedModel)) {
|
|
|
|
|
setFormError(
|
|
|
|
|
discovered.length === 0
|
|
|
|
|
? "No OpenCode models discovered. Run `opencode models` and authenticate providers."
|
|
|
|
|
: `Configured OpenCode model is unavailable: ${selectedModel}`,
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
createAgent.mutate({
|
|
|
|
|
name: name.trim(),
|
|
|
|
|
role: effectiveRole,
|
|
|
|
|
...(title.trim() ? { title: title.trim() } : {}),
|
|
|
|
|
...(reportsTo ? { reportsTo } : {}),
|
2026-02-17 20:07:30 -06:00
|
|
|
adapterType: configValues.adapterType,
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
adapterConfig: buildAdapterConfig(),
|
|
|
|
|
runtimeConfig: {
|
|
|
|
|
heartbeat: {
|
2026-02-17 20:07:30 -06:00
|
|
|
enabled: configValues.heartbeatEnabled,
|
|
|
|
|
intervalSec: configValues.intervalSec,
|
2026-02-18 16:46:29 -06:00
|
|
|
wakeOnDemand: true,
|
2026-02-17 13:24:33 -06:00
|
|
|
cooldownSec: 10,
|
2026-02-20 12:50:34 -06:00
|
|
|
maxConcurrentRuns: 1,
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
},
|
|
|
|
|
},
|
2026-02-17 13:24:33 -06:00
|
|
|
budgetMonthlyCents: 0,
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleKeyDown(e: React.KeyboardEvent) {
|
|
|
|
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
handleSubmit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-17 13:24:33 -06:00
|
|
|
const currentReportsTo = (agents ?? []).find((a) => a.id === reportsTo);
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Dialog
|
|
|
|
|
open={newAgentOpen}
|
|
|
|
|
onOpenChange={(open) => {
|
2026-02-17 13:24:33 -06:00
|
|
|
if (!open) { reset(); closeNewAgent(); }
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<DialogContent
|
|
|
|
|
showCloseButton={false}
|
|
|
|
|
className={cn("p-0 gap-0 overflow-hidden", expanded ? "sm:max-w-2xl" : "sm:max-w-lg")}
|
|
|
|
|
onKeyDown={handleKeyDown}
|
|
|
|
|
>
|
|
|
|
|
{/* Header */}
|
|
|
|
|
<div className="flex items-center justify-between px-4 py-2.5 border-b border-border">
|
|
|
|
|
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
|
|
|
{selectedCompany && (
|
|
|
|
|
<span className="bg-muted px-1.5 py-0.5 rounded text-xs font-medium">
|
|
|
|
|
{selectedCompany.name.slice(0, 3).toUpperCase()}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
<span className="text-muted-foreground/60">›</span>
|
|
|
|
|
<span>New agent</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-1">
|
2026-02-17 13:24:33 -06:00
|
|
|
<Button variant="ghost" size="icon-xs" className="text-muted-foreground" onClick={() => setExpanded(!expanded)}>
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
{expanded ? <Minimize2 className="h-3.5 w-3.5" /> : <Maximize2 className="h-3.5 w-3.5" />}
|
|
|
|
|
</Button>
|
2026-02-17 13:24:33 -06:00
|
|
|
<Button variant="ghost" size="icon-xs" className="text-muted-foreground" onClick={() => { reset(); closeNewAgent(); }}>
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
<span className="text-lg leading-none">×</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-17 13:24:33 -06:00
|
|
|
<div className="overflow-y-auto max-h-[70vh]">
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
{/* Name */}
|
2026-02-23 14:41:21 -06:00
|
|
|
<div className="px-4 pt-4 pb-2 shrink-0">
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
<input
|
2026-02-23 14:41:21 -06:00
|
|
|
className="w-full text-lg font-semibold bg-transparent outline-none placeholder:text-muted-foreground/50"
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
placeholder="Agent name"
|
|
|
|
|
value={name}
|
|
|
|
|
onChange={(e) => setName(e.target.value)}
|
|
|
|
|
autoFocus
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Title */}
|
|
|
|
|
<div className="px-4 pb-2">
|
|
|
|
|
<input
|
|
|
|
|
className="w-full bg-transparent outline-none text-sm text-muted-foreground placeholder:text-muted-foreground/40"
|
|
|
|
|
placeholder="Title (e.g. VP of Engineering)"
|
|
|
|
|
value={title}
|
|
|
|
|
onChange={(e) => setTitle(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-17 13:24:33 -06:00
|
|
|
{/* Property chips: Role + Reports To */}
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
<div className="flex items-center gap-1.5 px-4 py-2 border-t border-border flex-wrap">
|
|
|
|
|
{/* Role */}
|
|
|
|
|
<Popover open={roleOpen} onOpenChange={setRoleOpen}>
|
|
|
|
|
<PopoverTrigger asChild>
|
|
|
|
|
<button
|
|
|
|
|
className={cn(
|
|
|
|
|
"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs hover:bg-accent/50 transition-colors",
|
|
|
|
|
isFirstAgent && "opacity-60 cursor-not-allowed"
|
|
|
|
|
)}
|
|
|
|
|
disabled={isFirstAgent}
|
|
|
|
|
>
|
|
|
|
|
<Shield className="h-3 w-3 text-muted-foreground" />
|
|
|
|
|
{roleLabels[effectiveRole] ?? effectiveRole}
|
|
|
|
|
</button>
|
|
|
|
|
</PopoverTrigger>
|
|
|
|
|
<PopoverContent className="w-36 p-1" align="start">
|
|
|
|
|
{AGENT_ROLES.map((r) => (
|
|
|
|
|
<button
|
|
|
|
|
key={r}
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",
|
|
|
|
|
r === role && "bg-accent"
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => { setRole(r); setRoleOpen(false); }}
|
|
|
|
|
>
|
|
|
|
|
{roleLabels[r] ?? r}
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</PopoverContent>
|
|
|
|
|
</Popover>
|
|
|
|
|
|
|
|
|
|
{/* Reports To */}
|
|
|
|
|
<Popover open={reportsToOpen} onOpenChange={setReportsToOpen}>
|
|
|
|
|
<PopoverTrigger asChild>
|
|
|
|
|
<button
|
|
|
|
|
className={cn(
|
|
|
|
|
"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs hover:bg-accent/50 transition-colors",
|
|
|
|
|
isFirstAgent && "opacity-60 cursor-not-allowed"
|
|
|
|
|
)}
|
|
|
|
|
disabled={isFirstAgent}
|
|
|
|
|
>
|
2026-02-23 14:41:21 -06:00
|
|
|
{currentReportsTo ? (
|
|
|
|
|
<>
|
|
|
|
|
<AgentIcon icon={currentReportsTo.icon} className="h-3 w-3 text-muted-foreground" />
|
|
|
|
|
{`Reports to ${currentReportsTo.name}`}
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<User className="h-3 w-3 text-muted-foreground" />
|
|
|
|
|
{isFirstAgent ? "Reports to: N/A (CEO)" : "Reports to..."}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
</button>
|
|
|
|
|
</PopoverTrigger>
|
|
|
|
|
<PopoverContent className="w-48 p-1" align="start">
|
|
|
|
|
<button
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",
|
|
|
|
|
!reportsTo && "bg-accent"
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => { setReportsTo(""); setReportsToOpen(false); }}
|
|
|
|
|
>
|
|
|
|
|
No manager
|
|
|
|
|
</button>
|
|
|
|
|
{(agents ?? []).map((a) => (
|
|
|
|
|
<button
|
|
|
|
|
key={a.id}
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50 truncate",
|
|
|
|
|
a.id === reportsTo && "bg-accent"
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => { setReportsTo(a.id); setReportsToOpen(false); }}
|
|
|
|
|
>
|
2026-02-23 14:41:21 -06:00
|
|
|
<AgentIcon icon={a.icon} className="shrink-0 h-3 w-3 text-muted-foreground" />
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
{a.name}
|
|
|
|
|
<span className="text-muted-foreground ml-auto">{roleLabels[a.role] ?? a.role}</span>
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</PopoverContent>
|
|
|
|
|
</Popover>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-17 20:07:30 -06:00
|
|
|
{/* Shared config form (adapter + heartbeat) */}
|
|
|
|
|
<AgentConfigForm
|
|
|
|
|
mode="create"
|
|
|
|
|
values={configValues}
|
|
|
|
|
onChange={(patch) => setConfigValues((prev) => ({ ...prev, ...patch }))}
|
|
|
|
|
adapterModels={adapterModels}
|
|
|
|
|
/>
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Footer */}
|
|
|
|
|
<div className="flex items-center justify-between px-4 py-2.5 border-t border-border">
|
|
|
|
|
<span className="text-xs text-muted-foreground">
|
|
|
|
|
{isFirstAgent ? "This will be the CEO" : ""}
|
|
|
|
|
</span>
|
2026-03-05 15:24:20 +01:00
|
|
|
</div>
|
|
|
|
|
{formError && (
|
|
|
|
|
<div className="px-4 pb-2 text-xs text-destructive">{formError}</div>
|
|
|
|
|
)}
|
|
|
|
|
<div className="flex items-center justify-end px-4 pb-3">
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
disabled={!name.trim() || createAgent.isPending}
|
|
|
|
|
onClick={handleSubmit}
|
|
|
|
|
>
|
2026-03-02 16:44:03 -06:00
|
|
|
{createAgent.isPending ? "Creating…" : "Create agent"}
|
Build out agent management UI: detail page, create dialog, list view
Add NewAgentDialog for creating agents with adapter config. Expand
AgentDetail page with tabbed view (overview, runs, config, logs),
run history timeline, and live status. Enhance Agents list page with
richer cards and filtering. Update AgentProperties panel, API client,
query keys, and utility helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:33:04 -06:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
);
|
|
|
|
|
}
|