feat(app): show the live Needs-you bell over the Runs list rows

This commit is contained in:
2026-10-22 00:52:06 +01:00
parent 1835bc8832
commit a309d9d571
15 changed files with 1557 additions and 127 deletions
+10 -10
View File
@@ -57,9 +57,9 @@ const RUNS = [
},
];
function humanDetail(accepted) {
function humanDetail(accepted, runs = RUNS) {
return {
...RUNS.find((run) => run.id === 5),
...runs.find((run) => run.id === 5),
status: accepted ? 'succeeded' : 'waiting', current_stage: 'gate',
input: { prompt: 'Fixture human decision' },
graph: { stages: [{ key: 'gate', type: 'human', edges: { approve: '#success' } }] },
@@ -79,12 +79,12 @@ const LIVE_EVENT = {
finished_at: '2026-10-21T12:05:00Z',
};
function detail(id, live, canceled = false) {
function detail(id, live, canceled = false, runs = RUNS) {
const status = canceled ? 'canceled'
: id === 1 && live ? 'succeeded' : id === 3 ? 'failed' : 'running';
return {
id,
title: RUNS.find((run) => run.id === id)?.title ?? `Run ${id}`,
title: runs.find((run) => run.id === id)?.title ?? `Run ${id}`,
name: 'fixture-pipeline',
status,
executing: status === 'running',
@@ -310,7 +310,7 @@ async function staticFile(base, pathname, req, res) {
* It serves the built probe bundle and upgrades /connect on the same origin, so
* the normal web composition infers this server from Uri.base.
*/
export async function startFixture({ root }) {
export async function startFixture({ root, runs = RUNS }) {
const base = await realpath(root);
const connections = new Set();
const sockets = new Set();
@@ -436,7 +436,7 @@ export async function startFixture({ root }) {
}
if (request.type === 'list_runs') {
listRuns++;
client.send({ id: request.id, type: 'runs', runs: RUNS.map((run) =>
client.send({ id: request.id, type: 'runs', runs: runs.map((run) =>
canceled.has(run.id) ? { ...run, status: 'canceled', executing: false }
: run.id === 5 && decisionAccepted ? { ...run, status: 'succeeded' } : run), usage: null });
return;
@@ -448,7 +448,7 @@ export async function startFixture({ root }) {
// Deliberately slow so the browser sees the pending/Back state;
// it must still answer so the serialized request queue continues.
setTimeout(() => {
client.send({ id: request.id, type: 'run', run_detail: detail(2, live) });
client.send({ id: request.id, type: 'run', run_detail: detail(2, live, false, runs) });
}, 2500);
return;
}
@@ -461,13 +461,13 @@ export async function startFixture({ root }) {
return;
}
client.send({ id: request.id, type: 'run', run_detail: id === 5
? humanDetail(decisionAccepted) : detail(id, live, canceled.has(id)) });
? humanDetail(decisionAccepted, runs) : detail(id, live, canceled.has(id), runs) });
return;
}
if (request.type === 'cancel_run' && request.run_id === 4) {
cancelRequests.push({ run_id: request.run_id });
canceled.add(4);
client.send({ id: request.id, type: 'run', run_detail: detail(4, live, true) });
client.send({ id: request.id, type: 'run', run_detail: detail(4, live, true, runs) });
return;
}
if (request.type === 'decide_run' && request.run_id === 5 &&
@@ -475,7 +475,7 @@ export async function startFixture({ root }) {
decisionRequests.push({ run_id: request.run_id, stage: request.stage,
option: request.option, ...(request.feedback ? { feedback: request.feedback } : {}) });
decisionAccepted = true;
client.send({ id: request.id, type: 'run', run_detail: humanDetail(true) });
client.send({ id: request.id, type: 'run', run_detail: humanDetail(true, runs) });
return;
}
if (request.type === 'search') {