samagotchi 0.192.0 → 0.194.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +128 -1
- data/docs/architecture.md +3 -3
- data/docs/bundle-authoring.md +1 -1
- data/docs/bundles.md +82 -40
- data/docs/cli.md +47 -17
- data/docs/configuration.md +75 -8
- data/docs/context.md +8 -5
- data/docs/desktop.md +3 -0
- data/docs/guardrails.md +20 -5
- data/docs/hooks.md +1 -0
- data/docs/internals/bridge.md +3 -1
- data/docs/internals/bundles.md +2 -2
- data/docs/internals/engine.md +46 -3
- data/docs/internals/pages.md +4 -4
- data/docs/internals/panes.md +66 -0
- data/docs/internals/participants.md +5 -3
- data/docs/internals/peers.md +176 -27
- data/docs/internals/prompt-caching.md +6 -1
- data/docs/internals/remote-sessions.md +6 -0
- data/docs/internals/session-lifecycle.md +12 -4
- data/docs/internals/web-frontend.md +106 -22
- data/docs/internals/working-set.md +5 -1
- data/docs/peers.md +150 -27
- data/docs/plugins.md +48 -7
- data/docs/releasing.md +30 -2
- data/docs/scheduling.md +3 -2
- data/docs/sessions.md +16 -7
- data/docs/sub-agent.md +6 -4
- data/docs/system-one.md +4 -0
- data/docs/testing.md +38 -3
- data/docs/thin-clients.md +27 -11
- data/lib/samagotchi/bridge/card_store.rb +1 -1
- data/lib/samagotchi/broadcast/triage_model.rb +17 -0
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +8 -5
- data/lib/samagotchi/bundles/claude-peer/plugin.rb +24 -5
- data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +61 -24
- data/lib/samagotchi/bundles/claude-peer/scripts/pair +31 -8
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +8 -5
- data/lib/samagotchi/bundles/codex-peer/plugin.rb +62 -6
- data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +57 -19
- data/lib/samagotchi/bundles/codex-peer/scripts/pair +28 -7
- data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
- data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +31 -0
- data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
- data/lib/samagotchi/bundles/mcp/manifest.yml +2 -2
- data/lib/samagotchi/bundles/mcp/plugin.rb +0 -7
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/chi_invocation.rb +7 -0
- data/lib/samagotchi/client.rb +18 -0
- data/lib/samagotchi/codex_rollout.rb +93 -0
- data/lib/samagotchi/compat.rb +8 -1
- data/lib/samagotchi/config.rb +19 -6
- data/lib/samagotchi/continue_offer.rb +13 -1
- data/lib/samagotchi/delivery.rb +2 -2
- data/lib/samagotchi/effective_model.rb +28 -2
- data/lib/samagotchi/engine/cards.rb +9 -4
- data/lib/samagotchi/engine/hooks.rb +8 -0
- data/lib/samagotchi/engine/models.rb +197 -7
- data/lib/samagotchi/engine/plugins.rb +2 -0
- data/lib/samagotchi/engine/side_requests.rb +72 -13
- data/lib/samagotchi/engine/toolkit.rb +1 -1
- data/lib/samagotchi/engine/turn_helpers.rb +1 -1
- data/lib/samagotchi/engine.rb +11 -8
- data/lib/samagotchi/engine_snapshots.rb +16 -3
- data/lib/samagotchi/events.rb +1 -0
- data/lib/samagotchi/guardrails/pair_boundary.rb +49 -18
- data/lib/samagotchi/hooks.rb +3 -1
- data/lib/samagotchi/host_registry.rb +146 -16
- data/lib/samagotchi/idle_client.rb +13 -2
- data/lib/samagotchi/idle_recap.rb +33 -3
- data/lib/samagotchi/idle_target.rb +27 -7
- data/lib/samagotchi/jsonl_store.rb +13 -2
- data/lib/samagotchi/llm/adapter_common.rb +4 -2
- data/lib/samagotchi/llm/anthropic_messages.rb +14 -2
- data/lib/samagotchi/llm/errors.rb +35 -4
- data/lib/samagotchi/llm/model_listing.rb +19 -0
- data/lib/samagotchi/llm/openai_chat.rb +8 -2
- data/lib/samagotchi/llm/prompt_cache.rb +5 -0
- data/lib/samagotchi/model_binding.rb +46 -4
- data/lib/samagotchi/model_catalog.rb +68 -8
- data/lib/samagotchi/model_profile.rb +35 -0
- data/lib/samagotchi/models_command.rb +8 -4
- data/lib/samagotchi/pages/launch.rb +1 -1
- data/lib/samagotchi/panes/kitty.rb +122 -0
- data/lib/samagotchi/panes.rb +185 -0
- data/lib/samagotchi/peer_announce.rb +245 -0
- data/lib/samagotchi/peer_cold.rb +92 -0
- data/lib/samagotchi/peer_command.rb +121 -20
- data/lib/samagotchi/peer_continue.rb +42 -16
- data/lib/samagotchi/peer_exchanges.rb +7 -0
- data/lib/samagotchi/peer_mailbox.rb +50 -10
- data/lib/samagotchi/peer_pair_here.rb +149 -0
- data/lib/samagotchi/peer_presence.rb +434 -0
- data/lib/samagotchi/peer_receipts.rb +33 -6
- data/lib/samagotchi/peer_say.rb +46 -21
- data/lib/samagotchi/peer_wait_expiry.rb +47 -0
- data/lib/samagotchi/plugin/api.rb +13 -1
- data/lib/samagotchi/plugin/card.rb +68 -11
- data/lib/samagotchi/plugin/context.rb +33 -2
- data/lib/samagotchi/plugin/panes.rb +54 -0
- data/lib/samagotchi/plugin/peer.rb +170 -63
- data/lib/samagotchi/plugin/peer_pairing.rb +290 -0
- data/lib/samagotchi/plugin/peer_start.rb +301 -0
- data/lib/samagotchi/plugin/peer_start_hook.rb +207 -0
- data/lib/samagotchi/plugin/peers.rb +89 -9
- data/lib/samagotchi/recap_setup.rb +40 -3
- data/lib/samagotchi/self_report.rb +25 -6
- data/lib/samagotchi/send_command.rb +6 -6
- data/lib/samagotchi/served_lookup.rb +225 -0
- data/lib/samagotchi/served_ref.rb +41 -0
- data/lib/samagotchi/session_access/contract.rb +6 -0
- data/lib/samagotchi/session_access/local.rb +149 -40
- data/lib/samagotchi/session_access/remote.rb +4 -4
- data/lib/samagotchi/session_access/remote_peers.rb +8 -5
- data/lib/samagotchi/session_chain/links.rb +8 -3
- data/lib/samagotchi/session_commands.rb +40 -8
- data/lib/samagotchi/session_continue.rb +11 -6
- data/lib/samagotchi/session_lifecycle/allowed.rb +4 -2
- data/lib/samagotchi/session_manager/delivery.rb +5 -0
- data/lib/samagotchi/session_manager/lifecycle.rb +58 -7
- data/lib/samagotchi/session_manager/removal.rb +3 -0
- data/lib/samagotchi/session_manager/spawn.rb +6 -1
- data/lib/samagotchi/session_model_settings.rb +7 -3
- data/lib/samagotchi/session_stores.rb +25 -11
- data/lib/samagotchi/sessions_command.rb +16 -3
- data/lib/samagotchi/system_one/http_backend.rb +111 -10
- data/lib/samagotchi/system_one/runs.rb +5 -2
- data/lib/samagotchi/system_prompt.rb +11 -4
- data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -1
- data/lib/samagotchi/terminal_ui/formatting.rb +26 -12
- data/lib/samagotchi/terminal_ui/status_row.rb +20 -3
- data/lib/samagotchi/terminal_ui.rb +1 -1
- data/lib/samagotchi/testing/boundary.rb +0 -1
- data/lib/samagotchi/testing/bundle.rb +6 -2
- data/lib/samagotchi/testing/host.rb +1 -0
- data/lib/samagotchi/testing/recorder.rb +3 -0
- data/lib/samagotchi/turn_endings.rb +6 -2
- data/lib/samagotchi/user_typed.rb +29 -0
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +8 -20
- data/lib/samagotchi/web/participant_review.rb +1 -1
- data/lib/samagotchi/web/participant_view.rb +1 -1
- data/lib/samagotchi/web/peer_routes.rb +40 -15
- data/lib/samagotchi/web/public/agent_rows.js +206 -0
- data/lib/samagotchi/web/public/agent_runs.js +595 -0
- data/lib/samagotchi/web/public/answer_fold.js +41 -44
- data/lib/samagotchi/web/public/app.js +4 -4
- data/lib/samagotchi/web/public/block_fix.js +1 -1
- data/lib/samagotchi/web/public/card.js +26 -10
- data/lib/samagotchi/web/public/cards_place.js +6 -4
- data/lib/samagotchi/web/public/context_chips.js +24 -2
- data/lib/samagotchi/web/public/copy.js +8 -2
- data/lib/samagotchi/web/public/data.js +2 -1
- data/lib/samagotchi/web/public/format.js +9 -1
- data/lib/samagotchi/web/public/history_reveal.js +5 -2
- data/lib/samagotchi/web/public/index.html +56 -2
- data/lib/samagotchi/web/public/info_bar_model.js +1 -1
- data/lib/samagotchi/web/public/model_pick.js +18 -5
- data/lib/samagotchi/web/public/model_picker.js +1 -1
- data/lib/samagotchi/web/public/page_view.js +1 -1
- data/lib/samagotchi/web/public/pages.css +1 -7
- data/lib/samagotchi/web/public/peer_chip.js +15 -5
- data/lib/samagotchi/web/public/peer_data.js +4 -2
- data/lib/samagotchi/web/public/peer_mailbox_api.js +2 -1
- data/lib/samagotchi/web/public/peer_note.js +4 -2
- data/lib/samagotchi/web/public/peer_row.js +37 -0
- data/lib/samagotchi/web/public/peer_wait.js +36 -0
- data/lib/samagotchi/web/public/quiet_notes.js +12 -1
- data/lib/samagotchi/web/public/revise_stack.js +5 -2
- data/lib/samagotchi/web/public/send_turn.js +11 -3
- data/lib/samagotchi/web/public/served_ref.js +9 -0
- data/lib/samagotchi/web/public/session_fields.js +1 -0
- data/lib/samagotchi/web/public/session_state.js +4 -0
- data/lib/samagotchi/web/public/stage_missing.js +23 -6
- data/lib/samagotchi/web/public/stream_handlers.js +16 -0
- data/lib/samagotchi/web/public/turn_block.js +4 -0
- data/lib/samagotchi/web/public/version_notices.js +7 -1
- data/lib/samagotchi/web/session_control.rb +19 -10
- data/lib/samagotchi/web/session_show.rb +20 -0
- data/lib/samagotchi/web/update_ops.rb +2 -2
- data/lib/samagotchi/worker/command_queue.rb +3 -0
- data/lib/samagotchi/worker/mail.rb +24 -1
- data/lib/samagotchi/worker.rb +8 -5
- data/lib/samagotchi/worker_inbound/mail.rb +34 -6
- data/lib/samagotchi/worker_inbound.rb +11 -3
- data/lib/samagotchi/worker_link.rb +13 -1
- data/lib/samagotchi/worker_wakes.rb +33 -5
- metadata +22 -2
- data/lib/samagotchi/web/public/pages_group.js +0 -67
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
// never changes shape, a click changes its height, animated
|
|
10
10
|
// (details_motion.js animateHeight) unless the viewer prefers no motion.
|
|
11
11
|
//
|
|
12
|
-
// A delegate report
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// lines". Its key: a merged one's data-line-key, a wake turn's opening
|
|
17
|
-
// "<turn id>:prompt". A live merged report has no key until a reload.
|
|
12
|
+
// A delegate report's and a peer answer's rows (closed by default) are
|
|
13
|
+
// agent_runs.js's, which owns everything agents write to each other: this
|
|
14
|
+
// module keeps their key (answerKey) and the store's `open` list they are
|
|
15
|
+
// kept in (readOpened / writeOpened), and skips their rows.
|
|
18
16
|
//
|
|
19
17
|
// A long prompt (a user bubble with no data-source: typed, not brought in)
|
|
20
18
|
// gets the same row over the same threshold, open by default as an answer
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
//
|
|
25
23
|
// Which answers are folded is this browser's choice (localStorage through
|
|
26
24
|
// storage.js): one key per session holding the folded answers' keys and
|
|
27
|
-
// the unfolded reports' keys, the last FOLD_KEEP of each. An answer's key is its turn's id
|
|
25
|
+
// the unfolded reports' and peer answers' keys, the last FOLD_KEEP of each. An answer's key is its turn's id
|
|
28
26
|
// (data-answer-turn), a delegate report's reply its own (data-reply-key);
|
|
29
27
|
// a bubble with neither (an answer before any prompt, a canceled turn's
|
|
30
28
|
// partial) gets no row. The keys of sessions gone from the session list go
|
|
@@ -52,11 +50,14 @@ export const FOLD_PREFIX = "chi_answer_fold:";
|
|
|
52
50
|
const LABEL_CHARS = 160;
|
|
53
51
|
|
|
54
52
|
const ROW_CLASS = "answer-fold";
|
|
55
|
-
// What gets a row: answers
|
|
56
|
-
// and
|
|
53
|
+
// What gets a row here: answers and the user's own prompts (no source).
|
|
54
|
+
// A delegate report's and a peer answer's keys are answerKey's too (their
|
|
55
|
+
// selectors are agent_rows.js's, kept apart here: this module's top level
|
|
56
|
+
// uses none of agent_rows.js's bindings, see there).
|
|
57
57
|
const REPORTS = '.bubble.user[data-source="delegate_report"]';
|
|
58
|
+
const PEERS = ".bubble.note.peer-answer";
|
|
58
59
|
const PROMPTS = ".bubble.user:not([data-source])";
|
|
59
|
-
const ANSWERS = `.bubble.output, ${
|
|
60
|
+
const ANSWERS = `.bubble.output, ${PROMPTS}`;
|
|
60
61
|
// Not done yet: still streaming.
|
|
61
62
|
const UNFINISHED = ".streaming";
|
|
62
63
|
|
|
@@ -184,12 +185,19 @@ export function sweepAnswerFolds(sessions, { scoped = false } = {}) {
|
|
|
184
185
|
|
|
185
186
|
const isReport = (bubble) => !!bubble?.matches?.(REPORTS);
|
|
186
187
|
const isPrompt = (bubble) => !!bubble?.matches?.(PROMPTS);
|
|
188
|
+
const isPeer = (bubble) => !!bubble?.matches?.(PEERS);
|
|
187
189
|
|
|
188
190
|
// The key an answer bubble is folded by, or null. A delegate report's: a
|
|
189
191
|
// merged one's line key (data-line-key, "<turn id>:input:<place>"), one
|
|
190
192
|
// that opened a wake turn its turn's id and ":prompt" (never the answer's
|
|
191
|
-
// key, the bare id). A prompt's: its turn's id and ":prompt".
|
|
193
|
+
// key, the bare id). A prompt's: its turn's id and ":prompt". A peer's
|
|
194
|
+
// answer's: "peer:<name>#<serial>", else "peer@<opening id>".
|
|
192
195
|
export function answerKey(bubble) {
|
|
196
|
+
if (isPeer(bubble)) {
|
|
197
|
+
const { peerName, peerSerial, openingId } = bubble.dataset;
|
|
198
|
+
if (peerName && peerSerial) return `peer:${peerName}#${peerSerial}`;
|
|
199
|
+
return openingId ? `peer@${openingId}` : null;
|
|
200
|
+
}
|
|
193
201
|
if (isReport(bubble)) {
|
|
194
202
|
const turn = bubble.getAttribute("data-turn-id");
|
|
195
203
|
return bubble.getAttribute("data-line-key") || (turn ? `${turn}:prompt` : null);
|
|
@@ -205,34 +213,22 @@ function answerText(bubble) {
|
|
|
205
213
|
return bubbleCopyText(bubble);
|
|
206
214
|
}
|
|
207
215
|
|
|
208
|
-
// A
|
|
209
|
-
//
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
// A report row's label: its origin label (the bubble's) and its first
|
|
213
|
-
// heading or first line after the header.
|
|
214
|
-
export function reportLabel(text, origin = "") {
|
|
215
|
-
const body = String(text ?? "").replace(/\r\n?/g, "\n").split("\n").filter((l) => !REPORT_HEADER.test(l.trim())).join("\n");
|
|
216
|
-
const first = foldLabel(body);
|
|
217
|
-
return clip([origin.trim(), first].filter(Boolean).join(" · "), LABEL_CHARS);
|
|
218
|
-
}
|
|
216
|
+
// A report row's label (agent_rows.js): kept here for an older cached
|
|
217
|
+
// module that imports it from this one.
|
|
218
|
+
export { reportLabel } from "./agent_rows.js";
|
|
219
219
|
|
|
220
220
|
function drawRow(row, bubble) {
|
|
221
221
|
const folded = bubble.classList.contains("folded");
|
|
222
222
|
const text = answerText(bubble);
|
|
223
|
-
const report = isReport(bubble);
|
|
224
223
|
const prompt = isPrompt(bubble);
|
|
225
|
-
const own = report ? { label: reportLabel(text, bubble.querySelector(":scope > .origin-label")?.textContent || "") } : {};
|
|
226
224
|
// A prompt's label is its first line as typed (no heading picked).
|
|
227
225
|
const display = prompt || bubble.hasAttribute("data-answer-display");
|
|
228
|
-
const { label, size } = foldRowText(text, { display, folded
|
|
229
|
-
const what =
|
|
226
|
+
const { label, size } = foldRowText(text, { display, folded });
|
|
227
|
+
const what = prompt ? "message" : "answer";
|
|
230
228
|
row.setAttribute("aria-expanded", folded ? "false" : "true");
|
|
231
229
|
row.title = folded ? `Show the ${what}` : `Fold the ${what}`;
|
|
232
230
|
row.classList.toggle("folded", folded);
|
|
233
|
-
row.classList.toggle("report", report);
|
|
234
231
|
row.classList.toggle("prompt", prompt);
|
|
235
|
-
row.classList.toggle("steered", report && bubble.classList.contains("steered"));
|
|
236
232
|
const [labelEl, sizeEl] = row.children;
|
|
237
233
|
if (labelEl.textContent !== label) labelEl.textContent = label;
|
|
238
234
|
if (sizeEl.textContent !== size) sizeEl.textContent = size;
|
|
@@ -242,11 +238,11 @@ function makeRow(doc) {
|
|
|
242
238
|
const row = doc.createElement("button");
|
|
243
239
|
row.type = "button";
|
|
244
240
|
row.className = ROW_CLASS;
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
241
|
+
for (const part of ["label", "size"]) {
|
|
242
|
+
const el = doc.createElement("span");
|
|
243
|
+
el.className = `answer-fold-${part}`;
|
|
244
|
+
row.append(el);
|
|
245
|
+
}
|
|
250
246
|
return row;
|
|
251
247
|
}
|
|
252
248
|
|
|
@@ -277,6 +273,7 @@ export function installAnswerFold({ historyEl, sessionId, projectRoot = () => nu
|
|
|
277
273
|
if (bubble.parentElement !== historyEl) return;
|
|
278
274
|
const key = answerKey(bubble);
|
|
279
275
|
let row = rows.get(bubble);
|
|
276
|
+
// An answer or a prompt over the threshold only.
|
|
280
277
|
if (!key || bubble.matches(UNFINISHED) || (!row && !foldable(answerText(bubble)))) return;
|
|
281
278
|
if (!row) {
|
|
282
279
|
row = makeRow(historyEl.ownerDocument);
|
|
@@ -284,28 +281,30 @@ export function installAnswerFold({ historyEl, sessionId, projectRoot = () => nu
|
|
|
284
281
|
bubbleOf.set(row, bubble);
|
|
285
282
|
// The stored choice, once: after that the bubble's class is the state
|
|
286
283
|
// (a jump that unfolds it, history_reveal.js, isn't saved). An answer
|
|
287
|
-
// is open unless folded by hand, a report
|
|
288
|
-
|
|
289
|
-
if (
|
|
284
|
+
// is open unless folded by hand, a report or a peer's answer folded
|
|
285
|
+
// unless opened.
|
|
286
|
+
if (stored().turns.includes(key)) bubble.classList.add("folded");
|
|
290
287
|
}
|
|
291
288
|
if (bubble.previousElementSibling !== row) historyEl.insertBefore(row, bubble);
|
|
292
289
|
drawRow(row, bubble);
|
|
293
290
|
}
|
|
294
291
|
|
|
295
|
-
// Rows whose bubble left (a re-render, a replaced bubble) go with it
|
|
296
|
-
//
|
|
297
|
-
//
|
|
292
|
+
// Rows whose bubble left (a re-render, a replaced bubble) go with it (only
|
|
293
|
+
// this module's: agent_runs.js's rows are its own); a row something was
|
|
294
|
+
// placed after (a card or a recap placed before a
|
|
295
|
+
// prompt that opens its turn) goes back just before its bubble.
|
|
298
296
|
function dropOrphans() {
|
|
299
297
|
for (const row of historyEl.querySelectorAll(`:scope > .${ROW_CLASS}`)) {
|
|
298
|
+
if (!bubbleOf.has(row)) continue;
|
|
300
299
|
const bubble = bubbleOf.get(row);
|
|
301
|
-
if (
|
|
300
|
+
if (bubble.parentElement !== historyEl) row.remove();
|
|
302
301
|
else if (row.nextElementSibling !== bubble) historyEl.insertBefore(row, bubble);
|
|
303
302
|
}
|
|
304
303
|
}
|
|
305
304
|
|
|
306
305
|
function decorate(root) {
|
|
307
306
|
let entry = null;
|
|
308
|
-
const stored = () => (entry ??= { turns: readFolded(sessionId())
|
|
307
|
+
const stored = () => (entry ??= { turns: readFolded(sessionId()) });
|
|
309
308
|
if (root.matches?.(ANSWERS)) decorateBubble(root, stored);
|
|
310
309
|
for (const bubble of root.querySelectorAll?.(ANSWERS) || []) decorateBubble(bubble, stored);
|
|
311
310
|
}
|
|
@@ -351,9 +350,7 @@ export function installAnswerFold({ historyEl, sessionId, projectRoot = () => nu
|
|
|
351
350
|
settle();
|
|
352
351
|
animateHeight(bubble, 0, bubble.offsetHeight, { fade: true });
|
|
353
352
|
}
|
|
354
|
-
|
|
355
|
-
if (isReport(bubble)) writeOpened(sessionId(), answerKey(bubble), !folded, { root: projectRoot() });
|
|
356
|
-
else writeFold(sessionId(), answerKey(bubble), folded, { root: projectRoot() });
|
|
353
|
+
writeFold(sessionId(), answerKey(bubble), folded, { root: projectRoot() });
|
|
357
354
|
});
|
|
358
355
|
|
|
359
356
|
return { decorate };
|
|
@@ -73,7 +73,7 @@ import { wireBlockFix } from "./block_fix.js";
|
|
|
73
73
|
import { createWidgetDrawer } from "./inline_widgets.js";
|
|
74
74
|
import { copyText, installCopy } from "./copy.js";
|
|
75
75
|
import { installAnswerFold, sweepAnswerFolds } from "./answer_fold.js";
|
|
76
|
-
import {
|
|
76
|
+
import { installAgentRuns } from "./agent_runs.js";
|
|
77
77
|
import { sweepSessionPrefs } from "./session_prefs.js";
|
|
78
78
|
import { installDetailsMotion } from "./details_motion.js";
|
|
79
79
|
import { answerLabel, installReviseStacks, reviseChipTemplate, reviseWorkerUnavailable } from "./revise_stack.js";
|
|
@@ -543,7 +543,7 @@ turnRoots().forEach((root) => root.addEventListener("click", cards.onCardAction)
|
|
|
543
543
|
const sessionView = createSessionView({
|
|
544
544
|
store, historyEl, getSession, clientId,
|
|
545
545
|
liveTurn, turnDom, questionCards, shownTexts, objectives, featureGates, markdownTip, workingSet, wsPreview, gapClock,
|
|
546
|
-
bubbles, cards, markdown: markdownPlace, cardRegistry, peerLinks, pictures,
|
|
546
|
+
bubbles, cards, markdown: markdownPlace, cardRegistry, peerLinks, pictures, stageMissing,
|
|
547
547
|
capabilities: () => pageCapabilities,
|
|
548
548
|
page: {
|
|
549
549
|
setReviseAnchor, renderInitRow, setMarkdownWarning, setCapabilities, findInTurnRoots, appendToHistory,
|
|
@@ -1458,10 +1458,10 @@ const blockFix = wireBlockFix({ viewer, roots: turnRoots(), store, getSession, c
|
|
|
1458
1458
|
// with their height animated (details_motion.js), in the history and on
|
|
1459
1459
|
// the stage.
|
|
1460
1460
|
installDetailsMotion({ root: document.body, selector: ".turn-work, .bubble.thinking, .bubble.recap" });
|
|
1461
|
-
// Long answers fold by hand (answer_fold.js), per viewer and session;
|
|
1461
|
+
// Long answers fold by hand (answer_fold.js), per viewer and session; reports, peer answers and background items (agent_runs.js) start closed.
|
|
1462
1462
|
const projectRoot = () => store.sessions.find((s) => s.id === store.selected)?.project_root ?? null;
|
|
1463
1463
|
installAnswerFold({ historyEl, sessionId: () => store.selected, projectRoot });
|
|
1464
|
-
|
|
1464
|
+
installAgentRuns({ historyEl, sessionId: () => store.selected, projectRoot });
|
|
1465
1465
|
// Revise stacks (revise_stack.js): the superseded versions fold to stubs,
|
|
1466
1466
|
// the top answer gets its version chip, a final answer its Revise button.
|
|
1467
1467
|
reviseStacks = viewer.can("revise") || viewer.can("revise_own_turn") ? installReviseStacks({
|
|
@@ -178,7 +178,7 @@ export function createBlockFix({ roots, sessionId, features, bridgeUp = () => tr
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// The fixed answer, read again and written by
|
|
181
|
+
// The fixed answer, read again and written by answer_write.js's writeAnswer
|
|
182
182
|
// (which, unlike applyFinalAnswer, can't find the bubble by its old text).
|
|
183
183
|
// +pres+: the blocks this redraw settles when it can't (the session
|
|
184
184
|
// left behind mid-read is not one: leave that page alone).
|
|
@@ -24,6 +24,7 @@ export const NOTICE_CHARS = 160;
|
|
|
24
24
|
// one that asks (actions) and one with more to read stay cards.
|
|
25
25
|
export function isNoticeCard(card) {
|
|
26
26
|
if (!card || card.level === "warn") return false;
|
|
27
|
+
if (Array.isArray(card.rows) && card.rows.length) return false;
|
|
27
28
|
if (cardActions(card).length) return false;
|
|
28
29
|
const body = String(card.body ?? "").trim();
|
|
29
30
|
return !body.includes("\n") && body.length <= NOTICE_CHARS;
|
|
@@ -82,17 +83,32 @@ export function cardTemplate(card) {
|
|
|
82
83
|
const body = cardBodyTemplate(card);
|
|
83
84
|
const actions = cardActions(card);
|
|
84
85
|
const hosts = [];
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
const button = (a) => {
|
|
87
|
+
if (a.command) return html`<button type="button" class=${a.primary ? "card-action" : "card-action ghost"} data-command=${a.command} title=${a.command}>${a.label || a.command}</button>`;
|
|
88
|
+
const url = cardActionUrl(a);
|
|
89
|
+
const host = new URL(url).host;
|
|
90
|
+
if (!hosts.includes(host)) hosts.push(host);
|
|
91
|
+
return html`<a class="card-link ghost" href=${url} target="_blank" rel="noopener noreferrer" title=${host}>${a.label}</a>`;
|
|
92
|
+
};
|
|
93
|
+
const rows = cardRowsTemplate(card, actions, button);
|
|
94
|
+
const own = actions.filter((a) => !Number.isInteger(a.row));
|
|
95
|
+
const buttons = own.length ? html`<div class="card-actions">${own.map(button)}</div>` : nothing;
|
|
94
96
|
const opens = hosts.length ? html`<div class="card-opens">opens ${hosts.join(", ")}</div>` : nothing;
|
|
95
|
-
return html`<div class="card-head"><span class="card-title">${card.title || ""}</span>${label}${source}</div>${body ? html`<div class="card-body">${body}</div>` : nothing}${buttons}${opens}<div class="card-error hidden"></div>`;
|
|
97
|
+
return html`<div class="card-head"><span class="card-title">${card.title || ""}</span>${label}${source}</div>${body ? html`<div class="card-body">${body}</div>` : nothing}${rows}${buttons}${opens}<div class="card-error hidden"></div>`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// A card's rows (a list to pick from: claude-peer's sessions here), each
|
|
101
|
+
// its title and its sub line when it has them and its own buttons (the actions
|
|
102
|
+
// whose +row+ is its index); nothing without rows.
|
|
103
|
+
function cardRowsTemplate(card, actions, button) {
|
|
104
|
+
const rows = Array.isArray(card?.rows) ? card.rows : [];
|
|
105
|
+
if (!rows.length) return nothing;
|
|
106
|
+
return html`<div class="card-rows">${rows.map((row, index) => {
|
|
107
|
+
const mine = actions.filter((a) => a.row === index);
|
|
108
|
+
const sub = String(row?.sub ?? "").trim();
|
|
109
|
+
const title = String(row?.title ?? "").trim();
|
|
110
|
+
return html`<div class="card-row"><div class="card-row-txt">${title ? html`<div class="card-row-title">${title}</div>` : nothing}${sub ? html`<div class="card-row-sub">${sub}</div>` : nothing}</div>${mine.length ? html`<div class="card-row-acts">${mine.map(button)}</div>` : nothing}</div>`;
|
|
111
|
+
})}</div>`;
|
|
96
112
|
}
|
|
97
113
|
|
|
98
114
|
// A card element → the card it shows, as drawCard drew it.
|
|
@@ -133,16 +133,18 @@ export function createCardsPlace({
|
|
|
133
133
|
// for the end): right after the turn that just ended, as live (a notice
|
|
134
134
|
// draws no time divider of its own), so above the next opening's divider
|
|
135
135
|
// and the context notes that came between the turns. It walks back over
|
|
136
|
-
// those
|
|
137
|
-
//
|
|
138
|
-
//
|
|
136
|
+
// those, their notes rows (quiet_notes.js) and fold rows (answer_fold.js:
|
|
137
|
+
// a peer answer's, the next opening's own; an answer's or a report's
|
|
138
|
+
// bubble ends the walk before its row is reached), never over earlier
|
|
139
|
+
// lines, cards or questions (several lines keep their order), and returns
|
|
140
|
+
// the first one it walked over, else +before+.
|
|
139
141
|
// Assumes the line came right after a turn (an after_turn hook), not after
|
|
140
142
|
// a later note: an anytime command's line between turns moves above the
|
|
141
143
|
// notes before it too (rare; the e2e reload checks cover it).
|
|
142
144
|
function afterTurnEnd(before) {
|
|
143
145
|
let place = before;
|
|
144
146
|
for (let el = before ? before.previousElementSibling : historyEl.lastElementChild; el; el = el.previousElementSibling) {
|
|
145
|
-
if (!el.matches(".time-gap, .bubble.note:not(.turn-start), .quiet-notes")) break;
|
|
147
|
+
if (!el.matches(".time-gap, .bubble.note:not(.turn-start), .quiet-notes, .answer-fold")) break;
|
|
146
148
|
place = el;
|
|
147
149
|
}
|
|
148
150
|
return place;
|
|
@@ -13,6 +13,7 @@ import { focusBack, modalDialog } from "./popover_modal.js";
|
|
|
13
13
|
import { cantText } from "./format.js";
|
|
14
14
|
import { createLatest } from "./latest.js";
|
|
15
15
|
import { peerChipModel, peerGroups, peerKey, peerPopoverTemplate } from "./peer_chip.js";
|
|
16
|
+
import { waitingChipModel, waitingPopoverTemplate } from "./peer_wait.js";
|
|
16
17
|
|
|
17
18
|
// "now", "3m", "2h", "4d" since an ISO time; "" for none.
|
|
18
19
|
export function ageText(iso, now = Date.now()) {
|
|
@@ -124,7 +125,9 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
124
125
|
const rowOf = (name) => rows.find((r) => r.name === name) || null;
|
|
125
126
|
|
|
126
127
|
function chips(now = Date.now()) {
|
|
127
|
-
|
|
128
|
+
// A peer waited for and not paired yet: the waiting chip (peer_wait.js).
|
|
129
|
+
const peerChips = groups().map((group) => (group.peer.paired_at ? peerChipModel(group, exchangesOf(group.name), now)
|
|
130
|
+
: waitingChipModel(group, now)));
|
|
128
131
|
return [...peerChips, ...chipModel(rows, now)];
|
|
129
132
|
}
|
|
130
133
|
|
|
@@ -184,7 +187,8 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
function fill(group, row) {
|
|
187
|
-
if (group)
|
|
190
|
+
if (group && !group.peer.paired_at) render(waitingPopoverTemplate(group), pop);
|
|
191
|
+
else if (group) {
|
|
188
192
|
const actions = peerActions;
|
|
189
193
|
render(peerPopoverTemplate(group, exchangesOf(group.name), {
|
|
190
194
|
text, status: actions.status?.(group.name) || null, drawn: (id) => !!actions.drawn?.(id),
|
|
@@ -312,6 +316,23 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
312
316
|
focusAfterRemoval();
|
|
313
317
|
}
|
|
314
318
|
|
|
319
|
+
// Cancel (the waiting chip's): the wait ends (DELETE …/peers/NAME, no
|
|
320
|
+
// confirm: it pairs nothing), the peers are read again and the chip goes.
|
|
321
|
+
async function cancelWait() {
|
|
322
|
+
const group = groupOf(openKey);
|
|
323
|
+
if (!group) return;
|
|
324
|
+
const id = sessionId;
|
|
325
|
+
close();
|
|
326
|
+
try {
|
|
327
|
+
await api.unpair(id, group.name);
|
|
328
|
+
} catch (e) {
|
|
329
|
+
toast(cantText(`stop waiting for ${group.label}`, e));
|
|
330
|
+
}
|
|
331
|
+
await peers()?.refresh?.();
|
|
332
|
+
drawChips();
|
|
333
|
+
focusAfterRemoval();
|
|
334
|
+
}
|
|
335
|
+
|
|
315
336
|
// A chip the focus was given back to went with its source: the focus goes
|
|
316
337
|
// to the strip's first chip, else to +focusAway+ (the composer).
|
|
317
338
|
function focusAfterRemoval() {
|
|
@@ -328,6 +349,7 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
328
349
|
else if (name === "view") viewText();
|
|
329
350
|
else if (name === "detach") detach();
|
|
330
351
|
else if (name === "unpair") unpair();
|
|
352
|
+
else if (name === "cancel") cancelWait();
|
|
331
353
|
else if (name === "status" && group) {
|
|
332
354
|
const line = peerActions.status?.(group.name);
|
|
333
355
|
close();
|
|
@@ -113,11 +113,17 @@ function decorate(root) {
|
|
|
113
113
|
}
|
|
114
114
|
for (const pre of root.querySelectorAll(CODE)) {
|
|
115
115
|
if (pre.parentElement?.classList.contains("code-wrap")) continue;
|
|
116
|
+
// A block that failed before this frame (block_watch.js failBlock: a
|
|
117
|
+
// refused chi-ui block fails at once) has its line(s) right after it:
|
|
118
|
+
// they go into the wrap with it, so the line stays the <pre>'s next
|
|
119
|
+
// sibling (block_fix_note.js noteOf, the Ask in chat click), as when the
|
|
120
|
+
// block fails after the wrap.
|
|
121
|
+
const notes = [];
|
|
122
|
+
for (let at = pre.nextElementSibling; at?.classList.contains("block-note"); at = at.nextElementSibling) notes.push(at);
|
|
116
123
|
const wrap = doc.createElement("div");
|
|
117
124
|
wrap.className = "code-wrap";
|
|
118
125
|
pre.replaceWith(wrap);
|
|
119
|
-
wrap.
|
|
120
|
-
wrap.appendChild(makeButton(doc, "code"));
|
|
126
|
+
wrap.append(pre, ...notes, makeButton(doc, "code"));
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
|
|
@@ -263,7 +263,8 @@ export function dequeueTurn(id, enqueuedId, { clientId = null } = {}, opts = {})
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
// Hands the session to a new worker on the newest chi installed: 200
|
|
266
|
-
// {status, from_version, version}
|
|
266
|
+
// {status, from_version, version} (was_stopped: a stopped session started
|
|
267
|
+
// again: the page is a person's), or 409 with the reason in words (detail).
|
|
267
268
|
export function restartSession(id, opts = {}) {
|
|
268
269
|
return api(`/api/sessions/${encodeURIComponent(id)}/restart`, { method: "POST", body: JSON.stringify({}), ...opts });
|
|
269
270
|
}
|
|
@@ -242,7 +242,10 @@ export function servedModelDiffers(asked, served) {
|
|
|
242
242
|
// The session's model for the info bar: the served model with a marker when
|
|
243
243
|
// the server serves another one than +servedFor+ (the name asked), unless
|
|
244
244
|
// +expectedBy+ names the host whose hosts.<name>.models served: lists it.
|
|
245
|
-
|
|
245
|
+
// A served model with its id now (+modelServed+, which only a served model
|
|
246
|
+
// carries: an alias of main:served too) reads "served · <id>" (the id
|
|
247
|
+
// without its org; the title has it whole).
|
|
248
|
+
export function modelLabel(model, served, servedFor, expectedBy = null, modelServed = null) {
|
|
246
249
|
if (expectedBy && servedModelDiffers(servedFor, served)) {
|
|
247
250
|
const name = model || "";
|
|
248
251
|
return { text: name.slice(0, 40), title: `${name}; served: ${served} (expected: hosts.${expectedBy}.models)`, mismatch: false };
|
|
@@ -251,6 +254,11 @@ export function modelLabel(model, served, servedFor, expectedBy = null) {
|
|
|
251
254
|
return { text: `${served.slice(0, 40)} ⚠`, title: `served: ${served}; asked for ${model}`, mismatch: true };
|
|
252
255
|
}
|
|
253
256
|
const name = model || "";
|
|
257
|
+
if (modelServed) {
|
|
258
|
+
// The id after its org ("unsloth/…"): the bar has room for 40.
|
|
259
|
+
const short = modelServed.slice(modelServed.lastIndexOf("/") + 1) || modelServed;
|
|
260
|
+
return { text: `served · ${short}`.slice(0, 40), title: `${name} → ${modelServed} (what the host served at the last turn or listing)`, mismatch: false };
|
|
261
|
+
}
|
|
254
262
|
return { text: name.slice(0, 40), title: name, mismatch: false };
|
|
255
263
|
}
|
|
256
264
|
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// step, a diff), an answer or a delegate report folded (answer_fold.js: its row follows
|
|
4
4
|
// the bubble's class; the jump's unfold isn't saved), a superseded version
|
|
5
5
|
// of a Revise stack (revise_stack.js: its stub opens, not saved), a drawn
|
|
6
|
-
// block's source (block_source.js), a closed
|
|
7
|
-
// opens, never stored)
|
|
6
|
+
// block's source (block_source.js), a closed run line (agent_runs.js: the
|
|
7
|
+
// segment of what it hides opens, never stored), a closed notes row
|
|
8
|
+
// (quiet_notes.js: it opens, never stored). Every
|
|
8
9
|
// jump goes through it (claim_link.js showClaim, refs.js showRow and so the
|
|
9
10
|
// working set's step tags, verdict_card.js "View check"), so a new way to
|
|
10
11
|
// hide history is opened in one place.
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
import { revealBlockSource } from "./block_source.js";
|
|
17
18
|
import { openStubOver } from "./revise_stack.js";
|
|
18
19
|
import { revealQuiet } from "./quiet_notes.js";
|
|
20
|
+
import { revealRun } from "./agent_runs.js";
|
|
19
21
|
|
|
20
22
|
// Opens each closed <details> that holds +el+ (not +el+ itself: a fold the
|
|
21
23
|
// caller means to open it opens itself) and unfolds the folded answer that
|
|
@@ -23,6 +25,7 @@ import { revealQuiet } from "./quiet_notes.js";
|
|
|
23
25
|
export function revealInHistory(el) {
|
|
24
26
|
if (!el) return null;
|
|
25
27
|
openStubOver(el);
|
|
28
|
+
revealRun(el);
|
|
26
29
|
revealQuiet(el);
|
|
27
30
|
revealBlockSource(el);
|
|
28
31
|
el.closest?.(".bubble.folded")?.classList.remove("folded");
|
|
@@ -100,6 +100,29 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
|
|
|
100
100
|
.qn-names{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
101
101
|
.qn-warn{flex:none;margin-left:auto;white-space:nowrap;color:var(--warn-text)}
|
|
102
102
|
@media(max-width:600px){.quiet-notes{min-height:44px;align-items:center}}
|
|
103
|
+
/* The run line (agent_runs.js): a run of reports, peer answers, a finished turn's steps and notes as one line of
|
|
104
|
+
segments, one open at a time; that kind's rows under it (indented), the notes as they are. One line at every width:
|
|
105
|
+
the lowest rank truncates first (notes, then calls, then reports, then peers). The design: fold-levels mock-up. */
|
|
106
|
+
.quiet-notes.agent-line{gap:0;align-items:center;padding:2px 0 2px 9px;cursor:default;overflow:hidden;flex-wrap:nowrap}
|
|
107
|
+
@media(hover:hover){.quiet-notes.agent-line:hover{background:transparent;color:var(--text-muted)}}
|
|
108
|
+
.quiet-notes.agent-line::before{content:none}
|
|
109
|
+
.qn-seg{flex:0 1 auto;min-width:0;min-height:28px;margin:0;padding:4px 7px;font:inherit;color:inherit;text-align:left;background:transparent;border:0;border-radius:6px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
110
|
+
.qn-seg.seg-peer{flex-shrink:1}.qn-seg.seg-report{flex-shrink:1e5}.qn-seg.seg-calls{flex-shrink:1e10}.qn-seg.seg-notes{flex-shrink:1e15}
|
|
111
|
+
@media(hover:hover){.qn-seg:hover:not(:disabled){filter:none;background:var(--bg-hover);color:var(--text-2)}}
|
|
112
|
+
.qn-seg:focus-visible{outline:2px solid var(--accent-ring);outline-offset:-2px}
|
|
113
|
+
.qn-seg[aria-expanded="true"]{background:var(--bg-raised);color:var(--text-bright)}
|
|
114
|
+
.qn-seg+.qn-seg::before{content:"·";margin-right:11px;margin-left:-4px;color:var(--text-faint)}
|
|
115
|
+
.qn-seg .qn-warn{margin-left:6px}
|
|
116
|
+
/* A phone's line is 44px tall (the notes row's): a segment's tap area is the line's height, its look the mock-up's
|
|
117
|
+
size (drawn by ::after, 28px). */
|
|
118
|
+
@media(max-width:600px){.qn-seg{position:relative;z-index:0;min-height:40px;padding-inline:6px;background:transparent!important}.qn-seg::after{content:"";position:absolute;inset:6px 0;z-index:-1;border-radius:6px}.qn-seg[aria-expanded="true"]::after{background:var(--bg-raised)}}
|
|
119
|
+
@media(max-width:600px) and (hover:hover){.qn-seg:hover::after{background:var(--bg-hover)}.qn-seg[aria-expanded="true"]:hover::after{background:var(--bg-raised)}}
|
|
120
|
+
#history>.answer-fold.agent-row.in-line:not(.report),#history>.answer-fold.agent-row.in-line+.bubble{margin-left:12px;max-width:calc(100% - 12px)}
|
|
121
|
+
/* A steps block under its line ("N calls"): today's block, its summary row and footprint, indented as the rows are. */
|
|
122
|
+
#history>.turn-work.in-line{margin-left:12px;max-width:calc(100% - 12px)}
|
|
123
|
+
/* Opened under its compact row in a line, a report or a note is the row's box's rest, as a peer answer is (the mock-up's
|
|
124
|
+
level 3): the panel box, full width, its top edge the row's. */
|
|
125
|
+
#history>.answer-fold.compact.in-line:not(.peer):not(.folded)+.bubble{align-self:stretch;width:auto;opacity:1;background:var(--bg-panel);border:1px solid var(--border);border-top:0;border-radius:0 0 10px 10px;padding-top:8px}
|
|
103
126
|
.answer-fold:focus-visible{outline:2px solid var(--accent-ring);outline-offset:1px}
|
|
104
127
|
.answer-fold::before{content:"▾\00a0";color:var(--accent);flex:none}
|
|
105
128
|
.answer-fold.folded::before{content:"▸\00a0"}
|
|
@@ -114,6 +137,21 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
|
|
|
114
137
|
.answer-fold-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-2);font-size:13px}
|
|
115
138
|
.answer-fold-label:empty{display:none}
|
|
116
139
|
.answer-fold-size{flex:none;white-space:nowrap;font-variant-numeric:tabular-nums;transition:color .12s ease}
|
|
140
|
+
/* A peer's answer's row (answer_fold.js PEERS, closed by default): "<name> <verdict> <summary> N lines" in a plain panel
|
|
141
|
+
box, no chevron; the verdict in the text colour whatever it says; on a phone the summary truncates, the length stays.
|
|
142
|
+
Open, the same line is the box's top edge and the peer's bubble its rest. */
|
|
143
|
+
.answer-fold:is(.peer,.compact){gap:8px;padding:9px 12px;font-weight:400;color:var(--text);border-left-width:1px;border-left-color:var(--border);border-radius:10px}
|
|
144
|
+
.answer-fold:is(.peer,.compact)::before{content:none}
|
|
145
|
+
.answer-fold-name{flex:0 1 auto;min-width:0;max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:var(--text-bright)}
|
|
146
|
+
.answer-fold-verdict{flex:none;white-space:nowrap;font-weight:600}
|
|
147
|
+
.answer-fold-summary{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-3)}
|
|
148
|
+
.answer-fold:is(.peer,.compact) .answer-fold-size{font-size:12px;color:var(--text-faint)}
|
|
149
|
+
.answer-fold:is(.peer,.compact)>:empty{display:none}
|
|
150
|
+
/* Under its row (answer_fold.js .under-row) the bubble is the peer's text and its foot: the row says who, the verdict
|
|
151
|
+
and the summary; the head stays only for the ↑ to the send. */
|
|
152
|
+
.bubble.note.peer-answer.under-row>.note-text,.bubble.note.peer-answer.under-row>.peer-head>:not(.peer-up-slot){display:none}
|
|
153
|
+
.bubble.note.peer-answer.under-row>.peer-head:not(:has(.peer-up)){display:none}
|
|
154
|
+
.answer-fold.peer:not(.folded)+.bubble.note.peer-answer{border-color:var(--border);border-top:0;border-top-left-radius:0;border-top-right-radius:0;padding-top:8px}
|
|
117
155
|
/* Revise stacks (revise_stack.js): a superseded version folds to its stub; the Revise row under a final answer
|
|
118
156
|
(zero height: its button sits on the bubble's bottom edge, clear of the copy button, shown on hover) and a stack
|
|
119
157
|
top's version chip. */
|
|
@@ -715,6 +753,15 @@ button.peer-state{cursor:pointer}
|
|
|
715
753
|
.card-body>pre:only-child{background:transparent;border:none;padding:0;font-family:inherit;font-size:inherit}
|
|
716
754
|
.card-body :not(pre)>code{background:var(--bg-inset);border:1px solid var(--border);border-radius:4px;padding:1px 3px;font-size:.88em}
|
|
717
755
|
.card-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
|
|
756
|
+
/* A card's rows (card.js cardRowsTemplate): a list to pick from, each row its title, sub line and own buttons; on a phone the buttons take the row's width. */
|
|
757
|
+
.card-rows{display:flex;flex-direction:column;gap:8px;margin-top:6px}
|
|
758
|
+
.card-row{display:flex;gap:10px;align-items:center;min-width:0}
|
|
759
|
+
.card-row+.card-row{border-top:1px solid var(--border);padding-top:8px}
|
|
760
|
+
.card-row-txt{flex:1;min-width:0}
|
|
761
|
+
.card-row-title{color:var(--text-bright);font-weight:600;overflow-wrap:anywhere}
|
|
762
|
+
.card-row-sub{font-size:12px;color:var(--text-muted);overflow-wrap:anywhere}
|
|
763
|
+
.card-row-acts{display:flex;gap:6px;flex-wrap:wrap}
|
|
764
|
+
@media (max-width:600px){.card-row{flex-wrap:wrap}.card-row-acts{flex:1 1 100%}.card-row-acts .card-action{flex:1;min-height:40px;font-size:15px}}
|
|
718
765
|
.card-action{font-size:12.5px;padding:4px 10px}
|
|
719
766
|
/* A url action (card.js): an anchor that looks like the card's buttons; the line under the row names its host. */
|
|
720
767
|
.card-link{display:inline-block;font-size:12.5px;padding:4px 10px;border-radius:8px;background:var(--bg-raised);color:var(--text-2);text-decoration:none;transition:filter .12s ease}
|
|
@@ -912,6 +959,8 @@ body.has-session.fresh-link #composer .actions-col .model-pick:not([hidden]){dis
|
|
|
912
959
|
#modelList mark{background:none;color:var(--accent);font-weight:600}
|
|
913
960
|
#modelList .model-option.chosen mark{color:var(--text-bright)}
|
|
914
961
|
#modelList .model-note{flex:none;font-size:11px;color:var(--text-faint)}
|
|
962
|
+
#modelList .model-option.served .model-id{flex:none}
|
|
963
|
+
#modelList .model-option.served .model-note{flex:0 1 auto;min-width:0;margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
915
964
|
#modelList .model-option.unavailable:not(.chosen) .model-id,#modelList .model-option.unavailable .model-host{color:var(--text-faint)}
|
|
916
965
|
#modelList .model-option.unavailable .model-note{color:var(--warn-text)}
|
|
917
966
|
#modelList .model-empty{padding:10px;font-size:13px;color:var(--text-faint)}
|
|
@@ -1480,6 +1529,13 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1480
1529
|
/* A paired peer's one chip (peer_chip.js): waiting in the accent, can't send in warn, answers only dashed. */
|
|
1481
1530
|
#infoBar .ctx-chip.peer.waiting{color:var(--text);background:var(--accent-bg);border-color:var(--accent-border)}
|
|
1482
1531
|
#infoBar .ctx-chip.peer.cant-send{color:var(--warn-text);background:var(--warn-bg);border-color:var(--warn-border)}
|
|
1532
|
+
/* A peer the session waits for (/claude pair, peer_wait.js): the warning colours, as the mock-up's scene 4. */
|
|
1533
|
+
#infoBar .ctx-chip.peer.awaiting{color:var(--warn-text);background:var(--warn-bg);border-color:var(--warn-border)}
|
|
1534
|
+
.peer-wait{display:flex;gap:10px;align-items:center;min-width:0;margin-top:4px}
|
|
1535
|
+
.peer-wait-txt{flex:1;min-width:0}
|
|
1536
|
+
.peer-wait-main{color:var(--text-bright);font-weight:600;overflow-wrap:anywhere}
|
|
1537
|
+
.peer-wait-sub{font-size:12px;color:var(--text-muted);overflow-wrap:anywhere}
|
|
1538
|
+
@media (max-width:600px){.peer-wait{flex-wrap:wrap}.peer-wait>button{flex:1 1 100%;min-height:40px;font-size:15px}}
|
|
1483
1539
|
#infoBar .ctx-chip.peer.answers-only{border-style:dashed}
|
|
1484
1540
|
/* Its popover (scene 2): the two ways, the last exchanges, its actions; a bottom sheet on a phone. */
|
|
1485
1541
|
.ctx-popover.peer-pop{gap:12px}
|
|
@@ -2337,8 +2393,6 @@ body.participant-view .bubble.user:not(.by-participant)>.origin-label{color:var(
|
|
|
2337
2393
|
<section id="pageView" aria-label="Page"></section>
|
|
2338
2394
|
<section id="pagesList" aria-label="Pages"></section>
|
|
2339
2395
|
<section id="allView" aria-label="All sessions">
|
|
2340
|
-
<!-- Inert: an older cached app.js draws All sessions' Pages group into it (pages_group.js). Remove after 0.189.0. -->
|
|
2341
|
-
<div id="pagesGroup" hidden></div>
|
|
2342
2396
|
<div id="allList"></div>
|
|
2343
2397
|
<div id="allPath" hidden>Stored in <code></code></div>
|
|
2344
2398
|
</section>
|
|
@@ -163,7 +163,7 @@ export function infoBarModel({ id, state, sessions, chain, cardTitle, badge, res
|
|
|
163
163
|
// (resync_reach.js): +statusText+ and +statusTip+ then.
|
|
164
164
|
status: reach ? reach.status : running && waiting ? "waiting" : state.status,
|
|
165
165
|
...(reach ? { statusText: reach.text, statusTip: reach.tip } : {}),
|
|
166
|
-
model: modelLabel(state.model, ...(state.served || [])),
|
|
166
|
+
model: modelLabel(state.model, ...(state.served || [null, null, null]), state.modelServed),
|
|
167
167
|
// A link of a session chain: ← the previous link, → the next one (each
|
|
168
168
|
// only while the list holds it).
|
|
169
169
|
// +pruned+: the link before this one is gone (a schedule pruned it).
|
|
@@ -39,9 +39,13 @@ export const RECENT_KEY = "chi_model_recent";
|
|
|
39
39
|
// unavailable when that host failed to list its models. The
|
|
40
40
|
// default host's names are bare (name == id); the server's own default,
|
|
41
41
|
// unshifted when no host lists it, has no host and goes with them, shown
|
|
42
|
-
// by its name.
|
|
42
|
+
// by its name. A host's served row ("main:served", served: true: it follows
|
|
43
|
+
// the one model the host lists) shows the id "served", with servedId the
|
|
44
|
+
// one it runs on now; it is on the default host when the payload's
|
|
45
|
+
// default_host names its host.
|
|
43
46
|
export function modelRows(payload) {
|
|
44
47
|
const list = Array.isArray(payload?.models) ? payload.models : [];
|
|
48
|
+
const defaultHost = payload?.default_host ? String(payload.default_host) : "";
|
|
45
49
|
return list
|
|
46
50
|
.filter((m) => m && String(m.name || ""))
|
|
47
51
|
.map((m) => {
|
|
@@ -54,6 +58,9 @@ export function modelRows(payload) {
|
|
|
54
58
|
if (m.unavailable === true) row.unavailable = true;
|
|
55
59
|
if (m.llm_context && typeof m.llm_context === "object") row.llm_context = m.llm_context;
|
|
56
60
|
if (m.thinking && typeof m.thinking === "object") row.thinking = m.thinking;
|
|
61
|
+
// A served row keeps the rest (its sampling, llm_context, thinking:
|
|
62
|
+
// the start page's summaries); only its id and host place differ.
|
|
63
|
+
if (m.served === true && host) Object.assign(row, { id: "served", servedId: String(m.id || ""), served: true, isDefaultHost: host === defaultHost });
|
|
57
64
|
return row;
|
|
58
65
|
});
|
|
59
66
|
}
|
|
@@ -73,7 +80,9 @@ function shortNameCandidate(row) {
|
|
|
73
80
|
}
|
|
74
81
|
const model = id.slice(id.lastIndexOf("/") + 1) || name;
|
|
75
82
|
const labelHost = host && (!row?.isDefaultHost || !row?.host) ? `${host} · ` : "";
|
|
76
|
-
|
|
83
|
+
// A served row names what it runs on now: "main · served (now q8)".
|
|
84
|
+
const now = row?.served && row.servedId ? ` (now ${row.servedId.slice(row.servedId.lastIndexOf("/") + 1)})` : "";
|
|
85
|
+
return { name, label: `${labelHost}${model}${now}` };
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
// A compact label for the chosen model; list rows and all stored/API names
|
|
@@ -84,7 +93,7 @@ export function shortName(row, rows = []) {
|
|
|
84
93
|
return clashes > 1 ? candidate.name : candidate.label;
|
|
85
94
|
}
|
|
86
95
|
|
|
87
|
-
const byId = (a, b) => (b.configured === true) - (a.configured === true) ||
|
|
96
|
+
const byId = (a, b) => (b.served === true) - (a.served === true) || (b.configured === true) - (a.configured === true) ||
|
|
88
97
|
a.id.localeCompare(b.id, "en", { sensitivity: "base" });
|
|
89
98
|
|
|
90
99
|
// The rows under their hosts, [{host, isDefault, unavailable, rows}]: the
|
|
@@ -110,16 +119,20 @@ export function groupRows(rows) {
|
|
|
110
119
|
|
|
111
120
|
// The words after a row's id: "default" for the default model, else
|
|
112
121
|
// "config" for an id the host declares (hosts.<name>.models), else "";
|
|
113
|
-
// then "host down" when its host failed to
|
|
122
|
+
// then a served row's "now <id>"; then "host down" when its host failed to
|
|
123
|
+
// list its models.
|
|
114
124
|
export function rowNote(row, defaultName) {
|
|
115
125
|
const word = row.name === defaultName ? "default" : row.configured ? "config" : "";
|
|
116
|
-
|
|
126
|
+
// The id without its org ("unsloth/…"); the title has it whole.
|
|
127
|
+
const now = row.served && row.servedId ? `now ${row.servedId.slice(row.servedId.lastIndexOf("/") + 1)}` : "";
|
|
128
|
+
return [word, now, row.unavailable ? "host down" : ""].filter(Boolean).join(" · ");
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
// A row's tooltip: its configured sampling, where a configured id comes
|
|
120
132
|
// from, and that its host is down; "" when none.
|
|
121
133
|
export function rowTitle(row) {
|
|
122
134
|
const parts = [];
|
|
135
|
+
if (row.served) parts.push(`follows what host ${row.host} serves (now ${row.servedId}, as of the hosts' last listing, ≤ 60 s)`);
|
|
123
136
|
if (row.sampling) parts.push(`sampling: ${row.sampling}`);
|
|
124
137
|
if (row.configured) parts.push(`served by config (hosts.${row.host}.models)`);
|
|
125
138
|
if (row.unavailable) parts.push(`host ${row.host} didn't list its models (down?); a chat on it may fail`);
|