Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/agent/src/lib/termActions.ts
iris 23f4f1823b hive-agent: the per-agent page has no message box; its send route and the broker's operator message are removed
The page's composer (its input, slash commands and completion), POST /send in
hive-agent, the OperatorMsg request of the agent socket and its handler in
hive-c0re, and the broker-error helper only the send route used are deleted:
writing to an agent is the swarm UI's terminal. cancel turn, new session and
log out stay in the state badge's menu; POST /api/compact stays, with nothing
on the page calling it. The request-line limit keeps its size, and its comment
says it is a generous bound now. The docs describe the actions in place of the
footer and the prompt.
2026-11-06 01:13:44 +01:00

29 lines
896 B
TypeScript

// Same-origin fetch POST helpers for the state badge's actions
// ({ ok, detail } rather than throwing).
async function post(path: string): Promise<{ ok: boolean; detail?: string }> {
try {
const resp = await fetch(path, {
method: "POST",
redirect: "manual",
});
const ok =
resp.ok ||
resp.type === "opaqueredirect" ||
(resp.status >= 200 && resp.status < 400);
if (ok) return { ok: true };
const detail = await resp.text().catch(() => "");
return {
ok: false,
detail: `http ${resp.status}${detail ? " — " + detail : ""}`,
};
} catch (err) {
return {
ok: false,
detail: err instanceof Error ? err.message : String(err),
};
}
}
export const postCancelTurn = () => post("api/cancel");
export const postNewSession = () => post("api/new-session");
export const postLogout = () => post("api/logout");