visualproof 0.10.0 → 0.11.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.
@@ -94,8 +94,8 @@ export class AgentTokens {
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
96
  * invited person makes it (`makerPerson`: who its maker is, AgentSpec decision 7). `runs: "server"`
97
- * makes the token of an agent the server runs (AgentSpec decision 10), which lasts until revoked:
98
- * `days` is not read. */
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. */
99
99
  create(o) {
100
100
  const now = o.now ?? Date.now();
101
101
  this.expire(now);
@@ -156,6 +156,16 @@ export class AgentTokens {
156
156
  get(id) {
157
157
  return this.records.find((r) => r.id === id);
158
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
+ }
159
169
  /** Revoke a token in force: it lets nothing in from now on, and its agent's wait ends. False when
160
170
  * there is no such token in force. */
161
171
  revoke(id, by, now = Date.now()) {
@@ -216,8 +216,8 @@ 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 lasts until revoked: an agent the server runs (AgentSpec decision
220
- * 10). Far enough to never come, and still a date every reader of `expires` can parse. */
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
221
  export const UNTIL_STOPPED = "9999-12-31T23:59:59.000Z";
222
222
  /** Whether `who` made the token `t` (AgentSpec decision 7): the personal link that made it, where an
223
223
  * invited person did; else the name it was made under, as names are compared. Its private channel
@@ -273,12 +273,19 @@ export function cleanView(v) {
273
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;
274
274
  const lost = o.lostFound && typeof o.lostFound === "object" ? o.lostFound.open : undefined;
275
275
  const scheme = one(BOARD_SCHEMES, o.scheme);
276
- // the InfoView's caret: a declaration's name, a place within any file's bounds
276
+ // the InfoView's caret: a declaration's name or a file window's module, a place within any file's
277
+ // bounds
277
278
  const cv = o.caret && typeof o.caret === "object" ? o.caret : null;
278
279
  const place = (n, max) => Number.isInteger(n) && n >= 0 && n <= max;
279
280
  const caretDecl = cv ? str(cv.decl) : null;
280
- const caret = cv && caretDecl && place(cv.line, 10_000_000) && place(cv.character, 100_000)
281
- ? { decl: caretDecl, line: cv.line, character: cv.character, ...(cv.after === true ? { after: true } : {}), ...(cv.pinned === true ? { pinned: true } : {}) }
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
+ }
282
289
  : null;
283
290
  const pinned = Array.isArray(o.pinned)
284
291
  ? o.pinned