visualproof 0.7.0 → 0.8.1
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/README.md +1 -1
- package/dist/assets/tips/phone-fingers.light.mp4 +0 -0
- package/dist/assets/tips/phone-fingers.light.webp +0 -0
- package/dist/assets/tips/tour-agent.webp +0 -0
- package/dist/assets/tips/tour-arrange.webp +0 -0
- package/dist/assets/tips/tour-artwork.webp +0 -0
- package/dist/assets/tips/tour-checks.webp +0 -0
- package/dist/assets/tips/tour-export.webp +0 -0
- package/dist/assets/tips/tour-keys.webp +0 -0
- package/dist/assets/tips/tour-library.webp +0 -0
- package/dist/assets/tips/tour-project.webp +0 -0
- package/dist/assets/tips/tour-review.webp +0 -0
- package/dist/assets/tips/tour-share.webp +0 -0
- package/dist/assets/tips/tour-source.webp +0 -0
- package/dist/assets/tips/tour-target.webp +0 -0
- package/dist/assets/tips/tour-view.webp +0 -0
- package/dist/assets/tips/tour.json +90 -90
- package/dist/assets/tips/tour.webp +0 -0
- package/dist/server/agent.js +2 -2
- package/dist/server/agentadvice.js +16 -3
- package/dist/server/agentfollow.js +32 -4
- package/dist/server/agentviews.js +1 -1
- package/dist/server/app.js +3 -1
- package/dist/server/apptalk.js +21 -4
- package/dist/server/live.js +101 -10
- package/dist/server/mcptools.js +1 -1
- package/dist/server/presence.js +25 -8
- package/dist/server/readonlygate.js +4 -0
- package/dist/server/reviewapi.js +10 -3
- package/dist/shared/board.js +9 -8
- package/dist/shared/collab.js +53 -6
- package/dist/shared/pointer.js +152 -0
- package/dist/shared/query.js +36 -5
- package/dist/shared/review.js +34 -2
- package/dist/shared/sharesnap.js +15 -0
- package/dist/shared/titles.js +4 -0
- package/dist/web/bundle/app.js +1495 -248
- package/dist/web/index.html +4 -0
- package/dist/web/src/canvas.js +16 -14
- package/dist/web/src/highlight.js +8 -3
- package/dist/web/src/reviewqueue.js +52 -10
- package/dist/web/src/status.js +65 -1
- package/dist/web/style.css +121 -7
- package/docs/agent-api/advice.md +4 -1
- package/docs/agent-api/following.md +9 -3
- package/docs/agent-api/views.md +3 -1
- package/package.json +1 -1
package/dist/shared/query.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// file(Mathlib.NumberTheory) declarations of the modules under the prefix
|
|
15
15
|
// trusted | external | sorry | nonstandard
|
|
16
16
|
// kind(theorem, def) | status(unreviewed, stale) | advice(comment)
|
|
17
|
+
// mine(none, stale) where the reader's own review stands (none: they gave no opinion)
|
|
17
18
|
// key(fermatLastTheoremFour) the target and the declarations marked key for it
|
|
18
19
|
// key(targets) the same for every target
|
|
19
20
|
// X and Y | X or Y | X except Y left to right, one level; parentheses group
|
|
@@ -23,9 +24,10 @@
|
|
|
23
24
|
// word and a parenthesis (`ns(`), or joins with and, or, except is a query; a query that is one
|
|
24
25
|
// plain word is written in parentheses there (`tcb((external))`). Words are read without regard to case (`usedby`); `namespace` and
|
|
25
26
|
// `module` may stand for `ns` and `file`.
|
|
26
|
-
import { adviceOf, keyMarks, STANDARD_AXIOMS, statusOf, trusted, under } from "./review.js";
|
|
27
|
+
import { adviceOf, keyMarks, ownStatus, STANDARD_AXIOMS, statusOf, trusted, under } from "./review.js";
|
|
27
28
|
export const KINDS = ["theorem", "def", "abbrev", "instance", "structure", "class", "inductive", "opaque", "axiom", "quot", "constructor", "recursor", "notation", "unknown"];
|
|
28
29
|
export const STATUSES = ["unreviewed", "approved", "commented", "stale"];
|
|
30
|
+
export const MINE_STATUSES = ["approved", "commented", "stale", "none"];
|
|
29
31
|
const VERDICTS = ["approve", "comment"];
|
|
30
32
|
const CLOSURES = ["tcb", "uses", "usedBy", "refs"];
|
|
31
33
|
const PLAIN = ["all", "selection", "trusted", "external", "sorry", "nonstandard"];
|
|
@@ -340,7 +342,9 @@ function parse(text) {
|
|
|
340
342
|
return { op: "status", statuses: choose(args(), STATUSES, "status") };
|
|
341
343
|
if (w === "advice")
|
|
342
344
|
return { op: "advice", verdicts: choose(args(), VERDICTS, "advice") };
|
|
343
|
-
|
|
345
|
+
if (w === "mine")
|
|
346
|
+
return { op: "mine", statuses: choose(args(), MINE_STATUSES, "mine") };
|
|
347
|
+
throw new QueryError(`${text1(t)} is not a word of the query language (all, tcb, uses, usedBy, refs, decl, key, ns, file, trusted, external, kind, status, advice, mine, sorry, nonstandard)`, t.at);
|
|
344
348
|
};
|
|
345
349
|
const expr = () => {
|
|
346
350
|
let q = atom();
|
|
@@ -395,6 +399,8 @@ export function printQuery(q) {
|
|
|
395
399
|
return `status(${q.statuses.join(", ")})`;
|
|
396
400
|
case "advice":
|
|
397
401
|
return `advice(${q.verdicts.join(", ")})`;
|
|
402
|
+
case "mine":
|
|
403
|
+
return `mine(${q.statuses.join(", ")})`;
|
|
398
404
|
case "and":
|
|
399
405
|
case "or":
|
|
400
406
|
case "except": {
|
|
@@ -485,6 +491,8 @@ function readJson(x, why = false) {
|
|
|
485
491
|
: null;
|
|
486
492
|
case "advice":
|
|
487
493
|
return Array.isArray(o.verdicts) && o.verdicts.length && o.verdicts.every((s) => VERDICTS.includes(s)) ? { op: "advice", verdicts: [...o.verdicts] } : null;
|
|
494
|
+
case "mine":
|
|
495
|
+
return Array.isArray(o.statuses) && o.statuses.length && o.statuses.every((s) => MINE_STATUSES.includes(s)) ? { op: "mine", statuses: [...o.statuses] } : null;
|
|
488
496
|
case "and":
|
|
489
497
|
case "or":
|
|
490
498
|
case "except": {
|
|
@@ -549,9 +557,10 @@ export function namesIn(q) {
|
|
|
549
557
|
walk(q);
|
|
550
558
|
return [...out];
|
|
551
559
|
}
|
|
552
|
-
/** Whether the query reads the review (trust, statuses, advice): its set changes with
|
|
560
|
+
/** Whether the query reads the review (trust, statuses, advice, one's own): its set changes with
|
|
561
|
+
* opinions. */
|
|
553
562
|
export function readsReview(q) {
|
|
554
|
-
if (q.op === "trusted" || q.op === "status" || q.op === "advice" || q.op === "key")
|
|
563
|
+
if (q.op === "trusted" || q.op === "status" || q.op === "advice" || q.op === "key" || q.op === "mine")
|
|
555
564
|
return true;
|
|
556
565
|
if ((q.op === "tcb" || q.op === "uses" || q.op === "usedBy" || q.op === "refs") && q.of !== "selection" && !Array.isArray(q.of))
|
|
557
566
|
return readsReview(q.of);
|
|
@@ -559,6 +568,16 @@ export function readsReview(q) {
|
|
|
559
568
|
return readsReview(q.a) || readsReview(q.b);
|
|
560
569
|
return false;
|
|
561
570
|
}
|
|
571
|
+
/** Whether the query reads one's own review (`mine(…)`): its set is each reader's own. */
|
|
572
|
+
export function readsMine(q) {
|
|
573
|
+
if (q.op === "mine")
|
|
574
|
+
return true;
|
|
575
|
+
if ((q.op === "tcb" || q.op === "uses" || q.op === "usedBy" || q.op === "refs") && q.of !== "selection" && !Array.isArray(q.of))
|
|
576
|
+
return readsMine(q.of);
|
|
577
|
+
if (q.op === "and" || q.op === "or" || q.op === "except")
|
|
578
|
+
return readsMine(q.a) || readsMine(q.b);
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
562
581
|
/** The query with the selection replaced by `names`: what is lit now, as a scope (Zoom in). */
|
|
563
582
|
export function withSelection(q, names) {
|
|
564
583
|
switch (q.op) {
|
|
@@ -638,6 +657,8 @@ const list = (names) => (names.length > 2 ? `${names.slice(0, 2).map(last).join(
|
|
|
638
657
|
const roots = (of) => (of === "selection" ? "the selection" : Array.isArray(of) ? list(of) : describe(of));
|
|
639
658
|
const or = (xs) => (xs.length > 1 ? `${xs.slice(0, -1).join(", ")} or ${xs[xs.length - 1]}` : xs[0]);
|
|
640
659
|
// a Map, not an object: `constructor` is a kind, and an object's own property besides
|
|
660
|
+
/** one's own review in words (`mine(…)`): "me" is whoever reads it, the reader */
|
|
661
|
+
const MINE_WORDS = { approved: "approved by me", commented: "commented on by me", stale: "stale of mine", none: "not reviewed by me" };
|
|
641
662
|
const PLURAL = new Map([["theorem", "theorems"], ["def", "definitions"], ["abbrev", "abbreviations"], ["instance", "instances"], ["structure", "structures"], ["class", "classes"], ["inductive", "inductive types"], ["opaque", "opaque constants"], ["axiom", "axioms"], ["notation", "notations"]]);
|
|
642
663
|
/** A set in a few words, for a chip: "TCB of fermatLastTheoremFour", "everything". */
|
|
643
664
|
export function describe(q) {
|
|
@@ -683,6 +704,8 @@ export function describe(q) {
|
|
|
683
704
|
return or(q.statuses.map((s) => (s === "unreviewed" ? "not yet reviewed" : s)));
|
|
684
705
|
case "advice":
|
|
685
706
|
return `what an agent ${or(q.verdicts.map((v) => (v === "approve" ? "approves" : "comments on")))}`;
|
|
707
|
+
case "mine":
|
|
708
|
+
return or(q.statuses.map((s) => MINE_WORDS[s]));
|
|
686
709
|
case "and":
|
|
687
710
|
case "or":
|
|
688
711
|
case "except":
|
|
@@ -706,7 +729,7 @@ export function describeCondition(c) {
|
|
|
706
729
|
return `only in namespace ${q.prefix}`;
|
|
707
730
|
if (q.op === "file")
|
|
708
731
|
return `only in files under ${q.prefix}`;
|
|
709
|
-
if (q.op === "kind" || q.op === "status" || q.op === "advice" || q.op === "key")
|
|
732
|
+
if (q.op === "kind" || q.op === "status" || q.op === "advice" || q.op === "key" || q.op === "mine")
|
|
710
733
|
return `only ${describe(q)}`;
|
|
711
734
|
return `and ${describe(q)}`;
|
|
712
735
|
}
|
|
@@ -814,6 +837,14 @@ function evaluateIn(q, ctx, walks) {
|
|
|
814
837
|
return a !== null && vs.has(a);
|
|
815
838
|
});
|
|
816
839
|
}
|
|
840
|
+
case "mine": {
|
|
841
|
+
// nobody's own review to read: nothing (an agent's advice is no one's own, AgentSpec decision 2)
|
|
842
|
+
const me = ctx.me;
|
|
843
|
+
if (!me)
|
|
844
|
+
return out;
|
|
845
|
+
const ss = new Set(q.statuses);
|
|
846
|
+
return each((i) => ss.has(ownStatus(d, g.nodes[i].name, me, g.nodes[i].hash)));
|
|
847
|
+
}
|
|
817
848
|
case "and":
|
|
818
849
|
case "or":
|
|
819
850
|
case "except": {
|
package/dist/shared/review.js
CHANGED
|
@@ -355,8 +355,14 @@ export function record(d, r, toolchain, now) {
|
|
|
355
355
|
applyEvent(d, e);
|
|
356
356
|
return e;
|
|
357
357
|
}
|
|
358
|
+
/** Whose opinion a request records or takes back: the person it is for (ReviewSpec decisions 8 and
|
|
359
|
+
* 9), else its writer's own — an agent's, its advice. */
|
|
360
|
+
function whoseOp(r) {
|
|
361
|
+
return r.for?.trim() ? { by: r.for.trim(), ...(r.forPerson ? { person: r.forPerson } : {}) } : { by: r.by.trim(), agent: r.agent, person: r.person };
|
|
362
|
+
}
|
|
358
363
|
/** Whether recording `r` would change nothing: a target marked that is one, a prefix trusted that
|
|
359
|
-
* is, a key declaration marked that is, a withdrawal with no opinion standing to take back
|
|
364
|
+
* is, a key declaration marked that is, a withdrawal with no opinion standing to take back, an
|
|
365
|
+
* approval of the present version by someone whose current opinion there is one already. Such a
|
|
360
366
|
* request is answered, and nothing is appended. */
|
|
361
367
|
export function noChange(d, r) {
|
|
362
368
|
if (r.op === "target")
|
|
@@ -365,9 +371,14 @@ export function noChange(d, r) {
|
|
|
365
371
|
return d.trusted.includes(r.prefix) === r.on;
|
|
366
372
|
if (r.op === "key")
|
|
367
373
|
return keyMarked(d, r.target, r.name) === r.on;
|
|
374
|
+
// nobody approves twice (ReviewSpec decision 1, the owner's decision of 2026-10-20): people,
|
|
375
|
+
// someone spoken for and agents' advice alike; once a change has made it stale, approving again
|
|
376
|
+
// is new
|
|
377
|
+
if (r.op === "opinion")
|
|
378
|
+
return r.verdict === "approve" && approval(d, r.name, whoseOp(r), r.hash) === "approved";
|
|
368
379
|
// nothing standing to take back (ReviewSpec decision 9)
|
|
369
380
|
if (r.op === "withdraw")
|
|
370
|
-
return !standing(d, r.name,
|
|
381
|
+
return !standing(d, r.name, whoseOp(r));
|
|
371
382
|
if (r.op === "move")
|
|
372
383
|
return moveIsIdle(d, { ...r, rename: r.rename || undefined });
|
|
373
384
|
if (isLibraryOp(r.op))
|
|
@@ -622,6 +633,27 @@ export function standing(d, name, who) {
|
|
|
622
633
|
const o = (Object.hasOwn(d.opinions, name) ? d.opinions[name] : []).findLast((p) => author(p) === whose);
|
|
623
634
|
return o && !o.withdrawn ? o : null;
|
|
624
635
|
}
|
|
636
|
+
/** Where one person's own review of a declaration stands (the owner's decision of 2026-10-20: the
|
|
637
|
+
* Mine scheme, `mine(…)`): their current opinion, on the version whose hash is `hash` — approved,
|
|
638
|
+
* commented — or on an earlier one, stale; none where they have none (none given, or withdrawn).
|
|
639
|
+
* Nobody else's opinion counts, and an agent's advice is no person's. */
|
|
640
|
+
export function ownStatus(d, name, who, hash) {
|
|
641
|
+
const o = standing(d, name, who);
|
|
642
|
+
if (!o)
|
|
643
|
+
return "none";
|
|
644
|
+
return !fresh(o, hash) ? "stale" : STATUS_OF[o.verdict];
|
|
645
|
+
}
|
|
646
|
+
/** Where the approval of `who` on `name` stands against the version whose hash is `hash` (ReviewSpec
|
|
647
|
+
* decision 1, the owner's decision of 2026-10-20): `approved` where their current opinion is an
|
|
648
|
+
* approval of that version — approving again records nothing —, `stale` where it is an approval of
|
|
649
|
+
* an earlier one, `none` where it is no approval (none, a comment, or withdrawn). What the review
|
|
650
|
+
* box's Approve says (Approve, Approved ✓, Approve again), and what the server takes as no change. */
|
|
651
|
+
export function approval(d, name, who, hash) {
|
|
652
|
+
const o = standing(d, name, who);
|
|
653
|
+
if (!o || o.verdict !== "approve")
|
|
654
|
+
return "none";
|
|
655
|
+
return fresh(o, hash) ? "approved" : "stale";
|
|
656
|
+
}
|
|
625
657
|
/** An opinion recorded for someone else (ReviewSpec decision 8), as the review holds it: theirs —
|
|
626
658
|
* under their latest name where they are invited — saying who recorded it. */
|
|
627
659
|
function recordedFor(d, o, forName, forPerson) {
|
package/dist/shared/sharesnap.js
CHANGED
|
@@ -66,6 +66,12 @@ const same = (...fields) => ({
|
|
|
66
66
|
write: (v) => Object.fromEntries(fields.filter((f) => v[f] !== undefined).map((f) => [f, v[f]])),
|
|
67
67
|
read: (o, clean) => Object.fromEntries(fields.filter((f) => f in o && clean[f] !== undefined).map((f) => [f, clean[f]])),
|
|
68
68
|
});
|
|
69
|
+
/** The Export window with its job only where the job has an id: one the server had not named yet,
|
|
70
|
+
* or refused, is nothing the opener can read. */
|
|
71
|
+
function namedJob(e) {
|
|
72
|
+
const { job, ...rest } = e;
|
|
73
|
+
return { ...rest, ...(job?.id ? { job } : {}) };
|
|
74
|
+
}
|
|
69
75
|
/** to a tenth of a unit of the board's world: a tenth of a pixel at the closest zoom but one */
|
|
70
76
|
const tenth = (n) => Math.round(n * 10) / 10;
|
|
71
77
|
/** The form of every followed part, by its name in the registry (web/src/surfaces.ts, which holds the
|
|
@@ -106,6 +112,15 @@ export const SNAPSHOT_FORMS = {
|
|
|
106
112
|
colouring: same("scheme"),
|
|
107
113
|
edges: same("edges"),
|
|
108
114
|
linear: same("linear"),
|
|
115
|
+
// the Export window open, with its settings and the document it shows typeset or typesetting,
|
|
116
|
+
// which the opener reads by its id from the export's cache (the owner's decision of 2026-10-20); a
|
|
117
|
+
// job the server had not named yet, or refused, is no document to show, and is left out. Closed,
|
|
118
|
+
// nothing: the opener's own stays as it is
|
|
119
|
+
export: {
|
|
120
|
+
fields: ["export"],
|
|
121
|
+
write: (v) => (v.export?.open ? { export: namedJob(v.export) } : {}),
|
|
122
|
+
read: (o, clean) => ("export" in o && clean.export?.open ? { export: namedJob(clean.export) } : {}),
|
|
123
|
+
},
|
|
109
124
|
artwork: same("artwork"),
|
|
110
125
|
};
|
|
111
126
|
/** The snapshot of where a page is (`v`, as presence carries it: the registry's parts, read by the
|
package/dist/shared/titles.js
CHANGED
|
@@ -182,6 +182,9 @@ function filterWords(q) {
|
|
|
182
182
|
return or(q.statuses);
|
|
183
183
|
case "advice":
|
|
184
184
|
return or(q.verdicts.map((v) => (v === "approve" ? "agent-approved" : "agent-commented")));
|
|
185
|
+
case "mine":
|
|
186
|
+
// the reader's own review: "me" is whoever reads the title
|
|
187
|
+
return or(q.statuses.map((s) => (s === "none" ? "not reviewed by me" : s === "stale" ? "stale of mine" : `${s} by me`)));
|
|
185
188
|
case "sorry":
|
|
186
189
|
return "with sorry";
|
|
187
190
|
case "nonstandard":
|
|
@@ -240,6 +243,7 @@ function said(q, N) {
|
|
|
240
243
|
case "kind":
|
|
241
244
|
case "status":
|
|
242
245
|
case "advice":
|
|
246
|
+
case "mine":
|
|
243
247
|
return filterWords(q);
|
|
244
248
|
case "and":
|
|
245
249
|
case "or":
|