pi-studio 0.11.1 → 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 +18 -0
- package/client/studio-client.js +196 -42
- package/client/studio.css +44 -0
- package/index.ts +23 -3
- package/package.json +1 -1
- package/shared/studio-buffer-client.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ 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
|
+
|
|
18
|
+
## [0.11.2] — 2026-10-27
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- "Queue steering" is now **Steer**, Pi's own term. Its hover text says when the message arrives: when the agent's current step ends, before its next model call.
|
|
22
|
+
- In the new layout, the Prompt pane's **View** menu sits in its top row after **File**, as the response pane's View sits in its header. With the shorter label, the toolbar stays on one line while a prompt runs, with the default split, from about 1,100 px wide, down from about 1,315. A long file name shortens before the top row wraps.
|
|
23
|
+
- Saving a Document no longer briefly shows a notice above the panes, which made them jump, or a recovery warning in the footer, while Studio finishes the save. A save Studio can't finish itself still shows its notice and **Resolve saved backing…**. After a normal save the footer says "Saved NOTES.md.".
|
|
24
|
+
|
|
7
25
|
## [0.11.1] — 2026-10-22
|
|
8
26
|
|
|
9
27
|
### Changed
|
package/client/studio-client.js
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
let documentHostingReady = false, documentHostingPreparingFile = false, documentHostingRetired = false;
|
|
60
60
|
let documentHostingSaveResolution = null;
|
|
61
61
|
let documentHostingSaveResolutionBufferId = null, documentHostingFilePreparationBufferId = null;
|
|
62
|
+
let documentHostingSaveResolutionOperationId = null, documentHostingSaveResolutionStartedAt = 0;
|
|
62
63
|
let documentHostingResourceDir = null, documentHostingResourceEditGeneration = 0, documentHostingMetadataLocked = false;
|
|
63
64
|
const settledHostingSaveRequests = new Map();
|
|
64
65
|
const documentHostingOwnerFlights = new Map();
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
let scratchpadHostingProduction = null, reviewNotesHostingProduction = null;
|
|
67
68
|
const documentHostingWaiters = new Set();
|
|
68
69
|
let bufferRecoveryClient = null;
|
|
69
|
-
let bufferRecoveryIssue = "", bufferRecoveryKeptClosed = false;
|
|
70
|
+
let bufferRecoveryIssue = "", bufferRecoveryKeptClosed = false, bufferRecoveryIssueChannels = null;
|
|
70
71
|
let bufferRecoveryPanel = null;
|
|
71
72
|
let bufferRecoveryInitializing = false;
|
|
72
73
|
let bufferRecoveryNavigationConsent = null;
|
|
@@ -373,7 +374,8 @@
|
|
|
373
374
|
let studioOperationNotices = new Map();
|
|
374
375
|
let studioOperationNoticesEl = null;
|
|
375
376
|
let studioDocumentDestinationsSection = null;
|
|
376
|
-
let studioOperationNoticeFingerprint = "";
|
|
377
|
+
let studioOperationNoticeFingerprint = "", studioHeldSaveNoticeTimer = null;
|
|
378
|
+
const studioOwnSaveAttemptsEnded = new Set();
|
|
377
379
|
let statusLevel = "";
|
|
378
380
|
let reconnectTimer = null;
|
|
379
381
|
let reconnectAttempt = 0;
|
|
@@ -558,11 +560,19 @@
|
|
|
558
560
|
let traceDisplayContext = { mode: "live", responseId: null, historyIndex: -1, total: 0, summary: null };
|
|
559
561
|
let traceFilter = "all";
|
|
560
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;
|
|
561
569
|
let traceRenderRaf = null;
|
|
562
570
|
const traceExpandedOutputs = new Set();
|
|
563
571
|
const traceOpenDetails = new Set();
|
|
564
572
|
const traceClosedDetails = new Set();
|
|
565
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();
|
|
566
576
|
let gitChangesState = {
|
|
567
577
|
status: "idle",
|
|
568
578
|
requestId: null,
|
|
@@ -960,7 +970,7 @@
|
|
|
960
970
|
// Oliver, 22 Oct: the clock alone, beside Stop, so the running row fits narrower windows.
|
|
961
971
|
return Math.floor(seconds / 60) + ":" + String(seconds % 60).padStart(2, "0");
|
|
962
972
|
}
|
|
963
|
-
// Oliver, 14 Oct: a Run waiting for Pi to start says so briefly here, so
|
|
973
|
+
// Oliver, 14 Oct: a Run waiting for Pi to start says so briefly here, so Steer fits
|
|
964
974
|
// beside it and the toolbar doesn't wrap and jump back. The footer keeps the detail.
|
|
965
975
|
if (uiBusy && pendingKind === "direct") return "Starting…";
|
|
966
976
|
return uiBusy ? getStudioBusyStatus(pendingKind) : "";
|
|
@@ -1018,6 +1028,7 @@
|
|
|
1018
1028
|
status: "idle",
|
|
1019
1029
|
startedAt: null,
|
|
1020
1030
|
updatedAt: null,
|
|
1031
|
+
prompt: null,
|
|
1021
1032
|
entries: [],
|
|
1022
1033
|
};
|
|
1023
1034
|
}
|
|
@@ -1112,10 +1123,15 @@
|
|
|
1112
1123
|
status: normalizeTraceStatus(raw.status),
|
|
1113
1124
|
startedAt: parseFiniteNumber(raw.startedAt),
|
|
1114
1125
|
updatedAt: parseFiniteNumber(raw.updatedAt),
|
|
1126
|
+
prompt: normalizeTracePrompt(raw.prompt),
|
|
1115
1127
|
entries,
|
|
1116
1128
|
};
|
|
1117
1129
|
}
|
|
1118
1130
|
|
|
1131
|
+
function normalizeTracePrompt(value) {
|
|
1132
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1119
1135
|
function ensureTraceState() {
|
|
1120
1136
|
if (!traceState) traceState = createEmptyTraceState();
|
|
1121
1137
|
return traceState;
|
|
@@ -1129,6 +1145,8 @@
|
|
|
1129
1145
|
traceOpenDetails.clear();
|
|
1130
1146
|
traceClosedDetails.clear();
|
|
1131
1147
|
traceSectionDefaults.clear();
|
|
1148
|
+
traceStepsShownOpen.clear();
|
|
1149
|
+
traceStepsPaused = false;
|
|
1132
1150
|
}
|
|
1133
1151
|
renderTraceViewIfActive();
|
|
1134
1152
|
}
|
|
@@ -1196,6 +1214,7 @@
|
|
|
1196
1214
|
if (Object.prototype.hasOwnProperty.call(message, "status")) {
|
|
1197
1215
|
state.status = normalizeTraceStatus(message.status);
|
|
1198
1216
|
}
|
|
1217
|
+
if (Object.prototype.hasOwnProperty.call(message, "prompt")) state.prompt = normalizeTracePrompt(message.prompt);
|
|
1199
1218
|
renderTraceViewIfActive();
|
|
1200
1219
|
}
|
|
1201
1220
|
|
|
@@ -1289,6 +1308,7 @@
|
|
|
1289
1308
|
if (Object.prototype.hasOwnProperty.call(message, "startedAt")) state.startedAt = parseFiniteNumber(message.startedAt);
|
|
1290
1309
|
if (Object.prototype.hasOwnProperty.call(message, "updatedAt")) state.updatedAt = parseFiniteNumber(message.updatedAt);
|
|
1291
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);
|
|
1292
1312
|
if (shouldDisplayLiveTrace()) {
|
|
1293
1313
|
setTraceDisplayContext({ mode: "live", responseId: null, historyIndex: responseHistoryIndex, total: responseHistory.length, summary: null });
|
|
1294
1314
|
updateTraceStatusFromMessage(message);
|
|
@@ -1343,7 +1363,15 @@
|
|
|
1343
1363
|
|
|
1344
1364
|
function buildVisibleWorkingText(filterOverride) {
|
|
1345
1365
|
const filter = normalizeTraceFilter(filterOverride || traceFilter);
|
|
1346
|
-
|
|
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) {
|
|
1347
1375
|
if (!entries.length) return "";
|
|
1348
1376
|
|
|
1349
1377
|
if (filter === "thinking") {
|
|
@@ -4067,13 +4095,14 @@
|
|
|
4067
4095
|
(isEditorOnlyMode || isWatchedFilePreview || followMenu) ? null : activityTrackingSelect,
|
|
4068
4096
|
(bufferSwitchingEnabled && !followMenu) ? documentPreviewFollowSelect : null]);
|
|
4069
4097
|
appendStudioUiRefreshMenuSection(viewMenu.menu, "Annotations", [annotationModeSelect, insertHeaderBtn, stripAnnotationsBtn, saveAnnotatedBtn]);
|
|
4098
|
+
// View sits after File in row 1, as the right pane's View sits in its header, so row 2 fits narrower panes (Oliver, 27 Oct).
|
|
4099
|
+
headerToolsEl.appendChild(viewMenu.anchor);
|
|
4070
4100
|
// Row 2 mirrors row 1: the main action on the left, the tools on the right (Oliver, 10 Oct).
|
|
4071
4101
|
const toolsEl = makeStudioUiRefreshElement("span", "studio-refresh-tools");
|
|
4072
4102
|
if (reviewNotesBtn) toolsEl.appendChild(reviewNotesBtn);
|
|
4073
4103
|
if (scratchpadBtn) toolsEl.appendChild(scratchpadBtn);
|
|
4074
4104
|
if (isEditorOnlyMode && askAsideBtn) toolsEl.appendChild(askAsideBtn);
|
|
4075
4105
|
if (reviewMenu) toolsEl.appendChild(reviewMenu.anchor);
|
|
4076
|
-
toolsEl.appendChild(viewMenu.anchor);
|
|
4077
4106
|
actionLineOneEl.appendChild(toolsEl);
|
|
4078
4107
|
|
|
4079
4108
|
toolbarMainEl.appendChild(actionsEl);
|
|
@@ -5003,12 +5032,57 @@
|
|
|
5003
5032
|
} else if (opening?.error) add({ id: "open:invalid", kind: "open", bufferId: null,
|
|
5004
5033
|
message: "Opening backup could not be verified. Keep it for recovery; current work was kept.",
|
|
5005
5034
|
actions: [{ controlId: "studioDownloadOpenBtn", label: "Export backup" }] });
|
|
5006
|
-
for (const save of bufferRecoveryClient?.pendingHostingSaves() || [])
|
|
5007
|
-
|
|
5008
|
-
|
|
5035
|
+
for (const save of bufferRecoveryClient?.pendingHostingSaves() || []) {
|
|
5036
|
+
if (holdStudioSaveNotice(save.operationId)) continue;
|
|
5037
|
+
add({ id: "save:" + save.operationId, kind: "save", bufferId: save.bufferId,
|
|
5038
|
+
message: "Disk save recorded; attaching its backing is unresolved. Current text kept.",
|
|
5039
|
+
actions: [{ controlId: "studioResolveSaveBtn", label: "Resolve saved backing…", selectedBufferOnly: true }] });
|
|
5040
|
+
}
|
|
5009
5041
|
return notices;
|
|
5010
5042
|
}
|
|
5011
5043
|
|
|
5044
|
+
// Oliver, 27 Oct: every Document save showed its own pending record for about 40 ms, above the panes (so they
|
|
5045
|
+
// jumped) and as a recovery warning in the footer. While this tab is still finishing that save itself, there's
|
|
5046
|
+
// nothing to decide yet; if it's still pending after that, or after 10 s, it shows as before.
|
|
5047
|
+
const STUDIO_OWN_SAVE_HOLD_MS = 10000;
|
|
5048
|
+
// When this tab's hold on a pending save ends, or 0 if it isn't held.
|
|
5049
|
+
function studioSaveHoldEndsAt(operationId) {
|
|
5050
|
+
// Once Studio's own attempt to finish it has ended, a save still pending is a decision to make.
|
|
5051
|
+
if (!operationId || studioOwnSaveAttemptsEnded.has(operationId)) return 0;
|
|
5052
|
+
let endsAt = 0;
|
|
5053
|
+
for (const operation of pendingSaveOperations.values()) {
|
|
5054
|
+
if (operation.hosting?.operationId === operationId) endsAt = Math.max(endsAt, (operation.startedAt || 0) + STUDIO_OWN_SAVE_HOLD_MS);
|
|
5055
|
+
}
|
|
5056
|
+
if (documentHostingSaveResolution && documentHostingSaveResolutionOperationId === operationId) {
|
|
5057
|
+
endsAt = Math.max(endsAt, documentHostingSaveResolutionStartedAt + STUDIO_OWN_SAVE_HOLD_MS);
|
|
5058
|
+
}
|
|
5059
|
+
return endsAt > Date.now() ? endsAt : 0;
|
|
5060
|
+
}
|
|
5061
|
+
function studioSaveIsFinishingItself(operationId) {
|
|
5062
|
+
return studioSaveHoldEndsAt(operationId) > 0;
|
|
5063
|
+
}
|
|
5064
|
+
function holdStudioSaveNotice(operationId) {
|
|
5065
|
+
const endsAt = studioSaveHoldEndsAt(operationId);
|
|
5066
|
+
if (!endsAt) return false;
|
|
5067
|
+
// Look again when the earliest hold ends, in case nothing else does: at its own end, not 10 s from now (Sol, Astra).
|
|
5068
|
+
if (!studioHeldSaveNoticeTimer || studioHeldSaveNoticeTimer.at > endsAt) {
|
|
5069
|
+
if (studioHeldSaveNoticeTimer) clearTimeout(studioHeldSaveNoticeTimer.id);
|
|
5070
|
+
studioHeldSaveNoticeTimer = { at: endsAt, id: setTimeout(() => {
|
|
5071
|
+
studioHeldSaveNoticeTimer = null; syncStudioOperationNotices(); renderStatus();
|
|
5072
|
+
}, Math.max(0, endsAt - Date.now()) + 50) };
|
|
5073
|
+
}
|
|
5074
|
+
return true;
|
|
5075
|
+
}
|
|
5076
|
+
function studioPendingSavesAreFinishing() {
|
|
5077
|
+
const saves = bufferRecoveryClient?.pendingHostingSaves() || [];
|
|
5078
|
+
return saves.length > 0 && saves.every(save => holdStudioSaveNotice(save.operationId));
|
|
5079
|
+
}
|
|
5080
|
+
function getStudioShownRecoveryIssue() {
|
|
5081
|
+
const channels = bufferRecoveryIssueChannels;
|
|
5082
|
+
if (!channels?.["file-save"] || Object.values(channels).join(" ") !== bufferRecoveryIssue || !studioPendingSavesAreFinishing()) return bufferRecoveryIssue;
|
|
5083
|
+
return Object.entries(channels).filter(([channel]) => channel !== "file-save").map(([, message]) => message).join(" ");
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5012
5086
|
function getStudioPriorityOperationNotice() {
|
|
5013
5087
|
return [...studioOperationNotices.values()].find(notice => notice.unresolved && notice.severity === "warning") || null;
|
|
5014
5088
|
}
|
|
@@ -5080,11 +5154,12 @@
|
|
|
5080
5154
|
// the footer quiet rather than duplicating it or competing with a short
|
|
5081
5155
|
// confirmation; retain a fallback if notice rendering is unavailable.
|
|
5082
5156
|
const operationInNotice = operation && studioOperationNoticesEl?.isConnected && !studioOperationNoticesEl.hidden;
|
|
5083
|
-
|
|
5084
|
-
|
|
5157
|
+
const recoveryIssue = getStudioShownRecoveryIssue();
|
|
5158
|
+
statusEl.textContent = recoveryIssue
|
|
5159
|
+
? "Recovery: " + recoveryIssue + (bufferRecoveryKeptClosed ? "" : " Save or copy your text before reloading. " + (operationInNotice ? "" : (operation?.message || statusMessage)))
|
|
5085
5160
|
: operationInNotice ? "" : operation?.message || statusMessage;
|
|
5086
|
-
statusEl.className =
|
|
5087
|
-
statusEl.title =
|
|
5161
|
+
statusEl.className = recoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
|
|
5162
|
+
statusEl.title = recoveryIssue || (!operationInNotice && operation?.message) || "";
|
|
5088
5163
|
if (typeof syncStudioPromptAddUndo === "function") syncStudioPromptAddUndo();
|
|
5089
5164
|
|
|
5090
5165
|
const spinnerActive = shouldAnimateFooterSpinner();
|
|
@@ -6684,6 +6759,15 @@
|
|
|
6684
6759
|
return;
|
|
6685
6760
|
}
|
|
6686
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
|
+
|
|
6687
6771
|
if (!isTextEntryShortcutTarget(event.target) && !event.metaKey && !event.ctrlKey && event.altKey && !event.shiftKey) {
|
|
6688
6772
|
if (key === "ArrowLeft") {
|
|
6689
6773
|
event.preventDefault();
|
|
@@ -7388,7 +7472,8 @@
|
|
|
7388
7472
|
if (!referenceBadgeEl) return;
|
|
7389
7473
|
if (referenceHistoryCountEl) referenceHistoryCountEl.hidden = true;
|
|
7390
7474
|
const referenceMetaEl = referenceBadgeEl.closest(".reference-meta");
|
|
7391
|
-
|
|
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")) {
|
|
7392
7477
|
if (referenceMetaEl instanceof HTMLElement) referenceMetaEl.hidden = true;
|
|
7393
7478
|
if (rightView === "editor-preview") referenceBadgeEl.textContent = "";
|
|
7394
7479
|
return;
|
|
@@ -11768,8 +11853,11 @@
|
|
|
11768
11853
|
}
|
|
11769
11854
|
|
|
11770
11855
|
function handleTracePaneScroll() {
|
|
11856
|
+
const own = traceOwnScrollTop !== null && critiqueViewEl && Math.abs(critiqueViewEl.scrollTop - traceOwnScrollTop) < 1;
|
|
11857
|
+
traceOwnScrollTop = null;
|
|
11771
11858
|
if (rightView === "trace") {
|
|
11772
11859
|
traceAutoScroll = shouldStickTraceToBottom();
|
|
11860
|
+
if (!own && critiqueViewEl && critiqueViewEl.scrollHeight - critiqueViewEl.clientHeight > 4) traceStepsPaused = !traceAutoScroll;
|
|
11773
11861
|
return;
|
|
11774
11862
|
}
|
|
11775
11863
|
if (rightView === "repl") {
|
|
@@ -11804,6 +11892,16 @@
|
|
|
11804
11892
|
node.setAttribute("data-trace-expected-open", String(open));
|
|
11805
11893
|
node.open = open;
|
|
11806
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
|
+
}
|
|
11807
11905
|
if (nodes.length) traceAutoScroll = false;
|
|
11808
11906
|
return nodes.length > 0;
|
|
11809
11907
|
}
|
|
@@ -13780,6 +13878,12 @@
|
|
|
13780
13878
|
return { label: "Code", language: "javascript", text: payload ? payload.code : text,
|
|
13781
13879
|
extraInput: payload && Object.keys(payload).some(key => key !== "code") ? text : "" };
|
|
13782
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
|
+
}
|
|
13783
13887
|
return { label: name === "repl_send" || name === "studio_repl_send" ? "Code" : "Input", language: "", text, extraInput: "" };
|
|
13784
13888
|
}
|
|
13785
13889
|
|
|
@@ -13940,6 +14044,8 @@
|
|
|
13940
14044
|
if (presentation.language === "javascript") return renderTraceOutput(presentation.text, entry.id + ":input", { label: "Code", language: "javascript" })
|
|
13941
14045
|
+ (presentation.extraInput ? renderTraceRawInputDetails(presentation.extraInput, entry.id + ":input") : "");
|
|
13942
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") : "");
|
|
13943
14049
|
if (toolName === "bash") return renderTraceCommandInput(entry, inputText, "Command");
|
|
13944
14050
|
if (toolName === "repl_send" || toolName === "studio_repl_send") return renderTraceCommandInput(entry, inputText, "Code");
|
|
13945
14051
|
const payload = parseTraceToolArgsObject(inputText);
|
|
@@ -14295,11 +14401,16 @@
|
|
|
14295
14401
|
const historyMeta = (context.mode === "history" || context.mode === "missing" || context.mode === "loading")
|
|
14296
14402
|
? getTraceHistoryContextLabel()
|
|
14297
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);
|
|
14298
14408
|
const toolbar = "<div class='trace-toolbar'>"
|
|
14299
14409
|
+ "<div class='trace-summary'>"
|
|
14300
|
-
+ "<span class='trace-summary-badge'>Working</span>"
|
|
14410
|
+
+ (steps ? "" : "<span class='trace-summary-badge'>Working</span>")
|
|
14301
14411
|
+ "<span class='trace-summary-status trace-status-" + escapeHtml(String(state.status || "idle")) + "'>" + escapeHtml(statusLabel) + "</span>"
|
|
14302
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>" : "")
|
|
14303
14414
|
+ (started ? ("<span class='trace-summary-meta'>Started " + escapeHtml(started) + "</span>") : "")
|
|
14304
14415
|
+ (context.summary && context.summary.truncated ? "<span class='trace-summary-meta'>Truncated</span>" : "")
|
|
14305
14416
|
+ (filterMeta ? ("<span class='trace-summary-meta'>" + escapeHtml(filterMeta) + "</span>") : "")
|
|
@@ -14317,6 +14428,7 @@
|
|
|
14317
14428
|
+ "</div>"
|
|
14318
14429
|
+ "</div>";
|
|
14319
14430
|
|
|
14431
|
+
const promptCard = steps && state.prompt ? renderTracePromptCard(state) : "";
|
|
14320
14432
|
if (!entries.length) {
|
|
14321
14433
|
const emptyMessage = context.mode === "loading"
|
|
14322
14434
|
? "Loading saved working for this response…"
|
|
@@ -14329,8 +14441,25 @@
|
|
|
14329
14441
|
: (state.status === "running"
|
|
14330
14442
|
? "Waiting for the first model or tool update…"
|
|
14331
14443
|
: "No live working view yet. Start a run or critique to watch working details here."))));
|
|
14332
|
-
return "<div class='trace-panel'>" + toolbar + "<div class='trace-
|
|
14333
|
-
|
|
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
|
+
};
|
|
14334
14463
|
|
|
14335
14464
|
const cards = entries.map((entry) => {
|
|
14336
14465
|
if (entry.type === "assistant") {
|
|
@@ -14348,15 +14477,12 @@
|
|
|
14348
14477
|
if (!sections.length) {
|
|
14349
14478
|
sections.push("<div class='trace-empty-inline'>Waiting for streamed content…</div>");
|
|
14350
14479
|
}
|
|
14351
|
-
return "
|
|
14352
|
-
|
|
14353
|
-
+ "<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>"
|
|
14354
14482
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14355
14483
|
+ renderTraceEntryStatus(state, entry.status, false)
|
|
14356
|
-
+ (entry.stopReason === "length" ? "<span class='trace-card-meta'>Cut off at the length limit</span>" : "")
|
|
14357
|
-
|
|
14358
|
-
+ sections.join("")
|
|
14359
|
-
+ "</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));
|
|
14360
14486
|
}
|
|
14361
14487
|
|
|
14362
14488
|
const title = entry.label || entry.toolName || "tool";
|
|
@@ -14369,20 +14495,37 @@
|
|
|
14369
14495
|
if (imageOutput) outputPieces.push(imageOutput);
|
|
14370
14496
|
const output = renderTraceSection("Output", entry.output, entry.id + ":output", outputPieces.length ? outputPieces.join("") : "<div class='trace-empty-inline'>No output yet.</div>",
|
|
14371
14497
|
{ imageCount: entry.images?.length || 0, isError: toolError, pending: entry.status === "streaming" || entry.status === "pending" });
|
|
14372
|
-
return "
|
|
14373
|
-
|
|
14374
|
-
+ "<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>"
|
|
14375
14500
|
+ "<span class='trace-card-title'>" + escapeHtml(title) + "</span>"
|
|
14376
14501
|
+ "<span class='trace-card-meta'>" + escapeHtml(formatReferenceTime(entry.updatedAt) || "live") + "</span>"
|
|
14377
14502
|
+ (formatTraceEntryDuration(entry) ? "<span class='trace-card-meta'>" + escapeHtml(formatTraceEntryDuration(entry)) + "</span>" : "")
|
|
14378
|
-
+ renderTraceEntryStatus(state, entry.status, toolError)
|
|
14379
|
-
+ "
|
|
14380
|
-
+ argsSummary
|
|
14381
|
-
+ output
|
|
14382
|
-
+ "</article>";
|
|
14503
|
+
+ renderTraceEntryStatus(state, entry.status, toolError),
|
|
14504
|
+
argsSummary + output, "");
|
|
14383
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
|
+
}
|
|
14384
14518
|
|
|
14385
|
-
|
|
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>";
|
|
14386
14529
|
}
|
|
14387
14530
|
|
|
14388
14531
|
const TRACE_RUN_STATUS_LABELS = { running: "Running", complete: "Finished", stopped: "Stopped", error: "Failed", idle: "Idle" };
|
|
@@ -14411,6 +14554,7 @@
|
|
|
14411
14554
|
} else {
|
|
14412
14555
|
critiqueViewEl.scrollTop = previousScrollTop;
|
|
14413
14556
|
}
|
|
14557
|
+
if (Math.abs(critiqueViewEl.scrollTop - previousScrollTop) >= 1) traceOwnScrollTop = critiqueViewEl.scrollTop;
|
|
14414
14558
|
scheduleResponsePaneRepaintNudge();
|
|
14415
14559
|
}
|
|
14416
14560
|
|
|
@@ -17429,6 +17573,7 @@
|
|
|
17429
17573
|
const current = () => !bufferPageClosed && client === bufferRecoveryClient && generation > 0 && generation === documentHostingGeneration
|
|
17430
17574
|
&& bufferId === client.snapshot().selectedBufferId && facts() === before && !studioModalBlocksDraftAction(decision);
|
|
17431
17575
|
documentHostingSaveResolutionBufferId = bufferId;
|
|
17576
|
+
documentHostingSaveResolutionOperationId = options.automaticOperationId || null; documentHostingSaveResolutionStartedAt = Date.now();
|
|
17432
17577
|
syncDocumentHostingReadiness();
|
|
17433
17578
|
documentHostingSaveResolution = (async () => {
|
|
17434
17579
|
try {
|
|
@@ -17506,10 +17651,19 @@
|
|
|
17506
17651
|
if (client.pendingHostingSaves().some(save => save.operationId === record.operationId) || !client.hostingAuthority(bufferId).ok) {
|
|
17507
17652
|
throw new Error("The saved baseline is kept locally, but recovery is not acknowledged. Keep this tab and recheck copies before closing.");
|
|
17508
17653
|
}
|
|
17509
|
-
|
|
17654
|
+
// A save Studio finished by itself is just a save (Oliver, 27 Oct); the longer wording stays for a resolved one.
|
|
17655
|
+
setStatus(options.automaticOperationId ? "Saved " + (basenameForStudioPath(record.path) || record.label || "the file") + "."
|
|
17656
|
+
: "Attached the saved baseline without replacing later typing. The disk file was not rewritten.", "success");
|
|
17510
17657
|
}
|
|
17511
17658
|
} catch (error) { setStatus(error.message || "The save outcome could not be resolved. Keep current work and recheck.", "warning"); }
|
|
17512
|
-
})().finally(() => {
|
|
17659
|
+
})().finally(() => {
|
|
17660
|
+
if (options.automaticOperationId) {
|
|
17661
|
+
studioOwnSaveAttemptsEnded.add(options.automaticOperationId);
|
|
17662
|
+
while (studioOwnSaveAttemptsEnded.size > 128) studioOwnSaveAttemptsEnded.delete(studioOwnSaveAttemptsEnded.values().next().value);
|
|
17663
|
+
}
|
|
17664
|
+
documentHostingSaveResolution = null; documentHostingSaveResolutionBufferId = null; documentHostingSaveResolutionOperationId = null;
|
|
17665
|
+
syncDocumentHostingReadiness(); renderStatus();
|
|
17666
|
+
});
|
|
17513
17667
|
return documentHostingSaveResolution;
|
|
17514
17668
|
}
|
|
17515
17669
|
function documentHostingMetadataIsIdle(bufferId) {
|
|
@@ -28081,7 +28235,7 @@
|
|
|
28081
28235
|
queueSteerBtn.disabled = true;
|
|
28082
28236
|
queueSteerBtn.classList.remove("request-stop-active");
|
|
28083
28237
|
queueSteerBtn.hidden = true;
|
|
28084
|
-
queueSteerBtn.title = "
|
|
28238
|
+
queueSteerBtn.title = "Steer is unavailable in editor-only mode.";
|
|
28085
28239
|
}
|
|
28086
28240
|
if (sendReplBtn) {
|
|
28087
28241
|
sendReplBtn.hidden = !showReplSend;
|
|
@@ -28151,9 +28305,9 @@
|
|
|
28151
28305
|
queueSteerBtn.classList.remove("request-stop-active");
|
|
28152
28306
|
queueSteerBtn.title = canQueueSteering
|
|
28153
28307
|
? (annotationsEnabled
|
|
28154
|
-
? "
|
|
28155
|
-
: "
|
|
28156
|
-
: "
|
|
28308
|
+
? "Steer the active run with the editor text. Pi adds it when the agent's current step ends, before its next model call. Shortcut: Cmd/Ctrl+Enter."
|
|
28309
|
+
: "Steer the active run with the editor text, without its [an: ...] markers. Pi adds it when the agent's current step ends, before its next model call. Shortcut: Cmd/Ctrl+Enter.")
|
|
28310
|
+
: "Steer is available while a Studio run is active.";
|
|
28157
28311
|
}
|
|
28158
28312
|
|
|
28159
28313
|
if (sendReplBtn) {
|
|
@@ -31330,7 +31484,7 @@
|
|
|
31330
31484
|
const requestId = beginUiAction("save_as");
|
|
31331
31485
|
if (!requestId) return false;
|
|
31332
31486
|
const operation = {
|
|
31333
|
-
kind: "save_as", ...(hosting ? { hosting } : {}),
|
|
31487
|
+
kind: "save_as", ...(hosting ? { hosting } : {}), startedAt: Date.now(),
|
|
31334
31488
|
sourceKey: getEditorDraftSourceKey(),
|
|
31335
31489
|
path: cleanPath,
|
|
31336
31490
|
content: String(content ?? ""),
|
|
@@ -31405,7 +31559,7 @@
|
|
|
31405
31559
|
const requestId = beginUiAction("save_over");
|
|
31406
31560
|
if (!requestId) return false;
|
|
31407
31561
|
const operation = {
|
|
31408
|
-
kind: "save_over", ...(settings.hosting ? { hosting: settings.hosting } : {}),
|
|
31562
|
+
kind: "save_over", ...(settings.hosting ? { hosting: settings.hosting } : {}), startedAt: Date.now(),
|
|
31409
31563
|
sourceKey: getEditorDraftSourceKey(),
|
|
31410
31564
|
path,
|
|
31411
31565
|
content: Object.prototype.hasOwnProperty.call(settings, "content")
|
|
@@ -31776,7 +31930,7 @@
|
|
|
31776
31930
|
return;
|
|
31777
31931
|
}
|
|
31778
31932
|
if (!studioRunChainActive) {
|
|
31779
|
-
setStatus("
|
|
31933
|
+
setStatus("Steer is only available while a Studio run is active.", "warning");
|
|
31780
31934
|
return;
|
|
31781
31935
|
}
|
|
31782
31936
|
|
|
@@ -32598,7 +32752,7 @@
|
|
|
32598
32752
|
return legacy.status === "unavailable" ? { ok: false, reason: "unavailable", message: "Legacy server recovery could not be checked." } : { ok: true, state: legacy.state };
|
|
32599
32753
|
},
|
|
32600
32754
|
// A tab Studio moved away from no longer owns the workspace; its issues don't apply.
|
|
32601
|
-
onIssue: (message) => { if (studioMovedAway) return; bufferRecoveryIssue = message; renderStatus(); },
|
|
32755
|
+
onIssue: (message, channels) => { if (studioMovedAway) return; bufferRecoveryIssue = message; bufferRecoveryIssueChannels = channels || null; renderStatus(); },
|
|
32602
32756
|
});
|
|
32603
32757
|
let client = createRecoveryClient();
|
|
32604
32758
|
try { promptRunIndicatorFresh = !recoveryStorage?.getItem("piStudio.bufferWorkspace.v2:" + studioTabStateId) && document.body.dataset.hostingResume !== "1"; } catch { promptRunIndicatorFresh = false; }
|
package/client/studio.css
CHANGED
|
@@ -7580,6 +7580,21 @@
|
|
|
7580
7580
|
/* Natural widths with a small gap (Oliver, trial48): the unselected label may shift a little on switching. */
|
|
7581
7581
|
body.studio-workspace-layout .studio-workspace-file-controls { min-width: 0; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
7582
7582
|
body.studio-workspace-layout .studio-workspace-filename { min-width: 0; max-width: min(180px, 35cqi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
|
|
7583
|
+
/* With View beside File, the name shortens before anything wraps (Oliver, 27 Oct). Its column can narrow to 4em, so
|
|
7584
|
+
row 1 wraps only when even that won't fit. Otherwise the controls take the rest of the row, and the name what's left
|
|
7585
|
+
of that, up to its cap. In a very narrow pane the controls wrap among themselves, as before. */
|
|
7586
|
+
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls {
|
|
7587
|
+
display: grid; grid-auto-flow: column; grid-template-columns: minmax(4em, max-content); grid-auto-columns: max-content;
|
|
7588
|
+
justify-content: end; justify-items: stretch; align-items: center; column-gap: 8px; flex: 1 1 0%; min-width: min-content;
|
|
7589
|
+
}
|
|
7590
|
+
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > :has(> .studio-workspace-filename) { min-width: 0; max-width: min(180px, 35cqi); }
|
|
7591
|
+
body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > * > .studio-workspace-filename { max-width: 100%; }
|
|
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). 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) {
|
|
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; }
|
|
7597
|
+
}
|
|
7583
7598
|
body.studio-workspace-layout .studio-refresh-toolbar-main { display: block; }
|
|
7584
7599
|
body.studio-workspace-layout .studio-refresh-toolbar-actions { gap: 0; min-width: 0; width: 100%; }
|
|
7585
7600
|
body.studio-workspace-layout .studio-refresh-toolbar-actions > .studio-refresh-action-line { min-width: 0; width: 100%; }
|
|
@@ -7660,6 +7675,35 @@
|
|
|
7660
7675
|
body.studio-workspace-layout .trace-kind-badge,
|
|
7661
7676
|
body.studio-workspace-layout .repl-journal-chip { border-radius: 0; padding-left: 0; padding-right: 0; }
|
|
7662
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
|
+
}
|
|
7663
7707
|
body.studio-workspace-layout .trace-filter-btn.is-active { color: var(--accent); }
|
|
7664
7708
|
body.studio-workspace-layout #scratchpadBtn.has-content:not(:disabled):hover,
|
|
7665
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,
|
|
@@ -13247,7 +13257,7 @@ ${cssVarsBlock}
|
|
|
13247
13257
|
<div class="source-actions">
|
|
13248
13258
|
<div class="source-actions-row">
|
|
13249
13259
|
<button id="sendRunBtn" type="button" title="Run editor text. If Studio loaded or staged an unchanged Pi terminal draft, clear that draft after Pi accepts the run. While a direct run is active, this button becomes Stop. Cmd/Ctrl+Enter queues steering from the current editor text. Stop the active request with Esc.">Run editor text</button>
|
|
13250
|
-
<button id="queueSteerBtn" type="button" title="
|
|
13260
|
+
<button id="queueSteerBtn" type="button" title="Steer is available while a Studio run is active." disabled>Steer</button>
|
|
13251
13261
|
</div>
|
|
13252
13262
|
<div class="source-actions-row repl-action-line" hidden>
|
|
13253
13263
|
<button id="sendReplBtn" type="button" hidden title="Send the current selection, or the full editor text, to the active REPL session shown in the right pane.">Send to REPL</button>
|
|
@@ -13591,7 +13601,7 @@ ${cssVarsBlock}
|
|
|
13591
13601
|
<div><dt>Cmd/Ctrl+S</dt><dd>Save editor when the disk revision still matches</dd></div>
|
|
13592
13602
|
<div><dt>Cmd/Ctrl+Shift+S</dt><dd>Save editor as a new file</dd></div>
|
|
13593
13603
|
<div><dt>Cmd/Ctrl+Shift+L</dt><dd>Load the current Pi terminal input draft without clearing it</dd></div>
|
|
13594
|
-
<div class="shortcuts-full-only"><dt>Cmd/Ctrl+Enter</dt><dd>Run editor text, or
|
|
13604
|
+
<div class="shortcuts-full-only"><dt>Cmd/Ctrl+Enter</dt><dd>Run editor text, or steer an active run</dd></div>
|
|
13595
13605
|
<div><dt>Option/Alt+Tab or Cmd/Ctrl+Shift+Space</dt><dd>Suggest a completion at the editor cursor</dd></div>
|
|
13596
13606
|
<div><dt>Tab</dt><dd>Insert a visible completion suggestion; otherwise indent selected editor text</dd></div>
|
|
13597
13607
|
<div><dt>Esc</dt><dd>Dismiss a visible completion suggestion, close overlays, exit pane focus, or stop an active request</dd></div>
|
|
@@ -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",
|
|
@@ -64,7 +64,7 @@ export function createStudioBufferClient(options) {
|
|
|
64
64
|
const issues = new Map();
|
|
65
65
|
function issue(channel, result) {
|
|
66
66
|
if (result) issues.set(channel, result.message || "Recovery is unavailable."); else issues.delete(channel);
|
|
67
|
-
options.onIssue?.([...issues.values()].join(" "));
|
|
67
|
+
options.onIssue?.([...issues.values()].join(" "), Object.fromEntries(issues));
|
|
68
68
|
}
|
|
69
69
|
function ack() {
|
|
70
70
|
try {
|