1
>
/*---------------------------------------------------------------------------------------------
claudeInteractiveTools.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 { localize } from '../../../../nls.js';
7
>
import { ConfirmationOptionKind, ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind, ToolCallStatus, type ChatInputOption, type ChatInputQuestion, type ToolCallPendingConfirmationState } from '../../common/state/protocol/state.js';
8
>
import type { ChatInputAnswer } from '../../common/state/sessionState.js';
9
>
import { getClaudeToolDisplayName } from './claudeToolDisplay.js';
10
>
11
>
/**
12
>
* Pure projections between the Claude SDK's interactive built-in tool
13
>
* inputs/outputs and the agentHost workbench protocol.
14
>
*
15
>
* Phase 7 S3.5. The two interactive tools (`ExitPlanMode`,
16
>
* `AskUserQuestion`) are exempt from the SDK's `permissionMode` auto-
17
>
* approval and always reach `canUseTool`. The agent's job for each is
18
>
* to render a workbench prompt and translate the user's answer back
19
>
* into the SDK's `PermissionResult` shape — this module owns those
20
>
* projections so they can be tested without standing up an agent.
21
>
*/
22
>
23
>
// #region ExitPlanMode
24
>
25
>
/**
26
>
* Build the {@link ToolCallPendingConfirmationState} card body for the
27
>
* `ExitPlanMode` confirmation. Custom Approve / Deny buttons (no "Allow
28
>
* in this Session") so the approval is never remembered — each plan
29
>
* must be approved on its own merit. Mirrors the production extension's
30
>
* `exitPlanModeHandler.ts`.
31
>
*/
32
>
export function buildExitPlanModeConfirmationState(input: Record<string, unknown>, toolUseID: string): ToolCallPendingConfirmationState {
33
const plan = typeof input.plan === 'string' ? input.plan : '';
34
return {