1
>
/*---------------------------------------------------------------------------------------------
mapSessionEvents.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import type { AssistantMessageToolRequest, Attachment, SessionEvent, ToolExecutionCompleteContent, ToolExecutionCompleteData } from '@github/copilot-sdk';
7
>
import { decodeBase64 } from '../../../../base/common/buffer.js';
8
>
import { basename } from '../../../../base/common/path.js';
9
>
import { isString } from '../../../../base/common/types.js';
10
>
import { URI } from '../../../../base/common/uri.js';
11
>
import { generateUuid } from '../../../../base/common/uuid.js';
12
>
import { AgentSession } from '../../common/agentService.js';
13
>
import { stripRedundantCdPrefix } from '../../common/commandLineHelpers.js';
14
>
import { toToolCallMeta, type IToolCallUiMeta } from '../../common/meta/agentToolCallMeta.js';
15
>
import { IFileEditRecord, ISessionDatabase } from '../../common/sessionDataService.js';
16
>
import { MessageAttachmentKind, type MessageAttachment } from '../../common/state/protocol/state.js';
17
>
import { MessageKind, ResponsePartKind, ToolCallConfirmationReason, ToolCallContributorKind, ToolCallStatus, ToolResultContentType, TurnState, buildSubagentSessionUri, type AgentSelection, type Message, type ModelSelection, type ResponsePart, type StringOrMarkdown, type TerminalCommandResult, type ToolCallCompletedState, type ToolResultContent, type ToolResultTerminalContent, type Turn, type UsageInfo } from '../../common/state/sessionState.js';
18
>
import { buildNonPtyShellTerminalUri } from './copilotNonPtyShellTerminals.js';
19
>
import { getInvocationMessage, getPastTenseMessage, getShellIntention, getShellLanguage, getSubagentMetadata, getTaskCompleteMarkdown, getToolDisplayName, getToolInputString, getToolKind, isEditTool, isHiddenTool, isTaskCompleteTool, synthesizeSkillToolCall } from './copilotToolDisplay.js';
20
>
import { buildSessionDbUri } from '../shared/fileEditTracker.js';
21
>
import { getMediaMime } from '../../../../base/common/mime.js';
22
>
import { buildCopilotSystemNotification } from './copilotSystemNotification.js';
23
>
import { buildMcpChannel, buildMcpTopLevelCustomizationId } from '../shared/mcpCustomizationController.js';
24
>
import { readSimpleAttachmentDisplayKindFromMimeType } from './copilotAttachmentUtils.js';
25
>
26
function tryStringify(value: unknown): string | undefined {
27
try {