Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: turn an archetype agent into a custom one from its detail

This commit is contained in:
atlas 2026-11-01 12:08:38 +01:00 • committed by mara
commit 83bb47d134

View file

@ -11,6 +11,7 @@
// change or a link made here shows wherever else the same row is drawn.
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { Badge } from "@hive/shared/badge.js";
import { Button } from "../../ui/button/Button.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
import type { AgentActions } from "../roster/AgentActions.js";
import { AgentInference } from "./AgentInference.js";
@ -20,7 +21,7 @@ import { AgentPermissions } from "./AgentPermissions.js";
import { AllowedDomains } from "./AllowedDomains.js";
import { AgentStateRow } from "./AgentStateRow.js";
import { AgentTermPreview } from "../terminal/AgentTermPreview.js";
import { FRESHNESS, type AgentRow } from "../AgentTypes.js";
import { canTurnIntoCustom, FRESHNESS, type AgentRow } from "../AgentTypes.js";
import { LinkAccountMenu } from "./LinkAccountMenu.js";
import { LinkedAccounts } from "./LinkedAccounts.js";
import { LazyDisclosure } from "../../ui/disclosure/LazyDisclosure.js";
@ -90,7 +91,13 @@ function HeaderRows({
);
}
function OverviewRows({ row }: { row: AgentRow }) {
function OverviewRows({
row,
actions,
}: {
row: AgentRow;
actions: AgentActions;
}) {
return (
<>
<dt>state</dt>
@ -122,6 +129,25 @@ function OverviewRows({ row }: { row: AgentRow }) {
"—"
)}
</dd>
{row.archetype ? (
<>
<dt>archetype</dt>
<dd>
{row.archetype.source}/{row.archetype.name}
{canTurnIntoCustom(row) ? (
<>
{" "}
<Button
disabled={actions.pendingAgents.has(row.name)}
onClick={() => actions.requestCustom(row)}
>
turn into custom
</Button>
</>
) : null}
</dd>
</>
) : null}
</>
);
}
@ -211,7 +237,7 @@ function SectionBody({
case "overview":
return (
<dl class="ui-agent-detail-fields">
<OverviewRows row={row} />
<OverviewRows row={row} actions={actions} />
</dl>
);
case "settings":
@ -272,7 +298,7 @@ export function AgentDetail({
<div class="ui-agent-detail">
<dl class="ui-agent-detail-fields">
<HeaderRows row={row} actions={actions} />
<OverviewRows row={row} />
<OverviewRows row={row} actions={actions} />
<SettingsRows agent={row.name} />
<AccountsRows row={row} actions={actions} />
</dl>