agentBranchNameGenerator.ts ×9

Frontier kind: Code frontier

unlabeled · c_b7afb619a560

10 tests · 24402 LOC · 98 files · introduces 0 tests · 25 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges25 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2068 ranges24402 lines · 98 files · Browse complete extent
All tests (intent)
10 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: 25 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/agentBranchNameGenerator.ts 25 introduced LOC · 9 ranges

Open complete file

44
45 constructor(
46 > @ICopilotApiService private readonly _copilotApiService: ICopilotApiService, agentBranchNameGenerator.ts
47 > @ILogService private readonly _logService: ILogService,
48 > ) { }
49
50 async generateBranchName(request: IAgentBranchNameGeneratorRequest): Promise<string> {
51 > const branchNameHint = (await this._generateBranchNameHint(request)) ?? getAgentBranchNameHintFromMessage(request.message ?? ''); agentBranchNameGenerator.ts
52 > return this._buildBranchName(request, branchNameHint);
53 > }
54
55 private async _generateBranchNameHint(request: IAgentBranchNameGeneratorRequest): Promise<string | undefined> {
56 > const message = request.message?.trim(); agentBranchNameGenerator.ts
57 > if (!message || !request.githubToken) {
58 return undefined;
59 }
89 return undefined;
90 }
92
93 private _buildBranchNamePrompt(userRequest: string): ICopilotUtilityChatMessage[] {
113
114 private async _buildBranchName(request: IAgentBranchNameGeneratorRequest, branchNameHint: string | undefined): Promise<string> {
115 > // Prepend the caller-supplied prefix (e.g. `git.branchPrefix`) ahead of agentBranchNameGenerator.ts
116 > // the built-in `agents/` prefix. An empty/omitted value keeps the
117 > // historical `agents/<hint>` shape.
118 > const prefix = `${request.branchPrefix ?? ''}${AGENT_BRANCH_PREFIX}`;
119 >
120 > const branchName = `${prefix}${branchNameHint ?? request.sessionId}`;
121 > const collisionBase = branchNameHint
122 ? `${branchName}-${request.sessionId.substring(0, AGENT_BRANCH_SESSION_ID_SUFFIX_LENGTH)}`
123 : branchName;
124 > for (let candidateIndex = 0; candidateIndex < MAX_BRANCH_NAME_CANDIDATES; candidateIndex++) { agentBranchNameGenerator.ts
125 > const candidate = candidateIndex === 0
126 > ? branchName
127 : branchNameHint && candidateIndex === 1
128 ? collisionBase
129 : `${collisionBase}-${branchNameHint ? candidateIndex : candidateIndex + 1}`;
130 > if (!request.branchNameCollides || !await request.branchNameCollides(candidate)) { agentBranchNameGenerator.ts
131 > return candidate;
132 > }
133 > }
134
135 throw new Error(`Unable to find an available branch name after checking ${MAX_BRANCH_NAME_CANDIDATES} candidates`);
137 }
138