pi-studio 0.11.2 → 0.11.4
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 +22 -0
- package/client/studio-client.js +161 -29
- package/client/studio.css +54 -6
- package/index.ts +21 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to `pi-studio` are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.11.4] — 2026-10-28
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- In the new layout, **Working** looks more like agent-markdown-preview. The steps, and the prompt, sit on the pane's page colour, an open step has a rule under its line, and nothing inside a step has a frame of its own. The prompt, Thinking and Response read as prose; code and output stay monospaced.
|
|
11
|
+
- **Collapse all** folds the steps and the prompt and leaves what's inside them as it was. Steps that start later in the run arrive folded, until **Expand all**. A step's sections are open whenever the step is, whatever their length.
|
|
12
|
+
- An Assistant step's line shows its first line in plain words, open or folded, so "\*\*Inspecting alias settings\*\*" reads "Inspecting alias settings". Before, it showed the text only while folded, Markdown markers and all.
|
|
13
|
+
- While a prompt runs, **Steer** sits beside **Stop**, outlined, and the elapsed time follows it. Steer was plain accent text after the time, with a gap that changed as the time grew.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- A tool's output in Working no longer shows terminal colour or hyperlink codes, in either layout. **Copy visible** and **Load** match what's shown; the saved Working keeps the codes.
|
|
17
|
+
|
|
18
|
+
## [0.11.3] — 2026-10-28
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **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.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- 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.
|
|
25
|
+
- 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.
|
|
26
|
+
- 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.
|
|
27
|
+
- 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.
|
|
28
|
+
|
|
7
29
|
## [0.11.2] — 2026-10-27
|
|
8
30
|
|
|
9
31
|
### Changed
|
package/client/studio-client.js
CHANGED
|
@@ -560,11 +560,21 @@
|
|
|
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;
|
|
569
|
+
// After Collapse all, steps that start later in the run arrive folded too, until Expand all (Oliver, 28 Oct).
|
|
570
|
+
let traceStepsFolded = false;
|
|
563
571
|
let traceRenderRaf = null;
|
|
564
572
|
const traceExpandedOutputs = new Set();
|
|
565
573
|
const traceOpenDetails = new Set();
|
|
566
574
|
const traceClosedDetails = new Set();
|
|
567
575
|
const traceSectionDefaults = new Map();
|
|
576
|
+
// Steps last shown open by default: while the person has scrolled up to read, they stay open (Oliver, 27 Oct).
|
|
577
|
+
const traceStepsShownOpen = new Set();
|
|
568
578
|
let gitChangesState = {
|
|
569
579
|
status: "idle",
|
|
570
580
|
requestId: null,
|
|
@@ -1020,6 +1030,7 @@
|
|
|
1020
1030
|
status: "idle",
|
|
1021
1031
|
startedAt: null,
|
|
1022
1032
|
updatedAt: null,
|
|
1033
|
+
prompt: null,
|
|
1023
1034
|
entries: [],
|
|
1024
1035
|
};
|
|
1025
1036
|
}
|
|
@@ -1065,6 +1076,16 @@
|
|
|
1065
1076
|
return Math.max(0, Math.floor((compact.length * 3) / 4) - padding);
|
|
1066
1077
|
}
|
|
1067
1078
|
|
|
1079
|
+
// Terminal colour and cursor codes in a tool's output (nvm, git, test runners) show as boxes on a page. Working shows
|
|
1080
|
+
// the text without them; the saved working keeps them. In order: an OSC sequence (a hyperlink or a title) through
|
|
1081
|
+
// its terminator, but never past the end of its line or the next ESC, so one cut off by a saved snapshot's omission
|
|
1082
|
+
// can't take the notice and the text after it (Sol, c100); a CSI code, as ansi-regex; what's left of one cut off
|
|
1083
|
+
// (at the end of a streamed update, say); a stray BEL (Oliver, 28 Oct).
|
|
1084
|
+
const TRACE_TERMINAL_CODE_RE = /\u001B\][^\u0007\u001B\u009C\n]*(?:\u0007|\u001B\\|\u009C)?|[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]|[\u001B\u009B][[\]()#;?]*[\d;:]*|\u0007/g;
|
|
1085
|
+
function stripTraceTerminalCodes(text) {
|
|
1086
|
+
return String(text || "").replace(TRACE_TERMINAL_CODE_RE, "");
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1068
1089
|
function normalizeTraceEntry(entry, fallbackIndex) {
|
|
1069
1090
|
if (!entry || typeof entry !== "object") return null;
|
|
1070
1091
|
if (entry.type === "assistant") {
|
|
@@ -1088,7 +1109,7 @@
|
|
|
1088
1109
|
label: parseNonEmptyString(entry.label),
|
|
1089
1110
|
argsSummary: parseNonEmptyString(entry.argsSummary),
|
|
1090
1111
|
args: parseNonEmptyString(entry.args),
|
|
1091
|
-
output: typeof entry.output === "string" ? entry.output : "",
|
|
1112
|
+
output: typeof entry.output === "string" ? stripTraceTerminalCodes(entry.output) : "",
|
|
1092
1113
|
images: Array.isArray(entry.images)
|
|
1093
1114
|
? entry.images.map((image, imageIndex) => normalizeTraceImage(image, imageIndex)).filter(Boolean)
|
|
1094
1115
|
: [],
|
|
@@ -1114,10 +1135,15 @@
|
|
|
1114
1135
|
status: normalizeTraceStatus(raw.status),
|
|
1115
1136
|
startedAt: parseFiniteNumber(raw.startedAt),
|
|
1116
1137
|
updatedAt: parseFiniteNumber(raw.updatedAt),
|
|
1138
|
+
prompt: normalizeTracePrompt(raw.prompt),
|
|
1117
1139
|
entries,
|
|
1118
1140
|
};
|
|
1119
1141
|
}
|
|
1120
1142
|
|
|
1143
|
+
function normalizeTracePrompt(value) {
|
|
1144
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1121
1147
|
function ensureTraceState() {
|
|
1122
1148
|
if (!traceState) traceState = createEmptyTraceState();
|
|
1123
1149
|
return traceState;
|
|
@@ -1131,6 +1157,9 @@
|
|
|
1131
1157
|
traceOpenDetails.clear();
|
|
1132
1158
|
traceClosedDetails.clear();
|
|
1133
1159
|
traceSectionDefaults.clear();
|
|
1160
|
+
traceStepsShownOpen.clear();
|
|
1161
|
+
traceStepsPaused = false;
|
|
1162
|
+
traceStepsFolded = false;
|
|
1134
1163
|
}
|
|
1135
1164
|
renderTraceViewIfActive();
|
|
1136
1165
|
}
|
|
@@ -1198,6 +1227,7 @@
|
|
|
1198
1227
|
if (Object.prototype.hasOwnProperty.call(message, "status")) {
|
|
1199
1228
|
state.status = normalizeTraceStatus(message.status);
|
|
1200
1229
|
}
|
|
1230
|
+
if (Object.prototype.hasOwnProperty.call(message, "prompt")) state.prompt = normalizeTracePrompt(message.prompt);
|
|
1201
1231
|
renderTraceViewIfActive();
|
|
1202
1232
|
}
|
|
1203
1233
|
|
|
@@ -1291,6 +1321,7 @@
|
|
|
1291
1321
|
if (Object.prototype.hasOwnProperty.call(message, "startedAt")) state.startedAt = parseFiniteNumber(message.startedAt);
|
|
1292
1322
|
if (Object.prototype.hasOwnProperty.call(message, "updatedAt")) state.updatedAt = parseFiniteNumber(message.updatedAt);
|
|
1293
1323
|
if (Object.prototype.hasOwnProperty.call(message, "status")) state.status = normalizeTraceStatus(message.status);
|
|
1324
|
+
if (Object.prototype.hasOwnProperty.call(message, "prompt")) state.prompt = normalizeTracePrompt(message.prompt);
|
|
1294
1325
|
if (shouldDisplayLiveTrace()) {
|
|
1295
1326
|
setTraceDisplayContext({ mode: "live", responseId: null, historyIndex: responseHistoryIndex, total: responseHistory.length, summary: null });
|
|
1296
1327
|
updateTraceStatusFromMessage(message);
|
|
@@ -1345,7 +1376,15 @@
|
|
|
1345
1376
|
|
|
1346
1377
|
function buildVisibleWorkingText(filterOverride) {
|
|
1347
1378
|
const filter = normalizeTraceFilter(filterOverride || traceFilter);
|
|
1348
|
-
|
|
1379
|
+
// The new layout shows the run's prompt first under every filter, so Copy visible and Load include it, and are
|
|
1380
|
+
// available when it's all there is (Sol, candidate 99).
|
|
1381
|
+
const state = traceState || createEmptyTraceState();
|
|
1382
|
+
const prompt = studioUiRefreshUi && state.prompt && String(state.prompt).trim() ? "Prompt:\n" + String(state.prompt).trim() : "";
|
|
1383
|
+
const body = buildVisibleWorkingEntriesText(filter, getTraceEntriesForFilter(filter));
|
|
1384
|
+
return [prompt, body].filter(Boolean).join(filter === "thinking" ? "\n\n" : "\n\n---\n\n");
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
function buildVisibleWorkingEntriesText(filter, entries) {
|
|
1349
1388
|
if (!entries.length) return "";
|
|
1350
1389
|
|
|
1351
1390
|
if (filter === "thinking") {
|
|
@@ -4039,6 +4078,8 @@
|
|
|
4039
4078
|
const actionsEl = makeStudioUiRefreshElement("div", "studio-refresh-toolbar-actions");
|
|
4040
4079
|
const actionLineOneEl = makeStudioUiRefreshElement("div", "studio-refresh-action-line");
|
|
4041
4080
|
if (!isEditorOnlyMode && sendRunBtn) actionLineOneEl.appendChild(sendRunBtn);
|
|
4081
|
+
// Steer sits beside Stop, and the clock follows it (Oliver, 28 Oct).
|
|
4082
|
+
if (!isEditorOnlyMode && queueSteerBtn) actionLineOneEl.appendChild(queueSteerBtn);
|
|
4042
4083
|
const promptRunIndicator = makeStudioUiRefreshElement("span", "studio-prompt-run-indicator");
|
|
4043
4084
|
promptRunIndicator.id = "studioPromptRunIndicator"; promptRunIndicator.hidden = true;
|
|
4044
4085
|
promptRunIndicator.setAttribute("role", "status"); promptRunIndicator.setAttribute("aria-live", "polite");
|
|
@@ -4046,7 +4087,6 @@
|
|
|
4046
4087
|
// The run status takes the indicator's place while running, so the row keeps its width.
|
|
4047
4088
|
const runStatus = makeStudioUiRefreshElement("span", "studio-run-status");
|
|
4048
4089
|
runStatus.hidden = true; actionLineOneEl.appendChild(runStatus);
|
|
4049
|
-
if (!isEditorOnlyMode && queueSteerBtn) actionLineOneEl.appendChild(queueSteerBtn);
|
|
4050
4090
|
const actionLineTwoEl = makeStudioUiRefreshElement("div", "studio-refresh-action-line studio-refresh-utility-action-line");
|
|
4051
4091
|
if (!contextMenu && copyDraftBtn) actionLineTwoEl.appendChild(copyDraftBtn);
|
|
4052
4092
|
if (!contextMenu && suggestCompletionBtn) actionLineTwoEl.appendChild(suggestCompletionBtn);
|
|
@@ -6733,6 +6773,15 @@
|
|
|
6733
6773
|
return;
|
|
6734
6774
|
}
|
|
6735
6775
|
|
|
6776
|
+
// Oliver, 27 Oct: Ctrl+Option+L for the latest response, as in agent-markdown-preview, also while editing: on a
|
|
6777
|
+
// Mac it types nothing. Elsewhere Ctrl+Alt is AltGr, which types letters such as ł, so there only outside text.
|
|
6778
|
+
if (event.ctrlKey && event.altKey && !event.metaKey && !event.shiftKey && code === "KeyL"
|
|
6779
|
+
&& (isMacShortcutPlatform() || !isTextEntryShortcutTarget(event.target))) {
|
|
6780
|
+
event.preventDefault();
|
|
6781
|
+
triggerResponseHistoryShortcut("latest");
|
|
6782
|
+
return;
|
|
6783
|
+
}
|
|
6784
|
+
|
|
6736
6785
|
if (!isTextEntryShortcutTarget(event.target) && !event.metaKey && !event.ctrlKey && event.altKey && !event.shiftKey) {
|
|
6737
6786
|
if (key === "ArrowLeft") {
|
|
6738
6787
|
event.preventDefault();
|
|
@@ -7437,7 +7486,8 @@
|
|
|
7437
7486
|
if (!referenceBadgeEl) return;
|
|
7438
7487
|
if (referenceHistoryCountEl) referenceHistoryCountEl.hidden = true;
|
|
7439
7488
|
const referenceMetaEl = referenceBadgeEl.closest(".reference-meta");
|
|
7440
|
-
|
|
7489
|
+
// Oliver, 27 Oct: in the new layout Working's own header says what this line said (status, steps, start).
|
|
7490
|
+
if (rightView === "repl" || (studioUiRefreshUi && (rightView === "editor-preview" || rightView === "trace")) || (bufferSwitchingEnabled && studioUiRefreshUi && rightView === "files")) {
|
|
7441
7491
|
if (referenceMetaEl instanceof HTMLElement) referenceMetaEl.hidden = true;
|
|
7442
7492
|
if (rightView === "editor-preview") referenceBadgeEl.textContent = "";
|
|
7443
7493
|
return;
|
|
@@ -11817,8 +11867,11 @@
|
|
|
11817
11867
|
}
|
|
11818
11868
|
|
|
11819
11869
|
function handleTracePaneScroll() {
|
|
11870
|
+
const own = traceOwnScrollTop !== null && critiqueViewEl && Math.abs(critiqueViewEl.scrollTop - traceOwnScrollTop) < 1;
|
|
11871
|
+
traceOwnScrollTop = null;
|
|
11820
11872
|
if (rightView === "trace") {
|
|
11821
11873
|
traceAutoScroll = shouldStickTraceToBottom();
|
|
11874
|
+
if (!own && critiqueViewEl && critiqueViewEl.scrollHeight - critiqueViewEl.clientHeight > 4) traceStepsPaused = !traceAutoScroll;
|
|
11822
11875
|
return;
|
|
11823
11876
|
}
|
|
11824
11877
|
if (rightView === "repl") {
|
|
@@ -11845,7 +11898,11 @@
|
|
|
11845
11898
|
|
|
11846
11899
|
function setTraceVisibleDetails(open) {
|
|
11847
11900
|
if (rightView !== "trace" || studioLinkedReaderIsActive() || !critiqueViewEl) return false;
|
|
11848
|
-
|
|
11901
|
+
// In the new layout Collapse all folds the steps (and the prompt) to their lines and leaves what's inside them
|
|
11902
|
+
// as it was, so a step opened afterwards shows its sections. Expand all opens everything (Oliver, 28 Oct).
|
|
11903
|
+
const steps = Boolean(studioUiRefreshUi);
|
|
11904
|
+
const nodes = critiqueViewEl.querySelectorAll(steps && !open ? "details.trace-step[data-trace-details-key]" : "details[data-trace-details-key]");
|
|
11905
|
+
if (steps) traceStepsFolded = !open;
|
|
11849
11906
|
for (const node of nodes) {
|
|
11850
11907
|
const key = node.getAttribute("data-trace-details-key");
|
|
11851
11908
|
if (open) { traceOpenDetails.add(key); traceClosedDetails.delete(key); }
|
|
@@ -11853,6 +11910,16 @@
|
|
|
11853
11910
|
node.setAttribute("data-trace-expected-open", String(open));
|
|
11854
11911
|
node.open = open;
|
|
11855
11912
|
}
|
|
11913
|
+
// Folding a step can hide the focused control inside it. Keep focus on that step's own line, so the keys and
|
|
11914
|
+
// the next Expand still work (candidate 99).
|
|
11915
|
+
const focused = document.activeElement;
|
|
11916
|
+
if (!open && focused instanceof Element && critiqueViewEl.contains(focused)) {
|
|
11917
|
+
let fold = null;
|
|
11918
|
+
for (let node = focused.parentElement; node && node !== critiqueViewEl; node = node.parentElement) {
|
|
11919
|
+
if (node.matches("details[data-trace-details-key]") && !node.open && node.querySelector(":scope > summary") !== focused) fold = node;
|
|
11920
|
+
}
|
|
11921
|
+
fold?.querySelector(":scope > summary")?.focus({ preventScroll: true });
|
|
11922
|
+
}
|
|
11856
11923
|
if (nodes.length) traceAutoScroll = false;
|
|
11857
11924
|
return nodes.length > 0;
|
|
11858
11925
|
}
|
|
@@ -13773,7 +13840,7 @@
|
|
|
13773
13840
|
const visibleText = isExpanded || !preview.truncated ? value : preview.text;
|
|
13774
13841
|
const code = options && options.language === "javascript";
|
|
13775
13842
|
const rendered = code ? visibleText.replace(/\r\n/g, "\n").split("\n").map(line => highlightCodeLine(line, "javascript", "overlay")).join("\n") : escapeHtml(visibleText);
|
|
13776
|
-
const body = "<pre class='plain-markdown trace-output" + (code ? " trace-output-code" : "") + "'>" + rendered + "</pre>";
|
|
13843
|
+
const body = "<pre class='plain-markdown trace-output" + (code ? " trace-output-code" : "") + (options && options.prose ? " trace-output-prose" : "") + "'>" + rendered + "</pre>";
|
|
13777
13844
|
if (!preview.truncated) return body;
|
|
13778
13845
|
|
|
13779
13846
|
const hiddenParts = [];
|
|
@@ -13809,7 +13876,9 @@
|
|
|
13809
13876
|
|
|
13810
13877
|
function renderTraceSection(label, text, key, body, options) {
|
|
13811
13878
|
const settings = options || {}, value = String(text || ""), images = settings.imageCount || 0;
|
|
13812
|
-
|
|
13879
|
+
// In the new layout a section is open whenever its step is, unless the person folds it (Oliver, 28 Oct).
|
|
13880
|
+
const opened = studioUiRefreshUi ? traceStepIsOpen(key, true)
|
|
13881
|
+
: traceSectionIsOpen(key, value, images > 1 ? false : undefined, !settings.pending || Boolean(value) || images > 0);
|
|
13813
13882
|
const metrics = value ? formatTraceTextMetrics(value) : (images ? "" : (settings.pending ? "Waiting for output" : "No output"));
|
|
13814
13883
|
const summary = [label, settings.isError ? "Error" : "", metrics, images ? images + " image" + (images === 1 ? "" : "s") : ""].filter(Boolean).join(" · ");
|
|
13815
13884
|
return "<details class='trace-tool-details trace-section-fold" + (settings.isError ? " is-error" : "") + "' data-trace-details-key='" + escapeHtml(key)
|
|
@@ -13829,6 +13898,12 @@
|
|
|
13829
13898
|
return { label: "Code", language: "javascript", text: payload ? payload.code : text,
|
|
13830
13899
|
extraInput: payload && Object.keys(payload).some(key => key !== "code") ? text : "" };
|
|
13831
13900
|
}
|
|
13901
|
+
// Oliver, 27 Oct: a Bash step shows its command, not the JSON around it, as codemode shows its Code. Any other
|
|
13902
|
+
// field, such as a timeout, stays in Raw input.
|
|
13903
|
+
if (name === "bash" && payload && typeof payload.command === "string") {
|
|
13904
|
+
return { label: "Command", language: "", text: payload.command,
|
|
13905
|
+
extraInput: Object.keys(payload).some(key => key !== "command") ? text : "" };
|
|
13906
|
+
}
|
|
13832
13907
|
return { label: name === "repl_send" || name === "studio_repl_send" ? "Code" : "Input", language: "", text, extraInput: "" };
|
|
13833
13908
|
}
|
|
13834
13909
|
|
|
@@ -13989,6 +14064,8 @@
|
|
|
13989
14064
|
if (presentation.language === "javascript") return renderTraceOutput(presentation.text, entry.id + ":input", { label: "Code", language: "javascript" })
|
|
13990
14065
|
+ (presentation.extraInput ? renderTraceRawInputDetails(presentation.extraInput, entry.id + ":input") : "");
|
|
13991
14066
|
const toolName = String(entry.toolName || "").trim().toLowerCase();
|
|
14067
|
+
if (toolName === "bash" && presentation.label === "Command") return renderTraceOutput(presentation.text, entry.id + ":input", { label: "Command" })
|
|
14068
|
+
+ (presentation.extraInput ? renderTraceRawInputDetails(presentation.extraInput, entry.id + ":input") : "");
|
|
13992
14069
|
if (toolName === "bash") return renderTraceCommandInput(entry, inputText, "Command");
|
|
13993
14070
|
if (toolName === "repl_send" || toolName === "studio_repl_send") return renderTraceCommandInput(entry, inputText, "Code");
|
|
13994
14071
|
const payload = parseTraceToolArgsObject(inputText);
|
|
@@ -14344,11 +14421,16 @@
|
|
|
14344
14421
|
const historyMeta = (context.mode === "history" || context.mode === "missing" || context.mode === "loading")
|
|
14345
14422
|
? getTraceHistoryContextLabel()
|
|
14346
14423
|
: null;
|
|
14424
|
+
// Oliver, 27 Oct: in the new layout Working reads like agent-markdown-preview's page. The prompt comes first, each
|
|
14425
|
+
// step is one numbered line until opened, and this header is the one line saying the run's state (the pane is
|
|
14426
|
+
// already called Working).
|
|
14427
|
+
const steps = Boolean(studioUiRefreshUi);
|
|
14347
14428
|
const toolbar = "<div class='trace-toolbar'>"
|
|
14348
14429
|
+ "<div class='trace-summary'>"
|
|
14349
|
-
+ "<span class='trace-summary-badge'>Working</span>"
|
|
14430
|
+
+ (steps ? "" : "<span class='trace-summary-badge'>Working</span>")
|
|
14350
14431
|
+ "<span class='trace-summary-status trace-status-" + escapeHtml(String(state.status || "idle")) + "'>" + escapeHtml(statusLabel) + "</span>"
|
|
14351
14432
|
+ (historyMeta ? ("<span class='trace-summary-meta'>" + escapeHtml(historyMeta) + "</span>") : "")
|
|
14433
|
+
+ (steps && entries.length ? "<span class='trace-summary-meta'>" + entries.length + " step" + (entries.length === 1 ? "" : "s") + "</span>" : "")
|
|
14352
14434
|
+ (started ? ("<span class='trace-summary-meta'>Started " + escapeHtml(started) + "</span>") : "")
|
|
14353
14435
|
+ (context.summary && context.summary.truncated ? "<span class='trace-summary-meta'>Truncated</span>" : "")
|
|
14354
14436
|
+ (filterMeta ? ("<span class='trace-summary-meta'>" + escapeHtml(filterMeta) + "</span>") : "")
|
|
@@ -14366,6 +14448,7 @@
|
|
|
14366
14448
|
+ "</div>"
|
|
14367
14449
|
+ "</div>";
|
|
14368
14450
|
|
|
14451
|
+
const promptCard = steps && state.prompt ? renderTracePromptCard(state) : "";
|
|
14369
14452
|
if (!entries.length) {
|
|
14370
14453
|
const emptyMessage = context.mode === "loading"
|
|
14371
14454
|
? "Loading saved working for this response…"
|
|
@@ -14378,34 +14461,50 @@
|
|
|
14378
14461
|
: (state.status === "running"
|
|
14379
14462
|
? "Waiting for the first model or tool update…"
|
|
14380
14463
|
: "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
|
-
|
|
14464
|
+
return "<div class='trace-panel'>" + toolbar + (promptCard ? "<div class='trace-list'>" + promptCard + "</div>" : "")
|
|
14465
|
+
+ "<div class='trace-empty'>" + escapeHtml(emptyMessage) + "</div></div>";
|
|
14466
|
+
}
|
|
14467
|
+
|
|
14468
|
+
// Numbered by place in the whole run, so a step keeps its number under Thinking or Tools.
|
|
14469
|
+
const positions = new Map(getTraceEntriesForFilter("all").map((entry, index) => [entry.id, index + 1]));
|
|
14470
|
+
const latestId = entries[entries.length - 1].id, shownOpen = new Map();
|
|
14471
|
+
const card = (kindClass, entry, header, body, preview) => {
|
|
14472
|
+
if (!steps) return "<article class='trace-card " + kindClass + "'><div class='trace-card-header'>" + header + "</div>" + body + "</article>";
|
|
14473
|
+
const key = "step:" + entry.id, running = entry.status === "streaming" || entry.status === "pending";
|
|
14474
|
+
// Earlier steps fold as new ones arrive, except while the person has scrolled up to read.
|
|
14475
|
+
const opened = traceStepIsOpen(key, !traceStepsFolded && (running || entry.id === latestId || (traceStepsPaused && traceStepsShownOpen.has(key))));
|
|
14476
|
+
shownOpen.set(key, opened);
|
|
14477
|
+
const firstLine = String(preview || "").split("\n").find(line => line.trim()) || "";
|
|
14478
|
+
return "<details class='trace-card " + kindClass + " trace-step' data-trace-details-key='" + escapeHtml(key) + "' data-trace-expected-open='" + opened + "'" + (opened ? " open" : "") + ">"
|
|
14479
|
+
+ "<summary class='trace-card-header'><span class='trace-step-number'>" + (positions.get(entry.id) || "") + "</span>" + header
|
|
14480
|
+
+ (firstLine ? "<span class='trace-step-preview'>" + escapeHtml(firstLine.trim().slice(0, 300)) + "</span>" : "") + "</summary>"
|
|
14481
|
+
+ "<div class='trace-step-body'>" + body + "</div></details>";
|
|
14482
|
+
};
|
|
14383
14483
|
|
|
14384
14484
|
const cards = entries.map((entry) => {
|
|
14385
14485
|
if (entry.type === "assistant") {
|
|
14386
14486
|
const sections = [];
|
|
14387
14487
|
if (String(entry.thinking || "").trim()) {
|
|
14388
14488
|
sections.push(
|
|
14389
|
-
renderTraceSection("Thinking", entry.thinking, entry.id + ":thinking", renderTraceOutput(entry.thinking, entry.id + ":thinking", { label: "Thinking" }))
|
|
14489
|
+
renderTraceSection("Thinking", entry.thinking, entry.id + ":thinking", renderTraceOutput(entry.thinking, entry.id + ":thinking", { label: "Thinking", prose: true }))
|
|
14390
14490
|
);
|
|
14391
14491
|
}
|
|
14392
14492
|
if (filter === "all" && String(entry.text || "").trim()) {
|
|
14393
14493
|
sections.push(
|
|
14394
|
-
renderTraceSection("Response", entry.text, entry.id + ":response", renderTraceOutput(entry.text, entry.id + ":response", { label: "Response" }))
|
|
14494
|
+
renderTraceSection("Response", entry.text, entry.id + ":response", renderTraceOutput(entry.text, entry.id + ":response", { label: "Response", prose: true }))
|
|
14395
14495
|
);
|
|
14396
14496
|
}
|
|
14397
14497
|
if (!sections.length) {
|
|
14398
14498
|
sections.push("<div class='trace-empty-inline'>Waiting for streamed content…</div>");
|
|
14399
14499
|
}
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14500
|
+
const title = steps ? plainTraceTitle((filter === "thinking" ? entry.thinking : (entry.text || entry.thinking)) || "") : "";
|
|
14501
|
+
return card("trace-card-assistant", entry,
|
|
14502
|
+
"<span class='trace-kind-badge'>" + escapeHtml(filter === "thinking" ? "Thinking" : "Assistant") + "</span>"
|
|
14503
|
+
+ (title ? "<span class='trace-card-title'>" + escapeHtml(title) + "</span>" : "")
|
|
14403
14504
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14404
14505
|
+ 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>";
|
|
14506
|
+
+ (entry.stopReason === "length" ? "<span class='trace-card-meta'>Cut off at the length limit</span>" : ""),
|
|
14507
|
+
sections.join(""), "");
|
|
14409
14508
|
}
|
|
14410
14509
|
|
|
14411
14510
|
const title = entry.label || entry.toolName || "tool";
|
|
@@ -14418,20 +14517,52 @@
|
|
|
14418
14517
|
if (imageOutput) outputPieces.push(imageOutput);
|
|
14419
14518
|
const output = renderTraceSection("Output", entry.output, entry.id + ":output", outputPieces.length ? outputPieces.join("") : "<div class='trace-empty-inline'>No output yet.</div>",
|
|
14420
14519
|
{ 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>"
|
|
14520
|
+
return card("trace-card-tool", entry,
|
|
14521
|
+
"<span class='trace-kind-badge'>" + escapeHtml(entry.toolName || "tool") + "</span>"
|
|
14424
14522
|
+ "<span class='trace-card-title'>" + escapeHtml(title) + "</span>"
|
|
14425
14523
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14426
14524
|
+ (formatTraceEntryDuration(entry) ? "<span class='trace-card-meta'>" + escapeHtml(formatTraceEntryDuration(entry)) + "</span>" : "")
|
|
14427
|
-
+ renderTraceEntryStatus(state, entry.status, toolError)
|
|
14428
|
-
+ "
|
|
14429
|
-
+ argsSummary
|
|
14430
|
-
+ output
|
|
14431
|
-
+ "</article>";
|
|
14525
|
+
+ renderTraceEntryStatus(state, entry.status, toolError),
|
|
14526
|
+
argsSummary + output, "");
|
|
14432
14527
|
}).join("");
|
|
14528
|
+
// Only the steps shown now: one hidden by a filter keeps its state, so a filter round trip folds nothing (Astra).
|
|
14529
|
+
for (const [key, opened] of shownOpen) { if (opened) traceStepsShownOpen.add(key); else traceStepsShownOpen.delete(key); }
|
|
14530
|
+
|
|
14531
|
+
return "<div class='trace-panel'>" + toolbar + "<div class='trace-list'>" + promptCard + cards + "</div></div>";
|
|
14532
|
+
}
|
|
14533
|
+
|
|
14534
|
+
// A line of Markdown as plain words for a step's title: "**Inspecting alias settings**" reads "Inspecting alias
|
|
14535
|
+
// settings". Code spans keep their text as written, and underscores are left alone, as in __init__ (Astra, c100).
|
|
14536
|
+
function plainTraceTitle(text) {
|
|
14537
|
+
const line = String(text || "").split("\n").find(part => part.trim()) || "";
|
|
14538
|
+
const parts = line.trim().replace(/^(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+[.)]\s+)+/, "").split(/(`[^`]*`)/);
|
|
14539
|
+
const last = parts.length - 1;
|
|
14540
|
+
return parts.map((part, index) => {
|
|
14541
|
+
if (index % 2) return part.slice(1, -1);
|
|
14542
|
+
let plain = part.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\*\*(.+?)\*\*/g, "$1");
|
|
14543
|
+
if (index === 0) plain = plain.replace(/^\*\*/, "");
|
|
14544
|
+
if (index === last) plain = plain.replace(/\*\*$/, "");
|
|
14545
|
+
return plain;
|
|
14546
|
+
}).join("").trim().slice(0, 300);
|
|
14547
|
+
}
|
|
14548
|
+
|
|
14549
|
+
// A step is open while it runs or is the latest, unless the person chose otherwise; earlier steps fold to one line.
|
|
14550
|
+
function traceStepIsOpen(key, byDefault) {
|
|
14551
|
+
if (traceOpenDetails.has(key)) return true;
|
|
14552
|
+
if (traceClosedDetails.has(key)) return false;
|
|
14553
|
+
return Boolean(byDefault);
|
|
14554
|
+
}
|
|
14433
14555
|
|
|
14434
|
-
|
|
14556
|
+
// What Pi is responding to: open when short, otherwise one line with its start, like a long section.
|
|
14557
|
+
function renderTracePromptCard(state) {
|
|
14558
|
+
const text = String(state.prompt || ""), key = "prompt:" + (state.runId || "live");
|
|
14559
|
+
const short = text.length <= TRACE_SECTION_AUTO_OPEN_MAX_CHARS && countTraceTextLines(text) <= TRACE_SECTION_AUTO_OPEN_MAX_LINES;
|
|
14560
|
+
const opened = traceStepIsOpen(key, short);
|
|
14561
|
+
const firstLine = text.split("\n").find(line => line.trim()) || "";
|
|
14562
|
+
return "<details class='trace-card trace-card-prompt trace-step' data-trace-details-key='" + escapeHtml(key) + "' data-trace-expected-open='" + opened + "'" + (opened ? " open" : "") + ">"
|
|
14563
|
+
+ "<summary class='trace-card-header'><span class='trace-card-title'>Prompt</span>"
|
|
14564
|
+
+ "<span class='trace-step-preview'>" + escapeHtml(firstLine.trim().slice(0, 300)) + "</span></summary>"
|
|
14565
|
+
+ "<div class='trace-step-body'><div class='trace-prompt-text'>" + escapeHtml(text) + "</div></div></details>";
|
|
14435
14566
|
}
|
|
14436
14567
|
|
|
14437
14568
|
const TRACE_RUN_STATUS_LABELS = { running: "Running", complete: "Finished", stopped: "Stopped", error: "Failed", idle: "Idle" };
|
|
@@ -14460,6 +14591,7 @@
|
|
|
14460
14591
|
} else {
|
|
14461
14592
|
critiqueViewEl.scrollTop = previousScrollTop;
|
|
14462
14593
|
}
|
|
14594
|
+
if (Math.abs(critiqueViewEl.scrollTop - previousScrollTop) >= 1) traceOwnScrollTop = critiqueViewEl.scrollTop;
|
|
14463
14595
|
scheduleResponsePaneRepaintNudge();
|
|
14464
14596
|
}
|
|
14465
14597
|
|
|
@@ -18711,7 +18843,7 @@
|
|
|
18711
18843
|
if (openCompanionBtn) addItem(loadMenu, openCompanionBtn, "studioNewDocumentWindowInfo", openCompanionBtn.title);
|
|
18712
18844
|
}
|
|
18713
18845
|
studioUiRefreshUi.menus = studioUiRefreshUi.menus.filter(item => item !== studioUiRefreshUi.openMenu);
|
|
18714
|
-
studioUiRefreshUi.actionLine.insertBefore(addMenu.anchor,
|
|
18846
|
+
studioUiRefreshUi.actionLine.insertBefore(addMenu.anchor, studioUiRefreshUi.runStatus?.nextSibling || null);
|
|
18715
18847
|
// One click (Oliver, 9 Oct): the real guarded buttons sit in the row and only the one that
|
|
18716
18848
|
// applies shows, "Add selection to Prompt" with text selected, else "Add document to Prompt".
|
|
18717
18849
|
addMenu.button.hidden = true;
|
package/client/studio.css
CHANGED
|
@@ -6810,11 +6810,11 @@
|
|
|
6810
6810
|
min-width: 8.6rem;
|
|
6811
6811
|
}
|
|
6812
6812
|
|
|
6813
|
-
/* Stop is the one filled action while running;
|
|
6813
|
+
/* Stop is the one filled action while running; Steer beside it is outlined (Oliver, 28 Oct). */
|
|
6814
6814
|
body.studio-ui-refresh #queueSteerBtn:not(:disabled) {
|
|
6815
6815
|
background: transparent;
|
|
6816
|
-
border-color:
|
|
6817
|
-
color: var(--
|
|
6816
|
+
border-color: var(--control-border);
|
|
6817
|
+
color: var(--text);
|
|
6818
6818
|
font-weight: 600;
|
|
6819
6819
|
}
|
|
6820
6820
|
|
|
@@ -6822,7 +6822,7 @@
|
|
|
6822
6822
|
background: var(--studio-header-action-hover-bg, var(--panel-2));
|
|
6823
6823
|
}
|
|
6824
6824
|
|
|
6825
|
-
/*
|
|
6825
|
+
/* Steer needs no fixed width. The old 10rem left a gap before it and, on a
|
|
6826
6826
|
13-inch screen, pushed the tools onto a second row while running (Oliver, 19 Oct). */
|
|
6827
6827
|
body.studio-ui-refresh #queueSteerBtn {
|
|
6828
6828
|
min-width: 0;
|
|
@@ -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,53 @@
|
|
|
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. */
|
|
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
|
+
}
|
|
7707
|
+
/* Oliver, 28 Oct: lit like agent-markdown-preview's Working page. Steps are the light surface on the pane's darker
|
|
7708
|
+
one, an open step has a rule under its line, and inside a step the text sits on the step without frames of its
|
|
7709
|
+
own. The prompt, Thinking and Response read as prose; an Assistant step's title is its first line, so it isn't
|
|
7710
|
+
bold like a tool's label. */
|
|
7711
|
+
body.studio-workspace-layout #critiqueView:has(> .trace-panel) { background: var(--bg); }
|
|
7712
|
+
body.studio-workspace-layout details.trace-step { border-color: var(--panel-border); background: var(--panel); box-shadow: none; }
|
|
7713
|
+
body.studio-workspace-layout details.trace-step > summary.trace-card-header { padding: 9px 14px; }
|
|
7714
|
+
body.studio-workspace-layout details.trace-step > .trace-step-body { gap: 4px; border-top: 1px solid var(--panel-border); padding: 8px 14px 10px; }
|
|
7715
|
+
body.studio-workspace-layout .trace-step .trace-output-wrap,
|
|
7716
|
+
body.studio-workspace-layout .trace-step .trace-output,
|
|
7717
|
+
body.studio-workspace-layout .trace-step .trace-tool-fields,
|
|
7718
|
+
body.studio-workspace-layout .trace-step .trace-image-gallery { border: 0; border-radius: 0; background: transparent; padding-left: 0; padding-right: 0; }
|
|
7719
|
+
body.studio-workspace-layout .trace-step .trace-output { margin: 0; padding-top: 2px; padding-bottom: 4px; }
|
|
7720
|
+
body.studio-workspace-layout .trace-step .trace-output-prose,
|
|
7721
|
+
body.studio-workspace-layout .trace-prompt-text { font-family: inherit; line-height: 1.5; }
|
|
7722
|
+
body.studio-workspace-layout .trace-card-assistant > summary > .trace-card-title { font-weight: 400; }
|
|
7723
|
+
body.studio-workspace-layout .trace-step code.trace-tool-field-value { padding: 0; border: 0; background: transparent; }
|
|
7724
|
+
body.studio-workspace-layout .trace-step .trace-output-truncation { padding: 4px 0; background: transparent; }
|
|
7677
7725
|
body.studio-workspace-layout .trace-filter-btn.is-active { color: var(--accent); }
|
|
7678
7726
|
body.studio-workspace-layout #scratchpadBtn.has-content:not(:disabled):hover,
|
|
7679
7727
|
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.4",
|
|
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",
|