chore: convert submodules to standard directories for true monorepo structure
This commit is contained in:
30
vibn-agent-runner/dist/prompts/loader.js
vendored
Normal file
30
vibn-agent-runner/dist/prompts/loader.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
// ---------------------------------------------------------------------------
|
||||
// Prompt registry + variable resolver
|
||||
//
|
||||
// Prompts are template strings stored in this directory, one file per agent.
|
||||
// Variables are resolved at call time using {{variable_name}} syntax.
|
||||
//
|
||||
// Future: swap template strings for .md files with a build-time copy step.
|
||||
// ---------------------------------------------------------------------------
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.registerPrompt = registerPrompt;
|
||||
exports.resolvePrompt = resolvePrompt;
|
||||
exports.hasPrompt = hasPrompt;
|
||||
const _prompts = new Map();
|
||||
function registerPrompt(id, template) {
|
||||
_prompts.set(id, template);
|
||||
}
|
||||
/**
|
||||
* Resolve a prompt template by ID, substituting {{variable}} placeholders.
|
||||
* Missing variables are replaced with an empty string.
|
||||
*/
|
||||
function resolvePrompt(id, variables = {}) {
|
||||
const template = _prompts.get(id);
|
||||
if (!template)
|
||||
throw new Error(`Prompt not found: "${id}"`);
|
||||
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => variables[key] ?? '');
|
||||
}
|
||||
function hasPrompt(id) {
|
||||
return _prompts.has(id);
|
||||
}
|
||||
Reference in New Issue
Block a user