pi-studio 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/client/studio-client.js +116 -21
- package/client/studio.css +32 -2
- package/index.ts +21 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `pi-studio` are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.11.3] — 2026-10-28
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **Ctrl+Option+L** (Ctrl+Alt+L) goes to the latest response, as in agent-markdown-preview. On a Mac it also works while you're editing text. Elsewhere Ctrl+Alt is AltGr, which types letters such as ł, so there it works only outside text. **Option+L** is unchanged.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- In the new layout, **Working** starts with the run's prompt, as Pi received it, and keeps it with the saved response. A long prompt is folded to its first line.
|
|
14
|
+
- Each Working step is one numbered line until you open it. The running step and the latest are open, and earlier steps fold as the run goes on while Working follows the bottom. Scrolled up to read, nothing open folds.
|
|
15
|
+
- Working's header is one line ("Running · 4 steps · Started 4:28 PM"), and the "Working: running · 9 entries" line above the pane is gone. Inside a step, Code, Input and Output are plain sections, and a Bash step shows its command, not its JSON. **Copy visible** and **Load** include the prompt.
|
|
16
|
+
- In a pane under 360 px wide (300 px before), the file controls take their own line, so **View** isn't clipped when **Open** also shows.
|
|
17
|
+
|
|
7
18
|
## [0.11.2] — 2026-10-27
|
|
8
19
|
|
|
9
20
|
### Changed
|
package/client/studio-client.js
CHANGED
|
@@ -560,11 +560,19 @@
|
|
|
560
560
|
let traceDisplayContext = { mode: "live", responseId: null, historyIndex: -1, total: 0, summary: null };
|
|
561
561
|
let traceFilter = "all";
|
|
562
562
|
let traceAutoScroll = true;
|
|
563
|
+
// Whether the person has scrolled up in Working to read: earlier steps don't fold meanwhile (Oliver, 27 Oct).
|
|
564
|
+
// Only their own scrolling in a pane that scrolls changes it, so a short filtered list can't end it (Sol, c99).
|
|
565
|
+
let traceStepsPaused = false;
|
|
566
|
+
// Where Studio last moved the Working pane itself (to the bottom, say). The scroll event that follows is Studio's,
|
|
567
|
+
// not the person's, so it leaves the pause alone (Sol, c99).
|
|
568
|
+
let traceOwnScrollTop = null;
|
|
563
569
|
let traceRenderRaf = null;
|
|
564
570
|
const traceExpandedOutputs = new Set();
|
|
565
571
|
const traceOpenDetails = new Set();
|
|
566
572
|
const traceClosedDetails = new Set();
|
|
567
573
|
const traceSectionDefaults = new Map();
|
|
574
|
+
// Steps last shown open by default: while the person has scrolled up to read, they stay open (Oliver, 27 Oct).
|
|
575
|
+
const traceStepsShownOpen = new Set();
|
|
568
576
|
let gitChangesState = {
|
|
569
577
|
status: "idle",
|
|
570
578
|
requestId: null,
|
|
@@ -1020,6 +1028,7 @@
|
|
|
1020
1028
|
status: "idle",
|
|
1021
1029
|
startedAt: null,
|
|
1022
1030
|
updatedAt: null,
|
|
1031
|
+
prompt: null,
|
|
1023
1032
|
entries: [],
|
|
1024
1033
|
};
|
|
1025
1034
|
}
|
|
@@ -1114,10 +1123,15 @@
|
|
|
1114
1123
|
status: normalizeTraceStatus(raw.status),
|
|
1115
1124
|
startedAt: parseFiniteNumber(raw.startedAt),
|
|
1116
1125
|
updatedAt: parseFiniteNumber(raw.updatedAt),
|
|
1126
|
+
prompt: normalizeTracePrompt(raw.prompt),
|
|
1117
1127
|
entries,
|
|
1118
1128
|
};
|
|
1119
1129
|
}
|
|
1120
1130
|
|
|
1131
|
+
function normalizeTracePrompt(value) {
|
|
1132
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1121
1135
|
function ensureTraceState() {
|
|
1122
1136
|
if (!traceState) traceState = createEmptyTraceState();
|
|
1123
1137
|
return traceState;
|
|
@@ -1131,6 +1145,8 @@
|
|
|
1131
1145
|
traceOpenDetails.clear();
|
|
1132
1146
|
traceClosedDetails.clear();
|
|
1133
1147
|
traceSectionDefaults.clear();
|
|
1148
|
+
traceStepsShownOpen.clear();
|
|
1149
|
+
traceStepsPaused = false;
|
|
1134
1150
|
}
|
|
1135
1151
|
renderTraceViewIfActive();
|
|
1136
1152
|
}
|
|
@@ -1198,6 +1214,7 @@
|
|
|
1198
1214
|
if (Object.prototype.hasOwnProperty.call(message, "status")) {
|
|
1199
1215
|
state.status = normalizeTraceStatus(message.status);
|
|
1200
1216
|
}
|
|
1217
|
+
if (Object.prototype.hasOwnProperty.call(message, "prompt")) state.prompt = normalizeTracePrompt(message.prompt);
|
|
1201
1218
|
renderTraceViewIfActive();
|
|
1202
1219
|
}
|
|
1203
1220
|
|
|
@@ -1291,6 +1308,7 @@
|
|
|
1291
1308
|
if (Object.prototype.hasOwnProperty.call(message, "startedAt")) state.startedAt = parseFiniteNumber(message.startedAt);
|
|
1292
1309
|
if (Object.prototype.hasOwnProperty.call(message, "updatedAt")) state.updatedAt = parseFiniteNumber(message.updatedAt);
|
|
1293
1310
|
if (Object.prototype.hasOwnProperty.call(message, "status")) state.status = normalizeTraceStatus(message.status);
|
|
1311
|
+
if (Object.prototype.hasOwnProperty.call(message, "prompt")) state.prompt = normalizeTracePrompt(message.prompt);
|
|
1294
1312
|
if (shouldDisplayLiveTrace()) {
|
|
1295
1313
|
setTraceDisplayContext({ mode: "live", responseId: null, historyIndex: responseHistoryIndex, total: responseHistory.length, summary: null });
|
|
1296
1314
|
updateTraceStatusFromMessage(message);
|
|
@@ -1345,7 +1363,15 @@
|
|
|
1345
1363
|
|
|
1346
1364
|
function buildVisibleWorkingText(filterOverride) {
|
|
1347
1365
|
const filter = normalizeTraceFilter(filterOverride || traceFilter);
|
|
1348
|
-
|
|
1366
|
+
// The new layout shows the run's prompt first under every filter, so Copy visible and Load include it, and are
|
|
1367
|
+
// available when it's all there is (Sol, candidate 99).
|
|
1368
|
+
const state = traceState || createEmptyTraceState();
|
|
1369
|
+
const prompt = studioUiRefreshUi && state.prompt && String(state.prompt).trim() ? "Prompt:\n" + String(state.prompt).trim() : "";
|
|
1370
|
+
const body = buildVisibleWorkingEntriesText(filter, getTraceEntriesForFilter(filter));
|
|
1371
|
+
return [prompt, body].filter(Boolean).join(filter === "thinking" ? "\n\n" : "\n\n---\n\n");
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
function buildVisibleWorkingEntriesText(filter, entries) {
|
|
1349
1375
|
if (!entries.length) return "";
|
|
1350
1376
|
|
|
1351
1377
|
if (filter === "thinking") {
|
|
@@ -6733,6 +6759,15 @@
|
|
|
6733
6759
|
return;
|
|
6734
6760
|
}
|
|
6735
6761
|
|
|
6762
|
+
// Oliver, 27 Oct: Ctrl+Option+L for the latest response, as in agent-markdown-preview, also while editing: on a
|
|
6763
|
+
// Mac it types nothing. Elsewhere Ctrl+Alt is AltGr, which types letters such as ł, so there only outside text.
|
|
6764
|
+
if (event.ctrlKey && event.altKey && !event.metaKey && !event.shiftKey && code === "KeyL"
|
|
6765
|
+
&& (isMacShortcutPlatform() || !isTextEntryShortcutTarget(event.target))) {
|
|
6766
|
+
event.preventDefault();
|
|
6767
|
+
triggerResponseHistoryShortcut("latest");
|
|
6768
|
+
return;
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6736
6771
|
if (!isTextEntryShortcutTarget(event.target) && !event.metaKey && !event.ctrlKey && event.altKey && !event.shiftKey) {
|
|
6737
6772
|
if (key === "ArrowLeft") {
|
|
6738
6773
|
event.preventDefault();
|
|
@@ -7437,7 +7472,8 @@
|
|
|
7437
7472
|
if (!referenceBadgeEl) return;
|
|
7438
7473
|
if (referenceHistoryCountEl) referenceHistoryCountEl.hidden = true;
|
|
7439
7474
|
const referenceMetaEl = referenceBadgeEl.closest(".reference-meta");
|
|
7440
|
-
|
|
7475
|
+
// Oliver, 27 Oct: in the new layout Working's own header says what this line said (status, steps, start).
|
|
7476
|
+
if (rightView === "repl" || (studioUiRefreshUi && (rightView === "editor-preview" || rightView === "trace")) || (bufferSwitchingEnabled && studioUiRefreshUi && rightView === "files")) {
|
|
7441
7477
|
if (referenceMetaEl instanceof HTMLElement) referenceMetaEl.hidden = true;
|
|
7442
7478
|
if (rightView === "editor-preview") referenceBadgeEl.textContent = "";
|
|
7443
7479
|
return;
|
|
@@ -11817,8 +11853,11 @@
|
|
|
11817
11853
|
}
|
|
11818
11854
|
|
|
11819
11855
|
function handleTracePaneScroll() {
|
|
11856
|
+
const own = traceOwnScrollTop !== null && critiqueViewEl && Math.abs(critiqueViewEl.scrollTop - traceOwnScrollTop) < 1;
|
|
11857
|
+
traceOwnScrollTop = null;
|
|
11820
11858
|
if (rightView === "trace") {
|
|
11821
11859
|
traceAutoScroll = shouldStickTraceToBottom();
|
|
11860
|
+
if (!own && critiqueViewEl && critiqueViewEl.scrollHeight - critiqueViewEl.clientHeight > 4) traceStepsPaused = !traceAutoScroll;
|
|
11822
11861
|
return;
|
|
11823
11862
|
}
|
|
11824
11863
|
if (rightView === "repl") {
|
|
@@ -11853,6 +11892,16 @@
|
|
|
11853
11892
|
node.setAttribute("data-trace-expected-open", String(open));
|
|
11854
11893
|
node.open = open;
|
|
11855
11894
|
}
|
|
11895
|
+
// Folding a step can hide the focused control inside it. Keep focus on that step's own line, so the keys and
|
|
11896
|
+
// the next Expand still work (candidate 99).
|
|
11897
|
+
const focused = document.activeElement;
|
|
11898
|
+
if (!open && focused instanceof Element && critiqueViewEl.contains(focused)) {
|
|
11899
|
+
let fold = null;
|
|
11900
|
+
for (let node = focused.parentElement; node && node !== critiqueViewEl; node = node.parentElement) {
|
|
11901
|
+
if (node.matches("details[data-trace-details-key]") && !node.open && node.querySelector(":scope > summary") !== focused) fold = node;
|
|
11902
|
+
}
|
|
11903
|
+
fold?.querySelector(":scope > summary")?.focus({ preventScroll: true });
|
|
11904
|
+
}
|
|
11856
11905
|
if (nodes.length) traceAutoScroll = false;
|
|
11857
11906
|
return nodes.length > 0;
|
|
11858
11907
|
}
|
|
@@ -13829,6 +13878,12 @@
|
|
|
13829
13878
|
return { label: "Code", language: "javascript", text: payload ? payload.code : text,
|
|
13830
13879
|
extraInput: payload && Object.keys(payload).some(key => key !== "code") ? text : "" };
|
|
13831
13880
|
}
|
|
13881
|
+
// Oliver, 27 Oct: a Bash step shows its command, not the JSON around it, as codemode shows its Code. Any other
|
|
13882
|
+
// field, such as a timeout, stays in Raw input.
|
|
13883
|
+
if (name === "bash" && payload && typeof payload.command === "string") {
|
|
13884
|
+
return { label: "Command", language: "", text: payload.command,
|
|
13885
|
+
extraInput: Object.keys(payload).some(key => key !== "command") ? text : "" };
|
|
13886
|
+
}
|
|
13832
13887
|
return { label: name === "repl_send" || name === "studio_repl_send" ? "Code" : "Input", language: "", text, extraInput: "" };
|
|
13833
13888
|
}
|
|
13834
13889
|
|
|
@@ -13989,6 +14044,8 @@
|
|
|
13989
14044
|
if (presentation.language === "javascript") return renderTraceOutput(presentation.text, entry.id + ":input", { label: "Code", language: "javascript" })
|
|
13990
14045
|
+ (presentation.extraInput ? renderTraceRawInputDetails(presentation.extraInput, entry.id + ":input") : "");
|
|
13991
14046
|
const toolName = String(entry.toolName || "").trim().toLowerCase();
|
|
14047
|
+
if (toolName === "bash" && presentation.label === "Command") return renderTraceOutput(presentation.text, entry.id + ":input", { label: "Command" })
|
|
14048
|
+
+ (presentation.extraInput ? renderTraceRawInputDetails(presentation.extraInput, entry.id + ":input") : "");
|
|
13992
14049
|
if (toolName === "bash") return renderTraceCommandInput(entry, inputText, "Command");
|
|
13993
14050
|
if (toolName === "repl_send" || toolName === "studio_repl_send") return renderTraceCommandInput(entry, inputText, "Code");
|
|
13994
14051
|
const payload = parseTraceToolArgsObject(inputText);
|
|
@@ -14344,11 +14401,16 @@
|
|
|
14344
14401
|
const historyMeta = (context.mode === "history" || context.mode === "missing" || context.mode === "loading")
|
|
14345
14402
|
? getTraceHistoryContextLabel()
|
|
14346
14403
|
: null;
|
|
14404
|
+
// Oliver, 27 Oct: in the new layout Working reads like agent-markdown-preview's page. The prompt comes first, each
|
|
14405
|
+
// step is one numbered line until opened, and this header is the one line saying the run's state (the pane is
|
|
14406
|
+
// already called Working).
|
|
14407
|
+
const steps = Boolean(studioUiRefreshUi);
|
|
14347
14408
|
const toolbar = "<div class='trace-toolbar'>"
|
|
14348
14409
|
+ "<div class='trace-summary'>"
|
|
14349
|
-
+ "<span class='trace-summary-badge'>Working</span>"
|
|
14410
|
+
+ (steps ? "" : "<span class='trace-summary-badge'>Working</span>")
|
|
14350
14411
|
+ "<span class='trace-summary-status trace-status-" + escapeHtml(String(state.status || "idle")) + "'>" + escapeHtml(statusLabel) + "</span>"
|
|
14351
14412
|
+ (historyMeta ? ("<span class='trace-summary-meta'>" + escapeHtml(historyMeta) + "</span>") : "")
|
|
14413
|
+
+ (steps && entries.length ? "<span class='trace-summary-meta'>" + entries.length + " step" + (entries.length === 1 ? "" : "s") + "</span>" : "")
|
|
14352
14414
|
+ (started ? ("<span class='trace-summary-meta'>Started " + escapeHtml(started) + "</span>") : "")
|
|
14353
14415
|
+ (context.summary && context.summary.truncated ? "<span class='trace-summary-meta'>Truncated</span>" : "")
|
|
14354
14416
|
+ (filterMeta ? ("<span class='trace-summary-meta'>" + escapeHtml(filterMeta) + "</span>") : "")
|
|
@@ -14366,6 +14428,7 @@
|
|
|
14366
14428
|
+ "</div>"
|
|
14367
14429
|
+ "</div>";
|
|
14368
14430
|
|
|
14431
|
+
const promptCard = steps && state.prompt ? renderTracePromptCard(state) : "";
|
|
14369
14432
|
if (!entries.length) {
|
|
14370
14433
|
const emptyMessage = context.mode === "loading"
|
|
14371
14434
|
? "Loading saved working for this response…"
|
|
@@ -14378,8 +14441,25 @@
|
|
|
14378
14441
|
: (state.status === "running"
|
|
14379
14442
|
? "Waiting for the first model or tool update…"
|
|
14380
14443
|
: "No live working view yet. Start a run or critique to watch working details here."))));
|
|
14381
|
-
return "<div class='trace-panel'>" + toolbar + "<div class='trace-
|
|
14382
|
-
|
|
14444
|
+
return "<div class='trace-panel'>" + toolbar + (promptCard ? "<div class='trace-list'>" + promptCard + "</div>" : "")
|
|
14445
|
+
+ "<div class='trace-empty'>" + escapeHtml(emptyMessage) + "</div></div>";
|
|
14446
|
+
}
|
|
14447
|
+
|
|
14448
|
+
// Numbered by place in the whole run, so a step keeps its number under Thinking or Tools.
|
|
14449
|
+
const positions = new Map(getTraceEntriesForFilter("all").map((entry, index) => [entry.id, index + 1]));
|
|
14450
|
+
const latestId = entries[entries.length - 1].id, shownOpen = new Map();
|
|
14451
|
+
const card = (kindClass, entry, header, body, preview) => {
|
|
14452
|
+
if (!steps) return "<article class='trace-card " + kindClass + "'><div class='trace-card-header'>" + header + "</div>" + body + "</article>";
|
|
14453
|
+
const key = "step:" + entry.id, running = entry.status === "streaming" || entry.status === "pending";
|
|
14454
|
+
// Earlier steps fold as new ones arrive, except while the person has scrolled up to read.
|
|
14455
|
+
const opened = traceStepIsOpen(key, running || entry.id === latestId || (traceStepsPaused && traceStepsShownOpen.has(key)));
|
|
14456
|
+
shownOpen.set(key, opened);
|
|
14457
|
+
const firstLine = String(preview || "").split("\n").find(line => line.trim()) || "";
|
|
14458
|
+
return "<details class='trace-card " + kindClass + " trace-step' data-trace-details-key='" + escapeHtml(key) + "' data-trace-expected-open='" + opened + "'" + (opened ? " open" : "") + ">"
|
|
14459
|
+
+ "<summary class='trace-card-header'><span class='trace-step-number'>" + (positions.get(entry.id) || "") + "</span>" + header
|
|
14460
|
+
+ (firstLine ? "<span class='trace-step-preview'>" + escapeHtml(firstLine.trim().slice(0, 300)) + "</span>" : "") + "</summary>"
|
|
14461
|
+
+ "<div class='trace-step-body'>" + body + "</div></details>";
|
|
14462
|
+
};
|
|
14383
14463
|
|
|
14384
14464
|
const cards = entries.map((entry) => {
|
|
14385
14465
|
if (entry.type === "assistant") {
|
|
@@ -14397,15 +14477,12 @@
|
|
|
14397
14477
|
if (!sections.length) {
|
|
14398
14478
|
sections.push("<div class='trace-empty-inline'>Waiting for streamed content…</div>");
|
|
14399
14479
|
}
|
|
14400
|
-
return "
|
|
14401
|
-
|
|
14402
|
-
+ "<span class='trace-kind-badge'>" + escapeHtml(filter === "thinking" ? "Thinking" : "Assistant") + "</span>"
|
|
14480
|
+
return card("trace-card-assistant", entry,
|
|
14481
|
+
"<span class='trace-kind-badge'>" + escapeHtml(filter === "thinking" ? "Thinking" : "Assistant") + "</span>"
|
|
14403
14482
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14404
14483
|
+ renderTraceEntryStatus(state, entry.status, false)
|
|
14405
|
-
+ (entry.stopReason === "length" ? "<span class='trace-card-meta'>Cut off at the length limit</span>" : "")
|
|
14406
|
-
|
|
14407
|
-
+ sections.join("")
|
|
14408
|
-
+ "</article>";
|
|
14484
|
+
+ (entry.stopReason === "length" ? "<span class='trace-card-meta'>Cut off at the length limit</span>" : ""),
|
|
14485
|
+
sections.join(""), filter === "thinking" ? entry.thinking : (entry.text || entry.thinking));
|
|
14409
14486
|
}
|
|
14410
14487
|
|
|
14411
14488
|
const title = entry.label || entry.toolName || "tool";
|
|
@@ -14418,20 +14495,37 @@
|
|
|
14418
14495
|
if (imageOutput) outputPieces.push(imageOutput);
|
|
14419
14496
|
const output = renderTraceSection("Output", entry.output, entry.id + ":output", outputPieces.length ? outputPieces.join("") : "<div class='trace-empty-inline'>No output yet.</div>",
|
|
14420
14497
|
{ imageCount: entry.images?.length || 0, isError: toolError, pending: entry.status === "streaming" || entry.status === "pending" });
|
|
14421
|
-
return "
|
|
14422
|
-
|
|
14423
|
-
+ "<span class='trace-kind-badge'>" + escapeHtml(entry.toolName || "tool") + "</span>"
|
|
14498
|
+
return card("trace-card-tool", entry,
|
|
14499
|
+
"<span class='trace-kind-badge'>" + escapeHtml(entry.toolName || "tool") + "</span>"
|
|
14424
14500
|
+ "<span class='trace-card-title'>" + escapeHtml(title) + "</span>"
|
|
14425
14501
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14426
14502
|
+ (formatTraceEntryDuration(entry) ? "<span class='trace-card-meta'>" + escapeHtml(formatTraceEntryDuration(entry)) + "</span>" : "")
|
|
14427
|
-
+ renderTraceEntryStatus(state, entry.status, toolError)
|
|
14428
|
-
+ "
|
|
14429
|
-
+ argsSummary
|
|
14430
|
-
+ output
|
|
14431
|
-
+ "</article>";
|
|
14503
|
+
+ renderTraceEntryStatus(state, entry.status, toolError),
|
|
14504
|
+
argsSummary + output, "");
|
|
14432
14505
|
}).join("");
|
|
14506
|
+
// Only the steps shown now: one hidden by a filter keeps its state, so a filter round trip folds nothing (Astra).
|
|
14507
|
+
for (const [key, opened] of shownOpen) { if (opened) traceStepsShownOpen.add(key); else traceStepsShownOpen.delete(key); }
|
|
14508
|
+
|
|
14509
|
+
return "<div class='trace-panel'>" + toolbar + "<div class='trace-list'>" + promptCard + cards + "</div></div>";
|
|
14510
|
+
}
|
|
14511
|
+
|
|
14512
|
+
// A step is open while it runs or is the latest, unless the person chose otherwise; earlier steps fold to one line.
|
|
14513
|
+
function traceStepIsOpen(key, byDefault) {
|
|
14514
|
+
if (traceOpenDetails.has(key)) return true;
|
|
14515
|
+
if (traceClosedDetails.has(key)) return false;
|
|
14516
|
+
return Boolean(byDefault);
|
|
14517
|
+
}
|
|
14433
14518
|
|
|
14434
|
-
|
|
14519
|
+
// What Pi is responding to: open when short, otherwise one line with its start, like a long section.
|
|
14520
|
+
function renderTracePromptCard(state) {
|
|
14521
|
+
const text = String(state.prompt || ""), key = "prompt:" + (state.runId || "live");
|
|
14522
|
+
const short = text.length <= TRACE_SECTION_AUTO_OPEN_MAX_CHARS && countTraceTextLines(text) <= TRACE_SECTION_AUTO_OPEN_MAX_LINES;
|
|
14523
|
+
const opened = traceStepIsOpen(key, short);
|
|
14524
|
+
const firstLine = text.split("\n").find(line => line.trim()) || "";
|
|
14525
|
+
return "<details class='trace-card trace-card-prompt trace-step' data-trace-details-key='" + escapeHtml(key) + "' data-trace-expected-open='" + opened + "'" + (opened ? " open" : "") + ">"
|
|
14526
|
+
+ "<summary class='trace-card-header'><span class='trace-card-title'>Prompt</span>"
|
|
14527
|
+
+ "<span class='trace-step-preview'>" + escapeHtml(firstLine.trim().slice(0, 300)) + "</span></summary>"
|
|
14528
|
+
+ "<div class='trace-step-body'><div class='trace-prompt-text'>" + escapeHtml(text) + "</div></div></details>";
|
|
14435
14529
|
}
|
|
14436
14530
|
|
|
14437
14531
|
const TRACE_RUN_STATUS_LABELS = { running: "Running", complete: "Finished", stopped: "Stopped", error: "Failed", idle: "Idle" };
|
|
@@ -14460,6 +14554,7 @@
|
|
|
14460
14554
|
} else {
|
|
14461
14555
|
critiqueViewEl.scrollTop = previousScrollTop;
|
|
14462
14556
|
}
|
|
14557
|
+
if (Math.abs(critiqueViewEl.scrollTop - previousScrollTop) >= 1) traceOwnScrollTop = critiqueViewEl.scrollTop;
|
|
14463
14558
|
scheduleResponsePaneRepaintNudge();
|
|
14464
14559
|
}
|
|
14465
14560
|
|
package/client/studio.css
CHANGED
|
@@ -7590,8 +7590,9 @@
|
|
|
7590
7590
|
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > :has(> .studio-workspace-filename) { min-width: 0; max-width: min(180px, 35cqi); }
|
|
7591
7591
|
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > * > .studio-workspace-filename { max-width: 100%; }
|
|
7592
7592
|
/* Its own line below the tabs, as before; it must also give up the row-filling size, or it stays beside the tabs
|
|
7593
|
-
and the name overlaps them (candidate 97, seen in a replay screenshot).
|
|
7594
|
-
|
|
7593
|
+
and the name overlaps them (candidate 97, seen in a replay screenshot). From 360 px, so a standalone Document
|
|
7594
|
+
window, which also shows Open, doesn't clip View (Astra, candidate 98). */
|
|
7595
|
+
@container (max-width: 360px) {
|
|
7595
7596
|
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; min-width: 0; margin-left: auto; }
|
|
7596
7597
|
}
|
|
7597
7598
|
body.studio-workspace-layout .studio-refresh-toolbar-main { display: block; }
|
|
@@ -7674,6 +7675,35 @@
|
|
|
7674
7675
|
body.studio-workspace-layout .trace-kind-badge,
|
|
7675
7676
|
body.studio-workspace-layout .repl-journal-chip { border-radius: 0; padding-left: 0; padding-right: 0; }
|
|
7676
7677
|
body.studio-workspace-layout .trace-summary-badge { color: var(--text); font-size: 13px; font-weight: 700; }
|
|
7678
|
+
/* Oliver, 27 Oct: Working like agent-markdown-preview's page. The prompt and each step are one line until opened;
|
|
7679
|
+
inside a step, Code and Output are plain sections, and only the content keeps its frame. */
|
|
7680
|
+
body.studio-workspace-layout details.trace-step { display: block; padding: 0; }
|
|
7681
|
+
body.studio-workspace-layout details.trace-step > summary.trace-card-header {
|
|
7682
|
+
list-style: none; cursor: pointer; user-select: none; flex-wrap: nowrap; padding: 8px 11px;
|
|
7683
|
+
}
|
|
7684
|
+
body.studio-workspace-layout details.trace-step > summary.trace-card-header::-webkit-details-marker { display: none; }
|
|
7685
|
+
/* The same triangles as the sections' own markers, at the same size. */
|
|
7686
|
+
body.studio-workspace-layout details.trace-step > summary.trace-card-header::before { content: "▶"; flex: none; width: 1em; color: var(--muted); font-size: 9px; }
|
|
7687
|
+
body.studio-workspace-layout details.trace-step[open] > summary.trace-card-header::before { content: "▼"; }
|
|
7688
|
+
body.studio-workspace-layout details.trace-step > summary.trace-card-header:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 3px; }
|
|
7689
|
+
body.studio-workspace-layout details.trace-step > summary > * { flex: none; }
|
|
7690
|
+
body.studio-workspace-layout details.trace-step > summary > .trace-card-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
7691
|
+
body.studio-workspace-layout .trace-step-number { min-width: 1.2em; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
7692
|
+
body.studio-workspace-layout details.trace-step > summary > .trace-step-preview {
|
|
7693
|
+
flex: 1 1 6em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px;
|
|
7694
|
+
}
|
|
7695
|
+
body.studio-workspace-layout details.trace-step[open] > summary > .trace-step-preview { display: none; }
|
|
7696
|
+
body.studio-workspace-layout .trace-step-body { display: flex; flex-direction: column; gap: 6px; padding: 0 11px 10px; }
|
|
7697
|
+
body.studio-workspace-layout .trace-step .trace-tool-details { border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
7698
|
+
body.studio-workspace-layout .trace-step .trace-tool-details > summary { padding: 3px 0; }
|
|
7699
|
+
body.studio-workspace-layout .trace-step .trace-tool-details[open] > summary { border-bottom: 0; background: transparent; }
|
|
7700
|
+
body.studio-workspace-layout .trace-step .trace-tool-details-body,
|
|
7701
|
+
body.studio-workspace-layout .trace-step .trace-tool-change-body { padding: 4px 0 0; }
|
|
7702
|
+
body.studio-workspace-layout .trace-step .trace-section-fold { margin-top: 0; }
|
|
7703
|
+
body.studio-workspace-layout .trace-prompt-text {
|
|
7704
|
+
max-height: 40vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
|
|
7705
|
+
color: var(--text); font-size: var(--studio-working-font-size); line-height: 1.45;
|
|
7706
|
+
}
|
|
7677
7707
|
body.studio-workspace-layout .trace-filter-btn.is-active { color: var(--accent); }
|
|
7678
7708
|
body.studio-workspace-layout #scratchpadBtn.has-content:not(:disabled):hover,
|
|
7679
7709
|
body.studio-workspace-layout #reviewNotesBtn.has-content:not(:disabled):hover,
|
package/index.ts
CHANGED
|
@@ -541,6 +541,10 @@ interface StudioTraceState {
|
|
|
541
541
|
status: StudioTraceRunStatus;
|
|
542
542
|
startedAt: number | null;
|
|
543
543
|
updatedAt: number | null;
|
|
544
|
+
// The run's first user message, as Pi received it, so Working can show what it's responding to (Oliver, 27 Oct).
|
|
545
|
+
// It's cut once, on arrival; promptTruncated records that, so a saved copy keeps the same text and count.
|
|
546
|
+
prompt: string | null;
|
|
547
|
+
promptTruncated?: boolean;
|
|
544
548
|
entries: StudioTraceEntry[];
|
|
545
549
|
}
|
|
546
550
|
|
|
@@ -10903,6 +10907,7 @@ function createEmptyStudioTraceState(): StudioTraceState {
|
|
|
10903
10907
|
status: "idle",
|
|
10904
10908
|
startedAt: null,
|
|
10905
10909
|
updatedAt: null,
|
|
10910
|
+
prompt: null,
|
|
10906
10911
|
entries: [],
|
|
10907
10912
|
};
|
|
10908
10913
|
}
|
|
@@ -10986,6 +10991,9 @@ function createStudioTraceSnapshot(source: StudioTraceState): { traceState: Stud
|
|
|
10986
10991
|
});
|
|
10987
10992
|
if (sourceEntries.length > entries.length) truncated = true;
|
|
10988
10993
|
|
|
10994
|
+
// Already cut on arrival: cutting the cut text again would rewrite its omission count (Sol, Astra).
|
|
10995
|
+
if (source.promptTruncated) truncated = true;
|
|
10996
|
+
|
|
10989
10997
|
return {
|
|
10990
10998
|
traceState: {
|
|
10991
10999
|
runId: source.runId,
|
|
@@ -10994,6 +11002,8 @@ function createStudioTraceSnapshot(source: StudioTraceState): { traceState: Stud
|
|
|
10994
11002
|
status: source.status,
|
|
10995
11003
|
startedAt: source.startedAt,
|
|
10996
11004
|
updatedAt: source.updatedAt,
|
|
11005
|
+
prompt: typeof source.prompt === "string" ? source.prompt : null,
|
|
11006
|
+
promptTruncated: source.promptTruncated === true,
|
|
10997
11007
|
entries,
|
|
10998
11008
|
},
|
|
10999
11009
|
truncated,
|
|
@@ -13606,7 +13616,7 @@ ${cssVarsBlock}
|
|
|
13606
13616
|
<div><dt>Cmd/Ctrl+Option/Alt+Shift+Enter</dt><dd>Load the selected response into the editor without switching views; same replacement safeguards</dd></div>
|
|
13607
13617
|
<div><dt>Option/Alt+←</dt><dd>Previous response when not editing text</dd></div>
|
|
13608
13618
|
<div><dt>Option/Alt+→</dt><dd>Next response when not editing text</dd></div>
|
|
13609
|
-
<div><dt>Option/Alt+
|
|
13619
|
+
<div><dt>Option/Alt+L, or Ctrl+Option/Alt+L</dt><dd>Latest response when not editing text; Ctrl+Option+L also while editing on a Mac</dd></div>
|
|
13610
13620
|
</dl>
|
|
13611
13621
|
</section>
|
|
13612
13622
|
<section class="shortcuts-group">
|
|
@@ -15014,6 +15024,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
15014
15024
|
status: studioTraceState.status,
|
|
15015
15025
|
startedAt: studioTraceState.startedAt,
|
|
15016
15026
|
updatedAt: studioTraceState.updatedAt,
|
|
15027
|
+
prompt: studioTraceState.prompt,
|
|
15017
15028
|
});
|
|
15018
15029
|
};
|
|
15019
15030
|
|
|
@@ -15041,6 +15052,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
15041
15052
|
status: "running",
|
|
15042
15053
|
startedAt: now,
|
|
15043
15054
|
updatedAt: now,
|
|
15055
|
+
prompt: null,
|
|
15044
15056
|
entries: [],
|
|
15045
15057
|
};
|
|
15046
15058
|
activeStudioTraceAssistantEntryId = null;
|
|
@@ -20065,6 +20077,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
20065
20077
|
if (role === "user") {
|
|
20066
20078
|
const userPrompt = extractUserText(event.message);
|
|
20067
20079
|
pendingTurnPrompt = userPrompt;
|
|
20080
|
+
// Working shows the run's first user message, as Pi received it (Oliver, 27 Oct). Pi starts the run before the
|
|
20081
|
+
// message, so the run's Working is already in place; later messages in the same run don't replace it.
|
|
20082
|
+
if (userPrompt && studioRunLifecycle.snapshot().run && studioTraceState.runId && studioTraceState.prompt == null) {
|
|
20083
|
+
const cut = truncateStudioTraceSnapshotText(userPrompt);
|
|
20084
|
+
studioTraceState.prompt = cut.text;
|
|
20085
|
+
studioTraceState.promptTruncated = cut.truncated;
|
|
20086
|
+
broadcastStudioTraceStatus();
|
|
20087
|
+
}
|
|
20068
20088
|
const inputIndex = studioPromptInputs.findIndex(input => input.text === normalizePromptText(userPrompt));
|
|
20069
20089
|
const registeredInput = inputIndex >= 0 ? studioPromptInputs.splice(inputIndex, 1)[0] : null;
|
|
20070
20090
|
const activatedQueuedRequest = activateQueuedStudioDirectRequestForPrompt(userPrompt);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-studio",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Two-pane browser workspace for pi with prompt/response editing, annotations, critiques, active quiz, prompt/response history, live previews, and tmux-backed REPL/literate REPL workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|