src/vs/platform/agentHost/node/claude/claudeToolDenial.ts

33 LOC · 33 covered · 0 uncovered · 8 ranges · 512 concepts · 5 introducers · 262 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- claudeToolDenial.ts ×1
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 > /**
7 > * Deny `message` returned to the SDK when the user declines a tool
8 > * permission. The SDK surfaces it as the `is_error` tool_result content.
9 > */
10 > export const CLAUDE_USER_DECLINED_MESSAGE = 'User declined';
11 > /** Deny `message` when the user declines an `ExitPlanMode` plan. */
12 > export const CLAUDE_PLAN_DECLINED_MESSAGE = 'The user declined the plan, maybe ask why?';
13 > /** Deny `message` when the user cancels an `AskUserQuestion` prompt. */
14 > export const CLAUDE_QUESTION_CANCELLED_MESSAGE = 'The user cancelled the question';
15 >
16 > /**
17 > * Classifies a failed tool's result message into a `languageModelToolInvoked`
18 > * cancellation code (`denied`/`cancelled`), or `undefined` for a genuine tool
19 > * error. The input is the `message` a denied `canUseTool` returns, which the
20 > * SDK echoes back as the `is_error` tool_result content — so matching the
21 > * known deny strings distinguishes a user cancellation from a tool failure.
22 > */
23 > export function claudeToolDenialCode(message: string): 'denied' | 'cancelled' | undefined {
24 > switch (message) { claudeToolDenial.ts ×4
25 > case CLAUDE_USER_DECLINED_MESSAGE:
26 > case CLAUDE_PLAN_DECLINED_MESSAGE:
27 > return 'denied'; claudeToolDenial.ts ×1
28 > case CLAUDE_QUESTION_CANCELLED_MESSAGE: claudeToolDenial.ts ×4
29 > return 'cancelled'; claudeToolDenial.ts ×1
30 > default: claudeToolDenial.ts ×4
31 > return undefined; claudeToolDenial.ts ×1
33 > }