
import { localize } from '../../../../../nls.js';
import { RawContextKey, ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
import { IsWebContext } from '../../../../../platform/contextkey/common/contextkeys.js';
import { RemoteNameContext } from '../../../../common/contextkeys.js';
import { ChatEntitlementContextKeys } from '../../../../services/chat/common/chatEntitlementService.js';
import { ChatModeKind, ChatPermissionLevel } from '../constants.js';

var ChatContextKeys;
(function(ChatContextKeys) {
    ChatContextKeys.responseVote = ( new RawContextKey("chatSessionResponseVote", "", {
        type: "string",
        description: ( localize(
            7107,
            "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string."
        ))
    }));
    ChatContextKeys.responseDetectedAgentCommand = ( new RawContextKey("chatSessionResponseDetectedAgentOrCommand", false, {
        type: "boolean",
        description: ( localize(7108, "When the agent or command was automatically detected"))
    }));
    ChatContextKeys.responseSupportsIssueReporting = ( new RawContextKey("chatResponseSupportsIssueReporting", false, {
        type: "boolean",
        description: ( localize(7109, "True when the current chat response supports issue reporting."))
    }));
    ChatContextKeys.responseIsFiltered = ( new RawContextKey("chatSessionResponseFiltered", false, {
        type: "boolean",
        description: ( localize(7110, "True when the chat response was filtered out by the server."))
    }));
    ChatContextKeys.responseHasError = ( new RawContextKey("chatSessionResponseError", false, {
        type: "boolean",
        description: ( localize(7111, "True when the chat response resulted in an error."))
    }));
    ChatContextKeys.requestInProgress = ( new RawContextKey("chatSessionRequestInProgress", false, {
        type: "boolean",
        description: ( localize(7112, "True when the current request is still in progress."))
    }));
    ChatContextKeys.currentlyEditing = ( new RawContextKey("chatSessionCurrentlyEditing", false, {
        type: "boolean",
        description: ( localize(7113, "True when the current request is being edited."))
    }));
    ChatContextKeys.currentlyEditingInput = ( new RawContextKey("chatSessionCurrentlyEditingInput", false, {
        type: "boolean",
        description: ( localize(7114, "True when the current request input at the bottom is being edited."))
    }));
    (function(EditingRequestType) {
        EditingRequestType["Sent"] = "s";
        EditingRequestType["Queue"] = "q";
        EditingRequestType["Steer"] = "st";
    })(
        ChatContextKeys.EditingRequestType || (ChatContextKeys.EditingRequestType = {})
    );
    ChatContextKeys.editingRequestType = ( new RawContextKey("chatEditingSentRequest", undefined, {
        type: "string",
        description: ( localize(7115, "The type of the current editing request."))
    }));
    ChatContextKeys.isResponse = ( new RawContextKey("chatResponse", false, {
        type: "boolean",
        description: ( localize(7116, "The chat item is a response."))
    }));
    ChatContextKeys.isRequest = ( new RawContextKey("chatRequest", false, {
        type: "boolean",
        description: ( localize(7117, "The chat item is a request"))
    }));
    ChatContextKeys.isPendingRequest = ( new RawContextKey("chatRequestIsPending", false, {
        type: "boolean",
        description: ( localize(7118, "True when the chat request item is pending in the queue."))
    }));
    ChatContextKeys.itemId = ( new RawContextKey("chatItemId", "", {
        type: "string",
        description: ( localize(7119, "The id of the chat item."))
    }));
    ChatContextKeys.lastItemId = ( new RawContextKey("chatLastItemId", [], {
        type: "string",
        description: ( localize(7120, "The id of the last chat item."))
    }));
    ChatContextKeys.editApplied = ( new RawContextKey("chatEditApplied", false, {
        type: "boolean",
        description: ( localize(7121, "True when the chat text edits have been applied."))
    }));
    ChatContextKeys.inputHasText = ( new RawContextKey("chatInputHasText", false, {
        type: "boolean",
        description: ( localize(7122, "True when the chat input has text."))
    }));
    ChatContextKeys.inputHasFocus = ( new RawContextKey("chatInputHasFocus", false, {
        type: "boolean",
        description: ( localize(7123, "True when the chat input has focus."))
    }));
    ChatContextKeys.inChatInput = ( new RawContextKey("inChatInput", false, {
        type: "boolean",
        description: ( localize(7124, "True when focus is in the chat input, false otherwise."))
    }));
    ChatContextKeys.inChatSession = ( new RawContextKey("inChat", false, {
        type: "boolean",
        description: ( localize(7125, "True when focus is in the chat widget, false otherwise."))
    }));
    ChatContextKeys.inChatQuestionCarousel = ( new RawContextKey("inChatQuestionCarousel", false, {
        type: "boolean",
        description: ( localize(7126, "True when focus is in the chat question carousel."))
    }));
    ChatContextKeys.inChatEditor = ( new RawContextKey("inChatEditor", false, {
        type: "boolean",
        description: ( localize(7127, "Whether focus is in a chat editor."))
    }));
    ChatContextKeys.inChatTodoList = ( new RawContextKey("inChatTodoList", false, {
        type: "boolean",
        description: ( localize(7128, "True when focus is in the chat todo list."))
    }));
    ChatContextKeys.inChatTip = ( new RawContextKey("inChatTip", false, {
        type: "boolean",
        description: ( localize(7129, "True when focus is in a chat tip."))
    }));
    ChatContextKeys.multipleChatTips = ( new RawContextKey("multipleChatTips", false, {
        type: "boolean",
        description: ( localize(7130, "True when there are multiple chat tips available."))
    }));
    ChatContextKeys.inChatTerminalToolOutput = ( new RawContextKey("inChatTerminalToolOutput", false, {
        type: "boolean",
        description: ( localize(7131, "True when focus is in the chat terminal output region."))
    }));
    ChatContextKeys.chatModeKind = ( new RawContextKey("chatAgentKind", ChatModeKind.Ask, {
        type: "string",
        description: ( localize(7132, "The 'kind' of the current agent."))
    }));
    ChatContextKeys.chatPermissionLevel = ( new RawContextKey("chatPermissionLevel", ChatPermissionLevel.Default, {
        type: "string",
        description: ( localize(7133, "The current permission level for tool auto-approval."))
    }));
    ChatContextKeys.chatModeName = ( new RawContextKey("chatModeName", "", {
        type: "string",
        description: ( localize(7134, "The name of the current chat mode (e.g. 'Plan' for custom modes)."))
    }));
    ChatContextKeys.chatModelId = ( new RawContextKey("chatModelId", "", {
        type: "string",
        description: ( localize(
            7135,
            "The short id of the currently selected chat model (for example 'gpt-4.1')."
        ))
    }));
    ChatContextKeys.supported = ( ContextKeyExpr.or(( IsWebContext.negate()), ( RemoteNameContext.notEqualsTo("")), ( ContextKeyExpr.has("config.chat.experimental.serverlessWebEnabled"))));
    ChatContextKeys.enabled = ( new RawContextKey("chatIsEnabled", false, {
        type: "boolean",
        description: ( localize(
            7136,
            "True when chat is enabled because a default chat participant is activated with an implementation."
        ))
    }));
    ChatContextKeys.lockedToCodingAgent = ( new RawContextKey("lockedToCodingAgent", false, {
        type: "boolean",
        description: ( localize(7137, "True when the chat widget is locked to the coding agent session."))
    }));
    ChatContextKeys.lockedCodingAgentId = ( new RawContextKey("lockedCodingAgentId", "", {
        type: "string",
        description: ( localize(
            7138,
            "The agent ID when the chat widget is locked to a coding agent session."
        ))
    }));
    ChatContextKeys.chatSessionHasCustomAgentTarget = ( new RawContextKey("chatSessionHasCustomAgentTarget", false, {
        type: "boolean",
        description: ( localize(
            7139,
            "True when the chat session has a customAgentTarget defined to filter modes."
        ))
    }));
    ChatContextKeys.chatSessionHasTargetedModels = ( new RawContextKey("chatSessionHasTargetedModels", false, {
        type: "boolean",
        description: ( localize(
            7140,
            "True when the chat session has language models that target it via targetChatSessionType."
        ))
    }));
    ChatContextKeys.agentSupportsAttachments = ( new RawContextKey("agentSupportsAttachments", false, {
        type: "boolean",
        description: ( localize(7141, "True when the chat agent supports attachments."))
    }));
    ChatContextKeys.withinEditSessionDiff = ( new RawContextKey("withinEditSessionDiff", false, {
        type: "boolean",
        description: ( localize(7142, "True when the chat widget dispatches to the edit session chat."))
    }));
    ChatContextKeys.filePartOfEditSession = ( new RawContextKey("filePartOfEditSession", false, {
        type: "boolean",
        description: ( localize(7143, "True when the chat widget is within a file with an edit session."))
    }));
    ChatContextKeys.extensionParticipantRegistered = ( new RawContextKey("chatPanelExtensionParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(
            7144,
            "True when a default chat participant is registered for the panel from an extension."
        ))
    }));
    ChatContextKeys.panelParticipantRegistered = ( new RawContextKey("chatPanelParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(7145, "True when a default chat participant is registered for the panel."))
    }));
    ChatContextKeys.chatEditingCanUndo = ( new RawContextKey("chatEditingCanUndo", false, {
        type: "boolean",
        description: ( localize(
            7146,
            "True when it is possible to undo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.chatEditingCanRedo = ( new RawContextKey("chatEditingCanRedo", false, {
        type: "boolean",
        description: ( localize(
            7147,
            "True when it is possible to redo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.languageModelsAreUserSelectable = ( new RawContextKey("chatModelsAreUserSelectable", false, {
        type: "boolean",
        description: ( localize(7148, "True when the chat model can be selected manually by the user."))
    }));
    ChatContextKeys.chatSessionHasModels = ( new RawContextKey("chatSessionHasModels", false, {
        type: "boolean",
        description: ( localize(
            7149,
            "True when the chat is in a contributed chat session that has available 'models' to display."
        ))
    }));
    ChatContextKeys.chatSessionOptionsValid = ( new RawContextKey("chatSessionOptionsValid", true, {
        type: "boolean",
        description: ( localize(
            7150,
            "True when all selected session options exist in their respective option group items."
        ))
    }));
    ChatContextKeys.extensionInvalid = ( new RawContextKey("chatExtensionInvalid", false, {
        type: "boolean",
        description: ( localize(
            7151,
            "True when the installed chat extension is invalid and needs to be updated."
        ))
    }));
    ChatContextKeys.inputCursorAtTop = ( new RawContextKey("chatCursorAtTop", false));
    ChatContextKeys.inputHasAgent = ( new RawContextKey("chatInputHasAgent", false));
    ChatContextKeys.location = ( new RawContextKey("chatLocation", undefined));
    ChatContextKeys.inQuickChat = ( new RawContextKey("quickChatHasFocus", false, {
        type: "boolean",
        description: ( localize(7152, "True when the quick chat UI has focus, false otherwise."))
    }));
    ChatContextKeys.inAgentSessionsWelcome = ( new RawContextKey("inAgentSessionsWelcome", false, {
        type: "boolean",
        description: ( localize(
            7153,
            "True when the chat input is within the agent sessions welcome page."
        ))
    }));
    ChatContextKeys.chatSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(7154, "The type of the current chat session."))
    }));
    ChatContextKeys.hasFileAttachments = ( new RawContextKey("chatHasFileAttachments", false, {
        type: "boolean",
        description: ( localize(7155, "True when the chat has file attachments."))
    }));
    ChatContextKeys.chatSessionIsEmpty = ( new RawContextKey("chatSessionIsEmpty", true, {
        type: "boolean",
        description: ( localize(7156, "True when the current chat session has no requests."))
    }));
    ChatContextKeys.hasPendingRequests = ( new RawContextKey("chatHasPendingRequests", false, {
        type: "boolean",
        description: ( localize(7157, "True when there are pending requests in the queue."))
    }));
    ChatContextKeys.chatSessionHasDebugData = ( new RawContextKey("chatSessionHasDebugData", false, {
        type: "boolean",
        description: ( localize(7158, "True when the current chat session has debug log data."))
    }));
    ChatContextKeys.chatSessionHasDebugTools = ( new RawContextKey("chatSessionHasDebugTools", false, {
        type: "boolean",
        description: ( localize(7159, "True when debug tools are enabled in the current chat session."))
    }));
    ChatContextKeys.remoteJobCreating = ( new RawContextKey("chatRemoteJobCreating", false, {
        type: "boolean",
        description: ( localize(7160, "True when a remote coding agent job is being created."))
    }));
    ChatContextKeys.hasRemoteCodingAgent = ( new RawContextKey("hasRemoteCodingAgent", false, ( localize(7161, "Whether any remote coding agent is available"))));
    ChatContextKeys.hasCanDelegateProviders = ( new RawContextKey("chatHasCanDelegateProviders", false, {
        type: "boolean",
        description: ( localize(
            7162,
            "True when there are chat session providers with delegation support available."
        ))
    }));
    ChatContextKeys.enableRemoteCodingAgentPromptFileOverlay = ( new RawContextKey("enableRemoteCodingAgentPromptFileOverlay", false, ( localize(
        7163,
        "Whether the remote coding agent prompt file overlay feature is enabled"
    ))));
    ChatContextKeys.skipChatRequestInProgressMessage = ( new RawContextKey("chatSkipRequestInProgressMessage", false, {
        type: "boolean",
        description: ( localize(7164, "True when the chat request in progress message should be skipped."))
    }));
    ChatContextKeys.Setup = ChatEntitlementContextKeys.Setup;
    ChatContextKeys.Entitlement = ChatEntitlementContextKeys.Entitlement;
    ChatContextKeys.chatQuotaExceeded = ChatEntitlementContextKeys.chatQuotaExceeded;
    ChatContextKeys.completionsQuotaExceeded = ChatEntitlementContextKeys.completionsQuotaExceeded;
    ChatContextKeys.Editing = {
        hasToolConfirmation: ( new RawContextKey("chatHasToolConfirmation", false, {
            type: "boolean",
            description: ( localize(7165, "True when a tool confirmation is present."))
        })),
        hasElicitationRequest: ( new RawContextKey("chatHasElicitationRequest", false, {
            type: "boolean",
            description: ( localize(7166, "True when a chat elicitation request is pending."))
        })),
        hasQuestionCarousel: ( new RawContextKey("chatHasQuestionCarousel", false, {
            type: "boolean",
            description: ( localize(7167, "True when a question carousel is rendered in the chat input."))
        }))
    };
    ChatContextKeys.Tools = {
        toolsCount: ( new RawContextKey("toolsCount", 0, {
            type: "number",
            description: ( localize(7168, "The count of tools available in the chat."))
        }))
    };
    ChatContextKeys.foregroundSessionCount = ( new RawContextKey("chatForegroundSessionCount", 0, {
        type: "number",
        description: ( localize(
            7169,
            "The number of foreground chat sessions visible across chat surfaces."
        ))
    }));
    ChatContextKeys.Modes = {
        hasCustomChatModes: ( new RawContextKey("chatHasCustomAgents", false, {
            type: "boolean",
            description: ( localize(7170, "True when the chat has custom agents available."))
        })),
        agentModeDisabledByPolicy: ( new RawContextKey("chatAgentModeDisabledByPolicy", false, {
            type: "boolean",
            description: ( localize(7171, "True when agent mode is disabled by organization policy."))
        }))
    };
    ChatContextKeys.panelLocation = ( new RawContextKey("chatPanelLocation", undefined, {
        type: "number",
        description: ( localize(7172, "The location of the chat panel."))
    }));
    ChatContextKeys.agentSessionsViewerFocused = ( new RawContextKey("agentSessionsViewerFocused", true, {
        type: "boolean",
        description: ( localize(7173, "If the agent sessions view in the chat view is focused."))
    }));
    ChatContextKeys.agentSessionsViewerOrientation = ( new RawContextKey("agentSessionsViewerOrientation", undefined, {
        type: "number",
        description: ( localize(7174, "Orientation of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerPosition = ( new RawContextKey("agentSessionsViewerPosition", undefined, {
        type: "number",
        description: ( localize(7175, "Position of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerVisible = ( new RawContextKey("agentSessionsViewerVisible", undefined, {
        type: "boolean",
        description: ( localize(7176, "Visibility of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(7177, "The type of the current agent session item."))
    }));
    ChatContextKeys.chatSessionSupportsDelegation = ( new RawContextKey("chatSessionSupportsDelegation", true, {
        type: "boolean",
        description: ( localize(7178, "True when the current session type supports delegation."))
    }));
    ChatContextKeys.chatSessionSupportsFork = ( new RawContextKey("chatSessionSupportsFork", false, {
        type: "boolean",
        description: ( localize(
            7179,
            "True when the current chat session provider supports forking conversations."
        ))
    }));
    ChatContextKeys.agentSessionSection = ( new RawContextKey("agentSessionSection", "", {
        type: "string",
        description: ( localize(7180, "The section of the current agent session section item."))
    }));
    ChatContextKeys.isArchivedAgentSession = ( new RawContextKey("agentSessionIsArchived", false, {
        type: "boolean",
        description: ( localize(7181, "True when the agent session item is archived."))
    }));
    ChatContextKeys.isPinnedAgentSession = ( new RawContextKey("agentSessionIsPinned", false, {
        type: "boolean",
        description: ( localize(7182, "True when the agent session item is pinned."))
    }));
    ChatContextKeys.isReadAgentSession = ( new RawContextKey("agentSessionIsRead", false, {
        type: "boolean",
        description: ( localize(7183, "True when the agent session item is read."))
    }));
    ChatContextKeys.hasMultipleAgentSessionsSelected = ( new RawContextKey("agentSessionHasMultipleSelected", false, {
        type: "boolean",
        description: ( localize(7184, "True when multiple agent sessions are selected."))
    }));
    ChatContextKeys.hasAgentSessionChanges = ( new RawContextKey("agentSessionHasChanges", false, {
        type: "boolean",
        description: ( localize(7185, "True when the current agent session item has changes."))
    }));
    ChatContextKeys.isKatexMathElement = ( new RawContextKey("chatIsKatexMathElement", false, {
        type: "boolean",
        description: ( localize(7186, "True when focusing a KaTeX math element."))
    }));
    ChatContextKeys.hasUsedCreateSlashCommands = ( new RawContextKey("chatHasUsedCreateSlashCommands", false, {
        type: "boolean",
        description: ( localize(7187, "True when the user has used any of the /create-* slash commands."))
    }));
    ChatContextKeys.contextUsageHasBeenOpened = ( new RawContextKey("chatContextUsageHasBeenOpened", false, {
        type: "boolean",
        description: ( localize(7188, "True when the user has opened the context window usage details."))
    }));
    ChatContextKeys.newChatButtonExperimentIcon = ( new RawContextKey("chatNewChatButtonExperimentIcon", "", {
        type: "string",
        description: ( localize(
            7189,
            "The icon variant for the new chat button, controlled by experiment. Values: 'copilot', 'new-session', 'comment', or empty for default."
        ))
    }));
})(ChatContextKeys || (ChatContextKeys = {}));
var ChatContextKeyExprs;
(function(ChatContextKeyExprs) {
    ChatContextKeyExprs.inEditingMode = ( ContextKeyExpr.or(( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Edit)), ( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent))));
    ChatContextKeyExprs.chatSetupTriggerContext = ( ContextKeyExpr.or(( ChatContextKeys.Setup.installed.negate()), ChatContextKeys.Entitlement.canSignUp));
})(ChatContextKeyExprs || (ChatContextKeyExprs = {}));

export { ChatContextKeyExprs, ChatContextKeys };
