copilotAgentSession.ts ×12

Frontier kind: Code frontier

unlabeled · c_6e1667df89ab

13 tests · 43796 LOC · 243 files · introduces 0 tests · 53 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges53 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4009 ranges43796 lines · 243 files · Browse complete extent
All tests (intent)
13 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: 53 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts 53 introduced LOC · 12 ranges

Open complete file

137 * Keys not present here fall back to the raw action id.
138 */
139 > function getPlanActionDescription(actionId: string): { label: string; description: string } | undefined { copilotAgentSession.ts
140 > switch (actionId) {
141 > case 'autopilot':
142 return {
143 label: localize('agentHost.planReview.autopilot.label', "Implement with Autopilot"),
144 description: localize('agentHost.planReview.autopilot.description', "Continue autonomously until done, using the selected approval level."),
145 };
146 > case 'autopilot_fleet': copilotAgentSession.ts
147 return {
148 label: localize('agentHost.planReview.autopilotFleet.label', "Implement with Autopilot Fleet"),
149 description: localize('agentHost.planReview.autopilotFleet.description', "Continue autonomously with fleet management, using the selected approval level."),
150 };
151 > case 'interactive': copilotAgentSession.ts
152 return {
153 label: localize('agentHost.planReview.interactive.label', "Implement Plan"),
154 description: localize('agentHost.planReview.interactive.description', "Implement the plan, asking for input and approval for each action."),
155 };
156 > case 'exit_only': copilotAgentSession.ts
157 return {
158 label: localize('agentHost.planReview.exitOnly.label', "Approve Plan Only"),
159 description: localize('agentHost.planReview.exitOnly.description', "Approve the plan without executing it. I will implement it myself."),
160 };
161 > default: copilotAgentSession.ts
162 return undefined;
164 > }
165
166 type UserInputHandler = NonNullable<SessionConfig['onUserInputRequest']>;
2833 const pendingPlanReview = this._pendingPlanReviews.get(requestId);
2834 if (pendingPlanReview) {
2835 > this._pendingPlanReviews.delete(requestId); copilotAgentSession.ts
2836 > pendingPlanReview.deferred.complete(this._resolveExitPlanMode(pendingPlanReview, response, answers));
2837 > return true;
2838 > }
2839
2840 const pendingElicitation = this._pendingElicitations.get(requestId);
2872 */
2873 private _resolveExitPlanMode(
2874 > pending: { actions: readonly string[]; recommendedAction: string; questionId: string }, copilotAgentSession.ts
2875 > response: ChatInputResponseKind,
2876 > answers?: Record<string, ChatInputAnswer>,
2877 > ): IExitPlanModeResponse {
2878 > if (response !== ChatInputResponseKind.Accept) {
2879 return { approved: false };
2880 }
2881 const answer = answers?.[pending.questionId];
2882 > if (!answer || answer.state === ChatInputAnswerState.Skipped) { copilotAgentSession.ts
2883 return { approved: false };
2884 }
2910 ? pending.recommendedAction
2911 : undefined;
2913 > // Freeform feedback => revision request. The SDK semantics are
2914 > // `approved: false` with a non-empty `feedback`; it will revise
2915 > // the plan and re-emit `exit_plan_mode.requested`.
2916 > if (feedback) {
2917 return {
2918 approved: false,
2936
2937 const isAutopilot = selectedAction === 'autopilot' || selectedAction === 'autopilot_fleet';
2938 > return { copilotAgentSession.ts
2939 > approved: true,
2940 > selectedAction,
2941 > ...(isAutopilot && this._isBypassApprovals() ? { autoApproveEdits: true } : {}),
2942 > };
2943 > }
2944
2945 /**
4097 return { approved: false };
4098 }
4100 > const options = data.actions.map(actionId => {
4101 > const desc = getPlanActionDescription(actionId);
4102 > return {
4103 > id: actionId,
4104 > label: desc?.label ?? actionId,
4105 > description: desc?.description,
4106 > recommended: actionId === data.recommendedAction,
4107 > };
4108 > });
4109 >
4110 > const actions: IAgentHostPlanReviewAction[] = options.map(option => ({
4111 > id: option.id,
4112 > label: option.label,
4113 > ...(option.description ? { description: option.description } : {}),
4114 > ...(option.recommended ? { default: true } : {}),
4115 > }));
4116 >
4117 > const inputRequest: ChatInputRequestWithPlanReview = {
4118 > id: requestId,
4119 > planReview: {
4120 > title: localize('agentHost.planReview.title', "Review Plan"),
4121 > content: data.summary || localize('agentHost.planReview.fallbackSummary', "A plan is ready for review."),
4122 actions,
4123 canProvideFeedback: true,