refactor(console): remove hosted-context command blocking from Hermes Console (#66144)

The dashboard console previously ran under a 'hosted' context that
blocked most commands (auth add, config set model.*, mcp add --command,
cron --script, ...) behind an allowlist + line-policy layer. With the
full Hermes CLI now built into the dashboard, that policy layer is
redundant gatekeeping: the console gets the same command surface
everywhere.

Removed:
- ConsoleContext/contexts plumbing on ConsoleCommand + engine
- EXPECTED_HOSTED_PATHS allowlist + _mark_hosted
- _enforce_hosted_line_policy + HOSTED_CONFIG_* allow/block tables
- _dashboard_console_context() and the context field on the ready frame
- hosted-context tests; context badge in HermesConsoleModal

Kept (mechanical, not policy): shell-syntax rejection, the
interactive/server command blocks (gateway, dashboard, mcp serve, ...),
mutating-command confirmations, output caps, and command timeouts.
This commit is contained in:
Teknium 2026-07-17 04:33:34 -07:00 committed by GitHub
parent 60419dfb4b
commit 6dcbcd0277
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 467 deletions

View file

@ -17,7 +17,6 @@ import { useTheme } from "@/themes";
type ConsoleFrame =
| {
type: "ready";
context?: string;
profile?: string;
prompt?: string;
}
@ -113,7 +112,6 @@ export function HermesConsoleModal({ open, onClose }: HermesConsoleModalProps) {
const hasReadyFrameRef = useRef(false);
const [connectionState, setConnectionState] =
useState<ConnectionState>("connecting");
const [consoleContext, setConsoleContext] = useState("pending");
const [consoleProfile, setConsoleProfile] = useState("current");
const { profile } = useProfileScope();
const { theme } = useTheme();
@ -278,7 +276,6 @@ export function HermesConsoleModal({ open, onClose }: HermesConsoleModalProps) {
promptRef.current = nextPrompt;
inputPromptRef.current = nextPrompt;
hasReadyFrameRef.current = true;
setConsoleContext(frame.context || "local");
setConsoleProfile(frame.profile || "current");
activeCommandRef.current = false;
setConnectionState("ready");
@ -395,7 +392,6 @@ export function HermesConsoleModal({ open, onClose }: HermesConsoleModalProps) {
const dataDisposable = term.onData(handleInputData);
setConnectionState("connecting");
setConsoleContext("pending");
setConsoleProfile(profile || "current");
hasReadyFrameRef.current = false;
writeLine(term, "\x1b[2mConnecting to Hermes Console...\x1b[0m");
@ -511,7 +507,6 @@ export function HermesConsoleModal({ open, onClose }: HermesConsoleModalProps) {
</h2>
<div className="mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
<Badge tone={statusTone}>{connectionState}</Badge>
<span className="font-mono">{consoleContext}</span>
<span className="font-mono">{consoleProfile}</span>
</div>
</div>