visualproof 0.4.4 → 0.6.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.
Files changed (82) hide show
  1. package/README.md +16 -7
  2. package/dist/assets/tips/phone-fingers.light.mp4 +0 -0
  3. package/dist/assets/tips/phone-fingers.light.webp +0 -0
  4. package/dist/assets/tips/tour-agent.webp +0 -0
  5. package/dist/assets/tips/tour-arrange.webp +0 -0
  6. package/dist/assets/tips/tour-artwork.webp +0 -0
  7. package/dist/assets/tips/tour-checks.webp +0 -0
  8. package/dist/assets/tips/tour-keys.webp +0 -0
  9. package/dist/assets/tips/tour-library.webp +0 -0
  10. package/dist/assets/tips/tour-project.webp +0 -0
  11. package/dist/assets/tips/tour-review.webp +0 -0
  12. package/dist/assets/tips/tour-share.webp +0 -0
  13. package/dist/assets/tips/tour-source.webp +0 -0
  14. package/dist/assets/tips/tour-target.webp +0 -0
  15. package/dist/assets/tips/tour-view.webp +0 -0
  16. package/dist/assets/tips/tour.json +132 -117
  17. package/dist/assets/tips/tour.webp +0 -0
  18. package/dist/mcp/visualproof-mcp.mjs +20 -9
  19. package/dist/server/access.js +31 -1
  20. package/dist/server/accesspage.js +130 -0
  21. package/dist/server/agent.js +143 -50
  22. package/dist/server/askfollow.js +1 -1
  23. package/dist/server/buildwatch.js +133 -0
  24. package/dist/server/deploy.js +995 -0
  25. package/dist/server/doctor.js +15 -3
  26. package/dist/server/film.js +1 -1
  27. package/dist/server/historyapi.js +100 -50
  28. package/dist/server/historythread.js +206 -0
  29. package/dist/server/hover.js +8 -0
  30. package/dist/server/invites.js +113 -20
  31. package/dist/server/live.js +308 -60
  32. package/dist/server/main.js +450 -77
  33. package/dist/server/mcptools.js +33 -20
  34. package/dist/server/presence.js +3 -3
  35. package/dist/server/prompt.js +8 -3
  36. package/dist/server/readonlygate.js +4 -4
  37. package/dist/server/review.js +27 -7
  38. package/dist/server/reviewapi.js +51 -17
  39. package/dist/server/status.js +119 -46
  40. package/dist/server/talk.js +231 -115
  41. package/dist/server/tokens.js +10 -2
  42. package/dist/server/usage.js +51 -0
  43. package/dist/shared/board.js +2 -1
  44. package/dist/shared/build.js +35 -1
  45. package/dist/shared/collab.js +8 -0
  46. package/dist/shared/deploy.js +35 -0
  47. package/dist/shared/keys.js +66 -37
  48. package/dist/shared/layout.js +297 -70
  49. package/dist/shared/libm.js +366 -0
  50. package/dist/shared/lostfound.js +1 -0
  51. package/dist/shared/mentions.js +83 -0
  52. package/dist/shared/palette.js +1 -1
  53. package/dist/shared/query.js +13 -4
  54. package/dist/shared/review.js +91 -21
  55. package/dist/shared/reviewqueue.js +6 -1
  56. package/dist/shared/separate.js +556 -32
  57. package/dist/web/bundle/app.js +5022 -2736
  58. package/dist/web/bundle/edges.js +2 -1
  59. package/dist/web/bundle/layout.js +1026 -80
  60. package/dist/web/index.html +45 -9
  61. package/dist/web/src/canvas.js +47 -34
  62. package/dist/web/src/overview.js +4 -1
  63. package/dist/web/src/reviewqueue.js +52 -19
  64. package/dist/web/src/scene.js +13 -12
  65. package/dist/web/src/status.js +28 -0
  66. package/dist/web/src/theme.js +108 -0
  67. package/dist/web/src/trust.js +271 -0
  68. package/dist/web/style.css +283 -105
  69. package/docs/agent-api/README.md +13 -11
  70. package/docs/agent-api/advice.md +8 -2
  71. package/docs/agent-api/export.md +1 -1
  72. package/docs/agent-api/following.md +11 -12
  73. package/docs/agent-api/history.md +6 -2
  74. package/docs/agent-api/mcp.md +15 -15
  75. package/docs/agent-api/notes.md +1 -1
  76. package/docs/agent-api/reading.md +2 -2
  77. package/docs/agent-api/requests.md +16 -18
  78. package/docs/agent-api/talking.md +60 -55
  79. package/docs/agent-api/tcb.md +21 -21
  80. package/docs/agent-api/views.md +3 -4
  81. package/docs/agent-api/words.md +8 -8
  82. package/package.json +2 -1
@@ -64,6 +64,17 @@
64
64
  <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true"><path d="M2 8h2.5l1.5-4 3 8 1.5-4H14"/></svg>
65
65
  <span id="activity-badge" class="act-badge" hidden></span>
66
66
  </button>
67
+ <!-- the conversations (CollabSpec decision 13, web/src/talk.ts): opens and closes the reader's
68
+ own conversation window; counts what they have not seen of Everyone, marked where they are
69
+ mentioned or one of their agents answered; a mention's notice under it -->
70
+ <div class="talk-wrap">
71
+ <button id="talk-btn" class="act-btn act-icon" title="Conversations: everyone on this page, and your agents" aria-label="Conversations" aria-pressed="false" hidden>
72
+ <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true"><path d="M3.2 3h9.6c.7 0 1.2.5 1.2 1.2v5.6c0 .7-.5 1.2-1.2 1.2H7.6L4.6 13.4V11H3.2C2.5 11 2 10.5 2 9.8V4.2C2 3.5 2.5 3 3.2 3z"/></svg>
73
+ <span id="talk-badge" class="act-badge" hidden></span>
74
+ <span id="talk-at" class="talk-at" aria-hidden="true" hidden>@</span>
75
+ </button>
76
+ <button id="talk-notice" class="glass" type="button" hidden></button>
77
+ </div>
67
78
  <!-- the others' initials: a person's opens their menu, to follow them or ask them to follow
