@letta-ai/letta-agent-sdk 0.7.2 → 0.7.3

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.
@@ -8807,6 +8807,7 @@ class RemoteTurnCoordinator {
8807
8807
  runIds: new Set,
8808
8808
  observedTurnEvidence: false,
8809
8809
  observedRequiresApprovalStop: false,
8810
+ pendingTerminal: null,
8810
8811
  abortRequested: false,
8811
8812
  timeout: null
8812
8813
  };
@@ -9026,6 +9027,8 @@ class RemoteTurnCoordinator {
9026
9027
  return;
9027
9028
  }
9028
9029
  if (status === "WAITING_ON_INPUT" && active.observedTurnEvidence) {
9030
+ if (active.pendingTerminal)
9031
+ return;
9029
9032
  this.completeActiveTurn({
9030
9033
  runtime: active.runtime,
9031
9034
  stopReason: null,
@@ -9056,14 +9059,19 @@ class RemoteTurnCoordinator {
9056
9059
  }
9057
9060
  const errorCode = toSdkErrorCode(finished.stopReason);
9058
9061
  const success = !isFailureStopReason(finished.stopReason);
9059
- this.completeActiveTurn({
9062
+ const terminal = {
9060
9063
  runtime: active.runtime,
9061
9064
  stopReason: finished.stopReason,
9062
9065
  runIds: [...active.runIds],
9063
9066
  success,
9064
9067
  ...success ? {} : { errorCode: errorCode ?? "error" },
9065
9068
  ...finished.error ? { detail: finished.error } : {}
9066
- });
9069
+ };
9070
+ if (active.pendingTerminal) {
9071
+ active.pendingTerminal = terminal;
9072
+ return;
9073
+ }
9074
+ this.completeActiveTurn(terminal);
9067
9075
  }
9068
9076
  handleTurnTerminalDelta(delta, sdkMessage) {
9069
9077
  const active = this.activeTurn;
@@ -9076,11 +9084,15 @@ class RemoteTurnCoordinator {
9076
9084
  active.observedRequiresApprovalStop = true;
9077
9085
  return;
9078
9086
  }
9079
- this.completeActiveTurn({
9087
+ active.pendingTerminal = {
9080
9088
  runtime: active.runtime,
9081
9089
  stopReason,
9082
9090
  runIds: [...active.runIds]
9083
- });
9091
+ };
9092
+ return;
9093
+ }
9094
+ if (messageType === "usage_statistics" && active.pendingTerminal) {
9095
+ this.completeActiveTurn(active.pendingTerminal);
9084
9096
  return;
9085
9097
  }
9086
9098
  if (sdkMessage?.type === "error") {
@@ -12722,4 +12734,4 @@ export {
12722
12734
  CloudManagedSandboxExpiredError
12723
12735
  };
12724
12736
 
12725
- //# debugId=306AFAA371490E4864756E2164756E21
12737
+ //# debugId=CEC217A9F57A79F564756E2164756E21