feat(prompts-core): add public prompt loader types
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
export interface VariantTest {
|
||||||
|
test: (input: { modelID?: string; agentName?: string }) => boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VariantFallback {
|
||||||
|
fallback: true
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VariantDefinition = VariantTest | VariantFallback
|
||||||
|
|
||||||
|
export interface VariantTable {
|
||||||
|
[variantKey: string]: VariantDefinition
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResolveVariantInput {
|
||||||
|
modelID?: string
|
||||||
|
agentName?: string
|
||||||
|
variants: VariantTable
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RuntimeInjection {
|
||||||
|
placeholder: string
|
||||||
|
resolver: () => string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoadPromptInput {
|
||||||
|
source: string
|
||||||
|
name: string
|
||||||
|
variant: string
|
||||||
|
inject?: readonly RuntimeInjection[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoadedPrompt {
|
||||||
|
body: string
|
||||||
|
frontmatter: Record<string, unknown>
|
||||||
|
resolvedPath: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PromptNotFoundError extends Error {
|
||||||
|
constructor(message: string) {
|
||||||
|
super(message)
|
||||||
|
this.name = "PromptNotFoundError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NoMatchingVariantError extends Error {
|
||||||
|
constructor(message: string) {
|
||||||
|
super(message)
|
||||||
|
this.name = "NoMatchingVariantError"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user