pi-studio 0.9.22 → 0.9.23

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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to `pi-studio` are documented here.
4
4
 
5
+ ## [0.9.23] — 2026-05-31
6
+
7
+ ### Changed
8
+ - Studio now treats Pi `/tree` navigation as an explicit response-history sync: it preserves the selected response only when that response still exists on the new branch, otherwise selects the latest response on the current branch and shows a status note that editor text was left unchanged.
9
+
5
10
  ## [0.9.22] — 2026-05-29
6
11
 
7
12
  ### Added
@@ -18451,9 +18451,10 @@
18451
18451
  }
18452
18452
 
18453
18453
  if (message.type === "response_history") {
18454
+ const isTreeSync = message.reason === "tree";
18454
18455
  setResponseHistory(message.items, {
18455
- autoSelectLatest: followLatest,
18456
- preserveSelection: !followLatest,
18456
+ autoSelectLatest: isTreeSync ? true : followLatest,
18457
+ preserveSelection: isTreeSync ? true : !followLatest,
18457
18458
  silent: true,
18458
18459
  });
18459
18460
  return;
package/index.ts CHANGED
@@ -10935,10 +10935,11 @@ export default function (pi: ExtensionAPI) {
10935
10935
  };
10936
10936
  };
10937
10937
 
10938
- const broadcastResponseHistory = () => {
10938
+ const broadcastResponseHistory = (extra?: Record<string, unknown>) => {
10939
10939
  broadcast({
10940
10940
  type: "response_history",
10941
10941
  items: studioResponseHistory,
10942
+ ...(extra ?? {}),
10942
10943
  });
10943
10944
  };
10944
10945
 
@@ -13841,13 +13842,32 @@ export default function (pi: ExtensionAPI) {
13841
13842
  });
13842
13843
 
13843
13844
 
13844
- pi.on("session_tree", async (_event, ctx) => {
13845
+ pi.on("session_tree", async (event, ctx) => {
13845
13846
  latestModelRequestCtx = ctx;
13846
- hydrateLatestAssistant(ctx.sessionManager.getBranch());
13847
+ const branchEntries = ctx.sessionManager.getBranch();
13848
+ hydrateLatestAssistant(branchEntries);
13847
13849
  refreshRuntimeMetadata({ cwd: ctx.cwd, model: ctx.model });
13848
13850
  refreshContextUsage(ctx);
13849
- broadcastResponseHistory();
13851
+ emitDebugEvent("session_tree", {
13852
+ oldLeafId: event.oldLeafId ?? null,
13853
+ newLeafId: event.newLeafId ?? null,
13854
+ branchEntryCount: branchEntries.length,
13855
+ responseHistoryCount: studioResponseHistory.length,
13856
+ });
13857
+ broadcastResponseHistory({
13858
+ reason: "tree",
13859
+ oldLeafId: event.oldLeafId ?? null,
13860
+ newLeafId: event.newLeafId ?? null,
13861
+ responseHistoryCount: studioResponseHistory.length,
13862
+ });
13850
13863
  broadcastState();
13864
+ broadcast({
13865
+ type: "info",
13866
+ level: "info",
13867
+ message: studioResponseHistory.length > 0
13868
+ ? "Pi session tree changed; Studio response history now follows the current branch. Editor text was left unchanged."
13869
+ : "Pi session tree changed; this branch has no assistant responses yet. Editor text was left unchanged.",
13870
+ });
13851
13871
  });
13852
13872
 
13853
13873
  pi.on("model_select", async (event, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.9.22",
3
+ "version": "0.9.23",
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",