--- title: Extension Points --- ```js import {API, POLL_HEAVY, apiFetch, pollDelay, waitForVisible} from "./components/config.js"; ``` ```js const epState = (async function*() { let failures = 0; while (true) { let data = [], ok = false; try { const [re, rw, rt, rr] = await Promise.all([ apiFetch("/extension-points/"), apiFetch("/workstreams/"), apiFetch("/topics/"), apiFetch("/repos/"), ]); ok = re.ok && rw.ok && rt.ok && rr.ok; if (ok) { const [epList, wsList, topicList, repoList] = await Promise.all([re.json(), rw.json(), rt.json(), rr.json()]); const topicMap = Object.fromEntries(topicList.map(t => [t.id, t])); const repoMap = Object.fromEntries(repoList.map(r => [r.id, r])); const wsMap = Object.fromEntries(wsList.map(w => [w.id, { ...w, domain: repoMap[w.repo_id]?.domain_slug ?? topicMap[w.topic_id]?.domain_slug ?? "unknown", }])); data = epList.map(e => ({ ...e, workstream_title: wsMap[e.workstream_id]?.title ?? null, })).sort((a, b) => { const pr = {critical: 0, high: 1, medium: 2, low: 3}; const st = {open: 0, in_progress: 1, deferred: 2, addressed: 3, wont_fix: 4}; const sd = (st[a.status] ?? 9) - (st[b.status] ?? 9); return sd !== 0 ? sd : (pr[a.priority] ?? 9) - (pr[b.priority] ?? 9); }); } } catch {} failures = ok ? 0 : failures + 1; yield {data, ok, ts: new Date()}; await waitForVisible(pollDelay({ok, base: POLL_HEAVY, failures})); } })(); ``` ```js const data = epState.data ?? []; const _ok = epState.ok ?? false; const _ts = epState.ts; ``` ```js import {MultiSelect} from "./components/multiselect.js"; const STATUSES = ["open", "in_progress", "addressed", "deferred", "wont_fix"]; const PRIORITIES = ["critical", "high", "medium", "low"]; const _domainsResp = await fetch(`${API}/domains/?status=active`).catch(() => null); const DOMAINS = _domainsResp?.ok ? (await _domainsResp.json()).map(d => d.slug) : ["custodian", "railiance", "markitect", "coulomb_social", "personhood", "foerster_capabilities"]; const EP_TYPES = ["api", "schema", "mcp", "dashboard", "architecture", "integration", "other"]; const _filtersForm = Inputs.form( { status: MultiSelect(STATUSES, {label: "Status", placeholder: "All statuses"}), priority: MultiSelect(PRIORITIES, {label: "Priority", placeholder: "All priorities"}), domain: MultiSelect(DOMAINS, {label: "Domain", placeholder: "All domains"}), ep_type: MultiSelect(EP_TYPES, {label: "Type", placeholder: "All types"}), }, { template: ({status, priority, domain, ep_type}) => html`
${status}${priority}${domain}${ep_type}
`, } ); ``` ```js const filters = Generators.input(_filtersForm); ``` ```js const filtered = data.filter(e => (filters.status.length === 0 || filters.status.includes(e.status)) && (filters.priority.length === 0 || filters.priority.includes(e.priority)) && (filters.domain.length === 0 || filters.domain.includes(e.domain_slug)) && (filters.ep_type.length === 0 || filters.ep_type.includes(e.ep_type)) ); ``` # Extension Points ```js import {injectTocTop} from "./components/toc-sidebar.js"; import {withDocHelp} from "./components/doc-overlay.js"; import {openEntityModal} from "./components/entity-modal.js"; // ── KPI sidebar ─────────────────────────────────────────────────────────────── const _open = data.filter(e => e.status === "open" || e.status === "in_progress"); const _addressed = data.filter(e => e.status === "addressed"); const _byType = EP_TYPES.map(t => [t, data.filter(e => e.ep_type === t && e.status === "open").length]) .filter(([,n]) => n > 0); const _kpiBox = html`
Extension Points
open
${_open.length}
addressed
${_addressed.length}
${_byType.length > 0 ? html`
${_byType.map(([t, n]) => html`
${t} ${n}
`)}
` : ""}
`; // ── Live indicator ───────────────────────────────────────────────────────────── const _liveEl = html`
${_ok ? `Live · updated ${_ts?.toLocaleTimeString()}` : html`Offline — run: make api`}
`; withDocHelp(_liveEl, "/docs/live-data"); const _h1 = document.querySelector("#observablehq-main h1"); if (_h1) { _h1.style.position = "relative"; withDocHelp(_h1, "/docs/extensions"); } injectTocTop("ep-kpi-box", _kpiBox); injectTocTop("live-indicator", _liveEl); ``` ## By Type & Status ```js import * as Plot from "npm:@observablehq/plot"; const TYPE_COLOR = { api: "#3b82f6", schema: "#8b5cf6", mcp: "#ec4899", dashboard: "#f59e0b", architecture: "#10b981", integration: "#6366f1", other: "#94a3b8", }; const STATUS_COLOR = { open: "#3b82f6", in_progress: "#f59e0b", addressed: "#22c55e", deferred: "#94a3b8", wont_fix: "#e2e8f0", }; const byType = EP_TYPES .map(t => ({type: t, count: filtered.filter(e => e.ep_type === t).length})) .filter(d => d.count > 0); const byStatus = STATUSES .map(s => ({status: s, count: filtered.filter(e => e.status === s).length})) .filter(d => d.count > 0); if (filtered.length === 0) { display(html`

No extension points match the current filter.

`); } else { display(html`
${Plot.plot({ marks: [ Plot.barX(byType, {y: "type", x: "count", fill: d => TYPE_COLOR[d.type] ?? "#94a3b8", tip: true}), Plot.ruleX([0]), ], marginLeft: 100, width: 340, title: "By type", })} ${Plot.plot({ marks: [ Plot.barX(byStatus, {y: "status", x: "count", fill: d => STATUS_COLOR[d.status] ?? "#94a3b8", tip: true}), Plot.ruleX([0]), ], marginLeft: 90, width: 300, title: "By status", })}
`); } ``` ## All Extension Points ```js display(_filtersForm); display(html`

${filtered.length} extension points shown.

`); display(html`
${filtered.map(ep => html`
openEntityModal(ep, "ep")} title="Click to view full details">
${ep.ep_id ? html`${ep.ep_id}` : ""} ${ep.ep_type} ${ep.status.replace("_", " ")} ${ep.priority} ${ep.domain} ${ep.workstream_title ? html`${ep.workstream_title}` : ""}
${ep.title}
${ep.description ? html`
${ep.description.slice(0, 220)}${ep.description.length > 220 ? " …" : ""}
` : ""} ${ep.location ? html`
${ep.location}
` : ""}
`)}
`); ```