sessionServerTools.ts ×14

Frontier kind: Code frontier

unlabeled · c_230eb7f81bb3

6 tests · 21858 LOC · 87 files · introduces 0 tests · 53 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges53 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1871 ranges21858 lines · 87 files · Browse complete extent
All tests (intent)
6 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 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/sessionServerTools.ts 53 introduced LOC · 14 ranges

Open complete file

332
333 /** Decodes the {@link SessionStatus} bit-flags into readable names for the agent. */
334 > function describeSessionStatusBits(status: SessionStatus): string[] { sessionServerTools.ts
335 > const names: string[] = [];
336 > // `InputNeeded` is a superset of the `InProgress` bit, so it must be matched
337 > // with an exact-bits check before falling back to plain `InProgress`.
338 > if ((status & SessionStatus.InputNeeded) === SessionStatus.InputNeeded) {
339 names.push('inputNeeded');
340 > } else if (status & SessionStatus.InProgress) { sessionServerTools.ts
341 names.push('inProgress');
342 } else if (status & SessionStatus.Idle) {
343 names.push('idle');
344 }
345 > if (status & SessionStatus.Error) { sessionServerTools.ts
346 names.push('error');
347 }
348 > if (status & SessionStatus.IsArchived) { sessionServerTools.ts
349 names.push('archived');
350 }
351 > return names; sessionServerTools.ts
352 > }
353
354 /**
359 * archived through either mechanism.
360 */
361 > function describeSessionStatusNames(session: IAgentSessionMetadata): string[] { sessionServerTools.ts
362 > const names = session.status !== undefined ? describeSessionStatusBits(session.status) : [];
363 > if (sessionIsArchived(session) && !names.includes('archived')) {
364 names.push('archived');
365 }
366 > return names; sessionServerTools.ts
367 > }
368
369 /** Renders a session's status names as the compact string used in tool results. */
370 > function describeSessionStatus(session: IAgentSessionMetadata): string | undefined { sessionServerTools.ts
371 > const names = describeSessionStatusNames(session);
372 > if (names.length > 0) {
373 > return names.join(',');
374 > }
375 > return session.status !== undefined ? 'unknown' : undefined;
376 > }
377
378
512 }
513
514 > function serializeGitState(session: IAgentSessionMetadata): ISerializedGitState | undefined { sessionServerTools.ts
515 > const git = readSessionGitState(session._meta);
516 > if (!git) {
517 return undefined;
518 }
524 if (git.incomingChanges !== undefined) { result.behind = git.incomingChanges; }
525 if (git.uncommittedChanges !== undefined) { result.uncommittedChanges = git.uncommittedChanges; }
526 > return Object.keys(result).length > 0 ? result : undefined; sessionServerTools.ts
527 > }
528
529 > function serializeGitHubState(session: IAgentSessionMetadata): ISerializedGitHubState | undefined { sessionServerTools.ts
530 > const github = readSessionGitHubState(session._meta);
531 > if (!github) {
532 return undefined;
533 }
536 if (github.repo !== undefined) { result.repo = github.repo; }
537 if (github.pullRequestUrl !== undefined) { result.pullRequestUrl = github.pullRequestUrl; }
538 > return Object.keys(result).length > 0 ? result : undefined; sessionServerTools.ts
539 > }
540
541 > function serializeSession(session: IAgentSessionMetadata): ISerializedSession { sessionServerTools.ts
542 > const git = serializeGitState(session);
543 > const github = serializeGitHubState(session);
544 > const status = describeSessionStatus(session);
545 > return {
546 > session: session.session.toString(),
547 > ...(session.summary !== undefined ? { title: session.summary } : {}),
548 > ...(status !== undefined ? { status } : {}),
549 > ...(session.activity !== undefined ? { activity: session.activity } : {}),
550 > ...(session.workingDirectory !== undefined ? { workingDirectory: session.workingDirectory.toString() } : {}),
551 > ...(session.project !== undefined ? { project: session.project.displayName } : {}),
552 > ...(session.isRead === false ? { unread: true } : {}),
553 > ...(session.startTime > 0 ? { createdAt: new Date(session.startTime).toISOString() } : {}),
554 > ...(session.modifiedTime > 0 ? { modifiedAt: new Date(session.modifiedTime).toISOString() } : {}),
555 > ...(session.changes !== undefined ? { changes: session.changes } : {}),
556 > ...(session.changesets !== undefined ? {
557 changesets: session.changesets.map(changeset => ({
558 label: changeset.label,
561 ...(changeset.description !== undefined ? { description: changeset.description } : {}),
562 })),
563 > } : {}), sessionServerTools.ts
564 > ...(git !== undefined ? { git } : {}),
565 > ...(github !== undefined ? { github } : {}),
566 > };
567 > }
568
569 /** Serializes session metadata into the compact tool-result JSON payload. */