@blade-hq/agent-kit 0.5.26 → 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.
@@ -4,7 +4,7 @@ import { ComponentType, ReactNode } from 'react';
4
4
  import { C as ChatMessage, A as AskUserAnswerData, T as ToolCallInfo, M as MessageContent } from './AskUserQuestionBlock---kOTouk.js';
5
5
  import * as zustand from 'zustand';
6
6
  import { M as ModeId, a as SessionInfo, b as SessionStatus } from './session-B5v5KkVd.js';
7
- import { v as BladeClient } from './blade-client-DA2h2P5I.js';
7
+ import { v as BladeClient } from './blade-client-DoodJJDz.js';
8
8
  import { C as ContentBlock } from './projection-BWYEFYNn.js';
9
9
 
10
10
  /**
@@ -1577,6 +1577,34 @@ declare namespace AgentBoardBoardTaskChangedPayloadSchema {
1577
1577
  }
1578
1578
  }
1579
1579
  type AgentBoardBoardTaskChangedPayload = AgentBoardBoardTaskChangedPayloadSchema.AgentBoardBoardTaskChangedPayload;
1580
+ declare namespace AgentBoardFileOpPayloadSchema {
1581
+ type ProjectId = number;
1582
+ type SessionId = string;
1583
+ type ToolCallId = (string | null);
1584
+ type Action = string;
1585
+ type FilePath = string;
1586
+ type Description = (string | null);
1587
+ type ContentPreview = (string | null);
1588
+ type FinalContent = (string | null);
1589
+ type ContentDelta = (boolean | null);
1590
+ type IsFinal = (boolean | null);
1591
+ type CreatedAt = string;
1592
+ interface AgentBoardFileOpPayload {
1593
+ project_id: ProjectId;
1594
+ session_id: SessionId;
1595
+ tool_call_id?: ToolCallId;
1596
+ action: Action;
1597
+ file_path: FilePath;
1598
+ description?: Description;
1599
+ content_preview?: ContentPreview;
1600
+ final_content?: FinalContent;
1601
+ content_delta?: ContentDelta;
1602
+ is_final?: IsFinal;
1603
+ created_at: CreatedAt;
1604
+ [k: string]: unknown;
1605
+ }
1606
+ }
1607
+ type AgentBoardFileOpPayload = AgentBoardFileOpPayloadSchema.AgentBoardFileOpPayload;
1580
1608
  declare namespace ChatStopAckSchema {
1581
1609
  type Status = string;
1582
1610
  type Message = (string | null);
@@ -1645,6 +1673,7 @@ interface ServerToClientEvents {
1645
1673
  "vibe:logs:end": (payload: VibeLogsEndPayload) => void;
1646
1674
  "replay:input_mismatch": (payload: unknown) => void;
1647
1675
  "agent-board:board-task:changed": (payload: AgentBoardBoardTaskChangedPayload) => void;
1676
+ "agent-board:file-op": (payload: AgentBoardFileOpPayload) => void;
1648
1677
  }
1649
1678
 
1650
1679
  type TypedSocket = Socket<ServerToClientEvents, ClientToServerEvents>;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSessionStore
3
- } from "./chunk-UNO53NPU.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-6L6JFSR5.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) {
@@ -2810,6 +2821,12 @@ var AgentSocket = class {
2810
2821
  this.socket.off("agent-board:board-task:changed", handler);
2811
2822
  };
2812
2823
  }
2824
+ onAgentBoardFileOp(handler) {
2825
+ this.socket.on("agent-board:file-op", handler);
2826
+ return () => {
2827
+ this.socket.off("agent-board:file-op", handler);
2828
+ };
2829
+ }
2813
2830
  unsubscribe() {
2814
2831
  const previousSessionId = this.subscribedSession;
2815
2832
  if (previousSessionId) {
@@ -2876,6 +2893,22 @@ var AgentSocket = class {
2876
2893
  this.pendingJoins.set(sessionId, join);
2877
2894
  return join;
2878
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
+ }
2879
2912
  _shouldWaitForJoinBeforeSend(sessionId) {
2880
2913
  return this.subscribedSession === sessionId || this.joinedSessions.has(sessionId) || this.pendingJoins.has(sessionId) || this.requestedJoins.has(sessionId);
2881
2914
  }
@@ -3228,4 +3261,4 @@ export {
3228
3261
  bootstrapBladeClient,
3229
3262
  getBootstrappedClient
3230
3263
  };
3231
- //# sourceMappingURL=chunk-UNO53NPU.js.map
3264
+ //# sourceMappingURL=chunk-JWHBUVSM.js.map