swarm ui: show agent freshness and failures where the operator looks, page titles, try again, and stale-data notes
An agent card shows its freshness (stale with the last report's age, never reported, not in swarm identity) when it is not fresh, so the status filter has a visible reason. A failed state change shows its reason in a panel under the card, and a failed cancel shows its reason in the badge, instead of a hover title. Pages can set their title (usePageTitle) and the flow editor does, so several editor tabs differ; the 404 links home. The claude login dialog offers try again after a failure, announces its wait, and has a per-agent field id. The create-agent tabs go forward again as far as the operator has been, but not past a step that is invalid now (lastReachableStep, tested), and the disabled next and create buttons say why in a hint they are described by. usePolled reports when the last live answer arrived, and StaleNote says how old a list is under a failed refresh, or that it is the answer saved from the last visit, on the alerts, builds, review runs, hives, schedules and flows lists.
This commit is contained in:
parent
e4cfac6926
commit
679d2ee420
21 changed files with 321 additions and 25 deletions
|
|
@ -43,7 +43,10 @@ Everything it shows comes from [`swarm-controller`](../../../swarm-controller/RE
|
||||||
Pages that refresh on a timer share one polling rule: the page sends no new
|
Pages that refresh on a timer share one polling rule: the page sends no new
|
||||||
request while the last one is still running, so an older answer never overtakes
|
request while the last one is still running, so an older answer never overtakes
|
||||||
a slow one, and a failed refresh keeps the rows already on screen under an
|
a slow one, and a failed refresh keeps the rows already on screen under an
|
||||||
error. While a page is fetching, its refresh picker shows a spinner in place of
|
error. A list that isn't live says so: under a failed refresh it reads "showing the
|
||||||
|
last answer, from" and the time, and a page opened on the answer saved from the last
|
||||||
|
visit says that until a fresh one arrives (the alerts, builds, review runs, hives,
|
||||||
|
schedules and flows lists). While a page is fetching, its refresh picker shows a spinner in place of
|
||||||
the clock, for at least 0.4 seconds so a quick answer still reads as a refresh.
|
the clock, for at least 0.4 seconds so a quick answer still reads as a refresh.
|
||||||
On a folded card (jobs, builds, hives) the picker sits in the card's header, left of the
|
On a folded card (jobs, builds, hives) the picker sits in the card's header, left of the
|
||||||
chevron, and shows once the card is open; selecting it doesn't fold the card.
|
chevron, and shows once the card is open; selecting it doesn't fold the card.
|
||||||
|
|
@ -72,7 +75,8 @@ An agent created here or with `swarmctl agent create` starts `paused`; set it
|
||||||
`up` from its card. A card shows **login needed** when the agent's own
|
`up` from its card. A card shows **login needed** when the agent's own
|
||||||
turn-state header says its claude has no session, and a **log in** button
|
turn-state header says its claude has no session, and a **log in** button
|
||||||
that runs the claude login from a dialog: open the URL it shows, then paste
|
that runs the claude login from a dialog: open the URL it shows, then paste
|
||||||
the code back. When the secret store has the login, the dialog closes and a
|
the code back. A failed login offers **try again** in the same dialog. When the
|
||||||
|
secret store has the login, the dialog closes and a
|
||||||
short toast in the top-right corner says so. The credentials go to the agent through the secret store
|
short toast in the top-right corner says so. The credentials go to the agent through the secret store
|
||||||
([`claude-login.md`](../../2-handbook/swarm/claude-login.md)). The agent's own web UI login still
|
([`claude-login.md`](../../2-handbook/swarm/claude-login.md)). The agent's own web UI login still
|
||||||
works too. The settings section of an opened card has a **claude login** row: when
|
works too. The settings section of an opened card has a **claude login** row: when
|
||||||
|
|
@ -80,6 +84,11 @@ the swarm stored the agent's login, or that none is, with a **log in** button
|
||||||
(**log in again** when the swarm holds one) that opens the same dialog, and a **delete
|
(**log in again** when the swarm holds one) that opens the same dialog, and a **delete
|
||||||
login** action that asks first.
|
login** action that asks first.
|
||||||
|
|
||||||
|
A card shows its freshness when the agent isn't **fresh**: **stale** with how long ago the hive last
|
||||||
|
reported it, **never reported**, or **not in swarm identity**. A fresh agent shows nothing, so the
|
||||||
|
badge is the reason a card matched the status filter. A failed state change shows its reason in a panel
|
||||||
|
under the card's header, not in a hover title.
|
||||||
|
|
||||||
A card shows **updating** when the agent's status snapshot has `updating` set.
|
A card shows **updating** when the agent's status snapshot has `updating` set.
|
||||||
The hive sets it when an update stops a running container and clears it when
|
The hive sets it when an update stops a running container and clears it when
|
||||||
the tail reconcile or start settles the agent, whether the container came back
|
the tail reconcile or start settles the agent, whether the container came back
|
||||||
|
|
@ -537,7 +546,7 @@ error and the agent gets nothing.
|
||||||
While the agent is in a turn, a **cancel turn** badge appears among the state
|
While the agent is in a turn, a **cancel turn** badge appears among the state
|
||||||
badges over the terminal, in its own tab. It asks the agent's harness to stop
|
badges over the terminal, in its own tab. It asks the agent's harness to stop
|
||||||
the turn, then shows whether one was running ("turn cancelled" or "nothing was
|
the turn, then shows whether one was running ("turn cancelled" or "nothing was
|
||||||
running"); a failure shows "cancel failed" with the reason on hover, and a click
|
running"); a failure shows "cancel failed: " and the reason in the badge, and a click
|
||||||
tries again. Subagents have no message box and no cancel badge.
|
tries again. Subagents have no message box and no cancel badge.
|
||||||
|
|
||||||
The message doesn't go through the agent's hive, so the hive dashboard's
|
The message doesn't go through the agent's hive, so the hive dashboard's
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
// Root shell component — routing only. Each route's content is its own
|
// Root shell component — routing only. Each route's content is its own
|
||||||
// page component under `./pages/`; this file just maps paths to them.
|
// page component under `./pages/`; this file just maps paths to them.
|
||||||
import { Redirect, Route, Router, Switch, useSearch } from "wouter-preact";
|
import {
|
||||||
|
Link,
|
||||||
|
Redirect,
|
||||||
|
Route,
|
||||||
|
Router,
|
||||||
|
Switch,
|
||||||
|
useSearch,
|
||||||
|
} from "wouter-preact";
|
||||||
import { MOVED_ROUTES, movedHref } from "./shell/routes.js";
|
import { MOVED_ROUTES, movedHref } from "./shell/routes.js";
|
||||||
import { Shell } from "./shell/Shell.js";
|
import { Shell } from "./shell/Shell.js";
|
||||||
import { useGuardedLocation } from "./shell/useGuardedLocation.js";
|
import { useGuardedLocation } from "./shell/useGuardedLocation.js";
|
||||||
|
|
@ -28,6 +35,9 @@ function NotFound() {
|
||||||
return (
|
return (
|
||||||
<Panel title="404" icon="🧭">
|
<Panel title="404" icon="🧭">
|
||||||
<p>no route here.</p>
|
<p>no route here.</p>
|
||||||
|
<p>
|
||||||
|
<Link href="/">back to the start page</Link>
|
||||||
|
</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ export function ClaudeLoginDialog({
|
||||||
}) {
|
}) {
|
||||||
const [step, setStep] = useState<LoginStep>({ step: "starting" });
|
const [step, setStep] = useState<LoginStep>({ step: "starting" });
|
||||||
const [code, setCode] = useState("");
|
const [code, setCode] = useState("");
|
||||||
|
// Bumped by "try again": the effect below starts a new login for it.
|
||||||
|
const [attempt, setAttempt] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let live = true;
|
let live = true;
|
||||||
|
|
@ -65,7 +67,13 @@ export function ClaudeLoginDialog({
|
||||||
return () => {
|
return () => {
|
||||||
live = false;
|
live = false;
|
||||||
};
|
};
|
||||||
}, [agent]);
|
}, [agent, attempt]);
|
||||||
|
|
||||||
|
function tryAgain() {
|
||||||
|
setCode("");
|
||||||
|
setStep({ step: "starting" });
|
||||||
|
setAttempt((n) => n + 1);
|
||||||
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
if (leavesLoginRunning(step)) {
|
if (leavesLoginRunning(step)) {
|
||||||
|
|
@ -104,7 +112,7 @@ export function ClaudeLoginDialog({
|
||||||
return (
|
return (
|
||||||
<Dialog open onClose={close} label={`log ${agent} in to claude`} plain>
|
<Dialog open onClose={close} label={`log ${agent} in to claude`} plain>
|
||||||
<Panel title={`log in to claude — ${agent}`} icon="🔑" onClose={close}>
|
<Panel title={`log in to claude — ${agent}`} icon="🔑" onClose={close}>
|
||||||
{step.step === "starting" && <p>starting the login…</p>}
|
{step.step === "starting" && <p role="status">starting the login…</p>}
|
||||||
{(step.step === "code" || step.step === "submitting") && (
|
{(step.step === "code" || step.step === "submitting") && (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -114,7 +122,7 @@ export function ClaudeLoginDialog({
|
||||||
</p>
|
</p>
|
||||||
<FormStack onSubmit={submit}>
|
<FormStack onSubmit={submit}>
|
||||||
<TextField
|
<TextField
|
||||||
id="claude-login-code"
|
id={`claude-login-code-${agent}`}
|
||||||
label="code"
|
label="code"
|
||||||
value={code}
|
value={code}
|
||||||
required
|
required
|
||||||
|
|
@ -131,10 +139,13 @@ export function ClaudeLoginDialog({
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{step.step === "failed" && (
|
{step.step === "failed" && (
|
||||||
|
<>
|
||||||
<ApiErrorPanel
|
<ApiErrorPanel
|
||||||
context="the claude login failed; close and start again"
|
context="the claude login failed"
|
||||||
problem={step.problem}
|
problem={step.problem}
|
||||||
/>
|
/>
|
||||||
|
<Button onClick={tryAgain}>try again</Button>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Panel>
|
</Panel>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
// `<button>`s) from also toggling the card. The wanted menu carries the destroy
|
// `<button>`s) from also toggling the card. The wanted menu carries the destroy
|
||||||
// option here, since no detail row repeats it any more.
|
// option here, since no detail row repeats it any more.
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
|
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||||
import { Badge } from "@hive/shared/badge.js";
|
import { Badge } from "@hive/shared/badge.js";
|
||||||
import { TerminalIcon } from "@hive/shared/icons.js";
|
import { TerminalIcon } from "@hive/shared/icons.js";
|
||||||
import { Card } from "../../ui/card/Card.js";
|
import { Card } from "../../ui/card/Card.js";
|
||||||
|
|
@ -23,7 +24,9 @@ import { ClaudeLoginDialog } from "../claude-login/ClaudeLoginDialog.js";
|
||||||
import { AgentDetail } from "../detail/AgentDetail.js";
|
import { AgentDetail } from "../detail/AgentDetail.js";
|
||||||
import { StatusMessage } from "../detail/StatusMessage.js";
|
import { StatusMessage } from "../detail/StatusMessage.js";
|
||||||
import { termPaths } from "../terminal/term-paths.js";
|
import { termPaths } from "../terminal/term-paths.js";
|
||||||
|
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||||
import {
|
import {
|
||||||
|
FRESHNESS,
|
||||||
hivePauseReason,
|
hivePauseReason,
|
||||||
isUpdating,
|
isUpdating,
|
||||||
showsLoginNeeded,
|
showsLoginNeeded,
|
||||||
|
|
@ -67,6 +70,30 @@ export function AgentCard({
|
||||||
name={<span class="ui-agent-card-name">{row.name}</span>}
|
name={<span class="ui-agent-card-name">{row.name}</span>}
|
||||||
status={
|
status={
|
||||||
<>
|
<>
|
||||||
|
{row.freshness !== "fresh" ? (
|
||||||
|
<Badge
|
||||||
|
tone={FRESHNESS[row.freshness].tone}
|
||||||
|
title={
|
||||||
|
row.freshness === "unknown"
|
||||||
|
? "reported by its hive but not registered in swarm-level identity — needs migration"
|
||||||
|
: row.freshness === "stale"
|
||||||
|
? "the hive has not reported this agent lately"
|
||||||
|
: "the hive has never reported this agent"
|
||||||
|
}
|
||||||
|
value={
|
||||||
|
<>
|
||||||
|
{FRESHNESS[row.freshness].label}
|
||||||
|
{row.freshness === "stale" &&
|
||||||
|
row.last_seen_unix !== null ? (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
(<RelativeTime epochMs={row.last_seen_unix * 1000} />)
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{isUpdating(row) ? (
|
{isUpdating(row) ? (
|
||||||
<Badge
|
<Badge
|
||||||
tone="accent"
|
tone="accent"
|
||||||
|
|
@ -127,18 +154,17 @@ export function AgentCard({
|
||||||
onSelectPaused={actions.selectPaused}
|
onSelectPaused={actions.selectPaused}
|
||||||
onDestroy={actions.requestDestroy}
|
onDestroy={actions.requestDestroy}
|
||||||
/>
|
/>
|
||||||
{error ? (
|
|
||||||
<Badge
|
|
||||||
tone="negative"
|
|
||||||
value="failed"
|
|
||||||
title={error.detail ?? "the declaration failed"}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
message={<StatusMessage snapshot={row.snapshot} />}
|
message={<StatusMessage snapshot={row.snapshot} />}
|
||||||
chevron={<span class="ui-agent-card-chevron" aria-hidden="true" />}
|
chevron={<span class="ui-agent-card-chevron" aria-hidden="true" />}
|
||||||
/>
|
/>
|
||||||
|
{error ? (
|
||||||
|
<ApiErrorPanel
|
||||||
|
context={`changing ${row.name}'s state failed`}
|
||||||
|
problem={error}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{open ? (
|
{open ? (
|
||||||
<div class="ui-agent-card-detail">
|
<div class="ui-agent-card-detail">
|
||||||
<AgentDetail row={row} actions={actions} withTerminal inCard />
|
<AgentDetail row={row} actions={actions} withTerminal inCard />
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ export function CancelTurnBadge({
|
||||||
return (
|
return (
|
||||||
<Badge
|
<Badge
|
||||||
tone="negative"
|
tone="negative"
|
||||||
value="cancel failed"
|
value={`cancel failed: ${state.detail}`}
|
||||||
title={state.detail}
|
title="try cancelling again"
|
||||||
onClick={cancel}
|
onClick={cancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../ui/refresh-interval/RefreshInterval.js";
|
} from "../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../ui/polled/StaleNote.js";
|
||||||
import { Table, type TableColumn } from "../ui/table/Table.js";
|
import { Table, type TableColumn } from "../ui/table/Table.js";
|
||||||
import { TableSkeleton } from "../ui/table/TableSkeleton.js";
|
import { TableSkeleton } from "../ui/table/TableSkeleton.js";
|
||||||
import { Toolbar } from "../ui/toolbar/Toolbar.js";
|
import { Toolbar } from "../ui/toolbar/Toolbar.js";
|
||||||
|
|
@ -81,6 +82,7 @@ function AlertsBody() {
|
||||||
const {
|
const {
|
||||||
data: alerts,
|
data: alerts,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing,
|
refreshing,
|
||||||
} = usePolled(
|
} = usePolled(
|
||||||
intervalMs,
|
intervalMs,
|
||||||
|
|
@ -114,6 +116,11 @@ function AlertsBody() {
|
||||||
problem={error}
|
problem={error}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={alerts !== null}
|
||||||
|
/>
|
||||||
{!error && alerts === null ? (
|
{!error && alerts === null ? (
|
||||||
<TableSkeleton columns={COLUMNS} label="the alerts" />
|
<TableSkeleton columns={COLUMNS} label="the alerts" />
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ import {
|
||||||
} from "./CreateAgentAgentsMd.js";
|
} from "./CreateAgentAgentsMd.js";
|
||||||
import {
|
import {
|
||||||
NAME_PATTERN,
|
NAME_PATTERN,
|
||||||
|
lastReachableStep,
|
||||||
nextStep,
|
nextStep,
|
||||||
previousStep,
|
previousStep,
|
||||||
STEP_TITLES,
|
STEP_TITLES,
|
||||||
|
|
@ -285,6 +286,32 @@ export function CreateAgentForm({
|
||||||
});
|
});
|
||||||
const done = result.status === "done";
|
const done = result.status === "done";
|
||||||
const at = STEPS.indexOf(step);
|
const at = STEPS.indexOf(step);
|
||||||
|
// The tabs go forward again as far as the operator has been, as long as the
|
||||||
|
// steps before are still valid.
|
||||||
|
const [reached, setReached] = useState(0);
|
||||||
|
useEffect(() => {
|
||||||
|
setReached((r) => Math.max(r, at));
|
||||||
|
}, [at]);
|
||||||
|
const firstBad = STEPS.findIndex(
|
||||||
|
(s) =>
|
||||||
|
stepProblem(s, {
|
||||||
|
name,
|
||||||
|
hive,
|
||||||
|
permissionsReady: catalogue !== null,
|
||||||
|
inferenceProblem,
|
||||||
|
}) !== null,
|
||||||
|
);
|
||||||
|
const lastTab = lastReachableStep(reached, firstBad, at);
|
||||||
|
// Why the primary button is off, said in words.
|
||||||
|
const createProblem =
|
||||||
|
step === "summary" && result.status !== "submitting"
|
||||||
|
? !hivesReady
|
||||||
|
? "the hive list has not loaded"
|
||||||
|
: !catalogue
|
||||||
|
? "the permission list has not loaded"
|
||||||
|
: null
|
||||||
|
: null;
|
||||||
|
const shownProblem = problem ?? createProblem;
|
||||||
|
|
||||||
// Enter goes on to the next step, and creates only from the summary.
|
// Enter goes on to the next step, and creates only from the summary.
|
||||||
function onSubmit(e: Event) {
|
function onSubmit(e: Event) {
|
||||||
|
|
@ -314,7 +341,7 @@ export function CreateAgentForm({
|
||||||
type="button"
|
type="button"
|
||||||
class={`create-agent-step-tab${s === step ? " create-agent-step-current" : ""}`}
|
class={`create-agent-step-tab${s === step ? " create-agent-step-current" : ""}`}
|
||||||
aria-current={s === step ? "step" : undefined}
|
aria-current={s === step ? "step" : undefined}
|
||||||
disabled={i > at || done}
|
disabled={i > lastTab || done}
|
||||||
onClick={() => setStep(s)}
|
onClick={() => setStep(s)}
|
||||||
>
|
>
|
||||||
{i + 1}. {STEP_TITLES[s]}
|
{i + 1}. {STEP_TITLES[s]}
|
||||||
|
|
@ -555,9 +582,14 @@ export function CreateAgentForm({
|
||||||
>
|
>
|
||||||
back
|
back
|
||||||
</Button>
|
</Button>
|
||||||
{problem !== null && (step !== "identity" || name !== "") && (
|
{shownProblem !== null && (
|
||||||
<Hint as="span" role="status" class="create-agent-hint">
|
<Hint
|
||||||
{problem}
|
as="span"
|
||||||
|
role="status"
|
||||||
|
class="create-agent-hint"
|
||||||
|
id="create-agent-hint"
|
||||||
|
>
|
||||||
|
{shownProblem}
|
||||||
</Hint>
|
</Hint>
|
||||||
)}
|
)}
|
||||||
{step === "summary" ? (
|
{step === "summary" ? (
|
||||||
|
|
@ -567,6 +599,9 @@ export function CreateAgentForm({
|
||||||
disabled={
|
disabled={
|
||||||
result.status === "submitting" || !hivesReady || !catalogue
|
result.status === "submitting" || !hivesReady || !catalogue
|
||||||
}
|
}
|
||||||
|
describedBy={
|
||||||
|
createProblem !== null ? "create-agent-hint" : undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{result.status === "submitting" ? "creating…" : "create"}
|
{result.status === "submitting" ? "creating…" : "create"}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -575,6 +610,9 @@ export function CreateAgentForm({
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={problem !== null}
|
disabled={problem !== null}
|
||||||
|
describedBy={
|
||||||
|
problem !== null ? "create-agent-hint" : undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
next
|
next
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,21 @@ export function stepProblem(step: Step, input: StepInputs): string | null {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last step a tab can go to. The tabs reach as far as the operator has
|
||||||
|
* got (`reached`, an index into `STEPS`), but not past a step whose inputs are
|
||||||
|
* not valid now (`firstBad`, its index, or -1 for none), and never behind the
|
||||||
|
* current step (`at`).
|
||||||
|
*/
|
||||||
|
export function lastReachableStep(
|
||||||
|
reached: number,
|
||||||
|
firstBad: number,
|
||||||
|
at: number,
|
||||||
|
): number {
|
||||||
|
const limit = firstBad === -1 ? reached : Math.min(reached, firstBad);
|
||||||
|
return Math.max(limit, at);
|
||||||
|
}
|
||||||
|
|
||||||
/** One line of the summary: a setting and what will be sent for it. */
|
/** One line of the summary: a setting and what will be sent for it. */
|
||||||
export interface SummaryRow {
|
export interface SummaryRow {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../../ui/polled/StaleNote.js";
|
||||||
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||||
import { durationLabel } from "../../util.js";
|
import { durationLabel } from "../../util.js";
|
||||||
import {
|
import {
|
||||||
|
|
@ -100,6 +101,7 @@ function BuildsBody() {
|
||||||
const {
|
const {
|
||||||
data: runs,
|
data: runs,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing,
|
refreshing,
|
||||||
} = usePolled(intervalMs, (signal) => fetchJson<BuildRun[]>(RUNS, signal), {
|
} = usePolled(intervalMs, (signal) => fetchJson<BuildRun[]>(RUNS, signal), {
|
||||||
cacheKey: "builds",
|
cacheKey: "builds",
|
||||||
|
|
@ -153,6 +155,11 @@ function BuildsBody() {
|
||||||
problem={error}
|
problem={error}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={runs !== null}
|
||||||
|
/>
|
||||||
{missing ? (
|
{missing ? (
|
||||||
<Hint role="status">
|
<Hint role="status">
|
||||||
the build in this link is no longer listed: the builder keeps only its
|
the build in this link is no longer listed: the builder keeps only its
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
// were changed elsewhere, and the editor offers to reload or to keep the draft
|
// were changed elsewhere, and the editor offers to reload or to keep the draft
|
||||||
// on top of the latest.
|
// on top of the latest.
|
||||||
import { useCallback, useEffect, useState } from "preact/hooks";
|
import { useCallback, useEffect, useState } from "preact/hooks";
|
||||||
|
import { usePageTitle } from "../../shell/page-title.js";
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
useLocation,
|
useLocation,
|
||||||
|
|
@ -76,6 +77,7 @@ export function FlowEditorPage({
|
||||||
// With `from` an archetype flow: the one agent this copy is for.
|
// With `from` an archetype flow: the one agent this copy is for.
|
||||||
const agent = search.get("agent");
|
const agent = search.get("agent");
|
||||||
const [, navigate] = useLocation();
|
const [, navigate] = useLocation();
|
||||||
|
usePageTitle(isNew ? "new flow" : `flow ${flowId}`);
|
||||||
const [view, setView] = useState<FlowsView | null>(null);
|
const [view, setView] = useState<FlowsView | null>(null);
|
||||||
const [draft, setDraft] = useState<Flow | null>(null);
|
const [draft, setDraft] = useState<Flow | null>(null);
|
||||||
// What a new draft started as, so leaving it untouched is not "unsaved".
|
// What a new draft started as, so leaving it untouched is not "unsaved".
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../../ui/polled/StaleNote.js";
|
||||||
import { Deliveries, DeliveriesSkeleton } from "./Deliveries.js";
|
import { Deliveries, DeliveriesSkeleton } from "./Deliveries.js";
|
||||||
import { FlowListSkeleton } from "./FlowListSkeleton.js";
|
import { FlowListSkeleton } from "./FlowListSkeleton.js";
|
||||||
import { NEW_FLOW_PATH, withMembersAs } from "./FlowDraft.js";
|
import { NEW_FLOW_PATH, withMembersAs } from "./FlowDraft.js";
|
||||||
|
|
@ -45,6 +46,7 @@ export function NotificationRouter() {
|
||||||
const {
|
const {
|
||||||
data: view,
|
data: view,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing: flowsRefreshing,
|
refreshing: flowsRefreshing,
|
||||||
refresh,
|
refresh,
|
||||||
} = usePolled(intervalMs, (signal) =>
|
} = usePolled(intervalMs, (signal) =>
|
||||||
|
|
@ -126,6 +128,11 @@ export function NotificationRouter() {
|
||||||
{error ? (
|
{error ? (
|
||||||
<ApiErrorPanel context="failed to load the flows" problem={error} />
|
<ApiErrorPanel context="failed to load the flows" problem={error} />
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={view !== null}
|
||||||
|
/>
|
||||||
{actionError ? (
|
{actionError ? (
|
||||||
<ApiErrorPanel
|
<ApiErrorPanel
|
||||||
context="the flows were not changed"
|
context="the flows were not changed"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../../ui/polled/StaleNote.js";
|
||||||
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||||
import { TryOutResult } from "../review-common/TryOutResult.js";
|
import { TryOutResult } from "../review-common/TryOutResult.js";
|
||||||
import { durationLabel } from "../../util.js";
|
import { durationLabel } from "../../util.js";
|
||||||
|
|
@ -97,6 +98,7 @@ export function ReviewRuns() {
|
||||||
const {
|
const {
|
||||||
data: runs,
|
data: runs,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing,
|
refreshing,
|
||||||
} = usePolled(
|
} = usePolled(
|
||||||
intervalMs,
|
intervalMs,
|
||||||
|
|
@ -136,6 +138,11 @@ export function ReviewRuns() {
|
||||||
{error ? (
|
{error ? (
|
||||||
<ApiErrorPanel context="the runs could not be loaded" problem={error} />
|
<ApiErrorPanel context="the runs could not be loaded" problem={error} />
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={runs !== null}
|
||||||
|
/>
|
||||||
{runs !== null && runs.length === 0 && !error ? (
|
{runs !== null && runs.length === 0 && !error ? (
|
||||||
<EmptyState>No runs yet.</EmptyState>
|
<EmptyState>No runs yet.</EmptyState>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../../ui/polled/StaleNote.js";
|
||||||
import type { TableColumn } from "../../ui/table/Table.js";
|
import type { TableColumn } from "../../ui/table/Table.js";
|
||||||
import type { AgentRow } from "../../agent/AgentTypes.js";
|
import type { AgentRow } from "../../agent/AgentTypes.js";
|
||||||
import { ScheduleCard, ScheduleListSkeleton } from "./ScheduleCard.js";
|
import { ScheduleCard, ScheduleListSkeleton } from "./ScheduleCard.js";
|
||||||
|
|
@ -64,6 +65,7 @@ function SchedulesBody() {
|
||||||
const {
|
const {
|
||||||
data: schedules,
|
data: schedules,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing: schedulesRefreshing,
|
refreshing: schedulesRefreshing,
|
||||||
refresh,
|
refresh,
|
||||||
} = usePolled(intervalMs, (signal) =>
|
} = usePolled(intervalMs, (signal) =>
|
||||||
|
|
@ -180,6 +182,11 @@ function SchedulesBody() {
|
||||||
{error ? (
|
{error ? (
|
||||||
<ApiErrorPanel context="failed to load the schedules" problem={error} />
|
<ApiErrorPanel context="failed to load the schedules" problem={error} />
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={schedules !== null}
|
||||||
|
/>
|
||||||
{actionError ? (
|
{actionError ? (
|
||||||
<ApiErrorPanel
|
<ApiErrorPanel
|
||||||
context="the schedule was not changed"
|
context="the schedule was not changed"
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import {
|
||||||
type RefreshIntervalMs,
|
type RefreshIntervalMs,
|
||||||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||||
|
import { StaleNote } from "../../ui/polled/StaleNote.js";
|
||||||
import { Table, type TableColumn } from "../../ui/table/Table.js";
|
import { Table, type TableColumn } from "../../ui/table/Table.js";
|
||||||
import { TableSkeleton } from "../../ui/table/TableSkeleton.js";
|
import { TableSkeleton } from "../../ui/table/TableSkeleton.js";
|
||||||
import { domainCell } from "../hive-domain.js";
|
import { domainCell } from "../hive-domain.js";
|
||||||
|
|
@ -116,6 +117,7 @@ function HiveRoster() {
|
||||||
const {
|
const {
|
||||||
data: hives,
|
data: hives,
|
||||||
error,
|
error,
|
||||||
|
updatedAt,
|
||||||
refreshing,
|
refreshing,
|
||||||
} = usePolled(
|
} = usePolled(
|
||||||
intervalMs,
|
intervalMs,
|
||||||
|
|
@ -136,6 +138,11 @@ function HiveRoster() {
|
||||||
{error ? (
|
{error ? (
|
||||||
<ApiErrorPanel context="failed to load the hives" problem={error} />
|
<ApiErrorPanel context="failed to load the hives" problem={error} />
|
||||||
) : null}
|
) : null}
|
||||||
|
<StaleNote
|
||||||
|
updatedAt={updatedAt}
|
||||||
|
failed={error !== null}
|
||||||
|
hasData={hives !== null}
|
||||||
|
/>
|
||||||
{!error && hives === null ? (
|
{!error && hives === null ? (
|
||||||
<TableSkeleton columns={COLUMNS} label="the hives" />
|
<TableSkeleton columns={COLUMNS} label="the hives" />
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
import { useEffect, useRef, useState } from "preact/hooks";
|
import { useEffect, useRef, useState } from "preact/hooks";
|
||||||
import type { ComponentChildren } from "preact";
|
import type { ComponentChildren } from "preact";
|
||||||
import { Link, useLocation } from "wouter-preact";
|
import { Link, useLocation } from "wouter-preact";
|
||||||
|
import { usePageTitleValue } from "./page-title.js";
|
||||||
import { LinksMenu } from "./LinksMenu.js";
|
import { LinksMenu } from "./LinksMenu.js";
|
||||||
import { UserMenu } from "./UserMenu.js";
|
import { UserMenu } from "./UserMenu.js";
|
||||||
import { useHideDebug } from "./useHideDebug.js";
|
import { useHideDebug } from "./useHideDebug.js";
|
||||||
|
|
@ -408,7 +409,9 @@ export function Shell({ children }: { children: ComponentChildren }) {
|
||||||
// top-level route takes its nav label, a terminal route takes the
|
// top-level route takes its nav label, a terminal route takes the
|
||||||
// label its page registered as a dynamic tab. An unmatched path gets
|
// label its page registered as a dynamic tab. An unmatched path gets
|
||||||
// the bare brand.
|
// the bare brand.
|
||||||
|
const pageTitle = usePageTitleValue();
|
||||||
const pageLabel =
|
const pageLabel =
|
||||||
|
pageTitle ??
|
||||||
navItems.find((item) => item.href === location)?.label ??
|
navItems.find((item) => item.href === location)?.label ??
|
||||||
tabs.find((tab) => tab.href === location)?.label;
|
tabs.find((tab) => tab.href === location)?.label;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
44
frontend/packages/swarm-ui/src/shell/page-title.ts
Normal file
44
frontend/packages/swarm-ui/src/shell/page-title.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
// The title a page gives itself, for the browser tab and the page's heading: for
|
||||||
|
// a route the shell cannot name from its nav items or open tabs, such as the
|
||||||
|
// flow editor, where several tabs would otherwise all read as the bare brand.
|
||||||
|
// A page calls `usePageTitle("flow fan-out")`; the shell reads it with
|
||||||
|
// `usePageTitleValue()` and falls back to its own label when none is set.
|
||||||
|
import { useEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
|
let current: string | undefined;
|
||||||
|
const listeners = new Set<() => void>();
|
||||||
|
|
||||||
|
/** Set the page's title (or clear it with `undefined`). */
|
||||||
|
export function setPageTitle(title: string | undefined): void {
|
||||||
|
if (current === title) return;
|
||||||
|
current = title;
|
||||||
|
listeners.forEach((fn) => fn());
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPageTitle(): string | undefined {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Subscribe to changes; returns the way to stop. */
|
||||||
|
export function subscribePageTitle(fn: () => void): () => void {
|
||||||
|
listeners.add(fn);
|
||||||
|
return () => listeners.delete(fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Give the page this title while it is mounted. */
|
||||||
|
export function usePageTitle(title: string | undefined): void {
|
||||||
|
useEffect(() => {
|
||||||
|
setPageTitle(title);
|
||||||
|
return () => setPageTitle(undefined);
|
||||||
|
}, [title]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The title a page has set, if any, following changes. */
|
||||||
|
export function usePageTitleValue(): string | undefined {
|
||||||
|
const [title, setTitle] = useState(getPageTitle());
|
||||||
|
useEffect(() => {
|
||||||
|
setTitle(getPageTitle());
|
||||||
|
return subscribePageTitle(() => setTitle(getPageTitle()));
|
||||||
|
}, []);
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
@ -16,12 +16,15 @@ export function Hint({
|
||||||
tone = "muted",
|
tone = "muted",
|
||||||
as: Tag = "p",
|
as: Tag = "p",
|
||||||
role,
|
role,
|
||||||
|
id,
|
||||||
class: extraClass,
|
class: extraClass,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
tone?: HintTone;
|
tone?: HintTone;
|
||||||
as?: "p" | "span" | "div";
|
as?: "p" | "span" | "div";
|
||||||
role?: "status" | "alert";
|
role?: "status" | "alert";
|
||||||
|
/** For a control's `aria-describedby`: the hint says why it is off. */
|
||||||
|
id?: string;
|
||||||
class?: string;
|
class?: string;
|
||||||
children: ComponentChildren;
|
children: ComponentChildren;
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -30,6 +33,7 @@ export function Hint({
|
||||||
.join(" ");
|
.join(" ");
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
|
id={id}
|
||||||
class={classes}
|
class={classes}
|
||||||
role={role ?? (tone === "error" ? "alert" : undefined)}
|
role={role ?? (tone === "error" ? "alert" : undefined)}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
36
frontend/packages/swarm-ui/src/ui/polled/StaleNote.tsx
Normal file
36
frontend/packages/swarm-ui/src/ui/polled/StaleNote.tsx
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
// <StaleNote> — says how old a polled list is when it is not live: under a failed
|
||||||
|
// refresh it shows the last good answer, and with a `cacheKey` the first paint is
|
||||||
|
// the answer saved on the last visit. Neither says so by itself, so a list such as
|
||||||
|
// "nothing is alerting" could be days old without a mark. Renders nothing for a
|
||||||
|
// list that is current.
|
||||||
|
import { Hint } from "../hint/Hint.js";
|
||||||
|
import { RelativeTime } from "../relative-time/RelativeTime.js";
|
||||||
|
|
||||||
|
export function StaleNote({
|
||||||
|
updatedAt,
|
||||||
|
failed,
|
||||||
|
hasData,
|
||||||
|
}: {
|
||||||
|
/** When the last live answer arrived (`usePolled`), or null if none has. */
|
||||||
|
updatedAt: number | null;
|
||||||
|
/** The latest refresh failed. */
|
||||||
|
failed: boolean;
|
||||||
|
/** The page has a list to show at all. */
|
||||||
|
hasData: boolean;
|
||||||
|
}) {
|
||||||
|
if (!hasData) return null;
|
||||||
|
if (updatedAt === null) {
|
||||||
|
return (
|
||||||
|
<Hint role="status">
|
||||||
|
showing the answer saved from your last visit, until a fresh one
|
||||||
|
arrives.
|
||||||
|
</Hint>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!failed) return null;
|
||||||
|
return (
|
||||||
|
<Hint role="status">
|
||||||
|
showing the last answer, from <RelativeTime epochMs={updatedAt} />.
|
||||||
|
</Hint>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
// A resource refetched on a timer: `{ data, error, refreshing, refresh, setData }`.
|
// A resource refetched on a timer: `{ data, error, refreshing, refresh, setData }`.
|
||||||
|
// `updatedAt` is when the last live answer arrived, for saying how old a list
|
||||||
|
// is under a failed refresh (`StaleNote`).
|
||||||
// `data` is `null` until the first answer (or, with a `cacheKey`, the saved one
|
// `data` is `null` until the first answer (or, with a `cacheKey`, the saved one
|
||||||
// of the last visit, which is shown at once and replaced by the fresh answer;
|
// of the last visit, which is shown at once and replaced by the fresh answer;
|
||||||
// see `answer-cache.ts`); a failed fetch sets `error` and
|
// see `answer-cache.ts`); a failed fetch sets `error` and
|
||||||
|
|
@ -53,6 +55,9 @@ export function usePolled<T>(
|
||||||
): {
|
): {
|
||||||
data: T | null;
|
data: T | null;
|
||||||
error: ProblemDetails | null;
|
error: ProblemDetails | null;
|
||||||
|
/** When the last live answer arrived; null until one has (a saved answer
|
||||||
|
* from the last visit is not one). */
|
||||||
|
updatedAt: number | null;
|
||||||
refreshing: boolean;
|
refreshing: boolean;
|
||||||
refresh: () => void;
|
refresh: () => void;
|
||||||
setData: (update: (prev: T | null) => T | null) => void;
|
setData: (update: (prev: T | null) => T | null) => void;
|
||||||
|
|
@ -64,6 +69,7 @@ export function usePolled<T>(
|
||||||
cacheKey === undefined ? null : readAnswer<T>(cacheKey),
|
cacheKey === undefined ? null : readAnswer<T>(cacheKey),
|
||||||
);
|
);
|
||||||
const [error, setError] = useState<ProblemDetails | null>(null);
|
const [error, setError] = useState<ProblemDetails | null>(null);
|
||||||
|
const [updatedAt, setUpdatedAt] = useState<number | null>(null);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
|
||||||
const fetcherRef = useRef(fetcher);
|
const fetcherRef = useRef(fetcher);
|
||||||
|
|
@ -83,6 +89,7 @@ export function usePolled<T>(
|
||||||
}
|
}
|
||||||
setData(next);
|
setData(next);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
setUpdatedAt(Date.now());
|
||||||
},
|
},
|
||||||
onError: (e) => setError(toProblem(e)),
|
onError: (e) => setError(toProblem(e)),
|
||||||
onBusy: (busy) => hold.busy(busy),
|
onBusy: (busy) => hold.busy(busy),
|
||||||
|
|
@ -99,5 +106,12 @@ export function usePolled<T>(
|
||||||
);
|
);
|
||||||
useRefreshInterval(intervalMs, () => poller.tick());
|
useRefreshInterval(intervalMs, () => poller.tick());
|
||||||
|
|
||||||
return { data, error, refreshing, refresh: () => poller.refetch(), setData };
|
return {
|
||||||
|
data,
|
||||||
|
error,
|
||||||
|
updatedAt,
|
||||||
|
refreshing,
|
||||||
|
refresh: () => poller.refetch(),
|
||||||
|
setData,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import {
|
import {
|
||||||
|
lastReachableStep,
|
||||||
nameProblem,
|
nameProblem,
|
||||||
nextStep,
|
nextStep,
|
||||||
previousStep,
|
previousStep,
|
||||||
|
|
@ -99,3 +100,16 @@ test("the summary lists what is sent and what stays at its default", () => {
|
||||||
assert.equal(rows({ permissions: [] }).permissions, "none");
|
assert.equal(rows({ permissions: [] }).permissions, "none");
|
||||||
assert.equal(rows({ agentsMd: "x" }).instructions, "AGENTS.md, 1 word");
|
assert.equal(rows({ agentsMd: "x" }).instructions, "AGENTS.md, 1 word");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("the tabs go forward as far as the operator has been, not past a bad step", () => {
|
||||||
|
// On the summary (4) having been there: every step is open.
|
||||||
|
assert.equal(lastReachableStep(4, -1, 4), 4);
|
||||||
|
// Back on the identity step (0) after reaching the summary: still open to 4.
|
||||||
|
assert.equal(lastReachableStep(4, -1, 0), 4);
|
||||||
|
// The name went bad (step 0): only the current step is open.
|
||||||
|
assert.equal(lastReachableStep(4, 0, 0), 0);
|
||||||
|
// A bad permissions step (2) stops the tabs there.
|
||||||
|
assert.equal(lastReachableStep(4, 2, 0), 2);
|
||||||
|
// Never behind the current step.
|
||||||
|
assert.equal(lastReachableStep(1, 0, 3), 3);
|
||||||
|
});
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue