visualproof 0.4.3 → 0.5.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/latex/visualproof.sty +19 -9
  3. package/dist/assets/tips/tour-agent.webp +0 -0
  4. package/dist/assets/tips/tour-arrange.webp +0 -0
  5. package/dist/assets/tips/tour-artwork.webp +0 -0
  6. package/dist/assets/tips/tour-checks.webp +0 -0
  7. package/dist/assets/tips/tour-keys.webp +0 -0
  8. package/dist/assets/tips/tour-library.webp +0 -0
  9. package/dist/assets/tips/tour-project.webp +0 -0
  10. package/dist/assets/tips/tour-review.webp +0 -0
  11. package/dist/assets/tips/tour-share.webp +0 -0
  12. package/dist/assets/tips/tour-source.webp +0 -0
  13. package/dist/assets/tips/tour-target.webp +0 -0
  14. package/dist/assets/tips/tour-view.webp +0 -0
  15. package/dist/assets/tips/tour.json +117 -112
  16. package/dist/assets/tips/tour.webp +0 -0
  17. package/dist/mcp/visualproof-mcp.mjs +7 -3
  18. package/dist/server/access.js +37 -1
  19. package/dist/server/accesspage.js +130 -0
  20. package/dist/server/agent.js +11 -5
  21. package/dist/server/agentlibrary.js +1 -1
  22. package/dist/server/agentviews.js +1 -1
  23. package/dist/server/artcmd.js +1 -1
  24. package/dist/server/askfollow.js +1 -4
  25. package/dist/server/buildwatch.js +133 -0
  26. package/dist/server/deploy.js +844 -0
  27. package/dist/server/doctor.js +15 -3
  28. package/dist/server/events.js +20 -5
  29. package/dist/server/export.js +17 -4
  30. package/dist/server/fetchurl.js +30 -13
  31. package/dist/server/film.js +1 -1
  32. package/dist/server/history.js +3 -1
  33. package/dist/server/historyapi.js +100 -50
  34. package/dist/server/historythread.js +206 -0
  35. package/dist/server/hover.js +8 -0
  36. package/dist/server/identity.js +25 -1
  37. package/dist/server/library.js +10 -3
  38. package/dist/server/live.js +206 -28
  39. package/dist/server/lostfound.js +3 -2
  40. package/dist/server/main.js +361 -50
  41. package/dist/server/poppler.js +48 -10
  42. package/dist/server/renames.js +10 -5
  43. package/dist/server/review.js +32 -2
  44. package/dist/server/reviewapi.js +1 -1
  45. package/dist/server/status.js +144 -50
  46. package/dist/server/talk.js +7 -2
  47. package/dist/server/usage.js +51 -0
  48. package/dist/server/views.js +21 -7
  49. package/dist/shared/board.js +2 -1
  50. package/dist/shared/collab.js +14 -8
  51. package/dist/shared/deploy.js +35 -0
  52. package/dist/shared/doc/latex.js +5 -3
  53. package/dist/shared/doc/outline.js +6 -3
  54. package/dist/shared/layout.js +297 -70
  55. package/dist/shared/libm.js +366 -0
  56. package/dist/shared/library.js +11 -6
  57. package/dist/shared/palette.js +1 -1
  58. package/dist/shared/review.js +7 -5
  59. package/dist/shared/search.js +7 -3
  60. package/dist/shared/separate.js +556 -32
  61. package/dist/shared/views.js +8 -1
  62. package/dist/web/bundle/app.js +3595 -1520
  63. package/dist/web/bundle/edges.js +44 -16
  64. package/dist/web/bundle/layout.js +1026 -80
  65. package/dist/web/index.html +2 -2
  66. package/dist/web/src/artwork.js +25 -4
  67. package/dist/web/src/axiomring.js +42 -0
  68. package/dist/web/src/bundles.js +52 -16
  69. package/dist/web/src/canvas.js +109 -54
  70. package/dist/web/src/overview.js +4 -1
  71. package/dist/web/src/past.js +28 -0
  72. package/dist/web/src/scene.js +13 -12
  73. package/dist/web/src/selection.js +47 -4
  74. package/dist/web/src/status.js +32 -2
  75. package/dist/web/src/theme.js +108 -0
  76. package/dist/web/style.css +181 -45
  77. package/docs/agent-api/following.md +1 -1
  78. package/docs/agent-api/history.md +3 -0
  79. package/docs/agent-api/library.md +1 -1
  80. package/docs/agent-api/requests.md +4 -1
  81. package/docs/agent-api/views.md +1 -1
  82. package/package.json +1 -1
@@ -0,0 +1,366 @@
1
+ // The transcendental functions the layout uses, the same on every engine (CanvasSpec, "Dependency
2
+ // order", the same picture everywhere).
3
+ //
4
+ // ECMAScript fixes + − × ÷ and √ to the last bit, but leaves Math.sin, cos, acos, log1p, hypot and
5
+ // the like to each engine: Chrome and Node, two builds of V8, already differ in the last digit of
6
+ // some, and the layout amplifies a last digit into a different picture (a board laid out on the
7
+ // page beside the same board laid out on the server moved 91 of its 184 declarations). So the
8
+ // layout computes them here, from the operations every engine computes alike: ports of the fdlibm
9
+ // routines (Sun's freely distributable libm, as FreeBSD's msun keeps it) that V8 itself runs, and
10
+ // V8's own Math.hypot. On Node they give what Math gives to the last bit, so that no layout the
11
+ // server made before moves (test/libm.test.ts checks them against Node's Math on the inputs the
12
+ // layout has); on any other engine they give the same.
13
+ //
14
+ // Only what the layout needs: arguments past the reach of the medium-sized argument reduction (a
15
+ // quarter of a million radians) are not reduced exactly, and are never asked for.
16
+ // a double's two 32-bit words, read and written through one buffer
17
+ const f64 = new Float64Array(1);
18
+ const u32 = new Uint32Array(f64.buffer);
19
+ /** the index of the high word: the layout runs on little-endian machines, but this does not assume it */
20
+ const HI = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1 ? 1 : 0;
21
+ const LO = 1 - HI;
22
+ function hiWord(x) {
23
+ f64[0] = x;
24
+ return u32[HI] | 0;
25
+ }
26
+ function loWord(x) {
27
+ f64[0] = x;
28
+ return u32[LO] >>> 0;
29
+ }
30
+ function withHi(x, hi) {
31
+ f64[0] = x;
32
+ u32[HI] = hi >>> 0;
33
+ return f64[0];
34
+ }
35
+ function withLo(x, lo) {
36
+ f64[0] = x;
37
+ u32[LO] = lo >>> 0;
38
+ return f64[0];
39
+ }
40
+ function fromWords(hi, lo) {
41
+ u32[HI] = hi >>> 0;
42
+ u32[LO] = lo >>> 0;
43
+ return f64[0];
44
+ }
45
+ /** √(x² + y²), as V8 computes Math.hypot of two numbers: each divided by the larger magnitude,
46
+ * squared and summed (Kahan's compensation, which two terms leave at zero), the square root
47
+ * scaled back. */
48
+ export function hypot(x, y) {
49
+ const ax = Math.abs(x), ay = Math.abs(y);
50
+ if (ax === Infinity || ay === Infinity)
51
+ return Infinity;
52
+ if (ax !== ax || ay !== ay)
53
+ return NaN;
54
+ const max = ax > ay ? ax : ay;
55
+ if (max === 0)
56
+ return 0;
57
+ const a = ax / max, b = ay / max;
58
+ return Math.sqrt(a * a + b * b) * max;
59
+ }
60
+ // fdlibm e_acos.c
61
+ const PI = 3.14159265358979311600e+00;
62
+ const PIO2_HI = 1.57079632679489655800e+00;
63
+ const PIO2_LO = 6.12323399573676603587e-17;
64
+ const pS0 = 1.66666666666666657415e-01;
65
+ const pS1 = -3.25565818622400915405e-01;
66
+ const pS2 = 2.01212532134862925881e-01;
67
+ const pS3 = -4.00555345006794114027e-02;
68
+ const pS4 = 7.91534994289814532176e-04;
69
+ const pS5 = 3.47933107596021167570e-05;
70
+ const qS1 = -2.40339491173441421878e+00;
71
+ const qS2 = 2.02094576023350569471e+00;
72
+ const qS3 = -6.88283971605453293030e-01;
73
+ const qS4 = 7.70381505559019352791e-02;
74
+ /** arccos x, in [0, π]. */
75
+ export function acos(x) {
76
+ const hx = hiWord(x);
77
+ const ix = hx & 0x7fffffff;
78
+ if (ix >= 0x3ff00000) {
79
+ // |x| >= 1
80
+ if (((ix - 0x3ff00000) | loWord(x)) === 0)
81
+ return hx > 0 ? 0.0 : PI + 2.0 * PIO2_LO;
82
+ return NaN;
83
+ }
84
+ if (ix < 0x3fe00000) {
85
+ // |x| < 0.5
86
+ if (ix <= 0x3c600000)
87
+ return PIO2_HI + PIO2_LO;
88
+ const z = x * x;
89
+ const p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));
90
+ const q = 1.0 + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
91
+ const r = p / q;
92
+ return PIO2_HI - (x - (PIO2_LO - x * r));
93
+ }
94
+ else if (hx < 0) {
95
+ // x < -0.5
96
+ const z = (1.0 + x) * 0.5;
97
+ const p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));
98
+ const q = 1.0 + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
99
+ const s = Math.sqrt(z);
100
+ const r = p / q;
101
+ const w = r * s - PIO2_LO;
102
+ return PI - 2.0 * (s + w);
103
+ }
104
+ else {
105
+ // x > 0.5
106
+ const z = (1.0 - x) * 0.5;
107
+ const s = Math.sqrt(z);
108
+ const df = withLo(s, 0);
109
+ const c = (z - df * df) / (s + df);
110
+ const p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));
111
+ const q = 1.0 + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
112
+ const r = p / q;
113
+ const w = r * s + c;
114
+ return 2.0 * (df + w);
115
+ }
116
+ }
117
+ // fdlibm s_log1p.c
118
+ const LN2_HI = 6.93147180369123816490e-01;
119
+ const LN2_LO = 1.90821492927058770002e-10;
120
+ const Lp1 = 6.666666666666735130e-01;
121
+ const Lp2 = 3.999999999940941908e-01;
122
+ const Lp3 = 2.857142874366239149e-01;
123
+ const Lp4 = 2.222219843214978396e-01;
124
+ const Lp5 = 1.818357216161805012e-01;
125
+ const Lp6 = 1.531383769920937332e-01;
126
+ const Lp7 = 1.479819860511658591e-01;
127
+ /** log(1 + x), exact for small x. */
128
+ export function log1p(x) {
129
+ const hx = hiWord(x);
130
+ const ax = hx & 0x7fffffff;
131
+ let k = 1;
132
+ let f = 0, c = 0, hu = 0;
133
+ if (hx < 0x3fda827a) {
134
+ // 1 + x < √2
135
+ if (ax >= 0x3ff00000)
136
+ return x === -1.0 ? -Infinity : NaN;
137
+ if (ax < 0x3e200000) {
138
+ // |x| < 2^-29
139
+ if (ax < 0x3c900000)
140
+ return x;
141
+ return x - x * x * 0.5;
142
+ }
143
+ if (hx > 0 || hx <= (0xbfd2bec4 | 0)) {
144
+ // √2/2 - 1 <= x < √2 - 1
145
+ k = 0;
146
+ f = x;
147
+ hu = 1;
148
+ }
149
+ }
150
+ if (hx >= 0x7ff00000)
151
+ return x + x;
152
+ if (k !== 0) {
153
+ let u;
154
+ if (hx < 0x43400000) {
155
+ u = 1.0 + x;
156
+ hu = hiWord(u);
157
+ k = (hu >> 20) - 1023;
158
+ // the correction term
159
+ c = k > 0 ? 1.0 - (u - x) : x - (u - 1.0);
160
+ c /= u;
161
+ }
162
+ else {
163
+ u = x;
164
+ hu = hiWord(u);
165
+ k = (hu >> 20) - 1023;
166
+ c = 0;
167
+ }
168
+ hu &= 0x000fffff;
169
+ // u, or u/2, normalised into [√2/2, √2]
170
+ if (hu < 0x6a09e) {
171
+ u = withHi(u, hu | 0x3ff00000);
172
+ }
173
+ else {
174
+ k += 1;
175
+ u = withHi(u, hu | 0x3fe00000);
176
+ hu = (0x00100000 - hu) >> 2;
177
+ }
178
+ f = u - 1.0;
179
+ }
180
+ const hfsq = 0.5 * f * f;
181
+ if (hu === 0) {
182
+ // |f| < 2^-20
183
+ if (f === 0) {
184
+ if (k === 0)
185
+ return 0;
186
+ c += k * LN2_LO;
187
+ return k * LN2_HI + c;
188
+ }
189
+ const R = hfsq * (1.0 - 0.66666666666666666 * f);
190
+ if (k === 0)
191
+ return f - R;
192
+ return k * LN2_HI - ((R - (k * LN2_LO + c)) - f);
193
+ }
194
+ const s = f / (2.0 + f);
195
+ const z = s * s;
196
+ const R = z * (Lp1 + z * (Lp2 + z * (Lp3 + z * (Lp4 + z * (Lp5 + z * (Lp6 + z * Lp7))))));
197
+ if (k === 0)
198
+ return f - (hfsq - s * (hfsq + R));
199
+ return k * LN2_HI - ((hfsq - (s * (hfsq + R) + (k * LN2_LO + c))) - f);
200
+ }
201
+ // fdlibm k_sin.c, k_cos.c
202
+ const S1 = -1.66666666666666324348e-01;
203
+ const S2 = 8.33333333332248946124e-03;
204
+ const S3 = -1.98412698298579493134e-04;
205
+ const S4 = 2.75573137070700676789e-06;
206
+ const S5 = -2.50507602534068634195e-08;
207
+ const S6 = 1.58969099521155010221e-10;
208
+ function kernelSin(x, y, iy) {
209
+ const ix = hiWord(x) & 0x7fffffff;
210
+ if (ix < 0x3e400000 && Math.trunc(x) === 0)
211
+ return x;
212
+ const z = x * x;
213
+ const v = z * x;
214
+ const r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));
215
+ if (iy === 0)
216
+ return x + v * (S1 + z * r);
217
+ return x - ((z * (0.5 * y - v * r) - y) - v * S1);
218
+ }
219
+ const C1 = 4.16666666666666019037e-02;
220
+ const C2 = -1.38888888888741095749e-03;
221
+ const C3 = 2.48015872894767294178e-05;
222
+ const C4 = -2.75573143513906633035e-07;
223
+ const C5 = 2.08757232129817482790e-09;
224
+ const C6 = -1.13596475577881948265e-11;
225
+ function kernelCos(x, y) {
226
+ const ix = hiWord(x) & 0x7fffffff;
227
+ if (ix < 0x3e400000 && Math.trunc(x) === 0)
228
+ return 1.0;
229
+ const z = x * x;
230
+ const r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
231
+ if (ix < 0x3fd33333)
232
+ return 1.0 - (0.5 * z - (z * r - x * y));
233
+ const qx = ix > 0x3fe90000 ? 0.28125 : fromWords(ix - 0x00200000, 0);
234
+ const iz = 0.5 * z - qx;
235
+ const a = 1.0 - qx;
236
+ return a - (iz - (z * r - x * y));
237
+ }
238
+ // fdlibm e_rem_pio2.c, without the large arguments' reduction
239
+ const INVPIO2 = 6.36619772367581382433e-01;
240
+ const PIO2_1 = 1.57079632673412561417e+00;
241
+ const PIO2_1T = 6.07710050650619224932e-11;
242
+ const PIO2_2 = 6.07710050630396597660e-11;
243
+ const PIO2_2T = 2.02226624879595063154e-21;
244
+ const PIO2_3 = 2.02226624871116645580e-21;
245
+ const PIO2_3T = 8.47842766036889956997e-32;
246
+ const NPIO2_HW = [
247
+ 0x3ff921fb, 0x400921fb, 0x4012d97c, 0x401921fb, 0x401f6a7a, 0x4022d97c, 0x4025fdbb, 0x402921fb, 0x402c463a, 0x402f6a7a, 0x4031475c,
248
+ 0x4032d97c, 0x40346b9c, 0x4035fdbb, 0x40378fdb, 0x403921fb, 0x403ab41b, 0x403c463a, 0x403dd85a, 0x403f6a7a, 0x40407e4c, 0x4041475c,
249
+ 0x4042106c, 0x4042d97c, 0x4043a28c, 0x40446b9c, 0x404534ac, 0x4045fdbb, 0x4046c6cb, 0x40478fdb, 0x404858eb, 0x404921fb,
250
+ ];
251
+ /** x reduced by a multiple n of π/2 into [-π/4, π/4], as y0 + y1; returns n. */
252
+ const red = new Float64Array(2);
253
+ function remPio2(x) {
254
+ const hx = hiWord(x);
255
+ const ix = hx & 0x7fffffff;
256
+ if (ix <= 0x3fe921fb) {
257
+ red[0] = x;
258
+ red[1] = 0;
259
+ return 0;
260
+ }
261
+ if (ix < 0x4002d97c) {
262
+ // |x| < 3π/4: n = ±1
263
+ if (hx > 0) {
264
+ let z = x - PIO2_1;
265
+ if (ix !== 0x3ff921fb) {
266
+ red[0] = z - PIO2_1T;
267
+ red[1] = (z - red[0]) - PIO2_1T;
268
+ }
269
+ else {
270
+ z -= PIO2_2;
271
+ red[0] = z - PIO2_2T;
272
+ red[1] = (z - red[0]) - PIO2_2T;
273
+ }
274
+ return 1;
275
+ }
276
+ let z = x + PIO2_1;
277
+ if (ix !== 0x3ff921fb) {
278
+ red[0] = z + PIO2_1T;
279
+ red[1] = (z - red[0]) + PIO2_1T;
280
+ }
281
+ else {
282
+ z += PIO2_2;
283
+ red[0] = z + PIO2_2T;
284
+ red[1] = (z - red[0]) + PIO2_2T;
285
+ }
286
+ return -1;
287
+ }
288
+ if (ix > 0x413921fb)
289
+ throw new RangeError("libm: argument out of range");
290
+ // medium size: |x| <= 2^19 π/2
291
+ let t = Math.abs(x);
292
+ const n = Math.trunc(t * INVPIO2 + 0.5);
293
+ const fn = n;
294
+ let r = t - fn * PIO2_1;
295
+ let w = fn * PIO2_1T;
296
+ if (n < 32 && ix !== NPIO2_HW[n - 1]) {
297
+ red[0] = r - w;
298
+ }
299
+ else {
300
+ const j = ix >> 20;
301
+ red[0] = r - w;
302
+ let i = j - ((hiWord(red[0]) >> 20) & 0x7ff);
303
+ if (i > 16) {
304
+ // a second iteration, good to 118 bits
305
+ t = r;
306
+ w = fn * PIO2_2;
307
+ r = t - w;
308
+ w = fn * PIO2_2T - ((t - r) - w);
309
+ red[0] = r - w;
310
+ i = j - ((hiWord(red[0]) >> 20) & 0x7ff);
311
+ if (i > 49) {
312
+ // a third, 151 bits
313
+ t = r;
314
+ w = fn * PIO2_3;
315
+ r = t - w;
316
+ w = fn * PIO2_3T - ((t - r) - w);
317
+ red[0] = r - w;
318
+ }
319
+ }
320
+ }
321
+ red[1] = (r - red[0]) - w;
322
+ if (hx < 0) {
323
+ red[0] = -red[0];
324
+ red[1] = -red[1];
325
+ return -n;
326
+ }
327
+ return n;
328
+ }
329
+ /** sin x, for |x| up to 2^19 π/2. */
330
+ export function sin(x) {
331
+ const ix = hiWord(x) & 0x7fffffff;
332
+ if (ix <= 0x3fe921fb)
333
+ return kernelSin(x, 0, 0);
334
+ if (ix >= 0x7ff00000)
335
+ return NaN;
336
+ const n = remPio2(x);
337
+ switch (n & 3) {
338
+ case 0:
339
+ return kernelSin(red[0], red[1], 1);
340
+ case 1:
341
+ return kernelCos(red[0], red[1]);
342
+ case 2:
343
+ return -kernelSin(red[0], red[1], 1);
344
+ default:
345
+ return -kernelCos(red[0], red[1]);
346
+ }
347
+ }
348
+ /** cos x, for |x| up to 2^19 π/2. */
349
+ export function cos(x) {
350
+ const ix = hiWord(x) & 0x7fffffff;
351
+ if (ix <= 0x3fe921fb)
352
+ return kernelCos(x, 0);
353
+ if (ix >= 0x7ff00000)
354
+ return NaN;
355
+ const n = remPio2(x);
356
+ switch (n & 3) {
357
+ case 0:
358
+ return kernelCos(red[0], red[1]);
359
+ case 1:
360
+ return -kernelSin(red[0], red[1], 1);
361
+ case 2:
362
+ return -kernelCos(red[0], red[1]);
363
+ default:
364
+ return kernelSin(red[0], red[1], 1);
365
+ }
366
+ }
@@ -562,21 +562,26 @@ export function quoteAt(text, start, end, context = QUOTE_CONTEXT) {
562
562
  const after = squeeze(text.slice(end, end + context * 3)).s.slice(0, context);
563
563
  return { text: q, ...(before ? { before } : {}), ...(after ? { after } : {}) };
564
564
  }
