visualproof 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/mcp/visualproof-mcp.mjs +36 -6
- package/dist/server/agent.js +7 -1
- package/dist/server/agententry.js +29 -11
- package/dist/server/agenttalk.js +46 -4
- package/dist/server/app.js +6 -1
- package/dist/server/appagent.js +8 -2
- package/dist/server/appshare.js +27 -4
- package/dist/server/apptalk.js +56 -16
- package/dist/server/children.js +6 -2
- package/dist/server/doctor.js +8 -0
- package/dist/server/hosted.js +695 -0
- package/dist/server/live.js +56 -13
- package/dist/server/main.js +44 -0
- package/dist/server/mcptools.js +4 -2
- package/dist/server/options.js +38 -1
- package/dist/server/presence.js +2 -2
- package/dist/server/prompt.js +33 -0
- package/dist/server/serveragent.js +117 -0
- package/dist/server/talk.js +39 -3
- package/dist/server/tokens.js +17 -4
- package/dist/shared/collab.js +13 -3
- package/dist/web/bundle/app.js +266 -60
- package/dist/web/index.html +1 -0
- package/dist/web/style.css +33 -10
- package/docs/agent-api/mcp.md +4 -1
- package/docs/agent-api/talking.md +24 -0
- package/package.json +1 -1
package/dist/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,6 +5346,7 @@ 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" }),
|
|
5349
|
+
stopAgent: async () => ({ error: "a snapshot has no server" }),
|
|
5343
5350
|
setIdentity: async () => ({ error: "a snapshot has no server" }),
|
|
5344
5351
|
invites: async () => null,
|
|
5345
5352
|
invite: async () => ({ error: "a snapshot has no server to invite anyone to" }),
|
|
@@ -5431,10 +5438,11 @@ function serverSource() {
|
|
|
5431
5438
|
updates: () => fetch("/api/updates").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2 && typeof b2.running === "string" ? b2 : null).catch(() => null),
|
|
5432
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()),
|
|
5433
5440
|
tourJson: () => fetch("/tips/tour.json").then((r2) => r2.ok ? r2.json() : null).catch(() => null),
|
|
5434
|
-
agentShares: () => fetch("/api/share/agents").then((r2) => r2.ok ? r2.json() : null).catch(() => null),
|
|
5441
|
+
agentShares: () => fetch("/api/share/agents", { headers: headers() }).then((r2) => r2.ok ? r2.json() : null).catch(() => null),
|
|
5435
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" })),
|
|
5436
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" })),
|
|
5437
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" })),
|
|
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" })),
|
|
5438
5446
|
chat: (channel, before) => fetch(`/api/chat?channel=${encodeURIComponent(channel)}${before ? `&before=${before}` : ""}`, { headers: headers() }).then((r2) => r2.ok ? r2.json() : null).catch(() => null),
|
|
5439
5447
|
// a private reader's message says who wrote it, not where they are (CollabSpec decision 8)
|
|
5440
5448
|
sendChat: (channel, text2, place2) => fetch("/api/chat", { method: "POST", headers: headers(), body: JSON.stringify({ channel, text: text2, place: src.privateSession ? null : place2 }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
@@ -6338,7 +6346,7 @@ var FocusMenu = class {
|
|
|
6338
6346
|
};
|
|
6339
6347
|
|
|
6340
6348
|
// src/web/src/reload.ts
|
|
6341
|
-
var PAGE_VERSION = true ? "0.
|
|
6349
|
+
var PAGE_VERSION = true ? "0.11.0" : null;
|
|
6342
6350
|
var KEY = "visualproof:reload";
|
|
6343
6351
|
var FOR_KEY = "visualproof:reloaded-for";
|
|
6344
6352
|
var FRESH_MS = 10 * 6e4;
|
|
@@ -9920,6 +9928,9 @@ var Talk = class {
|
|
|
9920
9928
|
restarting = false;
|
|
9921
9929
|
/** the conversations before the last divider are shown, not folded into one line */
|
|
9922
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();
|
|
9923
9934
|
/** the page may read the conversations: a name given, and not a read-only reader's */
|
|
9924
9935
|
named = false;
|
|
9925
9936
|
/** counts the seconds of a thinking agent */
|
|
@@ -9964,6 +9975,7 @@ var Talk = class {
|
|
|
9964
9975
|
if (t2.closest("[data-fold]")) return this.toggleFold();
|
|
9965
9976
|
if (t2.closest("[data-cv-older]")) return void this.older();
|
|
9966
9977
|
if (t2.closest("[data-cv-new]")) return void this.restart();
|
|
9978
|
+
if (t2.closest("[data-cv-stop]")) return void this.stopTurn();
|
|
9967
9979
|
if (t2.closest("[data-cv-link]")) return void this.insertSeen();
|
|
9968
9980
|
if (t2.closest("[data-cv-name]")) return void this.hooks.ensureName();
|
|
9969
9981
|
const site = t2.closest("[data-site]");
|
|
@@ -9994,9 +10006,10 @@ var Talk = class {
|
|
|
9994
10006
|
for (const [k2, v2] of kept) if (!this.drafts.has(k2)) this.drafts.set(k2, v2);
|
|
9995
10007
|
}
|
|
9996
10008
|
// ---------------------------------------------------------------- the channels
|
|
9997
|
-
/** 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. */
|
|
9998
10011
|
own() {
|
|
9999
|
-
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);
|
|
10000
10013
|
}
|
|
10001
10014
|
/** The channels the reader has: Everyone, then each of their own agents. */
|
|
10002
10015
|
channels() {
|
|
@@ -10038,6 +10051,7 @@ var Talk = class {
|
|
|
10038
10051
|
* (what came while it was away), and what the reader may read is known again. */
|
|
10039
10052
|
connected() {
|
|
10040
10053
|
this.read.clear();
|
|
10054
|
+
this.sessions.clear();
|
|
10041
10055
|
this.identity();
|
|
10042
10056
|
}
|
|
10043
10057
|
/** Who the reader is changed (a name given or changed, a personal link): what they may read. */
|
|
@@ -10047,6 +10061,7 @@ var Talk = class {
|
|
|
10047
10061
|
if (!named2) this.threads.clear();
|
|
10048
10062
|
this.named = named2;
|
|
10049
10063
|
this.read.clear();
|
|
10064
|
+
this.sessions.clear();
|
|
10050
10065
|
this.render();
|
|
10051
10066
|
this.count();
|
|
10052
10067
|
if (!named2) return;
|
|
@@ -10060,7 +10075,7 @@ var Talk = class {
|
|
|
10060
10075
|
this.renderTabs();
|
|
10061
10076
|
this.renderState();
|
|
10062
10077
|
this.renderForm(false);
|
|
10063
|
-
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(" ");
|
|
10064
10079
|
if (read2 !== this.readSig) {
|
|
10065
10080
|
this.readSig = read2;
|
|
10066
10081
|
const el = this.thread();
|
|
@@ -10070,11 +10085,27 @@ var Talk = class {
|
|
|
10070
10085
|
else el.scrollTop = top;
|
|
10071
10086
|
}
|
|
10072
10087
|
this.renderPill();
|
|
10088
|
+
this.renderRestart();
|
|
10073
10089
|
if (this.named) {
|
|
10074
10090
|
for (const c3 of this.channels()) if (!this.read.has(c3)) void this.load(c3);
|
|
10075
10091
|
}
|
|
10076
10092
|
this.count();
|
|
10077
10093
|
}
|
|
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. */
|
|
10102
|
+
async stopTurn() {
|
|
10103
|
+
const a3 = this.agentOf(this.channel);
|
|
10104
|
+
if (!a3 || a3.runs !== "server") return;
|
|
10105
|
+
const r2 = await this.hooks.data.stopAgent(a3.id);
|
|
10106
|
+
this.error = r2.error ?? null;
|
|
10107
|
+
this.renderForm(false);
|
|
10108
|
+
}
|
|
10078
10109
|
/** Read a channel, once per connection: what it holds now, with what came meanwhile. */
|
|
10079
10110
|
async load(channel) {
|
|
10080
10111
|
if (!this.named || this.read.has(channel) || this.loading.has(channel)) return;
|
|
@@ -10086,6 +10117,10 @@ var Talk = class {
|
|
|
10086
10117
|
} else {
|
|
10087
10118
|
this.read.add(channel);
|
|
10088
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
|
+
}
|
|
10089
10124
|
}
|
|
10090
10125
|
if (channel === this.channel) {
|
|
10091
10126
|
this.renderThread();
|
|
@@ -10143,7 +10178,8 @@ var Talk = class {
|
|
|
10143
10178
|
/** The button's count and mark, from what is unseen. */
|
|
10144
10179
|
count() {
|
|
10145
10180
|
if (!this.named) return this.hooks.counted(0, false);
|
|
10146
|
-
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));
|
|
10147
10183
|
this.hooks.counted(u2.count, u2.marked);
|
|
10148
10184
|
}
|
|
10149
10185
|
/** The window opened, or opened again from its pill: the thread shows where it ends. */
|
|
@@ -10265,7 +10301,8 @@ var Talk = class {
|
|
|
10265
10301
|
for (const a3 of this.own()) {
|
|
10266
10302
|
const t2 = a3.talk;
|
|
10267
10303
|
const news = (this.threads.get(a3.id) ?? []).some((m3) => m3.kind === "agent" && m3.id > (seen[a3.id] ?? 0));
|
|
10268
|
-
|
|
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`);
|
|
10269
10306
|
}
|
|
10270
10307
|
if (box.innerHTML !== html) box.innerHTML = html;
|
|
10271
10308
|
}
|
|
@@ -10280,7 +10317,7 @@ var Talk = class {
|
|
|
10280
10317
|
const messages = this.threads.get(this.channel) ?? [];
|
|
10281
10318
|
const a3 = this.agentOf(this.channel);
|
|
10282
10319
|
if (!messages.length) {
|
|
10283
|
-
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>`;
|
|
10284
10321
|
return;
|
|
10285
10322
|
}
|
|
10286
10323
|
const f2 = fold(messages);
|
|
@@ -10350,7 +10387,7 @@ var Talk = class {
|
|
|
10350
10387
|
const t2 = a3?.talk;
|
|
10351
10388
|
const off = !this.named || !!a3 && (!t2 || t2.state === "offline");
|
|
10352
10389
|
const who = a3?.name ?? "the agent";
|
|
10353
|
-
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`;
|
|
10354
10391
|
const box = this.input.el;
|
|
10355
10392
|
const was = box.dataset.channel;
|
|
10356
10393
|
this.input.enable(!off, placeholder);
|
|
@@ -10369,13 +10406,15 @@ var Talk = class {
|
|
|
10369
10406
|
renderRestart() {
|
|
10370
10407
|
const b2 = this.el.querySelector("[data-cv-new]");
|
|
10371
10408
|
const a3 = this.named ? this.agentOf(this.channel) : null;
|
|
10409
|
+
const stop = this.el.querySelector("[data-cv-stop]");
|
|
10410
|
+
if (stop) stop.hidden = !(a3 && a3.runs === "server" && !a3.talk?.queued && (a3.talk?.state === "thinking" || a3.talk?.state === "working"));
|
|
10372
10411
|
if (!b2) return;
|
|
10373
10412
|
b2.hidden = !a3;
|
|
10374
10413
|
if (!a3) return;
|
|
10375
10414
|
const t2 = this.threads.get(this.channel) ?? [];
|
|
10376
10415
|
const off = this.loading.has(this.channel) || this.restarting || fresh2(t2);
|
|
10377
10416
|
b2.setAttribute("aria-disabled", String(off));
|
|
10378
|
-
b2.title = fresh2(t2) ? "A new conversation already: nothing was said since it began" : `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.`;
|
|
10379
10418
|
}
|
|
10380
10419
|
/** The pill the window collapses to: the channel on show and the start of its last message. */
|
|
10381
10420
|
renderPill() {
|
|
@@ -10384,7 +10423,7 @@ var Talk = class {
|
|
|
10384
10423
|
const a3 = this.agentOf(this.channel);
|
|
10385
10424
|
const t2 = a3?.talk;
|
|
10386
10425
|
const last2 = (this.threads.get(this.channel) ?? []).findLast((m3) => m3.kind !== "divider");
|
|
10387
|
-
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;
|
|
10388
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>` : "");
|
|
10389
10428
|
el.parentElement?.setAttribute("title", `${t2 ? `${stateWords(t2)}. ` : ""}Open the conversations`);
|
|
10390
10429
|
}
|
|
@@ -10401,14 +10440,16 @@ function chipInner(c3) {
|
|
|
10401
10440
|
return `${LINK}<span class="cv-cl">${words}${name}${c3.more ? ` +${c3.more}` : ""}</span>`;
|
|
10402
10441
|
}
|
|
10403
10442
|
function ownAgents(peers, me) {
|
|
10404
|
-
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)));
|
|
10405
10444
|
}
|
|
10406
|
-
function unseen(threads, seen, me, agents) {
|
|
10445
|
+
function unseen(threads, seen, me, agents, shared = []) {
|
|
10407
10446
|
let count2 = 0;
|
|
10408
10447
|
let marked2 = false;
|
|
10409
10448
|
const mine = (m3) => m3.kind !== "agent" && me !== null && sameName(m3.from, me);
|
|
10410
10449
|
const ownNames = /* @__PURE__ */ new Set();
|
|
10411
|
-
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
|
+
}
|
|
10412
10453
|
for (const m3 of threads.get(PUBLIC) ?? []) {
|
|
10413
10454
|
if (m3.id <= (seen[PUBLIC] ?? 0) || m3.kind === "divider" || mine(m3)) continue;
|
|
10414
10455
|
count2++;
|
|
@@ -10458,7 +10499,7 @@ function elapsed(iso, now = Date.now()) {
|
|
|
10458
10499
|
return m3 < 60 ? `${m3} min` : `${Math.floor(m3 / 60)} h${m3 % 60 ? ` ${m3 % 60} min` : ""}`;
|
|
10459
10500
|
}
|
|
10460
10501
|
function stateLine(t2, resolve, now = Date.now()) {
|
|
10461
|
-
const parts = [t2.state];
|
|
10502
|
+
const parts = [t2.queued ? "waiting its turn" : t2.state];
|
|
10462
10503
|
if (t2.state === "thinking") parts.push(elapsed(t2.since, now));
|
|
10463
10504
|
const what = t2.status ?? t2.doing;
|
|
10464
10505
|
const busy = t2.state === "thinking" || t2.state === "working";
|
|
@@ -10473,6 +10514,7 @@ function stateWords(t2, now = Date.now()) {
|
|
|
10473
10514
|
case "listening":
|
|
10474
10515
|
return "listening: what you write reaches it at once";
|
|
10475
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`;
|
|
10476
10518
|
return `thinking for ${elapsed(t2.since, now)}${what ? `: ${what}` : ""}`;
|
|
10477
10519
|
case "working":
|
|
10478
10520
|
return `working${what ? `: ${what}` : ""}; what you write waits for its next wait`;
|
|
@@ -10549,6 +10591,10 @@ var Share = class {
|
|
|
10549
10591
|
else if (t2.closest("[data-again]")) {
|
|
10550
10592
|
this.agent = { kind: "form", error: null };
|
|
10551
10593
|
this.render();
|
|
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);
|
|
10552
10598
|
} else if (t2.closest("[data-show]")) void this.showPrompt(t2.closest("[data-show]").dataset.show);
|
|
10553
10599
|
else if (t2.closest("[data-revoke]")) void this.revoke(t2.closest("[data-revoke]").dataset.revoke);
|
|
10554
10600
|
else if (t2.closest("[data-close]")) this.close();
|
|
@@ -10622,7 +10668,7 @@ var Share = class {
|
|
|
10622
10668
|
this.pop.hidden = false;
|
|
10623
10669
|
this.btn.classList.add("on");
|
|
10624
10670
|
this.arming = null;
|
|
10625
|
-
if (this.agent.kind
|
|
10671
|
+
if (this.agent.kind !== "form") this.agent = { kind: "form", error: null };
|
|
10626
10672
|
this.info = await this.shareInfo();
|
|
10627
10673
|
if (this.info.readOnly) return this.show("readonly");
|
|
10628
10674
|
if (this.tab === "readonly" && !this.readOnlyTab()) this.tab = "person";
|
|
@@ -10679,7 +10725,7 @@ var Share = class {
|
|
|
10679
10725
|
if (!this.shares.levels.includes(this.form.level)) this.form.level = this.shares.defaultLevel;
|
|
10680
10726
|
if (!this.shares.days.includes(this.form.days)) this.form.days = this.shares.defaultDays;
|
|
10681
10727
|
const a3 = this.agent;
|
|
10682
|
-
if (a3.kind
|
|
10728
|
+
if (a3.kind !== "form" && !this.shares.tokens.some((t2) => t2.id === a3.id)) this.agent = { kind: "form", error: null };
|
|
10683
10729
|
}
|
|
10684
10730
|
if (!this.pop.hidden) this.render();
|
|
10685
10731
|
}
|
|
@@ -10831,7 +10877,16 @@ var Share = class {
|
|
|
10831
10877
|
const me = this.hooks.me();
|
|
10832
10878
|
const name = f2.name ?? (me ? defaultAgentName(me) : "");
|
|
10833
10879
|
const option = (v2, label, on) => `<option value="${v2}"${on ? " selected" : ""}>${escapeHtml(label)}</option>`;
|
|
10834
|
-
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><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>`;
|
|
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>`;
|
|
10835
10890
|
}
|
|
10836
10891
|
/** The name an agent named `name` would act under: the reader's AI when the field is empty,
|
|
10837
10892
|
* numbered when one in force has it. */
|
|
@@ -10852,8 +10907,9 @@ var Share = class {
|
|
|
10852
10907
|
const armed = this.arming === t2.id;
|
|
10853
10908
|
const shown2 = this.agent.kind === "prompt" && this.agent.id === t2.id && this.tab === "agent";
|
|
10854
10909
|
const id = escapeHtml(t2.id);
|
|
10855
|
-
const
|
|
10856
|
-
|
|
10910
|
+
const here = t2.runs === "server";
|
|
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>`;
|
|
10857
10913
|
}
|
|
10858
10914
|
/** Make the token and its prompt, under the reader's name (asked for if there is none). */
|
|
10859
10915
|
async create() {
|
|
@@ -11509,7 +11565,7 @@ var FOLLOWED = [
|
|
|
11509
11565
|
}
|
|
11510
11566
|
];
|
|
11511
11567
|
var YOURS = [
|
|
11512
|
-
{ 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" },
|
|
11513
11569
|
{ id: "scroll", what: "scroll positions: the wheel off the canvas, a scrollbar" },
|
|
11514
11570
|
{ id: "sections", what: "folded sections of the side panel, the panel and the lost-and-found", where: "[data-sec], #lostfound .lf-archived > summary" },
|
|
11515
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]" },
|
|
@@ -12262,7 +12318,7 @@ var People = class {
|
|
|
12262
12318
|
const s2 = p2.sessions[0];
|
|
12263
12319
|
const where = s2.view ? this.hooks.describe(s2.view) : "";
|
|
12264
12320
|
const who = p2.name ? this.nameOf(p2) : "A reader without a name";
|
|
12265
|
-
const talk = s2.talk ?
|
|
12321
|
+
const talk = s2.talk ? `${s2.runs === "server" ? " \xB7 this server's agent, which everyone talks with" : ""} \xB7 ${stateWords(s2.talk)}` : "";
|
|
12266
12322
|
const ask = p2.agent ? null : this.hooks.asked?.(p2) ?? null;
|
|
12267
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";
|
|
12268
12324
|
const fol = following.has(p2.key);
|
|
@@ -16125,6 +16181,12 @@ function cascadeRect(from, taken, vp, min, top = EDGE) {
|
|
|
16125
16181
|
function raise(order, x2) {
|
|
16126
16182
|
return [...order.filter((y2) => y2 !== x2), x2];
|
|
16127
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
|
+
}
|
|
16128
16190
|
var EDGES = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
|
|
16129
16191
|
var DRAG_PX = 3;
|
|
16130
16192
|
var viewport = () => ({ w: document.documentElement.clientWidth || innerWidth, h: document.documentElement.clientHeight || innerHeight });
|
|
@@ -16185,12 +16247,23 @@ var FloatWindow = class {
|
|
|
16185
16247
|
get fitted() {
|
|
16186
16248
|
return this.fitting;
|
|
16187
16249
|
}
|
|
16188
|
-
/** Bring the window to the front of the others
|
|
16250
|
+
/** Bring the window to the front of the others. */
|
|
16189
16251
|
front() {
|
|
16190
|
-
if (
|
|
16252
|
+
if (stack[stack.length - 1] === this.el) return;
|
|
16191
16253
|
stack = raise(stack, this.el);
|
|
16192
16254
|
restack();
|
|
16193
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
|
+
}
|
|
16194
16267
|
/** The window goes for good: it is no longer kept in step with the viewport. */
|
|
16195
16268
|
dispose() {
|
|
16196
16269
|
window.removeEventListener("resize", this.resized);
|
|
@@ -16623,6 +16696,10 @@ function caretOf(text2, offset) {
|
|
|
16623
16696
|
const nl = before.lastIndexOf("\n");
|
|
16624
16697
|
return { line: before.split("\n").length - 1, ch: before.length - (nl + 1) };
|
|
16625
16698
|
}
|
|
16699
|
+
function placeIn2(start, text2, offset) {
|
|
16700
|
+
const at = caretOf(text2, offset);
|
|
16701
|
+
return { line: start + at.line, ch: at.ch };
|
|
16702
|
+
}
|
|
16626
16703
|
function taggedHtml(t2, isRef) {
|
|
16627
16704
|
if (typeof t2 === "string") return highlightLean(t2, (w2) => isRef(w2));
|
|
16628
16705
|
if (Array.isArray(t2)) return t2.map((x2) => taggedHtml(x2, isRef)).join("");
|
|
@@ -16706,11 +16783,28 @@ var InfoView = class {
|
|
|
16706
16783
|
}
|
|
16707
16784
|
const same2 = !!was && !!code && was.module === code.module && was.hash === code.hash;
|
|
16708
16785
|
if (!same2) this.answer = null;
|
|
16709
|
-
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;
|
|
16710
16787
|
this.watchSize();
|
|
16711
16788
|
if (this.caret && !same2) this.ask();
|
|
16712
16789
|
else this.draw();
|
|
16713
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
|
+
}
|
|
16714
16808
|
/** The element of line `line` of the file in the code on show, or null. */
|
|
16715
16809
|
lineEl(line) {
|
|
16716
16810
|
const c3 = this.code, l2 = this.lines;
|
|
@@ -16741,7 +16835,7 @@ var InfoView = class {
|
|
|
16741
16835
|
this.caret = { line: c3.start + to.line, ch: to.ch, after: k2.after };
|
|
16742
16836
|
this.ask();
|
|
16743
16837
|
this.hooks.moved();
|
|
16744
|
-
this.
|
|
16838
|
+
this.show(this.caret);
|
|
16745
16839
|
return true;
|
|
16746
16840
|
}
|
|
16747
16841
|
/** The caret as a followed reader's is (CollabSpec, "Surfaces"), or none: nobody is told. */
|
|
@@ -16755,9 +16849,16 @@ var InfoView = class {
|
|
|
16755
16849
|
if (!this.holds(c3.line)) return;
|
|
16756
16850
|
if (moved) {
|
|
16757
16851
|
this.ask();
|
|
16758
|
-
this.
|
|
16852
|
+
this.show(c3);
|
|
16759
16853
|
} else this.draw();
|
|
16760
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
|
+
}
|
|
16761
16862
|
/** No caret here any more: another window holds the page's. */
|
|
16762
16863
|
clear() {
|
|
16763
16864
|
if (!this.caret) return;
|
|
@@ -16821,8 +16922,10 @@ var InfoView = class {
|
|
|
16821
16922
|
const focused = document.activeElement;
|
|
16822
16923
|
pane.hidden = !v2.show || hidden;
|
|
16823
16924
|
split?.classList.toggle("iv-on", v2.show && !hidden);
|
|
16824
|
-
|
|
16825
|
-
|
|
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) {
|
|
16826
16929
|
if (!tab) {
|
|
16827
16930
|
tab = document.createElement("button");
|
|
16828
16931
|
tab.type = "button";
|
|
@@ -16830,18 +16933,30 @@ var InfoView = class {
|
|
|
16830
16933
|
tab.dataset.ivShow = "";
|
|
16831
16934
|
tab.title = "Show the InfoView: what Lean says at the caret (kept in this browser)";
|
|
16832
16935
|
tab.innerHTML = `<span aria-hidden="true">\u22A2</span> Lean`;
|
|
16833
|
-
|
|
16936
|
+
tab.addEventListener("click", () => this.hooks.hide(false));
|
|
16937
|
+
if (bar) bar.append(tab);
|
|
16938
|
+
else home.prepend(tab);
|
|
16834
16939
|
}
|
|
16835
16940
|
} else tab?.remove();
|
|
16836
16941
|
const had = focused instanceof HTMLElement && (pane.contains(focused) || focused.matches("[data-iv-show]")) ? focused : null;
|
|
16837
16942
|
const when = had?.closest("[data-iv-when]")?.dataset.ivWhen;
|
|
16838
16943
|
if (!v2.show || hidden || !k2) {
|
|
16839
16944
|
if (had) this.hooks.win().focus({ preventScroll: true });
|
|
16840
|
-
return;
|
|
16945
|
+
return this.below();
|
|
16841
16946
|
}
|
|
16842
16947
|
pane.innerHTML = headHtml(k2, v2.sides, !!this.answer?.interactive) + `<div class="iv-body">${v2.html}</div>`;
|
|
16843
16948
|
pane.setAttribute("aria-label", "What Lean says at the caret");
|
|
16844
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`);
|
|
16845
16960
|
}
|
|
16846
16961
|
/** The caret's line marked in the code, and its tactic, where the browser can (the CSS Custom
|
|
16847
16962
|
* Highlight API): marks the code keeps however often it is drawn again. */
|
|
@@ -16865,10 +16980,6 @@ var InfoView = class {
|
|
|
16865
16980
|
const split = pane.parentElement;
|
|
16866
16981
|
split?.addEventListener("click", (e2) => {
|
|
16867
16982
|
const t2 = e2.target;
|
|
16868
|
-
if (t2.closest("[data-iv-show]")) {
|
|
16869
|
-
this.hooks.hide(false);
|
|
16870
|
-
return;
|
|
16871
|
-
}
|
|
16872
16983
|
if (!pane.contains(t2)) return;
|
|
16873
16984
|
if (t2.closest("[data-iv-hide]")) return this.hooks.hide(true);
|
|
16874
16985
|
const when = t2.closest("[data-iv-when]")?.dataset.ivWhen;
|
|
@@ -16943,6 +17054,7 @@ var InfoView = class {
|
|
|
16943
17054
|
const side2 = paneSide(this.hooks.win().offsetWidth, this.hooks.fitted(), document.documentElement.clientWidth || innerWidth);
|
|
16944
17055
|
split.classList.toggle("iv-side", side2);
|
|
16945
17056
|
scroll.style.setProperty("--sw-view", `${scroll.clientHeight}px`);
|
|
17057
|
+
this.below();
|
|
16946
17058
|
}
|
|
16947
17059
|
};
|
|
16948
17060
|
function subtermHtml(r2, resolve) {
|
|
@@ -17044,8 +17156,9 @@ var Sources = class {
|
|
|
17044
17156
|
* page's own rules. The following window opens on their declaration, follows it and closes with
|
|
17045
17157
|
* theirs; a pinned window stands for each of theirs — one pinned here on the same declaration,
|
|
17046
17158
|
* else this page's following window pinned where they pinned theirs, else a new one a step aside
|
|
17047
|
-
* — and closes when theirs does
|
|
17048
|
-
*
|
|
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. */
|
|
17049
17162
|
mirror(s2) {
|
|
17050
17163
|
const left = new Set(this.pinned);
|
|
17051
17164
|
const states = [];
|
|
@@ -17061,6 +17174,11 @@ var Sources = class {
|
|
|
17061
17174
|
this.mirrored.add(p2);
|
|
17062
17175
|
states.push([p2, e2.collapsed, modeOf(e2)]);
|
|
17063
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
|
+
}
|
|
17064
17182
|
for (const p2 of left) if (this.mirrored.has(p2)) this.close(p2);
|
|
17065
17183
|
for (const e2 of missing) {
|
|
17066
17184
|
if (this.pinned.length >= MAX_PINNED) break;
|
|
@@ -17078,6 +17196,7 @@ var Sources = class {
|
|
|
17078
17196
|
p2.show(e2.decl);
|
|
17079
17197
|
}
|
|
17080
17198
|
this.pinned.push(p2);
|
|
17199
|
+
p2.front();
|
|
17081
17200
|
this.hooks.changed();
|
|
17082
17201
|
}
|
|
17083
17202
|
this.mirrored.add(p2);
|
|
@@ -17123,6 +17242,28 @@ var Sources = class {
|
|
|
17123
17242
|
this.pinAt(p2);
|
|
17124
17243
|
return true;
|
|
17125
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
|
+
}
|
|
17126
17267
|
/** A file opened from the Files tree or the board's menu (the owner's decision of 2026-11-01): a
|
|
17127
17268
|
* file window on module `module`, pinned as it opens a step aside from the middle of the screen,
|
|
17128
17269
|
* in File mode at the file's top; one on it already comes in front instead. It is no
|
|
@@ -17241,6 +17382,12 @@ var sourceMemory = () => ({ learned: /* @__PURE__ */ new Map(), printed: /* @__P
|
|
|
17241
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>`;
|
|
17242
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>`;
|
|
17243
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
|
+
}
|
|
17244
17391
|
var COLLAPSE = `<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 8.5h8"/></svg>`;
|
|
17245
17392
|
var READ_WAIT = 1e3;
|
|
17246
17393
|
var FILE_ANCHOR = "\u27E8file\u27E9";
|
|
@@ -17285,8 +17432,10 @@ var SourceWindow = class {
|
|
|
17285
17432
|
/** pinned: it stays on its declaration, and its place is its own */
|
|
17286
17433
|
pinned = false;
|
|
17287
17434
|
/** pinned as it opened, for a followed reader's window: how many steps aside from the middle of
|
|
17288
|
-
* 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 */
|
|
17289
17436
|
aside = 0;
|
|
17437
|
+
/** its pin was pressed from the keyboard's focus: the toggle has it again once drawn again */
|
|
17438
|
+
pinFocus = false;
|
|
17290
17439
|
/** bumped on every render, so a slow fetch for an earlier one is dropped */
|
|
17291
17440
|
turn = 0;
|
|
17292
17441
|
/** the code on show: its module, its first line in the file, the hash of the text */
|
|
@@ -17418,7 +17567,15 @@ var SourceWindow = class {
|
|
|
17418
17567
|
const t2 = e2.target;
|
|
17419
17568
|
if (t2.closest("[data-sw-quote]")) return this.quotePicked();
|
|
17420
17569
|
if (t2.closest("[data-sw-close]")) return this.hooks.close(this);
|
|
17421
|
-
|
|
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
|
+
}
|
|
17422
17579
|
if (t2.closest("[data-sw-back]")) return this.hooks.back();
|
|
17423
17580
|
if (t2.closest("[data-sw-fwd]")) return this.hooks.forward();
|
|
17424
17581
|
if (t2.closest(".sw-pill, [data-sw-collapse]")) return;
|
|
@@ -17487,7 +17644,8 @@ var SourceWindow = class {
|
|
|
17487
17644
|
moved: () => this.hooks.caretMoved?.(this),
|
|
17488
17645
|
win: () => this.el,
|
|
17489
17646
|
fitted: () => this.win.fitted,
|
|
17490
|
-
stale: () => void this.render(false)
|
|
17647
|
+
stale: () => void this.render(false),
|
|
17648
|
+
reveal: (line, ch) => this.unfoldAt(line, ch)
|
|
17491
17649
|
});
|
|
17492
17650
|
el.addEventListener("keydown", (e2) => {
|
|
17493
17651
|
this.keyAt = Date.now();
|
|
@@ -17647,6 +17805,14 @@ var SourceWindow = class {
|
|
|
17647
17805
|
this.win.layout();
|
|
17648
17806
|
void this.render(false);
|
|
17649
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
|
+
}
|
|
17650
17816
|
collapse(on) {
|
|
17651
17817
|
this.win.collapse(on);
|
|
17652
17818
|
if (on) this.unpick();
|
|
@@ -17700,6 +17866,8 @@ var SourceWindow = class {
|
|
|
17700
17866
|
this.el.classList.remove("opening", "slow");
|
|
17701
17867
|
this.el.removeAttribute("aria-busy");
|
|
17702
17868
|
this.frameEl.inert = false;
|
|
17869
|
+
if (this.pinFocus) this.frameEl.querySelector("[data-sw-pin]")?.focus();
|
|
17870
|
+
this.pinFocus = false;
|
|
17703
17871
|
for (const ok of this.waiting.splice(0)) ok();
|
|
17704
17872
|
}
|
|
17705
17873
|
/** The window goes: its cards, its place in the layer, what it waits for. */
|
|
@@ -17802,8 +17970,8 @@ var SourceWindow = class {
|
|
|
17802
17970
|
* in the file; not while the reader follows someone, whose caret it is (a click is reading then). */
|
|
17803
17971
|
caretIn(pre, node, off) {
|
|
17804
17972
|
if (!this.shown || !this.code || this.collapsed || this.hooks.following?.()) return;
|
|
17805
|
-
const at =
|
|
17806
|
-
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);
|
|
17807
17975
|
}
|
|
17808
17976
|
/** The InfoView's caret: where it is in the file, and whether the goals after the tactic are on
|
|
17809
17977
|
* show; null where there is none in this window. */
|
|
@@ -18061,6 +18229,7 @@ var SourceWindow = class {
|
|
|
18061
18229
|
this.unpick();
|
|
18062
18230
|
const g2 = this.g;
|
|
18063
18231
|
const v2 = g2.nodes[i2];
|
|
18232
|
+
this.info.leave(v2.module);
|
|
18064
18233
|
const parts = v2.name.split(".");
|
|
18065
18234
|
const ext = g2.isExt(i2);
|
|
18066
18235
|
const kind = ext ? "external" : v2.kind;
|
|
@@ -18076,7 +18245,7 @@ var SourceWindow = class {
|
|
|
18076
18245
|
const pinned = this.pinned;
|
|
18077
18246
|
const steps = () => this.hooks.steps();
|
|
18078
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>`;
|
|
18079
|
-
const pin = pinned
|
|
18248
|
+
const pin = pinHtml(pinned, false, v2.name);
|
|
18080
18249
|
let remote = null;
|
|
18081
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>`;
|
|
18082
18251
|
const frame2 = (where, notes2, body, editor = this.still ? null : this.hooks.editorLink(g2, i2), final = true) => {
|
|
@@ -18245,7 +18414,7 @@ var SourceWindow = class {
|
|
|
18245
18414
|
const pinned = this.pinned;
|
|
18246
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>`;
|
|
18247
18416
|
const what = this.file !== null ? `the file ${this.file}` : this.g.nodes[this.current].name;
|
|
18248
|
-
const pin = pinned
|
|
18417
|
+
const pin = pinHtml(pinned, this.file !== null, what);
|
|
18249
18418
|
let title;
|
|
18250
18419
|
if (this.file !== null) {
|
|
18251
18420
|
const parts = this.file.split(".");
|
|
@@ -18282,6 +18451,7 @@ var SourceWindow = class {
|
|
|
18282
18451
|
const v2 = i2 >= 0 ? g2.nodes[i2] : null;
|
|
18283
18452
|
const module = this.file ?? v2?.module;
|
|
18284
18453
|
if (!module) return;
|
|
18454
|
+
this.info.leave(module);
|
|
18285
18455
|
const turn = ++this.turn;
|
|
18286
18456
|
this.hideTip();
|
|
18287
18457
|
this.unpick();
|
|
@@ -18599,6 +18769,16 @@ var SourceWindow = class {
|
|
|
18599
18769
|
if (b2) b2.outerHTML = this.foldsButton();
|
|
18600
18770
|
this.updateSticky();
|
|
18601
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
|
+
}
|
|
18602
18782
|
/** A folded proof opened: that one alone, its place staying. */
|
|
18603
18783
|
openFold(id) {
|
|
18604
18784
|
this.openFolds.add(id);
|
|
@@ -42093,6 +42273,8 @@ function panelsPart(page) {
|
|
|
42093
42273
|
compiledOf: (m3) => page.compiled.get(m3),
|
|
42094
42274
|
close: (w2) => sources.close(w2),
|
|
42095
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()),
|
|
42096
42278
|
// a source window collapsed or opened again leaves or takes its side of the reference window
|
|
42097
42279
|
// paired with it, the two kept apart as the pairing shows them (AttachmentSpec decision 8)
|
|
42098
42280
|
collapsed: () => {
|
|
@@ -46113,7 +46295,7 @@ var GraphCanvas = class {
|
|
|
46113
46295
|
const { x: cx, y: cy, k: k2 } = this.cam;
|
|
46114
46296
|
const sx = (x2) => (x2 - cx) * k2 + this.w / 2, sy = (y2) => (y2 - cy) * k2 + this.h / 2;
|
|
46115
46297
|
const dot = this.dotPx();
|
|
46116
|
-
const
|
|
46298
|
+
const meets2 = (x0, y0, x1, y1) => x1 >= rect.x && y1 >= rect.y && x0 <= rect.x + rect.w && y0 <= rect.y + rect.h;
|
|
46117
46299
|
const P2 = this.posData;
|
|
46118
46300
|
const out = [];
|
|
46119
46301
|
const four = (d2, o2) => [d2[o2], d2[o2 + 1], d2[o2 + 2], d2[o2 + 3]];
|
|
@@ -46127,7 +46309,7 @@ var GraphCanvas = class {
|
|
|
46127
46309
|
const x2 = sx(d2[o2]), y2 = sy(d2[o2 + 1]);
|
|
46128
46310
|
const ring = d2[o2 + 12], ringR = r2 + d2[o2 + 14];
|
|
46129
46311
|
const ext = Math.max(r2, ringR + ring / 2);
|
|
46130
|
-
if (!
|
|
46312
|
+
if (!meets2(x2 - ext, y2 - ext, x2 + ext, y2 + ext)) continue;
|
|
46131
46313
|
const fill = four(d2, o2 + 4), stroke = ring > 0 && d2[o2 + 11] > 0 ? four(d2, o2 + 8) : null;
|
|
46132
46314
|
if (fill[3] <= 2e-3 && !stroke) continue;
|
|
46133
46315
|
const flags = Math.round(d2[o2 + 13]);
|
|
@@ -46146,7 +46328,7 @@ var GraphCanvas = class {
|
|
|
46146
46328
|
});
|
|
46147
46329
|
} else if (L2.kind === "lines") {
|
|
46148
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];
|
|
46149
|
-
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;
|
|
46150
46332
|
out.push({ kind: "line", x0, y0, x1, y1, colour: four(d2, o2 + 4), width: w2 });
|
|
46151
46333
|
} else {
|
|
46152
46334
|
const len = Math.round(d2[o2 + 8]);
|
|
@@ -46159,7 +46341,7 @@ var GraphCanvas = class {
|
|
|
46159
46341
|
[x0, y0, x1, y1] = [Math.min(x0, x2), Math.min(y0, y2), Math.max(x1, x2), Math.max(y1, y2)];
|
|
46160
46342
|
}
|
|
46161
46343
|
const w2 = d2[o2 + 10];
|
|
46162
|
-
if (!
|
|
46344
|
+
if (!meets2(x0 - w2, y0 - w2, x1 + w2, y1 + w2)) continue;
|
|
46163
46345
|
out.push({ kind: "bundle", ctrl, beta: d2[o2 + 9], width: w2, c0: four(d2, o2 + 12), c1: four(d2, o2 + 16) });
|
|
46164
46346
|
}
|
|
46165
46347
|
}
|
|
@@ -48677,7 +48859,7 @@ function inside(f2) {
|
|
|
48677
48859
|
const len = Math.hypot(f2[0], f2[1]);
|
|
48678
48860
|
return len > 1 ? [f2[0] / len, f2[1] / len] : f2;
|
|
48679
48861
|
}
|
|
48680
|
-
function
|
|
48862
|
+
function placeIn3(world, clusters, b2) {
|
|
48681
48863
|
const [wx, wy] = world;
|
|
48682
48864
|
let best = -1;
|
|
48683
48865
|
clusters.forEach((c3, k2) => {
|
|
@@ -49643,7 +49825,7 @@ var Stickies = class {
|
|
|
49643
49825
|
if (!b2 || !nb) return null;
|
|
49644
49826
|
if (kind === "view") return { kind, place: placeAt(b2.mode, world, this.clusters()) };
|
|
49645
49827
|
const clusters = this.clusters(true);
|
|
49646
|
-
const inside3 =
|
|
49828
|
+
const inside3 = placeIn3(world, clusters, nb);
|
|
49647
49829
|
if (inside3) return { kind, mode: b2.mode, place: inside3 };
|
|
49648
49830
|
const ring = this.ring ?? this.ringNow();
|
|
49649
49831
|
return ring ? { kind, mode: b2.mode, place: { ring: angleOf(ring, world[0], world[1]) } } : null;
|
|
@@ -53575,8 +53757,6 @@ var ChatWindow = class {
|
|
|
53575
53757
|
}
|
|
53576
53758
|
},
|
|
53577
53759
|
keepsCollapsed: true,
|
|
53578
|
-
// its own layer, above the source and reference windows' order (ReviewSpec, "In front")
|
|
53579
|
-
onTop: true,
|
|
53580
53760
|
start: (vp) => defaultRect(vp, this.hooks.insets()),
|
|
53581
53761
|
live: () => this.shown,
|
|
53582
53762
|
collapsed: (on) => {
|
|
@@ -53603,8 +53783,8 @@ var ChatWindow = class {
|
|
|
53603
53783
|
get reading() {
|
|
53604
53784
|
return this.shown && !this.win.collapsed && !document.hidden;
|
|
53605
53785
|
}
|
|
53606
|
-
/** Open it, as kept (collapsed or not, where the reader put it)
|
|
53607
|
-
* 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. */
|
|
53608
53788
|
show(expand2 = false) {
|
|
53609
53789
|
if (!this.shown) {
|
|
53610
53790
|
this.shown = true;
|
|
@@ -53615,8 +53795,14 @@ var ChatWindow = class {
|
|
|
53615
53795
|
}
|
|
53616
53796
|
if (expand2 && this.win.collapsed) this.win.collapse(false);
|
|
53617
53797
|
this.win.layout();
|
|
53798
|
+
this.win.front();
|
|
53618
53799
|
if (!this.win.collapsed) this.hooks.expanded();
|
|
53619
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
|
+
}
|
|
53620
53806
|
/** The reader closed it: its ✕, or the conversation button again. */
|
|
53621
53807
|
close() {
|
|
53622
53808
|
if (!this.shown) return;
|
|
@@ -54099,11 +54285,14 @@ function followPart(page) {
|
|
|
54099
54285
|
// the reference window (AttachmentSpec decision 11)
|
|
54100
54286
|
paper: () => page.papers.state() ? { paper: page.papers.state() } : {},
|
|
54101
54287
|
// the InfoView's caret (ReviewSpec, "The InfoView"; the owner's decision of 2026-11-01): the
|
|
54102
|
-
// 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)
|
|
54103
54290
|
caret: () => {
|
|
54104
54291
|
const w2 = page.sources.all.find((p2) => p2.caret);
|
|
54105
54292
|
const c3 = w2?.caret;
|
|
54106
|
-
|
|
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 } : {} } };
|
|
54107
54296
|
},
|
|
54108
54297
|
activity: () => ({ activity: page.activity.state() }),
|
|
54109
54298
|
lostFound: () => ({ lostFound: { open: page.lostDrawer.open } }),
|
|
@@ -54170,7 +54359,7 @@ function followPart(page) {
|
|
|
54170
54359
|
});
|
|
54171
54360
|
const c3 = v2.caret;
|
|
54172
54361
|
const f2 = page.sources.following;
|
|
54173
|
-
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;
|
|
54174
54363
|
for (const p2 of page.sources.all) p2.followCaret(p2 === at && c3 ? { line: c3.line, ch: c3.character, after: c3.after === true } : null);
|
|
54175
54364
|
}
|
|
54176
54365
|
if (once) {
|
|
@@ -54250,7 +54439,7 @@ function talkPart(page) {
|
|
|
54250
54439
|
const talkBtn = $("#talk-btn");
|
|
54251
54440
|
talkBtn.hidden = !!reader || !!data.snapshot;
|
|
54252
54441
|
talkBtn.addEventListener("click", () => {
|
|
54253
|
-
if (page.chatWin.open && !page.chatWin.collapsed) page.chatWin.close();
|
|
54442
|
+
if (page.chatWin.open && !page.chatWin.collapsed && !page.chatWin.covered) page.chatWin.close();
|
|
54254
54443
|
else page.chatWin.show(true);
|
|
54255
54444
|
});
|
|
54256
54445
|
let noticeTimer = null;
|
|
@@ -56185,6 +56374,8 @@ function sharePart(page) {
|
|
|
56185
56374
|
// what the reader sees (the owner's decision of 2026-10-12): every followed part as the registry
|
|
56186
56375
|
// reads it, the camera as the region of the board it shows
|
|
56187
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),
|
|
56188
56379
|
exact: {
|
|
56189
56380
|
get: () => S7.shareExact !== false,
|
|
56190
56381
|
set: (on) => {
|
|
@@ -57867,6 +58058,10 @@ function livePart(page) {
|
|
|
57867
58058
|
const d2 = JSON.parse(e2.data);
|
|
57868
58059
|
page.talk.add(d2.channel, d2.message);
|
|
57869
58060
|
});
|
|
58061
|
+
es.addEventListener("chat-state", (e2) => {
|
|
58062
|
+
const d2 = JSON.parse(e2.data);
|
|
58063
|
+
page.talk.sessionState(d2.channel, d2.talk);
|
|
58064
|
+
});
|
|
57870
58065
|
es.addEventListener("ask", (e2) => page.asking.asked(JSON.parse(e2.data)));
|
|
57871
58066
|
es.addEventListener("ask-answer", (e2) => page.asking.answered(JSON.parse(e2.data)));
|
|
57872
58067
|
es.addEventListener("ask-end", (e2) => page.asking.ended(JSON.parse(e2.data).id));
|
|
@@ -59750,13 +59945,24 @@ var TIPS = [
|
|
|
59750
59945
|
id: "conversations",
|
|
59751
59946
|
group: "together",
|
|
59752
59947
|
title: "Conversations",
|
|
59753
|
-
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.",
|
|
59754
59949
|
who: "full",
|
|
59755
59950
|
where: "both",
|
|
59756
59951
|
since: "0.6.0",
|
|
59757
59952
|
about: ["#talk-btn", "#convo"],
|
|
59758
59953
|
manual: "together"
|
|
59759
59954
|
},
|
|
59955
|
+
{
|
|
59956
|
+
id: "agent-here",
|
|
59957
|
+
group: "together",
|
|
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.",
|
|
59960
|
+
who: "full",
|
|
59961
|
+
where: "both",
|
|
59962
|
+
since: "0.11.0",
|
|
59963
|
+
about: ["#share-pop [data-tab=agent]", "#convo"],
|
|
59964
|
+
manual: "together"
|
|
59965
|
+
},
|
|
59760
59966
|
{
|
|
59761
59967
|
id: "copy-link",
|
|
59762
59968
|
group: "together",
|