fix: use inline setInterval instead of EventLoopKeepalive import
EventLoopKeepalive is not exported from yield.ts on main. Use setInterval + unref() directly, matching the pattern in keepaliveWhile(). Biome import order also fixed (type imports before value imports within the same group).
This commit is contained in:
@@ -34,7 +34,6 @@ import type {
|
||||
StreamFn,
|
||||
ToolCallContext,
|
||||
} from "./types";
|
||||
import { EventLoopKeepalive } from "./utils/yield";
|
||||
|
||||
/**
|
||||
* Default convertToLlm: Keep only LLM-compatible messages, convert attachments.
|
||||
@@ -858,7 +857,8 @@ export class Agent {
|
||||
if (!model) throw new Error("No model configured");
|
||||
|
||||
let skipInitialSteeringPoll = options?.skipInitialSteeringPoll === true;
|
||||
const keepalive = new EventLoopKeepalive();
|
||||
const keepalive = setInterval(() => {}, 86_400_000);
|
||||
keepalive.unref();
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
this.#runningPrompt = promise;
|
||||
this.#resolveRunningPrompt = resolve;
|
||||
@@ -1063,7 +1063,7 @@ export class Agent {
|
||||
this.#state.error = err?.message || String(err);
|
||||
this.#emit({ type: "agent_end", messages: [errorMsg] });
|
||||
} finally {
|
||||
keepalive.dispose();
|
||||
clearInterval(keepalive);
|
||||
this.#state.isStreaming = false;
|
||||
this.#state.streamMessage = null;
|
||||
this.#state.pendingToolCalls = new Set<string>();
|
||||
|
||||
Reference in New Issue
Block a user