pi-studio 0.5.18 → 0.5.19

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/index.ts +29 -5
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.19] — 2026-03-19
8
+
9
+ ### Fixed
10
+ - Studio now waits until `agent_end` before emitting the terminal/cmux “response ready” notification for completed requests, and it keeps the cmux `running…` status pill visible until that same turn fully finishes.
11
+
7
12
  ## [0.5.18] — 2026-03-17
8
13
 
9
14
  ### Fixed
package/index.ts CHANGED
@@ -2952,6 +2952,7 @@ export default function (pi: ExtensionAPI) {
2952
2952
  let lastCommandCtx: ExtensionCommandContext | null = null;
2953
2953
  let lastThemeVarsJson = "";
2954
2954
  let suppressedStudioResponse: { requestId: string; kind: StudioRequestKind } | null = null;
2955
+ let pendingStudioCompletionKind: StudioRequestKind | null = null;
2955
2956
  let agentBusy = false;
2956
2957
  let terminalActivityPhase: TerminalActivityPhase = "idle";
2957
2958
  let terminalActivityToolName: string | null = null;
@@ -3150,7 +3151,7 @@ export default function (pi: ExtensionAPI) {
3150
3151
  if (!shouldUseCmuxTerminalIntegration()) return;
3151
3152
  const workspaceArgs = getCmuxWorkspaceArgs();
3152
3153
  const statusColor = getCmuxStudioStatusColor();
3153
- if (activeRequest) {
3154
+ if (activeRequest || (pendingStudioCompletionKind && agentBusy)) {
3154
3155
  runCmuxCommand([
3155
3156
  "set-status",
3156
3157
  CMUX_STUDIO_STATUS_KEY,
@@ -3269,6 +3270,23 @@ export default function (pi: ExtensionAPI) {
3269
3270
  return "Studio: response ready.";
3270
3271
  };
3271
3272
 
3273
+ const clearPendingStudioCompletion = () => {
3274
+ if (!pendingStudioCompletionKind) return;
3275
+ pendingStudioCompletionKind = null;
3276
+ syncCmuxStudioStatus();
3277
+ };
3278
+
3279
+ const flushPendingStudioCompletionNotification = () => {
3280
+ if (!pendingStudioCompletionKind) return;
3281
+ const kind = pendingStudioCompletionKind;
3282
+ pendingStudioCompletionKind = null;
3283
+ syncCmuxStudioStatus();
3284
+ const message = getStudioRequestCompletionNotification(kind);
3285
+ emitDebugEvent("studio_completion_notification", { kind });
3286
+ notifyStudio(message, "info");
3287
+ notifyStudioTerminal(message, "info");
3288
+ };
3289
+
3272
3290
  const refreshContextUsage = (
3273
3291
  ctx?: { getContextUsage(): { tokens: number | null; contextWindow: number; percent: number | null } | undefined },
3274
3292
  ): StudioContextUsageSnapshot => {
@@ -4418,6 +4436,7 @@ export default function (pi: ExtensionAPI) {
4418
4436
  const stopServer = async () => {
4419
4437
  if (!serverState) return;
4420
4438
  clearActiveRequest();
4439
+ clearPendingStudioCompletion();
4421
4440
  clearCompactionState();
4422
4441
  closeAllClients(1001, "Server shutting down");
4423
4442
 
@@ -4449,6 +4468,7 @@ export default function (pi: ExtensionAPI) {
4449
4468
  hydrateLatestAssistant(ctx.sessionManager.getBranch());
4450
4469
  clearCompactionState();
4451
4470
  agentBusy = false;
4471
+ clearPendingStudioCompletion();
4452
4472
  refreshRuntimeMetadata({ cwd: ctx.cwd, model: ctx.model });
4453
4473
  refreshContextUsage(ctx);
4454
4474
  emitDebugEvent("session_start", {
@@ -4467,6 +4487,7 @@ export default function (pi: ExtensionAPI) {
4467
4487
  lastCommandCtx = null;
4468
4488
  hydrateLatestAssistant(ctx.sessionManager.getBranch());
4469
4489
  agentBusy = false;
4490
+ clearPendingStudioCompletion();
4470
4491
  refreshRuntimeMetadata({ cwd: ctx.cwd, model: ctx.model });
4471
4492
  refreshContextUsage(ctx);
4472
4493
  emitDebugEvent("session_switch", {
@@ -4627,10 +4648,8 @@ export default function (pi: ExtensionAPI) {
4627
4648
  responseHistory: studioResponseHistory,
4628
4649
  });
4629
4650
  broadcastResponseHistory();
4630
- clearActiveRequest({
4631
- terminalNotify: getStudioRequestCompletionNotification(kind),
4632
- terminalNotifyLevel: "info",
4633
- });
4651
+ pendingStudioCompletionKind = kind;
4652
+ clearActiveRequest();
4634
4653
  return;
4635
4654
  }
4636
4655
 
@@ -4667,6 +4686,7 @@ export default function (pi: ExtensionAPI) {
4667
4686
  activeRequestKind: activeRequest?.kind ?? null,
4668
4687
  suppressedRequestId: suppressedStudioResponse?.requestId ?? null,
4669
4688
  suppressedRequestKind: suppressedStudioResponse?.kind ?? null,
4689
+ pendingCompletionKind: pendingStudioCompletionKind,
4670
4690
  });
4671
4691
  setTerminalActivity("idle");
4672
4692
  if (activeRequest) {
@@ -4677,6 +4697,9 @@ export default function (pi: ExtensionAPI) {
4677
4697
  message: "Request ended without a complete assistant response.",
4678
4698
  });
4679
4699
  clearActiveRequest();
4700
+ clearPendingStudioCompletion();
4701
+ } else {
4702
+ flushPendingStudioCompletionNotification();
4680
4703
  }
4681
4704
  suppressedStudioResponse = null;
4682
4705
  });
@@ -4684,6 +4707,7 @@ export default function (pi: ExtensionAPI) {
4684
4707
  pi.on("session_shutdown", async () => {
4685
4708
  lastCommandCtx = null;
4686
4709
  agentBusy = false;
4710
+ clearPendingStudioCompletion();
4687
4711
  clearCompactionState();
4688
4712
  setTerminalActivity("idle");
4689
4713
  await stopServer();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.5.18",
3
+ "version": "0.5.19",
4
4
  "description": "Browser GUI for structured critique workflows in pi",
5
5
  "type": "module",
6
6
  "license": "MIT",