@lov3kaizen/agentsea-prompts 0.5.1

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,280 @@
1
+ import { EventEmitter } from 'eventemitter3';
2
+ import { P as PromptData, V as VariableDefinitions, R as RenderOptions, c as RenderedPrompt, C as CreatePromptInput, U as UpdatePromptInput, f as PromptQueryOptions } from './prompt.types-UpghZJIu.js';
3
+ import { Z as StorageAdapter, E as EnvironmentConfig, a as VersionHistoryEntry, V as VersionInfo, e as DiffOptions, D as DiffResult, C as CreateBranchInput, B as BranchInfo, M as MergeOptions, f as MergeResult, R as RollbackOptions, i as RollbackResult, P as PromoteInput, j as PromotionResult, A as ABTestConfig, o as ABTestData, J as CreateReviewInput, F as ReviewRequest, Y as AuditLogQueryOptions, W as AuditLogEntry } from './storage.types-CNQ8CxaH.js';
4
+ import { P as Prompt, a as PromptClient } from './Client-raKKKXgi.js';
5
+ import Handlebars from 'handlebars';
6
+
7
+ interface RegistryConfig {
8
+ storage: StorageAdapter;
9
+ defaultEnvironment?: string;
10
+ environments?: EnvironmentConfig[];
11
+ caching?: CacheConfig;
12
+ hooks?: RegistryHooks;
13
+ }
14
+ interface CacheConfig {
15
+ enabled: boolean;
16
+ ttl?: number;
17
+ maxSize?: number;
18
+ }
19
+ type RegistryEventType = 'prompt:created' | 'prompt:updated' | 'prompt:deleted' | 'prompt:promoted' | 'prompt:rolledback' | 'version:created' | 'branch:created' | 'branch:merged' | 'branch:deleted' | 'test:created' | 'test:started' | 'test:ended' | 'review:created' | 'review:approved' | 'review:rejected' | 'review:merged';
20
+ interface RegistryEvent {
21
+ type: RegistryEventType;
22
+ promptId?: string;
23
+ promptName?: string;
24
+ version?: string;
25
+ environment?: string;
26
+ actor?: string;
27
+ timestamp: Date;
28
+ data?: Record<string, unknown>;
29
+ }
30
+ interface RegistryHooks {
31
+ beforeCreate?: (prompt: unknown) => Promise<unknown>;
32
+ afterCreate?: (prompt: unknown) => Promise<void>;
33
+ beforeUpdate?: (prompt: unknown, updates: unknown) => Promise<unknown>;
34
+ afterUpdate?: (prompt: unknown) => Promise<void>;
35
+ beforeDelete?: (promptId: string) => Promise<boolean>;
36
+ afterDelete?: (promptId: string) => Promise<void>;
37
+ beforePromote?: (promotion: unknown) => Promise<unknown>;
38
+ afterPromote?: (promotion: unknown) => Promise<void>;
39
+ }
40
+ interface RegistryStats {
41
+ totalPrompts: number;
42
+ totalVersions: number;
43
+ promptsByEnvironment: Record<string, number>;
44
+ promptsByStatus: Record<string, number>;
45
+ activeTests: number;
46
+ pendingReviews: number;
47
+ }
48
+ interface PartialDefinition {
49
+ name: string;
50
+ template: string;
51
+ description?: string;
52
+ variables?: string[];
53
+ }
54
+
55
+ declare class PromptVersion implements VersionHistoryEntry {
56
+ readonly promptId: string;
57
+ readonly promptName: string;
58
+ readonly version: string;
59
+ readonly hash: string;
60
+ readonly message?: string;
61
+ readonly author?: string;
62
+ readonly createdAt: Date;
63
+ readonly parentVersion?: string;
64
+ readonly branch?: string;
65
+ readonly environment: string;
66
+ readonly snapshot: PromptData;
67
+ constructor(data: VersionHistoryEntry);
68
+ getInfo(): VersionInfo;
69
+ toData(): VersionHistoryEntry;
70
+ isNewerThan(other: PromptVersion | string): boolean;
71
+ isOlderThan(other: PromptVersion | string): boolean;
72
+ toString(): string;
73
+ static fromPrompt(prompt: PromptData, options?: {
74
+ message?: string;
75
+ author?: string;
76
+ parentVersion?: string;
77
+ branch?: string;
78
+ }): PromptVersion;
79
+ }
80
+ declare class VersionHistory {
81
+ private versions;
82
+ private currentVersion;
83
+ constructor(versions?: PromptVersion[]);
84
+ add(version: PromptVersion): void;
85
+ get(version: string): PromptVersion | undefined;
86
+ getLatest(): PromptVersion | undefined;
87
+ getAll(limit?: number): PromptVersion[];
88
+ get count(): number;
89
+ getNextVersion(): string;
90
+ getByBranch(branch: string): PromptVersion[];
91
+ getByAuthor(author: string): PromptVersion[];
92
+ getByDateRange(start: Date, end: Date): PromptVersion[];
93
+ has(version: string): boolean;
94
+ getPrevious(version: string): PromptVersion | undefined;
95
+ getLineage(version: string): PromptVersion[];
96
+ }
97
+
98
+ interface TemplateCompileOptions {
99
+ strict?: boolean;
100
+ noEscape?: boolean;
101
+ knownHelpers?: Record<string, boolean>;
102
+ knownHelpersOnly?: boolean;
103
+ }
104
+ declare class PromptTemplate {
105
+ readonly template: string;
106
+ readonly variables: VariableDefinitions;
107
+ private compiledTemplate?;
108
+ private handlebars;
109
+ constructor(template: string, variables?: VariableDefinitions, options?: {
110
+ partials?: Record<string, string>;
111
+ helpers?: Record<string, unknown>;
112
+ });
113
+ private registerDefaultHelpers;
114
+ private inferVariables;
115
+ compile(options?: TemplateCompileOptions): HandlebarsTemplateDelegate;
116
+ render(variables: Record<string, unknown>, options?: RenderOptions): RenderedPrompt;
117
+ registerPartial(name: string, template: string): void;
118
+ registerHelper(name: string, helper: Handlebars.HelperDelegate): void;
119
+ getVariableNames(): string[];
120
+ clone(overrides?: {
121
+ template?: string;
122
+ variables?: VariableDefinitions;
123
+ }): PromptTemplate;
124
+ }
125
+ declare class Partial {
126
+ readonly name: string;
127
+ readonly template: string;
128
+ readonly description?: string;
129
+ readonly variables: string[];
130
+ constructor(config: {
131
+ name: string;
132
+ template: string;
133
+ description?: string;
134
+ });
135
+ toData(): {
136
+ name: string;
137
+ template: string;
138
+ description?: string;
139
+ variables: string[];
140
+ };
141
+ }
142
+ declare function compose(parts: Array<{
143
+ partial: string;
144
+ variables?: Record<string, unknown>;
145
+ } | {
146
+ template: string;
147
+ variables?: Record<string, unknown>;
148
+ }>, separator?: string): string;
149
+ declare function createComposedTemplate(parts: Array<{
150
+ name?: string;
151
+ template: string;
152
+ condition?: string;
153
+ }>, options?: {
154
+ separator?: string;
155
+ wrapInConditional?: boolean;
156
+ }): string;
157
+
158
+ declare class PromptRegistry extends EventEmitter<Record<RegistryEventType, [RegistryEvent]>> {
159
+ private storage;
160
+ private defaultEnvironment;
161
+ private environments;
162
+ private cache?;
163
+ private versionHistories;
164
+ private partials;
165
+ private initialized;
166
+ constructor(config: RegistryConfig);
167
+ initialize(): Promise<void>;
168
+ private ensureInitialized;
169
+ create(input: CreatePromptInput): Promise<Prompt>;
170
+ get(name: string, options?: {
171
+ environment?: string;
172
+ version?: string;
173
+ }): Promise<Prompt | null>;
174
+ getById(id: string, options?: {
175
+ environment?: string;
176
+ }): Promise<Prompt | null>;
177
+ update(name: string, updates: UpdatePromptInput, options?: {
178
+ environment?: string;
179
+ author?: string;
180
+ }): Promise<Prompt>;
181
+ delete(name: string, options?: {
182
+ environment?: string;
183
+ }): Promise<boolean>;
184
+ query(options?: PromptQueryOptions): Promise<Prompt[]>;
185
+ list(options?: {
186
+ environment?: string;
187
+ }): Promise<Prompt[]>;
188
+ render(name: string, variables: Record<string, unknown>, options?: RenderOptions & {
189
+ environment?: string;
190
+ version?: string;
191
+ }): Promise<RenderedPrompt>;
192
+ history(name: string, options?: {
193
+ environment?: string;
194
+ limit?: number;
195
+ }): Promise<PromptVersion[]>;
196
+ diff(name: string, options: DiffOptions): Promise<DiffResult>;
197
+ branch(name: string, input: CreateBranchInput, options?: {
198
+ environment?: string;
199
+ }): Promise<BranchInfo>;
200
+ merge(name: string, options: MergeOptions & {
201
+ environment?: string;
202
+ }): Promise<MergeResult>;
203
+ rollback(name: string, options: RollbackOptions & {
204
+ environment?: string;
205
+ }): Promise<RollbackResult>;
206
+ promote(name: string, options: PromoteInput): Promise<PromotionResult>;
207
+ getEnvironments(): EnvironmentConfig[];
208
+ registerPartial(partial: Partial | PartialDefinition): Promise<void>;
209
+ getPartial(name: string): Partial | undefined;
210
+ getPartials(): Partial[];
211
+ deletePartial(name: string): Promise<boolean>;
212
+ createABTest(config: ABTestConfig): Promise<ABTestData>;
213
+ getABTest(nameOrId: string): Promise<ABTestData | null>;
214
+ requestReview(name: string, input: CreateReviewInput): Promise<ReviewRequest>;
215
+ private logAudit;
216
+ getAuditLog(nameOrOptions?: string | AuditLogQueryOptions): Promise<AuditLogEntry[]>;
217
+ getStats(): Promise<RegistryStats>;
218
+ close(): Promise<void>;
219
+ }
220
+
221
+ interface PromptProviderConfig {
222
+ registry?: PromptRegistry;
223
+ client?: PromptClient;
224
+ environment?: string;
225
+ autoRefresh?: boolean;
226
+ cacheTtl?: number;
227
+ }
228
+ interface DynamicPromptConfig {
229
+ name: string;
230
+ variables?: Record<string, unknown>;
231
+ version?: string;
232
+ fallback?: string;
233
+ }
234
+ interface ProviderEvents {
235
+ 'prompt:refreshed': {
236
+ name: string;
237
+ version: string;
238
+ };
239
+ 'prompt:error': {
240
+ name: string;
241
+ error: unknown;
242
+ };
243
+ }
244
+ declare class PromptProvider extends EventEmitter<ProviderEvents> {
245
+ private registry?;
246
+ private client?;
247
+ private environment;
248
+ private autoRefresh;
249
+ private cache;
250
+ private cacheTtl;
251
+ constructor(config: PromptProviderConfig);
252
+ private setupAutoRefresh;
253
+ get(name: string, options?: {
254
+ version?: string;
255
+ forceRefresh?: boolean;
256
+ }): Promise<Prompt | null>;
257
+ render(name: string, variables: Record<string, unknown>, options?: RenderOptions & {
258
+ version?: string;
259
+ }): Promise<RenderedPrompt>;
260
+ dynamic(nameOrConfig: string | DynamicPromptConfig, defaultVariables?: Record<string, unknown>): () => Promise<string>;
261
+ static(name: string, variables?: Record<string, unknown>): () => string;
262
+ preload(names: string[]): Promise<void>;
263
+ clearCache(): void;
264
+ invalidate(name: string): void;
265
+ getCacheStats(): {
266
+ size: number;
267
+ prompts: string[];
268
+ };
269
+ }
270
+ declare function createSystemPrompt(provider: PromptProvider, name: string, variables?: Record<string, unknown>, options?: {
271
+ fallback?: string;
272
+ }): () => Promise<string>;
273
+ declare function createABTestPrompt(provider: PromptProvider, config: {
274
+ testName: string;
275
+ prompt: string;
276
+ variables?: Record<string, unknown>;
277
+ getUserId: (context: Record<string, unknown>) => string;
278
+ }): (context: Record<string, unknown>) => Promise<string>;
279
+
280
+ export { type CacheConfig as C, type DynamicPromptConfig as D, PromptVersion as P, type RegistryConfig as R, VersionHistory as V, PromptTemplate as a, Partial as b, compose as c, createComposedTemplate as d, PromptRegistry as e, PromptProvider as f, createSystemPrompt as g, createABTestPrompt as h, type PromptProviderConfig as i, type RegistryEvent as j, type RegistryEventType as k, type RegistryStats as l, type RegistryHooks as m, type PartialDefinition as n };
@@ -0,0 +1,56 @@
1
+ export { P as Prompt, a as PromptClient, d as PromptClientConfig, b as PromptLoader, c as createDynamicPrompt } from './Client-raKKKXgi.js';
2
+ export { C as CacheConfig, D as DynamicPromptConfig, b as Partial, n as PartialDefinition, f as PromptProvider, i as PromptProviderConfig, e as PromptRegistry, a as PromptTemplate, P as PromptVersion, R as RegistryConfig, j as RegistryEvent, k as RegistryEventType, m as RegistryHooks, l as RegistryStats, V as VersionHistory, c as compose, h as createABTestPrompt, d as createComposedTemplate, g as createSystemPrompt } from './index-CxHUTqKA.js';
3
+ export { BufferStorage, FileStorage } from './storage/index.js';
4
+ import { V as VariableDefinitions } from './prompt.types-UpghZJIu.js';
5
+ export { C as CreatePromptInput, P as PromptData, a as PromptMetadata, f as PromptQueryOptions, b as PromptStatus, R as RenderOptions, c as RenderedPrompt, U as UpdatePromptInput, d as VariableDefinition, e as VariableType } from './prompt.types-UpghZJIu.js';
6
+ export { A as ABTestConfig, o as ABTestData, q as ABTestResults, p as ABTestStatus, Q as AccessCheck, S as AccessCheckResult, z as AssertionType, X as AuditAction, W as AuditLogEntry, Y as AuditLogQueryOptions, B as BranchInfo, K as Comment, C as CreateBranchInput, L as CreateCommentInput, J as CreateReviewInput, b as DiffHunk, c as DiffLine, d as DiffLineType, e as DiffOptions, D as DiffResult, n as EnvironmentComparison, E as EnvironmentConfig, m as EnvironmentSyncStatus, _ as FileStorageConfig, G as GetVariantOptions, h as MergeConflict, M as MergeOptions, f as MergeResult, g as MergeStrategy, s as MetricComparison, t as MetricRecord, N as Permission, a0 as PostgresStorageConfig, P as PromoteInput, k as PromotionRequest, j as PromotionResult, l as PromotionStatus, I as ReviewApproval, F as ReviewRequest, H as ReviewStatus, O as Role, R as RollbackOptions, i as RollbackResult, a1 as S3StorageConfig, $ as SQLiteStorageConfig, Z as StorageAdapter, y as TestAssertion, v as TestCase, w as TestCaseResult, x as TestRunResult, T as TestVariant, U as UserPermissions, u as VariantAssignment, r as VariantStats, a as VersionHistoryEntry, V as VersionInfo } from './storage.types-CNQ8CxaH.js';
7
+ export { ABTest, createABTestConfig } from './testing/index.js';
8
+ import { z } from 'zod';
9
+ import 'eventemitter3';
10
+ import 'handlebars';
11
+
12
+ declare function hashContent(content: string): string;
13
+ declare function generateId(): string;
14
+ declare function generateVersion(num: number): string;
15
+ declare function parseVersion(version: string): number;
16
+ declare function incrementVersion(version: string): string;
17
+ declare function compareVersions(a: string, b: string): number;
18
+ declare function shortHash(hash: string, length?: number): string;
19
+
20
+ declare function validatePromptName(name: string): {
21
+ valid: boolean;
22
+ error?: string;
23
+ };
24
+ declare function validateTemplate(template: string): {
25
+ valid: boolean;
26
+ error?: string;
27
+ variables: string[];
28
+ };
29
+ declare function validateVariables(variables: Record<string, unknown>, definitions: VariableDefinitions): {
30
+ valid: boolean;
31
+ errors: string[];
32
+ };
33
+ declare function createVariableSchema(definitions: VariableDefinitions): z.ZodSchema;
34
+ declare function validateBranchName(name: string): {
35
+ valid: boolean;
36
+ error?: string;
37
+ };
38
+ declare function validateEnvironmentName(name: string): {
39
+ valid: boolean;
40
+ error?: string;
41
+ };
42
+
43
+ declare function normalizeTemplate(template: string): string;
44
+ declare function formatPromptDisplay(template: string, options?: {
45
+ maxLines?: number;
46
+ truncateLength?: number;
47
+ }): string;
48
+ declare function formatVersion(version: string): string;
49
+ declare function formatDate(date: Date): string;
50
+ declare function formatRelativeTime(date: Date): string;
51
+ declare function truncate(text: string, maxLength: number): string;
52
+ declare function highlightVariables(template: string): string;
53
+ declare function indent(text: string, spaces?: number): string;
54
+ declare function wordWrap(text: string, maxWidth?: number): string;
55
+
56
+ export { VariableDefinitions, compareVersions, createVariableSchema, formatDate, formatPromptDisplay, formatRelativeTime, formatVersion, generateId, generateVersion, hashContent, highlightVariables, incrementVersion, indent, normalizeTemplate, parseVersion, shortHash, truncate, validateBranchName, validateEnvironmentName, validatePromptName, validateTemplate, validateVariables, wordWrap };