pi-studio 0.11.5 → 0.11.7

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.
@@ -568,8 +568,10 @@
568
568
  // Where Studio last moved the Working pane itself (to the bottom, say). The scroll event that follows is Studio's,
569
569
  // not the person's, so it leaves the pause alone (Sol, c99).
570
570
  let traceOwnScrollTop = null;
571
- // After Collapse all, steps that start later in the run arrive folded too, until Expand all (Oliver, 28 Oct).
571
+ // After Collapse all, steps that start later in the run arrive folded too, until Expand all (Oliver, 28 Oct); after
572
+ // Expand all they arrive open, until Collapse all, as in agent-markdown-preview (Oliver, 29 Oct).
572
573
  let traceStepsFolded = false;
574
+ let traceStepsExpanded = false;
573
575
  let traceRenderRaf = null;
574
576
  const traceExpandedOutputs = new Set();
575
577
  const traceOpenDetails = new Set();
@@ -686,6 +688,20 @@
686
688
  error: "",
687
689
  };
688
690
  let replTmuxAvailable = null;
691
+ // Whether the agent is told of new record entries ("on", "send" or "off"), from Studio's server.
692
+ let replRecordActivity = "off";
693
+ // The name this page's sends and notes are recorded under: chosen here and kept in this
694
+ // browser, else the default from Studio's server (PI_REPL_USER_NAME, then pi-repl's saved
695
+ // name, then "User"). Read once, so another tab choosing a name later leaves this page alone.
696
+ const REPL_PERSON_NAME_STORAGE_KEY = "piStudio.replPersonName.v1";
697
+ let replPersonName = loadReplPersonName();
698
+ let replPersonNameDefault = "User";
699
+ let replPersonNameSource = "default";
700
+ let replSenderEditing = false;
701
+ // What's typed in the name field, kept as it's typed so a redraw by any route keeps it (Sol).
702
+ let replSenderDraft = "";
703
+ // After Enter or Esc in the name field, the cursor goes back to ✎.
704
+ let replSenderReturnFocus = false;
689
705
  let replSessions = [];
690
706
  let replActiveSessionName = "";
691
707
  // Studio's selection as this page last adopted it, with its `shown`, and this page's
@@ -1171,6 +1187,7 @@
1171
1187
  traceStepsShownOpen.clear();
1172
1188
  traceStepsPaused = false;
1173
1189
  traceStepsFolded = false;
1190
+ traceStepsExpanded = false;
1174
1191
  }
1175
1192
  renderTraceViewIfActive();
1176
1193
  }
@@ -1340,7 +1357,7 @@
1340
1357
  }
1341
1358
 
1342
1359
  function normalizeTraceFilter(filter) {
1343
- return filter === "thinking" || filter === "tools" ? filter : "all";
1360
+ return filter === "messages" || filter === "thinking" || filter === "tools" ? filter : "all";
1344
1361
  }
1345
1362
 
1346
1363
  function setTraceFilter(nextFilter) {
@@ -1361,6 +1378,10 @@
1361
1378
  if (filter === "thinking") {
1362
1379
  return entries.filter((entry) => entry.type === "assistant" && String(entry.thinking || "").trim());
1363
1380
  }
1381
+ // What Pi wrote along the way, and the steers, without thinking or tools (Oliver, 29 Oct).
1382
+ if (filter === "messages") {
1383
+ return entries.filter((entry) => (entry.type === "assistant" || entry.type === "steer") && String(entry.text || "").trim());
1384
+ }
1364
1385
  return entries.filter((entry) => {
1365
1386
  if (entry.type === "assistant") {
1366
1387
  return Boolean(String(entry.thinking || "").trim() || String(entry.text || "").trim());
@@ -1406,6 +1427,10 @@
1406
1427
  .join("\n\n");
1407
1428
  }
1408
1429
 
1430
+ if (filter === "messages") {
1431
+ return entries.map((entry) => (entry.type === "steer" ? "Steer:\n" : "Assistant:\n") + String(entry.text || "").trim()).join("\n\n---\n\n");
1432
+ }
1433
+
1409
1434
  return entries.map((entry) => {
1410
1435
  if (entry.type === "assistant") {
1411
1436
  const parts = [];
@@ -1442,6 +1467,7 @@
1442
1467
 
1443
1468
  function getWorkingDocumentLabel(filterOverride) {
1444
1469
  const filter = normalizeTraceFilter(filterOverride || traceFilter);
1470
+ if (filter === "messages") return "working (messages)";
1445
1471
  if (filter === "thinking") return "working (thinking)";
1446
1472
  if (filter === "tools") return "working (tools)";
1447
1473
  return "working";
@@ -1597,6 +1623,8 @@
1597
1623
  runtime: typeof session.runtime === "string" ? session.runtime : "unknown",
1598
1624
  label: typeof session.label === "string" && session.label.trim() ? session.label.trim() : sessionName,
1599
1625
  source: typeof session.source === "string" ? session.source : "tmux",
1626
+ // Why Studio won't use its shared record from here, such as another record directory (pi-repl's P0).
1627
+ recordRefusal: typeof session.recordRefusal === "string" ? session.recordRefusal.slice(0, 1000) : "",
1600
1628
  };
1601
1629
  }
1602
1630
 
@@ -1829,9 +1857,10 @@
1829
1857
 
1830
1858
  function reconcileReplQuickPending() {
1831
1859
  if (!replQuickPending) return false;
1832
- const entry = replJournalEntries.find((candidate) => candidate.requestId === replQuickPending.requestId);
1860
+ // By its entry: the record gives a page's send its own request ID (studio:send:).
1861
+ const entry = replJournalEntries.find((candidate) => candidate.id === replQuickPending.journalEntryId);
1833
1862
  if (!entry || entry.status === "sending") return false;
1834
- return settleReplQuickPending(entry.requestId, entry.status !== "error");
1863
+ return settleReplQuickPending(replQuickPending.requestId, entry.status !== "error");
1835
1864
  }
1836
1865
 
1837
1866
  function updateReplQuickComposerActions() {
@@ -1877,6 +1906,7 @@
1877
1906
  target: session.target,
1878
1907
  tmuxSessionId: session.tmuxSessionId,
1879
1908
  tmuxSessionCreatedAt: session.tmuxSessionCreatedAt,
1909
+ recordRefusal: session.recordRefusal,
1880
1910
  })));
1881
1911
  }
1882
1912
 
@@ -2122,7 +2152,8 @@
2122
2152
  // its frame runs: composing, typing, a drag or focus elsewhere can start in between
2123
2153
  // (Sol, Astra). Composing holds even a forced redraw.
2124
2154
  function replRedrawMustWait(force) {
2125
- return replQuickComposing || (!force && isReplControlFocused() && !canRedrawReplUnderFocus());
2155
+ // Not under the name field while it's open either, even when forced: it would close mid-edit.
2156
+ return replQuickComposing || (replSenderEditing && isReplSenderNameFocused()) || (!force && isReplControlFocused() && !canRedrawReplUnderFocus());
2126
2157
  }
2127
2158
 
2128
2159
  function deferReplRedraw(force) {
@@ -2275,6 +2306,7 @@
2275
2306
  restoreReplQuickComposerCursor(cursor);
2276
2307
  applyReplQuickRefocus();
2277
2308
  if (replQuickFocusRequested) focusReplQuickComposer();
2309
+ focusReplSenderNameIfEditing();
2278
2310
  });
