mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:27:41 +00:00
fix: align embedded runner with session API changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentSession } from "@mariozechner/pi-coding-agent";
|
||||
import type { ResolvedTimeFormat } from "../date-time.js";
|
||||
import type { EmbeddedContextFile } from "../pi-embedded-helpers.js";
|
||||
import type { EmbeddedSandboxInfo } from "./types.js";
|
||||
@@ -79,3 +80,17 @@ export function createSystemPromptOverride(
|
||||
const trimmed = systemPrompt.trim();
|
||||
return () => trimmed;
|
||||
}
|
||||
|
||||
export function applySystemPromptOverrideToSession(
|
||||
session: AgentSession,
|
||||
override: (defaultPrompt?: string) => string,
|
||||
) {
|
||||
const prompt = override().trim();
|
||||
session.agent.setSystemPrompt(prompt);
|
||||
const mutableSession = session as unknown as {
|
||||
_baseSystemPrompt?: string;
|
||||
_rebuildSystemPrompt?: (toolNames: string[]) => string;
|
||||
};
|
||||
mutableSession._baseSystemPrompt = prompt;
|
||||
mutableSession._rebuildSystemPrompt = () => prompt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user