agentHostChangesetOperationService.ts ×9

Frontier kind: Code frontier

unlabeled · c_db44abff58da

3 tests · 19675 LOC · 87 files · introduces 0 tests · 52 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges52 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1923 ranges19675 lines · 87 files · Browse complete extent
All tests (intent)
3 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.

2 files ranked by introduced lines: 52 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentHostChangesetOperationService.ts 36 introduced LOC · 9 ranges

Open complete file

149 throw new ProtocolError(JsonRpcErrorCodes.InvalidParams, `Operation '${params.operationId}' is disabled while a turn is active on changeset ${params.channel}`);
150 }
152 const targetKind: ChangesetOperationScope = params.target?.kind === ChangesetOperationTargetKind.Resource
153 ? ChangesetOperationScope.Resource
154 > : params.target?.kind === ChangesetOperationTargetKind.Range agentHostChangesetOperationService.ts
155 ? ChangesetOperationScope.Range
156 > : ChangesetOperationScope.Changeset; agentHostChangesetOperationService.ts
157 if (!op.scopes.includes(targetKind)) {
158 throw new ProtocolError(JsonRpcErrorCodes.InvalidParams, `Operation '${params.operationId}' does not support scope '${targetKind}' (allowed: ${op.scopes.join(', ')})`);
159 }
161 > const handler = this._changesetOperationHandlers.get(params.operationId);
162 > if (!handler) {
163 throw new ProtocolError(JsonRpcErrorCodes.InternalError, `No operation handler registered for '${params.operationId}' on changeset ${params.channel}`);
164 }
166 > return this._invokeChangesetOperation(handler, params);
167 }
168
169 private _invokeChangesetOperation(
170 > handler: IChangesetOperationHandler, agentHostChangesetOperationService.ts
171 > params: InvokeChangesetOperationParams,
172 > ): Promise<InvokeChangesetOperationResult> {
173 > const operationKey = `${params.channel}\x00${params.operationId}\x00${JSON.stringify(params.target ?? null)}`;
174 > const inFlightOperationResult = this._inFlightOperations.get(operationKey);
175 > if (inFlightOperationResult) {
176 return inFlightOperationResult;
177 }
179 > this._stateManager.dispatchServerAction(params.channel, {
180 > type: ActionType.ChangesetOperationStatusChanged,
181 > operationId: params.operationId,
182 > status: ChangesetOperationStatus.Running,
183 > });
184 >
185 > const operationPromise = handler.invoke(params, CancellationToken.None)
186 > .then(result => {
187 this._stateManager.dispatchServerAction(params.channel, {
188 type: ActionType.ChangesetOperationStatusChanged,
192
193 return result;
195 > .catch((error) => {
196 this._stateManager.dispatchServerAction(params.channel, {
197 type: ActionType.ChangesetOperationStatusChanged,
202
203 throw error;
205 > .finally(() => {
206 > if (this._inFlightOperations.get(operationKey) === operationPromise) {
207 > this._inFlightOperations.delete(operationKey);
208 > }
209 > });
210 >
211 > this._inFlightOperations.set(operationKey, operationPromise);
212 >
213 > return operationPromise;
214 > }
215
216 private _registerChangesetOperationHandler(operationId: string, handler: IChangesetOperationHandler): IDisposable {
src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.ts 16 introduced LOC · 4 ranges

Open complete file

87
88 case ActionType.ChangesetOperationStatusChanged: {
89 > if (state.operations === undefined) { reducer.ts
90 return state;
91 }
92 > const idx = state.operations.findIndex(o => o.id === action.operationId); reducer.ts
93 > if (idx < 0) {
94 return state;
95 }
96 > const current = state.operations[idx]; reducer.ts
97 > // Carry `error` only when the new status is `Error` so we don't leave
98 > // a stale error on an operation that recovered or started running.
99 > let nextOp: ChangesetOperation;
100 > if (action.status === ChangesetOperationStatus.Error) {
101 nextOp = { ...current, status: action.status, error: action.error };
102 > } else { reducer.ts
103 > const { error: _ignored, ...rest } = current;
104 > nextOp = { ...rest, status: action.status };
105 > }
106 > const next: ChangesetOperation[] = [...state.operations];
107 > next[idx] = nextOp;
108 > return { ...state, operations: next };
109 > }
110
111 case ActionType.ChangesetCleared: