2026-02-18 13:02:23 -06:00
|
|
|
import { useCallback, useEffect, useMemo, useState, useRef } from "react";
|
2026-03-10 09:08:20 -05:00
|
|
|
import { useParams, useNavigate, Link, Navigate, useBeforeUnload } from "@/lib/router";
|
2026-02-17 12:24:48 -06:00
|
|
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
2026-03-17 09:21:44 -05:00
|
|
|
import { agentsApi, type AgentKey, type ClaudeLoginResult, type AvailableSkill } from "../api/agents";
|
2026-03-14 22:00:12 -05:00
|
|
|
import { budgetsApi } from "../api/budgets";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { heartbeatsApi } from "../api/heartbeats";
|
2026-03-06 13:24:20 -06:00
|
|
|
import { ApiError } from "../api/client";
|
2026-02-26 16:33:48 -06:00
|
|
|
import { ChartCard, RunActivityChart, PriorityChart, IssueStatusChart, SuccessRateChart } from "../components/ActivityCharts";
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
import { activityApi } from "../api/activity";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { issuesApi } from "../api/issues";
|
|
|
|
|
import { usePanel } from "../context/PanelContext";
|
2026-02-20 10:33:18 -06:00
|
|
|
import { useSidebar } from "../context/SidebarContext";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { useCompany } from "../context/CompanyContext";
|
2026-02-17 20:07:30 -06:00
|
|
|
import { useDialog } from "../context/DialogContext";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { useBreadcrumbs } from "../context/BreadcrumbContext";
|
2026-02-17 12:24:48 -06:00
|
|
|
import { queryKeys } from "../lib/queryKeys";
|
2026-02-17 20:07:30 -06:00
|
|
|
import { AgentConfigForm } from "../components/AgentConfigForm";
|
2026-03-10 09:08:20 -05:00
|
|
|
import { PageTabBar } from "../components/PageTabBar";
|
2026-02-17 20:07:30 -06:00
|
|
|
import { adapterLabels, roleLabels } from "../components/agent-config-primitives";
|
2026-02-18 13:53:03 -06:00
|
|
|
import { getUIAdapter, buildTranscript } from "../adapters";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { StatusBadge } from "../components/StatusBadge";
|
2026-02-23 19:52:43 -06:00
|
|
|
import { agentStatusDot, agentStatusDotDefault } from "../lib/status-colors";
|
2026-02-23 15:23:08 -06:00
|
|
|
import { MarkdownBody } from "../components/MarkdownBody";
|
2026-02-18 15:29:29 -06:00
|
|
|
import { CopyText } from "../components/CopyText";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { EntityRow } from "../components/EntityRow";
|
2026-02-19 14:39:48 -06:00
|
|
|
import { Identity } from "../components/Identity";
|
2026-03-02 16:44:03 -06:00
|
|
|
import { PageSkeleton } from "../components/PageSkeleton";
|
2026-03-14 22:00:12 -05:00
|
|
|
import { BudgetPolicyCard } from "../components/BudgetPolicyCard";
|
2026-03-07 20:07:39 -06:00
|
|
|
import { ScrollToBottom } from "../components/ScrollToBottom";
|
2026-03-14 22:00:12 -05:00
|
|
|
import { formatCents, formatDate, relativeTime, formatTokens, visibleRunCostUsd } from "../lib/utils";
|
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 { cn } from "../lib/utils";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { Button } from "@/components/ui/button";
|
2026-03-17 09:21:44 -05:00
|
|
|
import { Badge } from "@/components/ui/badge";
|
2026-03-10 09:08:20 -05:00
|
|
|
import { Tabs } from "@/components/ui/tabs";
|
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 {
|
|
|
|
|
Popover,
|
|
|
|
|
PopoverContent,
|
|
|
|
|
PopoverTrigger,
|
|
|
|
|
} from "@/components/ui/popover";
|
|
|
|
|
import {
|
|
|
|
|
MoreHorizontal,
|
|
|
|
|
Play,
|
|
|
|
|
Pause,
|
|
|
|
|
CheckCircle2,
|
|
|
|
|
XCircle,
|
|
|
|
|
Clock,
|
|
|
|
|
Timer,
|
|
|
|
|
Loader2,
|
|
|
|
|
Slash,
|
|
|
|
|
RotateCcw,
|
|
|
|
|
Trash2,
|
2026-02-17 20:07:30 -06:00
|
|
|
Plus,
|
2026-02-17 20:46:12 -06:00
|
|
|
Key,
|
|
|
|
|
Eye,
|
|
|
|
|
EyeOff,
|
|
|
|
|
Copy,
|
2026-02-18 15:29:29 -06:00
|
|
|
ChevronRight,
|
2026-02-23 14:41:21 -06:00
|
|
|
ChevronDown,
|
2026-02-20 10:33:18 -06:00
|
|
|
ArrowLeft,
|
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-02-17 20:46:12 -06:00
|
|
|
import { Input } from "@/components/ui/input";
|
2026-02-23 12:25:13 -06:00
|
|
|
import { AgentIcon, AgentIconPicker } from "../components/AgentIconPicker";
|
2026-03-11 10:35:41 -05:00
|
|
|
import { RunTranscriptView, type TranscriptMode } from "../components/transcript/RunTranscriptView";
|
2026-03-14 22:00:12 -05:00
|
|
|
import {
|
|
|
|
|
isUuidLike,
|
|
|
|
|
type Agent,
|
|
|
|
|
type BudgetPolicySummary,
|
|
|
|
|
type HeartbeatRun,
|
|
|
|
|
type HeartbeatRunEvent,
|
|
|
|
|
type AgentRuntimeState,
|
|
|
|
|
type LiveEvent,
|
2026-03-17 09:36:35 -05:00
|
|
|
type WorkspaceOperation,
|
2026-03-14 22:00:12 -05:00
|
|
|
} from "@paperclipai/shared";
|
2026-03-11 20:56:47 -05:00
|
|
|
import { redactHomePathUserSegments, redactHomePathUserSegmentsInValue } from "@paperclipai/adapter-utils";
|
2026-03-02 16:44:03 -06:00
|
|
|
import { agentRouteRef } from "../lib/utils";
|
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 runStatusIcons: Record<string, { icon: typeof CheckCircle2; color: string }> = {
|
2026-02-26 16:33:48 -06:00
|
|
|
succeeded: { icon: CheckCircle2, color: "text-green-600 dark:text-green-400" },
|
|
|
|
|
failed: { icon: XCircle, color: "text-red-600 dark:text-red-400" },
|
|
|
|
|
running: { icon: Loader2, color: "text-cyan-600 dark:text-cyan-400" },
|
|
|
|
|
queued: { icon: Clock, color: "text-yellow-600 dark:text-yellow-400" },
|
|
|
|
|
timed_out: { icon: Timer, color: "text-orange-600 dark:text-orange-400" },
|
|
|
|
|
cancelled: { icon: Slash, color: "text-neutral-500 dark:text-neutral-400" },
|
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-18 16:46:55 -06:00
|
|
|
const REDACTED_ENV_VALUE = "***REDACTED***";
|
|
|
|
|
const SECRET_ENV_KEY_RE =
|
|
|
|
|
/(api[-_]?key|access[-_]?token|auth(?:_?token)?|authorization|bearer|secret|passwd|password|credential|jwt|private[-_]?key|cookie|connectionstring)/i;
|
|
|
|
|
const JWT_VALUE_RE = /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/;
|
|
|
|
|
|
|
|
|
|
function shouldRedactSecretValue(key: string, value: unknown): boolean {
|
|
|
|
|
if (SECRET_ENV_KEY_RE.test(key)) return true;
|
|
|
|
|
if (typeof value !== "string") return false;
|
|
|
|
|
return JWT_VALUE_RE.test(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function redactEnvValue(key: string, value: unknown): string {
|
2026-02-19 15:44:05 -06:00
|
|
|
if (
|
|
|
|
|
typeof value === "object" &&
|
|
|
|
|
value !== null &&
|
|
|
|
|
!Array.isArray(value) &&
|
|
|
|
|
(value as { type?: unknown }).type === "secret_ref"
|
|
|
|
|
) {
|
|
|
|
|
return "***SECRET_REF***";
|
|
|
|
|
}
|
2026-02-18 16:46:55 -06:00
|
|
|
if (shouldRedactSecretValue(key, value)) return REDACTED_ENV_VALUE;
|
|
|
|
|
if (value === null || value === undefined) return "";
|
2026-03-11 20:56:47 -05:00
|
|
|
if (typeof value === "string") return redactHomePathUserSegments(value);
|
2026-02-18 16:46:55 -06:00
|
|
|
try {
|
2026-03-11 20:56:47 -05:00
|
|
|
return JSON.stringify(redactHomePathUserSegmentsInValue(value));
|
2026-02-18 16:46:55 -06:00
|
|
|
} catch {
|
2026-03-11 20:56:47 -05:00
|
|
|
return redactHomePathUserSegments(String(value));
|
2026-02-18 16:46:55 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatEnvForDisplay(envValue: unknown): string {
|
|
|
|
|
const env = asRecord(envValue);
|
|
|
|
|
if (!env) return "<unable-to-parse>";
|
|
|
|
|
|
|
|
|
|
const keys = Object.keys(env);
|
|
|
|
|
if (keys.length === 0) return "<empty>";
|
|
|
|
|
|
|
|
|
|
return keys
|
|
|
|
|
.sort()
|
|
|
|
|
.map((key) => `${key}=${redactEnvValue(key, env[key])}`)
|
|
|
|
|
.join("\n");
|
|
|
|
|
}
|
|
|
|
|
|
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 sourceLabels: Record<string, string> = {
|
|
|
|
|
timer: "Timer",
|
|
|
|
|
assignment: "Assignment",
|
|
|
|
|
on_demand: "On-demand",
|
|
|
|
|
automation: "Automation",
|
|
|
|
|
};
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-02-20 15:48:42 -06:00
|
|
|
const LIVE_SCROLL_BOTTOM_TOLERANCE_PX = 32;
|
|
|
|
|
type ScrollContainer = Window | HTMLElement;
|
|
|
|
|
|
|
|
|
|
function isWindowContainer(container: ScrollContainer): container is Window {
|
|
|
|
|
return container === window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isElementScrollContainer(element: HTMLElement): boolean {
|
|
|
|
|
const overflowY = window.getComputedStyle(element).overflowY;
|
|
|
|
|
return overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function findScrollContainer(anchor: HTMLElement | null): ScrollContainer {
|
|
|
|
|
let parent = anchor?.parentElement ?? null;
|
|
|
|
|
while (parent) {
|
|
|
|
|
if (isElementScrollContainer(parent)) return parent;
|
|
|
|
|
parent = parent.parentElement;
|
|
|
|
|
}
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function readScrollMetrics(container: ScrollContainer): { scrollHeight: number; distanceFromBottom: number } {
|
|
|
|
|
if (isWindowContainer(container)) {
|
|
|
|
|
const pageHeight = Math.max(
|
|
|
|
|
document.documentElement.scrollHeight,
|
|
|
|
|
document.body.scrollHeight,
|
|
|
|
|
);
|
|
|
|
|
const viewportBottom = window.scrollY + window.innerHeight;
|
|
|
|
|
return {
|
|
|
|
|
scrollHeight: pageHeight,
|
|
|
|
|
distanceFromBottom: Math.max(0, pageHeight - viewportBottom),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const viewportBottom = container.scrollTop + container.clientHeight;
|
|
|
|
|
return {
|
|
|
|
|
scrollHeight: container.scrollHeight,
|
|
|
|
|
distanceFromBottom: Math.max(0, container.scrollHeight - viewportBottom),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scrollToContainerBottom(container: ScrollContainer, behavior: ScrollBehavior = "auto") {
|
|
|
|
|
if (isWindowContainer(container)) {
|
|
|
|
|
const pageHeight = Math.max(
|
|
|
|
|
document.documentElement.scrollHeight,
|
|
|
|
|
document.body.scrollHeight,
|
|
|
|
|
);
|
|
|
|
|
window.scrollTo({ top: pageHeight, behavior });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
container.scrollTo({ top: container.scrollHeight, behavior });
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 09:10:40 -05:00
|
|
|
type AgentDetailView = "dashboard" | "configuration" | "skills" | "runs" | "budget";
|
2026-02-18 13:02:23 -06:00
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
function parseAgentDetailView(value: string | null): AgentDetailView {
|
2026-03-10 09:08:20 -05:00
|
|
|
if (value === "configure" || value === "configuration") return "configuration";
|
2026-03-17 09:10:40 -05:00
|
|
|
if (value === "skills") return value;
|
|
|
|
|
if (value === "budget") return value;
|
2026-02-18 13:02:23 -06:00
|
|
|
if (value === "runs") return value;
|
2026-03-10 09:08:20 -05:00
|
|
|
return "dashboard";
|
2026-02-18 13:02:23 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function usageNumber(usage: Record<string, unknown> | null, ...keys: string[]) {
|
|
|
|
|
if (!usage) return 0;
|
|
|
|
|
for (const key of keys) {
|
|
|
|
|
const value = usage[key];
|
|
|
|
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function runMetrics(run: HeartbeatRun) {
|
|
|
|
|
const usage = (run.usageJson ?? null) as Record<string, unknown> | null;
|
|
|
|
|
const result = (run.resultJson ?? null) as Record<string, unknown> | null;
|
|
|
|
|
const input = usageNumber(usage, "inputTokens", "input_tokens");
|
|
|
|
|
const output = usageNumber(usage, "outputTokens", "output_tokens");
|
|
|
|
|
const cached = usageNumber(
|
|
|
|
|
usage,
|
|
|
|
|
"cachedInputTokens",
|
|
|
|
|
"cached_input_tokens",
|
|
|
|
|
"cache_read_input_tokens",
|
|
|
|
|
);
|
|
|
|
|
const cost =
|
2026-03-14 22:00:12 -05:00
|
|
|
visibleRunCostUsd(usage, result);
|
2026-02-18 13:02:23 -06:00
|
|
|
return {
|
|
|
|
|
input,
|
|
|
|
|
output,
|
|
|
|
|
cached,
|
|
|
|
|
cost,
|
|
|
|
|
totalTokens: input + output,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RunLogChunk = { ts: string; stream: "stdout" | "stderr" | "system"; chunk: string };
|
|
|
|
|
|
|
|
|
|
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
|
|
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
|
|
|
return value as Record<string, unknown>;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-26 10:32:51 -06:00
|
|
|
function asNonEmptyString(value: unknown): string | null {
|
|
|
|
|
if (typeof value !== "string") return null;
|
|
|
|
|
const trimmed = value.trim();
|
|
|
|
|
return trimmed.length > 0 ? trimmed : null;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 09:36:35 -05:00
|
|
|
function parseStoredLogContent(content: string): RunLogChunk[] {
|
|
|
|
|
const parsed: RunLogChunk[] = [];
|
|
|
|
|
for (const line of content.split("\n")) {
|
|
|
|
|
const trimmed = line.trim();
|
|
|
|
|
if (!trimmed) continue;
|
|
|
|
|
try {
|
|
|
|
|
const raw = JSON.parse(trimmed) as { ts?: unknown; stream?: unknown; chunk?: unknown };
|
|
|
|
|
const stream =
|
|
|
|
|
raw.stream === "stderr" || raw.stream === "system" ? raw.stream : "stdout";
|
|
|
|
|
const chunk = typeof raw.chunk === "string" ? raw.chunk : "";
|
|
|
|
|
const ts = typeof raw.ts === "string" ? raw.ts : new Date().toISOString();
|
|
|
|
|
if (!chunk) continue;
|
|
|
|
|
parsed.push({ ts, stream, chunk });
|
|
|
|
|
} catch {
|
|
|
|
|
// Ignore malformed log lines.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return parsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function workspaceOperationPhaseLabel(phase: WorkspaceOperation["phase"]) {
|
|
|
|
|
switch (phase) {
|
|
|
|
|
case "worktree_prepare":
|
|
|
|
|
return "Worktree setup";
|
|
|
|
|
case "workspace_provision":
|
|
|
|
|
return "Provision";
|
|
|
|
|
case "workspace_teardown":
|
|
|
|
|
return "Teardown";
|
|
|
|
|
case "worktree_cleanup":
|
|
|
|
|
return "Worktree cleanup";
|
|
|
|
|
default:
|
|
|
|
|
return phase;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function workspaceOperationStatusTone(status: WorkspaceOperation["status"]) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case "succeeded":
|
|
|
|
|
return "border-green-500/20 bg-green-500/10 text-green-700 dark:text-green-300";
|
|
|
|
|
case "failed":
|
|
|
|
|
return "border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300";
|
|
|
|
|
case "running":
|
|
|
|
|
return "border-cyan-500/20 bg-cyan-500/10 text-cyan-700 dark:text-cyan-300";
|
|
|
|
|
case "skipped":
|
|
|
|
|
return "border-yellow-500/20 bg-yellow-500/10 text-yellow-700 dark:text-yellow-300";
|
|
|
|
|
default:
|
|
|
|
|
return "border-border bg-muted/40 text-muted-foreground";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function WorkspaceOperationStatusBadge({ status }: { status: WorkspaceOperation["status"] }) {
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
className={cn(
|
|
|
|
|
"inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize",
|
|
|
|
|
workspaceOperationStatusTone(status),
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{status.replace("_", " ")}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function WorkspaceOperationLogViewer({ operation }: { operation: WorkspaceOperation }) {
|
|
|
|
|
const [open, setOpen] = useState(false);
|
|
|
|
|
const { data: logData, isLoading, error } = useQuery({
|
|
|
|
|
queryKey: ["workspace-operation-log", operation.id],
|
|
|
|
|
queryFn: () => heartbeatsApi.workspaceOperationLog(operation.id),
|
|
|
|
|
enabled: open && Boolean(operation.logRef),
|
|
|
|
|
refetchInterval: open && operation.status === "running" ? 2000 : false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const chunks = useMemo(
|
|
|
|
|
() => (logData?.content ? parseStoredLogContent(logData.content) : []),
|
|
|
|
|
[logData?.content],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className="text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground"
|
|
|
|
|
onClick={() => setOpen((value) => !value)}
|
|
|
|
|
>
|
|
|
|
|
{open ? "Hide full log" : "Show full log"}
|
|
|
|
|
</button>
|
|
|
|
|
{open && (
|
|
|
|
|
<div className="rounded-md border border-border bg-background/70 p-2">
|
|
|
|
|
{isLoading && <div className="text-xs text-muted-foreground">Loading log...</div>}
|
|
|
|
|
{error && (
|
|
|
|
|
<div className="text-xs text-destructive">
|
|
|
|
|
{error instanceof Error ? error.message : "Failed to load workspace operation log"}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{!isLoading && !error && chunks.length === 0 && (
|
|
|
|
|
<div className="text-xs text-muted-foreground">No persisted log lines.</div>
|
|
|
|
|
)}
|
|
|
|
|
{chunks.length > 0 && (
|
|
|
|
|
<div className="max-h-64 overflow-y-auto rounded bg-neutral-100 p-2 font-mono text-xs dark:bg-neutral-950">
|
|
|
|
|
{chunks.map((chunk, index) => (
|
|
|
|
|
<div key={`${chunk.ts}-${index}`} className="flex gap-2">
|
|
|
|
|
<span className="shrink-0 text-neutral-500">
|
|
|
|
|
{new Date(chunk.ts).toLocaleTimeString("en-US", { hour12: false })}
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
className={cn(
|
|
|
|
|
"shrink-0 w-14",
|
|
|
|
|
chunk.stream === "stderr"
|
|
|
|
|
? "text-red-600 dark:text-red-300"
|
|
|
|
|
: chunk.stream === "system"
|
|
|
|
|
? "text-blue-600 dark:text-blue-300"
|
|
|
|
|
: "text-muted-foreground",
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
[{chunk.stream}]
|
|
|
|
|
</span>
|
|
|
|
|
<span className="whitespace-pre-wrap break-all">{redactHomePathUserSegments(chunk.chunk)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function WorkspaceOperationsSection({ operations }: { operations: WorkspaceOperation[] }) {
|
|
|
|
|
if (operations.length === 0) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="rounded-lg border border-border bg-background/60 p-3 space-y-3">
|
|
|
|
|
<div className="text-xs font-medium text-muted-foreground">
|
|
|
|
|
Workspace ({operations.length})
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-3">
|
|
|
|
|
{operations.map((operation) => {
|
|
|
|
|
const metadata = asRecord(operation.metadata);
|
|
|
|
|
return (
|
|
|
|
|
<div key={operation.id} className="rounded-md border border-border/70 bg-background/70 p-3 space-y-2">
|
|
|
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
|
|
|
<div className="text-sm font-medium">{workspaceOperationPhaseLabel(operation.phase)}</div>
|
|
|
|
|
<WorkspaceOperationStatusBadge status={operation.status} />
|
|
|
|
|
<div className="text-[11px] text-muted-foreground">
|
|
|
|
|
{relativeTime(operation.startedAt)}
|
|
|
|
|
{operation.finishedAt && ` to ${relativeTime(operation.finishedAt)}`}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{operation.command && (
|
|
|
|
|
<div className="text-xs break-all">
|
|
|
|
|
<span className="text-muted-foreground">Command: </span>
|
|
|
|
|
<span className="font-mono">{operation.command}</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{operation.cwd && (
|
|
|
|
|
<div className="text-xs break-all">
|
|
|
|
|
<span className="text-muted-foreground">Working dir: </span>
|
|
|
|
|
<span className="font-mono">{operation.cwd}</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{(asNonEmptyString(metadata?.branchName)
|
|
|
|
|
|| asNonEmptyString(metadata?.baseRef)
|
|
|
|
|
|| asNonEmptyString(metadata?.worktreePath)
|
|
|
|
|
|| asNonEmptyString(metadata?.repoRoot)
|
|
|
|
|
|| asNonEmptyString(metadata?.cleanupAction)) && (
|
|
|
|
|
<div className="grid gap-1 text-xs sm:grid-cols-2">
|
|
|
|
|
{asNonEmptyString(metadata?.branchName) && (
|
|
|
|
|
<div><span className="text-muted-foreground">Branch: </span><span className="font-mono">{metadata?.branchName as string}</span></div>
|
|
|
|
|
)}
|
|
|
|
|
{asNonEmptyString(metadata?.baseRef) && (
|
|
|
|
|
<div><span className="text-muted-foreground">Base ref: </span><span className="font-mono">{metadata?.baseRef as string}</span></div>
|
|
|
|
|
)}
|
|
|
|
|
{asNonEmptyString(metadata?.worktreePath) && (
|
|
|
|
|
<div className="break-all"><span className="text-muted-foreground">Worktree: </span><span className="font-mono">{metadata?.worktreePath as string}</span></div>
|
|
|
|
|
)}
|
|
|
|
|
{asNonEmptyString(metadata?.repoRoot) && (
|
|
|
|
|
<div className="break-all"><span className="text-muted-foreground">Repo root: </span><span className="font-mono">{metadata?.repoRoot as string}</span></div>
|
|
|
|
|
)}
|
|
|
|
|
{asNonEmptyString(metadata?.cleanupAction) && (
|
|
|
|
|
<div><span className="text-muted-foreground">Cleanup: </span><span className="font-mono">{metadata?.cleanupAction as string}</span></div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{typeof metadata?.created === "boolean" && (
|
|
|
|
|
<div className="text-xs text-muted-foreground">
|
|
|
|
|
{metadata.created ? "Created by this run" : "Reused existing workspace"}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{operation.stderrExcerpt && operation.stderrExcerpt.trim() && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="mb-1 text-xs text-red-700 dark:text-red-300">stderr excerpt</div>
|
|
|
|
|
<pre className="rounded-md bg-red-50 p-2 text-xs whitespace-pre-wrap break-all text-red-800 dark:bg-neutral-950 dark:text-red-100">
|
|
|
|
|
{redactHomePathUserSegments(operation.stderrExcerpt)}
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{operation.stdoutExcerpt && operation.stdoutExcerpt.trim() && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="mb-1 text-xs text-muted-foreground">stdout excerpt</div>
|
|
|
|
|
<pre className="rounded-md bg-neutral-100 p-2 text-xs whitespace-pre-wrap break-all dark:bg-neutral-950">
|
|
|
|
|
{redactHomePathUserSegments(operation.stdoutExcerpt)}
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{operation.logRef && <WorkspaceOperationLogViewer operation={operation} />}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
export function AgentDetail() {
|
2026-03-02 16:44:03 -06:00
|
|
|
const { companyPrefix, agentId, tab: urlTab, runId: urlRunId } = useParams<{
|
|
|
|
|
companyPrefix?: string;
|
|
|
|
|
agentId: string;
|
|
|
|
|
tab?: string;
|
|
|
|
|
runId?: string;
|
|
|
|
|
}>();
|
|
|
|
|
const { companies, selectedCompanyId, setSelectedCompanyId } = useCompany();
|
2026-02-18 13:02:23 -06:00
|
|
|
const { closePanel } = usePanel();
|
2026-02-17 20:07:30 -06:00
|
|
|
const { openNewIssue } = useDialog();
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
const { setBreadcrumbs } = useBreadcrumbs();
|
2026-02-17 12:24:48 -06:00
|
|
|
const queryClient = useQueryClient();
|
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 navigate = useNavigate();
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
const [actionError, setActionError] = 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
|
|
|
const [moreOpen, setMoreOpen] = useState(false);
|
2026-02-23 14:41:21 -06:00
|
|
|
const activeView = urlRunId ? "runs" as AgentDetailView : parseAgentDetailView(urlTab ?? null);
|
2026-02-18 13:02:23 -06:00
|
|
|
const [configDirty, setConfigDirty] = useState(false);
|
|
|
|
|
const [configSaving, setConfigSaving] = useState(false);
|
|
|
|
|
const saveConfigActionRef = useRef<(() => void) | null>(null);
|
|
|
|
|
const cancelConfigActionRef = useRef<(() => void) | null>(null);
|
2026-02-20 11:29:13 -06:00
|
|
|
const { isMobile } = useSidebar();
|
2026-03-02 16:44:03 -06:00
|
|
|
const routeAgentRef = agentId ?? "";
|
|
|
|
|
const routeCompanyId = useMemo(() => {
|
|
|
|
|
if (!companyPrefix) return null;
|
|
|
|
|
const requestedPrefix = companyPrefix.toUpperCase();
|
|
|
|
|
return companies.find((company) => company.issuePrefix.toUpperCase() === requestedPrefix)?.id ?? null;
|
|
|
|
|
}, [companies, companyPrefix]);
|
|
|
|
|
const lookupCompanyId = routeCompanyId ?? selectedCompanyId ?? undefined;
|
|
|
|
|
const canFetchAgent = routeAgentRef.length > 0 && (isUuidLike(routeAgentRef) || Boolean(lookupCompanyId));
|
2026-02-18 13:02:23 -06:00
|
|
|
const setSaveConfigAction = useCallback((fn: (() => void) | null) => { saveConfigActionRef.current = fn; }, []);
|
|
|
|
|
const setCancelConfigAction = useCallback((fn: (() => void) | null) => { cancelConfigActionRef.current = fn; }, []);
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-02-17 12:24:48 -06:00
|
|
|
const { data: agent, isLoading, error } = useQuery({
|
2026-03-02 16:44:03 -06:00
|
|
|
queryKey: [...queryKeys.agents.detail(routeAgentRef), lookupCompanyId ?? null],
|
|
|
|
|
queryFn: () => agentsApi.get(routeAgentRef, lookupCompanyId),
|
|
|
|
|
enabled: canFetchAgent,
|
2026-02-17 12:24:48 -06:00
|
|
|
});
|
2026-03-02 16:44:03 -06:00
|
|
|
const resolvedCompanyId = agent?.companyId ?? selectedCompanyId;
|
|
|
|
|
const canonicalAgentRef = agent ? agentRouteRef(agent) : routeAgentRef;
|
|
|
|
|
const agentLookupRef = agent?.id ?? routeAgentRef;
|
2026-03-06 09:06:55 -06:00
|
|
|
const resolvedAgentId = agent?.id ?? null;
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -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 { data: runtimeState } = useQuery({
|
2026-03-06 09:06:55 -06:00
|
|
|
queryKey: queryKeys.agents.runtimeState(resolvedAgentId ?? routeAgentRef),
|
|
|
|
|
queryFn: () => agentsApi.runtimeState(resolvedAgentId!, resolvedCompanyId ?? undefined),
|
|
|
|
|
enabled: Boolean(resolvedAgentId),
|
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 12:24:48 -06:00
|
|
|
const { data: heartbeats } = useQuery({
|
2026-03-02 16:44:03 -06:00
|
|
|
queryKey: queryKeys.heartbeats(resolvedCompanyId!, agent?.id ?? undefined),
|
|
|
|
|
queryFn: () => heartbeatsApi.list(resolvedCompanyId!, agent?.id ?? undefined),
|
|
|
|
|
enabled: !!resolvedCompanyId && !!agent?.id,
|
2026-02-17 12:24:48 -06:00
|
|
|
});
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-02-17 12:24:48 -06:00
|
|
|
const { data: allIssues } = useQuery({
|
2026-03-02 16:44:03 -06:00
|
|
|
queryKey: queryKeys.issues.list(resolvedCompanyId!),
|
|
|
|
|
queryFn: () => issuesApi.list(resolvedCompanyId!),
|
|
|
|
|
enabled: !!resolvedCompanyId,
|
2026-02-17 12:24:48 -06:00
|
|
|
});
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -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 { data: allAgents } = useQuery({
|
2026-03-02 16:44:03 -06:00
|
|
|
queryKey: queryKeys.agents.list(resolvedCompanyId!),
|
|
|
|
|
queryFn: () => agentsApi.list(resolvedCompanyId!),
|
|
|
|
|
enabled: !!resolvedCompanyId,
|
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-14 22:00:12 -05:00
|
|
|
const { data: budgetOverview } = useQuery({
|
|
|
|
|
queryKey: queryKeys.budgets.overview(resolvedCompanyId ?? "__none__"),
|
|
|
|
|
queryFn: () => budgetsApi.overview(resolvedCompanyId!),
|
|
|
|
|
enabled: !!resolvedCompanyId,
|
|
|
|
|
refetchInterval: 30_000,
|
|
|
|
|
staleTime: 5_000,
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-02 16:55:37 -06:00
|
|
|
const assignedIssues = (allIssues ?? [])
|
|
|
|
|
.filter((i) => i.assigneeAgentId === agent?.id)
|
|
|
|
|
.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
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 reportsToAgent = (allAgents ?? []).find((a) => a.id === agent?.reportsTo);
|
2026-03-02 16:44:03 -06:00
|
|
|
const directReports = (allAgents ?? []).filter((a) => a.reportsTo === agent?.id && a.status !== "terminated");
|
2026-03-14 22:00:12 -05:00
|
|
|
const agentBudgetSummary = useMemo(() => {
|
|
|
|
|
const matched = budgetOverview?.policies.find(
|
|
|
|
|
(policy) => policy.scopeType === "agent" && policy.scopeId === (agent?.id ?? routeAgentRef),
|
|
|
|
|
);
|
|
|
|
|
if (matched) return matched;
|
|
|
|
|
const budgetMonthlyCents = agent?.budgetMonthlyCents ?? 0;
|
|
|
|
|
const spentMonthlyCents = agent?.spentMonthlyCents ?? 0;
|
|
|
|
|
return {
|
|
|
|
|
policyId: "",
|
|
|
|
|
companyId: resolvedCompanyId ?? "",
|
|
|
|
|
scopeType: "agent",
|
|
|
|
|
scopeId: agent?.id ?? routeAgentRef,
|
|
|
|
|
scopeName: agent?.name ?? "Agent",
|
|
|
|
|
metric: "billed_cents",
|
|
|
|
|
windowKind: "calendar_month_utc",
|
|
|
|
|
amount: budgetMonthlyCents,
|
|
|
|
|
observedAmount: spentMonthlyCents,
|
|
|
|
|
remainingAmount: Math.max(0, budgetMonthlyCents - spentMonthlyCents),
|
|
|
|
|
utilizationPercent:
|
|
|
|
|
budgetMonthlyCents > 0 ? Number(((spentMonthlyCents / budgetMonthlyCents) * 100).toFixed(2)) : 0,
|
|
|
|
|
warnPercent: 80,
|
|
|
|
|
hardStopEnabled: true,
|
|
|
|
|
notifyEnabled: true,
|
|
|
|
|
isActive: budgetMonthlyCents > 0,
|
|
|
|
|
status: budgetMonthlyCents > 0 && spentMonthlyCents >= budgetMonthlyCents ? "hard_stop" : "ok",
|
|
|
|
|
paused: agent?.status === "paused",
|
|
|
|
|
pauseReason: agent?.pauseReason ?? null,
|
|
|
|
|
windowStart: new Date(),
|
|
|
|
|
windowEnd: new Date(),
|
|
|
|
|
} satisfies BudgetPolicySummary;
|
|
|
|
|
}, [agent, budgetOverview?.policies, resolvedCompanyId, routeAgentRef]);
|
2026-02-20 11:29:13 -06:00
|
|
|
const mobileLiveRun = useMemo(
|
|
|
|
|
() => (heartbeats ?? []).find((r) => r.status === "running" || r.status === "queued") ?? null,
|
|
|
|
|
[heartbeats],
|
|
|
|
|
);
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-03-02 16:44:03 -06:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!agent) return;
|
|
|
|
|
if (urlRunId) {
|
2026-03-10 09:08:20 -05:00
|
|
|
if (routeAgentRef !== canonicalAgentRef) {
|
|
|
|
|
navigate(`/agents/${canonicalAgentRef}/runs/${urlRunId}`, { replace: true });
|
|
|
|
|
}
|
2026-03-02 16:44:03 -06:00
|
|
|
return;
|
|
|
|
|
}
|
2026-03-10 21:06:15 -05:00
|
|
|
const canonicalTab =
|
|
|
|
|
activeView === "configuration"
|
|
|
|
|
? "configuration"
|
2026-03-17 09:10:40 -05:00
|
|
|
: activeView === "skills"
|
|
|
|
|
? "skills"
|
|
|
|
|
: activeView === "runs"
|
|
|
|
|
? "runs"
|
|
|
|
|
: activeView === "budget"
|
|
|
|
|
? "budget"
|
2026-03-16 16:02:21 -05:00
|
|
|
: "dashboard";
|
2026-03-10 09:08:20 -05:00
|
|
|
if (routeAgentRef !== canonicalAgentRef || urlTab !== canonicalTab) {
|
|
|
|
|
navigate(`/agents/${canonicalAgentRef}/${canonicalTab}`, { replace: true });
|
2026-03-02 16:44:03 -06:00
|
|
|
return;
|
|
|
|
|
}
|
2026-03-10 09:08:20 -05:00
|
|
|
}, [agent, routeAgentRef, canonicalAgentRef, urlRunId, urlTab, activeView, navigate]);
|
2026-03-02 16:44:03 -06:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!agent?.companyId || agent.companyId === selectedCompanyId) return;
|
|
|
|
|
setSelectedCompanyId(agent.companyId, { source: "route_sync" });
|
|
|
|
|
}, [agent?.companyId, selectedCompanyId, setSelectedCompanyId]);
|
|
|
|
|
|
2026-02-17 12:24:48 -06:00
|
|
|
const agentAction = useMutation({
|
2026-02-19 14:02:29 -06:00
|
|
|
mutationFn: async (action: "invoke" | "pause" | "resume" | "terminate") => {
|
2026-03-02 16:44:03 -06:00
|
|
|
if (!agentLookupRef) return Promise.reject(new Error("No agent reference"));
|
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
|
|
|
switch (action) {
|
2026-03-02 16:44:03 -06:00
|
|
|
case "invoke": return agentsApi.invoke(agentLookupRef, resolvedCompanyId ?? undefined);
|
|
|
|
|
case "pause": return agentsApi.pause(agentLookupRef, resolvedCompanyId ?? undefined);
|
|
|
|
|
case "resume": return agentsApi.resume(agentLookupRef, resolvedCompanyId ?? undefined);
|
|
|
|
|
case "terminate": return agentsApi.terminate(agentLookupRef, resolvedCompanyId ?? undefined);
|
2026-02-17 12:24:48 -06:00
|
|
|
}
|
|
|
|
|
},
|
2026-02-20 12:21:03 -06:00
|
|
|
onSuccess: (data, action) => {
|
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
|
|
|
setActionError(null);
|
2026-03-02 16:44:03 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(routeAgentRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agentLookupRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.runtimeState(agentLookupRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.taskSessions(agentLookupRef) });
|
|
|
|
|
if (resolvedCompanyId) {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(resolvedCompanyId) });
|
|
|
|
|
if (agent?.id) {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(resolvedCompanyId, agent.id) });
|
|
|
|
|
}
|
2026-02-17 12:24:48 -06:00
|
|
|
}
|
2026-02-20 12:21:03 -06:00
|
|
|
if (action === "invoke" && data && typeof data === "object" && "id" in data) {
|
2026-03-02 16:44:03 -06:00
|
|
|
navigate(`/agents/${canonicalAgentRef}/runs/${(data as HeartbeatRun).id}`);
|
2026-02-20 12:21:03 -06:00
|
|
|
}
|
2026-02-17 12:24:48 -06:00
|
|
|
},
|
|
|
|
|
onError: (err) => {
|
|
|
|
|
setActionError(err instanceof Error ? err.message : "Action failed");
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-14 22:00:12 -05:00
|
|
|
const budgetMutation = useMutation({
|
|
|
|
|
mutationFn: (amount: number) =>
|
|
|
|
|
budgetsApi.upsertPolicy(resolvedCompanyId!, {
|
|
|
|
|
scopeType: "agent",
|
|
|
|
|
scopeId: agent?.id ?? routeAgentRef,
|
|
|
|
|
amount,
|
|
|
|
|
windowKind: "calendar_month_utc",
|
|
|
|
|
}),
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
if (!resolvedCompanyId) return;
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.budgets.overview(resolvedCompanyId) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(routeAgentRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agentLookupRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(resolvedCompanyId) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.dashboard(resolvedCompanyId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-23 12:25:13 -06:00
|
|
|
const updateIcon = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: (icon: string) => agentsApi.update(agentLookupRef, { icon }, resolvedCompanyId ?? undefined),
|
2026-02-23 12:25:13 -06:00
|
|
|
onSuccess: () => {
|
2026-03-02 16:44:03 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(routeAgentRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agentLookupRef) });
|
|
|
|
|
if (resolvedCompanyId) {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(resolvedCompanyId) });
|
2026-02-23 12:25:13 -06:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-19 14:02:29 -06:00
|
|
|
const resetTaskSession = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: (taskKey: string | null) =>
|
|
|
|
|
agentsApi.resetSession(agentLookupRef, taskKey, resolvedCompanyId ?? undefined),
|
2026-02-19 14:02:29 -06:00
|
|
|
onSuccess: () => {
|
|
|
|
|
setActionError(null);
|
2026-03-02 16:44:03 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.runtimeState(agentLookupRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.taskSessions(agentLookupRef) });
|
2026-02-19 14:02:29 -06:00
|
|
|
},
|
|
|
|
|
onError: (err) => {
|
|
|
|
|
setActionError(err instanceof Error ? err.message : "Failed to reset session");
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
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
|
|
|
const updatePermissions = useMutation({
|
|
|
|
|
mutationFn: (canCreateAgents: boolean) =>
|
2026-03-02 16:44:03 -06:00
|
|
|
agentsApi.updatePermissions(agentLookupRef, { canCreateAgents }, resolvedCompanyId ?? undefined),
|
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
|
|
|
onSuccess: () => {
|
|
|
|
|
setActionError(null);
|
2026-03-02 16:44:03 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(routeAgentRef) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agentLookupRef) });
|
|
|
|
|
if (resolvedCompanyId) {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(resolvedCompanyId) });
|
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
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onError: (err) => {
|
|
|
|
|
setActionError(err instanceof Error ? err.message : "Failed to update permissions");
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
useEffect(() => {
|
2026-02-23 14:41:21 -06:00
|
|
|
const crumbs: { label: string; href?: string }[] = [
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
{ label: "Agents", href: "/agents" },
|
2026-02-23 14:41:21 -06:00
|
|
|
];
|
2026-03-02 16:44:03 -06:00
|
|
|
const agentName = agent?.name ?? routeAgentRef ?? "Agent";
|
2026-03-10 09:08:20 -05:00
|
|
|
if (activeView === "dashboard" && !urlRunId) {
|
2026-02-23 14:41:21 -06:00
|
|
|
crumbs.push({ label: agentName });
|
|
|
|
|
} else {
|
2026-03-10 09:08:20 -05:00
|
|
|
crumbs.push({ label: agentName, href: `/agents/${canonicalAgentRef}/dashboard` });
|
2026-02-23 14:41:21 -06:00
|
|
|
if (urlRunId) {
|
2026-03-02 16:44:03 -06:00
|
|
|
crumbs.push({ label: "Runs", href: `/agents/${canonicalAgentRef}/runs` });
|
2026-02-23 14:41:21 -06:00
|
|
|
crumbs.push({ label: `Run ${urlRunId.slice(0, 8)}` });
|
2026-03-10 09:08:20 -05:00
|
|
|
} else if (activeView === "configuration") {
|
|
|
|
|
crumbs.push({ label: "Configuration" });
|
2026-03-17 09:10:40 -05:00
|
|
|
} else if (activeView === "skills") {
|
|
|
|
|
crumbs.push({ label: "Skills" });
|
2026-02-23 14:41:21 -06:00
|
|
|
} else if (activeView === "runs") {
|
|
|
|
|
crumbs.push({ label: "Runs" });
|
2026-03-16 16:02:21 -05:00
|
|
|
} else if (activeView === "budget") {
|
|
|
|
|
crumbs.push({ label: "Budget" });
|
2026-03-10 09:08:20 -05:00
|
|
|
} else {
|
|
|
|
|
crumbs.push({ label: "Dashboard" });
|
2026-02-23 14:41:21 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setBreadcrumbs(crumbs);
|
2026-03-02 16:44:03 -06:00
|
|
|
}, [setBreadcrumbs, agent, routeAgentRef, canonicalAgentRef, activeView, urlRunId]);
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2026-02-18 13:02:23 -06:00
|
|
|
closePanel();
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
return () => closePanel();
|
2026-03-10 09:08:20 -05:00
|
|
|
}, [closePanel]);
|
2026-02-18 13:02:23 -06:00
|
|
|
|
|
|
|
|
useBeforeUnload(
|
|
|
|
|
useCallback((event) => {
|
|
|
|
|
if (!configDirty) return;
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
event.returnValue = "";
|
|
|
|
|
}, [configDirty]),
|
|
|
|
|
);
|
|
|
|
|
|
2026-03-02 16:44:03 -06:00
|
|
|
if (isLoading) return <PageSkeleton variant="detail" />;
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
if (error) return <p className="text-sm text-destructive">{error.message}</p>;
|
|
|
|
|
if (!agent) return null;
|
2026-03-10 09:08:20 -05:00
|
|
|
if (!urlRunId && !urlTab) {
|
|
|
|
|
return <Navigate to={`/agents/${canonicalAgentRef}/dashboard`} replace />;
|
|
|
|
|
}
|
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
|
|
|
const isPendingApproval = agent.status === "pending_approval";
|
2026-03-10 20:58:18 -05:00
|
|
|
const showConfigActionBar = activeView === "configuration" && (configDirty || configSaving);
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
|
|
|
|
return (
|
2026-02-20 11:29:13 -06:00
|
|
|
<div className={cn("space-y-6", isMobile && showConfigActionBar && "pb-24")}>
|
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
|
|
|
{/* Header */}
|
2026-02-20 10:32:32 -06:00
|
|
|
<div className="flex items-center justify-between gap-2">
|
2026-02-23 12:25:13 -06:00
|
|
|
<div className="flex items-center gap-3 min-w-0">
|
|
|
|
|
<AgentIconPicker
|
|
|
|
|
value={agent.icon}
|
|
|
|
|
onChange={(icon) => updateIcon.mutate(icon)}
|
|
|
|
|
>
|
2026-02-23 14:41:21 -06:00
|
|
|
<button className="shrink-0 flex items-center justify-center h-12 w-12 rounded-lg bg-accent hover:bg-accent/80 transition-colors">
|
|
|
|
|
<AgentIcon icon={agent.icon} className="h-6 w-6" />
|
2026-02-23 12:25:13 -06:00
|
|
|
</button>
|
|
|
|
|
</AgentIconPicker>
|
|
|
|
|
<div className="min-w-0">
|
2026-02-23 14:41:21 -06:00
|
|
|
<h2 className="text-2xl font-bold truncate">{agent.name}</h2>
|
2026-02-23 12:25:13 -06:00
|
|
|
<p className="text-sm text-muted-foreground truncate">
|
|
|
|
|
{roleLabels[agent.role] ?? agent.role}
|
|
|
|
|
{agent.title ? ` - ${agent.title}` : ""}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</div>
|
2026-02-20 10:32:32 -06:00
|
|
|
<div className="flex items-center gap-1 sm:gap-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
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
2026-03-02 16:44:03 -06:00
|
|
|
onClick={() => openNewIssue({ assigneeAgentId: agent.id })}
|
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-20 10:32:32 -06:00
|
|
|
<Plus className="h-3.5 w-3.5 sm:mr-1" />
|
|
|
|
|
<span className="hidden sm:inline">Assign Task</span>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</Button>
|
2026-02-17 20:07:30 -06:00
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
2026-02-18 13:02:23 -06:00
|
|
|
onClick={() => agentAction.mutate("invoke")}
|
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
|
|
|
disabled={agentAction.isPending || isPendingApproval}
|
2026-02-17 20:07:30 -06:00
|
|
|
>
|
2026-02-20 10:32:32 -06:00
|
|
|
<Play className="h-3.5 w-3.5 sm:mr-1" />
|
2026-03-07 08:12:37 -08:00
|
|
|
<span className="hidden sm:inline">Run Heartbeat</span>
|
2026-02-17 20:07:30 -06:00
|
|
|
</Button>
|
2026-02-18 13:02:23 -06:00
|
|
|
{agent.status === "paused" ? (
|
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
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
2026-02-18 13:02:23 -06:00
|
|
|
onClick={() => agentAction.mutate("resume")}
|
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
|
|
|
disabled={agentAction.isPending || isPendingApproval}
|
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-20 10:32:32 -06:00
|
|
|
<Play className="h-3.5 w-3.5 sm:mr-1" />
|
|
|
|
|
<span className="hidden sm:inline">Resume</span>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</Button>
|
|
|
|
|
) : (
|
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
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
2026-02-18 13:02:23 -06:00
|
|
|
onClick={() => agentAction.mutate("pause")}
|
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
|
|
|
disabled={agentAction.isPending || isPendingApproval}
|
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-20 10:32:32 -06:00
|
|
|
<Pause className="h-3.5 w-3.5 sm:mr-1" />
|
|
|
|
|
<span className="hidden sm:inline">Pause</span>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</Button>
|
|
|
|
|
)}
|
2026-02-20 10:32:32 -06:00
|
|
|
<span className="hidden sm:inline"><StatusBadge status={agent.status} /></span>
|
2026-02-20 11:29:13 -06:00
|
|
|
{mobileLiveRun && (
|
2026-02-23 14:41:21 -06:00
|
|
|
<Link
|
2026-03-02 16:44:03 -06:00
|
|
|
to={`/agents/${canonicalAgentRef}/runs/${mobileLiveRun.id}`}
|
2026-02-23 14:41:21 -06:00
|
|
|
className="sm:hidden flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline"
|
2026-02-20 11:29:13 -06:00
|
|
|
>
|
|
|
|
|
<span className="relative flex h-2 w-2">
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<span className="animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75" />
|
2026-02-20 11:29:13 -06:00
|
|
|
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-500" />
|
|
|
|
|
</span>
|
2026-02-26 16:33:48 -06:00
|
|
|
<span className="text-[11px] font-medium text-blue-600 dark:text-blue-400">Live</span>
|
2026-02-23 14:41:21 -06:00
|
|
|
</Link>
|
2026-02-20 11:29:13 -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
|
|
|
|
|
|
|
|
{/* Overflow menu */}
|
|
|
|
|
<Popover open={moreOpen} onOpenChange={setMoreOpen}>
|
|
|
|
|
<PopoverTrigger asChild>
|
|
|
|
|
<Button variant="ghost" size="icon-xs">
|
|
|
|
|
<MoreHorizontal className="h-4 w-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</PopoverTrigger>
|
|
|
|
|
<PopoverContent className="w-44 p-1" align="end">
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50"
|
2026-02-17 21:12:31 -06:00
|
|
|
onClick={() => {
|
|
|
|
|
navigator.clipboard.writeText(agent.id);
|
|
|
|
|
setMoreOpen(false);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Copy className="h-3 w-3" />
|
|
|
|
|
Copy Agent ID
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/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
|
|
|
onClick={() => {
|
2026-02-19 14:02:29 -06:00
|
|
|
resetTaskSession.mutate(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
|
|
|
setMoreOpen(false);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<RotateCcw className="h-3 w-3" />
|
2026-02-19 14:02:29 -06:00
|
|
|
Reset Sessions
|
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>
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50 text-destructive"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
agentAction.mutate("terminate");
|
|
|
|
|
setMoreOpen(false);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Trash2 className="h-3 w-3" />
|
|
|
|
|
Terminate
|
|
|
|
|
</button>
|
|
|
|
|
</PopoverContent>
|
|
|
|
|
</Popover>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-10 09:08:20 -05:00
|
|
|
{!urlRunId && (
|
|
|
|
|
<Tabs
|
2026-03-10 21:06:15 -05:00
|
|
|
value={activeView}
|
2026-03-10 09:08:20 -05:00
|
|
|
onValueChange={(value) => navigate(`/agents/${canonicalAgentRef}/${value}`)}
|
|
|
|
|
>
|
|
|
|
|
<PageTabBar
|
|
|
|
|
items={[
|
|
|
|
|
{ value: "dashboard", label: "Dashboard" },
|
|
|
|
|
{ value: "configuration", label: "Configuration" },
|
2026-03-17 09:10:40 -05:00
|
|
|
{ value: "skills", label: "Skills" },
|
2026-03-10 21:06:15 -05:00
|
|
|
{ value: "runs", label: "Runs" },
|
2026-03-16 08:12:38 -05:00
|
|
|
{ value: "budget", label: "Budget" },
|
2026-03-10 09:08:20 -05:00
|
|
|
]}
|
2026-03-10 21:06:15 -05:00
|
|
|
value={activeView}
|
2026-03-10 09:08:20 -05:00
|
|
|
onValueChange={(value) => navigate(`/agents/${canonicalAgentRef}/${value}`)}
|
|
|
|
|
/>
|
|
|
|
|
</Tabs>
|
|
|
|
|
)}
|
|
|
|
|
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
{actionError && <p className="text-sm text-destructive">{actionError}</p>}
|
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
|
|
|
{isPendingApproval && (
|
|
|
|
|
<p className="text-sm text-amber-500">
|
|
|
|
|
This agent is pending board approval and cannot be invoked yet.
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-02-20 11:29:13 -06:00
|
|
|
{/* Floating Save/Cancel (desktop) */}
|
2026-03-16 08:15:22 -05:00
|
|
|
{!isMobile && showConfigActionBar && (
|
2026-02-20 11:29:13 -06:00
|
|
|
<div
|
2026-03-16 08:15:22 -05:00
|
|
|
className="sticky top-6 z-10 float-right transition-opacity duration-150"
|
2026-02-20 11:29:13 -06:00
|
|
|
>
|
|
|
|
|
<div className="flex items-center gap-2 bg-background/90 backdrop-blur-sm border border-border rounded-lg px-3 py-1.5 shadow-lg">
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => cancelConfigActionRef.current?.()}
|
|
|
|
|
disabled={configSaving}
|
|
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => saveConfigActionRef.current?.()}
|
|
|
|
|
disabled={configSaving}
|
|
|
|
|
>
|
2026-03-02 16:44:03 -06:00
|
|
|
{configSaving ? "Saving…" : "Save"}
|
2026-02-20 11:29:13 -06:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Mobile bottom Save/Cancel bar */}
|
|
|
|
|
{isMobile && showConfigActionBar && (
|
|
|
|
|
<div className="fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 backdrop-blur-sm">
|
|
|
|
|
<div
|
|
|
|
|
className="flex items-center justify-end gap-2 px-3 py-2"
|
|
|
|
|
style={{ paddingBottom: "max(env(safe-area-inset-bottom), 0.5rem)" }}
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
>
|
2026-02-20 11:29:13 -06:00
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => cancelConfigActionRef.current?.()}
|
|
|
|
|
disabled={configSaving}
|
|
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => saveConfigActionRef.current?.()}
|
|
|
|
|
disabled={configSaving}
|
|
|
|
|
>
|
2026-03-02 16:44:03 -06:00
|
|
|
{configSaving ? "Saving…" : "Save"}
|
2026-02-20 11:29:13 -06:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-02-18 13:02:23 -06:00
|
|
|
</div>
|
2026-02-20 11:29:13 -06:00
|
|
|
)}
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
{/* View content */}
|
2026-03-10 09:08:20 -05:00
|
|
|
{activeView === "dashboard" && (
|
2026-02-23 14:41:21 -06:00
|
|
|
<AgentOverview
|
|
|
|
|
agent={agent}
|
|
|
|
|
runs={heartbeats ?? []}
|
|
|
|
|
assignedIssues={assignedIssues}
|
|
|
|
|
runtimeState={runtimeState}
|
2026-03-02 16:44:03 -06:00
|
|
|
agentId={agent.id}
|
|
|
|
|
agentRouteId={canonicalAgentRef}
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
/>
|
2026-02-23 14:41:21 -06:00
|
|
|
)}
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-03-10 09:08:20 -05:00
|
|
|
{activeView === "configuration" && (
|
2026-02-23 14:41:21 -06:00
|
|
|
<AgentConfigurePage
|
|
|
|
|
agent={agent}
|
2026-03-02 16:44:03 -06:00
|
|
|
agentId={agent.id}
|
|
|
|
|
companyId={resolvedCompanyId ?? undefined}
|
2026-02-23 14:41:21 -06:00
|
|
|
onDirtyChange={setConfigDirty}
|
|
|
|
|
onSaveActionChange={setSaveConfigAction}
|
|
|
|
|
onCancelActionChange={setCancelConfigAction}
|
|
|
|
|
onSavingChange={setConfigSaving}
|
|
|
|
|
updatePermissions={updatePermissions}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-03-17 09:10:40 -05:00
|
|
|
{activeView === "skills" && (
|
|
|
|
|
<SkillsTab
|
|
|
|
|
agent={agent}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
{activeView === "runs" && (
|
|
|
|
|
<RunsTab
|
|
|
|
|
runs={heartbeats ?? []}
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId={resolvedCompanyId!}
|
|
|
|
|
agentId={agent.id}
|
|
|
|
|
agentRouteId={canonicalAgentRef}
|
2026-02-23 14:41:21 -06:00
|
|
|
selectedRunId={urlRunId ?? null}
|
|
|
|
|
adapterType={agent.adapterType}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2026-03-16 08:12:38 -05:00
|
|
|
|
|
|
|
|
{activeView === "budget" && resolvedCompanyId ? (
|
|
|
|
|
<div className="max-w-3xl">
|
|
|
|
|
<BudgetPolicyCard
|
|
|
|
|
summary={agentBudgetSummary}
|
|
|
|
|
isSaving={budgetMutation.isPending}
|
|
|
|
|
onSave={(amount) => budgetMutation.mutate(amount)}
|
|
|
|
|
variant="plain"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
) : 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
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Helper components ---- */
|
|
|
|
|
|
|
|
|
|
function SummaryRow({ label, children }: { label: string; children: React.ReactNode }) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<span className="text-muted-foreground text-xs">{label}</span>
|
|
|
|
|
<div className="flex items-center gap-1">{children}</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-19 14:39:48 -06:00
|
|
|
function LatestRunCard({ runs, agentId }: { runs: HeartbeatRun[]; agentId: string }) {
|
|
|
|
|
if (runs.length === 0) return null;
|
|
|
|
|
|
|
|
|
|
const sorted = [...runs].sort(
|
|
|
|
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const liveRun = sorted.find((r) => r.status === "running" || r.status === "queued");
|
|
|
|
|
const run = liveRun ?? sorted[0];
|
|
|
|
|
const isLive = run.status === "running" || run.status === "queued";
|
|
|
|
|
const statusInfo = runStatusIcons[run.status] ?? { icon: Clock, color: "text-neutral-400" };
|
|
|
|
|
const StatusIcon = statusInfo.icon;
|
|
|
|
|
const summary = run.resultJson
|
|
|
|
|
? String((run.resultJson as Record<string, unknown>).summary ?? (run.resultJson as Record<string, unknown>).result ?? "")
|
|
|
|
|
: run.error ?? "";
|
|
|
|
|
|
2026-02-19 14:02:29 -06:00
|
|
|
return (
|
2026-02-23 15:23:08 -06:00
|
|
|
<div className="space-y-3">
|
2026-03-02 16:44:03 -06:00
|
|
|
<div className="flex w-full items-center justify-between">
|
2026-02-26 16:33:48 -06:00
|
|
|
<h3 className="flex items-center gap-2 text-sm font-medium">
|
2026-02-19 14:39:48 -06:00
|
|
|
{isLive && (
|
|
|
|
|
<span className="relative flex h-2 w-2">
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<span className="animate-pulse absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75" />
|
2026-02-19 14:39:48 -06:00
|
|
|
<span className="relative inline-flex rounded-full h-2 w-2 bg-cyan-400" />
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
2026-02-26 16:33:48 -06:00
|
|
|
{isLive ? "Live Run" : "Latest Run"}
|
|
|
|
|
</h3>
|
2026-02-23 14:41:21 -06:00
|
|
|
<Link
|
|
|
|
|
to={`/agents/${agentId}/runs/${run.id}`}
|
2026-02-26 16:33:48 -06:00
|
|
|
className="shrink-0 text-xs text-muted-foreground hover:text-foreground transition-colors no-underline"
|
2026-02-19 14:02:29 -06:00
|
|
|
>
|
2026-02-19 14:39:48 -06:00
|
|
|
View details →
|
2026-02-23 14:41:21 -06:00
|
|
|
</Link>
|
2026-02-19 14:02:29 -06:00
|
|
|
</div>
|
2026-02-19 14:39:48 -06:00
|
|
|
|
2026-03-02 16:44:03 -06:00
|
|
|
<Link
|
|
|
|
|
to={`/agents/${agentId}/runs/${run.id}`}
|
|
|
|
|
className={cn(
|
|
|
|
|
"block border rounded-lg p-4 space-y-2 w-full no-underline transition-colors hover:bg-muted/50 cursor-pointer",
|
|
|
|
|
isLive ? "border-cyan-500/30 shadow-[0_0_12px_rgba(6,182,212,0.08)]" : "border-border"
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-02-23 15:23:08 -06:00
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<StatusIcon className={cn("h-3.5 w-3.5", statusInfo.color, run.status === "running" && "animate-spin")} />
|
|
|
|
|
<StatusBadge status={run.status} />
|
|
|
|
|
<span className="font-mono text-xs text-muted-foreground">{run.id.slice(0, 8)}</span>
|
|
|
|
|
<span className={cn(
|
|
|
|
|
"inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium",
|
2026-02-26 16:33:48 -06:00
|
|
|
run.invocationSource === "timer" ? "bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300"
|
|
|
|
|
: run.invocationSource === "assignment" ? "bg-violet-100 text-violet-700 dark:bg-violet-900/50 dark:text-violet-300"
|
|
|
|
|
: run.invocationSource === "on_demand" ? "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300"
|
|
|
|
|
: "bg-muted text-muted-foreground"
|
2026-02-23 15:23:08 -06:00
|
|
|
)}>
|
|
|
|
|
{sourceLabels[run.invocationSource] ?? run.invocationSource}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="ml-auto text-xs text-muted-foreground">{relativeTime(run.createdAt)}</span>
|
|
|
|
|
</div>
|
2026-02-19 14:39:48 -06:00
|
|
|
|
2026-02-23 15:23:08 -06:00
|
|
|
{summary && (
|
|
|
|
|
<div className="overflow-hidden max-h-16">
|
|
|
|
|
<MarkdownBody className="[&>*:first-child]:mt-0 [&>*:last-child]:mb-0">{summary}</MarkdownBody>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-02 16:44:03 -06:00
|
|
|
</Link>
|
2026-02-23 14:41:21 -06:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Agent Overview (main single-page view) ---- */
|
|
|
|
|
|
|
|
|
|
function AgentOverview({
|
|
|
|
|
agent,
|
|
|
|
|
runs,
|
|
|
|
|
assignedIssues,
|
|
|
|
|
runtimeState,
|
|
|
|
|
agentId,
|
2026-03-02 16:44:03 -06:00
|
|
|
agentRouteId,
|
2026-02-23 14:41:21 -06:00
|
|
|
}: {
|
|
|
|
|
agent: Agent;
|
|
|
|
|
runs: HeartbeatRun[];
|
|
|
|
|
assignedIssues: { id: string; title: string; status: string; priority: string; identifier?: string | null; createdAt: Date }[];
|
|
|
|
|
runtimeState?: AgentRuntimeState;
|
|
|
|
|
agentId: string;
|
2026-03-02 16:44:03 -06:00
|
|
|
agentRouteId: string;
|
2026-02-23 14:41:21 -06:00
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-8">
|
|
|
|
|
{/* Latest Run */}
|
2026-03-02 16:44:03 -06:00
|
|
|
<LatestRunCard runs={runs} agentId={agentRouteId} />
|
2026-02-23 14:41:21 -06:00
|
|
|
|
|
|
|
|
{/* Charts */}
|
|
|
|
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
|
|
|
|
<ChartCard title="Run Activity" subtitle="Last 14 days">
|
|
|
|
|
<RunActivityChart runs={runs} />
|
|
|
|
|
</ChartCard>
|
|
|
|
|
<ChartCard title="Issues by Priority" subtitle="Last 14 days">
|
|
|
|
|
<PriorityChart issues={assignedIssues} />
|
|
|
|
|
</ChartCard>
|
|
|
|
|
<ChartCard title="Issues by Status" subtitle="Last 14 days">
|
|
|
|
|
<IssueStatusChart issues={assignedIssues} />
|
|
|
|
|
</ChartCard>
|
|
|
|
|
<ChartCard title="Success Rate" subtitle="Last 14 days">
|
|
|
|
|
<SuccessRateChart runs={runs} />
|
|
|
|
|
</ChartCard>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Recent Issues */}
|
|
|
|
|
<div className="space-y-3">
|
2026-02-23 15:13:59 -06:00
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<h3 className="text-sm font-medium">Recent Issues</h3>
|
|
|
|
|
<Link to={`/issues?assignee=${agentId}`} className="text-xs text-muted-foreground hover:text-foreground transition-colors">
|
|
|
|
|
See All →
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
2026-02-23 14:41:21 -06:00
|
|
|
{assignedIssues.length === 0 ? (
|
|
|
|
|
<p className="text-sm text-muted-foreground">No assigned issues.</p>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="border border-border rounded-lg">
|
|
|
|
|
{assignedIssues.slice(0, 10).map((issue) => (
|
|
|
|
|
<EntityRow
|
|
|
|
|
key={issue.id}
|
|
|
|
|
identifier={issue.identifier ?? issue.id.slice(0, 8)}
|
|
|
|
|
title={issue.title}
|
|
|
|
|
to={`/issues/${issue.identifier ?? issue.id}`}
|
|
|
|
|
trailing={<StatusBadge status={issue.status} />}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
{assignedIssues.length > 10 && (
|
|
|
|
|
<div className="px-3 py-2 text-xs text-muted-foreground text-center border-t border-border">
|
|
|
|
|
+{assignedIssues.length - 10} more issues
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Costs */}
|
|
|
|
|
<div className="space-y-3">
|
|
|
|
|
<h3 className="text-sm font-medium">Costs</h3>
|
|
|
|
|
<CostsSection runtimeState={runtimeState} runs={runs} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Costs Section (inline) ---- */
|
|
|
|
|
|
|
|
|
|
function CostsSection({
|
|
|
|
|
runtimeState,
|
|
|
|
|
runs,
|
|
|
|
|
}: {
|
|
|
|
|
runtimeState?: AgentRuntimeState;
|
|
|
|
|
runs: HeartbeatRun[];
|
|
|
|
|
}) {
|
|
|
|
|
const runsWithCost = runs
|
|
|
|
|
.filter((r) => {
|
2026-03-14 22:00:12 -05:00
|
|
|
const metrics = runMetrics(r);
|
|
|
|
|
return metrics.cost > 0 || metrics.input > 0 || metrics.output > 0 || metrics.cached > 0;
|
2026-02-23 14:41:21 -06:00
|
|
|
})
|
|
|
|
|
.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
{runtimeState && (
|
|
|
|
|
<div className="border border-border rounded-lg p-4">
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 tabular-nums">
|
2026-02-23 14:41:21 -06:00
|
|
|
<div>
|
|
|
|
|
<span className="text-xs text-muted-foreground block">Input tokens</span>
|
|
|
|
|
<span className="text-lg font-semibold">{formatTokens(runtimeState.totalInputTokens)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="text-xs text-muted-foreground block">Output tokens</span>
|
|
|
|
|
<span className="text-lg font-semibold">{formatTokens(runtimeState.totalOutputTokens)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="text-xs text-muted-foreground block">Cached tokens</span>
|
|
|
|
|
<span className="text-lg font-semibold">{formatTokens(runtimeState.totalCachedInputTokens)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="text-xs text-muted-foreground block">Total cost</span>
|
|
|
|
|
<span className="text-lg font-semibold">{formatCents(runtimeState.totalCostCents)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{runsWithCost.length > 0 && (
|
|
|
|
|
<div className="border border-border rounded-lg overflow-hidden">
|
|
|
|
|
<table className="w-full text-xs">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr className="border-b border-border bg-accent/20">
|
|
|
|
|
<th className="text-left px-3 py-2 font-medium text-muted-foreground">Date</th>
|
|
|
|
|
<th className="text-left px-3 py-2 font-medium text-muted-foreground">Run</th>
|
|
|
|
|
<th className="text-right px-3 py-2 font-medium text-muted-foreground">Input</th>
|
|
|
|
|
<th className="text-right px-3 py-2 font-medium text-muted-foreground">Output</th>
|
|
|
|
|
<th className="text-right px-3 py-2 font-medium text-muted-foreground">Cost</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{runsWithCost.slice(0, 10).map((run) => {
|
2026-03-14 22:00:12 -05:00
|
|
|
const metrics = runMetrics(run);
|
2026-02-23 14:41:21 -06:00
|
|
|
return (
|
|
|
|
|
<tr key={run.id} className="border-b border-border last:border-b-0">
|
|
|
|
|
<td className="px-3 py-2">{formatDate(run.createdAt)}</td>
|
|
|
|
|
<td className="px-3 py-2 font-mono">{run.id.slice(0, 8)}</td>
|
2026-03-14 22:00:12 -05:00
|
|
|
<td className="px-3 py-2 text-right tabular-nums">{formatTokens(metrics.input)}</td>
|
|
|
|
|
<td className="px-3 py-2 text-right tabular-nums">{formatTokens(metrics.output)}</td>
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<td className="px-3 py-2 text-right tabular-nums">
|
2026-03-14 22:00:12 -05:00
|
|
|
{metrics.cost > 0
|
|
|
|
|
? `$${metrics.cost.toFixed(4)}`
|
2026-02-23 14:41:21 -06:00
|
|
|
: "-"
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2026-02-19 14:02:29 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
/* ---- Agent Configure Page ---- */
|
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-23 14:41:21 -06:00
|
|
|
function AgentConfigurePage({
|
2026-02-18 13:02:23 -06:00
|
|
|
agent,
|
2026-02-23 14:41:21 -06:00
|
|
|
agentId,
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId,
|
2026-02-18 13:02:23 -06:00
|
|
|
onDirtyChange,
|
|
|
|
|
onSaveActionChange,
|
|
|
|
|
onCancelActionChange,
|
|
|
|
|
onSavingChange,
|
2026-02-19 14:39:48 -06:00
|
|
|
updatePermissions,
|
2026-02-18 13:02:23 -06:00
|
|
|
}: {
|
|
|
|
|
agent: Agent;
|
2026-02-23 14:41:21 -06:00
|
|
|
agentId: string;
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId?: string;
|
2026-02-18 13:02:23 -06:00
|
|
|
onDirtyChange: (dirty: boolean) => void;
|
|
|
|
|
onSaveActionChange: (save: (() => void) | null) => void;
|
|
|
|
|
onCancelActionChange: (cancel: (() => void) | null) => void;
|
|
|
|
|
onSavingChange: (saving: boolean) => void;
|
2026-02-19 14:39:48 -06:00
|
|
|
updatePermissions: { mutate: (canCreate: boolean) => void; isPending: boolean };
|
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
|
|
|
const queryClient = useQueryClient();
|
2026-02-23 14:41:21 -06:00
|
|
|
const [revisionsOpen, setRevisionsOpen] = useState(false);
|
2026-02-17 20:07:30 -06:00
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
const { data: configRevisions } = useQuery({
|
|
|
|
|
queryKey: queryKeys.agents.configRevisions(agent.id),
|
2026-03-02 16:44:03 -06:00
|
|
|
queryFn: () => agentsApi.listConfigRevisions(agent.id, companyId),
|
2026-02-17 20:07:30 -06:00
|
|
|
});
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
const rollbackConfig = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: (revisionId: string) => agentsApi.rollbackConfigRevision(agent.id, revisionId, companyId),
|
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
|
|
|
onSuccess: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agent.id) });
|
2026-03-03 10:09:15 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agent.urlKey) });
|
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.agents.configRevisions(agent.id) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
return (
|
|
|
|
|
<div className="max-w-3xl space-y-6">
|
|
|
|
|
<ConfigurationTab
|
|
|
|
|
agent={agent}
|
|
|
|
|
onDirtyChange={onDirtyChange}
|
|
|
|
|
onSaveActionChange={onSaveActionChange}
|
|
|
|
|
onCancelActionChange={onCancelActionChange}
|
|
|
|
|
onSavingChange={onSavingChange}
|
|
|
|
|
updatePermissions={updatePermissions}
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId={companyId}
|
2026-02-23 14:41:21 -06:00
|
|
|
/>
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="text-sm font-medium mb-3">API Keys</h3>
|
2026-03-02 16:44:03 -06:00
|
|
|
<KeysTab agentId={agentId} companyId={companyId} />
|
2026-02-23 14:41:21 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Configuration Revisions — collapsible at the bottom */}
|
|
|
|
|
<div>
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-2 text-sm font-medium hover:text-foreground transition-colors"
|
|
|
|
|
onClick={() => setRevisionsOpen((v) => !v)}
|
|
|
|
|
>
|
|
|
|
|
{revisionsOpen
|
|
|
|
|
? <ChevronDown className="h-3.5 w-3.5 text-muted-foreground" />
|
|
|
|
|
: <ChevronRight className="h-3.5 w-3.5 text-muted-foreground" />
|
|
|
|
|
}
|
|
|
|
|
Configuration Revisions
|
|
|
|
|
<span className="text-xs font-normal text-muted-foreground">{configRevisions?.length ?? 0}</span>
|
|
|
|
|
</button>
|
|
|
|
|
{revisionsOpen && (
|
|
|
|
|
<div className="mt-3">
|
|
|
|
|
{(configRevisions ?? []).length === 0 ? (
|
|
|
|
|
<p className="text-sm text-muted-foreground">No configuration revisions yet.</p>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
{(configRevisions ?? []).slice(0, 10).map((revision) => (
|
|
|
|
|
<div key={revision.id} className="border border-border/70 rounded-md p-3 space-y-2">
|
|
|
|
|
<div className="flex items-center justify-between gap-3">
|
|
|
|
|
<div className="text-xs text-muted-foreground">
|
|
|
|
|
<span className="font-mono">{revision.id.slice(0, 8)}</span>
|
|
|
|
|
<span className="mx-1">·</span>
|
|
|
|
|
<span>{formatDate(revision.createdAt)}</span>
|
|
|
|
|
<span className="mx-1">·</span>
|
|
|
|
|
<span>{revision.source}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="outline"
|
|
|
|
|
className="h-7 px-2.5 text-xs"
|
|
|
|
|
onClick={() => rollbackConfig.mutate(revision.id)}
|
|
|
|
|
disabled={rollbackConfig.isPending}
|
|
|
|
|
>
|
|
|
|
|
Restore
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
|
|
Changed:{" "}
|
|
|
|
|
{revision.changedKeys.length > 0 ? revision.changedKeys.join(", ") : "no tracked changes"}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Configuration Tab ---- */
|
|
|
|
|
|
|
|
|
|
function ConfigurationTab({
|
|
|
|
|
agent,
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId,
|
2026-02-23 14:41:21 -06:00
|
|
|
onDirtyChange,
|
|
|
|
|
onSaveActionChange,
|
|
|
|
|
onCancelActionChange,
|
|
|
|
|
onSavingChange,
|
|
|
|
|
updatePermissions,
|
|
|
|
|
}: {
|
|
|
|
|
agent: Agent;
|
2026-03-02 16:44:03 -06:00
|
|
|
companyId?: string;
|
2026-02-23 14:41:21 -06:00
|
|
|
onDirtyChange: (dirty: boolean) => void;
|
|
|
|
|
onSaveActionChange: (save: (() => void) | null) => void;
|
|
|
|
|
onCancelActionChange: (cancel: (() => void) | null) => void;
|
|
|
|
|
onSavingChange: (saving: boolean) => void;
|
|
|
|
|
updatePermissions: { mutate: (canCreate: boolean) => void; isPending: boolean };
|
|
|
|
|
}) {
|
|
|
|
|
const queryClient = useQueryClient();
|
2026-03-10 20:58:18 -05:00
|
|
|
const [awaitingRefreshAfterSave, setAwaitingRefreshAfterSave] = useState(false);
|
|
|
|
|
const lastAgentRef = useRef(agent);
|
2026-02-23 14:41:21 -06:00
|
|
|
|
|
|
|
|
const { data: adapterModels } = useQuery({
|
2026-03-05 15:24:20 +01:00
|
|
|
queryKey:
|
|
|
|
|
companyId
|
|
|
|
|
? queryKeys.agents.adapterModels(companyId, agent.adapterType)
|
|
|
|
|
: ["agents", "none", "adapter-models", agent.adapterType],
|
|
|
|
|
queryFn: () => agentsApi.adapterModels(companyId!, agent.adapterType),
|
|
|
|
|
enabled: Boolean(companyId),
|
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
|
|
|
});
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
const updateAgent = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: (data: Record<string, unknown>) => agentsApi.update(agent.id, data, companyId),
|
2026-03-10 20:58:18 -05:00
|
|
|
onMutate: () => {
|
|
|
|
|
setAwaitingRefreshAfterSave(true);
|
|
|
|
|
},
|
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
|
|
|
onSuccess: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agent.id) });
|
2026-03-03 10:09:15 -06:00
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.detail(agent.urlKey) });
|
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.agents.configRevisions(agent.id) });
|
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-10 20:58:18 -05:00
|
|
|
onError: () => {
|
|
|
|
|
setAwaitingRefreshAfterSave(false);
|
|
|
|
|
},
|
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-18 13:02:23 -06:00
|
|
|
useEffect(() => {
|
2026-03-10 20:58:18 -05:00
|
|
|
if (awaitingRefreshAfterSave && agent !== lastAgentRef.current) {
|
|
|
|
|
setAwaitingRefreshAfterSave(false);
|
|
|
|
|
}
|
|
|
|
|
lastAgentRef.current = agent;
|
|
|
|
|
}, [agent, awaitingRefreshAfterSave]);
|
|
|
|
|
|
|
|
|
|
const isConfigSaving = updateAgent.isPending || awaitingRefreshAfterSave;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
onSavingChange(isConfigSaving);
|
|
|
|
|
}, [onSavingChange, isConfigSaving]);
|
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
|
|
|
return (
|
2026-02-23 14:41:21 -06:00
|
|
|
<div className="space-y-6">
|
|
|
|
|
<AgentConfigForm
|
|
|
|
|
mode="edit"
|
|
|
|
|
agent={agent}
|
|
|
|
|
onSave={(patch) => updateAgent.mutate(patch)}
|
2026-03-10 20:58:18 -05:00
|
|
|
isSaving={isConfigSaving}
|
2026-02-23 14:41:21 -06:00
|
|
|
adapterModels={adapterModels}
|
|
|
|
|
onDirtyChange={onDirtyChange}
|
|
|
|
|
onSaveActionChange={onSaveActionChange}
|
|
|
|
|
onCancelActionChange={onCancelActionChange}
|
|
|
|
|
hideInlineSave
|
|
|
|
|
sectionLayout="cards"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="text-sm font-medium mb-3">Permissions</h3>
|
|
|
|
|
<div className="border border-border rounded-lg p-4">
|
|
|
|
|
<div className="flex items-center justify-between text-sm">
|
|
|
|
|
<span>Can create new agents</span>
|
|
|
|
|
<Button
|
|
|
|
|
variant={agent.permissions?.canCreateAgents ? "default" : "outline"}
|
|
|
|
|
size="sm"
|
|
|
|
|
className="h-7 px-2.5 text-xs"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updatePermissions.mutate(!Boolean(agent.permissions?.canCreateAgents))
|
|
|
|
|
}
|
|
|
|
|
disabled={updatePermissions.isPending}
|
|
|
|
|
>
|
|
|
|
|
{agent.permissions?.canCreateAgents ? "Enabled" : "Disabled"}
|
|
|
|
|
</Button>
|
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
|
|
|
</div>
|
2026-02-23 14:41:21 -06:00
|
|
|
</div>
|
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
|
|
|
</div>
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 09:21:44 -05:00
|
|
|
function SkillsTab({ agent }: { agent: Agent }) {
|
2026-03-17 09:10:40 -05:00
|
|
|
const instructionsPath =
|
|
|
|
|
typeof agent.adapterConfig?.instructionsFilePath === "string" && agent.adapterConfig.instructionsFilePath.trim().length > 0
|
|
|
|
|
? agent.adapterConfig.instructionsFilePath
|
|
|
|
|
: null;
|
2026-03-17 09:21:44 -05:00
|
|
|
const { data, isLoading, error } = useQuery({
|
|
|
|
|
queryKey: queryKeys.skills.available,
|
|
|
|
|
queryFn: () => agentsApi.availableSkills(),
|
|
|
|
|
});
|
|
|
|
|
const skills = data?.skills ?? [];
|
2026-03-17 09:10:40 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div className="border border-border rounded-lg p-4 space-y-2">
|
|
|
|
|
<h3 className="text-sm font-medium">Skills</h3>
|
|
|
|
|
<p className="text-sm text-muted-foreground">
|
|
|
|
|
Skills are reusable instruction bundles the agent can invoke from its local tool environment.
|
2026-03-17 09:21:44 -05:00
|
|
|
This view shows the current instructions file and the skills currently visible to the local agent runtime.
|
2026-03-17 09:10:40 -05:00
|
|
|
</p>
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
|
|
Agent: <span className="font-mono">{agent.name}</span>
|
|
|
|
|
</p>
|
|
|
|
|
<div className="rounded-md border border-border bg-muted/30 px-3 py-2 text-sm">
|
|
|
|
|
<div className="text-xs uppercase tracking-wide text-muted-foreground mb-1">
|
|
|
|
|
Instructions file
|
|
|
|
|
</div>
|
|
|
|
|
<div className="font-mono break-all">
|
|
|
|
|
{instructionsPath ?? "No instructions file configured for this agent."}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-17 09:21:44 -05:00
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<div className="text-xs uppercase tracking-wide text-muted-foreground">
|
|
|
|
|
Available skills
|
|
|
|
|
</div>
|
|
|
|
|
{isLoading ? (
|
|
|
|
|
<p className="text-sm text-muted-foreground">Loading available skills…</p>
|
|
|
|
|
) : error ? (
|
|
|
|
|
<p className="text-sm text-destructive">
|
|
|
|
|
{error instanceof Error ? error.message : "Failed to load available skills."}
|
|
|
|
|
</p>
|
|
|
|
|
) : skills.length === 0 ? (
|
|
|
|
|
<p className="text-sm text-muted-foreground">No local skills were found.</p>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
{skills.map((skill) => (
|
|
|
|
|
<SkillRow key={skill.name} skill={skill} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SkillRow({ skill }: { skill: AvailableSkill }) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="rounded-md border border-border bg-muted/20 px-3 py-2 space-y-1.5">
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<span className="font-mono text-sm">{skill.name}</span>
|
|
|
|
|
<Badge variant={skill.isPaperclipManaged ? "secondary" : "outline"}>
|
|
|
|
|
{skill.isPaperclipManaged ? "Paperclip" : "Local"}
|
|
|
|
|
</Badge>
|
2026-03-17 09:10:40 -05:00
|
|
|
</div>
|
2026-03-17 09:21:44 -05:00
|
|
|
<p className="text-sm text-muted-foreground">
|
|
|
|
|
{skill.description || "No description available."}
|
|
|
|
|
</p>
|
2026-03-17 09:10:40 -05:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/* ---- Runs Tab ---- */
|
|
|
|
|
|
2026-02-20 10:33:18 -06:00
|
|
|
function RunListItem({ run, isSelected, agentId }: { run: HeartbeatRun; isSelected: boolean; agentId: string }) {
|
|
|
|
|
const statusInfo = runStatusIcons[run.status] ?? { icon: Clock, color: "text-neutral-400" };
|
|
|
|
|
const StatusIcon = statusInfo.icon;
|
|
|
|
|
const metrics = runMetrics(run);
|
|
|
|
|
const summary = run.resultJson
|
|
|
|
|
? String((run.resultJson as Record<string, unknown>).summary ?? (run.resultJson as Record<string, unknown>).result ?? "")
|
|
|
|
|
: run.error ?? "";
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-23 14:50:20 -06:00
|
|
|
<Link
|
|
|
|
|
to={isSelected ? `/agents/${agentId}/runs` : `/agents/${agentId}/runs/${run.id}`}
|
2026-02-20 10:33:18 -06:00
|
|
|
className={cn(
|
2026-02-23 14:50:20 -06:00
|
|
|
"flex flex-col gap-1 w-full px-3 py-2.5 text-left border-b border-border last:border-b-0 transition-colors no-underline text-inherit",
|
2026-02-20 10:33:18 -06:00
|
|
|
isSelected ? "bg-accent/40" : "hover:bg-accent/20",
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<StatusIcon className={cn("h-3.5 w-3.5 shrink-0", statusInfo.color, run.status === "running" && "animate-spin")} />
|
|
|
|
|
<span className="font-mono text-xs text-muted-foreground">
|
|
|
|
|
{run.id.slice(0, 8)}
|
|
|
|
|
</span>
|
|
|
|
|
<span className={cn(
|
|
|
|
|
"inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium shrink-0",
|
2026-02-26 16:33:48 -06:00
|
|
|
run.invocationSource === "timer" ? "bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300"
|
|
|
|
|
: run.invocationSource === "assignment" ? "bg-violet-100 text-violet-700 dark:bg-violet-900/50 dark:text-violet-300"
|
|
|
|
|
: run.invocationSource === "on_demand" ? "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300"
|
|
|
|
|
: "bg-muted text-muted-foreground"
|
2026-02-20 10:33:18 -06:00
|
|
|
)}>
|
|
|
|
|
{sourceLabels[run.invocationSource] ?? run.invocationSource}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="ml-auto text-[11px] text-muted-foreground shrink-0">
|
|
|
|
|
{relativeTime(run.createdAt)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
{summary && (
|
|
|
|
|
<span className="text-xs text-muted-foreground truncate pl-5.5">
|
|
|
|
|
{summary.slice(0, 60)}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
{(metrics.totalTokens > 0 || metrics.cost > 0) && (
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<div className="flex items-center gap-2 pl-5.5 text-[11px] text-muted-foreground tabular-nums">
|
2026-02-20 10:33:18 -06:00
|
|
|
{metrics.totalTokens > 0 && <span>{formatTokens(metrics.totalTokens)} tok</span>}
|
|
|
|
|
{metrics.cost > 0 && <span>${metrics.cost.toFixed(3)}</span>}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-23 14:50:20 -06:00
|
|
|
</Link>
|
2026-02-20 10:33:18 -06:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 16:44:03 -06:00
|
|
|
function RunsTab({
|
|
|
|
|
runs,
|
|
|
|
|
companyId,
|
|
|
|
|
agentId,
|
|
|
|
|
agentRouteId,
|
|
|
|
|
selectedRunId,
|
|
|
|
|
adapterType,
|
|
|
|
|
}: {
|
|
|
|
|
runs: HeartbeatRun[];
|
|
|
|
|
companyId: string;
|
|
|
|
|
agentId: string;
|
|
|
|
|
agentRouteId: string;
|
|
|
|
|
selectedRunId: string | null;
|
|
|
|
|
adapterType: string;
|
|
|
|
|
}) {
|
2026-02-20 10:33:18 -06:00
|
|
|
const { isMobile } = useSidebar();
|
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
|
|
|
|
|
|
|
|
if (runs.length === 0) {
|
|
|
|
|
return <p className="text-sm text-muted-foreground">No runs yet.</p>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sort by created descending
|
|
|
|
|
const sorted = [...runs].sort(
|
|
|
|
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
|
|
|
);
|
|
|
|
|
|
2026-02-20 10:33:18 -06:00
|
|
|
// On mobile, don't auto-select so the list shows first; on desktop, auto-select latest
|
|
|
|
|
const effectiveRunId = isMobile ? selectedRunId : (selectedRunId ?? sorted[0]?.id ?? null);
|
2026-02-18 13:02:23 -06:00
|
|
|
const selectedRun = sorted.find((r) => r.id === effectiveRunId) ?? null;
|
|
|
|
|
|
2026-02-20 10:33:18 -06:00
|
|
|
// Mobile: show either run list OR run detail with back button
|
|
|
|
|
if (isMobile) {
|
|
|
|
|
if (selectedRun) {
|
|
|
|
|
return (
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="space-y-3 min-w-0 overflow-x-hidden">
|
2026-02-23 14:50:20 -06:00
|
|
|
<Link
|
2026-03-02 16:44:03 -06:00
|
|
|
to={`/agents/${agentRouteId}/runs`}
|
2026-02-23 14:50:20 -06:00
|
|
|
className="flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors no-underline"
|
2026-02-20 10:33:18 -06:00
|
|
|
>
|
|
|
|
|
<ArrowLeft className="h-3.5 w-3.5" />
|
|
|
|
|
Back to runs
|
2026-02-23 14:50:20 -06:00
|
|
|
</Link>
|
2026-03-02 16:44:03 -06:00
|
|
|
<RunDetail key={selectedRun.id} run={selectedRun} agentRouteId={agentRouteId} adapterType={adapterType} />
|
2026-02-20 10:33:18 -06:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return (
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="border border-border rounded-lg overflow-x-hidden">
|
2026-02-20 10:33:18 -06:00
|
|
|
{sorted.map((run) => (
|
2026-03-02 16:44:03 -06:00
|
|
|
<RunListItem key={run.id} run={run} isSelected={false} agentId={agentRouteId} />
|
2026-02-20 10:33:18 -06:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Desktop: side-by-side layout
|
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 (
|
2026-02-18 13:17:03 -06:00
|
|
|
<div className="flex gap-0">
|
2026-02-18 16:46:55 -06:00
|
|
|
{/* Left: run list — border stretches full height, content sticks */}
|
2026-02-18 13:02:23 -06:00
|
|
|
<div className={cn(
|
2026-02-18 16:46:55 -06:00
|
|
|
"shrink-0 border border-border rounded-lg",
|
2026-02-18 13:02:23 -06:00
|
|
|
selectedRun ? "w-72" : "w-full",
|
2026-02-18 16:46:55 -06:00
|
|
|
)}>
|
|
|
|
|
<div className="sticky top-4 overflow-y-auto" style={{ maxHeight: "calc(100vh - 2rem)" }}>
|
2026-02-20 10:33:18 -06:00
|
|
|
{sorted.map((run) => (
|
2026-03-02 16:44:03 -06:00
|
|
|
<RunListItem key={run.id} run={run} isSelected={run.id === effectiveRunId} agentId={agentRouteId} />
|
2026-02-20 10:33:18 -06:00
|
|
|
))}
|
2026-02-18 16:46:55 -06:00
|
|
|
</div>
|
2026-02-18 13:02:23 -06:00
|
|
|
</div>
|
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-18 13:17:03 -06:00
|
|
|
{/* Right: run detail — natural height, page scrolls */}
|
2026-02-18 13:02:23 -06:00
|
|
|
{selectedRun && (
|
2026-02-18 13:17:03 -06:00
|
|
|
<div className="flex-1 min-w-0 pl-4">
|
2026-03-02 16:44:03 -06:00
|
|
|
<RunDetail key={selectedRun.id} run={selectedRun} agentRouteId={agentRouteId} adapterType={adapterType} />
|
2026-02-18 13:02:23 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Run Detail (expanded) ---- */
|
|
|
|
|
|
2026-03-10 21:16:33 -05:00
|
|
|
function RunDetail({ run: initialRun, agentRouteId, adapterType }: { run: HeartbeatRun; agentRouteId: string; adapterType: string }) {
|
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 queryClient = useQueryClient();
|
2026-02-26 10:32:51 -06:00
|
|
|
const navigate = useNavigate();
|
2026-03-10 21:16:33 -05:00
|
|
|
const { data: hydratedRun } = useQuery({
|
|
|
|
|
queryKey: queryKeys.runDetail(initialRun.id),
|
|
|
|
|
queryFn: () => heartbeatsApi.get(initialRun.id),
|
|
|
|
|
enabled: Boolean(initialRun.id),
|
|
|
|
|
});
|
|
|
|
|
const run = hydratedRun ?? initialRun;
|
2026-02-18 13:02:23 -06:00
|
|
|
const metrics = runMetrics(run);
|
2026-02-18 15:29:29 -06:00
|
|
|
const [sessionOpen, setSessionOpen] = useState(false);
|
2026-02-23 12:25:13 -06:00
|
|
|
const [claudeLoginResult, setClaudeLoginResult] = useState<ClaudeLoginResult | null>(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setClaudeLoginResult(null);
|
|
|
|
|
}, [run.id]);
|
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 cancelRun = useMutation({
|
|
|
|
|
mutationFn: () => heartbeatsApi.cancel(run.id),
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(run.companyId, run.agentId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-02-26 10:32:51 -06:00
|
|
|
const canResumeLostRun = run.errorCode === "process_lost" && run.status === "failed";
|
|
|
|
|
const resumePayload = useMemo(() => {
|
|
|
|
|
const payload: Record<string, unknown> = {
|
|
|
|
|
resumeFromRunId: run.id,
|
|
|
|
|
};
|
|
|
|
|
const context = asRecord(run.contextSnapshot);
|
|
|
|
|
if (!context) return payload;
|
|
|
|
|
const issueId = asNonEmptyString(context.issueId);
|
|
|
|
|
const taskId = asNonEmptyString(context.taskId);
|
|
|
|
|
const taskKey = asNonEmptyString(context.taskKey);
|
|
|
|
|
const commentId = asNonEmptyString(context.wakeCommentId) ?? asNonEmptyString(context.commentId);
|
|
|
|
|
if (issueId) payload.issueId = issueId;
|
|
|
|
|
if (taskId) payload.taskId = taskId;
|
|
|
|
|
if (taskKey) payload.taskKey = taskKey;
|
|
|
|
|
if (commentId) payload.commentId = commentId;
|
|
|
|
|
return payload;
|
|
|
|
|
}, [run.contextSnapshot, run.id]);
|
|
|
|
|
const resumeRun = useMutation({
|
|
|
|
|
mutationFn: async () => {
|
|
|
|
|
const result = await agentsApi.wakeup(run.agentId, {
|
|
|
|
|
source: "on_demand",
|
|
|
|
|
triggerDetail: "manual",
|
|
|
|
|
reason: "resume_process_lost_run",
|
|
|
|
|
payload: resumePayload,
|
2026-03-02 16:44:03 -06:00
|
|
|
}, run.companyId);
|
2026-02-26 10:32:51 -06:00
|
|
|
if (!("id" in result)) {
|
|
|
|
|
throw new Error("Resume request was skipped because the agent is not currently invokable.");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (resumedRun) => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(run.companyId, run.agentId) });
|
2026-03-02 16:44:03 -06:00
|
|
|
navigate(`/agents/${agentRouteId}/runs/${resumedRun.id}`);
|
2026-02-26 10:32:51 -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
|
|
|
|
2026-03-05 07:50:54 -06:00
|
|
|
const canRetryRun = run.status === "failed" || run.status === "timed_out";
|
|
|
|
|
const retryPayload = useMemo(() => {
|
|
|
|
|
const payload: Record<string, unknown> = {};
|
|
|
|
|
const context = asRecord(run.contextSnapshot);
|
|
|
|
|
if (!context) return payload;
|
|
|
|
|
const issueId = asNonEmptyString(context.issueId);
|
|
|
|
|
const taskId = asNonEmptyString(context.taskId);
|
|
|
|
|
const taskKey = asNonEmptyString(context.taskKey);
|
|
|
|
|
if (issueId) payload.issueId = issueId;
|
|
|
|
|
if (taskId) payload.taskId = taskId;
|
|
|
|
|
if (taskKey) payload.taskKey = taskKey;
|
|
|
|
|
return payload;
|
|
|
|
|
}, [run.contextSnapshot]);
|
|
|
|
|
const retryRun = useMutation({
|
|
|
|
|
mutationFn: async () => {
|
|
|
|
|
const result = await agentsApi.wakeup(run.agentId, {
|
|
|
|
|
source: "on_demand",
|
|
|
|
|
triggerDetail: "manual",
|
|
|
|
|
reason: "retry_failed_run",
|
|
|
|
|
payload: retryPayload,
|
|
|
|
|
}, run.companyId);
|
|
|
|
|
if (!("id" in result)) {
|
|
|
|
|
throw new Error("Retry was skipped because the agent is not currently invokable.");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (newRun) => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(run.companyId, run.agentId) });
|
|
|
|
|
navigate(`/agents/${agentRouteId}/runs/${newRun.id}`);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
const { data: touchedIssues } = useQuery({
|
|
|
|
|
queryKey: queryKeys.runIssues(run.id),
|
|
|
|
|
queryFn: () => activityApi.issuesForRun(run.id),
|
|
|
|
|
});
|
2026-02-20 10:32:32 -06:00
|
|
|
const touchedIssueIds = useMemo(
|
|
|
|
|
() => Array.from(new Set((touchedIssues ?? []).map((issue) => issue.issueId))),
|
|
|
|
|
[touchedIssues],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const clearSessionsForTouchedIssues = useMutation({
|
|
|
|
|
mutationFn: async () => {
|
|
|
|
|
if (touchedIssueIds.length === 0) return 0;
|
2026-03-02 16:44:03 -06:00
|
|
|
await Promise.all(touchedIssueIds.map((issueId) => agentsApi.resetSession(run.agentId, issueId, run.companyId)));
|
2026-02-20 10:32:32 -06:00
|
|
|
return touchedIssueIds.length;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.runtimeState(run.agentId) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.taskSessions(run.agentId) });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.runIssues(run.id) });
|
|
|
|
|
},
|
|
|
|
|
});
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
|
2026-02-23 12:25:13 -06:00
|
|
|
const runClaudeLogin = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: () => agentsApi.loginWithClaude(run.agentId, run.companyId),
|
2026-02-23 12:25:13 -06:00
|
|
|
onSuccess: (data) => {
|
|
|
|
|
setClaudeLoginResult(data);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-23 20:20:38 -06:00
|
|
|
const isRunning = run.status === "running" && !!run.startedAt && !run.finishedAt;
|
|
|
|
|
const [elapsedSec, setElapsedSec] = useState<number>(() => {
|
|
|
|
|
if (!run.startedAt) return 0;
|
|
|
|
|
return Math.max(0, Math.round((Date.now() - new Date(run.startedAt).getTime()) / 1000));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isRunning || !run.startedAt) return;
|
|
|
|
|
const startMs = new Date(run.startedAt).getTime();
|
|
|
|
|
setElapsedSec(Math.max(0, Math.round((Date.now() - startMs) / 1000)));
|
|
|
|
|
const id = setInterval(() => {
|
|
|
|
|
setElapsedSec(Math.max(0, Math.round((Date.now() - startMs) / 1000)));
|
|
|
|
|
}, 1000);
|
|
|
|
|
return () => clearInterval(id);
|
|
|
|
|
}, [isRunning, run.startedAt]);
|
|
|
|
|
|
2026-02-18 15:29:29 -06:00
|
|
|
const timeFormat: Intl.DateTimeFormatOptions = { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false };
|
|
|
|
|
const startTime = run.startedAt ? new Date(run.startedAt).toLocaleTimeString("en-US", timeFormat) : null;
|
|
|
|
|
const endTime = run.finishedAt ? new Date(run.finishedAt).toLocaleTimeString("en-US", timeFormat) : null;
|
|
|
|
|
const durationSec = run.startedAt && run.finishedAt
|
|
|
|
|
? Math.round((new Date(run.finishedAt).getTime() - new Date(run.startedAt).getTime()) / 1000)
|
|
|
|
|
: null;
|
2026-02-23 20:20:38 -06:00
|
|
|
const displayDurationSec = durationSec ?? (isRunning ? elapsedSec : null);
|
2026-02-18 15:29:29 -06:00
|
|
|
const hasMetrics = metrics.input > 0 || metrics.output > 0 || metrics.cached > 0 || metrics.cost > 0;
|
|
|
|
|
const hasSession = !!(run.sessionIdBefore || run.sessionIdAfter);
|
|
|
|
|
const sessionChanged = run.sessionIdBefore && run.sessionIdAfter && run.sessionIdBefore !== run.sessionIdAfter;
|
|
|
|
|
const sessionId = run.sessionIdAfter || run.sessionIdBefore;
|
|
|
|
|
const hasNonZeroExit = run.exitCode !== null && run.exitCode !== 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
|
|
|
|
2026-02-18 15:29:29 -06:00
|
|
|
return (
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="space-y-4 min-w-0">
|
2026-02-18 15:29:29 -06:00
|
|
|
{/* Run summary card */}
|
|
|
|
|
<div className="border border-border rounded-lg overflow-hidden">
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="flex flex-col sm:flex-row">
|
2026-02-18 15:29:29 -06:00
|
|
|
{/* Left column: status + timing */}
|
|
|
|
|
<div className="flex-1 p-4 space-y-3">
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<StatusBadge status={run.status} />
|
|
|
|
|
{(run.status === "running" || run.status === "queued") && (
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="text-destructive hover:text-destructive text-xs h-6 px-2"
|
|
|
|
|
onClick={() => cancelRun.mutate()}
|
|
|
|
|
disabled={cancelRun.isPending}
|
|
|
|
|
>
|
2026-03-02 16:44:03 -06:00
|
|
|
{cancelRun.isPending ? "Cancelling…" : "Cancel"}
|
2026-02-18 15:29:29 -06:00
|
|
|
</Button>
|
|
|
|
|
)}
|
2026-02-26 10:32:51 -06:00
|
|
|
{canResumeLostRun && (
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="text-xs h-6 px-2"
|
|
|
|
|
onClick={() => resumeRun.mutate()}
|
|
|
|
|
disabled={resumeRun.isPending}
|
|
|
|
|
>
|
|
|
|
|
<RotateCcw className="h-3.5 w-3.5 mr-1" />
|
2026-03-02 16:44:03 -06:00
|
|
|
{resumeRun.isPending ? "Resuming…" : "Resume"}
|
2026-02-26 10:32:51 -06:00
|
|
|
</Button>
|
|
|
|
|
)}
|
2026-03-05 07:50:54 -06:00
|
|
|
{canRetryRun && !canResumeLostRun && (
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="text-xs h-6 px-2"
|
|
|
|
|
onClick={() => retryRun.mutate()}
|
|
|
|
|
disabled={retryRun.isPending}
|
|
|
|
|
>
|
|
|
|
|
<RotateCcw className="h-3.5 w-3.5 mr-1" />
|
|
|
|
|
{retryRun.isPending ? "Retrying…" : "Retry"}
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
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>
|
2026-02-26 10:32:51 -06:00
|
|
|
{resumeRun.isError && (
|
|
|
|
|
<div className="text-xs text-destructive">
|
|
|
|
|
{resumeRun.error instanceof Error ? resumeRun.error.message : "Failed to resume run"}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-05 07:50:54 -06:00
|
|
|
{retryRun.isError && (
|
|
|
|
|
<div className="text-xs text-destructive">
|
|
|
|
|
{retryRun.error instanceof Error ? retryRun.error.message : "Failed to retry run"}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-18 15:29:29 -06:00
|
|
|
{startTime && (
|
|
|
|
|
<div className="space-y-0.5">
|
|
|
|
|
<div className="text-sm font-mono">
|
|
|
|
|
{startTime}
|
|
|
|
|
{endTime && <span className="text-muted-foreground"> → </span>}
|
|
|
|
|
{endTime}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="text-[11px] text-muted-foreground">
|
|
|
|
|
{relativeTime(run.startedAt!)}
|
|
|
|
|
{run.finishedAt && <> → {relativeTime(run.finishedAt)}</>}
|
|
|
|
|
</div>
|
2026-02-23 20:20:38 -06:00
|
|
|
{displayDurationSec !== null && (
|
2026-02-18 15:29:29 -06:00
|
|
|
<div className="text-xs text-muted-foreground">
|
2026-02-23 20:20:38 -06:00
|
|
|
Duration: {displayDurationSec >= 60 ? `${Math.floor(displayDurationSec / 60)}m ${displayDurationSec % 60}s` : `${displayDurationSec}s`}
|
2026-02-18 15:29:29 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{run.error && (
|
|
|
|
|
<div className="text-xs">
|
2026-02-26 16:33:48 -06:00
|
|
|
<span className="text-red-600 dark:text-red-400">{run.error}</span>
|
2026-02-18 15:29:29 -06:00
|
|
|
{run.errorCode && <span className="text-muted-foreground ml-1">({run.errorCode})</span>}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-23 12:25:13 -06:00
|
|
|
{run.errorCode === "claude_auth_required" && adapterType === "claude_local" && (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="h-7 px-2 text-xs"
|
|
|
|
|
onClick={() => runClaudeLogin.mutate()}
|
|
|
|
|
disabled={runClaudeLogin.isPending}
|
|
|
|
|
>
|
|
|
|
|
{runClaudeLogin.isPending ? "Running claude login..." : "Login to Claude Code"}
|
|
|
|
|
</Button>
|
|
|
|
|
{runClaudeLogin.isError && (
|
|
|
|
|
<p className="text-xs text-destructive">
|
|
|
|
|
{runClaudeLogin.error instanceof Error
|
|
|
|
|
? runClaudeLogin.error.message
|
|
|
|
|
: "Failed to run Claude login"}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
{claudeLoginResult?.loginUrl && (
|
|
|
|
|
<p className="text-xs">
|
|
|
|
|
Login URL:
|
|
|
|
|
<a
|
|
|
|
|
href={claudeLoginResult.loginUrl}
|
2026-02-26 16:33:48 -06:00
|
|
|
className="text-blue-600 underline underline-offset-2 ml-1 break-all dark:text-blue-400"
|
2026-02-23 12:25:13 -06:00
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
>
|
|
|
|
|
{claudeLoginResult.loginUrl}
|
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
{claudeLoginResult && (
|
|
|
|
|
<>
|
|
|
|
|
{!!claudeLoginResult.stdout && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-3 text-xs font-mono text-foreground overflow-x-auto whitespace-pre-wrap">
|
2026-02-23 12:25:13 -06:00
|
|
|
{claudeLoginResult.stdout}
|
|
|
|
|
</pre>
|
|
|
|
|
)}
|
|
|
|
|
{!!claudeLoginResult.stderr && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-3 text-xs font-mono text-red-700 dark:text-red-300 overflow-x-auto whitespace-pre-wrap">
|
2026-02-23 12:25:13 -06:00
|
|
|
{claudeLoginResult.stderr}
|
|
|
|
|
</pre>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-18 15:29:29 -06:00
|
|
|
{hasNonZeroExit && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="text-xs text-red-600 dark:text-red-400">
|
2026-02-18 15:29:29 -06:00
|
|
|
Exit code {run.exitCode}
|
|
|
|
|
{run.signal && <span className="text-muted-foreground ml-1">(signal: {run.signal})</span>}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
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-18 15:29:29 -06:00
|
|
|
{/* Right column: metrics */}
|
|
|
|
|
{hasMetrics && (
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<div className="border-t sm:border-t-0 sm:border-l border-border p-4 grid grid-cols-2 gap-x-4 sm:gap-x-8 gap-y-3 content-center tabular-nums">
|
2026-02-18 15:29:29 -06:00
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground">Input</div>
|
|
|
|
|
<div className="text-sm font-medium font-mono">{formatTokens(metrics.input)}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground">Output</div>
|
|
|
|
|
<div className="text-sm font-medium font-mono">{formatTokens(metrics.output)}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground">Cached</div>
|
|
|
|
|
<div className="text-sm font-medium font-mono">{formatTokens(metrics.cached)}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground">Cost</div>
|
|
|
|
|
<div className="text-sm font-medium font-mono">{metrics.cost > 0 ? `$${metrics.cost.toFixed(4)}` : "-"}</div>
|
|
|
|
|
</div>
|
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>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-18 15:29:29 -06:00
|
|
|
{/* Collapsible session row */}
|
|
|
|
|
{hasSession && (
|
|
|
|
|
<div className="border-t border-border">
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-1.5 w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
|
|
|
|
onClick={() => setSessionOpen((v) => !v)}
|
|
|
|
|
>
|
|
|
|
|
<ChevronRight className={cn("h-3 w-3 transition-transform", sessionOpen && "rotate-90")} />
|
|
|
|
|
Session
|
|
|
|
|
{sessionChanged && <span className="text-yellow-400 ml-1">(changed)</span>}
|
|
|
|
|
</button>
|
|
|
|
|
{sessionOpen && (
|
|
|
|
|
<div className="px-4 pb-3 space-y-1 text-xs">
|
|
|
|
|
{run.sessionIdBefore && (
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<span className="text-muted-foreground w-12">{sessionChanged ? "Before" : "ID"}</span>
|
|
|
|
|
<CopyText text={run.sessionIdBefore} className="font-mono" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{sessionChanged && run.sessionIdAfter && (
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<span className="text-muted-foreground w-12">After</span>
|
|
|
|
|
<CopyText text={run.sessionIdAfter} className="font-mono" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-20 10:32:32 -06:00
|
|
|
{touchedIssueIds.length > 0 && (
|
|
|
|
|
<div className="pt-1">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className="text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-60"
|
|
|
|
|
disabled={clearSessionsForTouchedIssues.isPending}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
const issueCount = touchedIssueIds.length;
|
|
|
|
|
const confirmed = window.confirm(
|
|
|
|
|
`Clear session for ${issueCount} issue${issueCount === 1 ? "" : "s"} touched by this run?`,
|
|
|
|
|
);
|
|
|
|
|
if (!confirmed) return;
|
|
|
|
|
clearSessionsForTouchedIssues.mutate();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{clearSessionsForTouchedIssues.isPending
|
|
|
|
|
? "clearing session..."
|
|
|
|
|
: "clear session for these issues"}
|
|
|
|
|
</button>
|
|
|
|
|
{clearSessionsForTouchedIssues.isError && (
|
|
|
|
|
<p className="text-[11px] text-destructive mt-1">
|
|
|
|
|
{clearSessionsForTouchedIssues.error instanceof Error
|
|
|
|
|
? clearSessionsForTouchedIssues.error.message
|
|
|
|
|
: "Failed to clear sessions"}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-18 15:29:29 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
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
|
|
|
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
{/* Issues touched by this run */}
|
|
|
|
|
{touchedIssues && touchedIssues.length > 0 && (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<span className="text-xs font-medium text-muted-foreground">Issues Touched ({touchedIssues.length})</span>
|
|
|
|
|
<div className="border border-border rounded-lg divide-y divide-border">
|
|
|
|
|
{touchedIssues.map((issue) => (
|
2026-02-23 14:50:20 -06:00
|
|
|
<Link
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
key={issue.issueId}
|
2026-02-23 14:50:20 -06:00
|
|
|
to={`/issues/${issue.identifier ?? issue.issueId}`}
|
|
|
|
|
className="flex items-center justify-between w-full px-3 py-2 text-xs hover:bg-accent/20 transition-colors text-left no-underline text-inherit"
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
>
|
|
|
|
|
<div className="flex items-center gap-2 min-w-0">
|
|
|
|
|
<StatusBadge status={issue.status} />
|
|
|
|
|
<span className="truncate">{issue.title}</span>
|
|
|
|
|
</div>
|
2026-02-20 16:04:05 -06:00
|
|
|
<span className="font-mono text-muted-foreground shrink-0 ml-2">{issue.identifier ?? issue.issueId.slice(0, 8)}</span>
|
2026-02-23 14:50:20 -06:00
|
|
|
</Link>
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-02-18 13:02:23 -06:00
|
|
|
{/* stderr excerpt for failed runs */}
|
|
|
|
|
{run.stderrExcerpt && (
|
|
|
|
|
<div className="space-y-1">
|
2026-02-26 16:33:48 -06:00
|
|
|
<span className="text-xs font-medium text-red-600 dark:text-red-400">stderr</span>
|
|
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-3 text-xs font-mono text-red-700 dark:text-red-300 overflow-x-auto whitespace-pre-wrap">{run.stderrExcerpt}</pre>
|
2026-02-18 13:02:23 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* stdout excerpt when no log is available */}
|
|
|
|
|
{run.stdoutExcerpt && !run.logRef && (
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<span className="text-xs font-medium text-muted-foreground">stdout</span>
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-3 text-xs font-mono text-foreground overflow-x-auto whitespace-pre-wrap">{run.stdoutExcerpt}</pre>
|
2026-02-18 13:02:23 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
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
|
|
|
{/* Log viewer */}
|
2026-02-18 13:53:03 -06:00
|
|
|
<LogViewer run={run} adapterType={adapterType} />
|
2026-03-07 20:07:39 -06:00
|
|
|
<ScrollToBottom />
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---- Log Viewer ---- */
|
|
|
|
|
|
2026-02-18 13:53:03 -06:00
|
|
|
function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType: string }) {
|
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 [events, setEvents] = useState<HeartbeatRunEvent[]>([]);
|
2026-02-18 13:02:23 -06:00
|
|
|
const [logLines, setLogLines] = useState<Array<{ ts: string; stream: "stdout" | "stderr" | "system"; chunk: string }>>([]);
|
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 [loading, setLoading] = useState(true);
|
2026-02-18 13:02:23 -06:00
|
|
|
const [logLoading, setLogLoading] = useState(!!run.logRef);
|
|
|
|
|
const [logError, setLogError] = useState<string | null>(null);
|
|
|
|
|
const [logOffset, setLogOffset] = useState(0);
|
2026-02-20 15:48:42 -06:00
|
|
|
const [isFollowing, setIsFollowing] = useState(false);
|
2026-03-06 14:39:49 -06:00
|
|
|
const [isStreamingConnected, setIsStreamingConnected] = useState(false);
|
2026-03-11 10:35:41 -05:00
|
|
|
const [transcriptMode, setTranscriptMode] = useState<TranscriptMode>("nice");
|
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 logEndRef = useRef<HTMLDivElement>(null);
|
2026-02-18 13:02:23 -06:00
|
|
|
const pendingLogLineRef = useRef("");
|
2026-02-20 15:48:42 -06:00
|
|
|
const scrollContainerRef = useRef<ScrollContainer | null>(null);
|
|
|
|
|
const isFollowingRef = useRef(false);
|
|
|
|
|
const lastMetricsRef = useRef<{ scrollHeight: number; distanceFromBottom: number }>({
|
|
|
|
|
scrollHeight: 0,
|
|
|
|
|
distanceFromBottom: Number.POSITIVE_INFINITY,
|
|
|
|
|
});
|
2026-02-18 13:02:23 -06:00
|
|
|
const isLive = run.status === "running" || run.status === "queued";
|
2026-03-17 09:36:35 -05:00
|
|
|
const { data: workspaceOperations = [] } = useQuery({
|
|
|
|
|
queryKey: queryKeys.runWorkspaceOperations(run.id),
|
|
|
|
|
queryFn: () => heartbeatsApi.workspaceOperations(run.id),
|
|
|
|
|
refetchInterval: isLive ? 2000 : false,
|
|
|
|
|
});
|
2026-02-18 13:02:23 -06:00
|
|
|
|
2026-03-06 13:24:20 -06:00
|
|
|
function isRunLogUnavailable(err: unknown): boolean {
|
|
|
|
|
return err instanceof ApiError && err.status === 404;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-18 13:02:23 -06:00
|
|
|
function appendLogContent(content: string, finalize = false) {
|
|
|
|
|
if (!content && !finalize) return;
|
|
|
|
|
const combined = `${pendingLogLineRef.current}${content}`;
|
|
|
|
|
const split = combined.split("\n");
|
|
|
|
|
pendingLogLineRef.current = split.pop() ?? "";
|
|
|
|
|
if (finalize && pendingLogLineRef.current) {
|
|
|
|
|
split.push(pendingLogLineRef.current);
|
|
|
|
|
pendingLogLineRef.current = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parsed: Array<{ ts: string; stream: "stdout" | "stderr" | "system"; chunk: string }> = [];
|
|
|
|
|
for (const line of split) {
|
|
|
|
|
const trimmed = line.trim();
|
|
|
|
|
if (!trimmed) continue;
|
|
|
|
|
try {
|
|
|
|
|
const raw = JSON.parse(trimmed) as { ts?: unknown; stream?: unknown; chunk?: unknown };
|
|
|
|
|
const stream =
|
|
|
|
|
raw.stream === "stderr" || raw.stream === "system" ? raw.stream : "stdout";
|
|
|
|
|
const chunk = typeof raw.chunk === "string" ? raw.chunk : "";
|
|
|
|
|
const ts = typeof raw.ts === "string" ? raw.ts : new Date().toISOString();
|
|
|
|
|
if (!chunk) continue;
|
|
|
|
|
parsed.push({ ts, stream, chunk });
|
|
|
|
|
} catch {
|
|
|
|
|
// ignore malformed lines
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (parsed.length > 0) {
|
|
|
|
|
setLogLines((prev) => [...prev, ...parsed]);
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
// Fetch events
|
|
|
|
|
const { data: initialEvents } = useQuery({
|
2026-02-18 13:02:23 -06:00
|
|
|
queryKey: ["run-events", run.id],
|
|
|
|
|
queryFn: () => heartbeatsApi.events(run.id, 0, 200),
|
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
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (initialEvents) {
|
|
|
|
|
setEvents(initialEvents);
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
}, [initialEvents]);
|
|
|
|
|
|
2026-02-20 15:48:42 -06:00
|
|
|
const getScrollContainer = useCallback((): ScrollContainer => {
|
|
|
|
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
|
|
|
const container = findScrollContainer(logEndRef.current);
|
|
|
|
|
scrollContainerRef.current = container;
|
|
|
|
|
return container;
|
2026-02-20 10:32:32 -06:00
|
|
|
}, []);
|
|
|
|
|
|
2026-02-20 15:48:42 -06:00
|
|
|
const updateFollowingState = useCallback(() => {
|
|
|
|
|
const container = getScrollContainer();
|
|
|
|
|
const metrics = readScrollMetrics(container);
|
|
|
|
|
lastMetricsRef.current = metrics;
|
|
|
|
|
const nearBottom = metrics.distanceFromBottom <= LIVE_SCROLL_BOTTOM_TOLERANCE_PX;
|
|
|
|
|
isFollowingRef.current = nearBottom;
|
|
|
|
|
setIsFollowing((prev) => (prev === nearBottom ? prev : nearBottom));
|
|
|
|
|
}, [getScrollContainer]);
|
|
|
|
|
|
2026-02-20 10:32:32 -06:00
|
|
|
useEffect(() => {
|
2026-02-20 15:48:42 -06:00
|
|
|
scrollContainerRef.current = null;
|
|
|
|
|
lastMetricsRef.current = {
|
|
|
|
|
scrollHeight: 0,
|
|
|
|
|
distanceFromBottom: Number.POSITIVE_INFINITY,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!isLive) {
|
|
|
|
|
isFollowingRef.current = false;
|
|
|
|
|
setIsFollowing(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateFollowingState();
|
|
|
|
|
}, [isLive, run.id, updateFollowingState]);
|
2026-02-20 10:32:32 -06:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isLive) return;
|
2026-02-20 15:48:42 -06:00
|
|
|
const container = getScrollContainer();
|
2026-02-20 10:32:32 -06:00
|
|
|
updateFollowingState();
|
2026-02-20 15:48:42 -06:00
|
|
|
|
|
|
|
|
if (container === window) {
|
|
|
|
|
window.addEventListener("scroll", updateFollowingState, { passive: true });
|
|
|
|
|
} else {
|
|
|
|
|
container.addEventListener("scroll", updateFollowingState, { passive: true });
|
|
|
|
|
}
|
2026-02-20 10:32:32 -06:00
|
|
|
window.addEventListener("resize", updateFollowingState);
|
|
|
|
|
return () => {
|
2026-02-20 15:48:42 -06:00
|
|
|
if (container === window) {
|
|
|
|
|
window.removeEventListener("scroll", updateFollowingState);
|
|
|
|
|
} else {
|
|
|
|
|
container.removeEventListener("scroll", updateFollowingState);
|
|
|
|
|
}
|
2026-02-20 10:32:32 -06:00
|
|
|
window.removeEventListener("resize", updateFollowingState);
|
|
|
|
|
};
|
2026-02-20 15:48:42 -06:00
|
|
|
}, [isLive, run.id, getScrollContainer, updateFollowingState]);
|
2026-02-20 10:32:32 -06:00
|
|
|
|
|
|
|
|
// Auto-scroll only for live runs when following
|
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
|
|
|
useEffect(() => {
|
2026-02-20 15:48:42 -06:00
|
|
|
if (!isLive || !isFollowingRef.current) return;
|
|
|
|
|
|
|
|
|
|
const container = getScrollContainer();
|
|
|
|
|
const previous = lastMetricsRef.current;
|
|
|
|
|
const current = readScrollMetrics(container);
|
|
|
|
|
const growth = Math.max(0, current.scrollHeight - previous.scrollHeight);
|
|
|
|
|
const expectedDistance = previous.distanceFromBottom + growth;
|
|
|
|
|
const movedAwayBy = current.distanceFromBottom - expectedDistance;
|
|
|
|
|
|
|
|
|
|
// If user moved away from bottom between updates, release auto-follow immediately.
|
|
|
|
|
if (movedAwayBy > LIVE_SCROLL_BOTTOM_TOLERANCE_PX) {
|
|
|
|
|
isFollowingRef.current = false;
|
|
|
|
|
setIsFollowing(false);
|
|
|
|
|
lastMetricsRef.current = current;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scrollToContainerBottom(container, "auto");
|
|
|
|
|
const after = readScrollMetrics(container);
|
|
|
|
|
lastMetricsRef.current = after;
|
|
|
|
|
if (!isFollowingRef.current) {
|
|
|
|
|
isFollowingRef.current = true;
|
2026-02-18 15:29:29 -06:00
|
|
|
}
|
2026-02-20 15:48:42 -06:00
|
|
|
setIsFollowing((prev) => (prev ? prev : true));
|
|
|
|
|
}, [events.length, logLines.length, isLive, getScrollContainer]);
|
2026-02-18 13:02:23 -06:00
|
|
|
|
|
|
|
|
// Fetch persisted shell log
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let cancelled = false;
|
|
|
|
|
pendingLogLineRef.current = "";
|
|
|
|
|
setLogLines([]);
|
|
|
|
|
setLogOffset(0);
|
|
|
|
|
setLogError(null);
|
|
|
|
|
|
2026-03-06 13:24:20 -06:00
|
|
|
if (!run.logRef && !isLive) {
|
2026-02-18 13:02:23 -06:00
|
|
|
setLogLoading(false);
|
|
|
|
|
return () => {
|
|
|
|
|
cancelled = true;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setLogLoading(true);
|
|
|
|
|
const firstLimit =
|
|
|
|
|
typeof run.logBytes === "number" && run.logBytes > 0
|
|
|
|
|
? Math.min(Math.max(run.logBytes + 1024, 256_000), 2_000_000)
|
|
|
|
|
: 256_000;
|
|
|
|
|
|
|
|
|
|
const load = async () => {
|
|
|
|
|
try {
|
|
|
|
|
let offset = 0;
|
|
|
|
|
let first = true;
|
|
|
|
|
while (!cancelled) {
|
|
|
|
|
const result = await heartbeatsApi.log(run.id, offset, first ? firstLimit : 256_000);
|
2026-02-18 15:29:29 -06:00
|
|
|
if (cancelled) break;
|
2026-02-18 13:02:23 -06:00
|
|
|
appendLogContent(result.content, result.nextOffset === undefined);
|
|
|
|
|
const next = result.nextOffset ?? offset + result.content.length;
|
|
|
|
|
setLogOffset(next);
|
|
|
|
|
offset = next;
|
|
|
|
|
first = false;
|
|
|
|
|
if (result.nextOffset === undefined || isLive) break;
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
if (!cancelled) {
|
2026-03-06 13:24:20 -06:00
|
|
|
if (isLive && isRunLogUnavailable(err)) {
|
|
|
|
|
setLogLoading(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-02-18 13:02:23 -06:00
|
|
|
setLogError(err instanceof Error ? err.message : "Failed to load run log");
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
if (!cancelled) setLogLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void load();
|
|
|
|
|
return () => {
|
|
|
|
|
cancelled = true;
|
|
|
|
|
};
|
|
|
|
|
}, [run.id, run.logRef, run.logBytes, isLive]);
|
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
|
|
|
|
|
|
|
|
// Poll for live updates
|
|
|
|
|
useEffect(() => {
|
2026-03-06 14:39:49 -06:00
|
|
|
if (!isLive || isStreamingConnected) 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
|
|
|
const interval = setInterval(async () => {
|
|
|
|
|
const maxSeq = events.length > 0 ? Math.max(...events.map((e) => e.seq)) : 0;
|
|
|
|
|
try {
|
2026-02-18 13:02:23 -06:00
|
|
|
const newEvents = await heartbeatsApi.events(run.id, maxSeq, 100);
|
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
|
|
|
if (newEvents.length > 0) {
|
|
|
|
|
setEvents((prev) => [...prev, ...newEvents]);
|
|
|
|
|
}
|
|
|
|
|
} catch {
|
|
|
|
|
// ignore polling errors
|
|
|
|
|
}
|
|
|
|
|
}, 2000);
|
|
|
|
|
return () => clearInterval(interval);
|
2026-03-06 14:39:49 -06:00
|
|
|
}, [run.id, isLive, isStreamingConnected, events]);
|
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-18 13:02:23 -06:00
|
|
|
// Poll shell log for running runs
|
|
|
|
|
useEffect(() => {
|
2026-03-06 14:39:49 -06:00
|
|
|
if (!isLive || isStreamingConnected) return;
|
2026-02-18 13:02:23 -06:00
|
|
|
const interval = setInterval(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const result = await heartbeatsApi.log(run.id, logOffset, 256_000);
|
|
|
|
|
if (result.content) {
|
|
|
|
|
appendLogContent(result.content, result.nextOffset === undefined);
|
|
|
|
|
}
|
|
|
|
|
if (result.nextOffset !== undefined) {
|
|
|
|
|
setLogOffset(result.nextOffset);
|
|
|
|
|
} else if (result.content.length > 0) {
|
|
|
|
|
setLogOffset((prev) => prev + result.content.length);
|
|
|
|
|
}
|
2026-03-06 13:24:20 -06:00
|
|
|
} catch (err) {
|
|
|
|
|
if (isRunLogUnavailable(err)) return;
|
2026-02-18 13:02:23 -06:00
|
|
|
// ignore polling errors
|
|
|
|
|
}
|
|
|
|
|
}, 2000);
|
|
|
|
|
return () => clearInterval(interval);
|
2026-03-06 14:39:49 -06:00
|
|
|
}, [run.id, isLive, isStreamingConnected, logOffset]);
|
|
|
|
|
|
|
|
|
|
// Stream live updates from websocket (primary path for running runs).
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isLive) return;
|
|
|
|
|
|
|
|
|
|
let closed = false;
|
|
|
|
|
let reconnectTimer: number | null = null;
|
|
|
|
|
let socket: WebSocket | null = null;
|
|
|
|
|
|
|
|
|
|
const scheduleReconnect = () => {
|
|
|
|
|
if (closed) return;
|
|
|
|
|
reconnectTimer = window.setTimeout(connect, 1500);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const connect = () => {
|
|
|
|
|
if (closed) return;
|
|
|
|
|
const protocol = window.location.protocol === "https:" ? "wss" : "ws";
|
|
|
|
|
const url = `${protocol}://${window.location.host}/api/companies/${encodeURIComponent(run.companyId)}/events/ws`;
|
|
|
|
|
socket = new WebSocket(url);
|
|
|
|
|
|
|
|
|
|
socket.onopen = () => {
|
|
|
|
|
setIsStreamingConnected(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
socket.onmessage = (message) => {
|
|
|
|
|
const rawMessage = typeof message.data === "string" ? message.data : "";
|
|
|
|
|
if (!rawMessage) return;
|
|
|
|
|
|
|
|
|
|
let event: LiveEvent;
|
|
|
|
|
try {
|
|
|
|
|
event = JSON.parse(rawMessage) as LiveEvent;
|
|
|
|
|
} catch {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.companyId !== run.companyId) return;
|
|
|
|
|
const payload = asRecord(event.payload);
|
|
|
|
|
const eventRunId = asNonEmptyString(payload?.runId);
|
|
|
|
|
if (!payload || eventRunId !== run.id) return;
|
|
|
|
|
|
|
|
|
|
if (event.type === "heartbeat.run.log") {
|
|
|
|
|
const chunk = typeof payload.chunk === "string" ? payload.chunk : "";
|
|
|
|
|
if (!chunk) return;
|
|
|
|
|
const streamRaw = asNonEmptyString(payload.stream);
|
|
|
|
|
const stream = streamRaw === "stderr" || streamRaw === "system" ? streamRaw : "stdout";
|
|
|
|
|
const ts = asNonEmptyString((payload as Record<string, unknown>).ts) ?? event.createdAt;
|
|
|
|
|
setLogLines((prev) => [...prev, { ts, stream, chunk }]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.type !== "heartbeat.run.event") return;
|
|
|
|
|
|
|
|
|
|
const seq = typeof payload.seq === "number" ? payload.seq : null;
|
|
|
|
|
if (seq === null || !Number.isFinite(seq)) return;
|
|
|
|
|
|
|
|
|
|
const streamRaw = asNonEmptyString(payload.stream);
|
|
|
|
|
const stream =
|
|
|
|
|
streamRaw === "stdout" || streamRaw === "stderr" || streamRaw === "system"
|
|
|
|
|
? streamRaw
|
|
|
|
|
: null;
|
|
|
|
|
const levelRaw = asNonEmptyString(payload.level);
|
|
|
|
|
const level =
|
|
|
|
|
levelRaw === "info" || levelRaw === "warn" || levelRaw === "error"
|
|
|
|
|
? levelRaw
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
const liveEvent: HeartbeatRunEvent = {
|
|
|
|
|
id: seq,
|
|
|
|
|
companyId: run.companyId,
|
|
|
|
|
runId: run.id,
|
|
|
|
|
agentId: run.agentId,
|
|
|
|
|
seq,
|
|
|
|
|
eventType: asNonEmptyString(payload.eventType) ?? "event",
|
|
|
|
|
stream,
|
|
|
|
|
level,
|
|
|
|
|
color: asNonEmptyString(payload.color),
|
|
|
|
|
message: asNonEmptyString(payload.message),
|
|
|
|
|
payload: asRecord(payload.payload),
|
|
|
|
|
createdAt: new Date(event.createdAt),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setEvents((prev) => {
|
|
|
|
|
if (prev.some((existing) => existing.seq === seq)) return prev;
|
|
|
|
|
return [...prev, liveEvent];
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
socket.onerror = () => {
|
|
|
|
|
socket?.close();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
socket.onclose = () => {
|
|
|
|
|
setIsStreamingConnected(false);
|
|
|
|
|
scheduleReconnect();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
connect();
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
closed = true;
|
|
|
|
|
setIsStreamingConnected(false);
|
|
|
|
|
if (reconnectTimer !== null) window.clearTimeout(reconnectTimer);
|
|
|
|
|
if (socket) {
|
|
|
|
|
socket.onopen = null;
|
|
|
|
|
socket.onmessage = null;
|
|
|
|
|
socket.onerror = null;
|
|
|
|
|
socket.onclose = null;
|
|
|
|
|
socket.close(1000, "run_detail_unmount");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, [isLive, run.companyId, run.id, run.agentId]);
|
2026-02-18 13:02:23 -06:00
|
|
|
|
|
|
|
|
const adapterInvokePayload = useMemo(() => {
|
|
|
|
|
const evt = events.find((e) => e.eventType === "adapter.invoke");
|
2026-03-11 20:56:47 -05:00
|
|
|
return redactHomePathUserSegmentsInValue(asRecord(evt?.payload ?? null));
|
2026-02-18 13:02:23 -06:00
|
|
|
}, [events]);
|
|
|
|
|
|
2026-02-18 13:53:03 -06:00
|
|
|
const adapter = useMemo(() => getUIAdapter(adapterType), [adapterType]);
|
|
|
|
|
const transcript = useMemo(() => buildTranscript(logLines, adapter.parseStdoutLine), [logLines, adapter]);
|
2026-02-18 13:02:23 -06:00
|
|
|
|
2026-03-11 10:35:41 -05:00
|
|
|
useEffect(() => {
|
|
|
|
|
setTranscriptMode("nice");
|
|
|
|
|
}, [run.id]);
|
|
|
|
|
|
2026-02-18 13:02:23 -06:00
|
|
|
if (loading && logLoading) {
|
|
|
|
|
return <p className="text-xs text-muted-foreground">Loading run logs...</p>;
|
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-18 13:02:23 -06:00
|
|
|
if (events.length === 0 && logLines.length === 0 && !logError) {
|
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 <p className="text-xs text-muted-foreground">No log events.</p>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const levelColors: Record<string, string> = {
|
|
|
|
|
info: "text-foreground",
|
2026-02-26 16:33:48 -06:00
|
|
|
warn: "text-yellow-600 dark:text-yellow-400",
|
|
|
|
|
error: "text-red-600 dark:text-red-400",
|
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 streamColors: Record<string, string> = {
|
|
|
|
|
stdout: "text-foreground",
|
2026-02-26 16:33:48 -06:00
|
|
|
stderr: "text-red-600 dark:text-red-300",
|
|
|
|
|
system: "text-blue-600 dark:text-blue-300",
|
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 (
|
2026-02-18 13:02:23 -06:00
|
|
|
<div className="space-y-3">
|
2026-03-17 09:36:35 -05:00
|
|
|
<WorkspaceOperationsSection operations={workspaceOperations} />
|
2026-02-18 13:02:23 -06:00
|
|
|
{adapterInvokePayload && (
|
|
|
|
|
<div className="rounded-lg border border-border bg-background/60 p-3 space-y-2">
|
|
|
|
|
<div className="text-xs font-medium text-muted-foreground">Invocation</div>
|
|
|
|
|
{typeof adapterInvokePayload.adapterType === "string" && (
|
|
|
|
|
<div className="text-xs"><span className="text-muted-foreground">Adapter: </span>{adapterInvokePayload.adapterType}</div>
|
|
|
|
|
)}
|
|
|
|
|
{typeof adapterInvokePayload.cwd === "string" && (
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="text-xs break-all"><span className="text-muted-foreground">Working dir: </span><span className="font-mono">{adapterInvokePayload.cwd}</span></div>
|
2026-02-18 13:02:23 -06:00
|
|
|
)}
|
|
|
|
|
{typeof adapterInvokePayload.command === "string" && (
|
2026-02-23 17:20:29 -06:00
|
|
|
<div className="text-xs break-all">
|
2026-02-18 13:02:23 -06:00
|
|
|
<span className="text-muted-foreground">Command: </span>
|
|
|
|
|
<span className="font-mono">
|
|
|
|
|
{[
|
|
|
|
|
adapterInvokePayload.command,
|
|
|
|
|
...(Array.isArray(adapterInvokePayload.commandArgs)
|
|
|
|
|
? adapterInvokePayload.commandArgs.filter((v): v is string => typeof v === "string")
|
|
|
|
|
: []),
|
|
|
|
|
].join(" ")}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-02 16:44:03 -06:00
|
|
|
{Array.isArray(adapterInvokePayload.commandNotes) && adapterInvokePayload.commandNotes.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground mb-1">Command notes</div>
|
|
|
|
|
<ul className="list-disc pl-5 space-y-1">
|
|
|
|
|
{adapterInvokePayload.commandNotes
|
|
|
|
|
.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
|
|
|
|
.map((note, idx) => (
|
|
|
|
|
<li key={`${idx}-${note}`} className="text-xs break-all font-mono">
|
|
|
|
|
{note}
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-18 13:02:23 -06:00
|
|
|
{adapterInvokePayload.prompt !== undefined && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground mb-1">Prompt</div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap">
|
2026-02-18 13:02:23 -06:00
|
|
|
{typeof adapterInvokePayload.prompt === "string"
|
2026-03-11 20:56:47 -05:00
|
|
|
? redactHomePathUserSegments(adapterInvokePayload.prompt)
|
|
|
|
|
: JSON.stringify(redactHomePathUserSegmentsInValue(adapterInvokePayload.prompt), null, 2)}
|
2026-02-18 13:02:23 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{adapterInvokePayload.context !== undefined && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground mb-1">Context</div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap">
|
2026-03-11 20:56:47 -05:00
|
|
|
{JSON.stringify(redactHomePathUserSegmentsInValue(adapterInvokePayload.context), null, 2)}
|
2026-02-18 13:02:23 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{adapterInvokePayload.env !== undefined && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-xs text-muted-foreground mb-1">Environment</div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap font-mono">
|
2026-02-18 16:46:55 -06:00
|
|
|
{formatEnvForDisplay(adapterInvokePayload.env)}
|
2026-02-18 13:02:23 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<span className="text-xs font-medium text-muted-foreground">
|
|
|
|
|
Transcript ({transcript.length})
|
|
|
|
|
</span>
|
2026-02-20 10:32:32 -06:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-11 10:35:41 -05:00
|
|
|
<div className="inline-flex rounded-lg border border-border/70 bg-background/70 p-0.5">
|
|
|
|
|
{(["nice", "raw"] as const).map((mode) => (
|
|
|
|
|
<button
|
|
|
|
|
key={mode}
|
|
|
|
|
type="button"
|
|
|
|
|
className={cn(
|
|
|
|
|
"rounded-md px-2.5 py-1 text-[11px] font-medium capitalize transition-colors",
|
|
|
|
|
transcriptMode === mode
|
|
|
|
|
? "bg-accent text-foreground shadow-sm"
|
|
|
|
|
: "text-muted-foreground hover:text-foreground",
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => setTranscriptMode(mode)}
|
|
|
|
|
>
|
|
|
|
|
{mode}
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-02-20 10:32:32 -06:00
|
|
|
{isLive && !isFollowing && (
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="xs"
|
|
|
|
|
onClick={() => {
|
2026-02-20 15:48:42 -06:00
|
|
|
const container = getScrollContainer();
|
|
|
|
|
isFollowingRef.current = true;
|
2026-02-20 10:32:32 -06:00
|
|
|
setIsFollowing(true);
|
2026-02-20 15:48:42 -06:00
|
|
|
scrollToContainerBottom(container, "auto");
|
|
|
|
|
lastMetricsRef.current = readScrollMetrics(container);
|
2026-02-20 10:32:32 -06:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Jump to live
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
{isLive && (
|
|
|
|
|
<span className="flex items-center gap-1 text-xs text-cyan-400">
|
|
|
|
|
<span className="relative flex h-2 w-2">
|
ui: apply interface polish from design article review
- Add global font smoothing (antialiased) to body
- Add tabular-nums to all numeric displays: MetricCard values, Costs page,
AgentDetail token/cost grids and tables, IssueDetail cost summary,
Companies page budget display
- Replace markdown image hard border with subtle inset box-shadow overlay
- Replace all animate-ping status dots with calmer animate-pulse across
AgentDetail, IssueDetail, Agents, sidebar, kanban, issues list, and
active agents panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:20:24 -05:00
|
|
|
<span className="animate-pulse absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75" />
|
2026-02-20 10:32:32 -06:00
|
|
|
<span className="relative inline-flex rounded-full h-2 w-2 bg-cyan-400" />
|
|
|
|
|
</span>
|
|
|
|
|
Live
|
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>
|
2026-02-20 10:32:32 -06:00
|
|
|
)}
|
|
|
|
|
</div>
|
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>
|
2026-03-11 10:35:41 -05:00
|
|
|
<div className="max-h-[38rem] overflow-y-auto rounded-2xl border border-border/70 bg-background/40 p-3 sm:p-4">
|
|
|
|
|
<RunTranscriptView
|
|
|
|
|
entries={transcript}
|
|
|
|
|
mode={transcriptMode}
|
|
|
|
|
streaming={isLive}
|
|
|
|
|
emptyMessage={run.logRef ? "Waiting for transcript..." : "No persisted transcript for this run."}
|
|
|
|
|
/>
|
|
|
|
|
{logError && (
|
|
|
|
|
<div className="mt-3 rounded-xl border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-700 dark:text-red-300">
|
|
|
|
|
{logError}
|
|
|
|
|
</div>
|
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
|
|
|
<div ref={logEndRef} />
|
|
|
|
|
</div>
|
2026-02-18 13:02:23 -06:00
|
|
|
|
2026-02-18 13:17:03 -06:00
|
|
|
{(run.status === "failed" || run.status === "timed_out") && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="rounded-lg border border-red-300 dark:border-red-500/30 bg-red-50 dark:bg-red-950/20 p-3 space-y-2">
|
|
|
|
|
<div className="text-xs font-medium text-red-700 dark:text-red-300">Failure details</div>
|
2026-02-18 13:17:03 -06:00
|
|
|
{run.error && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="text-xs text-red-600 dark:text-red-200">
|
|
|
|
|
<span className="text-red-700 dark:text-red-300">Error: </span>
|
2026-03-11 20:56:47 -05:00
|
|
|
{redactHomePathUserSegments(run.error)}
|
2026-02-18 13:17:03 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{run.stderrExcerpt && run.stderrExcerpt.trim() && (
|
|
|
|
|
<div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="text-xs text-red-700 dark:text-red-300 mb-1">stderr excerpt</div>
|
|
|
|
|
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
2026-03-11 20:56:47 -05:00
|
|
|
{redactHomePathUserSegments(run.stderrExcerpt)}
|
2026-02-18 13:17:03 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{run.resultJson && (
|
|
|
|
|
<div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="text-xs text-red-700 dark:text-red-300 mb-1">adapter result JSON</div>
|
|
|
|
|
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
2026-03-11 20:56:47 -05:00
|
|
|
{JSON.stringify(redactHomePathUserSegmentsInValue(run.resultJson), null, 2)}
|
2026-02-18 13:17:03 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{run.stdoutExcerpt && run.stdoutExcerpt.trim() && !run.resultJson && (
|
|
|
|
|
<div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="text-xs text-red-700 dark:text-red-300 mb-1">stdout excerpt</div>
|
|
|
|
|
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
2026-03-11 20:56:47 -05:00
|
|
|
{redactHomePathUserSegments(run.stdoutExcerpt)}
|
2026-02-18 13:17:03 -06:00
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-02-18 13:02:23 -06:00
|
|
|
{events.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="mb-2 text-xs font-medium text-muted-foreground">Events ({events.length})</div>
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="bg-neutral-100 dark:bg-neutral-950 rounded-lg p-3 font-mono text-xs space-y-0.5">
|
2026-02-18 13:02:23 -06:00
|
|
|
{events.map((evt) => {
|
|
|
|
|
const color = evt.color
|
|
|
|
|
?? (evt.level ? levelColors[evt.level] : null)
|
|
|
|
|
?? (evt.stream ? streamColors[evt.stream] : null)
|
|
|
|
|
?? "text-foreground";
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div key={evt.id} className="flex gap-2">
|
2026-02-26 16:33:48 -06:00
|
|
|
<span className="text-neutral-400 dark:text-neutral-600 shrink-0 select-none w-16">
|
2026-02-18 13:02:23 -06:00
|
|
|
{new Date(evt.createdAt).toLocaleTimeString("en-US", { hour12: false })}
|
|
|
|
|
</span>
|
|
|
|
|
<span className={cn("shrink-0 w-14", evt.stream ? (streamColors[evt.stream] ?? "text-neutral-500") : "text-neutral-500")}>
|
|
|
|
|
{evt.stream ? `[${evt.stream}]` : ""}
|
|
|
|
|
</span>
|
|
|
|
|
<span className={cn("break-all", color)}>
|
2026-03-11 20:56:47 -05:00
|
|
|
{evt.message
|
|
|
|
|
? redactHomePathUserSegments(evt.message)
|
|
|
|
|
: evt.payload
|
|
|
|
|
? JSON.stringify(redactHomePathUserSegmentsInValue(evt.payload))
|
|
|
|
|
: ""}
|
2026-02-18 13:02:23 -06:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-17 20:46:12 -06:00
|
|
|
/* ---- Keys Tab ---- */
|
|
|
|
|
|
2026-03-02 16:44:03 -06:00
|
|
|
function KeysTab({ agentId, companyId }: { agentId: string; companyId?: string }) {
|
2026-02-17 20:46:12 -06:00
|
|
|
const queryClient = useQueryClient();
|
|
|
|
|
const [newKeyName, setNewKeyName] = useState("");
|
|
|
|
|
const [newToken, setNewToken] = useState<string | null>(null);
|
|
|
|
|
const [tokenVisible, setTokenVisible] = useState(false);
|
|
|
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
|
|
|
|
|
|
const { data: keys, isLoading } = useQuery({
|
|
|
|
|
queryKey: queryKeys.agents.keys(agentId),
|
2026-03-02 16:44:03 -06:00
|
|
|
queryFn: () => agentsApi.listKeys(agentId, companyId),
|
2026-02-17 20:46:12 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const createKey = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: () => agentsApi.createKey(agentId, newKeyName.trim() || "Default", companyId),
|
2026-02-17 20:46:12 -06:00
|
|
|
onSuccess: (data) => {
|
|
|
|
|
setNewToken(data.token);
|
|
|
|
|
setTokenVisible(true);
|
|
|
|
|
setNewKeyName("");
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.keys(agentId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const revokeKey = useMutation({
|
2026-03-02 16:44:03 -06:00
|
|
|
mutationFn: (keyId: string) => agentsApi.revokeKey(agentId, keyId, companyId),
|
2026-02-17 20:46:12 -06:00
|
|
|
onSuccess: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: queryKeys.agents.keys(agentId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function copyToken() {
|
|
|
|
|
if (!newToken) return;
|
|
|
|
|
navigator.clipboard.writeText(newToken);
|
|
|
|
|
setCopied(true);
|
|
|
|
|
setTimeout(() => setCopied(false), 2000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const activeKeys = (keys ?? []).filter((k: AgentKey) => !k.revokedAt);
|
|
|
|
|
const revokedKeys = (keys ?? []).filter((k: AgentKey) => k.revokedAt);
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-20 10:33:18 -06:00
|
|
|
<div className="space-y-6">
|
2026-02-17 20:46:12 -06:00
|
|
|
{/* New token banner */}
|
|
|
|
|
{newToken && (
|
2026-02-26 16:33:48 -06:00
|
|
|
<div className="border border-yellow-300 dark:border-yellow-600/40 bg-yellow-50 dark:bg-yellow-500/5 rounded-lg p-4 space-y-2">
|
|
|
|
|
<p className="text-sm font-medium text-yellow-700 dark:text-yellow-400">
|
2026-02-17 20:46:12 -06:00
|
|
|
API key created — copy it now, it will not be shown again.
|
|
|
|
|
</p>
|
|
|
|
|
<div className="flex items-center gap-2">
|
2026-02-26 16:33:48 -06:00
|
|
|
<code className="flex-1 bg-neutral-100 dark:bg-neutral-950 rounded px-3 py-1.5 text-xs font-mono text-green-700 dark:text-green-300 truncate">
|
2026-02-17 20:46:12 -06:00
|
|
|
{tokenVisible ? newToken : newToken.replace(/./g, "•")}
|
|
|
|
|
</code>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon-sm"
|
|
|
|
|
onClick={() => setTokenVisible((v) => !v)}
|
|
|
|
|
title={tokenVisible ? "Hide" : "Show"}
|
|
|
|
|
>
|
|
|
|
|
{tokenVisible ? <EyeOff className="h-3.5 w-3.5" /> : <Eye className="h-3.5 w-3.5" />}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon-sm"
|
|
|
|
|
onClick={copyToken}
|
|
|
|
|
title="Copy"
|
|
|
|
|
>
|
|
|
|
|
<Copy className="h-3.5 w-3.5" />
|
|
|
|
|
</Button>
|
|
|
|
|
{copied && <span className="text-xs text-green-400">Copied!</span>}
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="text-muted-foreground text-xs"
|
|
|
|
|
onClick={() => setNewToken(null)}
|
|
|
|
|
>
|
|
|
|
|
Dismiss
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Create new key */}
|
|
|
|
|
<div className="border border-border rounded-lg p-4 space-y-3">
|
2026-02-23 14:41:21 -06:00
|
|
|
<h3 className="text-xs font-medium text-muted-foreground flex items-center gap-2">
|
|
|
|
|
<Key className="h-3.5 w-3.5" />
|
2026-02-17 20:46:12 -06:00
|
|
|
Create API Key
|
|
|
|
|
</h3>
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
|
|
API keys allow this agent to authenticate calls to the Paperclip server.
|
|
|
|
|
</p>
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<Input
|
|
|
|
|
placeholder="Key name (e.g. production)"
|
|
|
|
|
value={newKeyName}
|
|
|
|
|
onChange={(e) => setNewKeyName(e.target.value)}
|
|
|
|
|
className="h-8 text-sm"
|
|
|
|
|
onKeyDown={(e) => {
|
|
|
|
|
if (e.key === "Enter") createKey.mutate();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => createKey.mutate()}
|
|
|
|
|
disabled={createKey.isPending}
|
|
|
|
|
>
|
|
|
|
|
<Plus className="h-3.5 w-3.5 mr-1" />
|
|
|
|
|
Create
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Active keys */}
|
|
|
|
|
{isLoading && <p className="text-sm text-muted-foreground">Loading keys...</p>}
|
|
|
|
|
|
|
|
|
|
{!isLoading && activeKeys.length === 0 && !newToken && (
|
|
|
|
|
<p className="text-sm text-muted-foreground">No active API keys.</p>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{activeKeys.length > 0 && (
|
|
|
|
|
<div>
|
2026-02-23 14:41:21 -06:00
|
|
|
<h3 className="text-xs font-medium text-muted-foreground mb-2">
|
2026-02-17 20:46:12 -06:00
|
|
|
Active Keys
|
|
|
|
|
</h3>
|
2026-02-23 14:41:21 -06:00
|
|
|
<div className="border border-border rounded-lg divide-y divide-border">
|
2026-02-17 20:46:12 -06:00
|
|
|
{activeKeys.map((key: AgentKey) => (
|
|
|
|
|
<div key={key.id} className="flex items-center justify-between px-4 py-2.5">
|
|
|
|
|
<div>
|
|
|
|
|
<span className="text-sm font-medium">{key.name}</span>
|
|
|
|
|
<span className="text-xs text-muted-foreground ml-3">
|
|
|
|
|
Created {formatDate(key.createdAt)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
className="text-destructive hover:text-destructive text-xs"
|
|
|
|
|
onClick={() => revokeKey.mutate(key.id)}
|
|
|
|
|
disabled={revokeKey.isPending}
|
|
|
|
|
>
|
|
|
|
|
Revoke
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-02-23 14:41:21 -06:00
|
|
|
{/* Revoked keys */}
|
2026-02-17 20:46:12 -06:00
|
|
|
{revokedKeys.length > 0 && (
|
|
|
|
|
<div>
|
2026-02-23 14:41:21 -06:00
|
|
|
<h3 className="text-xs font-medium text-muted-foreground mb-2">
|
2026-02-17 20:46:12 -06:00
|
|
|
Revoked Keys
|
|
|
|
|
</h3>
|
2026-02-23 14:41:21 -06:00
|
|
|
<div className="border border-border rounded-lg divide-y divide-border opacity-50">
|
2026-02-17 20:46:12 -06:00
|
|
|
{revokedKeys.map((key: AgentKey) => (
|
|
|
|
|
<div key={key.id} className="flex items-center justify-between px-4 py-2.5">
|
|
|
|
|
<div>
|
|
|
|
|
<span className="text-sm line-through">{key.name}</span>
|
|
|
|
|
<span className="text-xs text-muted-foreground ml-3">
|
|
|
|
|
Revoked {key.revokedAt ? formatDate(key.revokedAt) : ""}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|