Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/chatSessions/claude/node/test/mockClaudeToolPermissionService.ts
13406 views
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
import {
7
ClaudeToolPermissionContext,
8
ClaudeToolPermissionResult
9
} from '../../common/claudeToolPermission';
10
import { IClaudeToolPermissionService } from '../../common/claudeToolPermissionService';
11
12
/**
13
* Mock implementation of ClaudeToolPermissionService for testing.
14
* By default, allows all tools without confirmation.
15
*/
16
export class MockClaudeToolPermissionService implements IClaudeToolPermissionService {
17
declare readonly _serviceBrand: undefined;
18
19
public allowAll = true;
20
21
public async canUseTool(
22
_toolName: string,
23
input: Record<string, unknown>,
24
_context: ClaudeToolPermissionContext
25
): Promise<ClaudeToolPermissionResult> {
26
if (this.allowAll) {
27
return {
28
behavior: 'allow',
29
updatedInput: input
30
};
31
}
32
return {
33
behavior: 'deny',
34
message: 'Mock denied'
35
};
36
}
37
}
38
39