@yolo-labs/core-prompts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,163 @@
1
+ import { PromptStore, PromptRecord, PromptAssembler, PromptAssemblerContext } from '@yolo-labs/core-types';
2
+
3
+ /** Configuration options for the YAML-based prompt store. */
4
+ interface YamlPromptStoreOptions {
5
+ /** Root directory containing YAML prompt files. */
6
+ directory: string;
7
+ /** Whether to scan subdirectories recursively (default: true). */
8
+ recursive?: boolean;
9
+ /** Whether to watch for file changes and auto-reload. */
10
+ watchForChanges?: boolean;
11
+ }
12
+ /**
13
+ * Loads and manages prompts from YAML files in a directory.
14
+ *
15
+ * @remarks
16
+ * Each YAML file must contain `key` and `content` fields. Optional fields
17
+ * include `version`, `tags`, and `metadata`. Call {@link load} before
18
+ * querying. Supports optional file watching for development hot-reload.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const store = new YamlPromptStore({ directory: './prompts' });
23
+ * await store.load();
24
+ * const prompt = await store.get('system-base');
25
+ * ```
26
+ */
27
+ declare class YamlPromptStore implements PromptStore {
28
+ private prompts;
29
+ private directory;
30
+ private recursive;
31
+ private abortController?;
32
+ constructor(options: YamlPromptStoreOptions);
33
+ /**
34
+ * Scans the configured directory and loads all YAML prompt files into memory.
35
+ *
36
+ * @remarks
37
+ * Must be called before any query methods (`get`, `list`, `queryByTags`).
38
+ * Subsequent calls reload all prompts from disk, replacing the in-memory state.
39
+ */
40
+ load(): Promise<void>;
41
+ /**
42
+ * Starts watching the directory for YAML file changes and auto-reloads.
43
+ *
44
+ * @remarks
45
+ * Uses `fs/promises.watch` with an AbortController. Call {@link stopWatching}
46
+ * to clean up. Primarily useful during development.
47
+ */
48
+ startWatching(): void;
49
+ /** Stops watching for file changes. */
50
+ stopWatching(): void;
51
+ private watchDirectory;
52
+ private scanDirectory;
53
+ private loadFile;
54
+ /** Retrieves a prompt record by its unique key. */
55
+ get(key: string): Promise<PromptRecord | undefined>;
56
+ /** Returns all loaded prompt records. */
57
+ list(): Promise<PromptRecord[]>;
58
+ /** Inserts or updates a prompt record in the in-memory store. */
59
+ upsert(record: PromptRecord): Promise<PromptRecord>;
60
+ /** Deletes a prompt record by key from the in-memory store. */
61
+ delete(key: string): Promise<void>;
62
+ /**
63
+ * Returns all prompt records matching every specified tag (AND logic).
64
+ *
65
+ * @param tags - Array of tags that must all be present on a record.
66
+ * @returns Prompt records that contain all specified tags.
67
+ */
68
+ queryByTags(tags: string[]): Promise<PromptRecord[]>;
69
+ }
70
+
71
+ /**
72
+ * Default {@link PromptAssembler} implementation.
73
+ *
74
+ * @remarks
75
+ * Fetches prompt fragments from a {@link PromptStore}, concatenates them
76
+ * with double-newline separators, then applies variable interpolation
77
+ * (`{{var}}`) and conditional sections (`{{#if var}}...{{/if}}`).
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const assembler = new PromptAssemblerImpl(store);
82
+ * const prompt = await assembler.assemble(
83
+ * ['system-base', 'tools-description'],
84
+ * { variables: { projectName: 'MyApp', hasTools: 'true' } },
85
+ * );
86
+ * ```
87
+ */
88
+ declare class PromptAssemblerImpl implements PromptAssembler {
89
+ private store;
90
+ constructor(store: PromptStore);
91
+ /**
92
+ * Fetches prompt fragments by key, concatenates them, and interpolates variables.
93
+ *
94
+ * @param keys - Ordered array of prompt keys to fetch and concatenate.
95
+ * @param context - Variables and metadata for interpolation.
96
+ * @returns The assembled prompt string.
97
+ */
98
+ assemble(keys: string[], context: PromptAssemblerContext): Promise<string>;
99
+ /**
100
+ * Queries prompts by tags, concatenates their content, and interpolates variables.
101
+ *
102
+ * @param tags - Tags to query the prompt store with (AND logic).
103
+ * @param context - Variables and metadata for interpolation.
104
+ * @returns The assembled prompt string.
105
+ */
106
+ assembleByTags(tags: string[], context: PromptAssemblerContext): Promise<string>;
107
+ private interpolate;
108
+ }
109
+
110
+ /**
111
+ * Abstract base class for database-backed prompt stores.
112
+ *
113
+ * @remarks
114
+ * Consumers extend this class and implement the abstract methods for their
115
+ * specific database (MongoDB, PostgreSQL, Cloudflare D1, etc.). Optional
116
+ * hookpoints for initialization, cleanup, and version history are provided
117
+ * with no-op defaults that subclasses can override.
118
+ */
119
+ declare abstract class DatabasePromptStore implements PromptStore {
120
+ /** Retrieves a prompt record by its unique key. */
121
+ abstract get(key: string): Promise<PromptRecord | undefined>;
122
+ /** Returns all stored prompt records. */
123
+ abstract list(): Promise<PromptRecord[]>;
124
+ /** Inserts or updates a prompt record. */
125
+ abstract upsert(record: PromptRecord): Promise<PromptRecord>;
126
+ /** Deletes a prompt record by key. */
127
+ abstract delete(key: string): Promise<void>;
128
+ /** Returns all prompt records matching every specified tag. */
129
+ abstract queryByTags(tags: string[]): Promise<PromptRecord[]>;
130
+ /**
131
+ * Optional: Initialize database connection or schema.
132
+ * Override in subclass if needed.
133
+ */
134
+ initialize(): Promise<void>;
135
+ /**
136
+ * Optional: Close database connection.
137
+ * Override in subclass if needed.
138
+ */
139
+ close(): Promise<void>;
140
+ /**
141
+ * Retrieves a specific version of a prompt.
142
+ *
143
+ * @param _key - The prompt key.
144
+ * @param _version - The version number to retrieve.
145
+ * @returns The prompt record at the specified version, or `undefined`.
146
+ *
147
+ * @remarks
148
+ * Override in subclass to support prompt versioning.
149
+ */
150
+ getVersion(_key: string, _version: number): Promise<PromptRecord | undefined>;
151
+ /**
152
+ * Lists all versions of a prompt.
153
+ *
154
+ * @param _key - The prompt key to list versions for.
155
+ * @returns All version records for the given key.
156
+ *
157
+ * @remarks
158
+ * Override in subclass to support prompt version history.
159
+ */
160
+ listVersions(_key: string): Promise<PromptRecord[]>;
161
+ }
162
+
163
+ export { DatabasePromptStore, PromptAssemblerImpl, YamlPromptStore, type YamlPromptStoreOptions };
package/dist/index.js ADDED
@@ -0,0 +1,227 @@
1
+ // src/yaml-prompt-store.ts
2
+ import { readdir, readFile, watch } from "fs/promises";
3
+ import { join, extname } from "path";
4
+ import { parse as parseYaml } from "yaml";
5
+ var YamlPromptStore = class {
6
+ prompts = /* @__PURE__ */ new Map();
7
+ directory;
8
+ recursive;
9
+ abortController;
10
+ constructor(options) {
11
+ this.directory = options.directory;
12
+ this.recursive = options.recursive ?? true;
13
+ }
14
+ /**
15
+ * Scans the configured directory and loads all YAML prompt files into memory.
16
+ *
17
+ * @remarks
18
+ * Must be called before any query methods (`get`, `list`, `queryByTags`).
19
+ * Subsequent calls reload all prompts from disk, replacing the in-memory state.
20
+ */
21
+ async load() {
22
+ this.prompts.clear();
23
+ await this.scanDirectory(this.directory);
24
+ }
25
+ /**
26
+ * Starts watching the directory for YAML file changes and auto-reloads.
27
+ *
28
+ * @remarks
29
+ * Uses `fs/promises.watch` with an AbortController. Call {@link stopWatching}
30
+ * to clean up. Primarily useful during development.
31
+ */
32
+ startWatching() {
33
+ this.abortController = new AbortController();
34
+ this.watchDirectory().catch(() => {
35
+ });
36
+ }
37
+ /** Stops watching for file changes. */
38
+ stopWatching() {
39
+ this.abortController?.abort();
40
+ this.abortController = void 0;
41
+ }
42
+ async watchDirectory() {
43
+ if (!this.abortController) return;
44
+ try {
45
+ const watcher = watch(this.directory, {
46
+ recursive: this.recursive,
47
+ signal: this.abortController.signal
48
+ });
49
+ for await (const event of watcher) {
50
+ if (event.filename && (event.filename.endsWith(".yaml") || event.filename.endsWith(".yml"))) {
51
+ await this.load();
52
+ }
53
+ }
54
+ } catch {
55
+ }
56
+ }
57
+ // 34b: Recursive directory scanning
58
+ async scanDirectory(dir) {
59
+ let entries;
60
+ try {
61
+ entries = await readdir(dir, { withFileTypes: true });
62
+ } catch {
63
+ return;
64
+ }
65
+ for (const entry of entries) {
66
+ const fullPath = join(dir, entry.name);
67
+ if (entry.isDirectory() && this.recursive) {
68
+ await this.scanDirectory(fullPath);
69
+ } else if (entry.isFile() && (extname(entry.name) === ".yaml" || extname(entry.name) === ".yml")) {
70
+ await this.loadFile(fullPath);
71
+ }
72
+ }
73
+ }
74
+ // 34a: Parse YAML schema
75
+ async loadFile(filePath) {
76
+ try {
77
+ const content = await readFile(filePath, "utf-8");
78
+ const parsed = parseYaml(content);
79
+ if (!parsed.key || !parsed.content) {
80
+ return;
81
+ }
82
+ const record = {
83
+ key: parsed.key,
84
+ content: parsed.content,
85
+ version: parsed.version ?? 1,
86
+ metadata: parsed.metadata ?? {},
87
+ tags: parsed.tags ?? []
88
+ };
89
+ this.prompts.set(record.key, record);
90
+ } catch {
91
+ }
92
+ }
93
+ /** Retrieves a prompt record by its unique key. */
94
+ async get(key) {
95
+ return this.prompts.get(key);
96
+ }
97
+ /** Returns all loaded prompt records. */
98
+ async list() {
99
+ return Array.from(this.prompts.values());
100
+ }
101
+ /** Inserts or updates a prompt record in the in-memory store. */
102
+ async upsert(record) {
103
+ this.prompts.set(record.key, record);
104
+ return record;
105
+ }
106
+ /** Deletes a prompt record by key from the in-memory store. */
107
+ async delete(key) {
108
+ this.prompts.delete(key);
109
+ }
110
+ /**
111
+ * Returns all prompt records matching every specified tag (AND logic).
112
+ *
113
+ * @param tags - Array of tags that must all be present on a record.
114
+ * @returns Prompt records that contain all specified tags.
115
+ */
116
+ async queryByTags(tags) {
117
+ return Array.from(this.prompts.values()).filter(
118
+ (record) => tags.every((tag) => record.tags.includes(tag))
119
+ );
120
+ }
121
+ };
122
+
123
+ // src/prompt-assembler.ts
124
+ var PromptAssemblerImpl = class {
125
+ store;
126
+ constructor(store) {
127
+ this.store = store;
128
+ }
129
+ /**
130
+ * Fetches prompt fragments by key, concatenates them, and interpolates variables.
131
+ *
132
+ * @param keys - Ordered array of prompt keys to fetch and concatenate.
133
+ * @param context - Variables and metadata for interpolation.
134
+ * @returns The assembled prompt string.
135
+ */
136
+ async assemble(keys, context) {
137
+ const fragments = [];
138
+ for (const key of keys) {
139
+ const record = await this.store.get(key);
140
+ if (record) {
141
+ fragments.push(record.content);
142
+ }
143
+ }
144
+ const raw = fragments.join("\n\n");
145
+ return this.interpolate(raw, context);
146
+ }
147
+ /**
148
+ * Queries prompts by tags, concatenates their content, and interpolates variables.
149
+ *
150
+ * @param tags - Tags to query the prompt store with (AND logic).
151
+ * @param context - Variables and metadata for interpolation.
152
+ * @returns The assembled prompt string.
153
+ */
154
+ async assembleByTags(tags, context) {
155
+ const records = await this.store.queryByTags(tags);
156
+ const raw = records.map((r) => r.content).join("\n\n");
157
+ return this.interpolate(raw, context);
158
+ }
159
+ // 35c/35d: Variable interpolation and conditional sections
160
+ interpolate(content, context) {
161
+ let result = content;
162
+ result = result.replace(
163
+ /\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g,
164
+ (_match, varName, innerContent) => {
165
+ const value = context.variables[varName];
166
+ if (value && value !== "false" && value !== "0" && value !== "") {
167
+ return innerContent;
168
+ }
169
+ return "";
170
+ }
171
+ );
172
+ result = result.replace(
173
+ /\{\{(\w+)\}\}/g,
174
+ (_match, varName) => {
175
+ return context.variables[varName] ?? "";
176
+ }
177
+ );
178
+ return result;
179
+ }
180
+ };
181
+
182
+ // src/database-prompt-store.ts
183
+ var DatabasePromptStore = class {
184
+ /**
185
+ * Optional: Initialize database connection or schema.
186
+ * Override in subclass if needed.
187
+ */
188
+ async initialize() {
189
+ }
190
+ /**
191
+ * Optional: Close database connection.
192
+ * Override in subclass if needed.
193
+ */
194
+ async close() {
195
+ }
196
+ /**
197
+ * Retrieves a specific version of a prompt.
198
+ *
199
+ * @param _key - The prompt key.
200
+ * @param _version - The version number to retrieve.
201
+ * @returns The prompt record at the specified version, or `undefined`.
202
+ *
203
+ * @remarks
204
+ * Override in subclass to support prompt versioning.
205
+ */
206
+ async getVersion(_key, _version) {
207
+ return void 0;
208
+ }
209
+ /**
210
+ * Lists all versions of a prompt.
211
+ *
212
+ * @param _key - The prompt key to list versions for.
213
+ * @returns All version records for the given key.
214
+ *
215
+ * @remarks
216
+ * Override in subclass to support prompt version history.
217
+ */
218
+ async listVersions(_key) {
219
+ return [];
220
+ }
221
+ };
222
+ export {
223
+ DatabasePromptStore,
224
+ PromptAssemblerImpl,
225
+ YamlPromptStore
226
+ };
227
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/yaml-prompt-store.ts","../src/prompt-assembler.ts","../src/database-prompt-store.ts"],"sourcesContent":["// Task 34: YamlPromptStore — load prompts from .yaml files in a directory\n\nimport { readdir, readFile, watch } from 'node:fs/promises';\nimport { join, extname } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport type { PromptRecord, PromptStore } from '@yolo-labs/core-types';\n\n/** Configuration options for the YAML-based prompt store. */\nexport interface YamlPromptStoreOptions {\n /** Root directory containing YAML prompt files. */\n directory: string;\n /** Whether to scan subdirectories recursively (default: true). */\n recursive?: boolean;\n /** Whether to watch for file changes and auto-reload. */\n watchForChanges?: boolean;\n}\n\ninterface YamlPromptFile {\n key: string;\n version?: number;\n tags?: string[];\n metadata?: Record<string, unknown>;\n content: string;\n}\n\n/**\n * Loads and manages prompts from YAML files in a directory.\n *\n * @remarks\n * Each YAML file must contain `key` and `content` fields. Optional fields\n * include `version`, `tags`, and `metadata`. Call {@link load} before\n * querying. Supports optional file watching for development hot-reload.\n *\n * @example\n * ```ts\n * const store = new YamlPromptStore({ directory: './prompts' });\n * await store.load();\n * const prompt = await store.get('system-base');\n * ```\n */\nexport class YamlPromptStore implements PromptStore {\n private prompts = new Map<string, PromptRecord>();\n private directory: string;\n private recursive: boolean;\n private abortController?: AbortController;\n\n constructor(options: YamlPromptStoreOptions) {\n this.directory = options.directory;\n this.recursive = options.recursive ?? true;\n }\n\n /**\n * Scans the configured directory and loads all YAML prompt files into memory.\n *\n * @remarks\n * Must be called before any query methods (`get`, `list`, `queryByTags`).\n * Subsequent calls reload all prompts from disk, replacing the in-memory state.\n */\n async load(): Promise<void> {\n this.prompts.clear();\n await this.scanDirectory(this.directory);\n }\n\n /**\n * Starts watching the directory for YAML file changes and auto-reloads.\n *\n * @remarks\n * Uses `fs/promises.watch` with an AbortController. Call {@link stopWatching}\n * to clean up. Primarily useful during development.\n */\n startWatching(): void {\n this.abortController = new AbortController();\n this.watchDirectory().catch(() => {\n // Silently handle watch errors (e.g., directory removed)\n });\n }\n\n /** Stops watching for file changes. */\n stopWatching(): void {\n this.abortController?.abort();\n this.abortController = undefined;\n }\n\n private async watchDirectory(): Promise<void> {\n if (!this.abortController) return;\n try {\n const watcher = watch(this.directory, {\n recursive: this.recursive,\n signal: this.abortController.signal,\n });\n for await (const event of watcher) {\n if (\n event.filename &&\n (event.filename.endsWith('.yaml') || event.filename.endsWith('.yml'))\n ) {\n await this.load();\n }\n }\n } catch {\n // AbortError or watch error — stop gracefully\n }\n }\n\n // 34b: Recursive directory scanning\n private async scanDirectory(dir: string): Promise<void> {\n let entries;\n try {\n entries = await readdir(dir, { withFileTypes: true });\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory() && this.recursive) {\n await this.scanDirectory(fullPath);\n } else if (\n entry.isFile() &&\n (extname(entry.name) === '.yaml' || extname(entry.name) === '.yml')\n ) {\n await this.loadFile(fullPath);\n }\n }\n }\n\n // 34a: Parse YAML schema\n private async loadFile(filePath: string): Promise<void> {\n try {\n const content = await readFile(filePath, 'utf-8');\n const parsed = parseYaml(content) as YamlPromptFile;\n\n if (!parsed.key || !parsed.content) {\n return; // Skip invalid files\n }\n\n const record: PromptRecord = {\n key: parsed.key,\n content: parsed.content,\n version: parsed.version ?? 1,\n metadata: parsed.metadata ?? {},\n tags: parsed.tags ?? [],\n };\n\n this.prompts.set(record.key, record);\n } catch {\n // Skip files that fail to parse\n }\n }\n\n /** Retrieves a prompt record by its unique key. */\n async get(key: string): Promise<PromptRecord | undefined> {\n return this.prompts.get(key);\n }\n\n /** Returns all loaded prompt records. */\n async list(): Promise<PromptRecord[]> {\n return Array.from(this.prompts.values());\n }\n\n /** Inserts or updates a prompt record in the in-memory store. */\n async upsert(record: PromptRecord): Promise<PromptRecord> {\n this.prompts.set(record.key, record);\n return record;\n }\n\n /** Deletes a prompt record by key from the in-memory store. */\n async delete(key: string): Promise<void> {\n this.prompts.delete(key);\n }\n\n /**\n * Returns all prompt records matching every specified tag (AND logic).\n *\n * @param tags - Array of tags that must all be present on a record.\n * @returns Prompt records that contain all specified tags.\n */\n async queryByTags(tags: string[]): Promise<PromptRecord[]> {\n return Array.from(this.prompts.values()).filter((record) =>\n tags.every((tag) => record.tags.includes(tag)),\n );\n }\n}\n","// Task 35: PromptAssemblerImpl\n\nimport type {\n PromptAssembler,\n PromptAssemblerContext,\n PromptStore,\n} from '@yolo-labs/core-types';\n\n/**\n * Default {@link PromptAssembler} implementation.\n *\n * @remarks\n * Fetches prompt fragments from a {@link PromptStore}, concatenates them\n * with double-newline separators, then applies variable interpolation\n * (`{{var}}`) and conditional sections (`{{#if var}}...{{/if}}`).\n *\n * @example\n * ```ts\n * const assembler = new PromptAssemblerImpl(store);\n * const prompt = await assembler.assemble(\n * ['system-base', 'tools-description'],\n * { variables: { projectName: 'MyApp', hasTools: 'true' } },\n * );\n * ```\n */\nexport class PromptAssemblerImpl implements PromptAssembler {\n private store: PromptStore;\n\n constructor(store: PromptStore) {\n this.store = store;\n }\n\n /**\n * Fetches prompt fragments by key, concatenates them, and interpolates variables.\n *\n * @param keys - Ordered array of prompt keys to fetch and concatenate.\n * @param context - Variables and metadata for interpolation.\n * @returns The assembled prompt string.\n */\n async assemble(\n keys: string[],\n context: PromptAssemblerContext,\n ): Promise<string> {\n const fragments: string[] = [];\n\n for (const key of keys) {\n const record = await this.store.get(key);\n if (record) {\n fragments.push(record.content);\n }\n }\n\n const raw = fragments.join('\\n\\n');\n return this.interpolate(raw, context);\n }\n\n /**\n * Queries prompts by tags, concatenates their content, and interpolates variables.\n *\n * @param tags - Tags to query the prompt store with (AND logic).\n * @param context - Variables and metadata for interpolation.\n * @returns The assembled prompt string.\n */\n async assembleByTags(\n tags: string[],\n context: PromptAssemblerContext,\n ): Promise<string> {\n const records = await this.store.queryByTags(tags);\n const raw = records.map((r) => r.content).join('\\n\\n');\n return this.interpolate(raw, context);\n }\n\n // 35c/35d: Variable interpolation and conditional sections\n private interpolate(content: string, context: PromptAssemblerContext): string {\n let result = content;\n\n // 35d: Process conditional sections first: {{#if varName}}...{{/if}}\n result = result.replace(\n /\\{\\{#if\\s+(\\w+)\\}\\}([\\s\\S]*?)\\{\\{\\/if\\}\\}/g,\n (_match, varName: string, innerContent: string) => {\n const value = context.variables[varName];\n if (value && value !== 'false' && value !== '0' && value !== '') {\n return innerContent;\n }\n return '';\n },\n );\n\n // 35c: Variable interpolation: {{variable}}\n result = result.replace(\n /\\{\\{(\\w+)\\}\\}/g,\n (_match, varName: string) => {\n return context.variables[varName] ?? '';\n },\n );\n\n return result;\n }\n}\n","// Task 36: DatabasePromptStore abstract class\n\nimport type { PromptRecord, PromptStore } from '@yolo-labs/core-types';\n\n/**\n * Abstract base class for database-backed prompt stores.\n *\n * @remarks\n * Consumers extend this class and implement the abstract methods for their\n * specific database (MongoDB, PostgreSQL, Cloudflare D1, etc.). Optional\n * hookpoints for initialization, cleanup, and version history are provided\n * with no-op defaults that subclasses can override.\n */\nexport abstract class DatabasePromptStore implements PromptStore {\n /** Retrieves a prompt record by its unique key. */\n abstract get(key: string): Promise<PromptRecord | undefined>;\n /** Returns all stored prompt records. */\n abstract list(): Promise<PromptRecord[]>;\n /** Inserts or updates a prompt record. */\n abstract upsert(record: PromptRecord): Promise<PromptRecord>;\n /** Deletes a prompt record by key. */\n abstract delete(key: string): Promise<void>;\n /** Returns all prompt records matching every specified tag. */\n abstract queryByTags(tags: string[]): Promise<PromptRecord[]>;\n\n /**\n * Optional: Initialize database connection or schema.\n * Override in subclass if needed.\n */\n async initialize(): Promise<void> {}\n\n /**\n * Optional: Close database connection.\n * Override in subclass if needed.\n */\n async close(): Promise<void> {}\n\n /**\n * Retrieves a specific version of a prompt.\n *\n * @param _key - The prompt key.\n * @param _version - The version number to retrieve.\n * @returns The prompt record at the specified version, or `undefined`.\n *\n * @remarks\n * Override in subclass to support prompt versioning.\n */\n async getVersion(\n _key: string,\n _version: number,\n ): Promise<PromptRecord | undefined> {\n return undefined;\n }\n\n /**\n * Lists all versions of a prompt.\n *\n * @param _key - The prompt key to list versions for.\n * @returns All version records for the given key.\n *\n * @remarks\n * Override in subclass to support prompt version history.\n */\n async listVersions(_key: string): Promise<PromptRecord[]> {\n return [];\n }\n}\n"],"mappings":";AAEA,SAAS,SAAS,UAAU,aAAa;AACzC,SAAS,MAAM,eAAe;AAC9B,SAAS,SAAS,iBAAiB;AAoC5B,IAAM,kBAAN,MAA6C;AAAA,EAC1C,UAAU,oBAAI,IAA0B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,SAAiC;AAC3C,SAAK,YAAY,QAAQ;AACzB,SAAK,YAAY,QAAQ,aAAa;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OAAsB;AAC1B,SAAK,QAAQ,MAAM;AACnB,UAAM,KAAK,cAAc,KAAK,SAAS;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,gBAAsB;AACpB,SAAK,kBAAkB,IAAI,gBAAgB;AAC3C,SAAK,eAAe,EAAE,MAAM,MAAM;AAAA,IAElC,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,eAAqB;AACnB,SAAK,iBAAiB,MAAM;AAC5B,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAc,iBAAgC;AAC5C,QAAI,CAAC,KAAK,gBAAiB;AAC3B,QAAI;AACF,YAAM,UAAU,MAAM,KAAK,WAAW;AAAA,QACpC,WAAW,KAAK;AAAA,QAChB,QAAQ,KAAK,gBAAgB;AAAA,MAC/B,CAAC;AACD,uBAAiB,SAAS,SAAS;AACjC,YACE,MAAM,aACL,MAAM,SAAS,SAAS,OAAO,KAAK,MAAM,SAAS,SAAS,MAAM,IACnE;AACA,gBAAM,KAAK,KAAK;AAAA,QAClB;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,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ACT;AAAA,IACF;AAGA,aAAS,OAAO;AAAA,MACd;AAAA,MACA,CAAC,QAAQ,YAAoB;AAC3B,eAAO,QAAQ,UAAU,OAAO,KAAK;AAAA,MACvC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;;;ACrFO,IAAe,sBAAf,MAA0D;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB/D,MAAM,aAA4B;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,MAAM,QAAuB;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY9B,MAAM,WACJ,MACA,UACmC;AACnC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,aAAa,MAAuC;AACxD,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@yolo-labs/core-prompts",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "dependencies": {
17
+ "yaml": "^2.8.2",
18
+ "@yolo-labs/core-types": "1.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "tsup": "^8.0.0",
22
+ "typescript": "^5.5.0"
23
+ },
24
+ "description": "YAML/DB prompt stores and prompt assembly with interpolation",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/yolo-labs-hq/monorepo.git",
29
+ "directory": "yolo-core/packages/prompts"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
35
+ "homepage": "https://github.com/yolo-labs-hq/monorepo/tree/main/yolo-core#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/yolo-labs-hq/monorepo/issues"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup",
41
+ "clean": "rm -rf dist *.tsbuildinfo"
42
+ }
43
+ }