mara on #5034: "effort shares /models fate". The per-agent web UI no longer sets effort: the `/effort` slash command, the effort picker, `POST /api/effort`, `Bus::set_effort`, the `hyperhive-effort` writer, `EFFORT_LEVELS`/`is_valid_effort` and the ACP effort-list payload are gone, and `lib/modelEffort.ts` with them. The effort chip is display-only and shows its source (`effort_source` in `/api/state`); on ACP it stays hidden while the session offers no effort level. The read side is unchanged: with no swarm value an agent runs an existing `hyperhive-effort` file, else its agent.nix effort, else medium. Existing files are not touched. Refs #5034
26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
// Pause/resume POST to the *dashboard's* origin (hive-c0re, not this
|
|
// agent's own `/api/*`) — see dashboardBase.ts. `fetch` with
|
|
// `mode: 'no-cors'` rather than a normal request: the POST is cross-
|
|
// origin (behind the gateway this page and the dashboard share an
|
|
// origin, but accessed directly they're different ports) and this way
|
|
// hive-c0re doesn't need to grow CORS headers for it — the tradeoff is
|
|
// an opaque, unreadable response, which is fine here since the caller
|
|
// doesn't need to read it, only trigger a state refresh afterward. `credentials:
|
|
// 'include'` matches the cookie-sending behavior of the plain <form>
|
|
// submit this replaces.
|
|
//
|
|
// mara flagged: the previous version was a real `<form>` submit, which
|
|
// navigates the whole page to whatever hive-c0re's endpoint returns —
|
|
// here, the literal text "ok". Fire-and-forget `fetch` keeps the click
|
|
// on the agent page.
|
|
export async function submitPauseResume(
|
|
dashboardBase: string,
|
|
label: string,
|
|
verb: "pause" | "resume",
|
|
): Promise<void> {
|
|
await fetch(`${dashboardBase}api/${verb}/${label}`, {
|
|
method: "POST",
|
|
mode: "no-cors",
|
|
credentials: "include",
|
|
}).catch(() => {});
|
|
}
|