visualproof 0.9.0 → 0.11.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 +7 -3
- package/dist/mcp/visualproof-mcp.mjs +36 -6
- package/dist/server/agent.js +7 -1
- package/dist/server/agententry.js +29 -11
- package/dist/server/agenttalk.js +46 -4
- package/dist/server/app.js +6 -1
- package/dist/server/appagent.js +8 -2
- package/dist/server/appshare.js +27 -4
- package/dist/server/apptalk.js +56 -16
- package/dist/server/children.js +6 -2
- package/dist/server/doctor.js +8 -0
- package/dist/server/hosted.js +695 -0
- package/dist/server/live.js +56 -13
- package/dist/server/main.js +44 -0
- package/dist/server/mcptools.js +4 -2
- package/dist/server/options.js +38 -1
- package/dist/server/presence.js +2 -2
- package/dist/server/prompt.js +33 -0
- package/dist/server/serveragent.js +117 -0
- package/dist/server/talk.js +39 -3
- package/dist/server/tokens.js +17 -4
- package/dist/shared/collab.js +13 -3
- package/dist/web/bundle/app.js +266 -60
- package/dist/web/index.html +1 -0
- package/dist/web/style.css +33 -10
- package/docs/agent-api/mcp.md +4 -1
- package/docs/agent-api/talking.md +24 -0
- package/package.json +1 -1
package/dist/server/tokens.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
28
28
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
29
29
|
import { join } from "node:path";
|
|
30
|
-
import { MAX_NAME, uniqueName, validName } from "../shared/collab.js";
|
|
30
|
+
import { MAX_NAME, UNTIL_STOPPED, uniqueName, validName } from "../shared/collab.js";
|
|
31
31
|
export const TOKEN_PREFIX = "vpa_";
|
|
32
32
|
/** how long a token may last, in days; DEFAULT_DAYS (7) is the one the page offers when none is said */
|
|
33
33
|
export const TOKEN_DAYS = [1, 7, 30];
|
|
@@ -93,7 +93,9 @@ export class AgentTokens {
|
|
|
93
93
|
/** Make a token for an agent: the token (for its prompt) and its record. The name and level are
|
|
94
94
|
* checked by the caller (server/appshare.ts); the name is used as given, numbered when an agent in
|
|
95
95
|
* force has it already; `by` is a person's name, and `person` their personal link's id where an
|
|
96
|
-
* invited person makes it (`makerPerson`: who its maker is, AgentSpec decision 7).
|
|
96
|
+
* invited person makes it (`makerPerson`: who its maker is, AgentSpec decision 7). `runs: "server"`
|
|
97
|
+
* makes the token of the server's own agent (AgentSpec decision 10; `by` the server,
|
|
98
|
+
* server/serveragent.ts), which has no expiry: `days` is not read. */
|
|
97
99
|
create(o) {
|
|
98
100
|
const now = o.now ?? Date.now();
|
|
99
101
|
this.expire(now);
|
|
@@ -109,10 +111,11 @@ export class AgentTokens {
|
|
|
109
111
|
by: o.by,
|
|
110
112
|
...(o.person ? { makerPerson: o.person } : {}),
|
|
111
113
|
created: new Date(now).toISOString(),
|
|
112
|
-
expires: new Date(now + o.days * 24 * 3600 * 1000).toISOString(),
|
|
114
|
+
expires: o.runs === "server" ? UNTIL_STOPPED : new Date(now + o.days * 24 * 3600 * 1000).toISOString(),
|
|
113
115
|
revoked: null,
|
|
114
116
|
revokedBy: null,
|
|
115
117
|
lastUsed: null,
|
|
118
|
+
...(o.runs === "server" ? { runs: "server" } : {}),
|
|
116
119
|
};
|
|
117
120
|
this.records.push(record);
|
|
118
121
|
this.save();
|
|
@@ -153,6 +156,16 @@ export class AgentTokens {
|
|
|
153
156
|
get(id) {
|
|
154
157
|
return this.records.find((r) => r.id === id);
|
|
155
158
|
}
|
|
159
|
+
/** The level of the server's agent's token, which follows the server's --agents from one start to
|
|
160
|
+
* the next (server/serveragent.ts); no other token's level changes after it is made. */
|
|
161
|
+
setLevel(id, level) {
|
|
162
|
+
const r = this.records.find((x) => x.id === id);
|
|
163
|
+
if (!r || r.level === level)
|
|
164
|
+
return;
|
|
165
|
+
r.level = level;
|
|
166
|
+
this.save();
|
|
167
|
+
this.onChanged();
|
|
168
|
+
}
|
|
156
169
|
/** Revoke a token in force: it lets nothing in from now on, and its agent's wait ends. False when
|
|
157
170
|
* there is no such token in force. */
|
|
158
171
|
revoke(id, by, now = Date.now()) {
|
|
@@ -225,5 +238,5 @@ function isRecord(x) {
|
|
|
225
238
|
const r = x;
|
|
226
239
|
return !!r && typeof r === "object" && typeof r.id === "string" && ID.test(r.id) && typeof r.secret === "string" && SECRET.test(r.secret) &&
|
|
227
240
|
typeof r.name === "string" && typeof r.by === "string" && typeof r.expires === "string" && ["read", "advise", "full"].includes(r.level) &&
|
|
228
|
-
(r.makerPerson === undefined || typeof r.makerPerson === "string");
|
|
241
|
+
(r.makerPerson === undefined || typeof r.makerPerson === "string") && (r.runs === undefined || r.runs === "server");
|
|
229
242
|
}
|
package/dist/shared/collab.js
CHANGED
|
@@ -216,6 +216,9 @@ export const BOARD_SCHEMES = ["kind", "status", "mine"];
|
|
|
216
216
|
/** Activity's filters: the kind of event, and whose (web/src/activity.ts). */
|
|
217
217
|
export const ACTIVITY_KINDS = ["all", "review", "build", "change"];
|
|
218
218
|
export const ACTIVITY_WHO = ["all", "agents", "people"];
|
|
219
|
+
/** The expiry of a token that never expires: the server's own agent's (AgentSpec decision 10). Far
|
|
220
|
+
* enough to never come, and still a date every reader of `expires` can parse. */
|
|
221
|
+
export const UNTIL_STOPPED = "9999-12-31T23:59:59.000Z";
|
|
219
222
|
/** Whether `who` made the token `t` (AgentSpec decision 7): the personal link that made it, where an
|
|
220
223
|
* invited person did; else the name it was made under, as names are compared. Its private channel
|
|
221
224
|
* and its prompt are theirs alone. */
|
|
@@ -270,12 +273,19 @@ export function cleanView(v) {
|
|
|
270
273
|
const activity = av && typeof av.open === "boolean" && kind && who ? { open: av.open, kind, who, ...(typeof av.mine === "string" && validName(av.mine) ? { mine: av.mine } : {}) } : null;
|
|
271
274
|
const lost = o.lostFound && typeof o.lostFound === "object" ? o.lostFound.open : undefined;
|
|
272
275
|
const scheme = one(BOARD_SCHEMES, o.scheme);
|
|
273
|
-
// the InfoView's caret: a declaration's name, a place within any file's
|
|
276
|
+
// the InfoView's caret: a declaration's name or a file window's module, a place within any file's
|
|
277
|
+
// bounds
|
|
274
278
|
const cv = o.caret && typeof o.caret === "object" ? o.caret : null;
|
|
275
279
|
const place = (n, max) => Number.isInteger(n) && n >= 0 && n <= max;
|
|
276
280
|
const caretDecl = cv ? str(cv.decl) : null;
|
|
277
|
-
const
|
|
278
|
-
|
|
281
|
+
const caretFile = cv && !caretDecl ? str(cv.file, 300) : null;
|
|
282
|
+
const caret = cv && (caretDecl || caretFile) && place(cv.line, 10_000_000) && place(cv.character, 100_000)
|
|
283
|
+
? {
|
|
284
|
+
...(caretDecl ? { decl: caretDecl, ...(cv.pinned === true ? { pinned: true } : {}) } : { file: caretFile }),
|
|
285
|
+
line: cv.line,
|
|
286
|
+
character: cv.character,
|
|
287
|
+
...(cv.after === true ? { after: true } : {}),
|
|
288
|
+
}
|
|
279
289
|
: null;
|
|
280
290
|
const pinned = Array.isArray(o.pinned)
|
|
281
291
|
? o.pinned
|