Skip to content

Commit 56e461b

Browse files
committed
refactor: thread prepared user turn through embedded runs
1 parent b9f6c96 commit 56e461b

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/agents/pi-embedded-runner/run.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,7 @@ export async function runEmbeddedPiAgent(
14431443
skillsSnapshot: params.skillsSnapshot,
14441444
prompt,
14451445
transcriptPrompt: params.transcriptPrompt,
1446+
userMessageForPersistence: params.userMessageForPersistence,
14461447
currentInboundEventKind: params.currentInboundEventKind,
14471448
currentInboundContext: params.currentInboundContext,
14481449
images: params.images,

‎src/agents/pi-embedded-runner/run/attempt.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,7 @@ export async function runEmbeddedAttempt(
23272327
config: params.config,
23282328
contextWindowTokens: params.contextTokenBudget,
23292329
inputProvenance: params.inputProvenance,
2330+
userMessageForPersistence: params.userMessageForPersistence,
23302331
allowSyntheticToolResults: transcriptPolicy.allowSyntheticToolResults,
23312332
missingToolResultText:
23322333
params.model.api === "openai-responses" ||

‎src/agents/pi-embedded-runner/run/params.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { OpenClawConfig } from "../../../config/types.openclaw.js";
1212
import type { PromptImageOrderEntry } from "../../../media/prompt-image-order.js";
1313
import type { CommandQueueEnqueueFn } from "../../../process/command-queue.types.js";
1414
import type { InputProvenance } from "../../../sessions/input-provenance.js";
15+
import type { PersistedUserTurnMessage } from "../../../sessions/user-turn-transcript.js";
1516
import type { ExecElevatedDefaults, ExecToolDefaults } from "../../bash-tools.exec-types.js";
1617
import type { AgentStreamParams, ClientToolDefinition } from "../../command/shared-types.js";
1718
import type { AgentInternalEvent } from "../../internal-events.js";
@@ -106,6 +107,8 @@ export type RunEmbeddedPiAgentParams = {
106107
prompt: string;
107108
/** User-visible prompt body to submit and persist; runtime context travels separately. */
108109
transcriptPrompt?: string;
110+
/** Prepared user transcript message to persist through Pi's normal user append path. */
111+
userMessageForPersistence?: PersistedUserTurnMessage;
109112
currentInboundEventKind?: InboundEventKind;
110113
currentInboundContext?: CurrentInboundPromptContext;
111114
images?: ImageContent[];

0 commit comments

Comments
 (0)