@blade-hq/agent-kit 0.5.27 → 0.5.28

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSessionStore
3
- } from "./chunk-OF7ZBBTH.js";
3
+ } from "./chunk-JWHBUVSM.js";
4
4
 
5
5
  // src/react/hooks/use-session.ts
6
6
  function useSession() {
@@ -27,4 +27,4 @@ function useSession() {
27
27
  export {
28
28
  useSession
29
29
  };
30
- //# sourceMappingURL=chunk-CDL6Y4W7.js.map
30
+ //# sourceMappingURL=chunk-EP5LVNO3.js.map
@@ -2400,11 +2400,19 @@ var AgentSocket = class {
2400
2400
  s.on("turn:start", (data) => {
2401
2401
  const sessionId = this._resolveSessionId(data);
2402
2402
  if (!sessionId) return;
2403
+ if (!useChatStore.getState().isStreaming[sessionId]) {
2404
+ useSessionStore.getState().updateSessionStatus(sessionId, "running");
2405
+ useChatStore.getState().setStreaming(sessionId, true);
2406
+ }
2403
2407
  applyTurn(sessionId, data);
2404
2408
  });
2405
2409
  s.on("turn:patch", (data) => {
2406
2410
  const sessionId = this._resolveSessionId(data);
2407
2411
  if (!sessionId) return;
2412
+ if (!useChatStore.getState().isStreaming[sessionId]) {
2413
+ useSessionStore.getState().updateSessionStatus(sessionId, "running");
2414
+ useChatStore.getState().setStreaming(sessionId, true);
2415
+ }
2408
2416
  if (data.data.workspace_changed) {
2409
2417
  notifyWorkspaceFilesChanged(sessionId);
2410
2418
  }
@@ -2795,6 +2803,9 @@ var AgentSocket = class {
2795
2803
  useUiStore.getState().clearArtifacts();
2796
2804
  useCardStateStore.getState().clearAllStates();
2797
2805
  }
2806
+ if (this.joinedSessions.has(sessionId)) {
2807
+ this._refreshRunningState(sessionId);
2808
+ }
2798
2809
  void this._ensureJoined(sessionId);
2799
2810
  }
2800
2811
  subscribeAgentBoardProject(projectId) {
@@ -2882,6 +2893,22 @@ var AgentSocket = class {
2882
2893
  this.pendingJoins.set(sessionId, join);
2883
2894
  return join;
2884
2895
  }
2896
+ _refreshRunningState(sessionId) {
2897
+ this.socket.timeout(5e3).emit(
2898
+ "session:subscribe",
2899
+ { session_id: sessionId },
2900
+ (err, response) => {
2901
+ if (err || !response) return;
2902
+ if (response.is_running) {
2903
+ useSessionStore.getState().updateSessionStatus(sessionId, "running");
2904
+ useChatStore.getState().setStreaming(sessionId, true);
2905
+ } else if (useChatStore.getState().isStreaming[sessionId]) {
2906
+ useChatStore.getState().setStreaming(sessionId, false);
2907
+ void this._syncSessionTurnsFromHistory(sessionId);
2908
+ }
2909
+ }
2910
+ );
2911
+ }
2885
2912
  _shouldWaitForJoinBeforeSend(sessionId) {
2886
2913
  return this.subscribedSession === sessionId || this.joinedSessions.has(sessionId) || this.pendingJoins.has(sessionId) || this.requestedJoins.has(sessionId);
2887
2914
  }
@@ -3234,4 +3261,4 @@ export {
3234
3261
  bootstrapBladeClient,
3235
3262
  getBootstrappedClient
3236
3263
  };
3237
- //# sourceMappingURL=chunk-OF7ZBBTH.js.map
3264
+ //# sourceMappingURL=chunk-JWHBUVSM.js.map