frontend: remove the unused vanilla terminal and tab strip, and fix comments that describe removed UI
shared/src/terminal/terminal.js (and its index.js re-export and package export) had no importer: the Preact Row replaced it. The .tail-pill and .load-more-pill rules were only made by it, and the preview's own tail-pill override styled a pill that no longer exists. hive-tab-strip.js had no importer either. Four constants nobody imports are no longer exported. The shared terminal pane section of the web-ui shape doc now describes Row, linkify and markdown instead of the removed factory. Header comments that named removed components (StatusChips, MetaNav, Root.tsx, the cost badge, four folded sections, a detail dialog) now describe the current code.
This commit is contained in:
parent
3d88108c4f
commit
a1e5855859
7 changed files with 78 additions and 990 deletions
|
|
@ -1,11 +1,11 @@
|
|||
// <AgentDetail> — one agent's details: its status, wanted state, hive, config
|
||||
// PR, inference settings, resource caps and linked accounts, plus the actions on
|
||||
// them. Two layouts. In an opened card on `/agents` (`inCard`) the card header
|
||||
// already shows status, message and wanted state, so the body is four folded
|
||||
// sections (`sections.ts`): overview, settings, accounts, and the terminal with
|
||||
// its subagents, each built when first opened. In the detail dialog on a terminal
|
||||
// page it is one flat list with those three rows, and no terminal, since the
|
||||
// page is already beside one.
|
||||
// already shows status, message and wanted state, so the body is folded
|
||||
// sections (`sections.ts`): status, terminal, open todos, subagents, background
|
||||
// tasks and settings, each built when first opened. In the details popover on a
|
||||
// terminal page (`AgentDetailPopover`) it is the status and the settings only,
|
||||
// since the page is already beside a terminal.
|
||||
//
|
||||
// Takes the agent's *live* row and the shared `AgentActions`, so a state
|
||||
// change or a link made here shows wherever else the same row is drawn.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// <AgentStateRow> — an agent's turn state, whether it is paused, and the
|
||||
// tokens in its context and billed, as the details table's "state" row. The
|
||||
// tokens in its context, as the details table's "state" row. The
|
||||
// terminal preview below the table carries no badges of its own (the full
|
||||
// terminal tab does), so this is where the panel says what the agent is doing.
|
||||
// Follows the agent's state stream, which announces on a change and once a
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// useAgentActions — what can be done to an agent from the swarm UI: declare
|
||||
// its wanted state (up / offline / paused / destroyed) and link an account to
|
||||
// it, with the confirm and form dialogs those need. Shared by the agent
|
||||
// roster (`AgentsPage`) and the detail dialog on a terminal page
|
||||
// roster (`AgentsPage`) and the details popover on a terminal page
|
||||
// (`AgentDetailPopover`), so a state change reads the same from either; each
|
||||
// caller renders the returned `dialogs` once.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@
|
|||
// states. An agent with no declaration has none to change: its badge is
|
||||
// disabled and points at creating it at swarm level, because the state
|
||||
// route refuses an agent the swarm never declared on that hive.
|
||||
// Presentational only, same split as `StatusChips`'s
|
||||
// `StatusMenu`: the caller owns what each selection actually does.
|
||||
// Presentational only: the caller owns what each selection actually does.
|
||||
//
|
||||
// "paused" has no separate resume option here — selecting "up" from a
|
||||
// paused row is the resume, same PUT either way (`AgentsPage`'s
|
||||
// paused row is the resume, same PUT either way (`useAgentActions`'s
|
||||
// `declareState`, `hive-c0re`'s `decide_pause` backend counterpart,
|
||||
// treats a declared `Up` with the marker still set as "clear it"). A
|
||||
// dedicated "resume" entry would just be a second spelling of the
|
||||
|
|
|
|||
|
|
@ -9,15 +9,8 @@ import {
|
|||
type TokenUsage,
|
||||
} from "../terminal/useSwarmAgentStateStream.js";
|
||||
|
||||
// Ported, not imported, same call `useSwarmTermStream`'s own `appendRow`
|
||||
// already made for this file's sibling hook: `@hive/agent`'s equivalents
|
||||
// (`STATE_LABELS`/`tokenTotal`/`fmtTokens` in `Root.tsx`/`lib/format.ts`)
|
||||
// live in a different package this one doesn't otherwise depend on, and
|
||||
// a cross-package hop isn't worth it for three small, stable helpers.
|
||||
// Vocabulary (glyphless — the per-agent page's own glyphs are part of
|
||||
// its bigger consolidated status badge, not this smaller read-only one)
|
||||
// kept in exact parity with `Root.tsx`'s `STATE_LABELS` so "idle" here
|
||||
// means the same thing it means there.
|
||||
// The turn-state vocabulary is glyphless text, so "idle" reads the same
|
||||
// wherever a turn state shows.
|
||||
const TURN_STATE_TONE: Record<string, BadgeTone> = {
|
||||
idle: "neutral",
|
||||
thinking: "accent",
|
||||
|
|
@ -26,10 +19,8 @@ const TURN_STATE_TONE: Record<string, BadgeTone> = {
|
|||
|
||||
export function tokenTotal(u: TokenUsage | null): number | null {
|
||||
if (!u) return null;
|
||||
// Matches `Root.tsx`'s own `tokenTotal`: input + both cache buckets,
|
||||
// `output_tokens` deliberately excluded (shown in a title breakdown
|
||||
// there, not carried at all here — this badge has no breakdown to put
|
||||
// it in).
|
||||
// Input plus both cache buckets; `output_tokens` is deliberately left
|
||||
// out, as this badge has no breakdown to put it in.
|
||||
return (
|
||||
(u.input_tokens ?? 0) +
|
||||
(u.cache_read_input_tokens ?? 0) +
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@
|
|||
.ui-agent-term-preview-with-input .live.terminal {
|
||||
padding-block-end: 4.8em;
|
||||
}
|
||||
/* The "new rows" pill rides above the message box. */
|
||||
.ui-agent-term-preview-with-input .tail-pill {
|
||||
bottom: 5.4em;
|
||||
}
|
||||
|
||||
.ui-agent-term-preview-wrap.terminal-wrap {
|
||||
max-height: 18em;
|
||||
|
|
@ -87,9 +83,7 @@
|
|||
/* The floating row over the terminal's top edge: the connection light
|
||||
(and on the full tab turn_state/agent_state/model/ctx) on the left, the
|
||||
expand trigger on the right. Positioned by `.terminal-wrap`'s own
|
||||
`position: relative`, same anchor `@hive/shared/terminal.css`'s
|
||||
`.tail-pill` uses, which anchors bottom-right and so never competes for
|
||||
this edge. The row itself takes no pointer events, so the terminal
|
||||
`position: relative`. The row itself takes no pointer events, so the terminal
|
||||
under its empty middle still scrolls and selects; only the badges and
|
||||
the trigger do. `flex-wrap` on the badges rather than a fixed width —
|
||||
at small viewport widths wrapping beats clipping. */
|
||||
|
|
|
|||
|
|
@ -1,37 +1,24 @@
|
|||
// <AgentTermPreview> — the MVP mara's own ruling asked for: not a separate
|
||||
// page, a small preview in an opened agent card on `AgentsPage`, with
|
||||
// an `AgentInputForm` under an agent's terminal (a subagent's has none: it
|
||||
// <AgentTermPreview> — an agent's terminal: the preview in an opened card on
|
||||
// `AgentsPage` and the full tab (`fullHeight`, `AgentTerminalPage`), with an
|
||||
// `AgentInputForm` under an agent's own terminal (a subagent's has none: it
|
||||
// takes no input of its own). Consumes swarm-controller's
|
||||
// `GET /api/agents/{name}/term/stream`, or for a subagent
|
||||
// `GET /api/agents/{name}/subagents/{subagent}/term/stream`, via
|
||||
// `useSwarmTermStream`, rendering through the same `@hive/shared` `Row`
|
||||
// component the per-hive local terminal uses — "share components between hive and swarm level
|
||||
// term as much as possible" (mara).
|
||||
// `useSwarmTermStream`, and renders each row through the `@hive/shared` `Row`
|
||||
// component, the same one `MessagesPage` uses.
|
||||
//
|
||||
// **Floating header badges** — turn state / model / ctx parity
|
||||
// with the per-agent page's own `StatusChips` — mara: "dont make it a
|
||||
// header though - make it floating elements on top of the terminal", so
|
||||
// this is a small `Badge` cluster pinned to the terminal box's own
|
||||
// corner (`.terminal-wrap`'s `position: relative`, same anchor
|
||||
// `@hive/shared/terminal.css`'s `.tail-pill` already uses), not a
|
||||
// separate layout row. Read-only, no click targets: pause/resume already
|
||||
// has its own control surface (`WantedMenu` on `AgentsPage`), so nothing
|
||||
// here needs to be interactive. Sourced from `useSwarmAgentStateStream`,
|
||||
// not from `AgentRow` — the roster fetch `AgentsPage` already did has no
|
||||
// notion of turn_state/model/ctx, only `wanted`/`snapshot.running`.
|
||||
// Only the full-tab mount (`fullHeight`) shows the state badges: the small
|
||||
// preview in an opened card stays free of them (mara: "the preview is small
|
||||
// and should not be encroached further with badges on top, but for the full
|
||||
// screen term i want it like that"), and the card's overview lists the
|
||||
// same state in a row of its own (`AgentStateRow`).
|
||||
|
||||
// **Expand-to-fullscreen trigger** — opens/navigates to
|
||||
// `/agents/:name/terminal` (`AgentTerminalPage`) via `useDynamicTabs`,
|
||||
// same header-tab mechanism `Shell`'s own nav row now shares. Lives here
|
||||
// (not on `AgentsPage`) so both the embedded preview and the future full
|
||||
// page mount the identical trigger without either needing to know where
|
||||
// the other one is. Suppressed via `fullHeight` — the full-page mount
|
||||
// already IS the destination, so it has nothing further to expand to.
|
||||
// **Floating controls** — one row pinned over the terminal's top edge, so the
|
||||
// terminal keeps the whole box. On the left, the `leading` slot (the page's
|
||||
// own badges, or the connection light by default), a "reconnect" badge when
|
||||
// the stream closed, and, on the full tab, the state badges from
|
||||
// `useSwarmAgentStateStream` (turn state, model and effort, context) and the
|
||||
// cancel-turn badge. On the right, the expand trigger and the `trailing` slot.
|
||||
// The card preview shows no state badges: it is small, and the card's overview
|
||||
// lists the same state in `AgentStateRow`.
|
||||
//
|
||||
// **Expand trigger** — opens `/agents/:name/terminal` (`AgentTerminalPage`) as
|
||||
// a header tab through `useDynamicTabs`. The full tab is already the
|
||||
// destination, so it has no trigger.
|
||||
import { useLayoutEffect, useRef, useState } from "preact/hooks";
|
||||
import type { ComponentChildren } from "preact";
|
||||
import { Badge } from "@hive/shared/badge.js";
|
||||
|
|
|
|||
Loading…
Reference in a new issue