sessionServerTools.ts ×5

Frontier kind: Code frontier

unlabeled · c_c6d1bd6ad9fc

3 tests · 22127 LOC · 87 files · introduces 0 tests · 22 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges22 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1965 ranges22127 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.

1 file ranked by introduced lines: 22 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/sessionServerTools.ts 22 introduced LOC · 5 ranges

Open complete file

585 * session one level deeper so its own `create_session` calls are bounded too.
586 */
587 > export async function applyCreateSessionTool(accessor: ISessionServerToolAccessor, rawArgs: unknown, currentSession?: URI): Promise<ICreateSessionResult> { sessionServerTools.ts
588 > const parentDepth = currentSession ? accessor.getSessionSpawnDepth(currentSession) : 0;
589 > if (parentDepth >= maxSessionSpawnDepth) {
590 throw new Error(`Refusing to create a session: recursion limit reached (max spawn depth ${maxSessionSpawnDepth}). This session was itself created ${parentDepth} level(s) deep.`);
591 }
592 > const sessions = await accessor.listSessions(); sessionServerTools.ts
593 > const args = getCreateSessionArgs(rawArgs, sessions, accessor.getModels());
594 > const config: IAgentCreateSessionConfig = {
595 > workingDirectory: args.workspace,
596 > ...(args.model !== undefined ? { provider: args.model.provider, model: { id: args.model.id } } : {}),
597 > };
598 > const session = await accessor.createSession(config);
599 > accessor.setSessionSpawnDepth(session, parentDepth + 1);
600 > const chat = URI.parse(buildDefaultChatUri(session));
601 > await accessor.startPrompt(session, chat, args.prompt);
602 > return { session: session.toString(), chat: chat.toString(), openLink: buildOpenSessionLinkUri(session) };
603 > }
604
605 /**
610 */
611 export function formatCreateSessionResult(result: ICreateSessionResult): string {
612 > return `Session created (${result.openLink}). Reply with one short sentence confirming the session was created; do not print the URL or mention a button.`; sessionServerTools.ts
613 > }
614
615 interface ICreateChatArgs {
1066 return serializeCurrentSession(currentSessionUri(sessionUri), await accessor.listSessions());
1067 case createSessionToolName: {
1068 > if (createdSessionCount >= maxCreatedSessions) { sessionServerTools.ts
1069 throw new Error(`Refusing to create more than ${maxCreatedSessions} sessions from server tools in this process.`);
1070 }
1071 > const result = await applyCreateSessionTool(accessor, rawArgs, currentSessionUri(sessionUri)); sessionServerTools.ts
1072 > createdSessionCount++;
1073 > return formatCreateSessionResult(result);
1074 > }
1075 case createChatToolName: {
1076 if (createdChatCount >= maxCreatedChats) {