diff --git a/scripts/scenarios/start-app.ts b/scripts/scenarios/start-app.ts index 5dee3f26c1..3e29b10757 100644 --- a/scripts/scenarios/start-app.ts +++ b/scripts/scenarios/start-app.ts @@ -126,6 +126,15 @@ const startApp = Effect.fn("startApp")(function* (input: { const checkout = yield* HostProcess.WorkingDirectory; const hostEnvironment = yield* HostProcess.Environment; yield* prepareHome(input.home); + // Synthetic option previews enter through the same replay boundary on both commits. + const parserPath = path.join(checkout, "packages/provider-acp/src/server/elicitationForm.ts"); + const parser = yield* fs.readFileString(parserPath); + yield* fs.writeFileString(parserPath, parser.replace( + "? { label, description: text(option.description) ?? label, value: option.const }", + "? { label, description: text(option.description) ?? label, value: option.const, ...({ Approve: { preview: 'Title: Fix login\\n\\nBody:\\nLogin fails when the password has a quote.\\nSteps: ...' }, Shorter: { preview: 'Title: Login bug\\n\\nBody:\\nQuote in password breaks login.' } }[option.const] ?? {}) }", + )); + yield* fs.writeFileString(path.join(checkout, "apps/server/src/orchestration-v2/testkit/fixtures/acp_elicitation/registry_transcript.ndjson"), "{\"type\": \"transcript_start\", \"provider\": \"acpRegistry\", \"protocol\": \"acp.ndjson-jsonrpc\", \"version\": \"1\", \"scenario\": \"acp_elicitation\", \"metadata\": {\"generatedBy\": \"protocol-semantic-fixture\", \"nativeSessionId\": \"registry-replay-session-1\"}}\n{\"type\": \"expect_outbound\", \"label\": \"initialize\", \"frame\": {\"kind\": \"request\", \"method\": \"initialize\", \"params\": {\"protocolVersion\": 2, \"info\": \"\", \"capabilities\": \"\", \"clientCapabilities\": \"\", \"clientInfo\": \"\"}}}\n{\"type\": \"emit_inbound\", \"label\": \"initialized\", \"frame\": {\"kind\": \"response\", \"method\": \"initialize\", \"result\": {\"protocolVersion\": 1, \"agentCapabilities\": {\"loadSession\": true, \"mcpCapabilities\": {\"http\": true, \"sse\": true}, \"promptCapabilities\": {\"audio\": false, \"embeddedContext\": true, \"image\": false}}, \"authMethods\": [{\"id\": \"replay\", \"name\": \"Replay\"}], \"agentInfo\": {\"name\": \"generic-acp-replay\", \"version\": \"1\"}}}}\n{\"type\": \"expect_outbound\", \"label\": \"session.new\", \"frame\": {\"kind\": \"request\", \"method\": \"session/new\", \"params\": {\"cwd\": \"\", \"mcpServers\": \"\"}}}\n{\"type\": \"emit_inbound\", \"label\": \"session.created\", \"frame\": {\"kind\": \"response\", \"method\": \"session/new\", \"result\": {\"sessionId\": \"registry-replay-session-1\"}}}\n{\"type\": \"expect_outbound\", \"label\": \"session.prompt\", \"frame\": {\"kind\": \"request\", \"method\": \"session/prompt\", \"params\": {\"sessionId\": \"registry-replay-session-1\", \"prompt\": [{\"type\": \"text\", \"text\": \"\\n\\n\\n\\n\\nUse request_user_input to ask one multiple-choice clarifying question about whether this fixture should prefer strict schemas or UI flexibility. After receiving the answer, respond exactly: plan questions fixture complete\\n\"}]}}}\n{\"type\": \"emit_inbound\", \"label\": \"elicitation.request\", \"frame\": {\"kind\": \"request\", \"method\": \"elicitation/create\", \"params\": {\"sessionId\": \"registry-replay-session-1\", \"mode\": \"form\", \"message\": \"Approve this issue title/body?\", \"requestedSchema\": {\"type\": \"object\", \"properties\": {\"issue_title\": {\"type\": \"string\", \"title\": \"Issue title\", \"description\": \"Approve this issue title/body?\", \"oneOf\": [{\"const\": \"Approve\", \"title\": \"Approve\", \"description\": \"Use the full draft\", \"preview\": \"Title: Fix login\\n\\nBody:\\nLogin fails when the password has a quote.\\nSteps: ...\"}, {\"const\": \"Shorter\", \"title\": \"Shorter\", \"description\": \"Use the shorter draft\", \"preview\": \"Title: Login bug\\n\\nBody:\\nQuote in password breaks login.\"}, {\"const\": \"Cancel\", \"title\": \"Cancel\", \"description\": \"Do not create the issue\"}]}}, \"required\": [\"issue_title\"]}}}}\n{\"type\": \"expect_outbound\", \"label\": \"elicitation.response\", \"frame\": {\"kind\": \"response\", \"method\": \"elicitation/create\", \"result\": {\"action\": \"accept\", \"content\": {\"schema_vs_ui_flexibility\": \"Strict schemas (Recommended)\"}}}}\n{\"type\": \"emit_inbound\", \"label\": \"assistant.final\", \"frame\": {\"kind\": \"notification\", \"method\": \"session/update\", \"params\": {\"sessionId\": \"registry-replay-session-1\", \"update\": {\"sessionUpdate\": \"agent_message_chunk\", \"content\": {\"type\": \"text\", \"text\": \"plan questions fixture complete\"}}}}}\n{\"type\": \"emit_inbound\", \"label\": \"prompt.completed\", \"frame\": {\"kind\": \"response\", \"method\": \"session/prompt\", \"result\": {\"stopReason\": \"end_turn\"}}}\n{\"type\": \"runtime_exit\", \"status\": \"success\"}\n"); + const env = { ...hostEnvironment, PATH: `${path.join(input.home, "bin")}:${hostEnvironment.PATH ?? ""}`,