2279
2311
  }
2280
2312
 
@@ -2556,6 +2588,94 @@
2556
2588
  return "… " + formatCompactNumber(value.length - REPL_JOURNAL_OUTPUT_MAX_CHARS) + " earlier chars omitted …\n" + value.slice(value.length - REPL_JOURNAL_OUTPUT_MAX_CHARS);
2557
2589
  }
2558
2590
 
2591
+ // pi-repl's rule for a person's name (shared/repl-person.js): trimmed, at most 80
2592
+ // characters, nothing that could break or disguise it where it's shown.
2593
+ function validateReplPersonName(value) {
2594
+ if (typeof value !== "string") return { error: "a name must be text" };
2595
+ const name = value.trim();
2596
+ if (!name) return { error: "the name is empty" };
2597
+ if ([...name].length > 80) return { error: "the name is longer than 80 characters" };
2598
+ if (/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}]/u.test(name)) return { error: "the name has control characters" };
2599
+ return { name };
2600
+ }
2601
+
2602
+ function loadReplPersonName() {
2603
+ try {
2604
+ const checked = validateReplPersonName(window.localStorage ? window.localStorage.getItem(REPL_PERSON_NAME_STORAGE_KEY) : null);
2605
+ return checked.error ? "" : checked.name;
2606
+ } catch {
2607
+ return "";
2608
+ }
2609
+ }
2610
+
2611
+ function getReplSenderName() {
2612
+ return replPersonName || replPersonNameDefault || "User";
2613
+ }
2614
+
2615
+ // What sends and notes are recorded under: the name on screen, since a redraw that would
2616
+ // show a new default can be waiting (Astra, Sol). Without the row on screen, the name now.
2617
+ function getShownReplSenderName() {
2618
+ const row = rightView === "repl" && critiqueViewEl ? critiqueViewEl.querySelector("[data-repl-sender-shown]") : null;
2619
+ const shown = row ? validateReplPersonName(row.getAttribute("data-repl-sender-shown")) : null;
2620
+ return shown && !shown.error ? shown.name : getReplSenderName();
2621
+ }
2622
+
2623
+ // A blank name goes back to the default.
2624
+ function chooseReplPersonName(value) {
2625
+ const trimmed = String(value || "").trim();
2626
+ const checked = trimmed ? validateReplPersonName(trimmed) : { name: "" };
2627
+ if (checked.error) return checked;
2628
+ replPersonName = checked.name;
2629
+ try {
2630
+ if (window.localStorage) {
2631
+ if (replPersonName) window.localStorage.setItem(REPL_PERSON_NAME_STORAGE_KEY, replPersonName);
2632
+ else window.localStorage.removeItem(REPL_PERSON_NAME_STORAGE_KEY);
2633
+ }
2634
+ } catch {
2635
+ // The name still applies to this page.
2636
+ }
2637
+ return { name: getReplSenderName() };
2638
+ }
2639
+
2640
+ // A version 4 UUID. getRandomValues, since randomUUID needs a secure context and Studio
2641
+ // can be opened over the network.
2642
+ function makeReplPersonUuid() {
2643
+ const bytes = window.crypto.getRandomValues(new Uint8Array(16));
2644
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
2645
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
2646
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
2647
+ return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20);
2648
+ }
2649
+
2650
+ // A person's request ID under Studio's channel prefix (studio:send: or studio:note:).
2651
+ function makeReplPersonRequestId(kind) {
2652
+ return "studio:" + kind + ":" + makeReplPersonUuid();
2653
+ }
2654
+
2655
+ // This page's send, recorded under studio:send: and the send's request ID.
2656
+ function isReplEntryOfRequest(entry, requestId) {
2657
+ return Boolean(requestId) && (entry.requestId === requestId || entry.requestId === "studio:send:" + requestId);
2658
+ }
2659
+
2660
+ // Who sent an entry, as the shared protocol's readers show it and as Studio tells its
2661
+ // agent (describeReplEntrySender in shared/studio-repl-activity.js): an agent's label; a
2662
+ // name under a person's prefix on its matching origin; otherwise "User".
2663
+ function describeReplEntrySender(entry) {
2664
+ const oneLine = (value) => {
2665
+ const text = String(value == null ? "" : value).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]+/g, " ").replace(/\s+/g, " ").trim();
2666
+ return [...text].length > 80 ? [...text].slice(0, 79).join("") + "…" : text;
2667
+ };
2668
+ if (entry.mode === "agent") return oneLine(entry.label) || "Agent";
2669
+ const channels = [
2670
+ { prefix: /^pi:(?:send|env):/, origin: "pi-repl", channel: "Pi" },
2671
+ { prefix: /^cli:(?:send|env):/, origin: "pi-repl", channel: "terminal" },
2672
+ { prefix: /^studio:(?:send|note):/, origin: "pi-studio", channel: "Pi Studio" },
2673
+ ];
2674
+ const person = channels.find((candidate) => candidate.origin === entry.origin && candidate.prefix.test(entry.requestId || ""));
2675
+ if (person) return (oneLine(entry.label) || "User") + " · via " + person.channel;
2676
+ return entry.origin === "pi-studio" ? "User · via Pi Studio" : "User";
2677
+ }
2678
+
2559
2679
  function createReplJournalEntry(details) {
2560
2680
  const sharedSynced = details.sharedSynced === true;
2561
2681
  return {
@@ -2908,7 +3028,8 @@
2908
3028
  return;
2909
3029
  }
2910
3030
  const entry = addReplJournalEntry({
2911
- label: "note",
3031
+ requestId: makeReplPersonRequestId("note"),
3032
+ label: getShownReplSenderName(),
2912
3033
  prose: note,
2913
3034
  status: "note",
2914
3035
  mode: "literate",
@@ -2937,7 +3058,8 @@
2937
3058
  if (payload.noteOnly) {
2938
3059
  if (String(payload.prose || "").trim()) {
2939
3060
  const entry = addReplJournalEntry({
2940
- label: payload.label || "note",
3061
+ requestId: makeReplPersonRequestId("note"),
3062
+ label: getShownReplSenderName(),
2941
3063
  prose: payload.prose,
2942
3064
  status: "note",
2943
3065
  mode: payload.mode || "literate",
@@ -2958,12 +3080,14 @@
2958
3080
  setStatus("REPL submission is empty.", "warning");
2959
3081
  return null;
2960
3082
  }
2961
- const requestId = makeRequestId();
3083
+ // Recorded under the name shown, as studio:send: and this request's ID, here and by the
3084
+ // server, so the card shows the name while the send waits.
3085
+ const requestId = makeReplPersonUuid();
2962
3086
  const journalEntry = addReplJournalEntry({
2963
- requestId,
3087
+ requestId: "studio:send:" + requestId,
2964
3088
  sessionName: session.sessionName,
2965
3089
  runtime: getActiveReplRuntime(),
2966
- label: payload.label,
3090
+ label: getShownReplSenderName(),
2967
3091
  mode: payload.mode,
2968
3092
  prose: payload.prose,
2969
3093
  code: text,
@@ -2987,6 +3111,7 @@
2987
3111
  journalEntryId: journalEntry.id,
2988
3112
  createdAt: journalEntry.createdAt,
2989
3113
  label: journalEntry.label,
3114
+ personName: journalEntry.label,
2990
3115
  mode: journalEntry.mode,
2991
3116
  prose: journalEntry.prose,
2992
3117
  skippedChunks: journalEntry.skippedChunks,
@@ -3045,7 +3170,7 @@
3045
3170
  skippedChunks: 0,
3046
3171
  });
3047
3172
  if (!requestId) return false;
3048
- replQuickPending = { requestId, key, text };
3173
+ replQuickPending = { requestId, key, text, journalEntryId: activeReplJournalEntryId };
3049
3174
  const activeEl = document.activeElement;
3050
3175
  replQuickRefocus = activeEl instanceof Element && activeEl.closest(".repl-quick-composer") ? { requestId, settled: false } : null;
3051
3176
  renderReplViewIfActive({ force: true });
@@ -11888,6 +12013,7 @@
11888
12013
  || !target.matches("details[data-trace-details-key]")) return;
11889
12014
  const key = target.getAttribute("data-trace-details-key") || "";
11890
12015
  if (!key) return;
12016
+ syncTraceBulkToggle();
11891
12017
  const expected = target.getAttribute("data-trace-expected-open");
11892
12018
  // Initial open attributes also queue native toggles: not user choices.
11893
12019
  if (expected !== null && expected === String(target.open) && target.getAttribute("data-trace-user-toggle") !== "1") return;
@@ -11904,7 +12030,7 @@
11904
12030
  // as it was, so a step opened afterwards shows its sections. Expand all opens everything (Oliver, 28 Oct).
11905
12031
  const steps = Boolean(studioUiRefreshUi);
11906
12032
  const nodes = critiqueViewEl.querySelectorAll(steps && !open ? "details.trace-step[data-trace-details-key]" : "details[data-trace-details-key]");
11907
- if (steps) traceStepsFolded = !open;
12033
+ if (steps) { traceStepsFolded = !open; traceStepsExpanded = open; }
11908
12034
  for (const node of nodes) {
11909
12035
  const key = node.getAttribute("data-trace-details-key");
11910
12036
  if (open) { traceOpenDetails.add(key); traceClosedDetails.delete(key); }
@@ -11923,9 +12049,30 @@
11923
12049
  fold?.querySelector(":scope > summary")?.focus({ preventScroll: true });
11924
12050
  }
11925
12051
  if (nodes.length) traceAutoScroll = false;
12052
+ syncTraceBulkToggle();
11926
12053
  return nodes.length > 0;
11927
12054
  }
11928
12055
 
12056
+ // In the new layout one button folds or opens every step, labelled with what a click does: Collapse all only when every
12057
+ // step shown is open, as in agent-markdown-preview (Oliver, 29 Oct). The classic layout keeps its two buttons.
12058
+ function getTraceBulkToggle(allOpen) {
12059
+ return allOpen
12060
+ ? { action: "collapse", label: "Collapse all", keys: "Control+Shift+[", title: "Fold every step; later steps arrive folded, until Expand all (Ctrl+Shift+[ while focused here)" }
12061
+ : { action: "expand", label: "Expand all", keys: "Control+Shift+]", title: "Open every step; later steps arrive open, until Collapse all (Ctrl+Shift+] while focused here)" };
12062
+ }
12063
+
12064
+ function syncTraceBulkToggle() {
12065
+ const button = studioUiRefreshUi && critiqueViewEl ? critiqueViewEl.querySelector("[data-trace-bulk]") : null;
12066
+ if (!button) return;
12067
+ const steps = Array.from(critiqueViewEl.querySelectorAll("details.trace-step[data-trace-details-key]"));
12068
+ const toggle = getTraceBulkToggle(steps.length > 0 && steps.every((step) => step.open));
12069
+ if (button.getAttribute("data-trace-action") === toggle.action) return;
12070
+ button.setAttribute("data-trace-action", toggle.action);
12071
+ button.setAttribute("aria-keyshortcuts", toggle.keys);
12072
+ button.title = toggle.title;
12073
+ button.textContent = toggle.label;
12074
+ }
12075
+
11929
12076
  function handleTracePaneKeydown(event) {
11930
12077
  if (!event || event.defaultPrevented || event.repeat || event.isComposing || rightView !== "trace" || studioLinkedReaderIsActive()
11931
12078
  || studioModalBlocksDraftAction() || !event.ctrlKey || !event.shiftKey || event.metaKey || event.altKey
@@ -11995,6 +12142,13 @@
11995
12142
  if (!actionBtn) return;
11996
12143
  event.preventDefault();
11997
12144
  const action = actionBtn.getAttribute("data-repl-action") || "";
12145
+ // The name isn't the session's, so a pane drawn for another session can still change it.
12146
+ if (action === "sender-edit") {
12147
+ replSenderEditing = true;
12148
+ replSenderDraft = replPersonName || getReplSenderName();
12149
+ renderReplViewIfActive({ force: true });
12150
+ return;
12151
+ }
11998
12152
  if (isReplPaneStale(actionBtn)) {
11999
12153
  refuseStaleReplPaneAction(action === "quick-send" ? "The REPL session changed, so nothing was sent." : "The REPL session changed, so nothing was done.");
12000
12154
  return;
@@ -12141,7 +12295,13 @@
12141
12295
  }
12142
12296
 
12143
12297
  // A redraw that waited for a control runs once focus has left it.
12144
- function handleReplPaneFocusOut() {
12298
+ function handleReplPaneFocusOut(event) {
12299
+ const target = event && event.target;
12300
+ // Leaving the name field keeps what's in it; a redraw that removed it doesn't count.
12301
+ if (target instanceof HTMLInputElement && target.hasAttribute("data-repl-sender-name") && target.isConnected) {
12302
+ finishReplSenderEdit(true);
12303
+ return;
12304
+ }
12145
12305
  if (!replRedrawDeferred) return;
12146
12306
  window.setTimeout(replayDeferredReplRedraw, 0);
12147
12307
  }
@@ -12171,6 +12331,10 @@
12171
12331
  function handleReplPaneInput(event) {
12172
12332
  if (rightView !== "repl") return;
12173
12333
  const target = event && event.target;
12334
+ if (target instanceof HTMLInputElement && target.hasAttribute("data-repl-sender-name")) {
12335
+ replSenderDraft = target.value;
12336
+ return;
12337
+ }
12174
12338
  if (!(target instanceof HTMLTextAreaElement) || !target.hasAttribute("data-repl-quick-draft")) return;
12175
12339
  replQuickLastInputAt = Date.now();
12176
12340
  // The text belongs to the session the box was drawn for, even if another is selected
@@ -12185,6 +12349,15 @@
12185
12349
  function handleReplPaneKeydown(event) {
12186
12350
  if (rightView !== "repl" || !event || event.isComposing) return;
12187
12351
  const target = event.target;
12352
+ if (target instanceof HTMLInputElement && target.hasAttribute("data-repl-sender-name")) {
12353
+ if (event.key !== "Enter" && event.key !== "Escape") return;
12354
+ event.preventDefault();
12355
+ event.stopPropagation();
12356
+ replSenderReturnFocus = true;
12357
+ finishReplSenderEdit(event.key === "Enter");
12358
+ if (replSenderEditing) replSenderReturnFocus = false;
12359
+ return;
12360
+ }
12188
12361
  if (!(target instanceof HTMLTextAreaElement) || !target.hasAttribute("data-repl-quick-draft")) return;
12189
12362
  const submitShortcut = event.key === "Enter"
12190
12363
  && (event.metaKey || event.ctrlKey)
@@ -14172,8 +14345,9 @@
14172
14345
  function buildReplStudioMeta(entry) {
14173
14346
  const parts = [];
14174
14347
  const kind = getReplStudioEntryKind(entry);
14175
- if (kind !== "Raw") parts.push(kind);
14176
- if (entry.origin) parts.push(entry.origin);
14348
+ // An agent's entry is named by who sent it.
14349
+ if (kind !== "Raw" && kind !== "Pi") parts.push(kind);
14350
+ parts.push(describeReplEntrySender(entry));
14177
14351
  const time = formatReferenceTime(entry.createdAt);
14178
14352
  if (time) parts.push(time);
14179
14353
  if (entry.skippedChunks) parts.push("skipped " + String(entry.skippedChunks));
@@ -14225,10 +14399,12 @@
14225
14399
  }
14226
14400
 
14227
14401
  function buildReplJournalHtml(transcript) {
14228
- const visibleEntries = getVisibleReplJournalEntries();
14402
+ const sessionName = getActiveReplJournalSessionName();
14403
+ // A record Studio won't use from here says why, and entries kept from before aren't shown as its record (P0).
14404
+ const recordRefusal = (replSessions.find((session) => session.sessionName === sessionName) || {}).recordRefusal || "";
14405
+ const visibleEntries = recordRefusal ? [] : getVisibleReplJournalEntries();
14229
14406
  const hasEntries = visibleEntries.length > 0;
14230
14407
  const entryCount = visibleEntries.length;
14231
- const sessionName = getActiveReplJournalSessionName();
14232
14408
  const collapsedClass = replJournalCollapsed ? " is-collapsed" : "";
14233
14409
  const toggleButton = "<button type='button' data-repl-action='journal-toggle' aria-expanded='" + (replJournalCollapsed ? "false" : "true") + "'>" + (replJournalCollapsed ? "Show record" : "Hide record") + "</button>";
14234
14410
  const toggleActions = "<div class='repl-journal-actions'>" + toggleButton + "</div>";
@@ -14266,8 +14442,9 @@
14266
14442
  const pending = !output && entry.status === "sending"
14267
14443
  ? "<div class='repl-studio-pending'>Running…</div>"
14268
14444
  : "";
14445
+ // Who sent it shows; the rest, such as the time, is in its tooltip.
14269
14446
  return "<article class='repl-journal-card repl-studio-entry'>"
14270
- + (meta ? "<div class='repl-studio-entry-meta'>" + escapeHtml(meta) + "</div>" : "")
14447
+ + (meta ? "<div class='repl-studio-entry-meta' title='" + escapeHtml(meta) + "'>" + escapeHtml(describeReplEntrySender(entry)) + "</div>" : "")
14271
14448
  + prose
14272
14449
  + code
14273
14450
  + output
@@ -14280,10 +14457,13 @@
14280
14457
  : "No compatible-client record entries yet. Send code from pi-repl or Studio, or use More → Add note (Literate send) to record prose.")
14281
14458
  : "No compatible-client record entries yet. Send code from pi-repl or Studio, or use More → Add note (Literate send) to record prose.";
14282
14459
  const terminalContent = banner
14283
- + (hasEntries ? cards : "<div class='repl-studio-empty'>" + escapeHtml(emptyText) + "</div>");
14460
+ + (hasEntries ? cards : (recordRefusal ? "" : "<div class='repl-studio-empty'>" + escapeHtml(emptyText) + "</div>"));
14284
14461
  return "<section class='repl-journal'>"
14285
14462
  + "<div class='repl-journal-header'><h3>Shared REPL Record</h3>" + toggleActions + "</div>"
14286
- + "<p class='repl-journal-description'>What Studio and pi-repl have sent to this session.</p>"
14463
+ + "<p class='repl-journal-description'>What Studio and pi-repl have sent to this session."
14464
+ + (replRecordActivity === "off" ? "" : " New entries here go to the agent and its model provider.")
14465
+ + "</p>"
14466
+ + (recordRefusal ? "<p class='repl-journal-omitted'>" + escapeHtml("Not shown: " + recordRefusal) + "</p>" : "")
14287
14467
  + (omitted ? "<div class='repl-journal-omitted'>Showing latest 12 entries for this session; " + escapeHtml(String(omitted)) + " older entries remain in export.</div>" : "")
14288
14468
  // The prompt column fits the longest prompt, such as gnuplot>, in the prompt's own font.
14289
14469
  + "<div class='repl-journal-list' style='--repl-studio-prompt-chars: " + Math.max(0, ...visibleEntries.map((entry) => getReplStudioPrompt(entry.runtime).length)) + "'>" + terminalContent + "</div>"
@@ -14318,6 +14498,77 @@
14318
14498
  return "tmux attach -t " + String(session.sessionName || "");
14319
14499
  }
14320
14500
 
14501
+ // "Sending as …": the name this page's sends and notes are recorded under, and its editor.
14502
+ function buildReplSenderHtml() {
14503
+ const name = getReplSenderName();
14504
+ if (replSenderEditing) {
14505
+ return "<span class='repl-quick-sender'><label>Sending as <input data-repl-sender-name type='text' value='" + escapeHtml(replSenderDraft) + "' placeholder='" + escapeHtml(replPersonNameDefault || "User") + "' aria-label='Name your sends and notes are recorded under' title='Enter to keep, Esc to cancel. Leave it empty for " + escapeHtml(replPersonNameDefault || "User") + ".'></label></span>";
14506
+ }
14507
+ const from = replPersonName
14508
+ ? "Chosen in this browser."
14509
+ : (replPersonNameSource === "environment"
14510
+ ? "From PI_REPL_USER_NAME."
14511
+ : (replPersonNameSource === "setting" ? "The name saved with /repl name or agent-repl name." : "No name is set."));
14512
+ return "<span class='repl-quick-sender' data-repl-sender-shown='" + escapeHtml(name) + "' title='Your sends and notes are recorded under this name. " + escapeHtml(from) + "'>Sending as <strong>" + escapeHtml(name) + "</strong>"
14513
+ + "<button type='button' class='repl-quick-sender-edit' data-repl-action='sender-edit' aria-label='Change the name your sends and notes are recorded under' title='Change name'>✎</button></span>";
14514
+ }
14515
+
14516
+ function isReplSenderNameFocused() {
14517
+ const activeEl = document.activeElement;
14518
+ return activeEl instanceof HTMLInputElement && activeEl.hasAttribute("data-repl-sender-name");
14519
+ }
14520
+
14521
+ function focusReplSenderNameIfEditing() {
14522
+ if (!critiqueViewEl) return;
14523
+ if (!replSenderEditing) {
14524
+ const button = replSenderReturnFocus ? critiqueViewEl.querySelector("[data-repl-action='sender-edit']") : null;
14525
+ replSenderReturnFocus = false;
14526
+ if (button instanceof HTMLElement) button.focus({ preventScroll: true });
14527
+ return;
14528
+ }
14529
+ if (isReplSenderNameFocused()) return;
14530
+ const input = critiqueViewEl.querySelector("[data-repl-sender-name]");
14531
+ if (!(input instanceof HTMLInputElement)) return;
14532
+ input.focus({ preventScroll: true });
14533
+ input.select();
14534
+ }
14535
+
14536
+ // Where the cursor is in the name field, so a redraw by any route puts it back: a response
14537
+ // can redraw the pane without waiting for the field (Sol).
14538
+ function captureReplSenderCursor() {
14539
+ if (!replSenderEditing || !isReplSenderNameFocused()) return null;
14540
+ const input = document.activeElement;
14541
+ return { start: input.selectionStart, end: input.selectionEnd, direction: input.selectionDirection };
14542
+ }
14543
+
14544
+ function restoreReplSenderCursor(cursor) {
14545
+ if (!cursor || !replSenderEditing || !critiqueViewEl) return;
14546
+ const input = critiqueViewEl.querySelector("[data-repl-sender-name]");
14547
+ if (!(input instanceof HTMLInputElement)) return;
14548
+ input.focus({ preventScroll: true });
14549
+ try {
14550
+ input.setSelectionRange(cursor.start, cursor.end, cursor.direction || "none");
14551
+ } catch {}
14552
+ }
14553
+
14554
+ // Enter or leaving the field keeps the name; Esc doesn't.
14555
+ function finishReplSenderEdit(keep) {
14556
+ if (!replSenderEditing) return;
14557
+ const input = critiqueViewEl ? critiqueViewEl.querySelector("[data-repl-sender-name]") : null;
14558
+ if (keep && input instanceof HTMLInputElement) {
14559
+ const before = getReplSenderName();
14560
+ const chosen = chooseReplPersonName(input.value);
14561
+ if (chosen.error) {
14562
+ setStatus("Name not changed: " + chosen.error + ".", "warning");
14563
+ if (document.activeElement === input) return;
14564
+ } else if (chosen.name !== before) {
14565
+ setStatus("Sending as " + chosen.name + ".", "success");
14566
+ }
14567
+ }
14568
+ replSenderEditing = false;
14569
+ renderReplViewIfActive({ force: true });
14570
+ }
14571
+
14321
14572
  function buildReplQuickComposerHtml(activeSession, canSendToActiveSession) {
14322
14573
  const key = getReplQuickDraftKey(activeSession);
14323
14574
  const draft = getReplQuickDraft(activeSession);
@@ -14334,7 +14585,7 @@
14334
14585
  + "<div class='repl-quick-header'><div><strong id='replQuickComposerTitle'>Quick send</strong><button type='button' class='repl-quick-target' data-repl-action='jump-controls' title='Target: " + escapeHtml(targetDetails) + ". Jump to REPL session controls.' aria-label='Target: " + escapeHtml(targetDetails) + ". Jump to REPL session controls.'><span class='repl-quick-target-label'>" + escapeHtml(visibleTargetLabel) + "</span><span class='repl-quick-target-arrow' aria-hidden='true'>↑</span></button></div>"
14335
14586
  + "<span class='repl-quick-hint'>Enter adds a line · Cmd/Ctrl+Enter sends</span></div>"
14336
14587
  + "<textarea data-repl-quick-draft data-repl-quick-lifetime='" + escapeHtml(encodeURIComponent(key)) + "'" + (replQuickBoxHeight ? " style='height: " + replQuickBoxHeight + "'" : "") + " rows='3' maxlength='" + REPL_QUICK_DRAFT_MAX_CHARS + "' aria-label='Quick code for " + escapeHtml(targetDetails) + "' aria-keyshortcuts='Meta+Enter Control+Enter' placeholder='" + (activeSession ? (key ? "Type a short command or snippet…" : "Exact tmux identity unavailable; refresh the session list") : "Start or select a REPL session first") + "'" + (inputDisabled ? " disabled" : "") + ">" + escapeHtml(draft) + "</textarea>"
14337
- + "<div class='repl-quick-actions'><span></span><div>"
14588
+ + "<div class='repl-quick-actions'>" + buildReplSenderHtml() + "<div>"
14338
14589
  + "<button type='button' data-repl-action='quick-clear'" + (pending || !draft ? " disabled" : "") + ">Clear</button>"
14339
14590
  + "<button class='repl-quick-send-btn' type='button' data-repl-action='quick-send'" + (sendDisabled ? " disabled" : "") + ">" + (pending ? "Sending…" : "Send") + "</button>"
14340
14591
  + "</div></div></section>";
@@ -14423,9 +14674,9 @@
14423
14674
  : (context.mode === "missing"
14424
14675
  ? "Not saved"
14425
14676
  : (TRACE_RUN_STATUS_LABELS[state.status] || "Idle")));
14426
- const filterMeta = filter === "thinking"
14427
- ? "Thinking only"
14428
- : (filter === "tools" ? "Tools only" : null);
14677
+ const filterMeta = filter === "messages"
14678
+ ? "Messages only"
14679
+ : (filter === "thinking" ? "Thinking only" : (filter === "tools" ? "Tools only" : null));
14429
14680
  const historyMeta = (context.mode === "history" || context.mode === "missing" || context.mode === "loading")
14430
14681
  ? getTraceHistoryContextLabel()
14431
14682
  : null;
@@ -14433,7 +14684,7 @@
14433
14684
  // step is one numbered line until opened, and this header is the one line saying the run's state (the pane is
14434
14685
  // already called Working).
14435
14686
  const steps = Boolean(studioUiRefreshUi);
14436
- const toolbar = "<div class='trace-toolbar'>"
14687
+ const toolbar = (allOpen) => "<div class='trace-toolbar'>"
14437
14688
  + "<div class='trace-summary'>"
14438
14689
  + (steps ? "" : "<span class='trace-summary-badge'>Working</span>")
14439
14690
  + "<span class='trace-summary-status trace-status-" + escapeHtml(String(state.status || "idle")) + "'>" + escapeHtml(statusLabel) + "</span>"
@@ -14446,12 +14697,15 @@
14446
14697
  + "<div class='trace-controls'>"
14447
14698
  + "<div class='trace-filter-group' role='tablist' aria-label='Working components'>"
14448
14699
  + "<button type='button' class='trace-filter-btn" + (filter === "all" ? " is-active" : "") + "' data-trace-filter='all' aria-pressed='" + (filter === "all" ? "true" : "false") + "'>All</button>"
14700
+ + "<button type='button' class='trace-filter-btn" + (filter === "messages" ? " is-active" : "") + "' data-trace-filter='messages' aria-pressed='" + (filter === "messages" ? "true" : "false") + "'>Messages</button>"
14449
14701
  + "<button type='button' class='trace-filter-btn" + (filter === "thinking" ? " is-active" : "") + "' data-trace-filter='thinking' aria-pressed='" + (filter === "thinking" ? "true" : "false") + "'>Thinking</button>"
14450
14702
  + "<button type='button' class='trace-filter-btn" + (filter === "tools" ? " is-active" : "") + "' data-trace-filter='tools' aria-pressed='" + (filter === "tools" ? "true" : "false") + "'>Tools</button>"
14451
14703
  + "</div>"
14452
- + "<button type='button' class='trace-action-btn' data-trace-action='collapse' aria-keyshortcuts='Control+Shift+[' title='Collapse displayed Working sections (Ctrl+Shift+[ while focused here)'" + (entries.length ? "" : " disabled") + ">Collapse all</button>"
14453
- + "<button type='button' class='trace-action-btn' data-trace-action='expand' aria-keyshortcuts='Control+Shift+]' title='Expand displayed Working sections (Ctrl+Shift+] while focused here); full output stays a separate choice'" + (entries.length ? "" : " disabled") + ">Expand all</button>"
14454
- + "<button type='button' class='trace-action-btn' data-trace-action='load'" + (hasVisibleContent ? "" : " disabled") + ">Load visible into editor</button>"
14704
+ + (steps ? renderTraceBulkToggle(getTraceBulkToggle(allOpen), entries.length > 0)
14705
+ : "<button type='button' class='trace-action-btn' data-trace-action='collapse' aria-keyshortcuts='Control+Shift+[' title='Collapse displayed Working sections (Ctrl+Shift+[ while focused here)'" + (entries.length ? "" : " disabled") + ">Collapse all</button>"
14706
+ + "<button type='button' class='trace-action-btn' data-trace-action='expand' aria-keyshortcuts='Control+Shift+]' title='Expand displayed Working sections (Ctrl+Shift+] while focused here); full output stays a separate choice'" + (entries.length ? "" : " disabled") + ">Expand all</button>")
14707
+ // The new layout has Copy only, so the row stays one line beside the editor; paste does what Load did (Oliver, 29 Oct).
14708
+ + (steps ? "" : "<button type='button' class='trace-action-btn' data-trace-action='load'" + (hasVisibleContent ? "" : " disabled") + ">Load visible into editor</button>")
14455
14709
  + "<button type='button' class='trace-action-btn' data-trace-action='copy'" + (hasVisibleContent ? "" : " disabled") + ">Copy visible</button>"
14456
14710
  + "</div>"
14457
14711
  + "</div>";
@@ -14462,14 +14716,16 @@
14462
14716
  ? "Loading saved working for this response…"
14463
14717
  : (context.mode === "missing"
14464
14718
  ? "No working was saved for this response."
14465
- : (filter === "thinking"
14466
- ? "No thinking steps in this working view yet."
14467
- : (filter === "tools"
14468
- ? "No tool steps in this working view yet."
14469
- : (state.status === "running"
14470
- ? "Waiting for the first model or tool update…"
14471
- : "No live working view yet. Start a run or critique to watch working details here."))));
14472
- return "<div class='trace-panel'>" + toolbar + (promptCard ? "<div class='trace-list'>" + promptCard + "</div>" : "")
14719
+ : (filter === "messages"
14720
+ ? "No messages in this working view yet."
14721
+ : (filter === "thinking"
14722
+ ? "No thinking steps in this working view yet."
14723
+ : (filter === "tools"
14724
+ ? "No tool steps in this working view yet."
14725
+ : (state.status === "running"
14726
+ ? "Waiting for the first model or tool update…"
14727
+ : "No live working view yet. Start a run or critique to watch working details here.")))));
14728
+ return "<div class='trace-panel'>" + toolbar(false) + (promptCard ? "<div class='trace-list'>" + promptCard + "</div>" : "")
14473
14729
  + "<div class='trace-empty'>" + escapeHtml(emptyMessage) + "</div></div>";
14474
14730
  }
14475
14731
 
@@ -14477,14 +14733,15 @@
14477
14733
  const positions = new Map(getTraceEntriesForFilter("all").map((entry, index) => [entry.id, index + 1]));
14478
14734
  const latestId = entries[entries.length - 1].id, shownOpen = new Map();
14479
14735
  // Oliver, 29 Oct (option C): a step's line is its number, its kind, what a tool acted on, and its time on the right,
14480
- // as on agent-markdown-preview's page. A folded step adds its first line, muted.
14736
+ // as on agent-markdown-preview's page. An Assistant step's line adds its first line, muted, open or folded; the prompt's
14737
+ // and a steer's add theirs while folded.
14481
14738
  const card = (kindClass, entry, line, body, options) => {
14482
14739
  const settings = options || {};
14483
14740
  if (!steps) return "<article class='trace-card " + kindClass + "'><div class='trace-card-header'>" + line.classic + "</div>" + body + "</article>";
14484
14741
  const key = "step:" + entry.id, running = entry.status === "streaming" || entry.status === "pending";
14485
14742
  // Earlier steps fold as new ones arrive, except while the person has scrolled up to read. A steer, like the
14486
14743
  // prompt, is open when short.
14487
- const opened = traceStepIsOpen(key, !traceStepsFolded && (typeof settings.openByDefault === "boolean" ? settings.openByDefault
14744
+ const opened = traceStepIsOpen(key, traceStepsExpanded || !traceStepsFolded && (typeof settings.openByDefault === "boolean" ? settings.openByDefault
14488
14745
  : (running || entry.id === latestId || (traceStepsPaused && traceStepsShownOpen.has(key)))));
14489
14746
  shownOpen.set(key, opened);
14490
14747
  const preview = String(settings.preview || "").split("\n").find(part => part.trim()) || "";
@@ -14500,12 +14757,12 @@
14500
14757
  const cards = entries.map((entry) => {
14501
14758
  if (entry.type === "assistant") {
14502
14759
  const sections = [];
14503
- if (String(entry.thinking || "").trim()) {
14760
+ if (filter !== "messages" && String(entry.thinking || "").trim()) {
14504
14761
  sections.push(
14505
14762
  renderTraceSection("Thinking", entry.thinking, entry.id + ":thinking", renderTraceOutput(entry.thinking, entry.id + ":thinking", { label: "Thinking", prose: true, headings: steps }))
14506
14763
  );
14507
14764
  }
14508
- if (filter === "all" && String(entry.text || "").trim()) {
14765
+ if ((filter === "all" || filter === "messages") && String(entry.text || "").trim()) {
14509
14766
  sections.push(
14510
14767
  renderTraceSection("Response", entry.text, entry.id + ":response", renderTraceOutput(entry.text, entry.id + ":response", { label: "Response", prose: true }))
14511
14768
  );
@@ -14550,7 +14807,13 @@
14550
14807
  // Only the steps shown now: one hidden by a filter keeps its state, so a filter round trip folds nothing (Astra).
14551
14808
  for (const [key, opened] of shownOpen) { if (opened) traceStepsShownOpen.add(key); else traceStepsShownOpen.delete(key); }
14552
14809
 
14553
- return "<div class='trace-panel'>" + toolbar + "<div class='trace-list'>" + promptCard + cards + "</div></div>";
14810
+ const allOpen = (!promptCard || tracePromptCardIsOpen(state)) && Array.from(shownOpen.values()).every(Boolean);
14811
+ return "<div class='trace-panel'>" + toolbar(allOpen) + "<div class='trace-list'>" + promptCard + cards + "</div></div>";
14812
+ }
14813
+
14814
+ function renderTraceBulkToggle(toggle, enabled) {
14815
+ return "<button type='button' class='trace-action-btn' data-trace-bulk data-trace-action='" + toggle.action + "' aria-keyshortcuts='" + toggle.keys
14816
+ + "' title='" + escapeHtml(toggle.title) + "'" + (enabled ? "" : " disabled") + ">" + toggle.label + "</button>";
14554
14817
  }
14555
14818
 
14556
14819
  // What a tool step acted on, for its line: the file's name for read, write and edit, otherwise its activity label,
@@ -14585,10 +14848,15 @@
14585
14848
  }
14586
14849
 
14587
14850
  // What Pi is responding to: open when short, otherwise one line with its start, like a long section.
14851
+ function tracePromptCardIsOpen(state) {
14852
+ const text = String(state.prompt || "");
14853
+ const short = text.length <= TRACE_SECTION_AUTO_OPEN_MAX_CHARS && countTraceTextLines(text) <= TRACE_SECTION_AUTO_OPEN_MAX_LINES;
14854
+ return traceStepIsOpen("prompt:" + (state.runId || "live"), short);
14855
+ }
14856
+
14588
14857
  function renderTracePromptCard(state) {
14589
14858
  const text = String(state.prompt || ""), key = "prompt:" + (state.runId || "live");
14590
- const short = text.length <= TRACE_SECTION_AUTO_OPEN_MAX_CHARS && countTraceTextLines(text) <= TRACE_SECTION_AUTO_OPEN_MAX_LINES;
14591
- const opened = traceStepIsOpen(key, short);
14859
+ const opened = tracePromptCardIsOpen(state);
14592
14860
  const firstLine = text.split("\n").find(line => line.trim()) || "", time = formatReferenceTime(state.startedAt);
14593
14861
  return "<details class='trace-card trace-card-prompt trace-step' data-trace-details-key='" + escapeHtml(key) + "' data-trace-expected-open='" + opened + "'" + (opened ? " open" : "") + ">"
14594
14862
  + "<summary class='trace-card-header'><span class='trace-card-title'>Prompt</span>"
@@ -14631,8 +14899,10 @@
14631
14899
  if (!critiqueViewEl) return;
14632
14900
  const shouldStick = shouldAutoStickReplView();
14633
14901
  const previousScrollTop = critiqueViewEl.scrollTop;
14902
+ const senderCursor = captureReplSenderCursor();
14634
14903
  finishPreviewRender(critiqueViewEl);
14635
14904
  critiqueViewEl.innerHTML = buildReplPanelHtml();
14905
+ restoreReplSenderCursor(senderCursor);
14636
14906
  critiqueViewEl.classList.remove("response-scroll-resetting");
14637
14907
  if (shouldStick) {
14638
14908
  critiqueViewEl.scrollTop = critiqueViewEl.scrollHeight;
@@ -17876,6 +18146,10 @@
17876
18146
  if (!current()) throw new Error("The editor changed. Current work was kept.");
17877
18147
  captureStudioBufferTransientState(); persistWorkspaceStateNow(); await bufferRecoveryClient.settled();
17878
18148
  const ready = await prepareDocumentHostingReplacement(bufferId, current);
18149
+ // The persistence timer can resend an unchanged checkpoint during that request; the open's gate refuses
18150
+ // while any save is in flight, so let it land first. A real change meanwhile still fails the check below
18151
+ // (c73's intermittent refusal after a reload, 30 Oct).
18152
+ await bufferRecoveryClient.settled();
17879
18153
  if (!ready()) throw new Error("The owning checkpoint changed before opening.");
17880
18154
  },
17881
18155
  capture: () => { captureStudioBufferTransientState(); persistWorkspaceStateNow(); },
@@ -29144,11 +29418,16 @@
29144
29418
  const settlesPendingRequest = Boolean(responseRequestId && responseRequestId === replPendingRequestId);
29145
29419
  const previousActiveLifetimeKey = getReplQuickDraftKey(getActiveReplSession());
29146
29420
  const previousRuntime = replRuntime;
29421
+ const previousSender = getReplSenderName() + "\u001e" + replPersonNameSource;
29147
29422
  // Every repl_state states Studio's selection; while this page's own choice is
29148
29423
  // unanswered, only that choice's reply changes what the page shows.
29149
29424
  noteReplChoiceAnswer(message);
29150
29425
  const present = !isReplChoicePending();
29151
29426
  replTmuxAvailable = typeof message.tmuxAvailable === "boolean" ? message.tmuxAvailable : replTmuxAvailable;
29427
+ if (message.recordActivity === "on" || message.recordActivity === "send" || message.recordActivity === "off") replRecordActivity = message.recordActivity;
29428
+ const defaultName = validateReplPersonName(message.personName);
29429
+ if (!defaultName.error) replPersonNameDefault = defaultName.name;
29430
+ if (message.personNameSource === "environment" || message.personNameSource === "setting" || message.personNameSource === "default") replPersonNameSource = message.personNameSource;
29152
29431
  const sessionsChanged = setReplSessions(message.sessions);
29153
29432
  if (present) adoptReplSelection(message);
29154
29433
  const journalChanged = mergeReplJournalEntries(message.journalEntries);
@@ -29174,6 +29453,7 @@
29174
29453
  || previousError !== replError
29175
29454
  || previousMessage !== replMessage
29176
29455
  || journalChanged
29456
+ || previousSender !== getReplSenderName() + "\u001e" + replPersonNameSource
29177
29457
  || (!previousCapturedAt && replCapturedAt);
29178
29458
  if (viewChanged) renderReplViewIfActive({ force: activeSessionIdentityChanged });
29179
29459
  updateReferenceBadge();
@@ -29300,7 +29580,7 @@
29300
29580
  if (responseRequestId) settleReplQuickPending(responseRequestId, true);
29301
29581
  mergeReplJournalEntries(message.journalEntries);
29302
29582
  if (typeof message.requestId === "string") {
29303
- replJournalEntries = replJournalEntries.map((entry) => entry.requestId === message.requestId ? { ...entry, status: "sent", updatedAt: Date.now() } : entry);
29583
+ replJournalEntries = replJournalEntries.map((entry) => isReplEntryOfRequest(entry, message.requestId) ? { ...entry, status: "sent", updatedAt: Date.now() } : entry);
29304
29584
  persistReplJournalEntries();
29305
29585
  }
29306
29586
  setStatus("Sent to REPL.", "success");
@@ -29879,7 +30159,7 @@
29879
30159
  replError = typeof message.message === "string" ? message.message : "REPL request failed.";
29880
30160
  settleReplQuickPending(failedReplRequestId, false);
29881
30161
  if (typeof message.requestId === "string") {
29882
- replJournalEntries = replJournalEntries.map((entry) => entry.requestId === message.requestId ? { ...entry, status: "error", output: replError, updatedAt: Date.now() } : entry);
30162
+ replJournalEntries = replJournalEntries.map((entry) => isReplEntryOfRequest(entry, message.requestId) ? { ...entry, status: "error", output: replError, updatedAt: Date.now() } : entry);
29883
30163
  persistReplJournalEntries();
29884
30164
  }
29885
30165
  renderReplViewIfActive({ force: true });