visualproof 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/dist/assets/tips/tour-library.webp +0 -0
- package/dist/assets/tips/tour-source.webp +0 -0
- package/dist/assets/tips/tour.json +90 -90
- package/dist/extractor/Extract.lean +34 -11
- package/dist/server/agent.js +19 -7
- package/dist/server/agentexport.js +2 -1
- package/dist/server/agentfollow.js +13 -3
- package/dist/server/agentlean.js +91 -1
- package/dist/server/agentnotes.js +6 -4
- package/dist/server/agentread.js +33 -1
- package/dist/server/app.js +1 -1
- package/dist/server/appgraph.js +24 -0
- package/dist/server/boardspots.js +1 -1
- package/dist/server/goals.js +224 -0
- package/dist/server/hover.js +281 -8
- package/dist/server/live.js +14 -0
- package/dist/server/main.js +3 -2
- package/dist/server/mcptools.js +11 -5
- package/dist/server/options.js +17 -2
- package/dist/server/readonlygate.js +2 -1
- package/dist/server/reviewapi.js +5 -2
- package/dist/server/status.js +43 -5
- package/dist/shared/build.js +9 -0
- package/dist/shared/collab.js +14 -2
- package/dist/shared/declfind.js +23 -3
- package/dist/shared/goals.js +309 -0
- package/dist/shared/hygiene.js +18 -0
- package/dist/shared/noteplace.js +45 -19
- package/dist/shared/scope.js +74 -45
- package/dist/shared/sharesnap.js +4 -2
- package/dist/web/bundle/app.js +2271 -581
- package/dist/web/index.html +1 -1
- package/dist/web/src/highlight.js +53 -3
- package/dist/web/style.css +148 -0
- package/docs/agent-api/README.md +1 -1
- package/docs/agent-api/mcp.md +1 -1
- package/docs/agent-api/notes.md +3 -2
- package/docs/agent-api/reading.md +38 -2
- package/docs/agent-api/words.md +3 -2
- package/package.json +1 -1
package/dist/shared/scope.js
CHANGED
|
@@ -77,16 +77,18 @@ function stripComments(line, depth) {
|
|
|
77
77
|
}
|
|
78
78
|
return { text: out, depth };
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
const copyFrame = (f) => ({ ...f, opens: [...f.opens], aliases: new Map(f.aliases), open: [...f.open], variables: [...f.variables], universes: [...f.universes], options: [...f.options], local: [...f.local] });
|
|
81
|
+
/** A reading of a file from its start, line by line: `to(upto)` reads on up to line `upto`
|
|
82
|
+
* (0-based, the line a declaration's text starts on, never before a line asked for already) and
|
|
83
|
+
* says what is in force there, as reading the file from its start up to there says it. One reading
|
|
84
|
+
* says it at every declaration of a file, as File mode needs (web/src/filemode.ts): asked anew at
|
|
85
|
+
* each, a file of 3,000 lines was read 200 times over. */
|
|
86
|
+
function walker(lines, hasNamespace) {
|
|
87
|
+
const live = { stack: [frame("top", "", null, 0)], pending: null };
|
|
88
|
+
const current = (st) => st.stack.map((f) => f.ns).filter(Boolean).join(".");
|
|
87
89
|
/** What `open X` opens: X under the namespaces around it, innermost first, or X itself. */
|
|
88
|
-
const resolveNs = (x) => {
|
|
89
|
-
const cur = current().split(".").filter(Boolean);
|
|
90
|
+
const resolveNs = (st, x) => {
|
|
91
|
+
const cur = current(st).split(".").filter(Boolean);
|
|
90
92
|
const out = [];
|
|
91
93
|
for (let k = cur.length; k >= 0; k--) {
|
|
92
94
|
const n = [...cur.slice(0, k), x].join(".");
|
|
@@ -96,7 +98,7 @@ function walk(lines, upto, hasNamespace) {
|
|
|
96
98
|
return out;
|
|
97
99
|
};
|
|
98
100
|
/** `open …` (its arguments): what it opens, into a frame, and the command as written. */
|
|
99
|
-
const open = (args, cmd, into) => {
|
|
101
|
+
const open = (st, args, cmd, into) => {
|
|
100
102
|
const words = args.trim().split(/\s+/);
|
|
101
103
|
const scoped = words[0] === "scoped";
|
|
102
104
|
const spaces = [];
|
|
@@ -105,7 +107,7 @@ function walk(lines, upto, hasNamespace) {
|
|
|
105
107
|
const paren = /^([^\s(]+)\s*\(([^)]*)\)/.exec(rest.trim());
|
|
106
108
|
const renaming = /^([^\s]+)\s+renaming\s+(.*)$/.exec(rest.trim());
|
|
107
109
|
if (paren) {
|
|
108
|
-
for (const ns of resolveNs(paren[1])) {
|
|
110
|
+
for (const ns of resolveNs(st, paren[1])) {
|
|
109
111
|
spaces.push(ns);
|
|
110
112
|
if (!scoped)
|
|
111
113
|
for (const x of paren[2].trim().split(/\s+/))
|
|
@@ -114,7 +116,7 @@ function walk(lines, upto, hasNamespace) {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
else if (renaming) {
|
|
117
|
-
for (const ns of resolveNs(renaming[1])) {
|
|
119
|
+
for (const ns of resolveNs(st, renaming[1])) {
|
|
118
120
|
spaces.push(ns);
|
|
119
121
|
if (!scoped)
|
|
120
122
|
for (const pair of renaming[2].split(",")) {
|
|
@@ -129,7 +131,7 @@ function walk(lines, upto, hasNamespace) {
|
|
|
129
131
|
for (const w of (hiding >= 0 ? rest.slice(0, hiding) : rest).trim().split(/\s+/)) {
|
|
130
132
|
if (!w)
|
|
131
133
|
continue;
|
|
132
|
-
const ns = resolveNs(w);
|
|
134
|
+
const ns = resolveNs(st, w);
|
|
133
135
|
spaces.push(...ns);
|
|
134
136
|
// scoped opens bring notation and instances, no names
|
|
135
137
|
if (!scoped)
|
|
@@ -139,11 +141,12 @@ function walk(lines, upto, hasNamespace) {
|
|
|
139
141
|
into.open.push({ ...cmd, namespaces: [...new Set(spaces)], ...(scoped ? { scoped: true } : {}) });
|
|
140
142
|
};
|
|
141
143
|
/** What a whole command does, once all its lines are read. */
|
|
142
|
-
const finish = (text, line) => {
|
|
144
|
+
const finish = (st, text, line) => {
|
|
145
|
+
const stack = st.stack;
|
|
143
146
|
let m;
|
|
144
147
|
if ((m = NAMESPACE.exec(text))) {
|
|
145
148
|
stack.push(frame("namespace", m[1], m[1], line));
|
|
146
|
-
pending = null;
|
|
149
|
+
st.pending = null;
|
|
147
150
|
return;
|
|
148
151
|
}
|
|
149
152
|
if ((m = SECTION.exec(text))) {
|
|
@@ -151,12 +154,12 @@ function walk(lines, upto, hasNamespace) {
|
|
|
151
154
|
if (/\bnoncomputable\s+section\b/.test(text))
|
|
152
155
|
f.noncomputable = true;
|
|
153
156
|
stack.push(f);
|
|
154
|
-
pending = null;
|
|
157
|
+
st.pending = null;
|
|
155
158
|
return;
|
|
156
159
|
}
|
|
157
160
|
if (MUTUAL.test(text)) {
|
|
158
161
|
stack.push(frame("mutual", "", null, line));
|
|
159
|
-
pending = null;
|
|
162
|
+
st.pending = null;
|
|
160
163
|
return;
|
|
161
164
|
}
|
|
162
165
|
if ((m = END.exec(text))) {
|
|
@@ -164,7 +167,7 @@ function walk(lines, upto, hasNamespace) {
|
|
|
164
167
|
let parts = m[1] ? m[1].split(".").length : 1;
|
|
165
168
|
while (parts > 0 && stack.length > 1)
|
|
166
169
|
parts -= (stack.pop().name ?? "_").split(".").length;
|
|
167
|
-
pending = null;
|
|
170
|
+
st.pending = null;
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
173
|
if (ATTRIBUTES.test(text))
|
|
@@ -172,18 +175,18 @@ function walk(lines, upto, hasNamespace) {
|
|
|
172
175
|
const head = IN_HEAD.test(text);
|
|
173
176
|
// `open A in def x …` on one line holds for that command alone, which is not the one asked about
|
|
174
177
|
if (head && !VARIABLE.test(text) && /\sin\s/.test(text)) {
|
|
175
|
-
pending = null;
|
|
178
|
+
st.pending = null;
|
|
176
179
|
return;
|
|
177
180
|
}
|
|
178
181
|
const onlyNext = head && IN.test(text);
|
|
179
182
|
const body = onlyNext ? text.replace(IN, "") : text;
|
|
180
183
|
// a command that is not `… in` uses up what was pending: a declaration, or anything else
|
|
181
|
-
const into = onlyNext ? (pending ??= frame("top", "", null, line)) : stack[stack.length - 1];
|
|
184
|
+
const into = onlyNext ? (st.pending ??= frame("top", "", null, line)) : stack[stack.length - 1];
|
|
182
185
|
if (!onlyNext)
|
|
183
|
-
pending = null;
|
|
186
|
+
st.pending = null;
|
|
184
187
|
const cmd = (t) => ({ line: line + 1, text: t, ...(onlyNext ? { in: true } : {}) });
|
|
185
188
|
if ((m = OPEN.exec(body)))
|
|
186
|
-
open(m[1], cmd(body), into);
|
|
189
|
+
open(st, m[1], cmd(body), into);
|
|
187
190
|
else if ((m = VARIABLE.exec(body)))
|
|
188
191
|
into.variables.push(cmd(m[1]));
|
|
189
192
|
else if ((m = UNIVERSE.exec(body)))
|
|
@@ -196,31 +199,42 @@ function walk(lines, upto, hasNamespace) {
|
|
|
196
199
|
let depth = 0;
|
|
197
200
|
/** the command being read: its first line, and its text so far */
|
|
198
201
|
let reading = null;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
let l = 0;
|
|
203
|
+
return {
|
|
204
|
+
to(upto) {
|
|
205
|
+
for (; l < upto && l < lines.length; l++) {
|
|
206
|
+
const line = lines[l];
|
|
207
|
+
const inComment = depth > 0;
|
|
208
|
+
const s = stripComments(line, depth);
|
|
209
|
+
depth = s.depth;
|
|
210
|
+
const text = s.text.replace(/\s+/g, " ").trim();
|
|
211
|
+
if (!text)
|
|
212
|
+
continue;
|
|
213
|
+
// a command starts at the line's first column, outside a comment; anything else continues it
|
|
214
|
+
if (!inComment && !/^\s/.test(line)) {
|
|
215
|
+
if (reading)
|
|
216
|
+
finish(live, reading.text, reading.line);
|
|
217
|
+
reading = { line: l, text };
|
|
218
|
+
}
|
|
219
|
+
else if (reading)
|
|
220
|
+
reading.text += " " + text;
|
|
221
|
+
}
|
|
222
|
+
// the command read last ends where the reading stops: finished on a copy, the reading going
|
|
223
|
+
// on from here with it still open
|
|
224
|
+
const st = { stack: live.stack.map(copyFrame), pending: live.pending && copyFrame(live.pending) };
|
|
209
225
|
if (reading)
|
|
210
|
-
finish(reading.text, reading.line);
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
reading.text += " " + text;
|
|
215
|
-
}
|
|
216
|
-
if (reading)
|
|
217
|
-
finish(reading.text, reading.line);
|
|
218
|
-
return { stack, pending };
|
|
226
|
+
finish(st, reading.text, reading.line);
|
|
227
|
+
return st;
|
|
228
|
+
},
|
|
229
|
+
};
|
|
219
230
|
}
|
|
220
|
-
/**
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
231
|
+
/** Read a file up to line `upto` (0-based, the line a declaration's text starts on): the frames in
|
|
232
|
+
* force there, and the commands written `… in` right before it. */
|
|
233
|
+
function walk(lines, upto, hasNamespace) {
|
|
234
|
+
return walker(lines, hasNamespace).to(upto);
|
|
235
|
+
}
|
|
236
|
+
/** A Scope from what is in force at a line. */
|
|
237
|
+
function scopeOf({ stack, pending }) {
|
|
224
238
|
const frames = pending ? [...stack, pending] : stack;
|
|
225
239
|
const cur = stack.map((f) => f.ns).filter(Boolean).join(".").split(".").filter(Boolean);
|
|
226
240
|
const namespaces = [];
|
|
@@ -232,6 +246,21 @@ export function scopeAt(lines, upto, hasNamespace) {
|
|
|
232
246
|
aliases.set(k, v);
|
|
233
247
|
return { namespaces, opens: [...new Set(frames.flatMap((f) => f.opens))], aliases };
|
|
234
248
|
}
|
|
249
|
+
/** The scope at each of lines `uptos` of a file (in any order), as `scopeAt` says it at each, from
|
|
250
|
+
* one reading of the file. */
|
|
251
|
+
export function scopesAt(lines, uptos, hasNamespace) {
|
|
252
|
+
const w = walker(lines, hasNamespace);
|
|
253
|
+
const out = new Array(uptos.length);
|
|
254
|
+
const order = uptos.map((_, k) => k).sort((a, b) => uptos[a] - uptos[b]);
|
|
255
|
+
for (const k of order)
|
|
256
|
+
out[k] = scopeOf(w.to(uptos[k]));
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
259
|
+
/** The scope at line `upto` of a file (the line a declaration's text starts on): what a short name
|
|
260
|
+
* written there can mean. */
|
|
261
|
+
export function scopeAt(lines, upto, hasNamespace) {
|
|
262
|
+
return scopeOf(walk(lines, upto, hasNamespace));
|
|
263
|
+
}
|
|
235
264
|
/** Everything in force at line `upto` of a file, as written: the context a declaration there is
|
|
236
265
|
* read in. */
|
|
237
266
|
export function contextAt(lines, upto, hasNamespace) {
|
package/dist/shared/sharesnap.js
CHANGED
|
@@ -105,8 +105,10 @@ export const SNAPSHOT_FORMS = {
|
|
|
105
105
|
read: (o, clean) => ("visitors" in o && clean.visitors ? { visitors: clean.visitors } : {}),
|
|
106
106
|
},
|
|
107
107
|
panel: same("sel"),
|
|
108
|
-
sources: same("source", "sourceCollapsed", "pinned"),
|
|
108
|
+
sources: same("source", "sourceCollapsed", "sourceMode", "pinned"),
|
|
109
109
|
paper: same("paper"),
|
|
110
|
+
// the InfoView's caret, in the window it is in (the owner's decision of 2026-11-01)
|
|
111
|
+
caret: same("caret"),
|
|
110
112
|
activity: same("activity"),
|
|
111
113
|
lostFound: same("lostFound"),
|
|
112
114
|
colouring: same("scheme"),
|
|
@@ -215,7 +217,7 @@ export function sortOut(v, has) {
|
|
|
215
217
|
* tells of, the declarations of the selection (`picked`), the visitors, the pinned windows — and a
|
|
216
218
|
* focus on what is no target now. */
|
|
217
219
|
export function goneNames(v, picked, has) {
|
|
218
|
-
const named = [v.sel, ...picked, ...(v.visitors ?? []).map((w) => w.decl), ...(v.pinned ?? []).
|
|
220
|
+
const named = [v.sel, ...picked, ...(v.visitors ?? []).map((w) => w.decl), ...(v.pinned ?? []).flatMap((w) => ("decl" in w ? [w.decl] : []))];
|
|
219
221
|
const decls = [...new Set(named.filter((n) => !!n && !has.decl(n)))];
|
|
220
222
|
return { decls, ...(typeof v.focus === "string" && !has.target(v.focus) ? { focus: v.focus } : {}) };
|
|
221
223
|
}
|