Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the inference editor fills the section, and the login and API key get a row each

The editor stopped at 60em, and the claude login row packed the login and
the API key badges into one wrapping line. The width cap is gone, and the
API key has its own row beside the login's.
This commit is contained in:
iris 2026-11-26 21:05:47 +01:00
commit 025d39d141
5 changed files with 25 additions and 22 deletions

View file

@ -204,8 +204,9 @@ starts open, the other five folded:
- **instructions**: the agent's AGENTS.md, as an editor you can type in. - **instructions**: the agent's AGENTS.md, as an editor you can type in.
- **inference**: how the agent thinks and what it costs, as an editor in place: - **inference**: how the agent thinks and what it costs, as an editor in place:
its model and effort, the subagent settings and the two context limits, then its model and effort, the subagent settings and the two context limits, then
the claude login and API key (the login's state, **log in**, and **set API the claude login and API key, each on its own row (the login's state and
key**), since the key is how the agent reaches claude. **log in**, then the key's state and **set API key**), since the key is how
the agent reaches claude. The editor fills the section's width.
- **access**: what the agent may reach and use: internet, allowed domains, - **access**: what the agent may reach and use: internet, allowed domains,
repositories, SSH, permissions and its resource caps. Each shows a badge; repositories, SSH, permissions and its resource caps. Each shows a badge;
select it to open the control that changes it (described below). select it to open the control that changes it (described below).
@ -1180,10 +1181,11 @@ reads back and its box starts with the stored text. The secrets never read back,
so their box starts empty and replaces the stored secrets only when filled and so their box starts empty and replaces the stored secrets only when filled and
saved. saved.
The **claude login** row of an agent's details also sets the API key: **set API The **API key** row of an agent's details, under the **claude login** row, sets
key** (or **replace API key**) sends the key as `ANTHROPIC_API_KEY=<key>` to the the API key: **set API key** (or **replace API key**) sends the key as
agent's secrets, **remove API key** deletes them, and **advanced** opens the `ANTHROPIC_API_KEY=<key>` to the agent's secrets, **remove API key** deletes
form above. The row shows whether the store holds a key and never the key. The them, and **advanced** opens the form above. The row shows whether the store
holds a key and never the key. The
form reads the stored configuration first: a 404 means the store holds none, and any form reads the stored configuration first: a 404 means the store holds none, and any
other failed read shows the error with a **retry** button and keeps **save** other failed read shows the error with a **retry** button and keeps **save**
disabled, so a save can't replace text that was never read. A disabled, so a save can't replace text that was never read. A

View file

@ -1,4 +1,4 @@
// <AgentApiKey> — how one agent is billed, in the claude login row: whether an // <AgentApiKey> — how one agent is billed, in the API key row: whether an
// API key is stored (`GET …/backend-secrets`, which never returns the key), a // API key is stored (`GET …/backend-secrets`, which never returns the key), a
// button that sets or replaces it, one that removes it, and the advanced // button that sets or replaces it, one that removes it, and the advanced
// backend settings. With a key stored the agent tries the key instead of // backend settings. With a key stored the agent tries the key instead of
@ -11,6 +11,7 @@ import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { Badge } from "@hive/shared/badge.js"; import { Badge } from "@hive/shared/badge.js";
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js"; import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
import { Dialog } from "../../ui/dialog/Dialog.js"; import { Dialog } from "../../ui/dialog/Dialog.js";
import { Hint } from "../../ui/hint/Hint.js";
import { showToast } from "../../ui/toast/toasts.js"; import { showToast } from "../../ui/toast/toasts.js";
import { LinkApiKeyForm } from "../../pages/LinkApiKeyForm.js"; import { LinkApiKeyForm } from "../../pages/LinkApiKeyForm.js";
import { LinkBackendEnvForm } from "../../pages/LinkBackendEnvForm.js"; import { LinkBackendEnvForm } from "../../pages/LinkBackendEnvForm.js";
@ -70,13 +71,11 @@ export function AgentApiKey({ hive, agent }: { hive: string; agent: string }) {
{error ? ( {error ? (
<ApiErrorPanel context="reading the API key failed" problem={error} /> <ApiErrorPanel context="reading the API key failed" problem={error} />
) : null} ) : null}
{stored === null ? null : ( {stored === null ? null : stored ? (
<>stored </>
) : (
<> <>
<Badge <Hint as="span">none stored</Hint>{" "}
label="API key"
value={stored ? "stored" : "none"}
tone={stored ? "ok" : "neutral"}
/>{" "}
</> </>
)} )}
<Badge <Badge

View file

@ -53,10 +53,12 @@ function ClaudeRows({ agent, hive }: { agent: string; hive: string | null }) {
<InferenceRows> <InferenceRows>
<InferencePair label="claude login"> <InferencePair label="claude login">
<AgentClaudeLogin key={agent} agent={agent} /> <AgentClaudeLogin key={agent} agent={agent} />
{hive ? (
<AgentApiKey key={`${hive}/${agent}`} hive={hive} agent={agent} />
) : null}
</InferencePair> </InferencePair>
{hive ? (
<InferencePair label="API key">
<AgentApiKey key={`${hive}/${agent}`} hive={hive} agent={agent} />
</InferencePair>
) : null}
</InferenceRows> </InferenceRows>
); );
} }

View file

@ -1,5 +1,5 @@
/* <AgentInference> — the settings as labelled values, two to a line where there /* <AgentInference> — the settings as labelled values, one to a line, each
is room, each value followed by where it comes from. */ value followed by where it comes from. */
.ui-agent-inference { .ui-agent-inference {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -8,14 +8,15 @@
} }
.ui-agent-inference-rows { .ui-agent-inference-rows {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(22em, 1fr)); grid-template-columns: minmax(0, 1fr);
gap: 0.3em 2em; gap: 0.4em;
align-self: stretch; align-self: stretch;
margin: 0; margin: 0;
} }
.ui-agent-inference-pair { .ui-agent-inference-pair {
display: grid; display: grid;
grid-template-columns: 12em minmax(0, 1fr); grid-template-columns: 12em minmax(0, 1fr);
align-items: baseline;
gap: 0 1em; gap: 0 1em;
} }
.ui-agent-inference-pair dt { .ui-agent-inference-pair dt {
@ -33,7 +34,6 @@
.ui-agent-inference .ui-form-stack { .ui-agent-inference .ui-form-stack {
align-items: stretch; align-items: stretch;
align-self: stretch; align-self: stretch;
max-width: 60em;
margin-top: 0; margin-top: 0;
} }
/* The claude login row under the editor. */ /* The claude login row under the editor. */

View file

@ -259,7 +259,7 @@ export function InferenceFields({
); );
} }
/** Labelled values, two to a line where there is room. */ /** Labelled values, one to a line. */
export function InferenceRows({ children }: { children: ComponentChildren }) { export function InferenceRows({ children }: { children: ComponentChildren }) {
return <dl class="ui-agent-inference-rows">{children}</dl>; return <dl class="ui-agent-inference-rows">{children}</dl>;
} }