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
Readonly
customizationProtected
Readonly
loggerReadonly
onEvent fired when the prompts change
Readonly
onEvent fired when the selected variant for a prompt variant set changes
Protected
Optional
promptProtected
Readonly
settingsProtected
toProtected
Readonly
toolProtected
Readonly
variableAdds a prompt fragment to the service
The fragment to store
Optional
promptVariantSetId: stringOptional ID of the prompt variant set this is a variant of
Protected
addAdds 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 =====
Protected
findFinds a built-in fragment by its ID
The ID of the fragment to find
The built-in fragment or undefined if not found
Protected
fireGets 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 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 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 =====
Optional
args: { [key: string]: unknown }Optional
context: AIVariableContextResolves a prompt fragment by replacing variables but preserving function references
The prompt fragment ID
Optional
args: { [key: string]: unknown }Optional object with values for variable replacement
Optional
context: AIVariableContextOptional context for variable resolution
Optional
resolveVariable: (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
Protected
initProtected
recalculateRecalculates the selected variants map for all variant sets and fires the onSelectedVariantChangeEmitter if the selectedVariants field has changed.
Protected
removeRemoves 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
Protected
resolveProtected
resolveCalculates all variable and argument replacements for an unresolved template.
the unresolved template text
Optional
args: { [key: string]: unknown }the object with placeholders, mapping the placeholder key to the value
Optional
context: AIVariableContextthe AIVariableContext to use during variable resolution
Optional
resolveVariable: (variable: AIVariableArg) => Promise<undefined | ResolvedAIVariable>the variable resolving method. Fall back to using the AIVariableService if not given.
Object containing replacements and resolved variables
Protected
stripStrips 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