agentSideEffects.ts ×5

Frontier kind: Code frontier

unlabeled · c_6655d59d3c6b

89 tests · 42519 LOC · 237 files · introduces 0 tests · 64 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges64 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4031 ranges42519 lines · 237 files · Browse complete extent
All tests (intent)
89 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.

4 files ranked by introduced lines: 64 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentSideEffects.ts 34 introduced LOC · 5 ranges

Open complete file

1511
1512 private _getTurnTelemetryContext(agent: IAgent, state: SessionState | undefined, modelId: string | undefined): { model: string | undefined; modelTelemetryKind: AgentHostModelTelemetryKind | undefined; permissionLevel: string | undefined } {
1513 > const permissionValue = state?.config?.values[SessionConfigKey.AutoApprove]; agentSideEffects.ts
1514 > const permissionLevel = typeof permissionValue === 'string' ? permissionValue : undefined;
1515 > const model = modelId === undefined ? undefined : agent.models.get().find(model => model.id === modelId);
1516 > let modelTelemetryKind: AgentHostModelTelemetryKind | undefined;
1517 > if (modelId === 'auto') {
1518 modelTelemetryKind = 'trusted';
1519 > } else if (modelId === undefined) { agentSideEffects.ts
1520 modelTelemetryKind = undefined;
1521 } else if (model === undefined) {
1524 modelTelemetryKind = readAgentModelByokIdentifier(model) === undefined ? 'trusted' : 'byok';
1525 }
1526 > return { model: modelId, modelTelemetryKind, permissionLevel }; agentSideEffects.ts
1527 > }
1528
1529 /**
1535 */
1536 private async _sendTurnMessage(options: {
1537 > agent: IAgent; agentSideEffects.ts
1538 > /** The agent/session URI the chat lives on (the send target). */
1539 > sessionChannel: ProtocolURI;
1540 > /** The channel the turn runs on — where `ChatError` / turn completion are reported. */
1541 > turnChannel: ProtocolURI;
1542 > /** Chat channel URI the turn targets. */
1543 > chat: ProtocolURI;
1544 > message: Message;
1545 > turnId: string;
1546 > senderClientId: string | undefined;
1547 > turnStopWatch: StopWatch;
1548 > }): Promise<void> {
1549 > const { agent, sessionChannel, turnChannel, chat, message, turnId, senderClientId, turnStopWatch } = options;
1550 >
1551 > // Read-only chats reject user-dispatched turns. `interactivity` is the
1552 > // general signal (e.g. subagent worker chats are `ReadOnly`), and an
1553 > // archived session downgrades its interactive chats to read-only too — so
1554 > // enforce off the chat's effective interactivity rather than special-casing
1555 > // archived. This is the enforcement behind the UI hiding the composer, so a
1556 > // buggy or remote client cannot run work in a read-only or archived session
1557 > // (which may no longer have its isolated worktree on disk).
1558 > const chatState = this._stateManager.getChatState(chat);
1559 > const sessionStatus = this._stateManager.getSessionSummary(options.sessionChannel)?.status ?? 0;
1560 > const sessionArchived = (sessionStatus & SessionStatus.IsArchived) === SessionStatus.IsArchived;
1561 > if (isChatReadOnly(chatState?.interactivity, sessionArchived)) {
1562 const error = sessionArchived
1563 ? { errorType: 'archived', message: 'This session is archived and read-only. Restore the session to continue the conversation.' }
1614 this._failSessionCreationIfStillCreating(sessionChannel, error);
1615 }
1617
1618 private async _resolveChatAttachments(sessionChannel: ProtocolURI, attachments: readonly MessageAttachment[] | undefined): Promise<readonly MessageAttachment[] | undefined> {
src/vs/platform/agentHost/node/agentHostTelemetryReporter.ts 14 introduced LOC · 2 ranges

Open complete file

262
263 userMessageSent(provider: string, session: string, sessionState: ISessionWithDefaultChat | undefined, source: AgentHostUserMessageSentSource, attachments: readonly MessageAttachment[] | undefined): void {
264 > const attachmentCount = attachments?.length ?? 0; agentHostTelemetryReporter.ts
265 > const activeClients = sessionState?.activeClients ?? [];
266 > const sessionUri = isAhpChatChannel(session) ? parseRequiredSessionUriFromChatUri(session) : session;
267 > this._telemetryService.publicLog2<IAgentHostUserMessageSentEvent, IAgentHostUserMessageSentClassification>('agentHost.userMessageSent', {
268 > provider,
269 > agentSessionId: AgentSession.id(sessionUri),
270 > source,
271 > isSubagentSession: isSubagentSession(sessionUri),
272 > turnCount: sessionState?.turns.length ?? 0,
273 > ...(activeClients.length > 0 ? {
274 activeClientId: activeClients[0].clientId,
275 activeClientToolCount: activeClients.reduce((sum, client) => sum + client.tools.length, 0),
276 activeClientCustomizationCount: activeClients.reduce((sum, client) => sum + (client.customizations?.length ?? 0), 0),
278 > attachmentCount,
279 > });
280 > }
281
282 /**
src/vs/platform/agentHost/node/agentHostTurnTracker.ts 11 introduced LOC · 1 range

Open complete file

35
36 turnStarted(provider: string, session: string, turnId: string, model: string | undefined, modelTelemetryKind: AgentHostModelTelemetryKind | undefined, permissionLevel: string | undefined): void {
37 > const key = this._key(session, turnId); agentHostTurnTracker.ts
38 > this._turnTimings.set(key, {
39 > stopWatch: StopWatch.create(false),
40 > provider,
41 > session,
42 > model,
43 > modelTelemetryKind,
44 > permissionLevel,
45 > firstProgressMs: undefined,
46 > });
47 > }
48
49 markFirstProgress(session: string, turnId: string): void {
src/vs/platform/agentHost/common/state/sessionState.ts 5 introduced LOC · 4 ranges

Open complete file

763 */
764 export function effectiveChatInteractivity(interactivity: ChatInteractivity | undefined, sessionArchived: boolean): ChatInteractivity {
765 > if (interactivity === ChatInteractivity.Hidden) { sessionState.ts
766 return ChatInteractivity.Hidden;
767 }
768 > if (sessionArchived) { sessionState.ts
769 return ChatInteractivity.ReadOnly;
770 }
771 return interactivity ?? ChatInteractivity.Full;
772 > } sessionState.ts
773
774 /**
778 */
779 export function isChatReadOnly(interactivity: ChatInteractivity | undefined, sessionArchived: boolean): boolean {
780 > return effectiveChatInteractivity(interactivity, sessionArchived) === ChatInteractivity.ReadOnly; sessionState.ts
781 > }
782
783 export function createActiveTurn(id: string, message: Message, startedAt: string): ActiveTurn {