copilotAgentSession.ts ×67

Frontier kind: Code frontier

unlabeled · c_16db53276427

257 tests · 43469 LOC · 242 files · introduces 0 tests · 355 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
114 ranges355 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3948 ranges43469 lines · 242 files · Browse complete extent
All tests (intent)
257 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.

2 files ranked by introduced lines: 355 introduced LOC across 114 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts 261 introduced LOC · 67 ranges

Open complete file

1293 async initializeSession(): Promise<void> {
1294 const wrapper = await this._sessionLauncher.launch(this._launchPlan, this._createRuntimeAdapter());
1295 > // The session may have been disposed while we were awaiting the copilotAgentSession.ts
1296 > // launcher. If so, dispose the freshly-created wrapper and
1297 > // skip subscribing — registering on a disposed store would leak.
1298 > if (this._store.isDisposed) {
1299 wrapper.dispose();
1300 throw new CancellationError();
1301 }
1302 > this._wrapper = this._register(wrapper); copilotAgentSession.ts
1303 > this._subscribeToEvents();
1304 > this._subscribeForLogging();
1305 > this._subscribeForMemoInvalidation();
1306 > this._subscribeForInstructionsCollectedTelemetry();
1307 > this._subscribeToPermissionConfigChanges();
1308 >
1309 > // Advertise the agent host's server tools for this session so clients
1310 > // see them as server-provided. Execution happens in-process via the SDK
1311 > // tool handlers built in `_createServerSdkTools`.
1312 this._serverToolHost?.advertise(this._storageUri.toString());
1313 }
2453
2454 private _subscribeToPermissionConfigChanges(): void {
2455 > this._register(this._configurationService.onDidRootConfigChange(() => { copilotAgentSession.ts
2456 void this._syncPermissionModeAfterConfigChange();
2458 > this._register(this._configurationService.onDidSessionConfigChange(event => {
2459 if (event.session === this._storageUri.toString() && Object.hasOwn(event.config, SessionConfigKey.AutoApprove)) {
2460 void this._syncPermissionModeAfterConfigChange();
2461 }
2463 > }
2464
2465 private async _syncPermissionModeAfterConfigChange(): Promise<void> {
3066
3067 private _subscribeToEvents(): void {
3068 > const wrapper = this._wrapper; copilotAgentSession.ts
3069 > const sessionId = this.sessionId;
3070 >
3071 > this._register(wrapper.onSystemNotification(e => {
3072 const notification = buildCopilotSystemNotification(e);
3073 if (!notification) {
3104 },
3105 });
3107 >
3108 > // Handle `user.message` events with three responsibilities:
3109 > //
3110 > // 1. Skip subagent and SDK-injected (`source !== 'user'`) messages
3111 > // outright — neither represents a root user turn and neither may
3112 > // be associated with the root turn boundary.
3113 > //
3114 > // 2. If the content matches a steering message we acknowledged
3115 > // via {@link sendSteering}, promote it to its own protocol
3116 > // turn (closing the in-flight turn) BEFORE step 3 so the
3117 > // event id is recorded against the new steering turn rather
3118 > // than the preempted one.
3119 > //
3120 > // 3. Record the SDK event id against the current turn so the
3121 > // `history.truncate` / `sessions.fork` RPCs can target the
3122 > // right boundary. The DB only sets `event_id` when it's NULL,
3123 > // so doing this for synthetic injections would permanently
3124 > // pin the wrong event to the turn.
3125 > this._register(wrapper.onUserMessage(e => {
3126 if (e.agentId || (e.data.source && e.data.source.toLowerCase() !== 'user')) {
3127 return;
3136 this._databaseRef.object.setTurnEventId(this._turnId, e.id);
3137 }
3139 >
3140 > this._register(wrapper.onMessageDelta(e => {
3141 this._logService.trace(`[Copilot:${sessionId}] delta: ${e.data.deltaContent}`);
3142 if (this._shouldDropUnmappedSubagentEvent(e, 'assistant.message_delta')) {
3144 }
3145 this._emitMarkdownDelta(e.data.deltaContent, this._parentToolCallIdForSubagentEvent(e));
3147 >
3148 > this._register(wrapper.onMessage(e => {
3149 this._logService.info(`[Copilot:${sessionId}] Full message received: ${e.data.content.length} chars`);
3150 // Report the enhanced GH `request.options.tools` event for this model call — parity with
3207 part: { kind: ResponsePartKind.Markdown, id: partId, content: e.data.content },
3208 }, parentToolCallId);
3210 >
3211 > // TODO@connor4312: Remove this correlation once the SDK permission callback includes auto-approval data.
3212 > this._register(wrapper.onPermissionRequested(e => {
3213 const toolCallId = e.data.permissionRequest.toolCallId;
3214 if (toolCallId) {
3215 this._recordAutoApproval(toolCallId, e.data.promptRequest?.autoApproval);
3216 }
3218 >
3219 > this._register(wrapper.onToolStart(e => {
3220 if (isHiddenTool(e.data.toolName)) {
3221 this._logService.trace(`[Copilot:${sessionId}] Tool started (hidden): ${e.data.toolName}`);
3364 ...(clientToolAutoApproved ? { _meta: toToolCallMeta({ autoApproveBySetting: true }) } : {}),
3365 }, parentToolCallId);
3367 >
3368 > this._register(wrapper.onToolComplete(async e => {
3369 this._approvedDuplicablePermissionSignatures.delete(e.data.toolCallId);
3370 const tracked = this._activeToolCalls.get(e.data.toolCallId);
3466 this._nonPtyShellTerminals.retire(e.data.toolCallId);
3467 }
3469 >
3470 > this._register(wrapper.onIdle(e => {
3471 this._logService.info(`[Copilot:${sessionId}] Session idle`);
3472 if (this._hasActivity) {
3510 this._completeActiveRepoInfoTelemetry();
3511 this._completeActiveTurn();
3513 >
3514 > // The SDK emits a `skill` tool call (which we hide) and a richer
3515 > // `skill.invoked` event with the resolved SKILL.md path. Synthesize a
3516 > // tool-start/complete pair from the latter so the UI can render a
3517 > // clickable file link, matching the `view`-tool display style.
3518 > this._register(wrapper.onSkillInvoked(e => {
3519 this._logService.info(`[Copilot:${sessionId}] Skill invoked: ${e.data.name} (${e.data.path})`);
3520 if (this._shouldDropUnmappedSubagentEvent(e, 'skill.invoked')) {
3557 },
3558 }, parentToolCallId);
3560 >
3561 > this._register(wrapper.onSubagentStarted(e => {
3562 if (e.agentId) {
3563 this._parentToolCallIdsByAgentId.set(e.agentId, e.data.toolCallId);
3587 parentToolCallId: tracked?.parentToolCallId,
3588 });
3590 >
3591 > this._register(wrapper.onSessionError(e => {
3592 this._logService.error(`[Copilot:${sessionId}] Session error: ${e.data.errorType} - ${e.data.message}`);
3593 // Prefer the structured SDK fields (the Copilot CLI classifies its own
3605 },
3606 });
3608 >
3609 > // Tracks the last parent-scope usage so the async attribution enrichment
3610 > // can re-emit a complete action (with accumulated credits, quota, etc.).
3611 > let lastParentUsage: UsageInfo | undefined;
3612 > let lastParentUsageTurnId: string | undefined;
3613 > let autoModeResolved: { readonly turnId: string; readonly data: NonNullable<UsageInfoMeta['autoModeResolved']> } | undefined;
3614 >
3615 > this._register(wrapper.onAutoModeResolved(e => {
3616 this._lastSeenModelId = e.data.chosenModel;
3617 const turnId = this._turnId;
3637 usage,
3638 });
3640 >
3641 > this._register(wrapper.onUsage(e => {
3642 // Usage events for a subagent's model calls carry the subagent's
3643 // `agentId`. Such an event is reported twice:
3735 }, parentToolCallId);
3736 }
3738 >
3739 > // After each usage event, asynchronously fetch the per-source context-
3740 > // window attribution from the SDK and re-emit the usage action enriched
3741 > // with the attribution data. The reducer replaces `activeTurn.usage` so
3742 > // the widget picks up the detailed breakdown on the next render cycle.
3743 > this._register(wrapper.onUsage(async e => {
3744 // Only enrich the parent-turn aggregate (not subagent scopes).
3745 if (this._parentToolCallIdForSubagentEvent(e)) {
3795 this._logService.trace(`[Copilot:${sessionId}] contextAttribution RPC failed: ${(err as Error)?.message ?? err}`);
3796 }
3798 >
3799 > this._register(wrapper.onReasoningDelta(e => {
3800 this._logService.trace(`[Copilot:${sessionId}] Reasoning delta: ${e.data.deltaContent.length} chars`);
3801 if (this._shouldDropUnmappedSubagentEvent(e, 'assistant.reasoning_delta')) {
3803 }
3804 this._emitReasoningDelta(e.data.deltaContent, this._parentToolCallIdForSubagentEvent(e));
3806 >
3807 > // Sync the AHP session config when the SDK's `currentMode` changes
3808 > // (e.g. after the model approves a plan, or after we set the mode
3809 > // before sending). The SDK and AHP share the same three modes
3810 > // (`interactive` / `plan` / `autopilot`), so we map directly.
3811 > this._register(wrapper.onSessionModeChanged(e => {
3812 // Sub-agents (e.g. a `task` tool sub-agent running in plan mode)
3813 // emit their own `session.mode_changed` events carrying an
3824 this._lastAppliedMode = newMode;
3825 this._syncAhpConfigFromSdkMode(newMode);
3827 >
3828 > // Translate SDK-reported MCP server lifecycle into AHP customization
3829 > // actions. The controller decides whether each server is a
3830 > // plugin-derived child (narrow `SessionMcpServerStateChanged`) or a
3831 > // bare top-level entry (`SessionCustomizationUpdated`). Each state
3832 > // change is also logged (with structured metadata) so it flows to the
3833 > // agent host's OTLP log stream and the per-server Output channels.
3834 > this._register(wrapper.onMcpServersLoaded(e => {
3835 this._logMcpServersSnapshot(e.data.servers.map((s: McpServersLoadedServer) => ({
3836 name: s.name,
3843 })), 'loaded');
3844 this._applyMcpServerList(e.data.servers);
3846 > this._register(wrapper.onMcpServerStatusChanged(e => {
3847 this._logMcpServerLifecycle({ name: e.data.serverName, status: e.data.status, error: e.data.error, origin: 'statusChanged' });
3848 const server = this._toSdkMcpServer(e.data.serverName, e.data.status, e.data.error);
3852 }
3853 this._mcpCustomizations.applyOne(server);
3855 >
3856 > this._register(wrapper.onToolsUpdated(() => {
3857 this._slashCommandProvider.clearCache();
3858 this._fireMcpToolsListChanged();
3860 > this._register(wrapper.onCommandsChanged(() => {
3861 this._slashCommandProvider.clearCache();
3863 >
3864 > // Seed the inventory with any servers the SDK has already loaded by
3865 > // the time we attach. The `session.mcp_servers_loaded` event may
3866 > // have fired before our subscription (e.g. for restored sessions or
3867 > // when servers are configured at session-creation time), and there
3868 > // is no replay. Subsequent `applyAll` calls from the event are
3869 > // idempotent, so this safely converges either way.
3870 > this._seedMcpServersFromRpc();
3871 > }
3872
3873 /**
3877 */
3878 private _seedMcpServersFromRpc(): void {
3879 > this._refreshMcpServersFromRpc().catch(err => { copilotAgentSession.ts
3880 this._logService.warn(`[Copilot:${this.sessionId}] Failed to seed MCP server inventory`, err);
3882 > }
3883
3884 private async _refreshMcpServersFromRpc(): Promise<void> {
3885 > const mcpRpc = this._wrapper.session.rpc?.mcp; copilotAgentSession.ts
3886 > if (!mcpRpc) {
3887 return;
3888 }
3899 this._applyMcpServerList(result.servers);
3900 }
3902
3903 private _applyMcpServerList(servers: readonly { readonly name: string; readonly status: SdkMcpServerStatus; readonly error?: string }[]): void {
4169 */
4170 private _subscribeForMemoInvalidation(): void {
4171 > const wrapper = this._wrapper; copilotAgentSession.ts
4172 > const invalidate = () => this._invalidateMappedEvents();
4173 > // New content appended to the log.
4174 > this._register(wrapper.onUserMessage(invalidate));
4175 > this._register(wrapper.onTurnStart(invalidate));
4176 > this._register(wrapper.onMessage(invalidate));
4177 > this._register(wrapper.onToolStart(invalidate));
4178 > this._register(wrapper.onToolComplete(invalidate));
4179 > this._register(wrapper.onSubagentStarted(invalidate));
4180 > this._register(wrapper.onSubagentCompleted(invalidate));
4181 > this._register(wrapper.onSubagentFailed(invalidate));
4182 > this._register(wrapper.onTurnEnd(invalidate));
4183 > // In-place rewrites of the persisted log.
4184 > this._register(wrapper.onSessionCompactionComplete(invalidate));
4185 > this._register(wrapper.onSessionTruncation(invalidate));
4186 > this._register(wrapper.onSessionSnapshotRewind(invalidate));
4187 > }
4188
4189 /**
4193 */
4194 private _subscribeForInstructionsCollectedTelemetry(): void {
4195 > const wrapper = this._wrapper; copilotAgentSession.ts
4196 > const sessionId = this.sessionId;
4197 >
4198 > this._register(wrapper.onUserMessage(e => {
4199 // Skip subagent and SDK-injected messages (matches guard on this event above).
4200 if (e.agentId || (e.data.source && e.data.source.toLowerCase() !== 'user')) {
4271 this._logService.trace(`[Copilot:${sessionId}] instructionsCollected telemetry failed: ${getErrorMessage(err)}`);
4272 });
4274 > }
4275
4276 private _subscribeForLogging(): void {
4277 > const wrapper = this._wrapper; copilotAgentSession.ts
4278 > const sessionId = this.sessionId;
4279 >
4280 > this._register(wrapper.onUnhandledEvent(e => {
4281 this._logService.trace(`[Copilot:${sessionId}] Unhandled SDK event: ${safeStringify(e)}`);
4283 >
4284 > this._register(wrapper.onSessionStart(e => {
4285 this._logService.trace(`[Copilot:${sessionId}] Session started: model=${e.data.selectedModel ?? 'default'}, producer=${e.data.producer}`);
4287 >
4288 > this._register(wrapper.onSessionResume(e => {
4289 this._logService.trace(`[Copilot:${sessionId}] Session resumed: eventCount=${e.data.eventCount}`);
4291 >
4292 > this._register(wrapper.onSessionInfo(e => {
4293 const attributes: Record<string, OtelAttributeValue> = { infoType: e.data.infoType };
4294 if (e.data.tip) {
4302 this._logService.trace(message, otelData);
4303 }
4305 >
4306 > this._register(wrapper.onSessionWarning(e => {
4307 this._logService.warn(`[Copilot:${sessionId}] ${e.data.message}`, new OtelData({ warningType: e.data.warningType }));
4309 >
4310 > this._register(wrapper.onSessionModelChange(e => {
4311 this._logService.trace(`[Copilot:${sessionId}] Model changed: ${e.data.previousModel ?? '(none)'} -> ${e.data.newModel}`);
4313 >
4314 > this._register(wrapper.onManagedSettingsResolved(e => {
4315 this._logService.info(`[Copilot:${sessionId}] Managed settings resolved: source=${e.data.source}, managedKeys=${e.data.managedKeys.join(',') || '(none)'}, bypassPermissionsDisabled=${e.data.bypassPermissionsDisabled}, failClosed=${e.data.failClosed}`);
4317 >
4318 > this._register(wrapper.onManagedSettingsEnforced(e => {
4319 this._logService.warn(`[Copilot:${sessionId}] Managed settings enforced: action=${e.data.action}, setting=${e.data.setting}, escalation=${e.data.escalation ?? '(none)'}, failClosed=${e.data.failClosed}, message=${e.data.message}`);
4321 >
4322 > this._register(wrapper.onSessionHandoff(e => {
4323 this._logService.trace(`[Copilot:${sessionId}] Session handoff: sourceType=${e.data.sourceType}, remoteSessionId=${e.data.remoteSessionId ?? '(none)'}`);
4325 >
4326 > this._register(wrapper.onSessionTruncation(e => {
4327 this._logService.trace(`[Copilot:${sessionId}] Session truncation: removed ${e.data.tokensRemovedDuringTruncation} tokens, ${e.data.messagesRemovedDuringTruncation} messages`);
4329 >
4330 > this._register(wrapper.onSessionSnapshotRewind(e => {
4331 this._logService.trace(`[Copilot:${sessionId}] Snapshot rewind: upTo=${e.data.upToEventId}, eventsRemoved=${e.data.eventsRemoved}`);
4333 >
4334 > this._register(wrapper.onSessionShutdown(e => {
4335 this._logService.trace(`[Copilot:${sessionId}] Session shutdown: type=${e.data.shutdownType}, apiDuration=${e.data.totalApiDurationMs}ms`);
4337 >
4338 > this._register(wrapper.onSessionUsageInfo(e => {
4339 this._logService.trace(`[Copilot:${sessionId}] Usage info: ${e.data.currentTokens}/${e.data.tokenLimit} tokens, ${e.data.messagesLength} messages`);
4341 >
4342 > this._register(wrapper.onSessionCompactionStart(() => {
4343 this._logService.trace(`[Copilot:${sessionId}] Compaction started`);
4345 >
4346 > this._register(wrapper.onSessionCompactionComplete(e => {
4347 this._logService.trace(`[Copilot:${sessionId}] Compaction complete: success=${e.data.success}, tokensRemoved=${e.data.tokensRemoved ?? '?'}`);
4349 >
4350 > this._register(wrapper.onUserMessage(e => {
4351 this._logService.trace(`[Copilot:${sessionId}] User message: ${e.data.content.length} chars, ${e.data.attachments?.length ?? 0} attachments`);
4352 // Restricted `conversation.messageText` (source=user): the raw user prompt text. Emit only
4357 this._telemetryReporter.userMessageText(this.sessionUri.toString(), e.data.content, this._turnOrdinal);
4358 }
4360 >
4361 > this._register(wrapper.onPendingMessagesModified(() => {
4362 this._logService.trace(`[Copilot:${sessionId}] Pending messages modified`);
4364 >
4365 > this._register(wrapper.onTurnStart(e => {
4366 this._currentTurn?.markRunning();
4367 this._logService.trace(`[Copilot:${sessionId}] Turn started: ${e.data.turnId}`);
4381 this._activeRepoInfoTurn = turn;
4382 }
4384 >
4385 > this._register(wrapper.onIntent(e => {
4386 this._logService.trace(`[Copilot:${sessionId}] Intent: ${e.data.intent}`);
4387 const activity = e.data.intent || undefined;
4394 activity,
4395 });
4397 >
4398 > this._register(wrapper.onReasoning(e => {
4399 this._logService.trace(`[Copilot:${sessionId}] Reasoning: ${e.data.content.length} chars`);
4401 >
4402 > this._register(wrapper.onTurnEnd(e => {
4403 this._logService.trace(`[Copilot:${sessionId}] Turn ended: ${e.data.turnId}`);
4405 >
4406 > this._register(wrapper.onAbort(e => {
4407 this._logService.trace(`[Copilot:${sessionId}] Aborted: ${e.data.reason}`);
4408 this._cancelActiveRepoInfoTelemetry();
4410 >
4411 > this._register(wrapper.onToolUserRequested(e => {
4412 this._logService.trace(`[Copilot:${sessionId}] Tool user-requested: ${e.data.toolName} (${e.data.toolCallId})`);
4414 >
4415 > this._register(wrapper.onToolPartialResult(e => {
4416 this._logService.trace(`[Copilot:${sessionId}] Tool partial result: ${e.data.toolCallId} (${e.data.partialOutput.length} chars)`);
4417 const tracked = this._activeToolCalls.get(e.data.toolCallId);
4439 }, tracked.parentToolCallId);
4440 }
4442 >
4443 > this._register(wrapper.onToolProgress(e => {
4444 this._logService.trace(`[Copilot:${sessionId}] Tool progress: ${e.data.toolCallId} - ${e.data.progressMessage}`);
4446 >
4447 > this._register(wrapper.onSkillInvoked(e => {
4448 this._logService.trace(`[Copilot:${sessionId}] Skill invoked: ${e.data.name} (${e.data.path})`);
4450 >
4451 > this._register(wrapper.onSubagentStarted(e => {
4452 this._logService.trace(`[Copilot:${sessionId}] Subagent started: ${e.data.agentName} (${e.data.agentDisplayName})`);
4454 >
4455 > this._register(wrapper.onSubagentCompleted(e => {
4456 if (e.agentId) {
4457 this._parentToolCallIdsByAgentId.delete(e.agentId);
4463 toolCallId: e.data.toolCallId,
4464 });
4466 >
4467 > this._register(wrapper.onSubagentFailed(e => {
4468 if (e.agentId) {
4469 this._parentToolCallIdsByAgentId.delete(e.agentId);
4475 toolCallId: e.data.toolCallId,
4476 });
4478 >
4479 > this._register(wrapper.onSubagentSelected(e => {
4480 this._logService.trace(`[Copilot:${sessionId}] Subagent selected: ${e.data.agentName}`);
4482 >
4483 > this._register(wrapper.onHookStart(e => {
4484 this._logService.trace(`[Copilot:${sessionId}] Hook started: ${e.data.hookType} (${e.data.hookInvocationId})`);
4486 >
4487 > this._register(wrapper.onHookEnd(e => {
4488 this._logService.trace(`[Copilot:${sessionId}] Hook ended: ${e.data.hookType} (${e.data.hookInvocationId}), success=${e.data.success}`);
4490 >
4491 > this._register(wrapper.onSystemMessage(e => {
4492 this._logService.trace(`[Copilot:${sessionId}] System message [${e.data.role}]: ${e.data.content.length} chars`);
4494 > }
4495
4496 // ---- SDK event ID tracking & truncation ---------------------------------
src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts 94 introduced LOC · 47 ranges

Open complete file

36 private _onMessageDelta: Event<SessionEventPayload<'assistant.message_delta'>> | undefined;
37 get onMessageDelta(): Event<SessionEventPayload<'assistant.message_delta'>> {
38 > return this._onMessageDelta ??= this._sdkEvent('assistant.message_delta'); copilotSessionWrapper.ts
39 > }
40
41 private _onMessage: Event<SessionEventPayload<'assistant.message'>> | undefined;
42 get onMessage(): Event<SessionEventPayload<'assistant.message'>> {
43 > return this._onMessage ??= this._sdkEvent('assistant.message'); copilotSessionWrapper.ts
44 > }
45
46 private _onToolStart: Event<SessionEventPayload<'tool.execution_start'>> | undefined;
47 get onToolStart(): Event<SessionEventPayload<'tool.execution_start'>> {
48 > return this._onToolStart ??= this._sdkEvent('tool.execution_start'); copilotSessionWrapper.ts
49 > }
50
51 private _onToolComplete: Event<SessionEventPayload<'tool.execution_complete'>> | undefined;
52 get onToolComplete(): Event<SessionEventPayload<'tool.execution_complete'>> {
53 > return this._onToolComplete ??= this._sdkEvent('tool.execution_complete'); copilotSessionWrapper.ts
54 > }
55
56 private _onPermissionRequested: Event<SessionEventPayload<'permission.requested'>> | undefined;
57 get onPermissionRequested(): Event<SessionEventPayload<'permission.requested'>> {
58 > return this._onPermissionRequested ??= this._sdkEvent('permission.requested'); copilotSessionWrapper.ts
59 > }
60
61 private _onIdle: Event<SessionEventPayload<'session.idle'>> | undefined;
62 get onIdle(): Event<SessionEventPayload<'session.idle'>> {
63 > return this._onIdle ??= this._sdkEvent('session.idle'); copilotSessionWrapper.ts
64 > }
65
66 private _onSessionStart: Event<SessionEventPayload<'session.start'>> | undefined;
67 get onSessionStart(): Event<SessionEventPayload<'session.start'>> {
68 > return this._onSessionStart ??= this._sdkEvent('session.start'); copilotSessionWrapper.ts
69 > }
70
71 private _onSessionResume: Event<SessionEventPayload<'session.resume'>> | undefined;
72 get onSessionResume(): Event<SessionEventPayload<'session.resume'>> {
73 > return this._onSessionResume ??= this._sdkEvent('session.resume'); copilotSessionWrapper.ts
74 > }
75
76 private _onSessionError: Event<SessionEventPayload<'session.error'>> | undefined;
77 get onSessionError(): Event<SessionEventPayload<'session.error'>> {
78 > return this._onSessionError ??= this._sdkEvent('session.error'); copilotSessionWrapper.ts
79 > }
80
81 private _onSessionInfo: Event<SessionEventPayload<'session.info'>> | undefined;
82 get onSessionInfo(): Event<SessionEventPayload<'session.info'>> {
83 > return this._onSessionInfo ??= this._sdkEvent('session.info'); copilotSessionWrapper.ts
84 > }
85
86 private _onSessionWarning: Event<SessionEventPayload<'session.warning'>> | undefined;
87 get onSessionWarning(): Event<SessionEventPayload<'session.warning'>> {
88 > return this._onSessionWarning ??= this._sdkEvent('session.warning'); copilotSessionWrapper.ts
89 > }
90
91 private _onSessionModelChange: Event<SessionEventPayload<'session.model_change'>> | undefined;
92 get onSessionModelChange(): Event<SessionEventPayload<'session.model_change'>> {
93 > return this._onSessionModelChange ??= this._sdkEvent('session.model_change'); copilotSessionWrapper.ts
94 > }
95
96 private _onAutoModeResolved: Event<SessionEventPayload<'session.auto_mode_resolved'>> | undefined;
97 get onAutoModeResolved(): Event<SessionEventPayload<'session.auto_mode_resolved'>> {
98 > return this._onAutoModeResolved ??= this._sdkEvent('session.auto_mode_resolved'); copilotSessionWrapper.ts
99 > }
100
101 private _onManagedSettingsResolved: Event<SessionEventPayload<'session.managed_settings_resolved'>> | undefined;
102 get onManagedSettingsResolved(): Event<SessionEventPayload<'session.managed_settings_resolved'>> {
103 > return this._onManagedSettingsResolved ??= this._sdkEvent('session.managed_settings_resolved'); copilotSessionWrapper.ts
104 > }
105
106 private _onManagedSettingsEnforced: Event<SessionEventPayload<'session.managed_settings_enforced'>> | undefined;
107 get onManagedSettingsEnforced(): Event<SessionEventPayload<'session.managed_settings_enforced'>> {
108 > return this._onManagedSettingsEnforced ??= this._sdkEvent('session.managed_settings_enforced'); copilotSessionWrapper.ts
109 > }
110
111 private _onSessionHandoff: Event<SessionEventPayload<'session.handoff'>> | undefined;
112 get onSessionHandoff(): Event<SessionEventPayload<'session.handoff'>> {
113 > return this._onSessionHandoff ??= this._sdkEvent('session.handoff'); copilotSessionWrapper.ts
114 > }
115
116 private _onSessionTruncation: Event<SessionEventPayload<'session.truncation'>> | undefined;
117 get onSessionTruncation(): Event<SessionEventPayload<'session.truncation'>> {
118 > return this._onSessionTruncation ??= this._sdkEvent('session.truncation'); copilotSessionWrapper.ts
119 > }
120
121 private _onSessionSnapshotRewind: Event<SessionEventPayload<'session.snapshot_rewind'>> | undefined;
122 get onSessionSnapshotRewind(): Event<SessionEventPayload<'session.snapshot_rewind'>> {
123 > return this._onSessionSnapshotRewind ??= this._sdkEvent('session.snapshot_rewind'); copilotSessionWrapper.ts
124 > }
125
126 private _onSessionShutdown: Event<SessionEventPayload<'session.shutdown'>> | undefined;
127 get onSessionShutdown(): Event<SessionEventPayload<'session.shutdown'>> {
128 > return this._onSessionShutdown ??= this._sdkEvent('session.shutdown'); copilotSessionWrapper.ts
129 > }
130
131 private _onSessionUsageInfo: Event<SessionEventPayload<'session.usage_info'>> | undefined;
132 get onSessionUsageInfo(): Event<SessionEventPayload<'session.usage_info'>> {
133 > return this._onSessionUsageInfo ??= this._sdkEvent('session.usage_info'); copilotSessionWrapper.ts
134 > }
135
136 private _onSessionCompactionStart: Event<SessionEventPayload<'session.compaction_start'>> | undefined;
141 private _onSessionCompactionComplete: Event<SessionEventPayload<'session.compaction_complete'>> | undefined;
142 get onSessionCompactionComplete(): Event<SessionEventPayload<'session.compaction_complete'>> {
143 > return this._onSessionCompactionComplete ??= this._sdkEvent('session.compaction_complete'); copilotSessionWrapper.ts
144 > }
145
146 private _onUserMessage: Event<SessionEventPayload<'user.message'>> | undefined;
147 get onUserMessage(): Event<SessionEventPayload<'user.message'>> {
148 > return this._onUserMessage ??= this._sdkEvent('user.message'); copilotSessionWrapper.ts
149 > }
150
151 private _onPendingMessagesModified: Event<SessionEventPayload<'pending_messages.modified'>> | undefined;
152 get onPendingMessagesModified(): Event<SessionEventPayload<'pending_messages.modified'>> {
153 > return this._onPendingMessagesModified ??= this._sdkEvent('pending_messages.modified'); copilotSessionWrapper.ts
154 > }
155
156 private _onTurnStart: Event<SessionEventPayload<'assistant.turn_start'>> | undefined;
157 get onTurnStart(): Event<SessionEventPayload<'assistant.turn_start'>> {
158 > return this._onTurnStart ??= this._sdkEvent('assistant.turn_start'); copilotSessionWrapper.ts
159 > }
160
161 private _onIntent: Event<SessionEventPayload<'assistant.intent'>> | undefined;
162 get onIntent(): Event<SessionEventPayload<'assistant.intent'>> {
163 > return this._onIntent ??= this._sdkEvent('assistant.intent'); copilotSessionWrapper.ts
164 > }
165
166 private _onReasoning: Event<SessionEventPayload<'assistant.reasoning'>> | undefined;
167 get onReasoning(): Event<SessionEventPayload<'assistant.reasoning'>> {
168 > return this._onReasoning ??= this._sdkEvent('assistant.reasoning'); copilotSessionWrapper.ts
169 > }
170
171 private _onReasoningDelta: Event<SessionEventPayload<'assistant.reasoning_delta'>> | undefined;
172 get onReasoningDelta(): Event<SessionEventPayload<'assistant.reasoning_delta'>> {
173 > return this._onReasoningDelta ??= this._sdkEvent('assistant.reasoning_delta'); copilotSessionWrapper.ts
174 > }
175
176 private _onTurnEnd: Event<SessionEventPayload<'assistant.turn_end'>> | undefined;
177 get onTurnEnd(): Event<SessionEventPayload<'assistant.turn_end'>> {
178 > return this._onTurnEnd ??= this._sdkEvent('assistant.turn_end'); copilotSessionWrapper.ts
179 > }
180
181 private _onUsage: Event<SessionEventPayload<'assistant.usage'>> | undefined;
182 get onUsage(): Event<SessionEventPayload<'assistant.usage'>> {
183 > return this._onUsage ??= this._sdkEvent('assistant.usage'); copilotSessionWrapper.ts
184 > }
185
186 private _onAbort: Event<SessionEventPayload<'abort'>> | undefined;
187 get onAbort(): Event<SessionEventPayload<'abort'>> {
188 > return this._onAbort ??= this._sdkEvent('abort'); copilotSessionWrapper.ts
189 > }
190
191 private _onToolUserRequested: Event<SessionEventPayload<'tool.user_requested'>> | undefined;
192 get onToolUserRequested(): Event<SessionEventPayload<'tool.user_requested'>> {
193 > return this._onToolUserRequested ??= this._sdkEvent('tool.user_requested'); copilotSessionWrapper.ts
194 > }
195
196 private _onToolPartialResult: Event<SessionEventPayload<'tool.execution_partial_result'>> | undefined;
197 get onToolPartialResult(): Event<SessionEventPayload<'tool.execution_partial_result'>> {
198 > return this._onToolPartialResult ??= this._sdkEvent('tool.execution_partial_result'); copilotSessionWrapper.ts
199 > }
200
201 private _onToolProgress: Event<SessionEventPayload<'tool.execution_progress'>> | undefined;
202 get onToolProgress(): Event<SessionEventPayload<'tool.execution_progress'>> {
203 > return this._onToolProgress ??= this._sdkEvent('tool.execution_progress'); copilotSessionWrapper.ts
204 > }
205
206 private _onSkillInvoked: Event<SessionEventPayload<'skill.invoked'>> | undefined;
207 get onSkillInvoked(): Event<SessionEventPayload<'skill.invoked'>> {
208 > return this._onSkillInvoked ??= this._sdkEvent('skill.invoked'); copilotSessionWrapper.ts
209 > }
210
211 private _onSubagentStarted: Event<SessionEventPayload<'subagent.started'>> | undefined;
212 get onSubagentStarted(): Event<SessionEventPayload<'subagent.started'>> {
213 > return this._onSubagentStarted ??= this._sdkEvent('subagent.started'); copilotSessionWrapper.ts
214 > }
215
216 private _onSubagentCompleted: Event<SessionEventPayload<'subagent.completed'>> | undefined;
217 get onSubagentCompleted(): Event<SessionEventPayload<'subagent.completed'>> {
218 > return this._onSubagentCompleted ??= this._sdkEvent('subagent.completed'); copilotSessionWrapper.ts
219 > }
220
221 private _onSubagentFailed: Event<SessionEventPayload<'subagent.failed'>> | undefined;
222 get onSubagentFailed(): Event<SessionEventPayload<'subagent.failed'>> {
223 > return this._onSubagentFailed ??= this._sdkEvent('subagent.failed'); copilotSessionWrapper.ts
224 > }
225
226 private _onSubagentSelected: Event<SessionEventPayload<'subagent.selected'>> | undefined;
227 get onSubagentSelected(): Event<SessionEventPayload<'subagent.selected'>> {
228 > return this._onSubagentSelected ??= this._sdkEvent('subagent.selected'); copilotSessionWrapper.ts
229 > }
230
231 private _onHookStart: Event<SessionEventPayload<'hook.start'>> | undefined;
232 get onHookStart(): Event<SessionEventPayload<'hook.start'>> {
233 > return this._onHookStart ??= this._sdkEvent('hook.start'); copilotSessionWrapper.ts
234 > }
235
236 private _onHookEnd: Event<SessionEventPayload<'hook.end'>> | undefined;
237 get onHookEnd(): Event<SessionEventPayload<'hook.end'>> {
238 > return this._onHookEnd ??= this._sdkEvent('hook.end'); copilotSessionWrapper.ts
239 > }
240
241 private _onSystemMessage: Event<SessionEventPayload<'system.message'>> | undefined;
242 get onSystemMessage(): Event<SessionEventPayload<'system.message'>> {
243 > return this._onSystemMessage ??= this._sdkEvent('system.message'); copilotSessionWrapper.ts
244 > }
245
246 private _onSystemNotification: Event<SessionEventPayload<'system.notification'>> | undefined;
247 get onSystemNotification(): Event<SessionEventPayload<'system.notification'>> {
248 > return this._onSystemNotification ??= this._sdkEvent('system.notification'); copilotSessionWrapper.ts
249 > }
250
251 private _onSessionModeChanged: Event<SessionEventPayload<'session.mode_changed'>> | undefined;
252 get onSessionModeChanged(): Event<SessionEventPayload<'session.mode_changed'>> {
253 > return this._onSessionModeChanged ??= this._sdkEvent('session.mode_changed'); copilotSessionWrapper.ts
254 > }
255
256 private _onMcpServersLoaded: Event<SessionEventPayload<'session.mcp_servers_loaded'>> | undefined;
257 get onMcpServersLoaded(): Event<SessionEventPayload<'session.mcp_servers_loaded'>> {
258 > return this._onMcpServersLoaded ??= this._sdkEvent('session.mcp_servers_loaded'); copilotSessionWrapper.ts
259 > }
260
261 private _onMcpServerStatusChanged: Event<SessionEventPayload<'session.mcp_server_status_changed'>> | undefined;
262 get onMcpServerStatusChanged(): Event<SessionEventPayload<'session.mcp_server_status_changed'>> {
263 > return this._onMcpServerStatusChanged ??= this._sdkEvent('session.mcp_server_status_changed'); copilotSessionWrapper.ts
264 > }
265
266 private _onToolsUpdated: Event<SessionEventPayload<'session.tools_updated'>> | undefined;
267 get onToolsUpdated(): Event<SessionEventPayload<'session.tools_updated'>> {
268 > return this._onToolsUpdated ??= this._sdkEvent('session.tools_updated'); copilotSessionWrapper.ts
269 > }
270
271 private _onCommandsChanged: Event<SessionEventPayload<'commands.changed'>> | undefined;
272 get onCommandsChanged(): Event<SessionEventPayload<'commands.changed'>> {
273 > return this._onCommandsChanged ??= this._sdkEvent('commands.changed'); copilotSessionWrapper.ts
274 > }
275
276 private _sdkEvent<K extends SessionEventType>(eventType: K): Event<SessionEventPayload<K>> {