registry.ts ×4

Frontier kind: Code frontier

unlabeled · c_a9f4c4322d02

264 tests · 3829 LOC · 21 files · introduces 0 tests · 195 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges195 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
487 ranges3829 lines · 21 files · Browse complete extent
All tests (intent)
264 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

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 native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 195 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/common/state/protocol/version/registry.ts 195 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- registry.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 > // allow-any-unicode-comment-file
7 > // DO NOT EDIT -- auto-generated by scripts/sync-agent-host-protocol.ts
8 >
9 > import { ActionType, type StateAction } from '../actions.js';
10 > import type { ServerNotificationMap } from '../messages.js';
11 >
12 > // ─── Protocol Version Constants ──────────────────────────────────────────────
13 >
14 > /**
15 > * The current protocol version that new code speaks.
16 > *
17 > * Formatted as a [SemVer](https://semver.org) `MAJOR.MINOR.PATCH` string.
18 > */
19 > export const PROTOCOL_VERSION = '0.7.0';
20 >
21 > /**
22 > * Every protocol version a client built from this source tree is willing
23 > * to negotiate via the `initialize` handshake. Ordered **most preferred
24 > * first** so a server picking the first acceptable entry honors the
25 > * client's preference (see [versioning](../../docs/specification/versioning.md)).
26 > *
27 > * The first entry MUST equal {@link PROTOCOL_VERSION} — the version
28 > * "new code speaks" is by definition the most preferred one. Older
29 > * versions may be appended if a client retains the ability to fall back
30 > * to them; today only one version is advertised.
31 > *
32 > * Every generated client (Rust, Kotlin, Swift) re-exports this constant
33 > * verbatim. The TypeScript client consumes it directly. The per-client
34 > * `release-metadata.json` files are validated against this list by
35 > * `scripts/verify-release-metadata.ts`.
36 > */
37 > export const SUPPORTED_PROTOCOL_VERSIONS: readonly string[] = Object.freeze([
38 > '0.7.0',
39 > '0.6.0',
40 > '0.5.2',
41 > '0.5.1',
42 > ]);
43 >
44 > // ─── SemVer Comparison ───────────────────────────────────────────────────────
45 >
46 > /**
47 > * Parses a `MAJOR.MINOR.PATCH` SemVer string into its three numeric
48 > * components. Pre-release and build metadata are not supported and MUST NOT
49 > * be present in protocol version strings.
50 > *
51 > * Throws if `version` is not a well-formed `MAJOR.MINOR.PATCH` string.
52 > */
53 function parseSemver(version: string): readonly [number, number, number] {
54 const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
58 return [Number(match[1]), Number(match[2]), Number(match[3])] as const;
59 }
61 > /**
62 > * Compares two `MAJOR.MINOR.PATCH` SemVer strings.
63 > *
64 > * Returns a negative number if `a < b`, zero if `a === b`, and a positive
65 > * number if `a > b`.
66 > */
67 > export function compareProtocolVersions(a: string, b: string): number {
68 const [aMajor, aMinor, aPatch] = parseSemver(a);
69 const [bMajor, bMinor, bPatch] = parseSemver(b);
70 return (aMajor - bMajor) || (aMinor - bMinor) || (aPatch - bPatch);
71 }
73 > // ─── Exhaustive Action → Version Map ─────────────────────────────────────────
74 >
75 > /**
76 > * Maps every action type to the protocol version that introduced it.
77 > * Adding a new action to `StateAction` without adding it here is a compile error.
78 > *
79 > * Versions are SemVer `MAJOR.MINOR.PATCH` strings (see `PROTOCOL_VERSION`).
80 > */
81 > export const ACTION_INTRODUCED_IN: { readonly [K in StateAction['type']]: string } = {
82 > [ActionType.RootAgentsChanged]: '0.1.0',
83 > [ActionType.RootActiveSessionsChanged]: '0.1.0',
84 > [ActionType.SessionReady]: '0.1.0',
85 > [ActionType.SessionCreationFailed]: '0.1.0',
86 > [ActionType.SessionChatAdded]: '0.4.0',
87 > [ActionType.SessionChatRemoved]: '0.4.0',
88 > [ActionType.SessionChatUpdated]: '0.4.0',
89 > [ActionType.SessionDefaultChatChanged]: '0.4.0',
90 > [ActionType.SessionTitleChanged]: '0.1.0',
91 > [ActionType.SessionServerToolsChanged]: '0.1.0',
92 > [ActionType.SessionActiveClientSet]: '0.5.0',
93 > [ActionType.SessionActiveClientRemoved]: '0.5.0',
94 > [ActionType.SessionWorkingDirectorySet]: '0.7.0',
95 > [ActionType.SessionWorkingDirectoryRemoved]: '0.7.0',
96 > [ActionType.SessionInputNeededSet]: '0.5.1',
97 > [ActionType.SessionInputNeededRemoved]: '0.5.1',
98 > [ActionType.SessionCustomizationsChanged]: '0.1.0',
99 > [ActionType.SessionCustomizationToggled]: '0.1.0',
100 > [ActionType.SessionCustomizationUpdated]: '0.1.0',
101 > [ActionType.SessionCustomizationRemoved]: '0.2.0',
102 > [ActionType.SessionMcpServerStateChanged]: '0.3.0',
103 > [ActionType.SessionMcpServerStartRequested]: '0.5.2',
104 > [ActionType.SessionMcpServerStopRequested]: '0.5.2',
105 > [ActionType.SessionIsReadChanged]: '0.1.0',
106 > [ActionType.SessionIsArchivedChanged]: '0.1.0',
107 > [ActionType.SessionActivityChanged]: '0.1.0',
108 > [ActionType.SessionChangesetsChanged]: '0.2.0',
109 > [ActionType.SessionConfigChanged]: '0.1.0',
110 > [ActionType.SessionMetaChanged]: '0.1.0',
111 > [ActionType.ChatTurnStarted]: '0.4.0',
112 > [ActionType.ChatDelta]: '0.4.0',
113 > [ActionType.ChatResponsePart]: '0.4.0',
114 > [ActionType.ChatToolCallStart]: '0.4.0',
115 > [ActionType.ChatToolCallDelta]: '0.4.0',
116 > [ActionType.ChatToolCallReady]: '0.4.0',
117 > [ActionType.ChatToolCallConfirmed]: '0.4.0',
118 > [ActionType.ChatToolCallComplete]: '0.4.0',
119 > [ActionType.ChatToolCallResultConfirmed]: '0.4.0',
120 > [ActionType.ChatToolCallContentChanged]: '0.4.0',
121 > [ActionType.ChatToolCallAuthRequired]: '0.6.0',
122 > [ActionType.ChatToolCallAuthResolved]: '0.6.0',
123 > [ActionType.ChatTurnComplete]: '0.4.0',
124 > [ActionType.ChatTurnCancelled]: '0.4.0',
125 > [ActionType.ChatError]: '0.4.0',
126 > [ActionType.ChatActivityChanged]: '0.5.0',
127 > [ActionType.ChatWorkingDirectorySet]: '0.7.0',
128 > [ActionType.ChatWorkingDirectoryRemoved]: '0.7.0',
129 > [ActionType.ChatUsage]: '0.4.0',
130 > [ActionType.ChatReasoning]: '0.4.0',
131 > [ActionType.ChatPendingMessageSet]: '0.4.0',
132 > [ActionType.ChatPendingMessageRemoved]: '0.4.0',
133 > [ActionType.ChatQueuedMessagesReordered]: '0.4.0',
134 > [ActionType.ChatDraftChanged]: '0.5.0',
135 > [ActionType.ChatInputRequested]: '0.4.0',
136 > [ActionType.ChatInputAnswerChanged]: '0.4.0',
137 > [ActionType.ChatInputCompleted]: '0.4.0',
138 > [ActionType.ChatTruncated]: '0.4.0',
139 > [ActionType.ChatTurnsLoaded]: '0.5.1',
140 > [ActionType.ChangesetStatusChanged]: '0.2.0',
141 > [ActionType.ChangesetFileSet]: '0.2.0',
142 > [ActionType.ChangesetFileRemoved]: '0.2.0',
143 > [ActionType.ChangesetFilesReviewChanged]: '0.6.0',
144 > [ActionType.ChangesetContentChanged]: '0.4.0',
145 > [ActionType.ChangesetOperationsChanged]: '0.2.0',
146 > [ActionType.ChangesetOperationStatusChanged]: '0.3.0',
147 > [ActionType.ChangesetCleared]: '0.2.0',
148 > [ActionType.AnnotationsSet]: '0.4.0',
149 > [ActionType.AnnotationsUpdated]: '0.4.0',
150 > [ActionType.AnnotationsRemoved]: '0.4.0',
151 > [ActionType.AnnotationsEntrySet]: '0.4.0',
152 > [ActionType.AnnotationsEntryRemoved]: '0.4.0',
153 > [ActionType.RootTerminalsChanged]: '0.1.0',
154 > [ActionType.RootConfigChanged]: '0.1.0',
155 > [ActionType.TerminalData]: '0.1.0',
156 > [ActionType.TerminalInput]: '0.1.0',
157 > [ActionType.TerminalResized]: '0.1.0',
158 > [ActionType.TerminalClaimed]: '0.1.0',
159 > [ActionType.TerminalTitleChanged]: '0.1.0',
160 > [ActionType.TerminalCwdChanged]: '0.1.0',
161 > [ActionType.TerminalExited]: '0.1.0',
162 > [ActionType.TerminalCleared]: '0.1.0',
163 > [ActionType.TerminalCommandDetectionAvailable]: '0.1.0',
164 > [ActionType.TerminalCommandExecuted]: '0.1.0',
165 > [ActionType.TerminalCommandFinished]: '0.1.0',
166 > [ActionType.ResourceWatchChanged]: '0.2.0',
167 > };
168 >
169 > /**
170 > * Returns whether the given action type is known to the specified protocol version.
171 > */
172 > export function isActionKnownToVersion(action: StateAction, clientVersion: string): boolean {
173 return compareProtocolVersions(ACTION_INTRODUCED_IN[action.type], clientVersion) <= 0;
174 }
175 > registry.ts
176 > // ─── Exhaustive Notification Method → Version Map ──────────────────────────
177 >
178 > /**
179 > * Server → client notification method names that are part of the AHP
180 > * protocol surface. The set is a subset of {@link ServerNotificationMap}
181 > * keys that excludes `action` (the action envelope) since action versions
182 > * are tracked via {@link ACTION_INTRODUCED_IN}.
183 > */
184 > export type ProtocolNotificationMethod = Exclude<keyof ServerNotificationMap, 'action'>;
185 >
186 > /**
187 > * Maps every server → client protocol notification method to the protocol
188 > * version that introduced it. Adding a new notification method to
189 > * {@link ServerNotificationMap} without adding it here is a compile error.
190 > *
191 > * Versions are SemVer `MAJOR.MINOR.PATCH` strings (see `PROTOCOL_VERSION`).
192 > */
193 > export const NOTIFICATION_INTRODUCED_IN: { readonly [K in ProtocolNotificationMethod]: string } = {
194 > 'root/sessionAdded': '0.1.0',
195 > 'root/sessionRemoved': '0.1.0',
196 > 'root/sessionSummaryChanged': '0.1.0',
197 > 'root/progress': '0.5.0',
198 > 'auth/required': '0.1.0',
199 > 'otlp/exportLogs': '0.2.0',
200 > 'otlp/exportTraces': '0.2.0',
201 > 'otlp/exportMetrics': '0.2.0',
202 > };
203 >
204 > /**
205 > * Returns whether the given notification method is known to the specified
206 > * protocol version.
207 > */
208 > export function isNotificationKnownToVersion(method: ProtocolNotificationMethod, clientVersion: string): boolean {
209 return compareProtocolVersions(NOTIFICATION_INTRODUCED_IN[method], clientVersion) <= 0;
210 }