@osdlc/wayfinder 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web/main.js CHANGED
@@ -36,6 +36,11 @@ const state = {
36
36
  knownRunners: /* @__PURE__ */ new Set(),
37
37
  checkedAt: Date.now(),
38
38
  loading: false,
39
+ live: false,
40
+ pending: [],
41
+ expected: 0,
42
+ order: [],
43
+ loadStarted: 0,
39
44
  trustable: false,
40
45
  cache: [],
41
46
  unknowns: [],
@@ -610,6 +615,8 @@ function groupOf(runner) {
610
615
  *
611
616
  * Browser-safe: no Node built-in, so the page imports it.
612
617
  */
618
+ /** How long a refresh runs before the status names the runners it still waits on. */
619
+ const WAITING_AFTER_MS = 3e3;
613
620
  /** What one row is called on every surface. */
614
621
  const TASK_NOUN = {
615
622
  one: "task",
@@ -1144,12 +1151,24 @@ function buildTree(rows) {
1144
1151
  }
1145
1152
  return root;
1146
1153
  }
1147
- function renderNode(node, prefix) {
1154
+ /**
1155
+ * The tree under `node`. `loading` names runners still loading; the combined
1156
+ * index's top level shows a row for each in the place its group will take.
1157
+ */
1158
+ function renderNode(node, prefix, loading = []) {
1148
1159
  let html = "";
1149
1160
  const order = runnerOrder();
1150
1161
  const topLevel = treeStart() === 0 && prefix.length === 0;
1151
- const groups = [...node.kids.entries()].sort((a, b) => topLevel ? order.indexOf(a[0]) - order.indexOf(b[0]) : a[0].localeCompare(b[0]));
1162
+ const groups = [...node.kids.entries()];
1163
+ if (topLevel) {
1164
+ for (const r of loading) if (!node.kids.has(r)) groups.push([r, null]);
1165
+ }
1166
+ groups.sort((a, b) => topLevel ? order.indexOf(a[0]) - order.indexOf(b[0]) : a[0].localeCompare(b[0]));
1152
1167
  for (const [seg, kid] of groups) {
1168
+ if (kid === null) {
1169
+ html += loadingRow(seg);
1170
+ continue;
1171
+ }
1153
1172
  const key = prefix.concat(seg).join(" ");
1154
1173
  const collapsed = state.collapsed.has(key);
1155
1174
  const depth = prefix.length;
@@ -1519,7 +1538,8 @@ let skillCounts = {
1519
1538
  * not in the order keeps its catalog place after the ones that are.
1520
1539
  */
1521
1540
  function runnerOrder() {
1522
- const present = (state.catalog?.reports || []).map((r) => r.runner);
1541
+ const reported = (state.catalog?.reports || []).map((r) => r.runner);
1542
+ const present = state.live ? [...state.order, ...reported.filter((r) => !state.order.includes(r))] : reported;
1523
1543
  const saved = state.runnerOrder.filter((r) => present.includes(r));
1524
1544
  const unsaved = present.filter((r) => !saved.includes(r));
1525
1545
  return [...saved, ...unsaved].sort((a, b) => groupRank(a) - groupRank(b));
@@ -1655,10 +1675,32 @@ function keepSelectedTabInView() {
1655
1675
  function hasInfo(runner) {
1656
1676
  return chainOf(runner).length > 0 || toolInfo(runner) !== void 0;
1657
1677
  }
1678
+ /** The runners the first probe will report but has not answered with rows, in display order. */
1679
+ function stillLoading(reports) {
1680
+ if (!state.live) return [];
1681
+ const answered = new Set(reports.map((r) => r.runner));
1682
+ return runnerOrder().filter((r) => !answered.has(r));
1683
+ }
1684
+ /**
1685
+ * A quiet tab for a runner still loading, in the place its tab will take.
1686
+ * It is not a button: there is nothing to select yet.
1687
+ */
1688
+ function loadingTab(r) {
1689
+ return "<span class=\"tab tab-loading\" aria-busy=\"true\" title=\"" + escapeHtml(runnerLabel(r)) + " is loading\">" + escapeHtml(runnerLabel(r)) + "<span class=\"spinner\" aria-hidden=\"true\"></span></span>";
1690
+ }
1691
+ /** A row for a runner still loading. */
1692
+ function loadingRow(r) {
1693
+ return "<div class=\"loading-row\" aria-busy=\"true\"><span class=\"spinner\" aria-hidden=\"true\"></span>" + escapeHtml(runnerLabel(r)) + " <span class=\"muted\">loading…</span></div>";
1694
+ }
1695
+ /** A row for each runner still loading, for the views that are not the tree. */
1696
+ function loadingRows(runners) {
1697
+ if (runners.length === 0) return "";
1698
+ return "<div class=\"loading-rows\">" + runners.map(loadingRow).join("") + "</div>";
1699
+ }
1658
1700
  function render() {
1659
1701
  const cat = state.catalog;
1660
1702
  if (!cat) {
1661
- $("out").innerHTML = "<div class=\"empty\">Loading...</div>";
1703
+ $("out").innerHTML = "<div class=\"empty\">Loading…</div>";
1662
1704
  return;
1663
1705
  }
1664
1706
  const main = $("out");
@@ -1672,27 +1714,42 @@ function render() {
1672
1714
  }
1673
1715
  const skillsTotal = cat.skills?.length ?? 0;
1674
1716
  if (state.runner === "@skills" ? skillsTotal === 0 : state.runner !== "all" && !enabled.has(state.runner)) state.runner = "all";
1675
- const on = runnerOrder().map((id) => cat.reports.find((s) => s.runner === id)).filter((s) => s !== void 0 && enabled.has(s.runner));
1717
+ const byOrder = runnerOrder();
1718
+ const loadingSet = new Set(stillLoading(cat.reports));
1719
+ const on = byOrder.map((id) => cat.reports.find((s) => s.runner === id)).filter((s) => s !== void 0 && enabled.has(s.runner));
1676
1720
  const total = on.reduce((n, s) => n + s.tasks.length, 0);
1677
1721
  const anyError = on.some((s) => s.status === "error");
1678
1722
  const foldable = on.filter((s) => s.tasks.length === 0 && s.status !== "error" && !s.skippedForExec && !(s.diagnostics || []).some((d) => d.severity === "warning") && s.runner !== state.runner);
1679
- const shown = on.filter((s) => !foldable.includes(s));
1680
1723
  const tabs = [{
1681
1724
  runner: "all",
1682
1725
  count: total,
1683
1726
  error: anyError,
1684
- exec: false
1685
- }].concat(shown.map((s) => ({
1686
- runner: s.runner,
1687
- count: s.tasks.length,
1688
- error: s.status === "error",
1689
- exec: s.skippedForExec
1690
- })));
1727
+ exec: false,
1728
+ loading: false
1729
+ }].concat(byOrder.flatMap((id) => {
1730
+ if (loadingSet.has(id)) return [{
1731
+ runner: id,
1732
+ count: 0,
1733
+ error: false,
1734
+ exec: false,
1735
+ loading: true
1736
+ }];
1737
+ const s = on.find((r) => r.runner === id);
1738
+ if (s === void 0 || foldable.includes(s)) return [];
1739
+ return [{
1740
+ runner: s.runner,
1741
+ count: s.tasks.length,
1742
+ error: s.status === "error",
1743
+ exec: s.skippedForExec,
1744
+ loading: false
1745
+ }];
1746
+ }));
1691
1747
  const chainOfRunner = (id) => cat.reports.find((r) => r.runner === id)?.chain ?? [];
1692
1748
  $("tabs").innerHTML = tabs.map((t, i) => {
1693
1749
  const prev = tabs[i - 1];
1694
1750
  const group = groupOf(t.runner);
1695
1751
  const header = t.runner !== "all" && prev !== void 0 && prev.runner !== "all" && groupOf(prev.runner) !== group && runnerLabel(t.runner) !== group.title.toLowerCase() ? "<span class=\"tabgroup\">" + escapeHtml(group.title) + "</span>" : "";
1752
+ if (t.loading) return header + loadingTab(t.runner);
1696
1753
  const shape = chainOfRunner(t.runner).map((c, i) => i === 0 ? runnerLabel(t.runner) : c.label).join(" › ");
1697
1754
  const draggable = t.runner !== "all" ? " draggable=\"true\"" : "";
1698
1755
  const tip = t.exec ? shape ? shape + ". " + execNote(t.runner) : execNote(t.runner) : shape;
@@ -1738,9 +1795,11 @@ function render() {
1738
1795
  html += "<div class=\"" + label + "\">" + escapeHtml(sec.runner) + ": " + escapeHtml(d.message) + (d.source ? "\n" + escapeHtml(d.source) : "") + "</div>";
1739
1796
  }
1740
1797
  const onSkills = state.runner === SKILLS;
1798
+ const loading = state.runner === "all" ? stillLoading(cat.reports) : [];
1799
+ let inTree = false;
1741
1800
  if (rows.length === 0 && skills.length === 0) {
1742
1801
  const noun = onSkills ? SKILL_NOUN.one : TASK_NOUN.one;
1743
- html += "<div class=\"empty\">" + (inScope || skillCounts.total ? "No " + noun + " matches." : "Nothing collected.") + "</div>";
1802
+ if (loading.length === 0) html += "<div class=\"empty\">" + (inScope || skillCounts.total ? "No " + noun + " matches." : "Nothing collected.") + "</div>";
1744
1803
  } else if (terms$1.length) {
1745
1804
  const hits = [...rows.map((r) => ({
1746
1805
  score: r.score,
@@ -1752,7 +1811,11 @@ function render() {
1752
1811
  hits.sort((a, b) => b.score - a.score);
1753
1812
  html += "<table>" + colgroup(0) + "<tbody>" + hits.slice(0, 400).map((h) => h.html()).join("") + "</tbody></table>";
1754
1813
  } else if (onSkills) html += skillTable(skills, 0);
1755
- else html += renderNode(buildTree(rows), []) + (skills.length > 0 ? skillsNode(skills) : "");
1814
+ else {
1815
+ inTree = true;
1816
+ html += renderNode(buildTree(rows), [], loading) + (skills.length > 0 ? skillsNode(skills) : "");
1817
+ }
1818
+ if (!inTree) html += loadingRows(loading);
1756
1819
  const focusWasInList = $("out").contains(document.activeElement);
1757
1820
  $("out").innerHTML = html;
1758
1821
  markEnterTarget();
@@ -2057,6 +2120,29 @@ function renderTrustBar() {
2057
2120
  host.innerHTML = html;
2058
2121
  host.hidden = html === "";
2059
2122
  }
2123
+ /** Say `text` to a screen reader, through the page's one polite live region. */
2124
+ function announce(text) {
2125
+ $("announce").textContent = text;
2126
+ }
2127
+ /** The counts the status line showed last, for {@link refreshStatus}. */
2128
+ let lastCounts = {
2129
+ shown: 0,
2130
+ total: 0
2131
+ };
2132
+ /** The status line again with the counts it showed last: a load started or ended. */
2133
+ function refreshStatus() {
2134
+ renderStatus(lastCounts.shown, lastCounts.total);
2135
+ }
2136
+ /** What the status line says about a probe running: what is still loading, or that it refreshes. */
2137
+ function loadingText() {
2138
+ if (state.live) {
2139
+ if (state.expected < 0) return "detecting the project…";
2140
+ if (state.pending.length === 0) return "loading…";
2141
+ return "loading " + state.pending.length + " of " + state.expected + ": " + escapeHtml(state.pending.map(runnerLabel).join(", "));
2142
+ }
2143
+ if (!state.loading) return "";
2144
+ return " - refreshing…" + (state.pending.length > 0 && Date.now() - state.loadStarted >= 3e3 ? " waiting on " + escapeHtml(state.pending.map(runnerLabel).join(", ")) : "");
2145
+ }
2060
2146
  /**
2061
2147
  * Kept separate from the table so an unchanged poll can update the clock
2062
2148
  * without touching the table. Otherwise Refresh on an unchanged repo would
@@ -2064,8 +2150,12 @@ function renderTrustBar() {
2064
2150
  * it is.
2065
2151
  */
2066
2152
  function renderStatus(shown, total) {
2153
+ lastCounts = {
2154
+ shown,
2155
+ total
2156
+ };
2067
2157
  const errs = (state.catalog?.reports || []).filter((s) => s.status === "error").map((s) => s.runner);
2068
- $("status").innerHTML = "<span>" + (state.runner === "@skills" ? skillCounts.shown + " of " + escapeHtml(countSkills(skillCounts.total)) : shown + " of " + escapeHtml(countTasks(total)) + (state.runner === "all" ? ", all runners" : " in " + escapeHtml(runnerLabel(state.runner))) + (skillCounts.total > 0 ? ", " + skillCounts.shown + " of " + escapeHtml(countSkills(skillCounts.total)) : "")) + "</span><span>checked " + new Date(state.checkedAt).toLocaleTimeString() + (state.loading ? " - refreshing" : "") + "</span>" + cacheSpan(state.cache) + (errs.length ? "<span class=\"err\">probe failed: " + escapeHtml(errs.map(runnerLabel).join(", ")) + "</span>" : "") + (state.runner === "@skills" ? "<span class=\"keyhint\"><kbd>Enter</kbd> copy /name &middot; <kbd>?</kbd> all keys</span>" : "<span class=\"keyhint\"><kbd>Enter</kbd> copy &middot; <kbd>Shift+Enter</kbd> run &middot; <kbd>?</kbd> all keys</span>");
2158
+ $("status").innerHTML = "<span>" + (state.runner === "@skills" ? skillCounts.shown + " of " + escapeHtml(countSkills(skillCounts.total)) : shown + " of " + escapeHtml(countTasks(total)) + (state.runner === "all" ? ", all runners" : " in " + escapeHtml(runnerLabel(state.runner))) + (skillCounts.total > 0 ? ", " + skillCounts.shown + " of " + escapeHtml(countSkills(skillCounts.total)) : "")) + "</span>" + (state.live ? "<span class=\"loading-note\">" + loadingText() + "</span>" : "<span>checked " + new Date(state.checkedAt).toLocaleTimeString() + loadingText() + "</span>") + cacheSpan(state.cache) + (errs.length ? "<span class=\"err\">probe failed: " + escapeHtml(errs.map(runnerLabel).join(", ")) + "</span>" : "") + (state.runner === "@skills" ? "<span class=\"keyhint\"><kbd>Enter</kbd> copy /name &middot; <kbd>?</kbd> all keys</span>" : "<span class=\"keyhint\"><kbd>Enter</kbd> copy &middot; <kbd>Shift+Enter</kbd> run &middot; <kbd>?</kbd> all keys</span>");
2069
2159
  }
2070
2160
  /**
2071
2161
  * The run bar: enter a task's arguments before handing over the terminal.
@@ -2307,6 +2397,8 @@ function settingLayer(key, source) {
2307
2397
  }
2308
2398
  //#endregion
2309
2399
  //#region src/web/api.ts
2400
+ /** The media type of a streamed answer: one JSON line per event, then the document. */
2401
+ const NDJSON = "application/x-ndjson";
2310
2402
  /** Where the bearer token is kept for this tab. */
2311
2403
  const TOKEN_KEY = `${APP}.token`;
2312
2404
  /**
@@ -2387,17 +2479,53 @@ function authHeaders(extra = {}) {
2387
2479
  return headers;
2388
2480
  }
2389
2481
  /**
2482
+ * Read an NDJSON body: each line of the events' kind goes to `events` as it
2483
+ * comes, and the other line, the document or the error, is the result. Null
2484
+ * when the stream ends without one.
2485
+ */
2486
+ async function readLines(body, events) {
2487
+ const reader = body.getReader();
2488
+ const decoder = new TextDecoder();
2489
+ let buffered = "";
2490
+ let last = null;
2491
+ const take = (text) => {
2492
+ if (text.trim() === "") return;
2493
+ const line = JSON.parse(text);
2494
+ if (line["kind"] === events.kind) events.on(line);
2495
+ else last = line;
2496
+ };
2497
+ try {
2498
+ for (;;) {
2499
+ const { done, value } = await reader.read();
2500
+ if (done) break;
2501
+ buffered += decoder.decode(value, { stream: true });
2502
+ let at;
2503
+ while ((at = buffered.indexOf("\n")) !== -1) {
2504
+ take(buffered.slice(0, at));
2505
+ buffered = buffered.slice(at + 1);
2506
+ }
2507
+ }
2508
+ take(buffered + decoder.decode());
2509
+ } catch {
2510
+ return null;
2511
+ }
2512
+ return last;
2513
+ }
2514
+ /**
2390
2515
  * Run `way <words...>` with `args`, the JSON form of its flags and
2391
- * positionals. `confirm` is the nonce of a confirmed 428.
2516
+ * positionals. `confirm` is the nonce of a confirmed 428. With `events`,
2517
+ * the answer streams as NDJSON: each event line goes to `events.on` as it
2518
+ * comes, and the document is the last line.
2392
2519
  */
2393
- async function call(words, args = {}, confirm) {
2520
+ async function call(words, args = {}, confirm, events) {
2394
2521
  let res;
2395
2522
  try {
2396
2523
  res = await fetch("/api/commands/" + words.map(encodeURIComponent).join("/"), {
2397
2524
  method: "POST",
2398
2525
  headers: authHeaders({
2399
2526
  "content-type": "application/json",
2400
- ...confirm !== void 0 ? { "x-confirm": confirm } : {}
2527
+ ...confirm !== void 0 ? { "x-confirm": confirm } : {},
2528
+ ...events !== void 0 ? { accept: NDJSON } : {}
2401
2529
  }),
2402
2530
  body: JSON.stringify(args),
2403
2531
  cache: "no-store"
@@ -2410,6 +2538,25 @@ async function call(words, args = {}, confirm) {
2410
2538
  };
2411
2539
  }
2412
2540
  if (res.status === 401) signOut();
2541
+ if (events !== void 0 && res.ok && res.body !== null && (res.headers.get("content-type") ?? "").includes(NDJSON)) {
2542
+ const last = await readLines(res.body, events);
2543
+ if (last === null) return {
2544
+ ok: false,
2545
+ status: 0,
2546
+ message: "the server is gone"
2547
+ };
2548
+ if (last["kind"] !== "error") return {
2549
+ ok: true,
2550
+ doc: last
2551
+ };
2552
+ return {
2553
+ ok: false,
2554
+ status: 500,
2555
+ message: typeof last["message"] === "string" ? last["message"] : "the command failed",
2556
+ ...typeof last["hint"] === "string" ? { hint: last["hint"] } : {},
2557
+ ...typeof last["code"] === "string" ? { code: last["code"] } : {}
2558
+ };
2559
+ }
2413
2560
  const body = await res.json().catch(() => null);
2414
2561
  if (res.ok && body !== null) return {
2415
2562
  ok: true,
@@ -2451,7 +2598,9 @@ let busy = false;
2451
2598
  * slowest runner takes seconds. `join` lets the answer be a probe the server
2452
2599
  * is already running, for the first fresh read and the polls. Without it (a
2453
2600
  * Refresh, or a read after a change) the server starts a probe, so the
2454
- * answer is never from before the click. A load asked for while one runs
2601
+ * answer is never from before the click. Progress streams with nothing on
2602
+ * screen, for a plain load, and with `progress`; a joining poll asks for none,
2603
+ * since each line carries a full report. A load asked for while one runs
2455
2604
  * runs after it, so a Refresh during a poll is not lost, and its promise
2456
2605
  * settles only once that later read has run.
2457
2606
  *
@@ -2482,15 +2631,107 @@ async function load(opts = {}) {
2482
2631
  if (next !== null) load(next.opts).finally(next.resolve);
2483
2632
  }
2484
2633
  }
2634
+ /**
2635
+ * One progress line of a probe. While nothing else is on screen, the runner
2636
+ * that answered joins the catalog and the page draws it; otherwise only the
2637
+ * count of runners still loading moves.
2638
+ */
2639
+ function onProgress(line) {
2640
+ const event = line;
2641
+ const first = state.expected < 0;
2642
+ state.pending = event.pending;
2643
+ state.expected = event.total;
2644
+ if (!state.live) {
2645
+ if (Date.now() - state.loadStarted >= 3e3) refreshStatus();
2646
+ return;
2647
+ }
2648
+ if (first) {
2649
+ state.order = [...event.pending];
2650
+ announce("loading " + countRunners(event.total));
2651
+ }
2652
+ const report = event.report;
2653
+ const base = state.catalog ?? {
2654
+ kind: "catalog",
2655
+ schemaVersion: 1,
2656
+ root: "",
2657
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2658
+ discovery: "git",
2659
+ allowExec: false,
2660
+ reports: [],
2661
+ cache: [],
2662
+ unknowns: [],
2663
+ skills: []
2664
+ };
2665
+ if (report === void 0) state.catalog = base;
2666
+ else {
2667
+ const others = (list) => (list ?? []).filter((r) => r.runner !== report.runner);
2668
+ const rank = (r) => {
2669
+ const at = state.order.indexOf(r.runner);
2670
+ return at === -1 ? state.order.length : at;
2671
+ };
2672
+ state.catalog = {
2673
+ ...base,
2674
+ reports: [...others(base.reports), report].sort((a, b) => rank(a) - rank(b)),
2675
+ cache: [...others(base.cache), ...event.cache ? [event.cache] : []],
2676
+ unknowns: [...others(base.unknowns), ...event.unknowns ?? []]
2677
+ };
2678
+ state.cache = state.catalog.cache ?? [];
2679
+ state.unknowns = state.catalog.unknowns ?? [];
2680
+ state.trustable = trustableFrom(state.unknowns);
2681
+ }
2682
+ scheduleRender();
2683
+ }
2684
+ /** Set while a render for progress lines waits, so a burst of lines draws once. */
2685
+ let renderQueued = false;
2686
+ /**
2687
+ * Draw the progress lines that arrived, once per 50 ms at most: a render
2688
+ * rebuilds every row, and runners often answer together. Skipped when the
2689
+ * load has ended, since its own render drew the whole answer.
2690
+ */
2691
+ function scheduleRender() {
2692
+ if (renderQueued) return;
2693
+ renderQueued = true;
2694
+ setTimeout(() => {
2695
+ renderQueued = false;
2696
+ if (state.live) render();
2697
+ }, 50);
2698
+ }
2699
+ /** How long a first load waits before it says Loading, so a held catalog shows with no flash. */
2700
+ const LOADING_AFTER_MS = 200;
2485
2701
  async function loadOnce(opts) {
2702
+ const live = state.catalog === null;
2703
+ const progress = live || opts.progress === true || opts.join !== true;
2486
2704
  const args = {
2487
2705
  ...opts.cached === true ? { cached: true } : {},
2488
- ...opts.join === true ? { join: true } : {}
2706
+ ...opts.join === true ? { join: true } : {},
2707
+ ...progress ? { progress: true } : {}
2489
2708
  };
2490
2709
  state.loading = true;
2491
- const result = await call(["list"], args);
2710
+ state.live = live;
2711
+ state.pending = [];
2712
+ state.expected = -1;
2713
+ state.order = [];
2714
+ state.loadStarted = Date.now();
2715
+ const timers = [setTimeout(() => {
2716
+ if (state.live && state.catalog === null) {
2717
+ render();
2718
+ refreshStatus();
2719
+ }
2720
+ }, LOADING_AFTER_MS), setTimeout(() => {
2721
+ if (state.loading && !state.live) refreshStatus();
2722
+ }, WAITING_AFTER_MS)];
2723
+ if (!live) refreshStatus();
2724
+ const result = await call(["list"], args, void 0, progress ? {
2725
+ kind: "catalog-progress",
2726
+ on: onProgress
2727
+ } : void 0);
2728
+ for (const timer of timers) clearTimeout(timer);
2492
2729
  state.loading = false;
2730
+ state.live = false;
2731
+ state.pending = [];
2732
+ state.order = [];
2493
2733
  if (!result.ok) {
2734
+ if (live) announce("loading failed");
2494
2735
  showError("refresh failed", result.status === 0 ? "the server is gone (is it still running?)" : failureText(result));
2495
2736
  return;
2496
2737
  }
@@ -2524,6 +2765,13 @@ async function loadOnce(opts) {
2524
2765
  state.fingerprint = fp;
2525
2766
  state.catalog = cat;
2526
2767
  render();
2768
+ if (live) announce(loadedText(cat));
2769
+ }
2770
+ /** What a screen reader hears when the first load ends. */
2771
+ function loadedText(cat) {
2772
+ const tasks = cat.reports.reduce((n, r) => n + r.tasks.length, 0);
2773
+ const failed = cat.reports.filter((r) => r.status === "error").length;
2774
+ return countTasks(tasks) + " loaded" + (failed > 0 ? ", " + failed + (failed === 1 ? " runner failed" : " runners failed") : "");
2527
2775
  }
2528
2776
  /** What the person is asked before a grant is sent. */
2529
2777
  const TRUST_QUESTION = "Trust this repository? Its runners will be read by running them, now and on every later visit, until you untrust it.";
@@ -3682,16 +3930,21 @@ async function start() {
3682
3930
  wireInput();
3683
3931
  measureChrome();
3684
3932
  $("q").focus();
3685
- const [config] = await Promise.all([
3686
- readConfig(),
3933
+ const config = readConfig().then((config) => {
3934
+ const order = settingValue(config, "runners.order");
3935
+ if (Array.isArray(order)) state.runnerOrder = order.filter((r) => typeof r === "string");
3936
+ state.runnerOrderSource = settingSource(config, "runners.order");
3937
+ });
3938
+ await Promise.all([
3939
+ config,
3687
3940
  load({ cached: true }),
3688
3941
  loadTools()
3689
3942
  ]);
3690
3943
  if (!signedIn()) return;
3691
- const order = settingValue(config, "runners.order");
3692
- if (Array.isArray(order)) state.runnerOrder = order.filter((r) => typeof r === "string");
3693
- state.runnerOrderSource = settingSource(config, "runners.order");
3694
- await load({ join: true });
3944
+ if (state.catalog?.source !== "fresh") await load({
3945
+ join: true,
3946
+ progress: true
3947
+ });
3695
3948
  }
3696
3949
  start();
3697
3950
  //#endregion
@@ -10,6 +10,8 @@
10
10
  of counts and keyboard hints. -->
11
11
  <div class="trustbar" id="trustbar" hidden></div>
12
12
  <div class="status" id="status"></div>
13
+ <!-- One stable live region, so a screen reader hears when loading starts and ends. -->
14
+ <div class="sr-only" id="announce" aria-live="polite"></div>
13
15
  <header>
14
16
  <div class="searchrow">
15
17
  <div class="searchbox">
@@ -682,6 +682,52 @@ main {
682
682
  color: var(--wf-text-muted);
683
683
  }
684
684
 
685
+ /* A runner the first probe has not heard from yet: a quiet tab and a row,
686
+ each with a spinner, until its rows arrive. */
687
+ .tab-loading {
688
+ font: 13px/1 system-ui;
689
+ padding: 9px 14px;
690
+ color: var(--wf-text-muted);
691
+ white-space: nowrap;
692
+ gap: 6px;
693
+ }
694
+ .loading-rows {
695
+ padding: 8px 0;
696
+ }
697
+ .loading-row {
698
+ display: flex;
699
+ align-items: center;
700
+ gap: 8px;
701
+ padding: 5px 0;
702
+ color: var(--wf-text-secondary);
703
+ }
704
+ .loading-row .muted {
705
+ color: var(--wf-text-muted);
706
+ }
707
+ .loading-note {
708
+ color: var(--wf-text-secondary);
709
+ }
710
+ .spinner {
711
+ width: 10px;
712
+ height: 10px;
713
+ flex: none;
714
+ border-radius: 50%;
715
+ border: 2px solid var(--wf-control-border);
716
+ border-top-color: var(--wf-accent);
717
+ animation: spin 0.8s linear infinite;
718
+ }
719
+ @keyframes spin {
720
+ to {
721
+ transform: rotate(360deg);
722
+ }
723
+ }
724
+ @media (prefers-reduced-motion: reduce) {
725
+ .spinner {
726
+ animation: none;
727
+ border-top-color: var(--wf-control-border);
728
+ }
729
+ }
730
+
685
731
  /* The call-chain tree: each level indents one step, and leaves are table
686
732
  rows. Every header sticks below the sticky header and below its own
687
733
  parents, at a top offset this depth's inline style sets. A header stops
@@ -1627,3 +1673,13 @@ kbd {
1627
1673
  .tool-facts dt {
1628
1674
  margin: 0;
1629
1675
  }
1676
+
1677
+ /* Read by screen readers, not drawn. */
1678
+ .sr-only {
1679
+ position: absolute;
1680
+ width: 1px;
1681
+ height: 1px;
1682
+ overflow: hidden;
1683
+ clip-path: inset(50%);
1684
+ white-space: nowrap;
1685
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdlc/wayfinder",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Browse and run every task in a repository from one list: a terminal UI where Enter runs the selected task, a live web view, and JSON for scripts. Tasks, installs, tool trust and git hooks come from @osdlc/system-model.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "sksizer",
@@ -55,15 +55,15 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "zod": "4.4.3",
58
- "@osdlc/cli-tool": "^0.9.0",
59
- "@osdlc/command-seam": "^0.12.0",
58
+ "@osdlc/command-seam": "^0.12.1",
59
+ "@osdlc/cli-tool": "^0.9.1",
60
60
  "@osdlc/config-layers": "^0.7.3",
61
- "@osdlc/detect-harness": "^0.5.0",
62
61
  "@osdlc/etag-write": "^0.2.1",
63
- "@osdlc/system-model": "^0.5.0",
64
- "@osdlc/trust-repo": "^0.4.0",
65
- "@osdlc/typed-git": "^0.8.1",
62
+ "@osdlc/system-model": "^0.6.0",
63
+ "@osdlc/detect-harness": "^0.5.0",
66
64
  "@osdlc/tiered-dirs": "^0.4.0",
65
+ "@osdlc/typed-git": "^0.8.2",
66
+ "@osdlc/trust-repo": "^0.4.0",
67
67
  "@osdlc/ux": "^0.1.0"
68
68
  },
69
69
  "devDependencies": {
@@ -75,9 +75,9 @@
75
75
  "rolldown": "^1.2.14",
76
76
  "typescript": "~6.0.3",
77
77
  "vitest": "^5.0.5",
78
+ "@osdlc/color": "^1.1.0",
78
79
  "@osdlc/prettier-config": "^0.3.1",
79
- "@osdlc/tsconfig": "^0.4.1",
80
- "@osdlc/color": "^1.1.0"
80
+ "@osdlc/tsconfig": "^0.4.1"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "node scripts/write-document-schemas.ts && tsc -p tsconfig.build.json && node scripts/build-web.mjs && node scripts/write-config-schema.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unpkg.com/@osdlc/wayfinder@0.8/schema/config.json",
3
+ "$id": "https://unpkg.com/@osdlc/wayfinder@0.9/schema/config.json",
4
4
  "title": "wayfinder configuration",
5
5
  "type": "object",
6
6
  "properties": {