Protected_Protected_Map to store default variant for each prompt variant set (key: promptVariantSetId, value: variantId)
Protected_Event emitter for prompt changes
Protected_Event emitter for selected variant changes
Protected_Map to store prompt variants sets (key: promptVariantSetId, value: array of variantIds)
Protected_Map to store selected variant for each prompt variant set (key: promptVariantSetId, value: variantId)
Protected ReadonlycustomizationProtected ReadonlyloggerReadonlyonEvent fired when the prompts change
ReadonlyonEvent fired when the selected variant for a prompt variant set changes
Protected OptionalpromptProtected ReadonlysettingsProtectedtoProtected ReadonlytoolProtected ReadonlyvariableAdds a prompt fragment to the service
The fragment to store
OptionalpromptVariantSetId: stringOptional ID of the prompt variant set this is a variant of
ProtectedaddAdds a variant ID to the fragment variants map
The prompt variant set id
The variant ID to add
Whether this variant should be the default for the prompt variant set (defaults to false)
===== Customization Service Delegation Methods =====
ProtectedfindFinds a built-in fragment by its ID
The ID of the fragment to find
The built-in fragment or undefined if not found
ProtectedfireGets all active prompts (highest priority version of each fragment)
Array of active prompt fragments
===== Fragment Collection Management Methods =====
Gets the built-in raw prompt fragment (before any customizations)
The prompt fragment ID
The built-in fragment or undefined if not found
Gets all prompt fragments marked as commands, optionally filtered by agent
OptionalagentId: stringOptional agent ID to filter commands (undefined returns commands for all agents)
Array of command prompt fragments
Gets the default variant ID of the given set
The prompt variant set id
The default variant ID or undefined if no default is set
Gets the effective variant ID that is guaranteed to be valid if one exists. This checks if the selected variant ID is valid, and falls back to the default variant if it isn't.
The prompt variant set id
A valid variant ID if one exists, or undefined if no valid variant can be found
Gets the raw prompt fragment without comments
The prompt fragment ID
The raw prompt fragment or undefined if not found
Gets a prompt fragment by command name (for slash commands)
The command name to search for
The fragment with the matching command name or undefined if not found
Gets all prompt variant sets and their variants
Map of prompt variant set IDs to arrays of variant IDs
Gets the raw prompt fragment with comments
The prompt fragment ID
The raw prompt fragment or undefined if not found
===== Fragment Resolution Methods =====
Optionalargs: { [key: string]: unknown }Optionalcontext: AIVariableContextResolves a prompt fragment by replacing variables but preserving function references
The prompt fragment ID
Optionalargs: { [key: string]: unknown }Optional object with values for variable replacement
Optionalcontext: AIVariableContextOptional context for variable resolution
OptionalresolveVariable: (variable: AIVariableArg) => Promise<undefined | ResolvedAIVariable>Optional custom variable resolution function
The partially resolved prompt fragment or undefined if not found
Gets the explicitly selected variant ID for a prompt fragment from settings. This returns only the variant that was explicitly selected in settings, not the default.
The prompt variant set id
The selected variant ID from settings, or undefined if none is selected
Returns all IDs of all prompt fragments of the given set
The prompt variant set id
Array of variant IDs
ProtectedinitProtectedrecalculateRecalculates the selected variants map for all variant sets and fires the onSelectedVariantChangeEmitter if the selectedVariants field has changed.
ProtectedremoveRemoves a variant ID from the fragment variants map
The prompt variant set id
The variant ID to remove
Removes a prompt fragment from the service
The fragment ID to remove
ProtectedresolveProtectedresolveCalculates all variable and argument replacements for an unresolved template.
the unresolved template text
Optionalargs: { [key: string]: unknown }the object with placeholders, mapping the placeholder key to the value
Optionalcontext: AIVariableContextthe AIVariableContext to use during variable resolution
OptionalresolveVariable: (variable: AIVariableArg) => Promise<undefined | ResolvedAIVariable>the variable resolving method. Fall back to using the AIVariableService if not given.
Object containing replacements and resolved variables
ProtectedstripStrips comments from a template string
The template text to process
Template text with comments removed
Updates the selected variant for a prompt variant set
The ID of the agent to update
The prompt variant set ID
The new variant ID to set as selected
Collection of built-in prompt fragments