@springbrand/chat-client 0.1.3-alpha.42 → 0.1.3-alpha.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springbrand/chat-client",
3
- "version": "0.1.3-alpha.42",
3
+ "version": "0.1.3-alpha.43",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -27,7 +27,7 @@
27
27
  "@types/react-dom": "^19.2.5",
28
28
  "react-dom": "^19.2.8",
29
29
  "typescript": "^7.0.2",
30
- "@springbrand/agent-runtime": "0.2.0-alpha.54"
30
+ "@springbrand/agent-runtime": "0.2.0-alpha.56"
31
31
  },
32
32
  "scripts": {
33
33
  "typecheck": "tsc --noEmit"
@@ -494,7 +494,7 @@ export function useUniversalAgentChat(): ChatRuntime {
494
494
  () => mergeOptimisticMessages(messages, optimisticMessages),
495
495
  [messages, optimisticMessages],
496
496
  );
497
- const authoritativeTurn = facetState?.turn;
497
+ const reportedTurn = facetState?.turn;
498
498
  const stoppedByUser = error?.message === USER_STOP_REASON;
499
499
  const latestMessage = visibleMessages.at(-1);
500
500
  const latestTurnStatus = latestMessage?.role === "assistant"
@@ -504,6 +504,18 @@ export function useUniversalAgentChat(): ChatRuntime {
504
504
  latestTurnStatus === "error" ||
505
505
  latestTurnStatus === "aborted" ||
506
506
  latestTurnStatus === "skipped";
507
+ // Messages and Agent state arrive in separate frames. A terminal message for
508
+ // the same Submission is newer than a still-active state projection; a
509
+ // different active ID belongs to the next Turn and must remain live.
510
+ const authoritativeTurn = reportedTurn &&
511
+ hasTerminalMessage &&
512
+ latestMessage?.metadata?.turnId === reportedTurn.activeSubmissionId
513
+ ? {
514
+ steerable: false,
515
+ hasPendingSteer: false,
516
+ queued: reportedTurn.queued,
517
+ }
518
+ : reportedTurn;
507
519
  const normalizedSdkStatus = sdkStatus === "error" &&
508
520
  (stoppedByUser || hasTerminalMessage)
509
521
  ? "ready"