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.
@@ -224,7 +224,13 @@ function cleanView(v2) {
224
224
  const cv = o2.caret && typeof o2.caret === "object" ? o2.caret : null;
225
225
  const place2 = (n3, max) => Number.isInteger(n3) && n3 >= 0 && n3 <= max;
226
226
  const caretDecl = cv ? str2(cv.decl) : null;
227
- const caret = cv && caretDecl && place2(cv.line, 1e7) && place2(cv.character, 1e5) ? { decl: caretDecl, line: cv.line, character: cv.character, ...cv.after === true ? { after: true } : {}, ...cv.pinned === true ? { pinned: true } : {} } : null;
227
+ const caretFile = cv && !caretDecl ? str2(cv.file, 300) : null;
228
+ const caret = cv && (caretDecl || caretFile) && place2(cv.line, 1e7) && place2(cv.character, 1e5) ? {
229
+ ...caretDecl ? { decl: caretDecl, ...cv.pinned === true ? { pinned: true } : {} } : { file: caretFile },
230
+ line: cv.line,
231
+ character: cv.character,
232
+ ...cv.after === true ? { after: true } : {}
233
+ } : null;
228
234
  const pinned = Array.isArray(o2.pinned) ? o2.pinned.slice(0, MAX_PINNED).map((w2) => {
229
235
  const x2 = w2 && typeof w2 === "object" ? w2 : null;
230
236
  const decl = x2 ? str2(x2.decl) : null, file = x2 && !decl ? str2(x2.file, 300) : null;
@@ -5340,8 +5346,6 @@ function snapshotSource(info2) {
5340
5346
  shareAgent: async () => ({ error: "a snapshot has no server to share with an agent" }),
5341
5347
  agentPrompt: async () => ({ error: "a snapshot has no server" }),
5342
5348
  revokeAgent: async () => ({ error: "a snapshot has no server" }),
5343
- giveClaude: async () => ({ error: "a snapshot has no server" }),
5344
- removeClaude: async () => ({ error: "a snapshot has no server" }),
5345
5349
  stopAgent: async () => ({ error: "a snapshot has no server" }),
5346
5350
  setIdentity: async () => ({ error: "a snapshot has no server" }),
5347
5351
  invites: async () => null,
@@ -5434,13 +5438,10 @@ function serverSource() {
5434
5438
  updates: () => fetch("/api/updates").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2 && typeof b2.running === "string" ? b2 : null).catch(() => null),
5435
5439
  tipClips: () => fetch("/tips/index.json").then((r2) => r2.ok ? r2.json() : null).then((b2) => new Set(Array.isArray(b2?.clips) ? b2.clips.filter((c3) => typeof c3 === "string") : [])).catch(() => /* @__PURE__ */ new Set()),
5436
5440
  tourJson: () => fetch("/tips/tour.json").then((r2) => r2.ok ? r2.json() : null).catch(() => null),
5437
- // with the reader's name: whether they gave a Claude token is told under it
5438
5441
  agentShares: () => fetch("/api/share/agents", { headers: headers() }).then((r2) => r2.ok ? r2.json() : null).catch(() => null),
5439
5442
  shareAgent: (body) => fetch("/api/share/agents", { method: "POST", headers: headers(), body: JSON.stringify(body) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5440
5443
  agentPrompt: (id) => fetch("/api/share/agents/prompt", { method: "POST", headers: headers(), body: JSON.stringify({ id }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5441
5444
  revokeAgent: (id) => fetch("/api/share/agents/revoke", { method: "POST", headers: headers(), body: JSON.stringify({ id }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5442
- giveClaude: (token) => fetch("/api/share/claude", { method: "POST", headers: headers(), body: JSON.stringify({ token }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5443
- removeClaude: () => fetch("/api/share/claude/remove", { method: "POST", headers: headers(), body: "{}" }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5444
5445
  stopAgent: (agent) => fetch("/api/chat/stop", { method: "POST", headers: headers(), body: JSON.stringify({ agent }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
5445
5446
  chat: (channel, before) => fetch(`/api/chat?channel=${encodeURIComponent(channel)}${before ? `&before=${before}` : ""}`, { headers: headers() }).then((r2) => r2.ok ? r2.json() : null).catch(() => null),
5446
5447
  // a private reader's message says who wrote it, not where they are (CollabSpec decision 8)
@@ -6345,7 +6346,7 @@ var FocusMenu = class {
6345
6346
  };
6346
6347
 
6347
6348
  // src/web/src/reload.ts
6348
- var PAGE_VERSION = true ? "0.10.0" : null;
6349
+ var PAGE_VERSION = true ? "0.11.1" : null;
6349
6350
  var KEY = "visualproof:reload";
6350
6351
  var FOR_KEY = "visualproof:reloaded-for";
6351
6352
  var FRESH_MS = 10 * 6e4;
@@ -9927,6 +9928,9 @@ var Talk = class {
9927
9928
  restarting = false;
9928
9929
  /** the conversations before the last divider are shown, not folded into one line */
9929
9930
  unfolded = false;
9931
+ /** the server's own agent's state in the reader's conversation with it, by its id: what its tab
9932
+ * shows in place of the state presence lists */
9933
+ sessions = /* @__PURE__ */ new Map();
9930
9934
  /** the page may read the conversations: a name given, and not a read-only reader's */
9931
9935
  named = false;
9932
9936
  /** counts the seconds of a thinking agent */
@@ -10002,9 +10006,10 @@ var Talk = class {
10002
10006
  for (const [k2, v2] of kept) if (!this.drafts.has(k2)) this.drafts.set(k2, v2);
10003
10007
  }
10004
10008
  // ---------------------------------------------------------------- the channels
10005
- /** The reader's own agents, as presence lists them: those whose token they made. */
10009
+ /** The reader's own agents, as presence lists them: those whose token they made, and the server's
10010
+ * own agent, in its state in the reader's conversation with it. */
10006
10011
  own() {
10007
- return ownAgents(this.hooks.peers(), this.hooks.me());
10012
+ return ownAgents(this.hooks.peers(), this.hooks.me()).map((p2) => p2.runs === "server" && this.sessions.has(p2.id) ? { ...p2, talk: this.sessions.get(p2.id) } : p2);
10008
10013
  }
10009
10014
  /** The channels the reader has: Everyone, then each of their own agents. */
10010
10015
  channels() {
@@ -10046,6 +10051,7 @@ var Talk = class {
10046
10051
  * (what came while it was away), and what the reader may read is known again. */
10047
10052
  connected() {
10048
10053
  this.read.clear();
10054
+ this.sessions.clear();
10049
10055
  this.identity();
10050
10056
  }
10051
10057
  /** Who the reader is changed (a name given or changed, a personal link): what they may read. */
@@ -10055,6 +10061,7 @@ var Talk = class {
10055
10061
  if (!named2) this.threads.clear();
10056
10062
  this.named = named2;
10057
10063
  this.read.clear();
10064
+ this.sessions.clear();
10058
10065
  this.render();
10059
10066
  this.count();
10060
10067
  if (!named2) return;
@@ -10068,7 +10075,7 @@ var Talk = class {
10068
10075
  this.renderTabs();
10069
10076
  this.renderState();
10070
10077
  this.renderForm(false);
10071
- const read2 = this.hooks.peers().flatMap((p2) => p2.agent && p2.talk ? [`${p2.id}:${p2.talk.read}:${p2.talk.readPublic}`] : []).join(" ");
10078
+ const read2 = [...this.hooks.peers().flatMap((p2) => p2.agent && p2.talk ? [`${p2.id}:${p2.talk.read}:${p2.talk.readPublic}`] : []), ...[...this.sessions].map(([id, t2]) => `${id}:s${t2.read}`)].join(" ");
10072
10079
  if (read2 !== this.readSig) {
10073
10080
  this.readSig = read2;
10074
10081
  const el = this.thread();
@@ -10084,8 +10091,14 @@ var Talk = class {
10084
10091
  }
10085
10092
  this.count();
10086
10093
  }
10087
- /** Stop the answer an agent the server runs is giving (AgentSpec decision 10): its maker's, as
10088
- * Esc in a terminal is for an agent run there. */
10094
+ /** The server's own agent's state in the reader's conversation with it changed (the event stream's
10095
+ * `chat-state`, to this reader's pages alone). */
10096
+ sessionState(channel, talk) {
10097
+ this.sessions.set(channel, talk);
10098
+ this.peersChanged();
10099
+ }
10100
+ /** Stop the answer the server's own agent is giving in the reader's conversation with it (AgentSpec
10101
+ * decision 10), as Esc in a terminal is for an agent run there. */
10089
10102
  async stopTurn() {
10090
10103
  const a3 = this.agentOf(this.channel);
10091
10104
  if (!a3 || a3.runs !== "server") return;
@@ -10104,6 +10117,10 @@ var Talk = class {
10104
10117
  } else {
10105
10118
  this.read.add(channel);
10106
10119
  this.threads.set(channel, merge(r2.messages, this.threads.get(channel) ?? []));
10120
+ if (r2.agent && r2.agent.runs === "server") {
10121
+ this.sessions.set(channel, r2.agent.talk);
10122
+ this.renderState();
10123
+ }
10107
10124
  }
10108
10125
  if (channel === this.channel) {
10109
10126
  this.renderThread();
@@ -10161,7 +10178,8 @@ var Talk = class {
10161
10178
  /** The button's count and mark, from what is unseen. */
10162
10179
  count() {
10163
10180
  if (!this.named) return this.hooks.counted(0, false);
10164
- const u2 = unseen(this.threads, this.hooks.store.data.chatSeen ?? {}, this.hooks.me().name, this.own().map((p2) => p2.id));
10181
+ const own2 = this.own();
10182
+ const u2 = unseen(this.threads, this.hooks.store.data.chatSeen ?? {}, this.hooks.me().name, own2.map((p2) => p2.id), own2.filter((p2) => p2.runs === "server").map((p2) => p2.id));
10165
10183
  this.hooks.counted(u2.count, u2.marked);
10166
10184
  }
10167
10185
  /** The window opened, or opened again from its pill: the thread shows where it ends. */
@@ -10283,7 +10301,8 @@ var Talk = class {
10283
10301
  for (const a3 of this.own()) {
10284
10302
  const t2 = a3.talk;
10285
10303
  const news = (this.threads.get(a3.id) ?? []).some((m3) => m3.kind === "agent" && m3.id > (seen[a3.id] ?? 0));
10286
- html += tab(a3.id, `<span class="st-dot${t2 ? ` st-${t2.state}` : ""}"></span>${BOT}<span class="cv-tn">${escapeHtml(a3.name ?? "")}</span>${news && a3.id !== this.channel ? '<span class="cv-dot" aria-label="new"></span>' : ""}`, `Your agent ${a3.name ?? ""}: ${t2 ? stateWords(t2) : ""} \u2014 between the two of you alone`);
10304
+ const who = a3.runs === "server" ? `${a3.name ?? ""}, this server's agent` : `Your agent ${a3.name ?? ""}`;
10305
+ html += tab(a3.id, `<span class="st-dot${t2 ? ` st-${t2.state}` : ""}"></span>${BOT}<span class="cv-tn">${escapeHtml(a3.name ?? "")}</span>${news && a3.id !== this.channel ? '<span class="cv-dot" aria-label="new"></span>' : ""}`, `${who}: ${t2 ? stateWords(t2) : ""} \u2014 between the two of you alone`);
10287
10306
  }
10288
10307
  if (box.innerHTML !== html) box.innerHTML = html;
10289
10308
  }
@@ -10298,7 +10317,7 @@ var Talk = class {
10298
10317
  const messages = this.threads.get(this.channel) ?? [];
10299
10318
  const a3 = this.agentOf(this.channel);
10300
10319
  if (!messages.length) {
10301
- el.innerHTML = `<div class="tk-empty muted">${this.loading.has(this.channel) ? "Reading the conversation\u2026" : a3 ? `No messages yet. What you write here goes to ${escapeHtml(a3.name ?? "your agent")}, and nobody else sees it.` : "No messages yet. What you write here everyone with a name on this page sees, and every agent can read; @ and a name hands it to an agent."}</div>`;
10320
+ el.innerHTML = `<div class="tk-empty muted">${this.loading.has(this.channel) ? "Reading the conversation\u2026" : a3 ? a3.runs === "server" ? `No messages yet. What you write here goes to ${escapeHtml(a3.name ?? "the agent")}, and nobody else sees it: it runs on this server, and everyone has a conversation of their own with it.` : `No messages yet. What you write here goes to ${escapeHtml(a3.name ?? "your agent")}, and nobody else sees it.` : "No messages yet. What you write here everyone with a name on this page sees, and every agent can read; @ and a name hands it to an agent."}</div>`;
10302
10321
  return;
10303
10322
  }
10304
10323
  const f2 = fold(messages);
@@ -10368,7 +10387,7 @@ var Talk = class {
10368
10387
  const t2 = a3?.talk;
10369
10388
  const off = !this.named || !!a3 && (!t2 || t2.state === "offline");
10370
10389
  const who = a3?.name ?? "the agent";
10371
- const placeholder = !this.named ? "Give your name to write here" : !a3 ? "Write to everyone" : off ? `${who} is offline${t2?.lastSeen ? ` \u2014 last seen ${ago(t2.lastSeen)}` : ""}` : t2.state === "listening" ? `Write to ${who}` : `Write to ${who} \xB7 it reads this when it next listens`;
10390
+ const placeholder = !this.named ? "Give your name to write here" : !a3 ? "Write to everyone" : off ? `${who} is offline${t2?.lastSeen ? ` \u2014 last seen ${ago(t2.lastSeen)}` : ""}` : t2.state === "listening" ? `Write to ${who}` : a3.runs === "server" ? `Write to ${who} \xB7 it reads this in its next turn` : `Write to ${who} \xB7 it reads this when it next listens`;
10372
10391
  const box = this.input.el;
10373
10392
  const was = box.dataset.channel;
10374
10393
  this.input.enable(!off, placeholder);
@@ -10388,14 +10407,14 @@ var Talk = class {
10388
10407
  const b2 = this.el.querySelector("[data-cv-new]");
10389
10408
  const a3 = this.named ? this.agentOf(this.channel) : null;
10390
10409
  const stop = this.el.querySelector("[data-cv-stop]");
10391
- if (stop) stop.hidden = !(a3 && a3.runs === "server" && (a3.talk?.state === "thinking" || a3.talk?.state === "working"));
10410
+ if (stop) stop.hidden = !(a3 && a3.runs === "server" && !a3.talk?.queued && (a3.talk?.state === "thinking" || a3.talk?.state === "working"));
10392
10411
  if (!b2) return;
10393
10412
  b2.hidden = !a3;
10394
10413
  if (!a3) return;
10395
10414
  const t2 = this.threads.get(this.channel) ?? [];
10396
10415
  const off = this.loading.has(this.channel) || this.restarting || fresh2(t2);
10397
10416
  b2.setAttribute("aria-disabled", String(off));
10398
- b2.title = fresh2(t2) ? "A new conversation already: nothing was said since it began" : a3.runs === "server" ? `New conversation: what was said so far folds away, and ${a3.name ?? "the agent"} starts a new session without it (it runs on this server).` : `New conversation: what was said so far folds away, and the next session of ${a3.name ?? "the agent"} starts without it. A session running now is told to disregard it, but keeps what it was told: only /clear in its own terminal erases that.`;
10417
+ b2.title = fresh2(t2) ? "A new conversation already: nothing was said since it began" : a3.runs === "server" ? `New conversation: what was said so far folds away, and ${a3.name ?? "the agent"} starts a new session of your conversation without it (it runs on this server; nobody else's changes).` : `New conversation: what was said so far folds away, and the next session of ${a3.name ?? "the agent"} starts without it. A session running now is told to disregard it, but keeps what it was told: only /clear in its own terminal erases that.`;
10399
10418
  }
10400
10419
  /** The pill the window collapses to: the channel on show and the start of its last message. */
10401
10420
  renderPill() {
@@ -10404,7 +10423,7 @@ var Talk = class {
10404
10423
  const a3 = this.agentOf(this.channel);
10405
10424
  const t2 = a3?.talk;
10406
10425
  const last2 = (this.threads.get(this.channel) ?? []).findLast((m3) => m3.kind !== "divider");
10407
- const state = !t2 ? "" : t2.state === "thinking" ? `thinking \xB7 ${elapsed(t2.since)}` : t2.state;
10426
+ const state = !t2 ? "" : t2.queued ? "waiting its turn" : t2.state === "thinking" ? `thinking \xB7 ${elapsed(t2.since)}` : t2.state;
10408
10427
  el.innerHTML = (a3 ? `<span class="st-dot${t2 ? ` st-${t2.state}` : ""}"></span>${BOT}<b>${escapeHtml(a3.name ?? "")}</b><span class="fl-pill-state">${escapeHtml(state)}</span>` : `<b>Everyone</b>`) + (last2 ? `<span class="fl-pill-msg">${escapeHtml(`${last2.from}: ${excerpt(last2.text)}`)}</span>` : "");
10409
10428
  el.parentElement?.setAttribute("title", `${t2 ? `${stateWords(t2)}. ` : ""}Open the conversations`);
10410
10429
  }
@@ -10421,14 +10440,16 @@ function chipInner(c3) {
10421
10440
  return `${LINK}<span class="cv-cl">${words}${name}${c3.more ? ` +${c3.more}` : ""}</span>`;
10422
10441
  }
10423
10442
  function ownAgents(peers, me) {
10424
- return peers.filter((p2) => p2.agent && p2.talk && p2.by !== void 0 && madeBy({ by: p2.by, makerPerson: p2.byPerson }, me));
10443
+ return peers.filter((p2) => p2.agent && p2.talk && (p2.runs === "server" ? me.name !== null || me.person !== null : p2.by !== void 0 && madeBy({ by: p2.by, makerPerson: p2.byPerson }, me)));
10425
10444
  }
10426
- function unseen(threads, seen, me, agents) {
10445
+ function unseen(threads, seen, me, agents, shared = []) {
10427
10446
  let count2 = 0;
10428
10447
  let marked2 = false;
10429
10448
  const mine = (m3) => m3.kind !== "agent" && me !== null && sameName(m3.from, me);
10430
10449
  const ownNames = /* @__PURE__ */ new Set();
10431
- for (const id of agents) for (const m3 of threads.get(id) ?? []) if (m3.kind === "agent") ownNames.add(m3.from);
10450
+ for (const id of agents) if (!shared.includes(id)) {
10451
+ for (const m3 of threads.get(id) ?? []) if (m3.kind === "agent") ownNames.add(m3.from);
10452
+ }
10432
10453
  for (const m3 of threads.get(PUBLIC) ?? []) {
10433
10454
  if (m3.id <= (seen[PUBLIC] ?? 0) || m3.kind === "divider" || mine(m3)) continue;
10434
10455
  count2++;
@@ -10478,7 +10499,7 @@ function elapsed(iso, now = Date.now()) {
10478
10499
  return m3 < 60 ? `${m3} min` : `${Math.floor(m3 / 60)} h${m3 % 60 ? ` ${m3 % 60} min` : ""}`;
10479
10500
  }
10480
10501
  function stateLine(t2, resolve, now = Date.now()) {
10481
- const parts = [t2.state];
10502
+ const parts = [t2.queued ? "waiting its turn" : t2.state];
10482
10503
  if (t2.state === "thinking") parts.push(elapsed(t2.since, now));
10483
10504
  const what = t2.status ?? t2.doing;
10484
10505
  const busy = t2.state === "thinking" || t2.state === "working";
@@ -10493,6 +10514,7 @@ function stateWords(t2, now = Date.now()) {
10493
10514
  case "listening":
10494
10515
  return "listening: what you write reaches it at once";
10495
10516
  case "thinking":
10517
+ if (t2.queued) return `waiting its turn for ${elapsed(t2.since, now)}: other conversations' answers take all there is for now`;
10496
10518
  return `thinking for ${elapsed(t2.since, now)}${what ? `: ${what}` : ""}`;
10497
10519
  case "working":
10498
10520
  return `working${what ? `: ${what}` : ""}; what you write waits for its next wait`;
@@ -10535,9 +10557,7 @@ var Share = class {
10535
10557
  people = null;
10536
10558
  /** the form as the reader left it: kept while the page is open; the name is null while the reader
10537
10559
  * has not written one, and the agent is then theirs ("Alice's AI") */
10538
- form = { name: null, level: "", days: 0, runs: null, claude: "" };
10539
- /** the reader asked to give their Claude token anew (Replace) */
10540
- claudeEdit = false;
10560
+ form = { name: null, level: "", days: 0 };
10541
10561
  /** a Revoke pressed once, waiting for the second press */
10542
10562
  arming = null;
10543
10563
  busy = false;
@@ -10571,12 +10591,11 @@ var Share = class {
10571
10591
  else if (t2.closest("[data-again]")) {
10572
10592
  this.agent = { kind: "form", error: null };
10573
10593
  this.render();
10574
- } else if (t2.closest("[data-claude-replace]")) {
10575
- this.claudeEdit = true;
10576
- this.render();
10577
- this.pop.querySelector("[data-f=claude]")?.focus();
10578
- } else if (t2.closest("[data-claude-remove]")) void this.removeClaude();
10579
- else if (t2.closest("[data-show]")) void this.showPrompt(t2.closest("[data-show]").dataset.show);
10594
+ } else if (t2.closest("[data-talk-server]")) {
10595
+ const id = this.shares?.server?.id;
10596
+ this.close();
10597
+ if (id) this.hooks.talk?.(id);
10598
+ } else if (t2.closest("[data-show]")) void this.showPrompt(t2.closest("[data-show]").dataset.show);
10580
10599
  else if (t2.closest("[data-revoke]")) void this.revoke(t2.closest("[data-revoke]").dataset.revoke);
10581
10600
  else if (t2.closest("[data-close]")) this.close();
10582
10601
  });
@@ -10586,11 +10605,7 @@ var Share = class {
10586
10605
  const f2 = t2.dataset.f;
10587
10606
  if (!f2) return;
10588
10607
  if (f2 === "days") this.form.days = Number(t2.value);
10589
- else if (f2 === "runs") {
10590
- this.form.runs = t2.value === "server" ? "server" : "agent";
10591
- this.render();
10592
- return void this.pop.querySelector("[data-f=runs]")?.focus();
10593
- } else this.form[f2] = t2.value;
10608
+ else this.form[f2] = t2.value;
10594
10609
  const as = this.pop.querySelector("[data-as]");
10595
10610
  if (f2 === "name" && as) as.textContent = this.actsAs(t2.value);
10596
10611
  });
@@ -10852,10 +10867,6 @@ var Share = class {
10852
10867
  }
10853
10868
  agentBody() {
10854
10869
  const s2 = this.shares;
10855
- if (this.agent.kind === "started") {
10856
- const a3 = this.agent;
10857
- return `<div class="sh-title">${escapeHtml(a3.name)} runs on this server</div><div class="sh-note">It listens now, on your Claude Code: talk to it in its conversation (its name, above the board), or mention <b>@${escapeHtml(a3.name)}</b> in the public channel. It runs until revoked, below.</div><div class="modal-actions"><button class="rv-btn" data-again>Another agent</button><button class="rv-btn primary" data-close>Done</button></div>`;
10858
- }
10859
10870
  if (this.agent.kind === "prompt") {
10860
10871
  const a3 = this.agent;
10861
10872
  const how = a3.made ? `Paste it into the agent. <b>It holds the agent's token</b>: give it to that agent only, and revoke it below when done.` : `<b>It holds the agent's token</b>: give it to that agent only.`;
@@ -10865,34 +10876,17 @@ var Share = class {
10865
10876
  const f2 = this.form;
10866
10877
  const me = this.hooks.me();
10867
10878
  const name = f2.name ?? (me ? defaultAgentName(me) : "");
10868
- const option = (v2, label, on, off = "") => `<option value="${v2}"${on ? " selected" : ""}${off ? ` disabled title="${escapeHtml(off)}"` : ""}>${escapeHtml(label)}</option>`;
10869
- const here = this.runsHere();
10870
- const sv = s2.server;
10871
- return `<div class="sh-form"><label class="sh-field"><span>Name</span><input data-f="name" maxlength="60" spellcheck="false" value="${escapeHtml(name)}" placeholder="Your name's AI"></label><label class="sh-field"><span>May</span><select data-f="level">${s2.levels.map((l2) => option(l2, LEVEL_HINT[l2] ?? l2, l2 === f2.level)).join("")}</select></label>` + (sv ? `<label class="sh-field"><span>Runs</span><select data-f="runs">${option("agent", "in your agent \u2014 a prompt to paste", !here)}${option("server", "on this server \u2014 your Claude Code", here, sv.available ? sv.refused ?? "" : "Claude Code is not on this server's machine")}</select></label>` : "") + (here ? "" : `<label class="sh-field"><span>For</span><select data-f="days">${s2.days.map((d2) => option(d2, d2 === 1 ? "1 day" : `${d2} days`, d2 === f2.days)).join("")}</select></label>`) + (here ? this.claudeField() : "") + `</div><div class="sh-note muted">Its own token, under your name: it acts as <i data-as>${escapeHtml(this.actsAs(name))}</i>${here ? ", here until revoked" : ""}.${s2.levels.length < 3 ? ` This server lets agents do at most ${escapeHtml(s2.level)}.` : ""}</div>` + (sv && f2.runs === "server" && sv.refused ? `<div class="modal-err">${escapeHtml(sv.refused)}</div>` : "") + (this.agent.error ? `<div class="modal-err">${escapeHtml(this.agent.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-create${this.busy ? " disabled" : ""}>${here ? "Start" : "Create"}</button></div>`;
10872
- }
10873
- /** Whether the agent is to run on this server (AgentSpec decision 10): as the reader chose; else
10874
- * where they may and have given a Claude token in use, there; else a prompt. */
10875
- runsHere() {
10876
- const sv = this.shares?.server;
10877
- if (!sv || !sv.available || sv.refused) return false;
10878
- if (this.form.runs) return this.form.runs === "server";
10879
- return !!sv.token && !sv.token.refused;
10880
- }
10881
- /** The reader's Claude Code token, for the agent on this server: given (Replace, Remove), refused,
10882
- * or none yet — a password field, never filled back. */
10883
- claudeField() {
10884
- const t2 = this.shares?.server?.token ?? null;
10885
- if (t2 && !t2.refused && !this.claudeEdit)
10886
- return `<div class="sh-note">On your Claude Code token, given ${escapeHtml(ago(t2.given))}. <button class="rv-btn sh-act" data-claude-replace title="Give a new one: the agents you run here use it from their next answer">Replace</button> <button class="rv-btn sh-act" data-claude-remove title="This server forgets it, and your agents here stop">Remove</button></div>`;
10887
- return `<label class="sh-field"><span>Claude token</span><input type="password" data-f="claude" autocomplete="off" spellcheck="false" placeholder="sk-ant-oat01-\u2026" value="${escapeHtml(this.form.claude)}"></label><div class="sh-note muted">${t2?.refused ? `<b>Claude Code refused your token</b> ${escapeHtml(ago(t2.refused))}: give a new one. ` : ""}In a terminal: <code>claude setup-token</code>, then paste what it prints. Kept on this server for your agents only, never shown again. Every answer spends your Claude usage, whoever asks (experimental).</div>`;
10888
- }
10889
- /** Remove the reader's Claude token: the server forgets it, and their agents here stop. */
10890
- async removeClaude() {
10891
- if (!await this.hooks.ensureName()) return;
10892
- const r2 = await this.hooks.data.removeClaude();
10893
- if (r2.error) this.agent = { kind: "form", error: r2.error };
10894
- await this.refresh();
10895
- this.render();
10879
+ const option = (v2, label, on) => `<option value="${v2}"${on ? " selected" : ""}>${escapeHtml(label)}</option>`;
10880
+ return this.serverAgent() + `<div class="sh-form"><label class="sh-field"><span>Name</span><input data-f="name" maxlength="60" spellcheck="false" value="${escapeHtml(name)}" placeholder="Your name's AI"></label><label class="sh-field"><span>May</span><select data-f="level">${s2.levels.map((l2) => option(l2, LEVEL_HINT[l2] ?? l2, l2 === f2.level)).join("")}</select></label><label class="sh-field"><span>For</span><select data-f="days">${s2.days.map((d2) => option(d2, d2 === 1 ? "1 day" : `${d2} days`, d2 === f2.days)).join("")}</select></label></div><div class="sh-note muted">Its own token, under your name: it acts as <i data-as>${escapeHtml(this.actsAs(name))}</i>.${s2.levels.length < 3 ? ` This server lets agents do at most ${escapeHtml(s2.level)}.` : ""}</div>` + (this.agent.error ? `<div class="modal-err">${escapeHtml(this.agent.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-create${this.busy ? " disabled" : ""}>Create</button></div>`;
10881
+ }
10882
+ /** The server's own agent, where it runs one (AgentSpec decision 10): who it is, that the reader
10883
+ * talks with it in a conversation of their own, and that it stops with the server; offline, why.
10884
+ * A read-only reader has no conversations: they are not told how to talk with it. */
10885
+ serverAgent() {
10886
+ const a3 = this.shares?.server;
10887
+ if (!a3) return "";
10888
+ const name = escapeHtml(a3.name);
10889
+ return `<div class="sh-here"><div class="sh-here-head">${BOT}<b>${name}</b> <span class="sh-lvl">${escapeHtml(a3.level)}</span> <span class="sh-lvl">on this server</span></div><div class="sh-note">${a3.offline ? `It is offline: ${escapeHtml(a3.offline)}. The server's operator can fix it and restart the server.` : `It runs on this server, on its operator's Claude Code, and everyone with a name talks with it: you in a conversation of your own, which nobody else reads, and anyone by <b>@${name}</b> in Everyone. It stops with the server.`}</div>` + (a3.offline || !this.hooks.talk ? "" : `<div class="modal-actions"><button class="rv-btn" data-talk-server>Talk with ${name}</button></div>`) + `</div><div class="sh-sub">An agent of yours</div>`;
10896
10890
  }
10897
10891
  /** The name an agent named `name` would act under: the reader's AI when the field is empty,
10898
10892
  * numbered when one in force has it. */
@@ -10913,10 +10907,9 @@ var Share = class {
10913
10907
  const armed = this.arming === t2.id;
10914
10908
  const shown2 = this.agent.kind === "prompt" && this.agent.id === t2.id && this.tab === "agent";
10915
10909
  const id = escapeHtml(t2.id);
10916
- const mine = madeBy(t2, { name: this.hooks.me(), person: this.hooks.person?.() ?? null });
10917
10910
  const here = t2.runs === "server";
10918
- const prompt = mine && !here;
10919
- return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text"${prompt ? ` data-show="${id}" title="Show its prompt again"` : here ? ` title="It runs on this server, on ${escapeHtml(t2.by)}'s Claude Code"` : ` title="Its prompt is shown again to ${escapeHtml(t2.by)} alone, who made it"`}><div>${BOT}<b>${escapeHtml(t2.name)}</b> <span class="sh-lvl">${escapeHtml(t2.level)}</span>${here ? ` <span class="sh-lvl">on this server</span>` : ""}</div><div class="muted">by ${escapeHtml(t2.by)}, ${escapeHtml(ago(t2.created))} \xB7 ${here ? "until revoked" : `expires ${escapeHtml(until(t2.expires))}`} \xB7 ${t2.lastUsed ? `last used ${escapeHtml(ago(t2.lastUsed))}` : "not used yet"}</div></div>` + (prompt ? `<button class="rv-btn sh-act" data-show="${id}" aria-pressed="${shown2}" title="Its prompt, with the token, to give the agent again">Show prompt</button>` : "") + `<button class="rv-btn sh-act${armed ? " bad" : ""}" data-revoke="${id}" title="It lets the agent in no more, at once">${armed ? "Revoke it" : "Revoke"}</button></div>`;
10911
+ const mine = !here && madeBy(t2, { name: this.hooks.me(), person: this.hooks.person?.() ?? null });
10912
+ return `<div class="sh-tok${shown2 ? " on" : ""}${here ? " sh-own" : ""}"><div class="sh-tok-text"${mine ? ` data-show="${id}" title="Show its prompt again"` : here ? ` title="The server's own agent: it stops with the server"` : ` title="Its prompt is shown again to ${escapeHtml(t2.by)} alone, who made it"`}><div>${BOT}<b>${escapeHtml(t2.name)}</b> <span class="sh-lvl">${escapeHtml(t2.level)}</span>${here ? ` <span class="sh-lvl">on this server</span>` : ""}</div><div class="muted">${here ? "the server's own \xB7 until the server stops" : `by ${escapeHtml(t2.by)}, ${escapeHtml(ago(t2.created))} \xB7 expires ${escapeHtml(until(t2.expires))}`} \xB7 ${t2.lastUsed ? `last used ${escapeHtml(ago(t2.lastUsed))}` : "not used yet"}</div></div>` + (mine ? `<button class="rv-btn sh-act" data-show="${id}" aria-pressed="${shown2}" title="Its prompt, with the token, to give the agent again">Show prompt</button>` : "") + (here ? "" : `<button class="rv-btn sh-act${armed ? " bad" : ""}" data-revoke="${id}" title="It lets the agent in no more, at once">${armed ? "Revoke it" : "Revoke"}</button>`) + `</div>`;
10920
10913
  }
10921
10914
  /** Make the token and its prompt, under the reader's name (asked for if there is none). */
10922
10915
  async create() {
@@ -10929,29 +10922,13 @@ var Share = class {
10929
10922
  this.busy = true;
10930
10923
  this.render();
10931
10924
  const f2 = this.form;
10932
- const here = this.runsHere();
10933
- if (here && f2.claude.trim()) {
10934
- const g2 = await this.hooks.data.giveClaude(f2.claude.trim());
10935
- if ("error" in g2) {
10936
- this.busy = false;
10937
- this.agent = { kind: "form", error: g2.error };
10938
- return this.render();
10939
- }
10940
- f2.claude = "";
10941
- this.claudeEdit = false;
10942
- if (this.shares?.server) this.shares.server.token = g2.token;
10943
- }
10944
- const r2 = await this.hooks.data.shareAgent({ name: f2.name?.trim() || void 0, level: f2.level, days: f2.days, ...here ? { runs: "server" } : {} });
10925
+ const r2 = await this.hooks.data.shareAgent({ name: f2.name?.trim() || void 0, level: f2.level, days: f2.days });
10945
10926
  this.busy = false;
10946
10927
  if ("error" in r2) {
10947
10928
  this.agent = { kind: "form", error: r2.error };
10948
10929
  return this.render();
10949
10930
  }
10950
10931
  if (this.shares) this.shares.tokens = r2.tokens;
10951
- if (r2.prompt === void 0) {
10952
- this.agent = { kind: "started", id: r2.token.id, name: r2.token.name };
10953
- return this.render();
10954
- }
10955
10932
  const copied = await copy(r2.prompt);
10956
10933
  this.agent = { kind: "prompt", id: r2.token.id, prompt: r2.prompt, name: r2.token.name, made: true, copied };
10957
10934
  this.showArea();
@@ -11588,7 +11565,7 @@ var FOLLOWED = [
11588
11565
  }
11589
11566
  ];
11590
11567
  var YOURS = [
11591
- { id: "windowPlaces", what: "where windows sit and how big they are (a drag on a title bar presses no control; the edges resize)", where: ".fl-rz" },
11568
+ { id: "windowPlaces", what: "where windows sit, how big they are and which is in front (a drag on a title bar presses no control; the edges resize; a press in a window brings it in front)", where: ".fl-rz" },
11592
11569
  { id: "scroll", what: "scroll positions: the wheel off the canvas, a scrollbar" },
11593
11570
  { id: "sections", what: "folded sections of the side panel, the panel and the lost-and-found", where: "[data-sec], #lostfound .lf-archived > summary" },
11594
11571
  { id: "tcbOrder", what: "the TCB list's order, and what of it is kept to by the reader's own review", where: "[data-tcb-order], [data-q-own]" },
@@ -12341,7 +12318,7 @@ var People = class {
12341
12318
  const s2 = p2.sessions[0];
12342
12319
  const where = s2.view ? this.hooks.describe(s2.view) : "";
12343
12320
  const who = p2.name ? this.nameOf(p2) : "A reader without a name";
12344
- const talk = s2.talk ? `${s2.runs === "server" ? ` \xB7 on this server, ${s2.by ?? "its maker"}'s Claude Code` : ""} \xB7 ${stateWords(s2.talk)}` : "";
12321
+ const talk = s2.talk ? `${s2.runs === "server" ? " \xB7 this server's agent, which everyone talks with" : ""} \xB7 ${stateWords(s2.talk)}` : "";
12345
12322
  const ask = p2.agent ? null : this.hooks.asked?.(p2) ?? null;
12346
12323
  const does = !this.hooks.menu ? "click to follow" : p2.agent ? `click to follow${s2.talk ? " or talk with it" : " it"}` : "click to follow, or to ask them to follow you";
12347
12324
  const fol = following.has(p2.key);
@@ -15569,16 +15546,43 @@ function sectionHead(id, shut, title, aside = "") {
15569
15546
  var TargetList = class {
15570
15547
  el;
15571
15548
  hooks;
15549
+ /** the gone target whose Unmark was pressed once, waiting for the second press */
15550
+ arming = null;
15551
+ /** an Unmark under way, and why the last one was refused */
15552
+ busy = null;
15553
+ refused = null;
15572
15554
  constructor(el, hooks) {
15573
15555
  this.el = el;
15574
15556
  this.hooks = hooks;
15575
15557
  el.addEventListener("click", (e2) => {
15576
15558
  const t2 = e2.target;
15559
+ const unmark = t2.closest("[data-unmark]");
15560
+ if (unmark) return void this.unmark(unmark.dataset.unmark);
15561
+ if (this.arming !== null) {
15562
+ this.arming = null;
15563
+ this.render();
15564
+ }
15577
15565
  if (t2.closest("[data-sec]")) return this.hooks.toggle("targets");
15578
15566
  const row = t2.closest("[data-target]");
15579
15567
  if (row) this.hooks.open(row.dataset.open ?? null, row.dataset.target);
15580
15568
  });
15581
15569
  }
15570
+ /** Unmark pressed on a gone target's row: the first press arms it, the second takes it off. */
15571
+ async unmark(target) {
15572
+ if (!this.hooks.unmark || this.busy !== null) return;
15573
+ if (this.arming !== target) {
15574
+ this.arming = target;
15575
+ this.refused = null;
15576
+ return this.render();
15577
+ }
15578
+ this.arming = null;
15579
+ this.busy = target;
15580
+ this.render();
15581
+ const why = await this.hooks.unmark(target);
15582
+ this.busy = null;
15583
+ this.refused = why ? { target, why } : null;
15584
+ this.render();
15585
+ }
15582
15586
  render() {
15583
15587
  const rows = targetRows(this.hooks.targets(), this.hooks.list());
15584
15588
  const shut = this.hooks.shut("targets");
@@ -15588,12 +15592,17 @@ var TargetList = class {
15588
15592
  html += rows.length ? `<div class="tg-rows">` + rows.map(({ target, view: v2 }) => {
15589
15593
  const p2 = this.hooks.progress(target);
15590
15594
  const k2 = this.hooks.keyProgress(target);
15595
+ const gone = p2 === null && !!this.hooks.unmark && !this.hooks.readOnly?.();
15596
+ const armed = this.arming === target;
15597
+ const unmark = gone ? `<button class="tg-unmark${armed ? " armed" : ""}" data-unmark="${escapeHtml(target)}"${this.busy === target ? " disabled" : ""} title="${escapeHtml(armed ? `Press again to unmark ${target}: it is no target any more; the history keeps that it was` : `Unmark ${target}: it is not in the graph now, and is no target any more; the history keeps that it was`)}">${armed ? "Unmark it?" : "Unmark"}</button>` : "";
15598
+ const why = this.refused?.target === target ? `<div class="act-warn tg-why">${escapeHtml(this.refused.why)}</div>` : "";
15591
15599
  const pct2 = (x2) => p2 && p2.total ? (100 * x2 / p2.total).toFixed(1) : "0";
15592
15600
  const tip = v2 ? `${target} \u2014 open its view, on it: ${this.hooks.title?.(v2.id) ?? v2.id}` : `${target} \u2014 it has no view: open a temporary view of its TCB, linked to it until it goes (pin, fold or name it to keep it)`;
15593
- return `<button class="tg-row${v2 && v2.id === active ? " on" : ""}${v2 ? "" : " tg-viewless"}"${v2 ? ` data-open="${escapeHtml(v2.id)}"` : ""} data-target="${escapeHtml(target)}" title="${escapeHtml(tip)}"><span class="tg-name"><span class="star">\u2605</span>${escapeHtml(target.split(".").pop())}</span>` + (p2 ? (
15601
+ const row = `<button class="tg-row${v2 && v2.id === active ? " on" : ""}${v2 ? "" : " tg-viewless"}"${v2 ? ` data-open="${escapeHtml(v2.id)}"` : ""} data-target="${escapeHtml(target)}" title="${escapeHtml(tip)}"><span class="tg-name"><span class="star">\u2605</span>${escapeHtml(target.split(".").pop())}</span>` + (p2 ? (
15594
15602
  // with no view, that is said where the bar is, so that the name keeps its room
15595
15603
  (v2 ? `<span class="rv-bar"><i class="ok" style="width:${pct2(p2.approved)}%"></i><i class="commented" style="width:${pct2(p2.commented)}%"></i><i class="stale" style="width:${pct2(p2.stale)}%"></i></span>` : `<span class="tg-noview">no view</span>`) + (k2 ? `<span class="tg-key" title="${escapeHtml(`Key declarations that need review: ${k2.approved} of ${k2.total} approved, the target among them${k2.trusted ? `; ${k2.trusted} more trusted, in need of no review` : ""}`)}"><span class="key-mark">\u25C6</span>${k2.approved}/${k2.total}</span>` : "") + `<span class="tg-n" title="${escapeHtml(`All it rests on: ${p2.approved} of ${p2.total} approved`)}">${p2.approved}/${p2.total}</span>`
15596
15604
  ) : `<span class="muted tg-gone">not in the graph now${v2 ? "" : ", no view"}</span>`) + `</button>`;
15605
+ return unmark ? `<div class="tg-line">${row}${unmark}</div>${why}` : row;
15597
15606
  }).join("") + `</div>` : `<div class="tg-none muted">${this.hooks.readOnly?.() ? "No targets yet." : "No targets yet: \u2606 Mark as target in a theorem's panel."}</div>`;
15598
15607
  }
15599
15608
  keepFocus(this.el, () => this.el.innerHTML = html);
@@ -16204,6 +16213,12 @@ function cascadeRect(from, taken, vp, min, top = EDGE) {
16204
16213
  function raise(order, x2) {
16205
16214
  return [...order.filter((y2) => y2 !== x2), x2];
16206
16215
  }
16216
+ function meets(a3, b2) {
16217
+ return a3.x < b2.x + b2.w && b2.x < a3.x + a3.w && a3.y < b2.y + b2.h && b2.y < a3.y + a3.h;
16218
+ }
16219
+ function coveredBy(me, others) {
16220
+ return others.some((o2) => o2.z > me.z && o2.at.w > 0 && o2.at.h > 0 && meets(o2.at, me.at));
16221
+ }
16207
16222
  var EDGES = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
16208
16223
  var DRAG_PX = 3;
16209
16224
  var viewport = () => ({ w: document.documentElement.clientWidth || innerWidth, h: document.documentElement.clientHeight || innerHeight });
@@ -16264,12 +16279,23 @@ var FloatWindow = class {
16264
16279
  get fitted() {
16265
16280
  return this.fitting;
16266
16281
  }
16267
- /** Bring the window to the front of the others; one on top is there already. */
16282
+ /** Bring the window to the front of the others. */
16268
16283
  front() {
16269
- if (this.o.onTop || stack[stack.length - 1] === this.el) return;
16284
+ if (stack[stack.length - 1] === this.el) return;
16270
16285
  stack = raise(stack, this.el);
16271
16286
  restack();
16272
16287
  }
16288
+ /** Whether another window lies over this one where they meet (coveredBy): what the conversation
16289
+ * button asks before it closes the window rather than bringing it in front. */
16290
+ get covered() {
16291
+ const at = (el) => {
16292
+ const r2 = el.getBoundingClientRect();
16293
+ return { x: r2.left, y: r2.top, w: r2.width, h: r2.height };
16294
+ };
16295
+ const z2 = (el) => Number(getComputedStyle(el).zIndex) || 0;
16296
+ const others = stack.filter((el) => el !== this.el && el.isConnected && !el.hidden);
16297
+ return coveredBy({ z: z2(this.el), at: at(this.el) }, others.map((el) => ({ z: z2(el), at: at(el) })));
16298
+ }
16273
16299
  /** The window goes for good: it is no longer kept in step with the viewport. */
16274
16300
  dispose() {
16275
16301
  window.removeEventListener("resize", this.resized);
@@ -16702,6 +16728,10 @@ function caretOf(text2, offset) {
16702
16728
  const nl = before.lastIndexOf("\n");
16703
16729
  return { line: before.split("\n").length - 1, ch: before.length - (nl + 1) };
16704
16730
  }
16731
+ function placeIn2(start, text2, offset) {
16732
+ const at = caretOf(text2, offset);
16733
+ return { line: start + at.line, ch: at.ch };
16734
+ }
16705
16735
  function taggedHtml(t2, isRef) {
16706
16736
  if (typeof t2 === "string") return highlightLean(t2, (w2) => isRef(w2));
16707
16737
  if (Array.isArray(t2)) return t2.map((x2) => taggedHtml(x2, isRef)).join("");
@@ -16785,11 +16815,28 @@ var InfoView = class {
16785
16815
  }
16786
16816
  const same2 = !!was && !!code && was.module === code.module && was.hash === code.hash;
16787
16817
  if (!same2) this.answer = null;
16788
- if (this.caret && !this.holds(this.caret.line)) this.caret = null;
16818
+ if (this.caret && (was && code && was.module !== code.module || !this.holds(this.caret.line))) this.caret = null;
16789
16819
  this.watchSize();
16790
16820
  if (this.caret && !same2) this.ask();
16791
16821
  else this.draw();
16792
16822
  }
16823
+ /** The window turns to the file of `module` (another declaration's, another file in File mode),
16824
+ * whose code it reads: a caret in the file on show goes with it — a place of one file is another
16825
+ * place of the next, which nobody clicked —, and nothing is asked until the window tells the new
16826
+ * code (`attach`). A followed reader's caret told meanwhile waits for that code. Nobody is told: the
16827
+ * reader did not move it. */
16828
+ leave(module) {
16829
+ const c3 = this.code;
16830
+ if (!c3 || c3.module === module) return;
16831
+ this.code = null;
16832
+ this.answer = null;
16833
+ this.turn++;
16834
+ this.stopWaits();
16835
+ if (this.caret) {
16836
+ this.caret = null;
16837
+ this.draw();
16838
+ }
16839
+ }
16793
16840
  /** The element of line `line` of the file in the code on show, or null. */
16794
16841
  lineEl(line) {
16795
16842
  const c3 = this.code, l2 = this.lines;
@@ -16820,7 +16867,7 @@ var InfoView = class {
16820
16867
  this.caret = { line: c3.start + to.line, ch: to.ch, after: k2.after };
16821
16868
  this.ask();
16822
16869
  this.hooks.moved();
16823
- this.lineEl(c3.start + to.line)?.scrollIntoView({ block: "nearest" });
16870
+ this.show(this.caret);
16824
16871
  return true;
16825
16872
  }
16826
16873
  /** The caret as a followed reader's is (CollabSpec, "Surfaces"), or none: nobody is told. */
@@ -16834,9 +16881,16 @@ var InfoView = class {
16834
16881
  if (!this.holds(c3.line)) return;
16835
16882
  if (moved) {
16836
16883
  this.ask();
16837
- this.lineEl(c3.line)?.scrollIntoView({ block: "nearest" });
16884
+ this.show(c3);
16838
16885
  } else this.draw();
16839
16886
  }
16887
+ /** The caret's place shown, stepped or followed to: what the window hides of it shown (a folded
16888
+ * proof), its line scrolled into sight — clear of what stands over the code's edges, File mode's
16889
+ * sticky header and the pane below the code (`scroll-padding`, web/style.css). */
16890
+ show(c3) {
16891
+ this.hooks.reveal?.(c3.line, c3.ch);
16892
+ this.lineEl(c3.line)?.scrollIntoView({ block: "nearest" });
16893
+ }
16840
16894
  /** No caret here any more: another window holds the page's. */
16841
16895
  clear() {
16842
16896
  if (!this.caret) return;
@@ -16900,8 +16954,10 @@ var InfoView = class {
16900
16954
  const focused = document.activeElement;
16901
16955
  pane.hidden = !v2.show || hidden;
16902
16956
  split?.classList.toggle("iv-on", v2.show && !hidden);
16903
- let tab = split?.querySelector(":scope > .iv-show") ?? null;
16904
- if (v2.show && hidden && split) {
16957
+ const bar = split?.parentElement?.querySelector(":scope > .sw-sticky") ?? null;
16958
+ const home = bar ?? split;
16959
+ let tab = home?.querySelector(":scope > .iv-show") ?? null;
16960
+ if (v2.show && hidden && home) {
16905
16961
  if (!tab) {
16906
16962
  tab = document.createElement("button");
16907
16963
  tab.type = "button";
@@ -16909,18 +16965,30 @@ var InfoView = class {
16909
16965
  tab.dataset.ivShow = "";
16910
16966
  tab.title = "Show the InfoView: what Lean says at the caret (kept in this browser)";
16911
16967
  tab.innerHTML = `<span aria-hidden="true">\u22A2</span> Lean`;
16912
- split.prepend(tab);
16968
+ tab.addEventListener("click", () => this.hooks.hide(false));
16969
+ if (bar) bar.append(tab);
16970
+ else home.prepend(tab);
16913
16971
  }
16914
16972
  } else tab?.remove();
16915
16973
  const had = focused instanceof HTMLElement && (pane.contains(focused) || focused.matches("[data-iv-show]")) ? focused : null;
16916
16974
  const when = had?.closest("[data-iv-when]")?.dataset.ivWhen;
16917
16975
  if (!v2.show || hidden || !k2) {
16918
16976
  if (had) this.hooks.win().focus({ preventScroll: true });
16919
- return;
16977
+ return this.below();
16920
16978
  }
16921
16979
  pane.innerHTML = headHtml(k2, v2.sides, !!this.answer?.interactive) + `<div class="iv-body">${v2.html}</div>`;
16922
16980
  pane.setAttribute("aria-label", "What Lean says at the caret");
16923
16981
  if (had && !had.isConnected) (pane.querySelector(`[data-iv-when="${when}"]`) ?? this.hooks.win()).focus({ preventScroll: true });
16982
+ this.below();
16983
+ }
16984
+ /** How much of the code's view the pane below the code stands over, so that a line the caret
16985
+ * steps to is scrolled clear of it (`--iv-below`, web/style.css); none beside the code. */
16986
+ below() {
16987
+ const pane = this.pane;
16988
+ const split = pane?.parentElement;
16989
+ const scroll = split?.closest(".sw-scroll");
16990
+ if (!pane || !split || !scroll) return;
16991
+ scroll.style.setProperty("--iv-below", `${!pane.hidden && !split.classList.contains("iv-side") ? pane.offsetHeight : 0}px`);
16924
16992
  }
16925
16993
  /** The caret's line marked in the code, and its tactic, where the browser can (the CSS Custom
16926
16994
  * Highlight API): marks the code keeps however often it is drawn again. */
@@ -16944,10 +17012,6 @@ var InfoView = class {
16944
17012
  const split = pane.parentElement;
16945
17013
  split?.addEventListener("click", (e2) => {
16946
17014
  const t2 = e2.target;
16947
- if (t2.closest("[data-iv-show]")) {
16948
- this.hooks.hide(false);
16949
- return;
16950
- }
16951
17015
  if (!pane.contains(t2)) return;
16952
17016
  if (t2.closest("[data-iv-hide]")) return this.hooks.hide(true);
16953
17017
  const when = t2.closest("[data-iv-when]")?.dataset.ivWhen;
@@ -17022,6 +17086,7 @@ var InfoView = class {
17022
17086
  const side2 = paneSide(this.hooks.win().offsetWidth, this.hooks.fitted(), document.documentElement.clientWidth || innerWidth);
17023
17087
  split.classList.toggle("iv-side", side2);
17024
17088
  scroll.style.setProperty("--sw-view", `${scroll.clientHeight}px`);
17089
+ this.below();
17025
17090
  }
17026
17091
  };
17027
17092
  function subtermHtml(r2, resolve) {
@@ -17123,8 +17188,9 @@ var Sources = class {
17123
17188
  * page's own rules. The following window opens on their declaration, follows it and closes with
17124
17189
  * theirs; a pinned window stands for each of theirs — one pinned here on the same declaration,
17125
17190
  * else this page's following window pinned where they pinned theirs, else a new one a step aside
17126
- * — and closes when theirs does; each is collapsed as theirs is. Windows this reader pinned
17127
- * on other declarations stay, and at most MAX_PINNED are pinned. */
17191
+ * — and closes when theirs does, or follows the selection again as theirs does when they unpin
17192
+ * it; each is collapsed as theirs is. Windows this reader pinned on other declarations stay, and
17193
+ * at most MAX_PINNED are pinned. */
17128
17194
  mirror(s2) {
17129
17195
  const left = new Set(this.pinned);
17130
17196
  const states = [];
@@ -17140,6 +17206,11 @@ var Sources = class {
17140
17206
  this.mirrored.add(p2);
17141
17207
  states.push([p2, e2.collapsed, modeOf(e2)]);
17142
17208
  }
17209
+ const unpinned = s2.following && s2.following.decl !== null && !this.following ? [...left].find((p2) => this.mirrored.has(p2) && p2.file === null) : void 0;
17210
+ if (unpinned) {
17211
+ left.delete(unpinned);
17212
+ this.unpin(unpinned, null);
17213
+ }
17143
17214
  for (const p2 of left) if (this.mirrored.has(p2)) this.close(p2);
17144
17215
  for (const e2 of missing) {
17145
17216
  if (this.pinned.length >= MAX_PINNED) break;
@@ -17157,6 +17228,7 @@ var Sources = class {
17157
17228
  p2.show(e2.decl);
17158
17229
  }
17159
17230
  this.pinned.push(p2);
17231
+ p2.front();
17160
17232
  this.hooks.changed();
17161
17233
  }
17162
17234
  this.mirrored.add(p2);
@@ -17202,6 +17274,28 @@ var Sources = class {
17202
17274
  this.pinAt(p2);
17203
17275
  return true;
17204
17276
  }
17277
+ /** Its pin pressed again (the owner's decision of 2026-11-08): a pinned window follows the
17278
+ * selection again, as it did before it was pinned — the next Space closes it, the next opening is
17279
+ * in it — and keeps its place. It shows the selected declaration `i`, stepped to it as the
17280
+ * following window steps (the pairing told of it) where it is on another; with no declaration
17281
+ * selected, it stays on its own until the selection changes, as it would not close under the
17282
+ * reader's hand. The window that followed the selection meanwhile closes: one follows at most. A
17283
+ * file window, pinned on its file by what it is, has no declaration to follow from: it stays. */
17284
+ unpin(p2, i2) {
17285
+ const k2 = this.pinned.indexOf(p2);
17286
+ if (k2 < 0 || p2.file !== null) return false;
17287
+ this.pinned.splice(k2, 1);
17288
+ this.mirrored.delete(p2);
17289
+ this.following?.remove();
17290
+ this.following = p2;
17291
+ p2.unpin();
17292
+ if (i2 !== null && p2.decl !== i2) {
17293
+ p2.show(i2);
17294
+ this.hooks.shown?.(p2, i2);
17295
+ }
17296
+ this.hooks.changed();
17297
+ return true;
17298
+ }
17205
17299
  /** A file opened from the Files tree or the board's menu (the owner's decision of 2026-11-01): a
17206
17300
  * file window on module `module`, pinned as it opens a step aside from the middle of the screen,
17207
17301
  * in File mode at the file's top; one on it already comes in front instead. It is no
@@ -17320,6 +17414,12 @@ var sourceMemory = () => ({ learned: /* @__PURE__ */ new Map(), printed: /* @__P
17320
17414
  var BACK = `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg>`;
17321
17415
  var FORWARD = `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5"/></svg>`;
17322
17416
  var PIN = `<svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true"><path d="M6 2.5h4l-.6 4 2.1 2.2v.8H4.5v-.8L6.6 6.5 6 2.5zM8 9.5v4"/></svg>`;
17417
+ function pinHtml(pinned, fileWindow, what) {
17418
+ const w2 = escapeHtml(what);
17419
+ if (fileWindow) return `<span class="sw-pinned" role="img" aria-label="Pinned" title="Pinned: a file window stays on ${w2}, whatever is selected">${PIN}</span>`;
17420
+ const title = pinned ? `Unpin: this window follows the selection again (pinned, it stays on ${w2}, whatever is selected)` : `Pin: keep this window on ${w2}; the next source you open (Space) opens in a new window beside it`;
17421
+ return `<button class="icon sw-pin" data-sw-pin aria-label="Pin" aria-pressed="${pinned}" title="${title}">${PIN}</button>`;
17422
+ }
17323
17423
  var COLLAPSE = `<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 8.5h8"/></svg>`;
17324
17424
  var READ_WAIT = 1e3;
17325
17425
  var FILE_ANCHOR = "\u27E8file\u27E9";
@@ -17364,8 +17464,10 @@ var SourceWindow = class {
17364
17464
  /** pinned: it stays on its declaration, and its place is its own */
17365
17465
  pinned = false;
17366
17466
  /** pinned as it opened, for a followed reader's window: how many steps aside from the middle of
17367
- * the screen it stands while it is fitted to its code (asideRect); 0 for any other */
17467
+ * the screen it stands while it is fitted to its code (asideRect), unpinned too; 0 for any other */
17368
17468
  aside = 0;
17469
+ /** its pin was pressed from the keyboard's focus: the toggle has it again once drawn again */
17470
+ pinFocus = false;
17369
17471
  /** bumped on every render, so a slow fetch for an earlier one is dropped */
17370
17472
  turn = 0;
17371
17473
  /** the code on show: its module, its first line in the file, the hash of the text */
@@ -17497,7 +17599,15 @@ var SourceWindow = class {
17497
17599
  const t2 = e2.target;
17498
17600
  if (t2.closest("[data-sw-quote]")) return this.quotePicked();
17499
17601
  if (t2.closest("[data-sw-close]")) return this.hooks.close(this);
17500
- if (t2.closest("[data-sw-pin]")) return this.hooks.pin(this);
17602
+ const pin = t2.closest("[data-sw-pin]");
17603
+ if (pin) {
17604
+ const was = this.pinned;
17605
+ this.pinFocus = document.activeElement === pin;
17606
+ if (was) this.hooks.unpin(this);
17607
+ else this.hooks.pin(this);
17608
+ if (this.pinned === was) this.pinFocus = false;
17609
+ return;
17610
+ }
17501
17611
  if (t2.closest("[data-sw-back]")) return this.hooks.back();
17502
17612
  if (t2.closest("[data-sw-fwd]")) return this.hooks.forward();
17503
17613
  if (t2.closest(".sw-pill, [data-sw-collapse]")) return;
@@ -17566,7 +17676,8 @@ var SourceWindow = class {
17566
17676
  moved: () => this.hooks.caretMoved?.(this),
17567
17677
  win: () => this.el,
17568
17678
  fitted: () => this.win.fitted,
17569
- stale: () => void this.render(false)
17679
+ stale: () => void this.render(false),
17680
+ reveal: (line, ch) => this.unfoldAt(line, ch)
17570
17681
  });
17571
17682
  el.addEventListener("keydown", (e2) => {
17572
17683
  this.keyAt = Date.now();
@@ -17726,6 +17837,14 @@ var SourceWindow = class {
17726
17837
  this.win.layout();
17727
17838
  void this.render(false);
17728
17839
  }
17840
+ /** Pinned no longer (its pin pressed again, the owner's decision of 2026-11-08): it follows the
17841
+ * selection again, with the page's back and forward, where it stands — a place the reader or the
17842
+ * page gave it stays its own, one fitted to its code stays fitted there. */
17843
+ unpin() {
17844
+ this.pinned = false;
17845
+ this.el.classList.remove("pinned");
17846
+ void this.render(false);
17847
+ }
17729
17848
  collapse(on) {
17730
17849
  this.win.collapse(on);
17731
17850
  if (on) this.unpick();
@@ -17779,6 +17898,8 @@ var SourceWindow = class {
17779
17898
  this.el.classList.remove("opening", "slow");
17780
17899
  this.el.removeAttribute("aria-busy");
17781
17900
  this.frameEl.inert = false;
17901
+ if (this.pinFocus) this.frameEl.querySelector("[data-sw-pin]")?.focus();
17902
+ this.pinFocus = false;
17782
17903
  for (const ok of this.waiting.splice(0)) ok();
17783
17904
  }
17784
17905
  /** The window goes: its cards, its place in the layer, what it waits for. */
@@ -17881,8 +18002,8 @@ var SourceWindow = class {
17881
18002
  * in the file; not while the reader follows someone, whose caret it is (a click is reading then). */
17882
18003
  caretIn(pre, node, off) {
17883
18004
  if (!this.shown || !this.code || this.collapsed || this.hooks.following?.()) return;
17884
- const at = caretOf(pre.textContent ?? "", offsetIn(pre, node, off));
17885
- this.info.place(Number(pre.dataset.line ?? this.shown.start) + at.line, at.ch);
18005
+ const at = placeIn2(Number(pre.dataset.line ?? this.shown.start), pre.textContent ?? "", offsetIn(pre, node, off));
18006
+ this.info.place(at.line, at.ch);
17886
18007
  }
17887
18008
  /** The InfoView's caret: where it is in the file, and whether the goals after the tactic are on
17888
18009
  * show; null where there is none in this window. */
@@ -18140,6 +18261,7 @@ var SourceWindow = class {
18140
18261
  this.unpick();
18141
18262
  const g2 = this.g;
18142
18263
  const v2 = g2.nodes[i2];
18264
+ this.info.leave(v2.module);
18143
18265
  const parts = v2.name.split(".");
18144
18266
  const ext = g2.isExt(i2);
18145
18267
  const kind = ext ? "external" : v2.kind;
@@ -18155,7 +18277,7 @@ var SourceWindow = class {
18155
18277
  const pinned = this.pinned;
18156
18278
  const steps = () => this.hooks.steps();
18157
18279
  const nav = () => `<span class="nav"><button data-sw-back title="Back (Alt \u2190)" aria-label="Back"${steps().back ? "" : " disabled"}>${BACK}</button><button data-sw-fwd title="Forward (Alt \u2192)" aria-label="Forward"${steps().forward ? "" : " disabled"}>${FORWARD}</button></span>`;
18158
- const pin = pinned ? `<span class="sw-pinned" role="img" aria-label="Pinned" title="Pinned: it stays on ${escapeHtml(v2.name)}, whatever is selected">${PIN}</span>` : `<button class="icon sw-pin" data-sw-pin aria-label="Pin" title="Pin: keep this window on ${escapeHtml(v2.name)}; the next source you open (Space) opens in a new window beside it">${PIN}</button>`;
18280
+ const pin = pinHtml(pinned, false, v2.name);
18159
18281
  let remote = null;
18160
18282
  const head = (where, editor) => `<div class="sw-head">${pinned ? "" : nav()}<span class="dot ${kindDot(v2.kind, ext)}"></span><span class="sw-name" title="${escapeHtml(v2.name)}">${short6}</span><span class="sw-ns">${escapeHtml(parts.slice(0, -1).join("."))}</span><span class="sw-loc">${where}</span>` + (editor ? editorAnchor(editor) : "") + (remote ? githubAnchor(remote.href, remote.commit, remote.what) : "") + modeSwitch("decl", false) + `<span class="sw-acts">${pin}<button class="icon" data-sw-collapse aria-label="Collapse" title="Collapse to one line (or double-click the title bar)">${COLLAPSE}</button><button class="icon sw-close" data-sw-close aria-label="Close" title="${pinned ? "Close (Esc)" : "Close (Esc, or Space)"}">\u2715</button></span></div>`;
18161
18283
  const frame2 = (where, notes2, body, editor = this.still ? null : this.hooks.editorLink(g2, i2), final = true) => {
@@ -18324,7 +18446,7 @@ var SourceWindow = class {
18324
18446
  const pinned = this.pinned;
18325
18447
  const nav = `<span class="nav"><button data-sw-back title="Back (Alt \u2190)" aria-label="Back"${this.hooks.steps().back ? "" : " disabled"}>${BACK}</button><button data-sw-fwd title="Forward (Alt \u2192)" aria-label="Forward"${this.hooks.steps().forward ? "" : " disabled"}>${FORWARD}</button></span>`;
18326
18448
  const what = this.file !== null ? `the file ${this.file}` : this.g.nodes[this.current].name;
18327
- const pin = pinned ? `<span class="sw-pinned" role="img" aria-label="Pinned" title="Pinned: it stays on ${escapeHtml(what)}, whatever is selected">${PIN}</span>` : `<button class="icon sw-pin" data-sw-pin aria-label="Pin" title="Pin: keep this window on ${escapeHtml(what)}; the next source you open (Space) opens in a new window beside it">${PIN}</button>`;
18449
+ const pin = pinHtml(pinned, this.file !== null, what);
18328
18450
  let title;
18329
18451
  if (this.file !== null) {
18330
18452
  const parts = this.file.split(".");
@@ -18361,6 +18483,7 @@ var SourceWindow = class {
18361
18483
  const v2 = i2 >= 0 ? g2.nodes[i2] : null;
18362
18484
  const module = this.file ?? v2?.module;
18363
18485
  if (!module) return;
18486
+ this.info.leave(module);
18364
18487
  const turn = ++this.turn;
18365
18488
  this.hideTip();
18366
18489
  this.unpick();
@@ -18678,6 +18801,16 @@ var SourceWindow = class {
18678
18801
  if (b2) b2.outerHTML = this.foldsButton();
18679
18802
  this.updateSticky();
18680
18803
  }
18804
+ /** The folded proof that holds (line, ch) of the file shown, as a click on its mark shows it: the
18805
+ * InfoView's caret stepped or followed into it (the owner's decisions of 2026-11-08, 0.11). */
18806
+ unfoldAt(line, ch) {
18807
+ const w2 = this.whole;
18808
+ if (this.mode !== "file" || !w2 || !this.hooks.foldProofs()) return;
18809
+ const upTo = (p2) => p2[0] < line || p2[0] === line && p2[1] <= ch;
18810
+ const f2 = w2.folds.find((x2) => upTo(x2.from) && !upTo(x2.to));
18811
+ const id = f2 ? `${f2.from[0]}:${f2.from[1]}` : null;
18812
+ if (id && !this.openFolds.has(id)) this.openFold(id);
18813
+ }
18681
18814
  /** A folded proof opened: that one alone, its place staying. */
18682
18815
  openFold(id) {
18683
18816
  this.openFolds.add(id);
@@ -42172,6 +42305,8 @@ function panelsPart(page) {
42172
42305
  compiledOf: (m3) => page.compiled.get(m3),
42173
42306
  close: (w2) => sources.close(w2),
42174
42307
  pin: (w2) => void sources.pin(w2),
42308
+ // unpinned, it follows the selection again: the panel's declaration
42309
+ unpin: (w2) => void sources.unpin(w2, selected()),
42175
42310
  // a source window collapsed or opened again leaves or takes its side of the reference window
42176
42311
  // paired with it, the two kept apart as the pairing shows them (AttachmentSpec decision 8)
42177
42312
  collapsed: () => {
@@ -46192,7 +46327,7 @@ var GraphCanvas = class {
46192
46327
  const { x: cx, y: cy, k: k2 } = this.cam;
46193
46328
  const sx = (x2) => (x2 - cx) * k2 + this.w / 2, sy = (y2) => (y2 - cy) * k2 + this.h / 2;
46194
46329
  const dot = this.dotPx();
46195
- const meets = (x0, y0, x1, y1) => x1 >= rect.x && y1 >= rect.y && x0 <= rect.x + rect.w && y0 <= rect.y + rect.h;
46330
+ const meets2 = (x0, y0, x1, y1) => x1 >= rect.x && y1 >= rect.y && x0 <= rect.x + rect.w && y0 <= rect.y + rect.h;
46196
46331
  const P2 = this.posData;
46197
46332
  const out = [];
46198
46333
  const four = (d2, o2) => [d2[o2], d2[o2 + 1], d2[o2 + 2], d2[o2 + 3]];
@@ -46206,7 +46341,7 @@ var GraphCanvas = class {
46206
46341
  const x2 = sx(d2[o2]), y2 = sy(d2[o2 + 1]);
46207
46342
  const ring = d2[o2 + 12], ringR = r2 + d2[o2 + 14];
46208
46343
  const ext = Math.max(r2, ringR + ring / 2);
46209
- if (!meets(x2 - ext, y2 - ext, x2 + ext, y2 + ext)) continue;
46344
+ if (!meets2(x2 - ext, y2 - ext, x2 + ext, y2 + ext)) continue;
46210
46345
  const fill = four(d2, o2 + 4), stroke = ring > 0 && d2[o2 + 11] > 0 ? four(d2, o2 + 8) : null;
46211
46346
  if (fill[3] <= 2e-3 && !stroke) continue;
46212
46347
  const flags = Math.round(d2[o2 + 13]);
@@ -46225,7 +46360,7 @@ var GraphCanvas = class {
46225
46360
  });
46226
46361
  } else if (L2.kind === "lines") {
46227
46362
  const x0 = sx(d2[o2]), y0 = sy(d2[o2 + 1]), x1 = sx(d2[o2 + 2]), y1 = sy(d2[o2 + 3]), w2 = d2[o2 + 8];
46228
- if (!meets(Math.min(x0, x1) - w2, Math.min(y0, y1) - w2, Math.max(x0, x1) + w2, Math.max(y0, y1) + w2)) continue;
46363
+ if (!meets2(Math.min(x0, x1) - w2, Math.min(y0, y1) - w2, Math.max(x0, x1) + w2, Math.max(y0, y1) + w2)) continue;
46229
46364
  out.push({ kind: "line", x0, y0, x1, y1, colour: four(d2, o2 + 4), width: w2 });
46230
46365
  } else {
46231
46366
  const len = Math.round(d2[o2 + 8]);
@@ -46238,7 +46373,7 @@ var GraphCanvas = class {
46238
46373
  [x0, y0, x1, y1] = [Math.min(x0, x2), Math.min(y0, y2), Math.max(x1, x2), Math.max(y1, y2)];
46239
46374
  }
46240
46375
  const w2 = d2[o2 + 10];
46241
- if (!meets(x0 - w2, y0 - w2, x1 + w2, y1 + w2)) continue;
46376
+ if (!meets2(x0 - w2, y0 - w2, x1 + w2, y1 + w2)) continue;
46242
46377
  out.push({ kind: "bundle", ctrl, beta: d2[o2 + 9], width: w2, c0: four(d2, o2 + 12), c1: four(d2, o2 + 16) });
46243
46378
  }
46244
46379
  }
@@ -48756,7 +48891,7 @@ function inside(f2) {
48756
48891
  const len = Math.hypot(f2[0], f2[1]);
48757
48892
  return len > 1 ? [f2[0] / len, f2[1] / len] : f2;
48758
48893
  }
48759
- function placeIn2(world, clusters, b2) {
48894
+ function placeIn3(world, clusters, b2) {
48760
48895
  const [wx, wy] = world;
48761
48896
  let best = -1;
48762
48897
  clusters.forEach((c3, k2) => {
@@ -49722,7 +49857,7 @@ var Stickies = class {
49722
49857
  if (!b2 || !nb) return null;
49723
49858
  if (kind === "view") return { kind, place: placeAt(b2.mode, world, this.clusters()) };
49724
49859
  const clusters = this.clusters(true);
49725
- const inside3 = placeIn2(world, clusters, nb);
49860
+ const inside3 = placeIn3(world, clusters, nb);
49726
49861
  if (inside3) return { kind, mode: b2.mode, place: inside3 };
49727
49862
  const ring = this.ring ?? this.ringNow();
49728
49863
  return ring ? { kind, mode: b2.mode, place: { ring: angleOf(ring, world[0], world[1]) } } : null;
@@ -53654,8 +53789,6 @@ var ChatWindow = class {
53654
53789
  }
53655
53790
  },
53656
53791
  keepsCollapsed: true,
53657
- // its own layer, above the source and reference windows' order (ReviewSpec, "In front")
53658
- onTop: true,
53659
53792
  start: (vp) => defaultRect(vp, this.hooks.insets()),
53660
53793
  live: () => this.shown,
53661
53794
  collapsed: (on) => {
@@ -53682,8 +53815,8 @@ var ChatWindow = class {
53682
53815
  get reading() {
53683
53816
  return this.shown && !this.win.collapsed && !document.hidden;
53684
53817
  }
53685
- /** Open it, as kept (collapsed or not, where the reader put it); `expand`: expanded whatever was
53686
- * kept, as asked for from a menu or a notice. */
53818
+ /** Open it, as kept (collapsed or not, where the reader put it), in front of the other windows;
53819
+ * `expand`: expanded whatever was kept, as asked for from a menu or a notice. */
53687
53820
  show(expand2 = false) {
53688
53821
  if (!this.shown) {
53689
53822
  this.shown = true;
@@ -53694,8 +53827,14 @@ var ChatWindow = class {
53694
53827
  }
53695
53828
  if (expand2 && this.win.collapsed) this.win.collapse(false);
53696
53829
  this.win.layout();
53830
+ this.win.front();
53697
53831
  if (!this.win.collapsed) this.hooks.expanded();
53698
53832
  }
53833
+ /** Whether another window lies over it where they meet: the conversation button then brings it in
53834
+ * front, rather than closing it. */
53835
+ get covered() {
53836
+ return this.shown && this.win.covered;
53837
+ }
53699
53838
  /** The reader closed it: its ✕, or the conversation button again. */
53700
53839
  close() {
53701
53840
  if (!this.shown) return;
@@ -54178,11 +54317,14 @@ function followPart(page) {
54178
54317
  // the reference window (AttachmentSpec decision 11)
54179
54318
  paper: () => page.papers.state() ? { paper: page.papers.state() } : {},
54180
54319
  // the InfoView's caret (ReviewSpec, "The InfoView"; the owner's decision of 2026-11-01): the
54181
- // page's one, in the window the reader put it in
54320
+ // page's one, in the window the reader put it in — a file window's by its file (the owner's
54321
+ // decisions of 2026-11-08, 0.11: the InfoView in File mode)
54182
54322
  caret: () => {
54183
54323
  const w2 = page.sources.all.find((p2) => p2.caret);
54184
54324
  const c3 = w2?.caret;
54185
- return w2 && c3 ? { caret: { decl: w2.name, line: c3.line, character: c3.ch, ...c3.after ? { after: true } : {}, ...w2 !== page.sources.following ? { pinned: true } : {} } } : {};
54325
+ if (!w2 || !c3) return {};
54326
+ const where = w2.file !== null ? { file: w2.file } : { decl: w2.name, ...w2 !== page.sources.following ? { pinned: true } : {} };
54327
+ return { caret: { ...where, line: c3.line, character: c3.ch, ...c3.after ? { after: true } : {} } };
54186
54328
  },
54187
54329
  activity: () => ({ activity: page.activity.state() }),
54188
54330
  lostFound: () => ({ lostFound: { open: page.lostDrawer.open } }),
@@ -54249,7 +54391,7 @@ function followPart(page) {
54249
54391
  });
54250
54392
  const c3 = v2.caret;
54251
54393
  const f2 = page.sources.following;
54252
- const at = c3 ? c3.pinned ? page.sources.pinned.find((p2) => p2.name === c3.decl) : f2 && f2.name === c3.decl ? f2 : void 0 : void 0;
54394
+ const at = !c3 ? void 0 : "file" in c3 ? page.sources.pinned.find((p2) => p2.file === c3.file) : c3.pinned ? page.sources.pinned.find((p2) => p2.file === null && p2.name === c3.decl) : f2 && f2.name === c3.decl ? f2 : void 0;
54253
54395
  for (const p2 of page.sources.all) p2.followCaret(p2 === at && c3 ? { line: c3.line, ch: c3.character, after: c3.after === true } : null);
54254
54396
  }
54255
54397
  if (once) {
@@ -54329,7 +54471,7 @@ function talkPart(page) {
54329
54471
  const talkBtn = $("#talk-btn");
54330
54472
  talkBtn.hidden = !!reader || !!data.snapshot;
54331
54473
  talkBtn.addEventListener("click", () => {
54332
- if (page.chatWin.open && !page.chatWin.collapsed) page.chatWin.close();
54474
+ if (page.chatWin.open && !page.chatWin.collapsed && !page.chatWin.covered) page.chatWin.close();
54333
54475
  else page.chatWin.show(true);
54334
54476
  });
54335
54477
  let noticeTimer = null;
@@ -55811,6 +55953,9 @@ function tabsPart(page) {
55811
55953
  return i2 === void 0 ? null : page.flowNow.keyProgress(i2);
55812
55954
  },
55813
55955
  open: (id, target) => openTarget(id, target),
55956
+ // a target gone from the graph taken off from its row (HistorySpec decision 13), under the
55957
+ // reader's name
55958
+ unmark: async (target) => await page.people.ensure() ? page.submit({ op: "target", name: target, on: false }) : "A target is unmarked under your name: give one first.",
55814
55959
  title: (id) => page.views.title(id),
55815
55960
  shut: page.shut,
55816
55961
  toggle: page.toggleSection
@@ -56264,6 +56409,8 @@ function sharePart(page) {
56264
56409
  // what the reader sees (the owner's decision of 2026-10-12): every followed part as the registry
56265
56410
  // reads it, the camera as the region of the board it shows
56266
56411
  snapshot: () => writeSnapshot(followedOf(page.parts.read), page.canvas.screen),
56412
+ // the reader's own conversation with the server's agent (AgentSpec decision 10)
56413
+ talk: (agent) => page.talk.open(agent),
56267
56414
  exact: {
56268
56415
  get: () => S7.shareExact !== false,
56269
56416
  set: (on) => {
@@ -56793,6 +56940,8 @@ var LostAndFound = class {
56793
56940
  flash = null;
56794
56941
  /** the Archived section opened by the reader */
56795
56942
  archivedOpen = false;
56943
+ /** the target entry whose Unmark was pressed once, by its key, waiting for the second press */
56944
+ unmarking = null;
56796
56945
  constructor(el, api2, hooks) {
56797
56946
  this.el = el;
56798
56947
  this.api = api2;
@@ -56922,6 +57071,22 @@ var LostAndFound = class {
56922
57071
  return;
56923
57072
  }
56924
57073
  const ek = at("data-lf-e");
57074
+ if (ek !== null && t2.closest("[data-lf-unmark]")) {
57075
+ const entry = group()?.entries[Number(ek)];
57076
+ if (!entry || entry.kind !== "target" || !this.hooks.unmark) return;
57077
+ if (this.unmarking !== entry.key) {
57078
+ this.unmarking = entry.key;
57079
+ return this.render();
57080
+ }
57081
+ this.unmarking = null;
57082
+ const unmark = this.hooks.unmark;
57083
+ void this.act(entry.key, async () => {
57084
+ const why = await unmark(entry.name);
57085
+ return why ? { error: why } : { ok: true };
57086
+ });
57087
+ return;
57088
+ }
57089
+ if (this.unmarking !== null) this.unmarking = null;
56925
57090
  if (ek !== null && t2.closest("[data-lf-archive]")) {
56926
57091
  const g2 = group();
56927
57092
  const entry = g2?.entries[Number(ek)];
@@ -57053,7 +57218,7 @@ var LostAndFound = class {
57053
57218
  g2.entries.forEach((e2, ei) => {
57054
57219
  const ewait = this.busy.has(e2.key) || this.busy.has(name) ? " disabled" : "";
57055
57220
  const eerr = this.errors.get(e2.key);
57056
- html += `<div class="lf-entry" data-lf-e="${ei}" data-lf-key="${escapeHtml(e2.key)}"><span class="lf-kind lf-${e2.kind}">${e2.kind}</span><div class="lf-entry-t">${this.entryHtml(e2)}</div><button class="lf-arch" data-lf-archive${ewait} title="Archive: hide it from the list; it is kept, under Archived">Archive</button>` + (eerr ? `<div class="act-warn">${escapeHtml(eerr)}</div>` : "") + `</div>`;
57221
+ html += `<div class="lf-entry" data-lf-e="${ei}" data-lf-key="${escapeHtml(e2.key)}"><span class="lf-kind lf-${e2.kind}">${e2.kind}</span><div class="lf-entry-t">${this.entryHtml(e2)}</div>` + (e2.kind === "target" && this.hooks.unmark ? this.unmarking === e2.key ? `<button class="lf-arch lf-unmark armed" data-lf-unmark${ewait} title="Press again to unmark it: it is no target any more; the history keeps that it was">Unmark it?</button>` : `<button class="lf-arch lf-unmark" data-lf-unmark${ewait} title="Unmark target: it is no target any more, and leaves this list; the history keeps that it was">Unmark</button>` : "") + `<button class="lf-arch" data-lf-archive${ewait} title="Archive: hide it from the list; it is kept, under Archived">Archive</button>` + (eerr ? `<div class="act-warn">${escapeHtml(eerr)}</div>` : "") + `</div>`;
57057
57222
  });
57058
57223
  return html + `</div>`;
57059
57224
  }
@@ -57178,6 +57343,9 @@ function timelinePart(page) {
57178
57343
  timeMachine: (at) => page.timeMachine(at),
57179
57344
  ensureName: () => page.people.ensure(),
57180
57345
  nameLost: () => page.people.lost(),
57346
+ // a lost target taken off from its entry (HistorySpec decision 13); the drawer asked for a name.
57347
+ // Not where the review cannot be changed: a snapshot, a read-only page
57348
+ ...data.snapshot || reader ? {} : { unmark: (name) => page.submit({ op: "target", name, on: false }) },
57181
57349
  toggled: (open) => {
57182
57350
  if (open && activity.open) activity.toggle(false);
57183
57351
  page.syncInsets();
@@ -57946,6 +58114,10 @@ function livePart(page) {
57946
58114
  const d2 = JSON.parse(e2.data);
57947
58115
  page.talk.add(d2.channel, d2.message);
57948
58116
  });
58117
+ es.addEventListener("chat-state", (e2) => {
58118
+ const d2 = JSON.parse(e2.data);
58119
+ page.talk.sessionState(d2.channel, d2.talk);
58120
+ });
57949
58121
  es.addEventListener("ask", (e2) => page.asking.asked(JSON.parse(e2.data)));
57950
58122
  es.addEventListener("ask-answer", (e2) => page.asking.answered(JSON.parse(e2.data)));
57951
58123
  es.addEventListener("ask-end", (e2) => page.asking.ended(JSON.parse(e2.data).id));
@@ -59829,7 +60001,7 @@ var TIPS = [
59829
60001
  id: "conversations",
59830
60002
  group: "together",
59831
60003
  title: "Conversations",
59832
- text: "The conversation button (Conversations in \u22EF on a phone) opens your own window: <b>Everyone</b>, where @ and a name mentions someone, and a private channel with each agent you made. It stays in front, whoever you follow.",
60004
+ text: "The conversation button (Conversations in \u22EF on a phone) opens your own window: <b>Everyone</b>, where @ and a name mentions someone, and a private channel with each agent you made. It stays open, whoever you follow.",
59833
60005
  who: "full",
59834
60006
  where: "both",
59835
60007
  since: "0.6.0",
@@ -59839,11 +60011,11 @@ var TIPS = [
59839
60011
  {
59840
60012
  id: "agent-here",
59841
60013
  group: "together",
59842
- title: "An agent that stays",
59843
- text: "Where the server allows it, Share runs your agent <b>on this server</b>, on your Claude Code token: given once, it answers until revoked, with no prompt to paste.",
60014
+ title: "The server's agent",
60015
+ text: "Where the server runs an AI agent of its own, it has a tab in your conversations: yours alone, nobody else reads it. In <b>Everyone</b>, <b>@</b> and its name asks it in front of all.",
59844
60016
  who: "full",
59845
60017
  where: "both",
59846
- since: "0.10.0",
60018
+ since: "0.11.0",
59847
60019
  about: ["#share-pop [data-tab=agent]", "#convo"],
59848
60020
  manual: "together"
59849
60021
  },