Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/agentHost/common/state/sessionCapabilities.ts
13399 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
// Protocol version constants and capability derivation.
7
// See protocol.md -> Versioning for the full design.
8
//
9
// The authoritative version numbers and action-filtering logic live in
10
// versions/versionRegistry.ts. This file re-exports them and provides the
11
// capability-object API that client code uses to gate features.
12
13
export const PROTOCOL_VERSION = 1;
14
export const MIN_PROTOCOL_VERSION = 1;
15
16
/**
17
* Capabilities derived from a protocol version.
18
* Core features (v1) are always-present literal `true`.
19
* Features from later versions are optional `true | undefined`.
20
*/
21
export interface ProtocolCapabilities {
22
// v1 — always present
23
readonly sessions: true;
24
readonly tools: true;
25
readonly permissions: true;
26
}
27
28
/**
29
* Derives the set of capabilities available at a given protocol version.
30
* Newer clients use this to determine which features the server supports.
31
*/
32
export function capabilitiesForVersion(version: number): ProtocolCapabilities {
33
if (version < 1) {
34
throw new Error(`Unsupported protocol version: ${version}`);
35
}
36
37
return {
38
sessions: true,
39
tools: true,
40
permissions: true,
41
// Future versions add fields here:
42
// ...(version >= 2 ? { reasoning: true as const } : {}),
43
};
44
}
45
46