68
79
  you; under them, what your request to follow came to (web/src/peermenu.ts,
69
80
  web/src/askfollow.ts) -->
@@ -83,9 +94,10 @@
83
94
  <button id="help-btn" class="help-btn" title="Help: tips, keys, the tour (?)" aria-label="Help" aria-haspopup="menu" aria-expanded="false">?</button>
84
95
  <div id="help-menu" class="glass" role="menu" aria-label="Help" hidden></div>
85
96
  </div>
86
- <!-- on a phone the bar's buttons are in one menu (web/src/phone.ts) -->
97
+ <!-- on a phone the bar's buttons are in one menu, what is new under it on it: Activity's count
98
+ and the conversations', their mark (web/src/phone.ts) -->
87
99
  <div class="more-wrap">
88
- <button id="more-btn" class="act-btn act-icon" aria-label="More" aria-haspopup="menu" aria-expanded="false" title="Share, the library, export, activity, your name, help"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><circle cx="3.5" cy="8" r="1.3"/><circle cx="8" cy="8" r="1.3"/><circle cx="12.5" cy="8" r="1.3"/></svg><span id="more-badge" class="act-badge" hidden></span></button>
100
+ <button id="more-btn" class="act-btn act-icon" aria-label="More" aria-haspopup="menu" aria-expanded="false" title="Share, the library, export, activity, the conversations, your name, help"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><circle cx="3.5" cy="8" r="1.3"/><circle cx="8" cy="8" r="1.3"/><circle cx="12.5" cy="8" r="1.3"/></svg><span id="more-badge" class="act-badge" hidden></span><span id="more-at" class="talk-at" aria-hidden="true" hidden>@</span></button>
89
101
  <div id="more-pop" class="glass" role="menu" aria-label="More" hidden></div>
90
102
  </div>
91
103
  </div>
@@ -216,14 +228,36 @@
216
228
  <!-- the canvas's menu: a right click, the ContextMenu key or Shift+F10 (web/src/ctxmenu.ts) -->
217
229
  <div id="ctxmenu" role="menu" aria-label="Actions" tabindex="-1" hidden></div>
218
230
  <!-- the floating windows, the one pressed or focused last in front (web/src/floatwin.ts): the
219
- source windows (web/src/sourcewin.ts adds each) and the following strip -->
231
+ source windows (web/src/sourcewin.ts adds each); the conversation window in front of them all,
232
+ always (ReviewSpec, "In front"); the following strip -->
220
233
  <div id="windows">
221
- <!-- following someone: the strip; following an agent that can be talked to, a window with the
222
- strip as its title bar, the conversation, and the pill it collapses to (web/src/people.ts,
223
- web/src/talk.ts, web/src/chatwin.ts, which adds the edges that resize it) -->
224
- <div id="following" class="glass" hidden>
225
- <div class="fl-strip"></div><div id="talk" hidden></div>
226
- <div class="fl-pill"><button class="fl-pill-open" type="button"><span class="fl-pill-text"></span><span class="fl-new" title="A new reply"></span></button><button data-unfollow type="button" title="Stop following" aria-label="Stop following">✕</button></div>
234
+ <!-- following someone: the strip, whom and its ✕ (web/src/people.ts) -->
235
+ <div id="following" class="glass" hidden><div class="fl-strip"></div></div>
236
+ <!-- the conversation window, the reader's own (CollabSpec decision 13): its channels at its head,
237
+ the thread, the agent's state, the box, and the pill it collapses to (web/src/chatwin.ts,
238
+ which adds the edges that resize it; web/src/talk.ts; web/src/chatinput.ts) -->
239
+ <div id="convo" class="glass" role="region" aria-label="Conversations" hidden>
240
+ <div class="cv-head">
241
+ <div class="cv-tabs" role="tablist" aria-label="Channels"></div>
242
+ <button data-cv-new type="button" aria-label="New conversation" hidden><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M3.2 2.8h9.6c.7 0 1.2.5 1.2 1.2v6.2c0 .7-.5 1.2-1.2 1.2H7.4L4.5 13.8v-2.4H3.2c-.7 0-1.2-.5-1.2-1.2V4c0-.7.5-1.2 1.2-1.2z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/><path d="M8 4.9v4.2M5.9 7h4.2" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg></button>
243
+ <button data-collapse type="button" title="Collapse to one line (or double-click the title bar)" aria-label="Collapse"><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 8.5h8" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg></button>
244
+ <button data-cv-close type="button" title="Close the conversations (the button at the top opens them again)" aria-label="Close">✕</button>
245
+ </div>
246
+ <div class="cv-body">
247
+ <div class="cv-thread tk-thread" aria-live="polite"></div>
248
+ <div class="cv-state" hidden></div>
249
+ <form class="cv-form" autocomplete="off">
250
+ <div class="cv-mentions glass" role="listbox" aria-label="Mention" hidden></div>
251
+ <div class="cv-input" role="textbox" aria-multiline="true" aria-label="Your message" contenteditable="true" spellcheck="true"></div>
252
+ <div class="cv-tools">
253
+ <button type="button" class="cv-tool" data-cv-link title="Insert a link to what you see: it shows as what it leads to, and carries no key"><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M6.5 9.5l3-3M7 4.5l1.2-1.2a2.6 2.6 0 0 1 3.7 3.7L10.7 8.2M9 11.5l-1.2 1.2a2.6 2.6 0 0 1-3.7-3.7L5.3 7.8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg><span>What I see</span></button>
254
+ <span class="cv-hint muted">Enter sends · Shift+Enter, a new line · @ mentions</span>
255
+ <button type="submit" class="rv-btn primary">Send</button>
256
+ </div>
257
+ <div class="cv-err" hidden></div>
258
+ </form>
259
+ </div>
260
+ <div class="fl-pill"><button class="fl-pill-open" type="button"><span class="fl-pill-text"></span><span class="fl-new" title="Something new"></span></button><button data-cv-close type="button" title="Close the conversations" aria-label="Close">✕</button></div>
227
261
  </div>
