fix: align embedded runner with session API changes

This commit is contained in:
Peter Steinberger
2026-02-01 15:06:42 -08:00
parent bcbb447357
commit 3367b2aa27
4 changed files with 55 additions and 15 deletions

View File

@@ -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;
}