visualproof 0.10.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 +6 -3
- package/dist/mcp/visualproof-mcp.mjs +12 -7
- package/dist/server/agent.js +7 -1
- package/dist/server/agententry.js +18 -7
- package/dist/server/agenttalk.js +46 -4
- package/dist/server/app.js +4 -3
- package/dist/server/appagent.js +7 -1
- package/dist/server/appshare.js +22 -117
- package/dist/server/apptalk.js +39 -25
- package/dist/server/children.js +1 -1
- package/dist/server/doctor.js +4 -3
- package/dist/server/hosted.js +475 -260
- package/dist/server/live.js +49 -24
- package/dist/server/main.js +26 -9
- package/dist/server/mcptools.js +2 -2
- package/dist/server/options.js +38 -14
- package/dist/server/prompt.js +19 -11
- package/dist/server/serveragent.js +117 -0
- package/dist/server/talk.js +39 -3
- package/dist/server/tokens.js +12 -2
- package/dist/shared/collab.js +12 -5
- package/dist/web/bundle/app.js +247 -131
- package/dist/web/index.html +1 -1
- package/dist/web/style.css +30 -10
- package/docs/agent-api/mcp.md +4 -3
- package/docs/agent-api/talking.md +23 -6
- package/package.json +1 -1
- package/dist/server/claudetokens.js +0 -113
package/dist/web/bundle/app.js
CHANGED
|
@@ -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
|
|
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.
|
|
6349
|
+
var PAGE_VERSION = true ? "0.11.0" : 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
|
-
/**
|
|
10088
|
-
*
|
|
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
|
|
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
|
-
|
|
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)
|
|
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
|
|
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-
|
|
10575
|
-
|
|
10576
|
-
this.
|
|
10577
|
-
this.
|
|
10578
|
-
} else if (t2.closest("[data-
|
|
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
|
|
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
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
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
|
|
10919
|
-
return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text"${
|
|
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
|
|
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
|
|
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" ?
|
|
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);
|
|
@@ -16204,6 +16181,12 @@ function cascadeRect(from, taken, vp, min, top = EDGE) {
|
|
|
16204
16181
|
function raise(order, x2) {
|
|
16205
16182
|
return [...order.filter((y2) => y2 !== x2), x2];
|
|
16206
16183
|
}
|
|
16184
|
+
function meets(a3, b2) {
|
|
16185
|
+
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;
|
|
16186
|
+
}
|
|
16187
|
+
function coveredBy(me, others) {
|
|
16188
|
+
return others.some((o2) => o2.z > me.z && o2.at.w > 0 && o2.at.h > 0 && meets(o2.at, me.at));
|
|
16189
|
+
}
|
|
16207
16190
|
var EDGES = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
|
|
16208
16191
|
var DRAG_PX = 3;
|
|
16209
16192
|
var viewport = () => ({ w: document.documentElement.clientWidth || innerWidth, h: document.documentElement.clientHeight || innerHeight });
|
|
@@ -16264,12 +16247,23 @@ var FloatWindow = class {
|
|
|
16264
16247
|
get fitted() {
|
|
16265
16248
|
return this.fitting;
|
|
16266
16249
|
}
|
|
16267
|
-
/** Bring the window to the front of the others
|
|
16250
|
+
/** Bring the window to the front of the others. */
|
|
16268
16251
|
front() {
|
|
16269
|
-
if (
|
|
16252
|
+
if (stack[stack.length - 1] === this.el) return;
|
|
16270
16253
|
stack = raise(stack, this.el);
|
|
16271
16254
|
restack();
|
|
16272
16255
|
}
|
|
16256
|
+
/** Whether another window lies over this one where they meet (coveredBy): what the conversation
|
|
16257
|
+
* button asks before it closes the window rather than bringing it in front. */
|
|
16258
|
+
get covered() {
|
|
16259
|
+
const at = (el) => {
|
|
16260
|
+
const r2 = el.getBoundingClientRect();
|
|
16261
|
+
return { x: r2.left, y: r2.top, w: r2.width, h: r2.height };
|
|
16262
|
+
};
|
|
16263
|
+
const z2 = (el) => Number(getComputedStyle(el).zIndex) || 0;
|
|
16264
|
+
const others = stack.filter((el) => el !== this.el && el.isConnected && !el.hidden);
|
|
16265
|
+
return coveredBy({ z: z2(this.el), at: at(this.el) }, others.map((el) => ({ z: z2(el), at: at(el) })));
|
|
16266
|
+
}
|
|
16273
16267
|
/** The window goes for good: it is no longer kept in step with the viewport. */
|
|
16274
16268
|
dispose() {
|
|
16275
16269
|
window.removeEventListener("resize", this.resized);
|
|
@@ -16702,6 +16696,10 @@ function caretOf(text2, offset) {
|
|
|
16702
16696
|
const nl = before.lastIndexOf("\n");
|
|
16703
16697
|
return { line: before.split("\n").length - 1, ch: before.length - (nl + 1) };
|
|
16704
16698
|
}
|
|
16699
|
+
function placeIn2(start, text2, offset) {
|
|
16700
|
+
const at = caretOf(text2, offset);
|
|
16701
|
+
return { line: start + at.line, ch: at.ch };
|
|
16702
|
+
}
|
|
16705
16703
|
function taggedHtml(t2, isRef) {
|
|
16706
16704
|
if (typeof t2 === "string") return highlightLean(t2, (w2) => isRef(w2));
|
|
16707
16705
|
if (Array.isArray(t2)) return t2.map((x2) => taggedHtml(x2, isRef)).join("");
|
|
@@ -16785,11 +16783,28 @@ var InfoView = class {
|
|
|
16785
16783
|
}
|
|
16786
16784
|
const same2 = !!was && !!code && was.module === code.module && was.hash === code.hash;
|
|
16787
16785
|
if (!same2) this.answer = null;
|
|
16788
|
-
if (this.caret && !this.holds(this.caret.line)) this.caret = null;
|
|
16786
|
+
if (this.caret && (was && code && was.module !== code.module || !this.holds(this.caret.line))) this.caret = null;
|
|
16789
16787
|
this.watchSize();
|
|
16790
16788
|
if (this.caret && !same2) this.ask();
|
|
16791
16789
|
else this.draw();
|
|
16792
16790
|
}
|
|
16791
|
+
/** The window turns to the file of `module` (another declaration's, another file in File mode),
|
|
16792
|
+
* whose code it reads: a caret in the file on show goes with it — a place of one file is another
|
|
16793
|
+
* place of the next, which nobody clicked —, and nothing is asked until the window tells the new
|
|
16794
|
+
* code (`attach`). A followed reader's caret told meanwhile waits for that code. Nobody is told: the
|
|
16795
|
+
* reader did not move it. */
|
|
16796
|
+
leave(module) {
|
|
16797
|
+
const c3 = this.code;
|
|
16798
|
+
if (!c3 || c3.module === module) return;
|
|
16799
|
+
this.code = null;
|
|
16800
|
+
this.answer = null;
|
|
16801
|
+
this.turn++;
|
|
16802
|
+
this.stopWaits();
|
|
16803
|
+
if (this.caret) {
|
|
16804
|
+
this.caret = null;
|
|
16805
|
+
this.draw();
|
|
16806
|
+
}
|
|
16807
|
+
}
|
|
16793
16808
|
/** The element of line `line` of the file in the code on show, or null. */
|
|
16794
16809
|
lineEl(line) {
|
|
16795
16810
|
const c3 = this.code, l2 = this.lines;
|
|
@@ -16820,7 +16835,7 @@ var InfoView = class {
|
|
|
16820
16835
|
this.caret = { line: c3.start + to.line, ch: to.ch, after: k2.after };
|
|
16821
16836
|
this.ask();
|
|
16822
16837
|
this.hooks.moved();
|
|
16823
|
-
this.
|
|
16838
|
+
this.show(this.caret);
|
|
16824
16839
|
return true;
|
|
16825
16840
|
}
|
|
16826
16841
|
/** The caret as a followed reader's is (CollabSpec, "Surfaces"), or none: nobody is told. */
|
|
@@ -16834,9 +16849,16 @@ var InfoView = class {
|
|
|
16834
16849
|
if (!this.holds(c3.line)) return;
|
|
16835
16850
|
if (moved) {
|
|
16836
16851
|
this.ask();
|
|
16837
|
-
this.
|
|
16852
|
+
this.show(c3);
|
|
16838
16853
|
} else this.draw();
|
|
16839
16854
|
}
|
|
16855
|
+
/** The caret's place shown, stepped or followed to: what the window hides of it shown (a folded
|
|
16856
|
+
* proof), its line scrolled into sight — clear of what stands over the code's edges, File mode's
|
|
16857
|
+
* sticky header and the pane below the code (`scroll-padding`, web/style.css). */
|
|
16858
|
+
show(c3) {
|
|
16859
|
+
this.hooks.reveal?.(c3.line, c3.ch);
|
|
16860
|
+
this.lineEl(c3.line)?.scrollIntoView({ block: "nearest" });
|
|
16861
|
+
}
|
|
16840
16862
|
/** No caret here any more: another window holds the page's. */
|
|
16841
16863
|
clear() {
|
|
16842
16864
|
if (!this.caret) return;
|
|
@@ -16900,8 +16922,10 @@ var InfoView = class {
|
|
|
16900
16922
|
const focused = document.activeElement;
|
|
16901
16923
|
pane.hidden = !v2.show || hidden;
|
|
16902
16924
|
split?.classList.toggle("iv-on", v2.show && !hidden);
|
|
16903
|
-
|
|
16904
|
-
|
|
16925
|
+
const bar = split?.parentElement?.querySelector(":scope > .sw-sticky") ?? null;
|
|
16926
|
+
const home = bar ?? split;
|
|
16927
|
+
let tab = home?.querySelector(":scope > .iv-show") ?? null;
|
|
16928
|
+
if (v2.show && hidden && home) {
|
|
16905
16929
|
if (!tab) {
|
|
16906
16930
|
tab = document.createElement("button");
|
|
16907
16931
|
tab.type = "button";
|
|
@@ -16909,18 +16933,30 @@ var InfoView = class {
|
|
|
16909
16933
|
tab.dataset.ivShow = "";
|
|
16910
16934
|
tab.title = "Show the InfoView: what Lean says at the caret (kept in this browser)";
|
|
16911
16935
|
tab.innerHTML = `<span aria-hidden="true">\u22A2</span> Lean`;
|
|
16912
|
-
|
|
16936
|
+
tab.addEventListener("click", () => this.hooks.hide(false));
|
|
16937
|
+
if (bar) bar.append(tab);
|
|
16938
|
+
else home.prepend(tab);
|
|
16913
16939
|
}
|
|
16914
16940
|
} else tab?.remove();
|
|
16915
16941
|
const had = focused instanceof HTMLElement && (pane.contains(focused) || focused.matches("[data-iv-show]")) ? focused : null;
|
|
16916
16942
|
const when = had?.closest("[data-iv-when]")?.dataset.ivWhen;
|
|
16917
16943
|
if (!v2.show || hidden || !k2) {
|
|
16918
16944
|
if (had) this.hooks.win().focus({ preventScroll: true });
|
|
16919
|
-
return;
|
|
16945
|
+
return this.below();
|
|
16920
16946
|
}
|
|
16921
16947
|
pane.innerHTML = headHtml(k2, v2.sides, !!this.answer?.interactive) + `<div class="iv-body">${v2.html}</div>`;
|
|
16922
16948
|
pane.setAttribute("aria-label", "What Lean says at the caret");
|
|
16923
16949
|
if (had && !had.isConnected) (pane.querySelector(`[data-iv-when="${when}"]`) ?? this.hooks.win()).focus({ preventScroll: true });
|
|
16950
|
+
this.below();
|
|
16951
|
+
}
|
|
16952
|
+
/** How much of the code's view the pane below the code stands over, so that a line the caret
|
|
16953
|
+
* steps to is scrolled clear of it (`--iv-below`, web/style.css); none beside the code. */
|
|
16954
|
+
below() {
|
|
16955
|
+
const pane = this.pane;
|
|
16956
|
+
const split = pane?.parentElement;
|
|
16957
|
+
const scroll = split?.closest(".sw-scroll");
|
|
16958
|
+
if (!pane || !split || !scroll) return;
|
|
16959
|
+
scroll.style.setProperty("--iv-below", `${!pane.hidden && !split.classList.contains("iv-side") ? pane.offsetHeight : 0}px`);
|
|
16924
16960
|
}
|
|
16925
16961
|
/** The caret's line marked in the code, and its tactic, where the browser can (the CSS Custom
|
|
16926
16962
|
* Highlight API): marks the code keeps however often it is drawn again. */
|
|
@@ -16944,10 +16980,6 @@ var InfoView = class {
|
|
|
16944
16980
|
const split = pane.parentElement;
|
|
16945
16981
|
split?.addEventListener("click", (e2) => {
|
|
16946
16982
|
const t2 = e2.target;
|
|
16947
|
-
if (t2.closest("[data-iv-show]")) {
|
|
16948
|
-
this.hooks.hide(false);
|
|
16949
|
-
return;
|
|
16950
|
-
}
|
|
16951
16983
|
if (!pane.contains(t2)) return;
|
|
16952
16984
|
if (t2.closest("[data-iv-hide]")) return this.hooks.hide(true);
|
|
16953
16985
|
const when = t2.closest("[data-iv-when]")?.dataset.ivWhen;
|
|
@@ -17022,6 +17054,7 @@ var InfoView = class {
|
|
|
17022
17054
|
const side2 = paneSide(this.hooks.win().offsetWidth, this.hooks.fitted(), document.documentElement.clientWidth || innerWidth);
|
|
17023
17055
|
split.classList.toggle("iv-side", side2);
|
|
17024
17056
|
scroll.style.setProperty("--sw-view", `${scroll.clientHeight}px`);
|
|
17057
|
+
this.below();
|
|
17025
17058
|
}
|
|
17026
17059
|
};
|
|
17027
17060
|
function subtermHtml(r2, resolve) {
|
|
@@ -17123,8 +17156,9 @@ var Sources = class {
|
|
|
17123
17156
|
* page's own rules. The following window opens on their declaration, follows it and closes with
|
|
17124
17157
|
* theirs; a pinned window stands for each of theirs — one pinned here on the same declaration,
|
|
17125
17158
|
* else this page's following window pinned where they pinned theirs, else a new one a step aside
|
|
17126
|
-
* — and closes when theirs does
|
|
17127
|
-
*
|
|
17159
|
+
* — and closes when theirs does, or follows the selection again as theirs does when they unpin
|
|
17160
|
+
* it; each is collapsed as theirs is. Windows this reader pinned on other declarations stay, and
|
|
17161
|
+
* at most MAX_PINNED are pinned. */
|
|
17128
17162
|
mirror(s2) {
|
|
17129
17163
|
const left = new Set(this.pinned);
|
|
17130
17164
|
const states = [];
|
|
@@ -17140,6 +17174,11 @@ var Sources = class {
|
|
|
17140
17174
|
this.mirrored.add(p2);
|
|
17141
17175
|
states.push([p2, e2.collapsed, modeOf(e2)]);
|
|
17142
17176
|
}
|
|
17177
|
+
const unpinned = s2.following && s2.following.decl !== null && !this.following ? [...left].find((p2) => this.mirrored.has(p2) && p2.file === null) : void 0;
|
|
17178
|
+
if (unpinned) {
|
|
17179
|
+
left.delete(unpinned);
|
|
17180
|
+
this.unpin(unpinned, null);
|
|
17181
|
+
}
|
|
17143
17182
|
for (const p2 of left) if (this.mirrored.has(p2)) this.close(p2);
|
|
17144
17183
|
for (const e2 of missing) {
|
|
17145
17184
|
if (this.pinned.length >= MAX_PINNED) break;
|
|
@@ -17157,6 +17196,7 @@ var Sources = class {
|
|
|
17157
17196
|
p2.show(e2.decl);
|
|
17158
17197
|
}
|
|
17159
17198
|
this.pinned.push(p2);
|
|
17199
|
+
p2.front();
|
|
17160
17200
|
this.hooks.changed();
|
|
17161
17201
|
}
|
|
17162
17202
|
this.mirrored.add(p2);
|
|
@@ -17202,6 +17242,28 @@ var Sources = class {
|
|
|
17202
17242
|
this.pinAt(p2);
|
|
17203
17243
|
return true;
|
|
17204
17244
|
}
|
|
17245
|
+
/** Its pin pressed again (the owner's decision of 2026-11-08): a pinned window follows the
|
|
17246
|
+
* selection again, as it did before it was pinned — the next Space closes it, the next opening is
|
|
17247
|
+
* in it — and keeps its place. It shows the selected declaration `i`, stepped to it as the
|
|
17248
|
+
* following window steps (the pairing told of it) where it is on another; with no declaration
|
|
17249
|
+
* selected, it stays on its own until the selection changes, as it would not close under the
|
|
17250
|
+
* reader's hand. The window that followed the selection meanwhile closes: one follows at most. A
|
|
17251
|
+
* file window, pinned on its file by what it is, has no declaration to follow from: it stays. */
|
|
17252
|
+
unpin(p2, i2) {
|
|
17253
|
+
const k2 = this.pinned.indexOf(p2);
|
|
17254
|
+
if (k2 < 0 || p2.file !== null) return false;
|
|
17255
|
+
this.pinned.splice(k2, 1);
|
|
17256
|
+
this.mirrored.delete(p2);
|
|
17257
|
+
this.following?.remove();
|
|
17258
|
+
this.following = p2;
|
|
17259
|
+
p2.unpin();
|
|
17260
|
+
if (i2 !== null && p2.decl !== i2) {
|
|
17261
|
+
p2.show(i2);
|
|
17262
|
+
this.hooks.shown?.(p2, i2);
|
|
17263
|
+
}
|
|
17264
|
+
this.hooks.changed();
|
|
17265
|
+
return true;
|
|
17266
|
+
}
|
|
17205
17267
|
/** A file opened from the Files tree or the board's menu (the owner's decision of 2026-11-01): a
|
|
17206
17268
|
* file window on module `module`, pinned as it opens a step aside from the middle of the screen,
|
|
17207
17269
|
* in File mode at the file's top; one on it already comes in front instead. It is no
|
|
@@ -17320,6 +17382,12 @@ var sourceMemory = () => ({ learned: /* @__PURE__ */ new Map(), printed: /* @__P
|
|
|
17320
17382
|
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
17383
|
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
17384
|
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>`;
|
|
17385
|
+
function pinHtml(pinned, fileWindow, what) {
|
|
17386
|
+
const w2 = escapeHtml(what);
|
|
17387
|
+
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>`;
|
|
17388
|
+
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`;
|
|
17389
|
+
return `<button class="icon sw-pin" data-sw-pin aria-label="Pin" aria-pressed="${pinned}" title="${title}">${PIN}</button>`;
|
|
17390
|
+
}
|
|
17323
17391
|
var COLLAPSE = `<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 8.5h8"/></svg>`;
|
|
17324
17392
|
var READ_WAIT = 1e3;
|
|
17325
17393
|
var FILE_ANCHOR = "\u27E8file\u27E9";
|
|
@@ -17364,8 +17432,10 @@ var SourceWindow = class {
|
|
|
17364
17432
|
/** pinned: it stays on its declaration, and its place is its own */
|
|
17365
17433
|
pinned = false;
|
|
17366
17434
|
/** 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 */
|
|
17435
|
+
* the screen it stands while it is fitted to its code (asideRect), unpinned too; 0 for any other */
|
|
17368
17436
|
aside = 0;
|
|
17437
|
+
/** its pin was pressed from the keyboard's focus: the toggle has it again once drawn again */
|
|
17438
|
+
pinFocus = false;
|
|
17369
17439
|
/** bumped on every render, so a slow fetch for an earlier one is dropped */
|
|
17370
17440
|
turn = 0;
|
|
17371
17441
|
/** the code on show: its module, its first line in the file, the hash of the text */
|
|
@@ -17497,7 +17567,15 @@ var SourceWindow = class {
|
|
|
17497
17567
|
const t2 = e2.target;
|
|
17498
17568
|
if (t2.closest("[data-sw-quote]")) return this.quotePicked();
|
|
17499
17569
|
if (t2.closest("[data-sw-close]")) return this.hooks.close(this);
|
|
17500
|
-
|
|
17570
|
+
const pin = t2.closest("[data-sw-pin]");
|
|
17571
|
+
if (pin) {
|
|
17572
|
+
const was = this.pinned;
|
|
17573
|
+
this.pinFocus = document.activeElement === pin;
|
|
17574
|
+
if (was) this.hooks.unpin(this);
|
|
17575
|
+
else this.hooks.pin(this);
|
|
17576
|
+
if (this.pinned === was) this.pinFocus = false;
|
|
17577
|
+
return;
|
|
17578
|
+
}
|
|
17501
17579
|
if (t2.closest("[data-sw-back]")) return this.hooks.back();
|
|
17502
17580
|
if (t2.closest("[data-sw-fwd]")) return this.hooks.forward();
|
|
17503
17581
|
if (t2.closest(".sw-pill, [data-sw-collapse]")) return;
|
|
@@ -17566,7 +17644,8 @@ var SourceWindow = class {
|
|
|
17566
17644
|
moved: () => this.hooks.caretMoved?.(this),
|
|
17567
17645
|
win: () => this.el,
|
|
17568
17646
|
fitted: () => this.win.fitted,
|
|
17569
|
-
stale: () => void this.render(false)
|
|
17647
|
+
stale: () => void this.render(false),
|
|
17648
|
+
reveal: (line, ch) => this.unfoldAt(line, ch)
|
|
17570
17649
|
});
|
|
17571
17650
|
el.addEventListener("keydown", (e2) => {
|
|
17572
17651
|
this.keyAt = Date.now();
|
|
@@ -17726,6 +17805,14 @@ var SourceWindow = class {
|
|
|
17726
17805
|
this.win.layout();
|
|
17727
17806
|
void this.render(false);
|
|
17728
17807
|
}
|
|
17808
|
+
/** Pinned no longer (its pin pressed again, the owner's decision of 2026-11-08): it follows the
|
|
17809
|
+
* selection again, with the page's back and forward, where it stands — a place the reader or the
|
|
17810
|
+
* page gave it stays its own, one fitted to its code stays fitted there. */
|
|
17811
|
+
unpin() {
|
|
17812
|
+
this.pinned = false;
|
|
17813
|
+
this.el.classList.remove("pinned");
|
|
17814
|
+
void this.render(false);
|
|
17815
|
+
}
|
|
17729
17816
|
collapse(on) {
|
|
17730
17817
|
this.win.collapse(on);
|
|
17731
17818
|
if (on) this.unpick();
|
|
@@ -17779,6 +17866,8 @@ var SourceWindow = class {
|
|
|
17779
17866
|
this.el.classList.remove("opening", "slow");
|
|
17780
17867
|
this.el.removeAttribute("aria-busy");
|
|
17781
17868
|
this.frameEl.inert = false;
|
|
17869
|
+
if (this.pinFocus) this.frameEl.querySelector("[data-sw-pin]")?.focus();
|
|
17870
|
+
this.pinFocus = false;
|
|
17782
17871
|
for (const ok of this.waiting.splice(0)) ok();
|
|
17783
17872
|
}
|
|
17784
17873
|
/** The window goes: its cards, its place in the layer, what it waits for. */
|
|
@@ -17881,8 +17970,8 @@ var SourceWindow = class {
|
|
|
17881
17970
|
* in the file; not while the reader follows someone, whose caret it is (a click is reading then). */
|
|
17882
17971
|
caretIn(pre, node, off) {
|
|
17883
17972
|
if (!this.shown || !this.code || this.collapsed || this.hooks.following?.()) return;
|
|
17884
|
-
const at =
|
|
17885
|
-
this.info.place(
|
|
17973
|
+
const at = placeIn2(Number(pre.dataset.line ?? this.shown.start), pre.textContent ?? "", offsetIn(pre, node, off));
|
|
17974
|
+
this.info.place(at.line, at.ch);
|
|
17886
17975
|
}
|
|
17887
17976
|
/** The InfoView's caret: where it is in the file, and whether the goals after the tactic are on
|
|
17888
17977
|
* show; null where there is none in this window. */
|
|
@@ -18140,6 +18229,7 @@ var SourceWindow = class {
|
|
|
18140
18229
|
this.unpick();
|
|
18141
18230
|
const g2 = this.g;
|
|
18142
18231
|
const v2 = g2.nodes[i2];
|
|
18232
|
+
this.info.leave(v2.module);
|
|
18143
18233
|
const parts = v2.name.split(".");
|
|
18144
18234
|
const ext = g2.isExt(i2);
|
|
18145
18235
|
const kind = ext ? "external" : v2.kind;
|
|
@@ -18155,7 +18245,7 @@ var SourceWindow = class {
|
|
|
18155
18245
|
const pinned = this.pinned;
|
|
18156
18246
|
const steps = () => this.hooks.steps();
|
|
18157
18247
|
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
|
|
18248
|
+
const pin = pinHtml(pinned, false, v2.name);
|
|
18159
18249
|
let remote = null;
|
|
18160
18250
|
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
18251
|
const frame2 = (where, notes2, body, editor = this.still ? null : this.hooks.editorLink(g2, i2), final = true) => {
|
|
@@ -18324,7 +18414,7 @@ var SourceWindow = class {
|
|
|
18324
18414
|
const pinned = this.pinned;
|
|
18325
18415
|
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
18416
|
const what = this.file !== null ? `the file ${this.file}` : this.g.nodes[this.current].name;
|
|
18327
|
-
const pin = pinned
|
|
18417
|
+
const pin = pinHtml(pinned, this.file !== null, what);
|
|
18328
18418
|
let title;
|
|
18329
18419
|
if (this.file !== null) {
|
|
18330
18420
|
const parts = this.file.split(".");
|
|
@@ -18361,6 +18451,7 @@ var SourceWindow = class {
|
|
|
18361
18451
|
const v2 = i2 >= 0 ? g2.nodes[i2] : null;
|
|
18362
18452
|
const module = this.file ?? v2?.module;
|
|
18363
18453
|
if (!module) return;
|
|
18454
|
+
this.info.leave(module);
|
|
18364
18455
|
const turn = ++this.turn;
|
|
18365
18456
|
this.hideTip();
|
|
18366
18457
|
this.unpick();
|
|
@@ -18678,6 +18769,16 @@ var SourceWindow = class {
|
|
|
18678
18769
|
if (b2) b2.outerHTML = this.foldsButton();
|
|
18679
18770
|
this.updateSticky();
|
|
18680
18771
|
}
|
|
18772
|
+
/** The folded proof that holds (line, ch) of the file shown, as a click on its mark shows it: the
|
|
18773
|
+
* InfoView's caret stepped or followed into it (the owner's decisions of 2026-11-08, 0.11). */
|
|
18774
|
+
unfoldAt(line, ch) {
|
|
18775
|
+
const w2 = this.whole;
|
|
18776
|
+
if (this.mode !== "file" || !w2 || !this.hooks.foldProofs()) return;
|
|
18777
|
+
const upTo = (p2) => p2[0] < line || p2[0] === line && p2[1] <= ch;
|
|
18778
|
+
const f2 = w2.folds.find((x2) => upTo(x2.from) && !upTo(x2.to));
|
|
18779
|
+
const id = f2 ? `${f2.from[0]}:${f2.from[1]}` : null;
|
|
18780
|
+
if (id && !this.openFolds.has(id)) this.openFold(id);
|
|
18781
|
+
}
|
|
18681
18782
|
/** A folded proof opened: that one alone, its place staying. */
|
|
18682
18783
|
openFold(id) {
|
|
18683
18784
|
this.openFolds.add(id);
|
|
@@ -42172,6 +42273,8 @@ function panelsPart(page) {
|
|
|
42172
42273
|
compiledOf: (m3) => page.compiled.get(m3),
|
|
42173
42274
|
close: (w2) => sources.close(w2),
|
|
42174
42275
|
pin: (w2) => void sources.pin(w2),
|
|
42276
|
+
// unpinned, it follows the selection again: the panel's declaration
|
|
42277
|
+
unpin: (w2) => void sources.unpin(w2, selected()),
|
|
42175
42278
|
// a source window collapsed or opened again leaves or takes its side of the reference window
|
|
42176
42279
|
// paired with it, the two kept apart as the pairing shows them (AttachmentSpec decision 8)
|
|
42177
42280
|
collapsed: () => {
|
|
@@ -46192,7 +46295,7 @@ var GraphCanvas = class {
|
|
|
46192
46295
|
const { x: cx, y: cy, k: k2 } = this.cam;
|
|
46193
46296
|
const sx = (x2) => (x2 - cx) * k2 + this.w / 2, sy = (y2) => (y2 - cy) * k2 + this.h / 2;
|
|
46194
46297
|
const dot = this.dotPx();
|
|
46195
|
-
const
|
|
46298
|
+
const meets2 = (x0, y0, x1, y1) => x1 >= rect.x && y1 >= rect.y && x0 <= rect.x + rect.w && y0 <= rect.y + rect.h;
|
|
46196
46299
|
const P2 = this.posData;
|
|
46197
46300
|
const out = [];
|
|
46198
46301
|
const four = (d2, o2) => [d2[o2], d2[o2 + 1], d2[o2 + 2], d2[o2 + 3]];
|
|
@@ -46206,7 +46309,7 @@ var GraphCanvas = class {
|
|
|
46206
46309
|
const x2 = sx(d2[o2]), y2 = sy(d2[o2 + 1]);
|
|
46207
46310
|
const ring = d2[o2 + 12], ringR = r2 + d2[o2 + 14];
|
|
46208
46311
|
const ext = Math.max(r2, ringR + ring / 2);
|
|
46209
|
-
if (!
|
|
46312
|
+
if (!meets2(x2 - ext, y2 - ext, x2 + ext, y2 + ext)) continue;
|
|
46210
46313
|
const fill = four(d2, o2 + 4), stroke = ring > 0 && d2[o2 + 11] > 0 ? four(d2, o2 + 8) : null;
|
|
46211
46314
|
if (fill[3] <= 2e-3 && !stroke) continue;
|
|
46212
46315
|
const flags = Math.round(d2[o2 + 13]);
|
|
@@ -46225,7 +46328,7 @@ var GraphCanvas = class {
|
|
|
46225
46328
|
});
|
|
46226
46329
|
} else if (L2.kind === "lines") {
|
|
46227
46330
|
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 (!
|
|
46331
|
+
if (!meets2(Math.min(x0, x1) - w2, Math.min(y0, y1) - w2, Math.max(x0, x1) + w2, Math.max(y0, y1) + w2)) continue;
|
|
46229
46332
|
out.push({ kind: "line", x0, y0, x1, y1, colour: four(d2, o2 + 4), width: w2 });
|
|
46230
46333
|
} else {
|
|
46231
46334
|
const len = Math.round(d2[o2 + 8]);
|
|
@@ -46238,7 +46341,7 @@ var GraphCanvas = class {
|
|
|
46238
46341
|
[x0, y0, x1, y1] = [Math.min(x0, x2), Math.min(y0, y2), Math.max(x1, x2), Math.max(y1, y2)];
|
|
46239
46342
|
}
|
|
46240
46343
|
const w2 = d2[o2 + 10];
|
|
46241
|
-
if (!
|
|
46344
|
+
if (!meets2(x0 - w2, y0 - w2, x1 + w2, y1 + w2)) continue;
|
|
46242
46345
|
out.push({ kind: "bundle", ctrl, beta: d2[o2 + 9], width: w2, c0: four(d2, o2 + 12), c1: four(d2, o2 + 16) });
|
|
46243
46346
|
}
|
|
46244
46347
|
}
|
|
@@ -48756,7 +48859,7 @@ function inside(f2) {
|
|
|
48756
48859
|
const len = Math.hypot(f2[0], f2[1]);
|
|
48757
48860
|
return len > 1 ? [f2[0] / len, f2[1] / len] : f2;
|
|
48758
48861
|
}
|
|
48759
|
-
function
|
|
48862
|
+
function placeIn3(world, clusters, b2) {
|
|
48760
48863
|
const [wx, wy] = world;
|
|
48761
48864
|
let best = -1;
|
|
48762
48865
|
clusters.forEach((c3, k2) => {
|
|
@@ -49722,7 +49825,7 @@ var Stickies = class {
|
|
|
49722
49825
|
if (!b2 || !nb) return null;
|
|
49723
49826
|
if (kind === "view") return { kind, place: placeAt(b2.mode, world, this.clusters()) };
|
|
49724
49827
|
const clusters = this.clusters(true);
|
|
49725
|
-
const inside3 =
|
|
49828
|
+
const inside3 = placeIn3(world, clusters, nb);
|
|
49726
49829
|
if (inside3) return { kind, mode: b2.mode, place: inside3 };
|
|
49727
49830
|
const ring = this.ring ?? this.ringNow();
|
|
49728
49831
|
return ring ? { kind, mode: b2.mode, place: { ring: angleOf(ring, world[0], world[1]) } } : null;
|
|
@@ -53654,8 +53757,6 @@ var ChatWindow = class {
|
|
|
53654
53757
|
}
|
|
53655
53758
|
},
|
|
53656
53759
|
keepsCollapsed: true,
|
|
53657
|
-
// its own layer, above the source and reference windows' order (ReviewSpec, "In front")
|
|
53658
|
-
onTop: true,
|
|
53659
53760
|
start: (vp) => defaultRect(vp, this.hooks.insets()),
|
|
53660
53761
|
live: () => this.shown,
|
|
53661
53762
|
collapsed: (on) => {
|
|
@@ -53682,8 +53783,8 @@ var ChatWindow = class {
|
|
|
53682
53783
|
get reading() {
|
|
53683
53784
|
return this.shown && !this.win.collapsed && !document.hidden;
|
|
53684
53785
|
}
|
|
53685
|
-
/** Open it, as kept (collapsed or not, where the reader put it)
|
|
53686
|
-
* kept, as asked for from a menu or a notice. */
|
|
53786
|
+
/** Open it, as kept (collapsed or not, where the reader put it), in front of the other windows;
|
|
53787
|
+
* `expand`: expanded whatever was kept, as asked for from a menu or a notice. */
|
|
53687
53788
|
show(expand2 = false) {
|
|
53688
53789
|
if (!this.shown) {
|
|
53689
53790
|
this.shown = true;
|
|
@@ -53694,8 +53795,14 @@ var ChatWindow = class {
|
|
|
53694
53795
|
}
|
|
53695
53796
|
if (expand2 && this.win.collapsed) this.win.collapse(false);
|
|
53696
53797
|
this.win.layout();
|
|
53798
|
+
this.win.front();
|
|
53697
53799
|
if (!this.win.collapsed) this.hooks.expanded();
|
|
53698
53800
|
}
|
|
53801
|
+
/** Whether another window lies over it where they meet: the conversation button then brings it in
|
|
53802
|
+
* front, rather than closing it. */
|
|
53803
|
+
get covered() {
|
|
53804
|
+
return this.shown && this.win.covered;
|
|
53805
|
+
}
|
|
53699
53806
|
/** The reader closed it: its ✕, or the conversation button again. */
|
|
53700
53807
|
close() {
|
|
53701
53808
|
if (!this.shown) return;
|
|
@@ -54178,11 +54285,14 @@ function followPart(page) {
|
|
|
54178
54285
|
// the reference window (AttachmentSpec decision 11)
|
|
54179
54286
|
paper: () => page.papers.state() ? { paper: page.papers.state() } : {},
|
|
54180
54287
|
// 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
|
|
54288
|
+
// page's one, in the window the reader put it in — a file window's by its file (the owner's
|
|
54289
|
+
// decisions of 2026-11-08, 0.11: the InfoView in File mode)
|
|
54182
54290
|
caret: () => {
|
|
54183
54291
|
const w2 = page.sources.all.find((p2) => p2.caret);
|
|
54184
54292
|
const c3 = w2?.caret;
|
|
54185
|
-
|
|
54293
|
+
if (!w2 || !c3) return {};
|
|
54294
|
+
const where = w2.file !== null ? { file: w2.file } : { decl: w2.name, ...w2 !== page.sources.following ? { pinned: true } : {} };
|
|
54295
|
+
return { caret: { ...where, line: c3.line, character: c3.ch, ...c3.after ? { after: true } : {} } };
|
|
54186
54296
|
},
|
|
54187
54297
|
activity: () => ({ activity: page.activity.state() }),
|
|
54188
54298
|
lostFound: () => ({ lostFound: { open: page.lostDrawer.open } }),
|
|
@@ -54249,7 +54359,7 @@ function followPart(page) {
|
|
|
54249
54359
|
});
|
|
54250
54360
|
const c3 = v2.caret;
|
|
54251
54361
|
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
|
|
54362
|
+
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
54363
|
for (const p2 of page.sources.all) p2.followCaret(p2 === at && c3 ? { line: c3.line, ch: c3.character, after: c3.after === true } : null);
|
|
54254
54364
|
}
|
|
54255
54365
|
if (once) {
|
|
@@ -54329,7 +54439,7 @@ function talkPart(page) {
|
|
|
54329
54439
|
const talkBtn = $("#talk-btn");
|
|
54330
54440
|
talkBtn.hidden = !!reader || !!data.snapshot;
|
|
54331
54441
|
talkBtn.addEventListener("click", () => {
|
|
54332
|
-
if (page.chatWin.open && !page.chatWin.collapsed) page.chatWin.close();
|
|
54442
|
+
if (page.chatWin.open && !page.chatWin.collapsed && !page.chatWin.covered) page.chatWin.close();
|
|
54333
54443
|
else page.chatWin.show(true);
|
|
54334
54444
|
});
|
|
54335
54445
|
let noticeTimer = null;
|
|
@@ -56264,6 +56374,8 @@ function sharePart(page) {
|
|
|
56264
56374
|
// what the reader sees (the owner's decision of 2026-10-12): every followed part as the registry
|
|
56265
56375
|
// reads it, the camera as the region of the board it shows
|
|
56266
56376
|
snapshot: () => writeSnapshot(followedOf(page.parts.read), page.canvas.screen),
|
|
56377
|
+
// the reader's own conversation with the server's agent (AgentSpec decision 10)
|
|
56378
|
+
talk: (agent) => page.talk.open(agent),
|
|
56267
56379
|
exact: {
|
|
56268
56380
|
get: () => S7.shareExact !== false,
|
|
56269
56381
|
set: (on) => {
|
|
@@ -57946,6 +58058,10 @@ function livePart(page) {
|
|
|
57946
58058
|
const d2 = JSON.parse(e2.data);
|
|
57947
58059
|
page.talk.add(d2.channel, d2.message);
|
|
57948
58060
|
});
|
|
58061
|
+
es.addEventListener("chat-state", (e2) => {
|
|
58062
|
+
const d2 = JSON.parse(e2.data);
|
|
58063
|
+
page.talk.sessionState(d2.channel, d2.talk);
|
|
58064
|
+
});
|
|
57949
58065
|
es.addEventListener("ask", (e2) => page.asking.asked(JSON.parse(e2.data)));
|
|
57950
58066
|
es.addEventListener("ask-answer", (e2) => page.asking.answered(JSON.parse(e2.data)));
|
|
57951
58067
|
es.addEventListener("ask-end", (e2) => page.asking.ended(JSON.parse(e2.data).id));
|
|
@@ -59829,7 +59945,7 @@ var TIPS = [
|
|
|
59829
59945
|
id: "conversations",
|
|
59830
59946
|
group: "together",
|
|
59831
59947
|
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
|
|
59948
|
+
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
59949
|
who: "full",
|
|
59834
59950
|
where: "both",
|
|
59835
59951
|
since: "0.6.0",
|
|
@@ -59839,11 +59955,11 @@ var TIPS = [
|
|
|
59839
59955
|
{
|
|
59840
59956
|
id: "agent-here",
|
|
59841
59957
|
group: "together",
|
|
59842
|
-
title: "
|
|
59843
|
-
text: "Where the server
|
|
59958
|
+
title: "The server's agent",
|
|
59959
|
+
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
59960
|
who: "full",
|
|
59845
59961
|
where: "both",
|
|
59846
|
-
since: "0.
|
|
59962
|
+
since: "0.11.0",
|
|
59847
59963
|
about: ["#share-pop [data-tab=agent]", "#convo"],
|
|
59848
59964
|
manual: "together"
|
|
59849
59965
|
},
|