copilotAgent.ts ×13

Frontier kind: Code frontier

unlabeled · c_54931fc069ac

24 tests · 51717 LOC · 300 files · introduces 0 tests · 37 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges37 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4994 ranges51717 lines · 300 files · Browse complete extent
All tests (intent)
24 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: 37 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotAgent.ts 37 introduced LOC · 13 ranges

Open complete file

1206
1207 private _createThinkingLevelConfigSchemaProperty(supportedReasoningEfforts: readonly string[] | undefined, defaultReasoningEffort: string | undefined): ConfigPropertySchema | undefined {
1208 > if (!supportedReasoningEfforts?.length) { copilotAgent.ts
1209 return undefined;
1210 }
1219 enumDescriptions: supportedReasoningEfforts.map(value => getReasoningEffortDescription(value) ?? ''),
1220 };
1221 > } copilotAgent.ts
1222
1223 /**
1232 */
1233 private _createContextSizeConfigSchemaProperty(billing: ICAPIModelBilling | undefined): ConfigPropertySchema | undefined {
1234 > const tokenPrices = billing?.tokenPrices; copilotAgent.ts
1235 > const defaultMax = tokenPrices?.contextMax;
1236 > const longContextMax = tokenPrices?.longContext?.contextMax;
1237 > if (!defaultMax || !longContextMax || defaultMax >= longContextMax) {
1238 return undefined;
1239 }
1240
1241 // When both tiers cost the same and the user prefers long context, show only the long-context option as a non-switchable indicator. See microsoft/vscode#322950, microsoft/vscode#323116.
1242 > if (this._isPreferLongContextEnabled() && !hasLongContextSurcharge(billing)) { copilotAgent.ts
1243 return {
1244 type: 'number',
1297 */
1298 private _createModelPickerMeta(modelInfo: ModelInfo, billing: ICAPIModelBilling | undefined): Record<string, unknown> | undefined {
1299 > return createPricingMetaFromBilling(billing, modelInfo.modelPickerPriceCategory, modelInfo.modelPickerCategory); copilotAgent.ts
1300 > }
1301
1302 private _createModelConfigSchema(m: ModelInfo, billing: ICAPIModelBilling | undefined): ConfigSchema | undefined {
1303 > const properties: ConfigSchema['properties'] = {}; copilotAgent.ts
1304 > const thinkingLevel = this._createThinkingLevelConfigSchemaProperty(m.supportedReasoningEfforts, m.defaultReasoningEffort);
1305 > if (thinkingLevel) {
1306 properties[ThinkingLevelConfigKey] = thinkingLevel;
1307 }
1308 > const contextSize = this._createContextSizeConfigSchemaProperty(billing); copilotAgent.ts
1309 > if (contextSize) {
1310 properties[ContextSizeConfigKey] = contextSize;
1311 }
1312 > if (Object.keys(properties).length === 0) { copilotAgent.ts
1313 return undefined;
1314 }
1315 return { type: 'object', properties };
1316 > } copilotAgent.ts
1317
1318 private _serializeModelSelection(model: ModelSelection): string {
1453 const preferLongContext = this._isPreferLongContextEnabled();
1454 const result = models.map((m): IAgentModelInfo => {
1455 > const billing = normalizeCAPIBilling(m.billing); copilotAgent.ts
1456 > const configSchema = this._createModelConfigSchema(m, billing);
1457 > // A model has free long context (larger window, no surcharge), but only treat it as free when the user prefers long context.
1458 > const tokenPrices = billing?.tokenPrices;
1459 > const hasLargerLongContext = !!tokenPrices?.contextMax
1460 && !!tokenPrices.longContext?.contextMax
1461 && tokenPrices.longContext.contextMax > tokenPrices.contextMax;
1462 > if (preferLongContext && hasLargerLongContext && !hasLongContextSurcharge(billing)) { copilotAgent.ts
1463 this._freeLongContextModels.add(m.id);
1464 }
1465 > return { copilotAgent.ts
1466 > provider: this.id,
1467 > id: m.id,
1468 > name: m.name,
1469 > // Synthetic SDK entries like `auto` ship with `capabilities: {}` and
1470 > // no fixed context window — surface them with maxContextWindow undefined.
1471 > maxContextWindow: m.capabilities?.limits?.max_context_window_tokens,
1472 > maxOutputTokens: m.capabilities?.limits?.max_output_tokens,
1473 > maxPromptTokens: m.capabilities?.limits?.max_prompt_tokens,
1474 > supportsVision: !!m.capabilities?.supports?.vision,
1475 > configSchema,
1476 > policyState: m.policy?.state as PolicyState | undefined,
1477 > _meta: this._createModelPickerMeta(m, billing),
1478 > };
1479 });
1480 this._logService.info(`[Copilot] Found ${result.length} models: ${result.map(m => m.name).join(', ')}`);