pi-sdk-web 0.5.7 → 0.5.8

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.
@@ -879,6 +879,11 @@ class PiWebClient {
879
879
  // ------------------------------------------------------------------
880
880
 
881
881
  renderEvent(ev) {
882
+ // Capture stickiness BEFORE the handler mutates the DOM: updates that
883
+ // grow content (message_update, tool deltas) increase scrollHeight, so
884
+ // checking wasAtBottom() after the fact would miss "user was already at
885
+ // the bottom" and stop following the stream.
886
+ const wasAtBottom = this.wasAtBottom();
882
887
  switch (ev.type) {
883
888
  case 'agent_start':
884
889
  this.status.working++;
@@ -964,9 +969,9 @@ class PiWebClient {
964
969
  default:
965
970
  break;
966
971
  }
967
- // Only auto-scroll when the user is already at the bottom (reading
968
- // history must not be yanked down by incoming events).
969
- if (this.wasAtBottom()) this.scrollToBottom();
972
+ // Auto-scroll only if the user was at the bottom before the event
973
+ // (reading history must not be yanked down by incoming events).
974
+ if (wasAtBottom) this.scrollToBottom();
970
975
  }
971
976
 
972
977
  onMessageStart(message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-sdk-web",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Browser Web access for Pi (AI coding agent) via the Pi SDK - standalone module, zero modification to Pi itself",
5
5
  "type": "module",
6
6
  "bin": {