228
262
  </div>
229
263
  <!-- someone asks you to follow them (CollabSpec decision 10, web/src/askfollow.ts): at the top
@@ -252,6 +286,8 @@
252
286
  <button type="submit" id="who-ok" class="rv-btn primary">Continue</button>
253
287
  </div>
254
288
  </form>
289
+ <!-- the personal link the reader came by, shown to them alone, in the form's place (web/src/mylink.ts) -->
290
+ <div id="mylink" class="modal-box glass" role="dialog" aria-modal="true" aria-labelledby="mylink-title" hidden></div>
255
291
  </div>
256
292
  <div id="export-modal" hidden></div>
257
293
  <div id="tip" class="tip" hidden></div>
@@ -10,17 +10,18 @@
10
10
  // folds the reader's selected visitor opens are the reader's alone.
11
11
  import { SITE_BODY, SITE_STMT } from "../../shared/graph.js";
12
12
  import { rgba } from "./gl/gl.js";
13
- import { FLAG_DASHED, FLAG_GLOW, FLAG_HALO, FLAG_RADIAL, FLAG_SHADED, Renderer, UNIT_DOT, UNIT_WORLD, bundle, bundlePath, circle, segment } from "./gl/renderer.js";
13
+ import { BUNDLE_STRIDE, FLAG_DASHED, FLAG_GLOW, FLAG_HALO, FLAG_RADIAL, FLAG_SHADED, Renderer, UNIT_DOT, UNIT_WORLD, bundle, bundlePath, circle, segment } from "./gl/renderer.js";
14
14
  import { joinChains, pathOf } from "./bundles.js";
15
15
  import { EdgeQueue } from "./edgequeue.js";
16
- import { DIM, aim, blendPoints, ease, weightGap, zoomPoint } from "./overview.js";
16
+ import { DIM, OVERVIEW_CROWD, aim, blendPoints, ease, weightGap, zoomPoint } from "./overview.js";
17
17
  import { MODE_SITES } from "../../shared/viewgraph.js";
18
18
  import { escapeHtml } from "./highlight.js";
19
19
  import { ART_DISPLAY, ART_SANS, ART_SERIF, spacedWidth, writeNames } from "./halo.js";
20
20
  import { artNameId } from "../../shared/collab.js";
21
21
  import { dragKeyHeld, dragMoves, menuClick } from "./drag.js";
22
22
  import { Motion } from "./motion.js";
23
- import { ST_APPROVED, ST_BUILDING, ST_COMMENTED, ST_FAILED, ST_SORRY, ST_TRUSTED, ST_UNREVIEWED, STATUSES } from "./status.js";
23
+ import { onThemeChange, reducedMotion } from "./theme.js";
24
+ import { clusterTroubles, ST_APPROVED, ST_COMMENTED, ST_TRUSTED, ST_UNREVIEWED, STATUSES } from "./status.js";
24
25
  import { LEAF_R, Scene } from "./scene.js";
25
26
  import { AXIOM_AT, AXIOM_OUT, AXIOM_W, kindDot, LIT, outside, pickRadius, ringed } from "./axiomring.js";
26
27
  import { markWords, PAST_CHANGED, PAST_GHOST, PAST_RENAMED } from "./past.js";
