@blade-hq/agent-kit 0.5.30 → 0.5.32

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.
@@ -905,7 +905,11 @@ function upsertArtifactState(state, target, options) {
905
905
  const targetKey = target.key ?? target.title;
906
906
  const applyUiState = (partial) => ({
907
907
  ...partial,
908
- ...reveal ? { rightPanelCollapsed: false, activeRightTab: "preview" } : {}
908
+ ...reveal ? {
909
+ rightPanelCollapsed: false,
910
+ activeRightTab: "preview",
911
+ rightTabActivationId: state.rightTabActivationId + 1
912
+ } : {}
909
913
  });
910
914
  const existing = state.artifacts.findIndex((artifact) => targetKey && (artifact.key ?? artifact.title) === targetKey);
911
915
  if (existing >= 0) {
@@ -929,6 +933,7 @@ var useUiStore = create2()((set) => ({
929
933
  leftPanelCollapsed: false,
930
934
  rightPanelCollapsed: false,
931
935
  activeRightTab: "situation",
936
+ rightTabActivationId: 0,
932
937
  artifacts: [],
933
938
  activeArtifactIndex: -1,
934
939
  theme: storedTheme,
@@ -938,7 +943,10 @@ var useUiStore = create2()((set) => ({
938
943
  setRightPanelCollapsed: (collapsed) => set({ rightPanelCollapsed: collapsed }),
939
944
  toggleLeftPanel: () => set((s) => ({ leftPanelCollapsed: !s.leftPanelCollapsed })),
940
945
  toggleRightPanel: () => set((s) => ({ rightPanelCollapsed: !s.rightPanelCollapsed })),
941
- setActiveRightTab: (tab) => set({ activeRightTab: tab }),
946
+ setActiveRightTab: (tab) => set((state) => ({
947
+ activeRightTab: tab,
948
+ rightTabActivationId: state.rightTabActivationId + 1
949
+ })),
942
950
  pushArtifact: (target) => set((state) => upsertArtifactState(state, target)),
943
951
  upsertArtifact: (target, options) => set((state) => upsertArtifactState(state, target, options)),
944
952
  setActiveArtifact: (index) => set({ activeArtifactIndex: index }),
@@ -949,7 +957,7 @@ var useUiStore = create2()((set) => ({
949
957
  return removeArtifactAtIndex(state, index);
950
958
  }),
951
959
  clearArtifacts: () => set({ artifacts: [], activeArtifactIndex: -1 }),
952
- setPreviewTarget: (target) => set(() => {
960
+ setPreviewTarget: (target) => set((state) => {
953
961
  if (target === null) {
954
962
  return { artifacts: [], activeArtifactIndex: -1 };
955
963
  }
@@ -957,7 +965,8 @@ var useUiStore = create2()((set) => ({
957
965
  artifacts: [target],
958
966
  activeArtifactIndex: 0,
959
967
  rightPanelCollapsed: false,
960
- activeRightTab: "preview"
968
+ activeRightTab: "preview",
969
+ rightTabActivationId: state.rightTabActivationId + 1
961
970
  };
962
971
  }),
963
972
  setTheme: (theme) => {
@@ -1271,7 +1280,7 @@ var useChatStore = create3()((set) => ({
1271
1280
  turn_id: turnId,
1272
1281
  loop_id: "root",
1273
1282
  role: "user",
1274
- status: "completed",
1283
+ status: "streaming",
1275
1284
  blocks: [{ type: "text", content }],
1276
1285
  tool_calls: [],
1277
1286
  model: null,
@@ -1286,7 +1295,10 @@ var useChatStore = create3()((set) => ({
1286
1295
  },
1287
1296
  upsertTurn: (sessionId, turn) => {
1288
1297
  set((state) => {
1289
- const existing = [...state.turns[sessionId] ?? []];
1298
+ let existing = [...state.turns[sessionId] ?? []];
1299
+ if (turn.role === "user" && !turn.turn_id.startsWith("local-user-")) {
1300
+ existing = existing.filter((t) => !t.turn_id.startsWith("local-user-"));
1301
+ }
1290
1302
  const index = existing.findIndex((item) => item.turn_id === turn.turn_id);
1291
1303
  if (index >= 0) {
1292
1304
  existing[index] = turn;
@@ -2105,19 +2117,6 @@ function invalidateFileTree(sessionId) {
2105
2117
  if (!queryClient) return;
2106
2118
  void queryClient.invalidateQueries({ queryKey: ["file-tree", sessionId] });
2107
2119
  }
2108
- function shouldSuppressOptimisticUserMessage(sessionId, askuserAnswer) {
2109
- if (askuserAnswer && typeof askuserAnswer.tool_call_id === "string") {
2110
- return true;
2111
- }
2112
- const session = useSessionStore.getState().sessions.find((item) => item.id === sessionId);
2113
- if (session?.status !== "waiting_for_input") {
2114
- return false;
2115
- }
2116
- const messages = useChatStore.getState().messages[sessionId] ?? [];
2117
- return messages.some(
2118
- (message) => (message.tool_calls ?? []).some((toolCall) => toolCall.status === "awaiting_answer")
2119
- );
2120
- }
2121
2120
  function invalidateSkillStats2(sessionId) {
2122
2121
  const queryClient = globalThis.__agentQueryClient;
2123
2122
  if (!queryClient) return;
@@ -2914,11 +2913,7 @@ var AgentSocket = class {
2914
2913
  }
2915
2914
  send(sessionId, message, mode, askuserAnswer, extras) {
2916
2915
  this._ensureConnected();
2917
- const suppressOptimisticUserMessage = shouldSuppressOptimisticUserMessage(
2918
- sessionId,
2919
- askuserAnswer
2920
- );
2921
- if (!suppressOptimisticUserMessage) {
2916
+ if (!(askuserAnswer && typeof askuserAnswer.tool_call_id === "string")) {
2922
2917
  useChatStore.getState().addUserMessage(sessionId, message);
2923
2918
  }
2924
2919
  useChatStore.getState().setStreaming(sessionId, true);
@@ -2930,14 +2925,12 @@ var AgentSocket = class {
2930
2925
  [tool_call_id]: rest
2931
2926
  });
2932
2927
  }
2933
- if (!suppressOptimisticUserMessage) {
2934
- useRuntimeStore.getState().addEvent(sessionId, {
2935
- type: "chat:start",
2936
- title: "User prompt sent",
2937
- status: "running",
2938
- detail: contentPreview(message)
2939
- });
2940
- }
2928
+ useRuntimeStore.getState().addEvent(sessionId, {
2929
+ type: "chat:start",
2930
+ title: "User prompt sent",
2931
+ status: "running",
2932
+ detail: contentPreview(message)
2933
+ });
2941
2934
  if (!extras?.replay_decision) {
2942
2935
  this.pendingReplayMessages.set(sessionId, message);
2943
2936
  this.pendingReplayModes.set(sessionId, mode);
@@ -3261,4 +3254,4 @@ export {
3261
3254
  bootstrapBladeClient,
3262
3255
  getBootstrappedClient
3263
3256
  };
3264
- //# sourceMappingURL=chunk-JWHBUVSM.js.map
3257
+ //# sourceMappingURL=chunk-QMOW3TDA.js.map