Path: blob/main/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.ts
13406 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*--------------------------------------------------------------------------------------------*/45import { RawContextKey } from '../../../../../platform/contextkey/common/contextkey.js';6import { AICustomizationManagementSection } from '../../common/aiCustomizationWorkspaceService.js';7import { PromptsType } from '../../common/promptSyntax/promptTypes.js';8import { localize } from '../../../../../nls.js';9import { MenuId } from '../../../../../platform/actions/common/actions.js';1011// Re-export for convenience — consumers import from this file12export { AICustomizationManagementSection } from '../../common/aiCustomizationWorkspaceService.js';13export type { AICustomizationPromptsStorage } from '../../common/aiCustomizationWorkspaceService.js';14export { BUILTIN_STORAGE } from '../../common/aiCustomizationWorkspaceService.js';1516export function sectionToPromptType(section: AICustomizationManagementSection): PromptsType {17switch (section) {18case AICustomizationManagementSection.Agents:19return PromptsType.agent;20case AICustomizationManagementSection.Skills:21return PromptsType.skill;22case AICustomizationManagementSection.Instructions:23return PromptsType.instructions;24case AICustomizationManagementSection.Hooks:25return PromptsType.hook;26case AICustomizationManagementSection.Prompts:27default:28return PromptsType.prompt;29}30}3132/**33* Editor pane ID for the AI Customizations Management Editor.34*/35export const AI_CUSTOMIZATION_MANAGEMENT_EDITOR_ID = 'workbench.editor.aiCustomizationManagement';3637/**38* Editor input type ID for serialization.39*/40export const AI_CUSTOMIZATION_MANAGEMENT_EDITOR_INPUT_ID = 'workbench.input.aiCustomizationManagement';4142/**43* Command IDs for the AI Customizations Management Editor.44*/45export const AICustomizationManagementCommands = {46OpenEditor: 'aiCustomization.openManagementEditor',47OpenMarketplace: 'aiCustomization.openMarketplace',48CreateNewAgent: 'aiCustomization.createNewAgent',49CreateNewSkill: 'aiCustomization.createNewSkill',50CreateNewInstructions: 'aiCustomization.createNewInstructions',51CreateNewPrompt: 'aiCustomization.createNewPrompt',52GenerateDebugReport: 'aiCustomization.generateDebugReport',53} as const;5455/**56* Context key indicating the AI Customization Management Editor is focused.57*/58export const CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_EDITOR = new RawContextKey<boolean>(59'aiCustomizationManagementEditorFocused',60false,61localize('aiCustomizationManagementEditorFocused', "Whether the Agent Customizations editor is focused")62);6364/**65* Context key for the currently selected section.66*/67export const CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_SECTION = new RawContextKey<string>(68'chatCustomizationSection',69AICustomizationManagementSection.Agents,70localize('chatCustomizationSection', "The currently selected section in the Agent Customizations editor")71);7273/**74* Context key for the active harness (session type) in the customizations editor.75* Extensions use this in when-clauses to scope create actions to their harness.76*/77export const CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_HARNESS = new RawContextKey<string>(78'chatCustomizationSessionType',79'',80localize('chatCustomizationSessionType', "The active harness (session type) in the Agent Customizations editor")81);8283/**84* Menu ID for the AI Customization Management Editor title bar actions.85*/86export const AICustomizationManagementTitleMenuId = MenuId.for('AICustomizationManagementEditorTitle');8788/**89* Menu ID for the AI Customization Management Editor item context menu.90*/91export const AICustomizationManagementItemMenuId = MenuId.for('AICustomizationManagementEditorItem');9293/**94* Menu ID for the AI Customization Management Editor create/add button.95* Extensions can contribute commands here to add create actions to the section's add button dropdown.96* Use the `chatCustomizationSection` context key to target a specific section.97*/98export const AICustomizationManagementCreateMenuId = MenuId.for('AICustomizationManagementCreate');99100/**101* Context key for the item prompt type (e.g. 'prompt', 'agent') used in when-clause filtering.102*/103export const AI_CUSTOMIZATION_ITEM_TYPE_KEY = 'aiCustomizationManagementItemType';104105/**106* Context key for the item storage type (e.g. 'local', 'user', 'extension') used in when-clause filtering.107*/108export const AI_CUSTOMIZATION_ITEM_STORAGE_KEY = 'aiCustomizationManagementItemStorage';109110/**111* Context key for the item URI used in when-clause filtering.112*/113export const AI_CUSTOMIZATION_ITEM_URI_KEY = 'aiCustomizationManagementItemUri';114115/**116* Context key for the parent plugin URI, set when the item is provided by a plugin.117*/118export const AI_CUSTOMIZATION_ITEM_PLUGIN_URI_KEY = 'aiCustomizationManagementItemPluginUri';119120/**121* Context key indicating whether the item is disabled.122*/123export const AI_CUSTOMIZATION_ITEM_DISABLED_KEY = 'aiCustomizationManagementItemDisabled';124125126/**127* Storage key for persisting the selected section.128*/129export const AI_CUSTOMIZATION_MANAGEMENT_SELECTED_SECTION_KEY = 'aiCustomizationManagement.selectedSection';130131/**132* Storage key for persisting the sidebar width.133*/134export const AI_CUSTOMIZATION_MANAGEMENT_SIDEBAR_WIDTH_KEY = 'aiCustomizationManagement.sidebarWidth';135136/**137* Storage key for persisting the search query.138*/139export const AI_CUSTOMIZATION_MANAGEMENT_SEARCH_KEY = 'aiCustomizationManagement.searchQuery';140141/**142* Layout constants for the editor.143*/144export const SIDEBAR_DEFAULT_WIDTH = 200;145export const SIDEBAR_MIN_WIDTH = 150;146export const SIDEBAR_MAX_WIDTH = 350;147export const CONTENT_MIN_WIDTH = 400;148149150