@@ -86,6 +87,7 @@ export function themeOf(v) {
86
87
  pin: rgba(v("--label")),
87
88
  edgeFrom: rgba(v("--edge-from")),
88
89
  edgeTo: rgba(v("--edge-to")),
90
+ edgeCrowd: Math.max(0, parseFloat(v("--edge-crowd")) || 0),
89
91
  kind,
90
92
  ext: rgba(v("--k-external")),
91
93
  lit: rgba(v("--accent")),
@@ -109,6 +111,14 @@ function sameTarget(a, b) {
109
111
  return a.c === b.c;
110
112
  return a.k === b.k;
111
113
  }
114
+ /** How much fainter each of `n` edges drawn at once is, beyond what every theme does, where more than
115
+ * `from` are: (from / n)^crowd, the theme's `crowd` (Theme.edgeCrowd; 1 for a crowd of 0). Edges
116
+ * that cross add up towards the colour of their mix, at full opacity once enough of them do: on the
117
+ * light ground a dense bundle reads as ink, on the dark one as light — the orange and the blue of
118
+ * hundreds of edges a pink-white haze. The dark theme has them step back as they grow many. */
119
+ export function crowdFade(n, from, crowd) {
120
+ return crowd > 0 && n > from ? (from / n) ** crowd : 1;
121
+ }
112
122
  /** A colour at `k` of its opacity. */
113
123
  const fade = (c, k) => [c[0], c[1], c[2], c[3] * k];
114
124
  /** How many lit declarations the board gives a card at zoom `k`: a card's name is what an artwork
@@ -120,22 +130,6 @@ const CARD_CAP = 180;
120
130
  /** position ids kept past the scene's for the visitors and their temporary clusters, whose edges are
121
131
  * bundled through them (web/src/visits.ts, visitChain) */
122
132
  const VISIT_SLOTS = 256;
123
- /** A file cluster's own build trouble, as a Status code (failed, building, sorry), or -1: what its
124
- * outline shows in the Status scheme. Trouble inherited from below (blocked, out of date because
125
- * something under it changed) is left out, so that one failure does not ring every file above it. */
126
- function troubleOf(f) {
127
- switch (f?.state) {
128
- case "failed":
129
- case "unbuilt":
130
- return ST_FAILED;
131
- case "building":
132
- return ST_BUILDING;
133
- case "sorry":
134
- return ST_SORRY;
135
- default:
136
- return -1;
137
- }
138
- }
139
133
  /** A late zoom point is caught up at up to this many times the zoom's own pace: the drawn blend moves
140
134
  * by at most CATCH_UP · |Δz| of weight in a frame where the camera zoomed by Δz zoom points. */
141
135
  const CATCH_UP = 2;
@@ -204,7 +198,8 @@ export class GraphCanvas {
204
198
  sceneDirty = true;
205
199
  anim = null;
206
200
  repSeen = -1;
207
- /** each file cluster's own build trouble (troubleOf), for its outline in the Status scheme */
201
+ /** each cluster's own build trouble (status.ts, clusterTroubles), -1 for none: its outline in the
202
+ * Status scheme */
208
203
  clusterTrouble = new Int8Array(0);
209
204
  files = new Map();
210
205
  /** how the layout on show clusters: a file's own build trouble outlines its cluster only when
@@ -303,6 +298,8 @@ export class GraphCanvas {
303
298
  overviewStyled = "";
304
299
  overviewStyle = 0;
305
300
  overviewDrawn = "";
301
+ /** counts the themes the board has been drawn in (setTheme): the overview's drawing is of one */
302
+ themeSerial = 0;
306
303
  /** the reader's visitors (setVisitors), and those of them selected (ringed as a selected point is) */
307
304
  visitors = [];
308
305
  visitorSel = [];
@@ -343,11 +340,9 @@ export class GraphCanvas {
343
340
  return;
344
341
  }
345
342
  this.theme = readTheme();
346
- // light or dark changed (the reader's choice, or the system's): the colours are read again
347
- new MutationObserver(() => {
348
- this.theme = readTheme();
349
- this.invalidate();
350
- }).observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
343
+ // light or dark changed (the reader's choice, the system's, an artwork's look): the colours are
344
+ // read again
345
+ onThemeChange(() => this.setTheme(readTheme()));
351
346
  new ResizeObserver(() => this.resize()).observe(this.canvas);
352
347
  this.resize();
353
348
  this.bindInput();
@@ -377,6 +372,13 @@ export class GraphCanvas {
377
372
  request() {
378
373
  this.dirty = true;
379
374
  }
375
+ /** The board's colours are `th` now (the theme on show changed): everything is drawn again in them,
376
+ * the overview's edges too, whose drawing is otherwise kept while what it shows is the same. */
377
+ setTheme(th) {
378
+ this.theme = th;
379
+ this.themeSerial++;
380
+ this.invalidate();
381
+ }
380
382
  /** Without a browser (ExportSpec decision 21): draw until nothing more comes — the scene at rest,
381
383
  * the overview's points chosen and blended, nothing asking for another frame — at most `most`
382
384
  * frames; whether it came to rest. */
@@ -610,12 +612,9 @@ export class GraphCanvas {
610
612
  recomputeStates() {
611
613
  if (!this.layout)
612
614
  return;
613
- this.clusterTrouble = new Int8Array(this.layout.clusters.length);
614
- // in the file layout a cluster is a module (or a directory of them); under namespaces a
615
- // cluster's key is a namespace, which can read like a module's name without being its file
616
- if (this.clustering !== "module")
617
- return;
618
- this.layout.clusters.forEach((c, k) => (this.clusterTrouble[k] = troubleOf(this.files.get(c.key))));
615
+ // in the file layout a cluster is a module (or a directory of them); under namespaces none has
616
+ // an outline of its own
617
+ this.clusterTrouble = clusterTroubles(this.layout.clusters, this.clustering, this.files);
619
618
  }
620
619
  setLayout(layout, places, foldedKeys, clustering) {
621
620
  this.layout = layout;
@@ -1483,8 +1482,11 @@ export class GraphCanvas {
1483
1482
  }
1484
1483
  this.animate({ x, y, k }, dur);
1485
1484
  }
1486
- /** The camera carried to `goal` over `dur` ms, easing in and out. */
1485
+ /** The camera carried to `goal` over `dur` ms, easing in and out; with reduced motion there at
1486
+ * once (theme.ts, reducedMotion): a flight, a fit, the zoom buttons, an artwork's frame closing in. */
1487
1487
  animate(goal, dur) {
1488
+ if (reducedMotion())
1489
+ return this.jumpTo(goal);
1488
1490
  if (this.anim)
1489
1491
  cancelAnimationFrame(this.anim);
1490
1492
  const { x, y, k } = goal;
@@ -2051,7 +2053,9 @@ export class GraphCanvas {
2051
2053
  sel.clear();
2052
2054
  if (act && this.edges.length && this.art?.edges !== "none") {
2053
2055
  const count = this.edges.length / 3;
2054
- const fade = count < 250 ? 1 : Math.max(0.25, Math.sqrt(250 / count));
2056
+ // the theme's own fading (crowdFade) from fewer: a selection's edges are bundled into few
2057
+ // trunks, a hundred of them already one bright band
2058
+ const fade = (count < 250 ? 1 : Math.max(0.25, Math.sqrt(250 / count))) * crowdFade(count, 100, th.edgeCrowd);
2055
2059
  const width = count > 4000 ? 1 : 1.6;
2056
2060
  const rep = S.nodeRep;
2057
2061
  const id = (i) => (rep[i] >= 0 ? rep[i] : S.nc + i);
@@ -2501,7 +2505,7 @@ export class GraphCanvas {
2501
2505
  const p = Q.points.get(point);
2502
2506
  return { looks: p.looks, index: Q.indexOf(p), w, scale: dimNow / (p.dim ? DIM : 1) };
2503
2507
  });
2504
- const drawn = `${this.overviewStyle}|${dim}|${W.map((x) => `${Q.points.get(x.point).serial}:${x.w.toFixed(3)}`).join(",")}`;
2508
+ const drawn = `${this.themeSerial}|${this.overviewStyle}|${dim}|${W.map((x) => `${Q.points.get(x.point).serial}:${x.w.toFixed(3)}`).join(",")}`;
2505
2509
  if (drawn === this.overviewDrawn)
2506
2510
  return;
2507
2511
  this.overviewDrawn = drawn;
@@ -2516,6 +2520,15 @@ export class GraphCanvas {
2516
2520
  [c1[0], c1[1], c1[2], c1[3]] = [to[0], to[1], to[2], (styled ? to[3] : 1) * alpha];
2517
2521
  bundlePath(L, P.path, 8 * j, P.len[j], beta, width, c0, c1);
2518
2522
  });
2523
+ // the theme's own fading with their number (crowdFade), from the number at which the overview's
2524
+ // choice starts fading them (web/src/overview.ts, looksOf)
2525
+ const k = crowdFade(L.count, OVERVIEW_CROWD, this.theme.edgeCrowd);
2526
+ if (k < 1)
2527
+ for (let n = 0; n < L.count; n++) {
2528
+ const o = n * BUNDLE_STRIDE;
2529
+ L.data[o + 15] *= k;
2530
+ L.data[o + 19] *= k;
2531
+ }
2519
2532
  }
2520
2533
  /** The colours of a bundled edge from `a` to `b` (ids of the scene's clusters, and of its
2521
2534
  * declarations past them), from the end that uses: the theme's; an artwork's cells', from one
@@ -237,7 +237,7 @@ export class OverviewModel {
237
237
  const Y = (id) => (id < nc ? S.cwy[id] : S.nwy[id - nc]);
238
238
  // many bundles share the screen: the more there are, the fainter each; with a selection the
239
239
  // overview steps back so the selection's own edges read
240
- const crowd = Math.min(1, Math.sqrt(400 / Math.max(1, n)));
240
+ const crowd = Math.min(1, Math.sqrt(OVERVIEW_CROWD / Math.max(1, n)));
241
241
  const fade = (ask.dim ? DIM : 1) * crowd;
242
242
  // few edges in view (zoomed in): even a single one clearly visible
243
243
  const floor = 0.05 + 0.3 * Math.min(1, Math.max(0, (1200 - nIn) / 900));
@@ -265,6 +265,9 @@ export class OverviewModel {
265
265
  return looks;
266
266
  }
267
267
  }
268
+ /** The number of bundles past which the more there are, the fainter each (looksOf); a theme's own
269
+ * fading with their number starts there too (web/src/canvas.ts, crowdFade). */
270
+ export const OVERVIEW_CROWD = 400;
268
271
  /** How much a selection dims the overview, so that its own edges read, the rest still seen faintly:
269
272
  * on the board and in an artwork alike (the owner's decision of 2026-10-15; 0.12 before). */
270
273
  export const DIM = 0.3;
@@ -15,15 +15,18 @@
15
15
  // them. Their advice is never counted here: the progress and what the reader reviewed are people's.
16
16
  //
17
17
  // Key declarations come first in reading (ExportSpec decision 4): progress has two levels, key
18
- // (approved of the key declarations, the target among them) and all (approved of the review). They
19
- // are marked ◆ in the review list, which can show them alone; what each supports is shared/keys.ts.
18
+ // (approved of the key declarations that need review, the target among them, those trusted told
19
+ // apart as "+N trusted") and all (approved of the review). They are marked ◆ in the review list,
20
+ // which can show them alone, the trusted ones among them (the owner's decision of 2026-10-19: a key
21
+ // declaration is a member of the TCB, trusted or not); what each supports is shared/keys.ts.
20
22
  import { SITE_STMT } from "../../shared/graph.js";
21
23
  import { advice, adviceOf, fresh, statusOf } from "../../shared/review.js";
22
- import { keyGraph, statusCounts } from "../../shared/keys.js";
23
- import { keyMarks } from "../../shared/review.js";
24
- import { inTargets, nonStandardAxiom, offBoard, queueProgress, reviewQueue, settled, whyChain } from "../../shared/reviewqueue.js";
24
+ import { keyCounts, keyGraph } from "../../shared/keys.js";
25
+ import { keyMarks, trustedBy } from "../../shared/review.js";
26
+ import { inTargets, nonStandardAxiom, offBoard, queueProgress, reviewQueue, settled, TCB_SITES, whyChain } from "../../shared/reviewqueue.js";
25
27
  import { BOT } from "./agentmark.js";
26
28
  import { escapeHtml } from "./highlight.js";
29
+ import { SHIELD } from "./trust.js";
27
30
  /** How a declaration reads in a chain: with its namespace's last part, which tells `Module.env`
28
31
  * from `ModExpr.env`. */
29
32
  function chainName(g, i) {
@@ -66,7 +69,7 @@ export class ReviewFlow {
66
69
  const k = this.states.findIndex((s) => s.g === g);
67
70
  let st = k >= 0 ? this.states.splice(k, 1)[0] : null;
68
71
  if (!st || st.review !== review)
69
- st = { g, review, orders: new Map(), shared: null, keyGraphs: new Map() };
72
+ st = { g, review, orders: new Map(), tcbs: new Map(), shared: null, keyGraphs: new Map() };
70
73
  this.states.push(st);
71
74
  if (this.states.length > KEEP_FLOWS)
72
75
  this.states.shift();
@@ -93,14 +96,32 @@ export class ReviewFlow {
93
96
  isKey(root, i) {
94
97
  return i === root || this.keys(root).keys.includes(i);
95
98
  }
96
- /** Whether `i` is in what `root`'s review holds: what can be marked key for it. */
99
+ /** Whether `i` is a key declaration of `root` that needs no review: trusted. */
100
+ isTrustedKey(root, i) {
101
+ return this.keys(root).trusted.includes(i);
102
+ }
103
+ /** Whether `i` is in what `root`'s review holds. */
97
104
  inReview(root, i) {
98
105
  return this.queue(root).order.includes(i);
99
106
  }
100
- /** How far the review of `root`'s key declarations has come: approved of K, the target among
101
- * them. */
107
+ /** `root`'s TCB: statement and body reach. */
108
+ tcb(root) {
109
+ const st = this.state();
110
+ let t = st.tcbs.get(root);
111
+ if (!t)
112
+ st.tcbs.set(root, (t = st.g.reach([root], TCB_SITES, "out")));
113
+ return t;
114
+ }
115
+ /** Whether `i` can be marked key for `root` (ExportSpec decision 1, the owner's decision of
116
+ * 2026-10-19): a member of its TCB, trusted or not, in the project or outside it, or of its review
117
+ * set (a non-standard axiom reached through proofs alone) — never the target itself. */
118
+ keyable(root, i) {
119
+ return i !== root && (this.tcb(root)[i] === 1 || this.inReview(root, i));
120
+ }
121
+ /** How far the review of `root`'s key declarations has come: approved of those that need review
122
+ * (K, the target among them), the trusted ones counted apart. */
102
123
  keyProgress(root) {
103
- return statusCounts(this.hooks.graph(), this.hooks.review(), this.keys(root).keys);
124
+ return keyCounts(this.hooks.graph(), this.hooks.review(), this.keys(root));
104
125
  }
105
126
  /** How far `root`'s review has come: its review set, and the axioms beside it. */
106
127
  progress(root) {
@@ -122,9 +143,10 @@ export class ReviewFlow {
122
143
  const q = this.queue(root);
123
144
  return q.order.filter((i) => !this.done(i)).length + offBoard(q).filter((a) => !this.axiomDone(a)).length;
124
145
  }
125
- /** What is left of `root`'s key declarations for this reader. */
146
+ /** What is left of `root`'s key declarations for this reader: those that need review. */
126
147
  keysLeft(root) {
127
- return this.keys(root).keys.filter((i) => !this.done(i)).length;
148
+ const kg = this.keys(root);
149
+ return kg.keys.filter((i) => !kg.trusted.includes(i) && !this.done(i)).length;
128
150
  }
129
151
  /** The declarations of `root`'s TCB that an agent comments on (advice on the present version), in
130
152
  * review order. */
@@ -161,7 +183,7 @@ export class ReviewFlow {
161
183
  ? ` · <span class="lens-adv" title="${escapeHtml(`${who.join(", ")} (agent${who.length === 1 ? "" : "s"}) ${who.length === 1 ? "comments" : "comment"} on ${commented.length} declaration${commented.length === 1 ? "" : "s"} here — advice, not counted; the target's review list marks them`)}">${BOT}${escapeHtml(who.length === 1 ? `${who[0]} comments on` : "Agents comment on")} ${commented.length}</span>`
162
184
  : "";
163
185
  meta.innerHTML =
164
- `· <span class="lens-key" title="${escapeHtml(`Key declarations: ${k.approved} of ${k.total} approved (the target among them) · ${keysLeft} not yet reviewed by you`)}"><span class="key-mark">◆</span>${k.approved} / ${k.total}</span>` +
186
+ `· <span class="lens-key" title="${escapeHtml(`Key declarations: ${k.approved} of the ${k.total} that need review approved (the target among them) · ${keysLeft} not yet reviewed by you${k.trusted ? ` · ${k.trusted} more trusted, needing no review` : ""}`)}"><span class="key-mark">◆</span>${k.approved} / ${k.total}${k.trusted ? ` <span class="muted">+${k.trusted} trusted</span>` : ""}</span>` +
165
187
  ` · ${p.approved} / ${p.total} approved` + (p.commented ? ` · ${p.commented} commented` : "") + (p.stale ? ` · ${p.stale} stale` : "") + adv +
166
188
  // the reader's own part done: an opinion on every one, every non-standard axiom approved
167
189
  (left ? "" : ` · <span class="lens-done">All reviewed ✓</span>`);
@@ -173,15 +195,18 @@ export class ReviewFlow {
173
195
  /** The panel's list of a target's review in review order: numbered, the review status of each,
174
196
  * the ones the reader reviewed faded. A non-standard axiom says so, and
175
197
  * where it is used; one the graph has no declaration for on the board is listed first, and goes
176
- * to the target, whose panel approves it. */
198
+ * to the target, whose panel approves it. `keyOnly` (◆ Key): the key declarations alone, in their
199
+ * order (shared/keys.ts, keySet) — the trusted ones first, marked trusted and unnumbered, since
200
+ * they are not in the review order; then the rest, numbered as in the review order. */
177
201
  listHtml(root, keyOnly = false) {
178
202
  const g = this.hooks.graph();
179
203
  const d = this.hooks.review();
180
204
  const q = this.queue(root);
181
- const keys = new Set(this.keys(root).keys);
205
+ const kg = this.keys(root);
206
+ const keys = new Set(kg.keys);
182
207
  const off = keyOnly ? [] : offBoard(q);
183
208
  // the positions are the review order's, also where only the key declarations are listed
184
- const order = keyOnly ? q.order.filter((i) => keys.has(i)) : q.order;
209
+ const order = keyOnly ? kg.keys : q.order;
185
210
  const position = new Map(q.order.map((i, k) => [i, k]));
186
211
  const offN = offBoard(q).length;
187
212
  const where = (a) => (a.via.length ? ` · used in ${a.via.map((j) => chainName(g, j)).join(", ")}` : "");
@@ -190,15 +215,23 @@ export class ReviewFlow {
190
215
  `<span class="q-n">${k + 1}</span>axiom ${escapeHtml(a.name)}<span class="muted">${escapeHtml(where(a))}</span></button>`);
191
216
  const kp = this.keyProgress(root);
192
217
  const note = keyOnly
193
- ? `The key declarations, ◆, in review order: ${kp.approved} of ${kp.total} approved, ${this.keysLeft(root)} not yet reviewed by you.`
218
+ ? `The key declarations, ◆, ${kp.trusted ? `${kp.trusted} trusted first, needing no review, then the rest ` : ""}in review order: ${kp.approved} of ${kp.total} approved, ${this.keysLeft(root)} not yet reviewed by you.`
194
219
  : `Non-standard axioms first, then bottom-up: what a declaration uses comes before it; ` +
195
220
  `${this.left(root)} of ${q.order.length + offN} not yet reviewed by you.`;
196
221
  return (`<div class="q-note muted">${note}</div>` +
197
222
  `<div class="q-list">` +
198
223
  offRows.join("") +
199
224
  order
200
- .map((i, k) => {
225
+ .map((i) => {
201
226
  const v = g.nodes[i];
227
+ const at = position.get(i);
228
+ // a trusted key declaration: read with the others, in need of no review, so no status and
229
+ // no place in the review order (ExportSpec decision 1)
230
+ if (at === undefined) {
231
+ const by = trustedBy(d, v.name, v.module, g.isExt(i));
232
+ return (`<button class="row q-row q-key rv-trusted" data-walk="${i}" title="${escapeHtml(`Go to ${v.name} — a key declaration, trusted without review${by.length ? `, under ${by.join(" and ")}` : ""}: it is read with the others and needs no opinion`)}">` +
233
+ `<span class="q-n q-trusted" aria-label="trusted">${SHIELD}</span>${i === root ? `<span class="star">★</span>` : `<span class="key-mark">◆</span>`}${escapeHtml(v.name)}<span class="muted"> · trusted</span></button>`);
234
+ }
202
235
  const mine = this.done(i);
203
236
  const cls = `row q-row rv-${statusOf(d, v.name, v.hash)}${mine ? " q-mine" : ""}`;
204
237
  const what = mine ? " — you reviewed it" : "";
@@ -208,7 +241,7 @@ export class ReviewFlow {
208
241
  const ax = axiomOf.get(i);
209
242
  const key = i !== root && keys.has(i);
210
243
  return (`<button class="${cls}${key ? " q-key" : ""}" data-walk="${i}" title="Go to ${escapeHtml(v.name)}${what}${key ? " — a key declaration" : ""}${ax ? escapeHtml(` — a non-standard axiom${where(ax)}`) : ""}">` +
211
- `<span class="q-n">${offN + position.get(i) + 1}</span>${i === root ? `<span class="star">★</span>` : key ? `<span class="key-mark">◆</span>` : ""}${ax ? "axiom " : ""}${escapeHtml(v.name)}${ax ? `<span class="muted">${escapeHtml(where(ax))}</span>` : ""}${mark}</button>`);
244
+ `<span class="q-n">${offN + at + 1}</span>${i === root ? `<span class="star">★</span>` : key ? `<span class="key-mark">◆</span>` : ""}${ax ? "axiom " : ""}${escapeHtml(v.name)}${ax ? `<span class="muted">${escapeHtml(where(ax))}</span>` : ""}${mark}</button>`);
212
245
  })
213
246
  .join("") +
214
247
  `</div>`);
@@ -16,6 +16,7 @@
16
16
  // The scene may hold room for what is not the board's: the discs the reader's visitors and their
17
17
  // temporary clusters take (ViewSpec decision 27; web/src/visits.ts). What they cover makes way, as
18
18
  // from a drop; they are never pins, and when they go everything is where it was.
19
+ import { hypot } from "../../shared/libm.js";
19
20
  import { Separator } from "../../shared/separate.js";
20
21
  /** collision radius of a declaration, as the server packs them */
21
22
  export const LEAF_R = 5;
@@ -423,7 +424,7 @@ export class Scene {
423
424
  if (p < 0)
424
425
  return [lx, ly];
425
426
  const room = Math.max(0, this.homeR[p] - this.padOf(p) - r);
426
- const d = Math.hypot(lx, ly);
427
+ const d = hypot(lx, ly);
427
428
  return d > room ? [(lx * room) / d, (ly * room) / d] : [lx, ly];
428
429
  }
429
430
  /** Room between a cluster's contents and its circle, for its label. */
@@ -520,9 +521,9 @@ export class Scene {
520
521
  const DENSITY = 0.72;
521
522
  let area = 0;
522
523
  for (const it of (shrunk ? items : []).filter((x) => !x.pinned).sort((a, b) => a.hx * a.hx + a.hy * a.hy - (b.hx * b.hx + b.hy * b.hy))) {
523
- const len = Math.hypot(it.hx, it.hy);
524
+ const len = hypot(it.hx, it.hy);
524
525
  const ux = len > 1e-6 ? it.hx / len : 1, uy = len > 1e-6 ? it.hy / len : 0;
525
- area += (Math.PI * (it.r + GAP / 2) ** 2) / DENSITY;
526
+ area += (Math.PI * ((it.r + GAP / 2) * (it.r + GAP / 2))) / DENSITY;
526
527
  const d = Math.min(len, Math.max(0, Math.sqrt(area / Math.PI) - it.r));
527
528
  it.x = ux * d;
528
529
  it.y = uy * d;
@@ -545,7 +546,7 @@ export class Scene {
545
546
  const inward = shrunk && !grown && !pinned;
546
547
  const room = self >= 0 ? homeR - this.padOf(self) : Infinity;
547
548
  const limit = Float64Array.from(items, (it) => {
548
- const len = Math.hypot(it.hx, it.hy);
549
+ const len = hypot(it.hx, it.hy);
549
550
  return inward ? len : Math.max(len, room - it.r);
550
551
  });
551
552
  const sep = this.separator;
@@ -585,7 +586,7 @@ export class Scene {
585
586
  });
586
587
  let extent = 0;
587
588
  for (const it of items) {
588
- extent = Math.max(extent, Math.hypot(it.x, it.y) + it.r);
589
+ extent = Math.max(extent, hypot(it.x, it.y) + it.r);
589
590
  if (it.c >= 0) {
590
591
  this.ancCX[it.c] = it.x;
591
592
  this.ancCY[it.c] = it.y;
@@ -629,17 +630,17 @@ export class Scene {
629
630
  const idx = Array.from({ length: n }, (_, j) => j);
630
631
  const B = { n, x, y, r, pinned, seq, big: Int32Array.from(idx.filter((j) => r[j] > LEAF_R + 0.1)), small: Int32Array.from(idx.filter((j) => r[j] <= LEAF_R + 0.1)) };
631
632
  const room = self >= 0 ? homeR - this.padOf(self) : Infinity;
632
- const limit = Float64Array.from(idx, (j) => Math.max(Math.hypot(x[j], y[j]), room - r[j]));
633
+ const limit = Float64Array.from(idx, (j) => Math.max(hypot(x[j], y[j]), room - r[j]));
633
634
  // how far the children reach before they make way: the circle grows by what they are pushed out
634
635
  let reach = 0;
635
636
  for (let j = 0; j < nk; j++)
636
- reach = Math.max(reach, Math.hypot(x[j], y[j]) + r[j]);
637
+ reach = Math.max(reach, hypot(x[j], y[j]) + r[j]);
637
638
  // only what a held disc covers makes way: overlaps the board's own arrangement has are its own
638
639
  // (a layout may hold some), and stay as they are where the held discs cover nothing
639
640
  let covers = false;
640
641
  for (let h = nk; h < n && !covers; h++)
641
642
  for (let j = 0; j < n && !covers; j++)
642
- if (j !== h && Math.hypot(x[j] - x[h], y[j] - y[h]) < r[j] + r[h] - 0.5)
643
+ if (j !== h && hypot(x[j] - x[h], y[j] - y[h]) < r[j] + r[h] - 0.5)
643
644
  covers = true;
644
645
  const sep = this.separator;
645
646
  if (covers) {
@@ -665,7 +666,7 @@ export class Scene {
665
666
  return 0;
666
667
  let pushed = 0, own = 0;
667
668
  for (let j = 0; j < n; j++) {
668
- const d = Math.hypot(x[j], y[j]) + r[j];
669
+ const d = hypot(x[j], y[j]) + r[j];
669
670
  if (j < nk)
670
671
  pushed = Math.max(pushed, d);
671
672
  else
@@ -783,17 +784,17 @@ export class Scene {
783
784
  let reach = 0;
784
785
  const x = this.cwx[c], y = this.cwy[c];
785
786
  for (const k of this.kidsC[c])
786
- reach = Math.max(reach, Math.hypot(this.cwx[k] - x, this.cwy[k] - y) + this.drawnR[k]);
787
+ reach = Math.max(reach, hypot(this.cwx[k] - x, this.cwy[k] - y) + this.drawnR[k]);
787
788
  for (const i of this.kidsN[c]) {
788
789
  if (this.nodeRep[i] >= 0)
789
790
  continue;
790
- reach = Math.max(reach, Math.hypot(this.nwx[i] - x, this.nwy[i] - y) + LEAF_R);
791
+ reach = Math.max(reach, hypot(this.nwx[i] - x, this.nwy[i] - y) + LEAF_R);
791
792
  }
792
793
  // what is held in it is inside it too: a visitor's temporary clusters (setHeld)
793
794
  const held = this.held.get(c), at = this.heldAt.get(c);
794
795
  if (held && at)
795
796
  for (let j = 0; j < held.length; j++)
796
- reach = Math.max(reach, (Math.hypot(at[2 * j], at[2 * j + 1]) + held[j].r) * this.scale[c]);
797
+ reach = Math.max(reach, (hypot(at[2 * j], at[2 * j + 1]) + held[j].r) * this.scale[c]);
797
798
  this.drawnR[c] = Math.max(this.curR[c], reach > 0 ? reach + MARGIN : 0);
798
799
  }
799
800
  }
@@ -80,3 +80,31 @@ export function statusCounts(codes, counted = () => true) {
80
80
  n[codes[i]]++;
81
81
  return n;
82
82
  }
83
+ /** A file cluster's own build trouble, as a Status code (failed, building, sorry), or -1: what its
84
+ * outline shows in the Status scheme. Trouble inherited from below (blocked, out of date because
85
+ * something under it changed) is left out, so that one failure does not ring every file above it. */
86
+ export function fileTrouble(f) {
87
+ switch (f?.state) {
88
+ case "failed":
89
+ case "unbuilt":
90
+ return ST_FAILED;
91
+ case "building":
92
+ return ST_BUILDING;
93
+ case "sorry":
94
+ return ST_SORRY;
95
+ default:
96
+ return -1;
97
+ }
98
+ }
99
+ /** Each cluster's outline in the Status scheme (CanvasSpec, "Files and clusters"): its file's own
100
+ * trouble (fileTrouble) where the clusters are files, -1 (none, the plain outline) for every other
101
+ * cluster. Under namespaces a cluster's key is a namespace, which can read like a module's name
102
+ * without being its file: none has an outline there. -1, not 0, is "none": 0 is failed's code, and
103
+ * an array left at zeros ringed every namespace in failed's colour (the owner's report of
104
+ * 2026-10-18). */
105
+ export function clusterTroubles(clusters, clustering, files) {
106
+ const out = new Int8Array(clusters.length).fill(-1);
107
+ if (clustering === "module")
108
+ clusters.forEach((c, k) => (out[k] = fileTrouble(files.get(c.key))));
109
+ return out;
110
+ }