swarm-ui: the agent terminal page gets cancel turn, effort, state age and the expand-output setting
The per-agent page had these and the swarm terminal did not; they need no new backend. A cancel turn button beside send, shown while the agent is in a turn, posts to the controller's existing cancel route and says whether a turn was stopped. The terminal's badges add the effort and how long the agent has been in its turn state. The expand tool output setting moves to the shared package so both pages render the one component, and the swarm menu gets it. Docs follow.
This commit is contained in:
parent
81439fa710
commit
214d7000d3
2 changed files with 119 additions and 20 deletions
|
|
@ -12,7 +12,7 @@ import { useApplyMotionOverride } from "@hive/shared/motion-apply.js";
|
|||
import { Header } from "./components/Header.js";
|
||||
import { MetaNav } from "./components/MetaNav.js";
|
||||
import { AgentUserMenu } from "./components/AgentUserMenu.js";
|
||||
import { ExpandDetailsSetting } from "./components/ExpandDetailsSetting.js";
|
||||
import { ExpandDetailsSetting } from "@hive/shared/expand-details-setting.js";
|
||||
import { HideDebugSetting } from "@hive/shared/hide-debug-setting.js";
|
||||
import { StatusChips } from "./components/StatusChips.js";
|
||||
import { LiveStream, type LiveStreamHandle } from "./components/LiveStream.js";
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
// Agent-terminal-only settings-menu row: "expand tool output panels".
|
||||
// Rendered as a `<SettingsMenu>` child (`@hive/shared/settings-menu.js`)
|
||||
// rather than a prop on that shared component — `SettingsMenu` is also
|
||||
// used by swarm-ui, which has no terminal to apply this to, and a prior
|
||||
// attempt to gate it behind a boolean prop (`showExpandDetails`) on the
|
||||
// shared component drew mara's review: "you cannot just add it like
|
||||
// this - if we have more and more options there in different places we
|
||||
// will keep accumulating cruft in the shared component." This file owns
|
||||
// its own state/storage entirely; `SettingsMenu` just renders it as a
|
||||
// child, no different from any other consumer's markup.
|
||||
import { useState } from "preact/hooks";
|
||||
import {
|
||||
getExpandDetailsPref,
|
||||
setExpandDetailsPref,
|
||||
} from "@hive/shared/prefs.js";
|
||||
|
||||
export function ExpandDetailsSetting() {
|
||||
// Plain localStorage read, not a hook-managed override like
|
||||
// theme/motion — `getExpandDetailsPref`/`setExpandDetailsPref`
|
||||
// (`@hive/shared/prefs.js`) are the existing shared-storage-key pair
|
||||
// the terminal itself already reads live (no round-trip needed here
|
||||
// beyond re-rendering this row's own checkbox state on toggle).
|
||||
const [expandDetails, setExpandDetailsState] = useState(() =>
|
||||
getExpandDetailsPref(),
|
||||
);
|
||||
return (
|
||||
<label class="settings-menu-row">
|
||||
<span>expand tool output</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={expandDetails}
|
||||
onChange={(e) => {
|
||||
const v = (e.target as HTMLInputElement).checked;
|
||||
setExpandDetailsPref(v);
|
||||
setExpandDetailsState(v);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue