Path: blob/main/src/vs/platform/agentHost/common/state/sessionActions.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45// Action and notification types for the sessions process protocol.6// Re-exports from the auto-generated protocol layer with local aliases.7//8// VS Code-specific additions:9// - IToolCallStartAction extends protocol with `toolKind` and `language`10// - isRootAction / isSessionAction type guards11// - INotification alias for ProtocolNotification1213// ---- Re-exports from protocol -----------------------------------------------1415export {16ActionType,17type ActionEnvelope,18type ActionOrigin,19type RootAgentsChangedAction,20type RootActiveSessionsChangedAction,21type SessionCreationFailedAction,22type SessionDeltaAction,23type SessionDiffsChangedAction,24type SessionErrorAction,25type SessionModelChangedAction,26type SessionReadyAction,27type SessionReasoningAction,28type SessionResponsePartAction,29type SessionToolCallCompleteAction,30type SessionToolCallConfirmedAction,31type SessionToolCallApprovedAction,32type SessionToolCallDeniedAction,33type SessionToolCallDeltaAction,34type SessionToolCallReadyAction,35type SessionToolCallResultConfirmedAction,36type SessionToolCallStartAction,37type SessionTitleChangedAction,38type SessionTurnCancelledAction,39type SessionTurnCompleteAction,40type SessionTurnStartedAction,41type SessionUsageAction,42type SessionServerToolsChangedAction,43type SessionActiveClientChangedAction,44type SessionActiveClientToolsChangedAction,45type SessionCustomizationsChangedAction,46type SessionCustomizationToggledAction,47type SessionPendingMessageSetAction,48type SessionPendingMessageRemovedAction,49type SessionQueuedMessagesReorderedAction,50type SessionInputRequestedAction,51type SessionInputCompletedAction,52type SessionIsReadChangedAction,53type SessionIsArchivedChangedAction,54type SessionToolCallContentChangedAction,55type StateAction,56} from './protocol/actions.js';5758export {59NotificationType,60AuthRequiredReason,61type SessionAddedNotification,62type SessionRemovedNotification,63type AuthRequiredNotification,64} from './protocol/notifications.js';6566// ---- Local aliases for short names ------------------------------------------67// Consumers use these shorter names; they're type-only aliases.6869import type {70RootAgentsChangedAction,71RootActiveSessionsChangedAction,72SessionDeltaAction,73SessionModelChangedAction,74SessionReasoningAction,75SessionResponsePartAction,76SessionToolCallApprovedAction,77SessionToolCallCompleteAction,78SessionToolCallConfirmedAction,79SessionToolCallDeniedAction,80SessionToolCallDeltaAction,81SessionToolCallReadyAction,82SessionToolCallResultConfirmedAction,83SessionToolCallStartAction,84SessionTitleChangedAction,85SessionTurnCancelledAction,86SessionTurnCompleteAction,87SessionTurnStartedAction,88SessionUsageAction,89StateAction,90SessionPendingMessageSetAction,91SessionPendingMessageRemovedAction,92SessionQueuedMessagesReorderedAction,93SessionIsReadChangedAction,94SessionIsArchivedChangedAction,95RootConfigChangedAction,96} from './protocol/actions.js';9798import type { ProtocolNotification } from './protocol/notifications.js';99import type { RootAction as IRootAction_, SessionAction as ISessionAction_, ClientSessionAction as IClientSessionAction_, ServerSessionAction as IServerSessionAction_, TerminalAction as ITerminalAction_, ClientTerminalAction as IClientTerminalAction_ } from './protocol/action-origin.generated.js';100101export type RootAction = IRootAction_;102export type SessionAction = ISessionAction_;103export type ClientSessionAction = IClientSessionAction_;104export type ServerSessionAction = IServerSessionAction_;105export type TerminalAction = ITerminalAction_;106export type ClientTerminalAction = IClientTerminalAction_;107108// Root actions109export type IAgentsChangedAction = RootAgentsChangedAction;110export type IActiveSessionsChangedAction = RootActiveSessionsChangedAction;111export type IRootConfigChangedAction = RootConfigChangedAction;112113// Session actions — short aliases114export type ITurnStartedAction = SessionTurnStartedAction;115export type IDeltaAction = SessionDeltaAction;116export type IResponsePartAction = SessionResponsePartAction;117export type IToolCallStartAction = SessionToolCallStartAction;118export type IToolCallDeltaAction = SessionToolCallDeltaAction;119export type IToolCallReadyAction = SessionToolCallReadyAction;120export type IToolCallApprovedAction = SessionToolCallApprovedAction;121export type IToolCallDeniedAction = SessionToolCallDeniedAction;122export type IToolCallConfirmedAction = SessionToolCallConfirmedAction;123export type IToolCallCompleteAction = SessionToolCallCompleteAction;124export type IToolCallResultConfirmedAction = SessionToolCallResultConfirmedAction;125export type ITurnCompleteAction = SessionTurnCompleteAction;126export type ITurnCancelledAction = SessionTurnCancelledAction;127export type ITitleChangedAction = SessionTitleChangedAction;128export type IUsageAction = SessionUsageAction;129export type IReasoningAction = SessionReasoningAction;130export type IModelChangedAction = SessionModelChangedAction;131export type ICustomizationsChangedAction = import('./protocol/actions.js').SessionCustomizationsChangedAction;132export type ICustomizationToggledAction = import('./protocol/actions.js').SessionCustomizationToggledAction;133134export type IPendingMessageSetAction = SessionPendingMessageSetAction;135export type IPendingMessageRemovedAction = SessionPendingMessageRemovedAction;136export type IQueuedMessagesReorderedAction = SessionQueuedMessagesReorderedAction;137export type IIsReadChangedAction = SessionIsReadChangedAction;138export type IIsArchivedChangedAction = SessionIsArchivedChangedAction;139140// Notifications141export type INotification = ProtocolNotification;142143// ---- Type guards ------------------------------------------------------------144145export function isRootAction(action: StateAction): action is RootAction {146return action.type.startsWith('root/');147}148149export function isSessionAction(action: StateAction): action is SessionAction {150return action.type.startsWith('session/');151}152153export function isTerminalAction(action: StateAction): action is TerminalAction {154return action.type.startsWith('terminal/');155}156157158