@tanstack/ai 0.47.1 → 0.47.2
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.
|
@@ -328,7 +328,8 @@ var TextEngine = class {
|
|
|
328
328
|
}
|
|
329
329
|
if ((yield* this.checkForPendingToolCalls()) === "wait") return;
|
|
330
330
|
if (!(!!this.finalStructuredOutput && this.tools.length === 0 && this.finalStructuredOutput.nativeCombined !== true)) do {
|
|
331
|
-
if (this.earlyTermination
|
|
331
|
+
if (this.earlyTermination) break;
|
|
332
|
+
if (this.isCancelled()) return;
|
|
332
333
|
this.logger.agentLoop(`iteration=${this.middlewareCtx.iteration}`, { iteration: this.middlewareCtx.iteration });
|
|
333
334
|
await this.beginCycle();
|
|
334
335
|
if (this.cyclePhase === "processText") {
|
|
@@ -342,6 +343,7 @@ var TextEngine = class {
|
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
344
345
|
yield* this.streamModelResponse();
|
|
346
|
+
if (this.earlyTermination) break;
|
|
345
347
|
if (yield* this.emitBoundaryInterrupts("afterModel", this.finishedEvent ?? this.createSyntheticFinishedEvent())) {
|
|
346
348
|
this.setToolPhase("wait");
|
|
347
349
|
return;
|
|
@@ -673,8 +675,8 @@ var TextEngine = class {
|
|
|
673
675
|
}
|
|
674
676
|
handleRunErrorEvent(chunk) {
|
|
675
677
|
this.earlyTermination = true;
|
|
676
|
-
if (this.
|
|
677
|
-
const message = chunk.message || chunk.error?.message || "Run failed
|
|
678
|
+
if (this.finalizationError === null) {
|
|
679
|
+
const message = chunk.message || chunk.error?.message || "Run failed";
|
|
678
680
|
this.finalizationError = {
|
|
679
681
|
message,
|
|
680
682
|
...chunk.code !== void 0 ? { code: chunk.code } : chunk.error?.code !== void 0 ? { code: chunk.error.code } : {}
|