Creates a new SystemPromptResolver instance.
Optionalregistry: SystemPromptsRegistryOptional registry of prompt preset templates indexed by tag name. If provided, overrides can reference templates by tag name.
Resolves the final system prompt by applying overrides in precedence order.
Object containing the base prompt and optional overrides at each level. - base (string): The fundamental system prompt (required) - instance (string | SystemPromptOverride): Instance-level override - thread (string | SystemPromptOverride): Thread-level override - call (string | SystemPromptOverride): Call-level override
OptionaltraceId: stringOptional trace identifier for logging and debugging purposes.
A promise resolving to the final, resolved system prompt string.
The resolution process follows this precedence hierarchy (highest to lowest):
For each override level:
Template variable substitution:
Merge strategies:
Note: 'replace' strategy is intentionally unsupported to prevent custom prompts from overriding framework-required structural contracts.
Default implementation of ISystemPromptResolver interface.
Remarks
This class manages the resolution and merging of system prompts across multiple levels:
Each level can provide either:
The resolution process:
At each level, the override is:
Template rendering supports:
Example
SystemPromptResolver
Implements
ISystemPromptResolver