Skip to content

Commit 2db10fb

Browse files
committed
perf(reply): lazy-load embedded queue steering
1 parent bad9c8c commit 2db10fb

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { queueEmbeddedPiMessage } from "./pi-embedded.js";

‎src/auto-reply/reply/agent-runner.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { lookupContextTokens } from "../../agents/context.js";
33
import { DEFAULT_CONTEXT_TOKENS } from "../../agents/defaults.js";
44
import { resolveModelAuthMode } from "../../agents/model-auth.js";
55
import { isCliProvider } from "../../agents/model-selection.js";
6-
import { queueEmbeddedPiMessage } from "../../agents/pi-embedded.js";
76
import { hasNonzeroUsage } from "../../agents/usage.js";
87
import {
98
resolveSessionFilePath,
@@ -58,6 +57,14 @@ import { createTypingSignaler } from "./typing-mode.js";
5857
import type { TypingController } from "./typing.js";
5958

6059
const BLOCK_REPLY_SEND_TIMEOUT_MS = 15_000;
60+
let piEmbeddedQueueRuntimePromise: Promise<
61+
typeof import("../../agents/pi-embedded-queue.runtime.js")
62+
> | null = null;
63+
64+
function loadPiEmbeddedQueueRuntime() {
65+
piEmbeddedQueueRuntimePromise ??= import("../../agents/pi-embedded-queue.runtime.js");
66+
return piEmbeddedQueueRuntimePromise;
67+
}
6168

6269
export async function runReplyAgent(params: {
6370
commandBody: string;
@@ -194,6 +201,7 @@ export async function runReplyAgent(params: {
194201
};
195202

196203
if (shouldSteer && isStreaming) {
204+
const { queueEmbeddedPiMessage } = await loadPiEmbeddedQueueRuntime();
197205
const steered = queueEmbeddedPiMessage(followupRun.run.sessionId, followupRun.prompt);
198206
if (steered && !shouldFollowup) {
199207
await touchActiveSessionEntry();

0 commit comments

Comments
 (0)