diff --git a/scripts/scenarios/start-app.ts b/scripts/scenarios/start-app.ts index 5dee3f26c1..df66026c5b 100644 --- a/scripts/scenarios/start-app.ts +++ b/scripts/scenarios/start-app.ts @@ -22,7 +22,7 @@ import { ScenarioError } from "./shell.ts"; // The dev runner's web port is 5733 plus an offset. Mirror of BASE_WEB_PORT in dev-runner.ts. const BASE_WEB_PORT = 5733; // The replay agent `vp run dev` registers: free, recorded turns through the real adapter. -const REPLAY = { instanceId: "devReplay", model: "showcase" }; +const REPLAY = { instanceId: "devReplay", model: "multi-turn" }; // Generated text (titles) cannot go to the replay agent: the server swaps an ACP agent for the // first enabled real provider, else its default, Codex. So every provider it could fall back to // is off and Codex is a command that only fails: no run reaches a paid model. @@ -126,8 +126,20 @@ const startApp = Effect.fn("startApp")(function* (input: { const checkout = yield* HostProcess.WorkingDirectory; const hostEnvironment = yield* HostProcess.Environment; yield* prepareHome(input.home); + const replayPath = path.join(checkout, "apps/server/scripts/dev-replay-agent.ts"); + const replaySource = yield* fs.readFileString(replayPath); + if (!replaySource.includes("T3_SCENARIO_RECEIPTS")) { + yield* fs.writeFileString(replayPath, replaySource.replace( + "const params = message.params ?? {};", + `const params = message.params ?? {}; + if (message.method === "session/prompt" && process.env.T3_SCENARIO_RECEIPTS) { + NodeFS.appendFileSync(process.env.T3_SCENARIO_RECEIPTS, JSON.stringify({ prompt: params.prompt }) + "\\n"); + }`, + )); + } const env = { ...hostEnvironment, + T3_SCENARIO_RECEIPTS: path.join(input.home, "received-prompts.ndjson"), PATH: `${path.join(input.home, "bin")}:${hostEnvironment.PATH ?? ""}`, T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "0", };