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/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center"><sub>Five Lean codebases, drawn by <code>visualproof artwork</code>.</sub></p>
|
|
11
11
|
|
|
12
|
-
https://github.com/user-attachments/assets/
|
|
12
|
+
https://github.com/user-attachments/assets/5d090578-ba18-493f-83d9-7529bcbc689c
|
|
13
13
|
|
|
14
14
|
<p align="center"><sub>A review of Sphere-Packing-Lean in 71 seconds. The whole tour — three and a half minutes in thirteen chapters, with captions — is in the page under <b>?</b> → Tips, and <a href="https://visualproof-demo.yingte.io/#tips">on the live demo</a>.</sub></p>
|
|
15
15
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"film": {
|
|
3
|
-
"file": "tour-
|
|
4
|
-
"sha256": "
|
|
5
|
-
"size":
|
|
3
|
+
"file": "tour-5a226b0d2c08.mp4",
|
|
4
|
+
"sha256": "5a226b0d2c080edebf0cbd49ad326bbf13a0b0e1b69df7d6516032ced7638b13",
|
|
5
|
+
"size": 48114397,
|
|
6
6
|
"width": 2560,
|
|
7
7
|
"height": 1600,
|
|
8
|
-
"duration":
|
|
8
|
+
"duration": 209
|
|
9
9
|
},
|
|
10
10
|
"chapters": [
|
|
11
11
|
{
|
|
@@ -26,52 +26,52 @@
|
|
|
26
26
|
{
|
|
27
27
|
"id": "source",
|
|
28
28
|
"start": 45.666666666666664,
|
|
29
|
-
"end": 55.
|
|
29
|
+
"end": 55.8
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"id": "keys",
|
|
33
|
-
"start": 55.
|
|
34
|
-
"end": 76.
|
|
33
|
+
"start": 55.8,
|
|
34
|
+
"end": 76.9
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"id": "checks",
|
|
38
|
-
"start": 76.
|
|
39
|
-
"end": 94.
|
|
38
|
+
"start": 76.9,
|
|
39
|
+
"end": 94.66666666666667
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"id": "review",
|
|
43
|
-
"start": 94.
|
|
44
|
-
"end": 110.
|
|
43
|
+
"start": 94.66666666666667,
|
|
44
|
+
"end": 110.53333333333333
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"id": "project",
|
|
48
|
-
"start": 110.
|
|
49
|
-
"end": 117.
|
|
48
|
+
"start": 110.53333333333333,
|
|
49
|
+
"end": 117.26666666666667
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"id": "share",
|
|
53
|
-
"start": 117.
|
|
54
|
-
"end":
|
|
53
|
+
"start": 117.26666666666667,
|
|
54
|
+
"end": 129.1
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"id": "agent",
|
|
58
|
-
"start":
|
|
59
|
-
"end": 145.
|
|
58
|
+
"start": 129.1,
|
|
59
|
+
"end": 145.8
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"id": "library",
|
|
63
|
-
"start": 145.
|
|
64
|
-
"end": 173.
|
|
63
|
+
"start": 145.8,
|
|
64
|
+
"end": 173.53333333333333
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"id": "export",
|
|
68
|
-
"start": 173.
|
|
69
|
-
"end": 191.
|
|
68
|
+
"start": 173.53333333333333,
|
|
69
|
+
"end": 191.8
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"id": "artwork",
|
|
73
|
-
"start": 191.
|
|
74
|
-
"end":
|
|
73
|
+
"start": 191.8,
|
|
74
|
+
"end": 209
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
77
|
"captions": [
|
|
@@ -132,172 +132,172 @@
|
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"start": 49.7,
|
|
135
|
-
"end": 52.
|
|
135
|
+
"end": 52.86666666666667,
|
|
136
136
|
"text": "Rest on a name: Lean says what it is."
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
|
-
"start": 52.
|
|
140
|
-
"end": 55.
|
|
139
|
+
"start": 52.86666666666667,
|
|
140
|
+
"end": 55.8,
|
|
141
141
|
"text": "Click it to go there: its source, its panel."
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
|
-
"start": 55.
|
|
145
|
-
"end": 58.
|
|
144
|
+
"start": 55.8,
|
|
145
|
+
"end": 58.86666666666667,
|
|
146
146
|
"text": "Keys: the definitions that carry what it says."
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
"start": 58.
|
|
150
|
-
"end": 70,
|
|
149
|
+
"start": 58.86666666666667,
|
|
150
|
+
"end": 70.19999999999999,
|
|
151
151
|
"text": "Mark each as a key, in its source or its panel."
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
|
-
"start": 70,
|
|
155
|
-
"end": 76.
|
|
154
|
+
"start": 70.19999999999999,
|
|
155
|
+
"end": 76.9,
|
|
156
156
|
"text": "Rests on · Keys lights them, joined to the target."
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
"start": 77.
|
|
160
|
-
"end": 79.
|
|
159
|
+
"start": 77.30000000000001,
|
|
160
|
+
"end": 79.66666666666667,
|
|
161
161
|
"text": "Selection: the statement alone."
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
"start": 79.
|
|
165
|
-
"end": 82.
|
|
164
|
+
"start": 79.66666666666667,
|
|
165
|
+
"end": 82.46666666666667,
|
|
166
166
|
"text": "Least effort — you trust every name in it."
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
"start": 82.
|
|
170
|
-
"end": 84.
|
|
169
|
+
"start": 82.46666666666667,
|
|
170
|
+
"end": 84.93333333333334,
|
|
171
171
|
"text": "Keys: the few that carry the meaning."
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
|
-
"start": 84.
|
|
175
|
-
"end":
|
|
174
|
+
"start": 84.93333333333334,
|
|
175
|
+
"end": 87.00000000000001,
|
|
176
176
|
"text": "Little effort, good confidence."
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
|
-
"start":
|
|
180
|
-
"end":
|
|
179
|
+
"start": 87.00000000000001,
|
|
180
|
+
"end": 89.00000000000001,
|
|
181
181
|
"text": "TCB: everything it rests on."
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
|
-
"start":
|
|
185
|
-
"end":
|
|
184
|
+
"start": 89.00000000000001,
|
|
185
|
+
"end": 91.00000000000001,
|
|
186
186
|
"text": "Most effort, most confidence."
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
"start":
|
|
190
|
-
"end": 94.
|
|
189
|
+
"start": 91.00000000000001,
|
|
190
|
+
"end": 94.66666666666667,
|
|
191
191
|
"text": "Choose how far to read: the counts say what each costs."
|
|
192
192
|
},
|
|
193
193
|
{
|
|
194
|
-
"start": 94.
|
|
195
|
-
"end": 98.
|
|
194
|
+
"start": 94.66666666666667,
|
|
195
|
+
"end": 98.23333333333333,
|
|
196
196
|
"text": "Read a definition, then say what you think of it."
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
"start": 98.
|
|
200
|
-
"end": 104.
|
|
199
|
+
"start": 98.23333333333333,
|
|
200
|
+
"end": 104.26666666666668,
|
|
201
201
|
"text": "Approve it, with why: the comment stays with it."
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
"start": 104.
|
|
205
|
-
"end":
|
|
204
|
+
"start": 104.26666666666668,
|
|
205
|
+
"end": 107.06666666666668,
|
|
206
206
|
"text": "Changed your mind? Withdraw takes it back."
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
|
-
"start":
|
|
210
|
-
"end": 110.
|
|
209
|
+
"start": 107.06666666666668,
|
|
210
|
+
"end": 110.53333333333335,
|
|
211
211
|
"text": "The target's progress counts your approval."
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
|
-
"start": 110.
|
|
215
|
-
"end": 114.
|
|
214
|
+
"start": 110.53333333333333,
|
|
215
|
+
"end": 114.63333333333333,
|
|
216
216
|
"text": "The Project tab: the whole codebase."
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
|
-
"start": 114.
|
|
220
|
-
"end": 117.
|
|
219
|
+
"start": 114.63333333333333,
|
|
220
|
+
"end": 117.26666666666667,
|
|
221
221
|
"text": "Every board shows the same review."
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
|
-
"start": 117.
|
|
225
|
-
"end": 122.
|
|
224
|
+
"start": 117.26666666666667,
|
|
225
|
+
"end": 122.89999999999999,
|
|
226
226
|
"text": "Share → AI agent: a token, and a prompt for it."
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
|
-
"start": 122.
|
|
230
|
-
"end":
|
|
229
|
+
"start": 122.89999999999999,
|
|
230
|
+
"end": 126.1,
|
|
231
231
|
"text": "Paste the prompt into your agent: it joins here."
|
|
232
232
|
},
|
|
233
233
|
{
|
|
234
|
-
"start":
|
|
235
|
-
"end":
|
|
234
|
+
"start": 126.1,
|
|
235
|
+
"end": 129.09999999999997,
|
|
236
236
|
"text": "The token is the agent's own: revoke it here."
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
|
-
"start": 129.
|
|
240
|
-
"end": 136.
|
|
239
|
+
"start": 129.6,
|
|
240
|
+
"end": 136.63333333333335,
|
|
241
241
|
"text": "Its menu → Talk: your private channel with it."
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
|
-
"start": 136.
|
|
245
|
-
"end": 140.
|
|
244
|
+
"start": 136.63333333333335,
|
|
245
|
+
"end": 140.23333333333335,
|
|
246
246
|
"text": "It reads the code; its state says what it does."
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
|
-
"start": 140.
|
|
250
|
-
"end": 142.
|
|
249
|
+
"start": 140.23333333333335,
|
|
250
|
+
"end": 142.70000000000002,
|
|
251
251
|
"text": "Its answer links to what it explains."
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
|
-
"start": 142.
|
|
255
|
-
"end": 145.
|
|
254
|
+
"start": 142.70000000000002,
|
|
255
|
+
"end": 145.8,
|
|
256
256
|
"text": "Click the link: your board goes there."
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
|
-
"start": 146.
|
|
260
|
-
"end": 151.
|
|
259
|
+
"start": 146.93333333333334,
|
|
260
|
+
"end": 151.56666666666666,
|
|
261
261
|
"text": "Library: add a paper about the code."
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
|
-
"start": 151.
|
|
265
|
-
"end": 162.
|
|
264
|
+
"start": 151.56666666666666,
|
|
265
|
+
"end": 162.8,
|
|
266
266
|
"text": "Link it to the theorem, at its page."
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
|
-
"start": 162.
|
|
270
|
-
"end": 167,
|
|
269
|
+
"start": 162.8,
|
|
270
|
+
"end": 167.20000000000002,
|
|
271
271
|
"text": "Space: its source, and the paper beside it at its page."
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
|
-
"start": 167,
|
|
275
|
-
"end": 173.
|
|
274
|
+
"start": 167.20000000000002,
|
|
275
|
+
"end": 173.53333333333333,
|
|
276
276
|
"text": "Pin a note on the target: where to start."
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
|
-
"start": 173.
|
|
280
|
-
"end": 180.
|
|
279
|
+
"start": 173.53333333333333,
|
|
280
|
+
"end": 180.96666666666667,
|
|
281
281
|
"text": "Export prints a view: here, the target's TCB."
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
|
-
"start": 180.
|
|
285
|
-
"end": 184.
|
|
284
|
+
"start": 180.96666666666667,
|
|
285
|
+
"end": 184.86666666666667,
|
|
286
286
|
"text": "Drag a section to change the document's order."
|
|
287
287
|
},
|
|
288
288
|
{
|
|
289
|
-
"start": 184.
|
|
290
|
-
"end": 191.
|
|
289
|
+
"start": 184.86666666666667,
|
|
290
|
+
"end": 191.8,
|
|
291
291
|
"text": "Typeset: the PDF follows the order you set."
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
|
-
"start": 191.
|
|
295
|
-
"end": 195.
|
|
294
|
+
"start": 191.8,
|
|
295
|
+
"end": 195.86666666666667,
|
|
296
296
|
"text": "Artwork: the board as a picture to keep."
|
|
297
297
|
},
|
|
298
298
|
{
|
|
299
|
-
"start": 195.
|
|
300
|
-
"end": 205.
|
|
299
|
+
"start": 195.86666666666667,
|
|
300
|
+
"end": 205.8,
|
|
301
301
|
"text": "Frame it, then save it as PNG or SVG."
|
|
302
302
|
}
|
|
303
303
|
]
|
|
Binary file
|
package/dist/server/agent.js
CHANGED
|
@@ -483,7 +483,7 @@ export class AgentApi {
|
|
|
483
483
|
{
|
|
484
484
|
method: "POST", path: "/api/agent/opinion", brief: "advice: approve or comment", needs: "advise", about: "Give advice on a declaration's present version: approve, or comment with what is wrong, unclear or worth checking. The server records the content hash and the text you judged. A later opinion replaces your earlier one. Never counted. A non-standard axiom a target rests on is advised on by its name, also where the graph has no declaration for it.",
|
|
485
485
|
params: { name, verdict: "approve | comment", comment: "your reasons; the text of a comment, which needs one (at most 10,000 characters). Light Markdown, kept as written: > quotes, `code`, ```lean blocks, **bold**, *italics*; a declaration's full name in backticks links to it; no HTML. Quote an opinion as `> [**Alice** (2026-10-09)](opinion:<name>#<by>@<at>):`, source lines as `[File.lean:12–13](source:<name>#L12-L13)` over a ```lean block (GET /api/agent/docs/advice)", opinions: `or several at once, [{name, verdict, comment}], at most ${MAX_OPINIONS}: answered as POST opinions answers them` },
|
|
486
|
-
returns: "{ok, recorded: {name, verdict, comment, hash, judged}, counted: false}",
|
|
486
|
+
returns: "{ok, recorded: {name, verdict, comment, hash, judged}, counted: false}; {ok, unchanged: true, note} where your advice approves this version already (nothing recorded)",
|
|
487
487
|
run: (a) => opinionPost(this, a),
|
|
488
488
|
},
|
|
489
489
|
{
|
|
@@ -495,7 +495,7 @@ export class AgentApi {
|
|
|
495
495
|
{
|
|
496
496
|
method: "POST", path: "/api/agent/opinions", needs: "advise", about: `Advice on up to ${MAX_OPINIONS} declarations at once: each item is checked and recorded as POST opinion does it, and answered on its own — one refused does not refuse the others.`,
|
|
497
497
|
params: { opinions: `[{name, verdict, comment}], at most ${MAX_OPINIONS}` },
|
|
498
|
-
returns: "{ok, recorded, refused, counted: false, results: [{index, name, status, recorded? | error, hint, didYouMean?}]}",
|
|
498
|
+
returns: "{ok, recorded, unchanged?, refused, counted: false, results: [{index, name, status, recorded? | unchanged? | error, hint, didYouMean?}]}",
|
|
499
499
|
run: (a) => opinionsPost(this, a),
|
|
500
500
|
},
|
|
501
501
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Advice (AgentSpec decision 2, ReviewSpec decisions 8 and 9), the endpoints of server/agent.ts an
|
|
2
2
|
// agent gives its opinions by: on a declaration's present version, bound to the text it judged as
|
|
3
3
|
// the page's opinions are (server/reviewapi.ts); on several at once; and its own taken back. Advice
|
|
4
|
-
// is recorded marked as an agent's: shown apart, never counted, at every level.
|
|
4
|
+
// is recorded marked as an agent's: shown apart, never counted, at every level. Nobody approves
|
|
5
|
+
// twice (ReviewSpec decision 1, the owner's decision of 2026-10-20): an approval of the version its
|
|
6
|
+
// advice approves already writes nothing, and is answered `unchanged`.
|
|
5
7
|
import { STANDARD_AXIOMS } from "../shared/review.js";
|
|
6
8
|
import { appended } from "./reviewapi.js";
|
|
7
9
|
import { View } from "./agentgraph.js";
|
|
@@ -19,8 +21,12 @@ export function opinionPost(api, a) {
|
|
|
19
21
|
const r = advise(api, v, body(a), a.caller);
|
|
20
22
|
if (r.status !== 200)
|
|
21
23
|
return r;
|
|
24
|
+
if (r.body.unchanged)
|
|
25
|
+
return ok({ ok: true, ...r.body, counted: false });
|
|
22
26
|
return ok({ ok: true, ...r.body, counted: false, note: "Recorded as advice: shown apart to people, never counted." });
|
|
23
27
|
}
|
|
28
|
+
/** What an approval of the version one approved already is answered with: nothing was written. */
|
|
29
|
+
const UNCHANGED = "Your advice there is an approval of this version already: nothing was recorded, a comment with it neither. Withdraw it first (POST /api/agent/opinion/withdraw) to approve again with other words, or comment.";
|
|
24
30
|
/** The agent's advice on a declaration taken back (ReviewSpec decision 9): its own, never anyone
|
|
25
31
|
* else's; afterwards it has none there, its earlier advice not restored. A name the graph folds
|
|
26
32
|
* into a declaration is that declaration's; a name the graph no longer has keeps what was said of
|
|
@@ -60,8 +66,11 @@ export function opinionsPost(api, a) {
|
|
|
60
66
|
const r = advise(api, v, x && typeof x === "object" && !Array.isArray(x) ? x : {}, a.caller);
|
|
61
67
|
return { index: k, name: x?.name ?? null, status: r.status, ...r.body };
|
|
62
68
|
});
|
|
63
|
-
const
|
|
64
|
-
|
|
69
|
+
const done = results.filter((r) => r.status === 200);
|
|
70
|
+
// an approval of the version it approved already writes nothing (ReviewSpec decision 1)
|
|
71
|
+
const unchanged = done.filter((r) => r.unchanged).length;
|
|
72
|
+
const recorded = done.length - unchanged;
|
|
73
|
+
return ok({ ok: true, recorded, ...(unchanged ? { unchanged } : {}), refused: items.length - done.length, counted: false, note: "Each item is answered on its own (its status); what was recorded is advice: shown apart to people, never counted.", results });
|
|
65
74
|
}
|
|
66
75
|
/** Check and record one piece of advice: the answer is `{recorded}`, or why it is refused. What
|
|
67
76
|
* it is about — the declaration's hash and the text judged — is bound as the page's opinions are
|
|
@@ -110,6 +119,10 @@ function advise(api, v, b, me) {
|
|
|
110
119
|
return { status: a.status, body: a.body };
|
|
111
120
|
}
|
|
112
121
|
const folded = unit !== name ? { asked: name, foldedInto: unit } : {};
|
|
122
|
+
// nobody approves twice (ReviewSpec decision 1, the owner's decision of 2026-10-20): its advice
|
|
123
|
+
// there is an approval of this version already, and nothing is written, the words with it neither
|
|
124
|
+
if (!r.change)
|
|
125
|
+
return ok({ unchanged: true, name: x.name, note: UNCHANGED, ...folded });
|
|
113
126
|
return ok({ recorded: { name: x.name, verdict, ...(comment ? { comment } : {}), hash: x.hash ?? null, judged: judged.text !== undefined ? "source" : judged.statement !== undefined ? "statement" : null }, ...folded });
|
|
114
127
|
}
|
|
115
128
|
export const MAX_OPINIONS = 100;
|
|
@@ -45,6 +45,9 @@ export async function companion(api, a) {
|
|
|
45
45
|
return { name: p.name, ...(p.verified ? { verified: true } : {}), idle: ps.every((x) => x.idle), pages: ps.length, place: p.view ? placeOf(api, p.view) : null };
|
|
46
46
|
});
|
|
47
47
|
out.sort((x, y) => Number(x.idle) - Number(y.idle) || (x.name ?? "\uffff").localeCompare(y.name ?? "\uffff"));
|
|
48
|
+
// who follows this agent (the owner's decision of 2026-10-21): the people by name, a page without a
|
|
49
|
+
// name as one; the private readers counted only; a read-only reader never (nobody sees one)
|
|
50
|
+
const followedBy = mine ? followersOf(P, peers, `a:${mine}`) : null;
|
|
48
51
|
// the person who shared with this agent, and whether they are here: the prompt does not say
|
|
49
52
|
// where they are, this does
|
|
50
53
|
const by = a.caller.token?.by;
|
|
@@ -57,16 +60,35 @@ export async function companion(api, a) {
|
|
|
57
60
|
...(sharedBy && !sharedBy.here ? { sharedByNote: `${by}, who shared with you, has no page open now: go on with what they asked; ?wait=60&since=<rev> tells you when someone comes.` } : {}),
|
|
58
61
|
people: out,
|
|
59
62
|
privateCount: P.privateCount(),
|
|
63
|
+
...(followedBy ? { followedBy } : {}),
|
|
60
64
|
agents,
|
|
61
|
-
note: "privateCount: how many people are here privately — not listed, not followable, nothing known of where they are. Each person's place is that of their liveliest page: the view, the tool (how a click selects), what is selected (a query), the declaration their panel tells of, whether its source window is open (and collapsed), the source windows they pinned (pinned: declaration, collapsed), and, where their page says them, Activity (open, kind, who, mine: whose targets), the lost-and-found (lostAndFound.open), the colouring (kind or status), edges — all of which those following them see too. idle: no input for five minutes, or the page in the background. verified: invited by a personal link, so the name is theirs. To look where someone looks, POST /api/agent/view with their view and declaration; ?wait=<s>&since=<rev> waits for the next change (at most 60 s).",
|
|
65
|
+
note: "privateCount: how many people are here privately — not listed, not followable, nothing known of where they are. Each person's place is that of their liveliest page: the view, the tool (how a click selects), what is selected (a query), the declaration their panel tells of, whether its source window is open (and collapsed), the source windows they pinned (pinned: declaration, collapsed), and, where their page says them, Activity (open, kind, who, mine: whose targets), the lost-and-found (lostAndFound.open), the colouring (kind or status), edges, the Export window (export: open, its settings, the document typeset by its job's id) — all of which those following them see too. followedBy: who follows you — the people by name, the private readers counted only (readers by a read-only link are never told of). idle: no input for five minutes, or the page in the background. verified: invited by a personal link, so the name is theirs. To look where someone looks, POST /api/agent/view with their view and declaration; ?wait=<s>&since=<rev> waits for the next change (at most 60 s).",
|
|
62
66
|
});
|
|
63
67
|
}
|
|
68
|
+
/** Who follows the person or agent `key` (shared/collab.ts personKey): the people whose pages say
|
|
69
|
+
* so, each once by name (null for a page without one), and how many private readers do. */
|
|
70
|
+
export function followersOf(P, peers, key) {
|
|
71
|
+
const seen = new Set();
|
|
72
|
+
const people = [];
|
|
73
|
+
for (const p of peers) {
|
|
74
|
+
if (p.agent || p.view?.following !== key)
|
|
75
|
+
continue;
|
|
76
|
+
const who = p.name ? `${p.verified ? "v" : "n"}:${p.name}` : `s:${p.id}`;
|
|
77
|
+
if (seen.has(who))
|
|
78
|
+
continue;
|
|
79
|
+
seen.add(who);
|
|
80
|
+
people.push(p.name);
|
|
81
|
+
}
|
|
82
|
+
people.sort((a, b) => (a ?? "\uffff").localeCompare(b ?? "\uffff"));
|
|
83
|
+
return { people, private: P.privateFollowers().get(key) ?? 0 };
|
|
84
|
+
}
|
|
64
85
|
/** A page's or an agent's place, as the companion tells it (and a conversation's message, where
|
|
65
86
|
* its writer was): with its source windows, the one following the selection and those pinned,
|
|
66
87
|
* each collapsed or not (decided 2026-10-09: what a follower's windows mirror), the build it
|
|
67
88
|
* browses in the Time Machine (HistorySpec decision 18), and what else those following it see
|
|
68
89
|
* (CollabSpec decision 4, the owner's decision of 2026-10-11): Activity and its filters, the
|
|
69
|
-
* lost-and-found, the colouring, the edges
|
|
90
|
+
* lost-and-found, the colouring, the edges, and the Export window (the owner's decision of
|
|
91
|
+
* 2026-10-20) — each where the page says it (an agent says none). */
|
|
70
92
|
export function placeOf(api, v) {
|
|
71
93
|
const on = v.view ? api.world.views.book.get(v.view) : undefined;
|
|
72
94
|
const titles = titleContext(api.world);
|
|
@@ -88,7 +110,12 @@ export function placeOf(api, v) {
|
|
|
88
110
|
: v.lostFound?.open
|
|
89
111
|
? ", with the lost-and-found open"
|
|
90
112
|
: "";
|
|
91
|
-
const drawn = (v.scheme ? `, coloured by ${v.scheme}` : "") + (v.edges === false ? ", edges hidden" : "");
|
|
113
|
+
const drawn = (v.scheme ? `, coloured by ${v.scheme === "mine" ? "their own review (Mine)" : v.scheme}` : "") + (v.edges === false ? ", edges hidden" : "");
|
|
114
|
+
// the Export window, followed too (the owner's decision of 2026-10-20)
|
|
115
|
+
const job = v.export?.job;
|
|
116
|
+
const exporting = v.export?.open
|
|
117
|
+
? `, with the Export window open${job?.state === "running" ? ", its document being typeset" : job?.state === "done" ? ", its document typeset" : job?.state === "failed" ? ", its typesetting failed" : ""}`
|
|
118
|
+
: "";
|
|
92
119
|
return {
|
|
93
120
|
view: v.view ?? PROJECT,
|
|
94
121
|
viewTitle: title,
|
|
@@ -106,7 +133,8 @@ export function placeOf(api, v) {
|
|
|
106
133
|
...(v.lostFound ? { lostAndFound: { open: v.lostFound.open } } : {}),
|
|
107
134
|
...(v.scheme ? { colouring: v.scheme } : {}),
|
|
108
135
|
...(v.edges !== undefined ? { edges: v.edges } : {}),
|
|
109
|
-
|
|
136
|
+
...(v.export ? { export: v.export } : {}),
|
|
137
|
+
inWords: words + then + shownBy + drawn + exporting + ".",
|
|
110
138
|
};
|
|
111
139
|
}
|
|
112
140
|
export function viewPost(api, a) {
|
|
@@ -640,7 +640,7 @@ export function viewEndpoints(world, refuseFull) {
|
|
|
640
640
|
run: (a) => items(a),
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
|
-
method: "POST", path: "/api/agent/views/open", about: "Open the view on a query — the open one with the same scope and build, or a new one nobody keeps — and be on it: people following you see it. With version, it shows that build, as what is made from a board of a past build does (Zoom in on a view kept at a build). The query language: all, tcb(A), uses(A), usedBy(A), decl(A, B), ns(P), file(P), trusted, external, kind(theorem), status(unreviewed|approved|commented|stale), advice(approve|comment), sorry, nonstandard, key(T) (key(targets): every target's), joined by and, or, except.",
|
|
643
|
+
method: "POST", path: "/api/agent/views/open", about: "Open the view on a query — the open one with the same scope and build, or a new one nobody keeps — and be on it: people following you see it. With version, it shows that build, as what is made from a board of a past build does (Zoom in on a view kept at a build). The query language: all, tcb(A), uses(A), usedBy(A), decl(A, B), ns(P), file(P), trusted, external, kind(theorem), status(unreviewed|approved|commented|stale), advice(approve|comment), sorry, nonstandard, key(T) (key(targets): every target's), joined by and, or, except; mine(…), a person's own review, holds nothing for an agent.",
|
|
644
644
|
params: { scope: "the query, as text (e.g. \"tcb(A.b) except trusted except external\") or its JSON form", version: "a snapshot's id (GET /api/agent/history): the build it shows; null or left out for the latest", clustering: "namespace (default) or module: a new view's", focus: "a target's full name: a new view's focus, the target it is made from (as a target's Key view is)" },
|
|
645
645
|
returns: "{view, holds: {project, outside}, note}",
|
|
646
646
|
run: (a) => open(a),
|
package/dist/server/app.js
CHANGED
|
@@ -29,7 +29,7 @@ import { readOnlyAllows, ReadOnlyBounds } from "./readonlygate.js";
|
|
|
29
29
|
import { readBody, refused, sendFile, sendJson, sendRevision, sendText, TooLarge, tooLarge } from "./send.js";
|
|
30
30
|
import { endedWords, enter, enterReadOnly, identity, identityGet, refuseHost, revokedWords } from "./appaccess.js";
|
|
31
31
|
import { shareAgents, sharePeople, shareReadOnly } from "./appshare.js";
|
|
32
|
-
import { ask, chat, chatNew, presence } from "./apptalk.js";
|
|
32
|
+
import { ask, chat, chatNew, pointer, presence } from "./apptalk.js";
|
|
33
33
|
import { history, layoutUndo, libraryRequest, reviewPost, views } from "./appsite.js";
|
|
34
34
|
import { agentRoute, exportRoute } from "./appagent.js";
|
|
35
35
|
import { git, graphParts, hover, source, status } from "./appgraph.js";
|
|
@@ -348,6 +348,8 @@ export class App {
|
|
|
348
348
|
return identity(this, req, res);
|
|
349
349
|
if (path === "/api/presence" && req.method === "POST")
|
|
350
350
|
return presence(this, req, res, agent);
|
|
351
|
+
if (path === "/api/pointer" && req.method === "POST")
|
|
352
|
+
return pointer(this, req, res);
|
|
351
353
|
if (path === "/api/events") {
|
|
352
354
|
const session = url.searchParams.get("session");
|
|
353
355
|
// `build=delta`: the page takes the build status as changes (a page of 0.6.0 or later)
|
package/dist/server/apptalk.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// others see (presence: CollabSpec decisions 4 and 8), asking others to follow (decision 10), and
|
|
3
3
|
// the conversations (decision 13, AgentSpec decision 8) — the public channel, each agent's private
|
|
4
4
|
// one with its maker, a new conversation there. Agents do all of it through their API.
|
|
5
|
-
import { cleanView, madeBy, nameKey
|
|
5
|
+
import { agentPlace, cleanFollowing, cleanView, madeBy, nameKey } from "../shared/collab.js";
|
|
6
6
|
import { forPages, MAX_PERSON, PUBLIC, THREAD } from "./talk.js";
|
|
7
7
|
import { mentioned } from "../shared/mentions.js";
|
|
8
8
|
import { sendJson } from "./send.js";
|
|
9
9
|
import { placeOf } from "./agentfollow.js";
|
|
10
|
+
import { BODY_MAX } from "../shared/pointer.js";
|
|
10
11
|
/** where a reader is: the others see it (CollabSpec decision 4); of a private reader, only that
|
|
11
12
|
* they are here (decision 8) */
|
|
12
13
|
export async function presence(app, req, res, agent) {
|
|
@@ -19,13 +20,29 @@ export async function presence(app, req, res, agent) {
|
|
|
19
20
|
// its own event stream only, by the secret the stream was given (`hello`)
|
|
20
21
|
const name = app.ids.who(req);
|
|
21
22
|
const priv = !agent && b.private === true;
|
|
22
|
-
// agents have no artwork (ExportSpec decision 19)
|
|
23
|
+
// agents have no artwork (ExportSpec decision 19) nor Export window — the page draws them — and
|
|
24
|
+
// follow nobody; a private page says whom it follows and nothing else, so that the reader it
|
|
25
|
+
// follows is told it is followed, by someone (the owner's decision of 2026-10-20)
|
|
23
26
|
if (agent && name)
|
|
24
|
-
live.presence.agentBeat(name,
|
|
25
|
-
else if (!live.beat(b.token, priv ? null : name, priv ? null : cleanView(b.view), !priv && b.idle === true, priv, !!app.ids.person(req), name))
|
|
27
|
+
live.presence.agentBeat(name, agentPlace(cleanView(b.view)));
|
|
28
|
+
else if (!live.beat(b.token, priv ? null : name, priv ? null : cleanView(b.view), !priv && b.idle === true, priv, !!app.ids.person(req), name, priv ? cleanFollowing(b.following) : null))
|
|
26
29
|
return sendJson(res, { error: "This heartbeat is not from an open event stream of this page's: it is sent with the token the stream says hello with.", stream: false }, 403);
|
|
27
30
|
return sendJson(res, { ok: true });
|
|
28
31
|
}
|
|
32
|
+
/** Where a page's pointer is, and what text it has selected (CollabSpec decision 4, the owner's
|
|
33
|
+
* decisions of 2026-10-20; shared/pointer.ts): relayed to the pages of its room by its stream's
|
|
34
|
+
* secret, as a heartbeat is, and kept nowhere; a read-only page says whom it follows. 403 where no
|
|
35
|
+
* open stream has the secret (an agent has none). */
|
|
36
|
+
export async function pointer(app, req, res) {
|
|
37
|
+
const r = await app.json(req, BODY_MAX);
|
|
38
|
+
if (r.error !== undefined)
|
|
39
|
+
return sendJson(res, { error: r.error }, 400);
|
|
40
|
+
const b = (r.body && typeof r.body === "object" ? r.body : {});
|
|
41
|
+
const to = app.live.pointer(b.token, b);
|
|
42
|
+
if (to === null)
|
|
43
|
+
return sendJson(res, { error: "This pointer is not from an open event stream of this page's: it is sent with the token the stream says hello with.", stream: false }, 403);
|
|
44
|
+
return sendJson(res, { ok: true, to });
|
|
45
|
+
}
|
|
29
46
|
/** The conversations (CollabSpec decision 13, AgentSpec decision 8), for pages: a channel read
|
|
30
47
|
* (GET ?channel=public|<agent id>&before=<id>, the newest 200 first) and a message written in it
|
|
31
48
|
* (POST {channel, text, place}). Everyone with a name reads and writes the public channel; an
|