--- title: Todo --- ```js import {API, POLL_HEAVY, apiFetch, pollDelay, waitForVisible} from "./components/config.js"; const THIS_REPO = "the-custodian"; ``` ```js // Live poll: tasks + workstreams + topics + contributions const todoState = (async function*() { let failures = 0; while (true) { let tasks = [], contribs = [], improvements = [], wsMap = {}, ok = false; try { const [rt, rw, rto, rr, rc, ri] = await Promise.all([ apiFetch("/tasks/?limit=500"), apiFetch("/workplans/"), apiFetch("/topics/"), apiFetch("/repos/"), apiFetch("/contributions/"), apiFetch("/technical-debt/?debt_type=dashboard-improvement"), ]); ok = rt.ok && rw.ok && rto.ok && rr.ok && rc.ok; if (ok) { const [taskList, wsList, topicList, repoList, contribList] = await Promise.all([ rt.json(), rw.json(), rto.json(), rr.json(), rc.json(), ]); const topicMap = Object.fromEntries(topicList.map(t => [t.id, t])); const repoMap = Object.fromEntries(repoList.map(r => [r.id, r])); wsMap = Object.fromEntries(wsList.map(w => [w.id, { ...w, domain: repoMap[w.repo_id]?.domain_slug ?? topicMap[w.topic_id]?.domain_slug ?? "unknown", }])); tasks = taskList.map(t => ({ ...t, workstream_title: wsMap[t.workstream_id]?.title ?? "—", domain: wsMap[t.workstream_id]?.domain ?? "unknown", })); contribs = contribList; const CLOSED = new Set(["finished", "wont_fix", "resolved", "deferred"]); improvements = ri.ok ? (await ri.json()).filter(t => t.debt_type === "dashboard-improvement" && !CLOSED.has(t.status)) : []; } } catch {} failures = ok ? 0 : failures + 1; yield {tasks, contribs, improvements, ok, ts: new Date()}; await waitForVisible(pollDelay({ok, base: POLL_HEAVY, failures})); } })(); ``` ```js const tasks = todoState.tasks ?? []; const contribs = todoState.contribs ?? []; const improvements = todoState.improvements ?? []; const _ok = todoState.ok ?? false; const _ts = todoState.ts; ``` ```js // ── Classify tasks ──────────────────────────────────────────────────────────── const OPEN_STATUSES = new Set(["wait", "todo", "progress"]); // Internal: custodian domain, open, no [repo:] routing prefix const internal = tasks.filter(t => OPEN_STATUSES.has(t.status) && t.domain === "custodian" && !t.title.includes("[repo:") ); // Ecosystem inbound: tasks routed to this repo from any domain const ecosystem = tasks.filter(t => OPEN_STATUSES.has(t.status) && t.title.toLowerCase().includes(`[repo:${THIS_REPO}]`) ); // Third-party: open contributions (outbound work for upstream repos) const thirdParty = contribs.filter(c => ["draft", "submitted", "acknowledged"].includes(c.status) ); ``` # Todo ```js import {injectTocTop} from "./components/toc-sidebar.js"; import {withDocHelp} from "./components/doc-overlay.js"; // ── KPI sidebar card ────────────────────────────────────────────────────────── const _kpiBox = html`
make api`}
No open todos in this category. ✓
`; return html`No open outbound contributions. ✓
`); } else { display(html`No open suggestions. Shift+click any widget to submit one.
`); } else { display(html`