1
>
/*---------------------------------------------------------------------------------------------
codexUserInputMapper.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind, ChatInputResponseKind, type ChatInputAnswer, type ChatInputQuestion, type ChatInputRequest } from '../../common/state/sessionState.js';
7
>
import type { ToolRequestUserInputAnswer } from './protocol/generated/v2/ToolRequestUserInputAnswer.js';
8
>
import type { ToolRequestUserInputQuestion } from './protocol/generated/v2/ToolRequestUserInputQuestion.js';
9
>
import type { ToolRequestUserInputResponse } from './protocol/generated/v2/ToolRequestUserInputResponse.js';
10
>
11
>
/**
12
>
* Translate codex `request_user_input` (the model's `ask_user`) questions into
13
>
* an agent-host {@link ChatInputRequest}. Questions with options become a
14
>
* single-select (with freeform allowed when codex marks `isOther`); option-less
15
>
* questions become a free text question. Codex options have no stable id, so
16
>
* the option label doubles as the id.
17
>
*/
18
>
export function buildUserInputRequest(requestId: string, questions: readonly ToolRequestUserInputQuestion[]): ChatInputRequest {
19
return {
20
id: requestId,