@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.
package/dist/index.js CHANGED
@@ -8828,6 +8828,7 @@ class RemoteTurnCoordinator {
8828
8828
  runIds: new Set,
8829
8829
  observedTurnEvidence: false,
8830
8830
  observedRequiresApprovalStop: false,
8831
+ pendingTerminal: null,
8831
8832
  abortRequested: false,
8832
8833
  timeout: null
8833
8834
  };
@@ -9047,6 +9048,8 @@ class RemoteTurnCoordinator {
9047
9048
  return;
9048
9049
  }
9049
9050
  if (status === "WAITING_ON_INPUT" && active.observedTurnEvidence) {
9051
+ if (active.pendingTerminal)
9052
+ return;
9050
9053
  this.completeActiveTurn({
9051
9054
  runtime: active.runtime,
9052
9055
  stopReason: null,
@@ -9077,14 +9080,19 @@ class RemoteTurnCoordinator {
9077
9080
  }
9078
9081
  const errorCode = toSdkErrorCode(finished.stopReason);
9079
9082
  const success = !isFailureStopReason(finished.stopReason);
9080
- this.completeActiveTurn({
9083
+ const terminal = {
9081
9084
  runtime: active.runtime,
9082
9085
  stopReason: finished.stopReason,
9083
9086
  runIds: [...active.runIds],
9084
9087
  success,
9085
9088
  ...success ? {} : { errorCode: errorCode ?? "error" },
9086
9089
  ...finished.error ? { detail: finished.error } : {}
9087
- });
9090
+ };
9091
+ if (active.pendingTerminal) {
9092
+ active.pendingTerminal = terminal;
9093
+ return;
9094
+ }
9095
+ this.completeActiveTurn(terminal);
9088
9096
  }
9089
9097
  handleTurnTerminalDelta(delta, sdkMessage) {
9090
9098
  const active = this.activeTurn;
@@ -9097,11 +9105,15 @@ class RemoteTurnCoordinator {
9097
9105
  active.observedRequiresApprovalStop = true;
9098
9106
  return;
9099
9107
  }
9100
- this.completeActiveTurn({
9108
+ active.pendingTerminal = {
9101
9109
  runtime: active.runtime,
9102
9110
  stopReason,
9103
9111
  runIds: [...active.runIds]
9104
- });
9112
+ };
9113
+ return;
9114
+ }
9115
+ if (messageType === "usage_statistics" && active.pendingTerminal) {
9116
+ this.completeActiveTurn(active.pendingTerminal);
9105
9117
  return;
9106
9118
  }
9107
9119
  if (sdkMessage?.type === "error") {
@@ -30382,4 +30394,4 @@ export {
30382
30394
  CloudManagedSandboxExpiredError
30383
30395
  };
30384
30396
 
30385
- //# debugId=DA5298CCD75BD69B64756E2164756E21
30397
+ //# debugId=E62F1B83D37B8D6A64756E2164756E21