mirror of https://github.com/openclaw/openclaw.git
perf(reply): lazy-load runner execution and memory
This commit is contained in:
parent
aaba1ae653
commit
263d5ea687
|
|
@ -0,0 +1 @@
|
|||
export { runAgentTurnWithFallback } from "./agent-runner-execution.js";
|
||||
|
|
@ -0,0 +1 @@
|
|||
export { runMemoryFlushIfNeeded } from "./agent-runner-memory.js";
|
||||
|
|
@ -27,7 +27,6 @@ import {
|
|||
import type { OriginatingChannelType, TemplateContext } from "../templating.js";
|
||||
import { resolveResponseUsageMode, type VerboseLevel } from "../thinking.js";
|
||||
import type { GetReplyOptions, ReplyPayload } from "../types.js";
|
||||
import { runAgentTurnWithFallback } from "./agent-runner-execution.js";
|
||||
import {
|
||||
createShouldEmitToolOutput,
|
||||
createShouldEmitToolResult,
|
||||
|
|
@ -35,7 +34,6 @@ import {
|
|||
isAudioPayload,
|
||||
signalTypingIfNeeded,
|
||||
} from "./agent-runner-helpers.js";
|
||||
import { runMemoryFlushIfNeeded } from "./agent-runner-memory.js";
|
||||
import { buildReplyPayloads } from "./agent-runner-payloads.js";
|
||||
import {
|
||||
appendUnscheduledReminderNote,
|
||||
|
|
@ -60,12 +58,28 @@ const BLOCK_REPLY_SEND_TIMEOUT_MS = 15_000;
|
|||
let piEmbeddedQueueRuntimePromise: Promise<
|
||||
typeof import("../../agents/pi-embedded-queue.runtime.js")
|
||||
> | null = null;
|
||||
let agentRunnerExecutionRuntimePromise: Promise<
|
||||
typeof import("./agent-runner-execution.runtime.js")
|
||||
> | null = null;
|
||||
let agentRunnerMemoryRuntimePromise: Promise<
|
||||
typeof import("./agent-runner-memory.runtime.js")
|
||||
> | null = null;
|
||||
|
||||
function loadPiEmbeddedQueueRuntime() {
|
||||
piEmbeddedQueueRuntimePromise ??= import("../../agents/pi-embedded-queue.runtime.js");
|
||||
return piEmbeddedQueueRuntimePromise;
|
||||
}
|
||||
|
||||
function loadAgentRunnerExecutionRuntime() {
|
||||
agentRunnerExecutionRuntimePromise ??= import("./agent-runner-execution.runtime.js");
|
||||
return agentRunnerExecutionRuntimePromise;
|
||||
}
|
||||
|
||||
function loadAgentRunnerMemoryRuntime() {
|
||||
agentRunnerMemoryRuntimePromise ??= import("./agent-runner-memory.runtime.js");
|
||||
return agentRunnerMemoryRuntimePromise;
|
||||
}
|
||||
|
||||
export async function runReplyAgent(params: {
|
||||
commandBody: string;
|
||||
followupRun: FollowupRun;
|
||||
|
|
@ -231,6 +245,7 @@ export async function runReplyAgent(params: {
|
|||
|
||||
await typingSignals.signalRunStart();
|
||||
|
||||
const { runMemoryFlushIfNeeded } = await loadAgentRunnerMemoryRuntime();
|
||||
activeSessionEntry = await runMemoryFlushIfNeeded({
|
||||
cfg,
|
||||
followupRun,
|
||||
|
|
@ -359,6 +374,7 @@ export async function runReplyAgent(params: {
|
|||
});
|
||||
try {
|
||||
const runStartedAt = Date.now();
|
||||
const { runAgentTurnWithFallback } = await loadAgentRunnerExecutionRuntime();
|
||||
const runOutcome = await runAgentTurnWithFallback({
|
||||
commandBody,
|
||||
followupRun,
|
||||
|
|
|
|||
Loading…
Reference in New Issue