--- title: Daily WSJF Triage --- ```js import {POLL_HEAVY, apiFetch, pollDelay, waitForVisible} from "./components/config.js"; import {injectTocTop} from "./components/toc-sidebar.js"; import {withDocHelp} from "./components/doc-overlay.js"; import { ACTION_META, actionMeta, buildCandidateIndex, buildPatternRows, isWithinDays, normalizeTriageReports, resolveCandidate, topAction, truncateSummary, } from "./components/wsjf-triage.js"; ``` ```js const triageState = (async function*() { let failures = 0; while (true) { let events = [], workplanIndex = {workstreams: {}}, ok = false; try { const [reportsResp, indexResp] = await Promise.all([ apiFetch("/progress/?event_type=daily_triage&limit=14"), apiFetch("/workplans/index"), ]); ok = reportsResp.ok && indexResp.ok; events = reportsResp.ok ? await reportsResp.json() : []; workplanIndex = indexResp.ok ? await indexResp.json() : {workstreams: {}}; } catch {} failures = ok ? 0 : failures + 1; yield {events, workplanIndex, ok, ts: new Date()}; await waitForVisible(pollDelay({ok, base: POLL_HEAVY, failures})); } })(); ``` ```js const reports = normalizeTriageReports(triageState.events ?? []); const candidateIndex = buildCandidateIndex(triageState.workplanIndex ?? {workstreams: {}}); const _ok = triageState.ok ?? false; const _ts = triageState.ts; const latestReport = reports[0] ?? null; ``` # Daily WSJF Triage ```js function fmtDateTime(iso) { if (!iso) return "-"; const d = new Date(iso); return Number.isNaN(d.getTime()) ? String(iso) : d.toLocaleString(); } function fmtDate(iso) { if (!iso) return "-"; const d = new Date(iso); return Number.isNaN(d.getTime()) ? String(iso).slice(0, 10) : d.toLocaleDateString(undefined, {year: "numeric", month: "short", day: "numeric"}); } function candidateNode(candidate, index) { const resolved = resolveCandidate(candidate, index); return resolved ? html`${candidate}` : html`${candidate || "-"}`; } function actionBadge(action, extraText = "") { const meta = actionMeta(action); return html``; } function recommendationTable(report, index) { const recommendations = report.recommendations ?? []; if (recommendations.length === 0) { return html`
No recommendations were recorded for this report.
`; } return html`| # | Candidate | Action | Confidence | Why |
|---|---|---|---|---|
| ${rec.rank} | ${candidateNode(rec.candidate, index)} | ${actionBadge(rec.action)} | ${rec.confidence} | ${rec.why || "-"} |
${report.summary || "-"}
No repeated recommendations are visible in the loaded 14-day window.
` : html`| Workstream | Times Recommended | Most Frequent Action |
|---|---|---|
| ${candidateNode(row.candidate, index)} | ${row.count} / ${Math.max(1, windowReports.length)} reports | ${actionBadge(row.action, ` x${row.actionCount}`)} |
| Date | Summary | # Recs | Top Action |
|---|
make api`}
Daily State Hub triage from activity-core. Recommendations are advisory; the operator and workplan owners decide what to act on.
`); display(html`The next run is scheduled for 07:20 Europe/Berlin (activity-core daily-statehub-wsjf-triage).