565
+ /** Typography read as typed: curly quotes as straight ones, dashes and the minus sign as a hyphen —
566
+ * each one character for one, so that offsets into the text stay where they were. A quote typed
567
+ * by hand or by an agent ("Kummer's lemma.") is found in a page typeset with ’ and –. */
568
+ export const plainPunctuation = (s) => s.replace(/[\u2018\u2019\u201a\u201b\u2032]/g, "'").replace(/[\u201c\u201d\u201e\u201f\u2033]/g, '"').replace(/[\u2010-\u2015\u2212]/g, "-");
565
569
  /** Where a quote is in a page's text: the offsets of the best match into `text` — the one whose
566
570
  * surroundings agree most with what was kept around it — or null when it is not there. Spaces are
567
- * read loosely, and so is case where no exact match is. */
571
+ * read loosely; so is case where no exact match is, and then typographic quotes and dashes. */
568
572
  export function findQuote(text, q) {
569
573
  const page = squeeze(text);
570
574
  const want = squeeze(q.text).s;
571
575
  if (!want)
572
576
  return null;
573
- const tries = [page.s, page.s.toLowerCase()];
574
- for (const [k, hay] of tries.entries()) {
575
- const needle = k ? want.toLowerCase() : want;
577
+ const tries = [(s) => s, (s) => s.toLowerCase(), (s) => plainPunctuation(s.toLowerCase())];
578
+ for (const read of tries) {
579
+ const hay = read(page.s);
580
+ const needle = read(want);
576
581
  let best = null;
577
582
  for (let at = hay.indexOf(needle); at >= 0; at = hay.indexOf(needle, at + 1)) {
578
- const before = q.before ? squeeze(q.before).s : "";
579
- const after = q.after ? squeeze(q.after).s : "";
583
+ const before = q.before ? read(squeeze(q.before).s) : "";
584
+ const after = q.after ? read(squeeze(q.after).s) : "";
580
585
  const score = common(hay.slice(Math.max(0, at - before.length - 1), at).trimEnd(), before, true) + common(hay.slice(at + needle.length).trimStart(), after, false);
581
586
  if (!best || score > best.score)
582
587
  best = { at, score };
@@ -26,7 +26,7 @@ export const STATUS_COLORS = {
26
26
  commented: "#2a62c0",
27
27
  stale: "#e69f00",
28
28
  approved: "#009e73",
29
- unreviewed: "#c7c7cc",
29
+ unreviewed: "#a6a29c",
30
30
  trusted: "#b3e2c2",
31
31
  };
32
32
  /** The code's token colours (web/src/highlight.ts). `sorry` is drawn white on its colour. */
@@ -654,18 +654,20 @@ export function trusted(d, name, module, external) {
654
654
  }
655
655
  /** What the canvas and the lists mark a declaration with: what reviewers said about it, and when
656
656
  * nobody has, whether a trusted prefix covers it — for the project's own declarations only:
657
- * the outside world trusted by default is the rule there, not news. */
658
- export function markOf(d, name, module, external, hash) {
657
+ * the outside world trusted by default is the rule there, not news; and never for a non-standard
658
+ * axiom (`axiom`), which needs review whatever trusts it (decision 3). */
659
+ export function markOf(d, name, module, external, hash, axiom = false) {
659
660
  const s = statusOf(d, name, hash);
660
- if (s !== "none" || external)
661
+ if (s !== "none" || external || axiom)
661
662
  return s;
662
663
  return trustedBy(d, name, module, false).length ? "trusted" : "none";
663
664
  }
664
- /** How far the review of a set (a target's TCB) has come. */
665
+ /** How far the review of a set (a target's TCB, a cluster) has come: what needs review in it, a
666
+ * non-standard axiom (`axiom`) whatever trusts it (decision 3). */
665
667
  export function progressOf(d, members) {
666
668
  const p = { total: 0, approved: 0, commented: 0, stale: 0 };
667
669
  for (const m of members) {
668
- if (trusted(d, m.name, m.module, m.ext))
670
+ if (!m.axiom && trusted(d, m.name, m.module, m.ext))
669
671
  continue;
670
672
  p.total++;
671
673
  const s = statusOf(d, m.name, m.hash);
@@ -11,7 +11,8 @@
11
11
  // scan, and a query that only adds to the last one looks through what the last one found.
12
12
  //
13
13
  // A unit is found by the names it folds too (ViewNode.also): `QOR.Name`, which Lean generated from
14
- // the command that writes `QOR`, finds `QOR`, as a name does, and the hit says which (`via`).
14
+ // the command that writes `QOR`, finds `QOR`, as a name does, after the declarations found by their
15
+ // own names, and the hit says which (`via`).
15
16
  //
16
17
  // The page's search box (web/src/search.ts) and the agent API (server/agent.ts) both search so.
17
18
  export const PLACES = ["name", "statement", "doc"];
@@ -95,7 +96,10 @@ export function search(ix, query, within) {
95
96
  if (tier === 0) {
96
97
  // as the search always ranked a name: the words in its last component, exactly, at its start,
97
98
  // inside it; then the project before the outside world; then the shorter name. A word found
98
- // in a name it folds counts as found in that name.
99
+ // in a name it folds counts as found in that name, and ranks after every declaration found by
100
+ // its own name: a generated name (`_aux_FltRegular_CaseI_…_termR_1`) has no dots, so all of it
101
+ // reads as a last component, and would rank its notation before `FltRegular.caseI` for
102
+ // "caseI flt".
99
103
  let name = names[i];
100
104
  for (const w of order) {
101
105
  const a = folded(w);
@@ -109,7 +113,7 @@ export function search(ix, query, within) {
109
113
  let fit = 0;
110
114
  for (const w of order)
111
115
  fit = Math.max(fit, last === w ? 0 : last.startsWith(w) ? 1 : last.includes(w) ? 2 : 3);
112
- score = fit * 1000 + (ext ? 500 : 0) + Math.min(400, name.length);
116
+ score = (via !== undefined ? 4000 : 0) + fit * 1000 + (ext ? 500 : 0) + Math.min(400, name.length);
113
117
  }
114
118
  else {
115
119
  // fewer words that needed this place first (the rest are in the name), then a word found