forgesmith 0.3.0 → 0.6.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.
package/dist/index.d.ts CHANGED
@@ -122,9 +122,797 @@ declare function generateOnboardingDoc(blueprint: BlueprintData | null, opts: On
122
122
 
123
123
  declare function generateRefactoringReport(blueprint: BlueprintData | null, opts: RefactoringReportOpts, provider: LlmProvider): Promise<GenerationResult>;
124
124
 
125
- declare function readPrismDirectory(prismPath: string): Promise<PrismData>;
126
- declare function readBlueprintData(targetPath: string): Promise<BlueprintData | null>;
127
-
128
125
  declare function generateAskDrivenAsset(blueprint: BlueprintData | null, question: string, opts: AskDrivenAssetOpts, provider: LlmProvider): Promise<GenerationResult>;
129
126
 
130
- export { type ArchitectureWalkthroughOpts, type AskDrivenAssetFormat, type AskDrivenAssetOpts, type BlueprintData, type BlueprintEdge, type BlueprintFile, type ChangesSinceOpts, type GenerationResult, type LlmMessage, type LlmProvider, type LlmRequest, type LlmResponse, type OnboardingDocOpts, type PrismData, type PrismInsight, type PrismRecommendation, type PrismSession, type RefactoringReportOpts, type ReleaseNotesOpts, generateArchitectureWalkthrough, generateAskDrivenAsset, generateChangesSince, generateOnboardingDoc, generateRefactoringReport, generateReleaseNotes, readBlueprintData, readPrismDirectory };
127
+ type ScopeKind = "framework" | "app" | "tenant";
128
+ type SignalKind = "brief" | "knowledge_ref" | "git_range" | "app_feature_ref" | "business_capability_ref" | "amber_capability_ref" | "platform_walkthrough" | "green_insight_ref";
129
+ type Channel = "heise" | "connect" | "linkedin" | "instagram" | "landing" | "onepager" | "internal" | "email" | "deck" | "x" | "product_hunt" | "presentation";
130
+ type AudienceId = string & {
131
+ readonly __brand: "AudienceId";
132
+ };
133
+ declare const asAudienceId: (id: string) => AudienceId;
134
+ type Intent = "inform" | "pitch" | "announce" | "convince" | "educate" | "explain_to_layperson" | "recruit" | "celebrate_release";
135
+ type Format = "long_article" | "short_post" | "carousel_sequence" | "story_sequence" | "pitch_paragraphs" | "landing_block" | "one_pager_section" | "quote_card" | "screenshot_narrative" | "visual_brief" | "video_brief" | "shotlist" | "hook_sequence";
136
+ type Modality = "text" | "text_with_visual_brief" | "interactive_visual" | "image" | "video" | "mixed";
137
+ type AssetKind = "image_brief" | "screenshot_request" | "video_brief" | "shotlist" | "quote_card_spec";
138
+ type OutputStatus = "draft" | "generating" | "ready" | "failed";
139
+ type Tonality = "sachlich-tief" | "sachlich-zugänglich" | "ambitioniert-glaubwürdig" | "warm-zugänglich" | "nüchtern-direkt";
140
+ type ReadingLevel = "expert" | "professional" | "general" | "lay";
141
+ interface ForgeAudience {
142
+ id: AudienceId;
143
+ label: string;
144
+ tonality: Tonality;
145
+ reading_level: ReadingLevel;
146
+ channel_hints: Channel[];
147
+ description: string;
148
+ }
149
+ interface ForgeSignal {
150
+ id: string;
151
+ scope_kind: ScopeKind;
152
+ app_id?: string | null;
153
+ env?: string | null;
154
+ kind: SignalKind;
155
+ payload: Record<string, unknown>;
156
+ source_refs: Record<string, unknown>;
157
+ created_by?: string | null;
158
+ created_at: string;
159
+ }
160
+ interface ForgeTemplate {
161
+ id: string;
162
+ channel: Channel;
163
+ audience_id: AudienceId;
164
+ intent: Intent;
165
+ format: Format;
166
+ modality: Modality;
167
+ tonality?: Tonality;
168
+ schema_json: Record<string, unknown>;
169
+ asset_slots: Array<Record<string, unknown>>;
170
+ created_at?: string;
171
+ }
172
+ interface ForgeOutput {
173
+ id: string;
174
+ signal_id?: string | null;
175
+ template_id?: string | null;
176
+ status: OutputStatus;
177
+ scope_kind: ScopeKind;
178
+ app_id?: string | null;
179
+ env?: string | null;
180
+ channel: Channel;
181
+ audience_id: AudienceId;
182
+ intent: Intent;
183
+ format: Format;
184
+ modality: Modality;
185
+ result_json?: Record<string, unknown> | null;
186
+ revision_of?: string | null;
187
+ created_at: string;
188
+ }
189
+ interface ForgeAsset {
190
+ id: string;
191
+ output_id: string;
192
+ kind: AssetKind;
193
+ modality: Modality;
194
+ props_json: Record<string, unknown>;
195
+ source_refs: Record<string, unknown>;
196
+ widget_def_id?: string | null;
197
+ widget_runtime?: string | null;
198
+ widget_def_history?: Array<{
199
+ widget_def_id: string;
200
+ replaced_at: string;
201
+ reason?: string;
202
+ }>;
203
+ created_at: string;
204
+ }
205
+ interface ForgeScope {
206
+ kind: ScopeKind;
207
+ app_id?: string | null;
208
+ env?: string | null;
209
+ }
210
+ type ForgeSubview = "signals" | "templates" | "audiences" | "outputs" | "walkthroughs";
211
+ interface Zone {
212
+ id: string;
213
+ name: string;
214
+ files: string[];
215
+ fileCount: number;
216
+ heat: number;
217
+ }
218
+ interface FileEntry {
219
+ path: string;
220
+ importCount: number;
221
+ importedByCount: number;
222
+ lineCount: number;
223
+ zone: string;
224
+ }
225
+
226
+ interface BrandKitPalette {
227
+ primary: string;
228
+ secondary: string;
229
+ accent: string;
230
+ surface: string;
231
+ text: string;
232
+ muted: string;
233
+ }
234
+ interface BrandKitFonts {
235
+ heading: string;
236
+ body: string;
237
+ mono: string;
238
+ }
239
+ interface BrandKitVoice {
240
+ tone: string;
241
+ audience: string;
242
+ vocabulary: string[];
243
+ avoid: string[];
244
+ formality: number;
245
+ technicality: number;
246
+ }
247
+ interface BrandKitLogo {
248
+ url?: string;
249
+ svg?: string;
250
+ }
251
+ interface BrandKitSnapshot {
252
+ version: number;
253
+ saved_at: string;
254
+ palette: BrandKitPalette;
255
+ voice: BrandKitVoice;
256
+ }
257
+ interface BrandKit {
258
+ id: string;
259
+ name: string;
260
+ source: "manual" | "url" | "prism";
261
+ source_url?: string;
262
+ palette: BrandKitPalette;
263
+ fonts: BrandKitFonts;
264
+ voice: BrandKitVoice;
265
+ logo: BrandKitLogo;
266
+ prism_detected?: boolean;
267
+ version: number;
268
+ versions: BrandKitSnapshot[];
269
+ created_at: string;
270
+ updated_at: string;
271
+ }
272
+ declare const DEFAULT_BRAND_KIT_PALETTE: BrandKitPalette;
273
+ declare const DEFAULT_BRAND_KIT_FONTS: BrandKitFonts;
274
+ declare const DEFAULT_BRAND_KIT_VOICE: BrandKitVoice;
275
+ declare function defaultBrandKit(partial?: Partial<BrandKit>): Omit<BrandKit, "id" | "created_at" | "updated_at">;
276
+ interface UrlBrandHints {
277
+ url: string;
278
+ pageTitle?: string;
279
+ metaDescription?: string;
280
+ themeColor?: string;
281
+ ogImage?: string;
282
+ cssColorHints?: string[];
283
+ fontHints?: string[];
284
+ }
285
+ declare function assembleBrandUrlExtractionPrompt(hints: UrlBrandHints): string;
286
+ declare function parseBrandKitFromLlmResponse(text: string, hints: UrlBrandHints): Omit<BrandKit, "id" | "created_at" | "updated_at" | "version" | "versions">;
287
+ interface PrismBrandDraft {
288
+ suggestedName: string;
289
+ voice: BrandKitVoice;
290
+ prism_detected: true;
291
+ blueprint_path: string;
292
+ stats: {
293
+ totalFiles: number;
294
+ categories: Record<string, number>;
295
+ technicalScore: number;
296
+ audienceMix: string;
297
+ };
298
+ }
299
+
300
+ type WidgetKind = "stat-card" | "feature-grid" | "testimonial" | "cta-banner" | "metric-badge" | "pricing-tier" | "changelog-row" | "social-proof";
301
+ type WidgetSlotType = "text" | "number" | "color" | "url" | "image-url" | "multiline" | "select";
302
+ type WidgetExportFormat = "html" | "markdown" | "react";
303
+ interface WidgetSlotDef {
304
+ id: string;
305
+ label: string;
306
+ type: WidgetSlotType;
307
+ default?: string | number;
308
+ required?: boolean;
309
+ placeholder?: string;
310
+ options?: string[];
311
+ }
312
+ interface WidgetTemplate {
313
+ id: WidgetKind;
314
+ name: string;
315
+ description: string;
316
+ slots: WidgetSlotDef[];
317
+ exportFormats: WidgetExportFormat[];
318
+ free_tier: boolean;
319
+ }
320
+ interface WidgetInstanceSnapshot {
321
+ version: number;
322
+ saved_at: string;
323
+ slots: Record<string, string | number>;
324
+ style_id?: string;
325
+ }
326
+ interface WidgetInstance {
327
+ id: string;
328
+ template_id: WidgetKind;
329
+ name: string;
330
+ slots: Record<string, string | number>;
331
+ brand_kit_id?: string;
332
+ style_id?: string;
333
+ version: number;
334
+ versions: WidgetInstanceSnapshot[];
335
+ created_at: string;
336
+ updated_at: string;
337
+ }
338
+ declare function getSlotValue(slots: Record<string, string | number>, template: WidgetTemplate, slotId: string): string;
339
+
340
+ interface StyleTokens {
341
+ radius: {
342
+ sm: string;
343
+ md: string;
344
+ lg: string;
345
+ full: string;
346
+ };
347
+ shadow: {
348
+ sm: string;
349
+ md: string;
350
+ lg: string;
351
+ };
352
+ spacing: {
353
+ xs: string;
354
+ sm: string;
355
+ md: string;
356
+ lg: string;
357
+ xl: string;
358
+ };
359
+ borderWidth: string;
360
+ borderStyle: "solid" | "dashed" | "none";
361
+ animation: {
362
+ entry: "fade" | "slide" | "scale" | "none";
363
+ durationMs: number;
364
+ };
365
+ }
366
+ interface WidgetStyleSnapshot {
367
+ version: number;
368
+ saved_at: string;
369
+ tokens: StyleTokens;
370
+ }
371
+ interface WidgetStyle {
372
+ id: string;
373
+ name: string;
374
+ preset: boolean;
375
+ tokens: StyleTokens;
376
+ customCss?: string;
377
+ templateOverrides?: Record<string, {
378
+ html?: string;
379
+ jsx?: string;
380
+ }>;
381
+ version: number;
382
+ versions: WidgetStyleSnapshot[];
383
+ created_at: string;
384
+ updated_at: string;
385
+ }
386
+ declare const STYLE_PRESET_DEFAULT: WidgetStyle;
387
+ declare const STYLE_PRESET_MINIMAL: WidgetStyle;
388
+ declare const STYLE_PRESET_GLASSY: WidgetStyle;
389
+ declare const STYLE_PRESET_BRUTALIST: WidgetStyle;
390
+ declare const BUNDLED_STYLE_PRESETS: WidgetStyle[];
391
+ declare function getStyleById(id: string): WidgetStyle;
392
+ declare function parseStyleFromTokensJson(json: unknown): Partial<StyleTokens>;
393
+ declare function parseStyleFromTailwindConfig(jsSource: string): Partial<StyleTokens>;
394
+ declare function parseStyleFromCss(css: string): {
395
+ tokens: Partial<StyleTokens>;
396
+ customCss: string;
397
+ };
398
+
399
+ type ChannelKind = "tweet" | "linkedin" | "blog" | "newsletter" | "hn" | "instagram" | "reddit" | "email" | "slack";
400
+ interface DispatchChannel {
401
+ id: string;
402
+ name: string;
403
+ kind: ChannelKind;
404
+ /** Hard character cap — orchestrateDispatch truncates to this. */
405
+ maxLength: number;
406
+ /** Injected into the channel-specific system prompt. */
407
+ promptHints: string;
408
+ }
409
+ declare const DISPATCH_CHANNEL_TWEET: DispatchChannel;
410
+ declare const DISPATCH_CHANNEL_LINKEDIN: DispatchChannel;
411
+ declare const DISPATCH_CHANNEL_BLOG: DispatchChannel;
412
+ declare const DISPATCH_CHANNEL_NEWSLETTER: DispatchChannel;
413
+ declare const DISPATCH_CHANNEL_HN: DispatchChannel;
414
+ declare const DISPATCH_CHANNEL_INSTAGRAM: DispatchChannel;
415
+ declare const DISPATCH_CHANNEL_REDDIT: DispatchChannel;
416
+ declare const DISPATCH_CHANNEL_EMAIL: DispatchChannel;
417
+ declare const DISPATCH_CHANNEL_SLACK: DispatchChannel;
418
+ declare const BUNDLED_DISPATCH_CHANNELS: DispatchChannel[];
419
+ declare function getDispatchChannel(id: string): DispatchChannel | undefined;
420
+
421
+ interface ChannelOutput {
422
+ channel_id: string;
423
+ channel_name: string;
424
+ kind: string;
425
+ content: string;
426
+ char_count: number;
427
+ truncated: boolean;
428
+ generated_at: string;
429
+ error?: string;
430
+ }
431
+ interface DispatchRun {
432
+ id: string;
433
+ ask: string;
434
+ audience_label?: string;
435
+ brand_name?: string;
436
+ blueprint_grounded: boolean;
437
+ outputs: ChannelOutput[];
438
+ created_at: string;
439
+ }
440
+ interface DispatchBrandContext {
441
+ name: string;
442
+ voice: {
443
+ tone: string;
444
+ formality: number;
445
+ vocabulary?: string[];
446
+ avoid?: string[];
447
+ };
448
+ }
449
+ interface DispatchAudienceContext {
450
+ label: string;
451
+ tonality: string;
452
+ reading_level: string;
453
+ }
454
+ interface OrchestrationInput {
455
+ ask: string;
456
+ channels: DispatchChannel[];
457
+ audience?: DispatchAudienceContext;
458
+ brand?: DispatchBrandContext;
459
+ blueprintContext?: string;
460
+ toneOverrides?: Record<string, number>;
461
+ }
462
+ interface TokenUsage {
463
+ total_input: number;
464
+ total_output: number;
465
+ channel_count: number;
466
+ }
467
+ interface OrchestrationResult {
468
+ outputs: ChannelOutput[];
469
+ usage: TokenUsage;
470
+ }
471
+ declare function orchestrateDispatch(input: OrchestrationInput, provider: LlmProvider): Promise<OrchestrationResult>;
472
+
473
+ interface AssetVersion {
474
+ id: string;
475
+ assetId: string;
476
+ versionNumber: number;
477
+ content: string;
478
+ message: string;
479
+ createdAt: string;
480
+ usedTokens?: number;
481
+ brandKitId?: string;
482
+ styleId?: string;
483
+ blueprintFocus?: string;
484
+ fromPrism?: boolean;
485
+ revertedFrom?: number;
486
+ }
487
+ interface DiffEntry {
488
+ type: "unchanged" | "added" | "removed";
489
+ line: string;
490
+ lineNo?: number;
491
+ }
492
+ interface DiffResult {
493
+ entries: DiffEntry[];
494
+ addedCount: number;
495
+ removedCount: number;
496
+ }
497
+ /**
498
+ * Deterministic line-level diff using a simple LCS approach.
499
+ * Returns DiffEntry[] suitable for a two-column diff display.
500
+ */
501
+ declare function computeDiff(contentA: string, contentB: string): DiffResult;
502
+ declare function buildVersion(assetId: string, versionNumber: number, content: string, message: string, meta?: Partial<Omit<AssetVersion, "id" | "assetId" | "versionNumber" | "content" | "message" | "createdAt">>): AssetVersion;
503
+ declare function buildRevertVersion(assetId: string, versionNumber: number, source: AssetVersion): AssetVersion;
504
+ declare function nextVersionNumber(versions: AssetVersion[]): number;
505
+
506
+ type ScheduledStatus = "draft" | "queued" | "exported" | "cancelled";
507
+ interface ScheduledEntryMetadata {
508
+ exportedTo?: "buffer" | "hypefury" | "icalendar";
509
+ exportedAt?: string;
510
+ exportRef?: string;
511
+ dispatchRunId?: string;
512
+ brandKitId?: string;
513
+ assetType?: string;
514
+ }
515
+ interface ScheduledEntry {
516
+ id: string;
517
+ assetId: string;
518
+ channelId: string;
519
+ scheduledFor: string;
520
+ status: ScheduledStatus;
521
+ contentPreview: string;
522
+ metadata: ScheduledEntryMetadata;
523
+ createdAt: string;
524
+ updatedAt: string;
525
+ }
526
+ interface ScheduleRange {
527
+ from: string;
528
+ to: string;
529
+ }
530
+ declare function buildScheduledEntry(assetId: string, channelId: string, scheduledFor: string, contentPreview: string, metadata?: ScheduledEntryMetadata): ScheduledEntry;
531
+ declare function applyEntryPatch(entry: ScheduledEntry, patch: Partial<Pick<ScheduledEntry, "scheduledFor" | "status" | "channelId" | "contentPreview" | "metadata">>): ScheduledEntry;
532
+ declare function entryInRange(entry: ScheduledEntry, range: ScheduleRange): boolean;
533
+ declare function next7DaysRange(): ScheduleRange;
534
+ /** Cascading cadence for "Schedule all dispatch outputs". */
535
+ declare function cascadingScheduledFor(channelIds: string[], startFrom?: Date): Record<string, string>;
536
+
537
+ interface ListOutputsOpts {
538
+ signalId?: string;
539
+ templateId?: string;
540
+ limit?: number;
541
+ }
542
+ interface ForgeStorage {
543
+ getSignal(id: string): Promise<ForgeSignal | null>;
544
+ getTemplate(id: string): Promise<ForgeTemplate | null>;
545
+ getAudience(id: string): Promise<ForgeAudience | null>;
546
+ listTemplates(): Promise<ForgeTemplate[]>;
547
+ listAudiences(): Promise<ForgeAudience[]>;
548
+ listOutputs(opts?: ListOutputsOpts): Promise<ForgeOutput[]>;
549
+ saveSignal(signal: Omit<ForgeSignal, "id" | "created_at">): Promise<ForgeSignal>;
550
+ saveTemplate(template: Omit<ForgeTemplate, "created_at">): Promise<ForgeTemplate>;
551
+ saveAudience(audience: ForgeAudience): Promise<ForgeAudience>;
552
+ saveOutput(output: Omit<ForgeOutput, "id" | "created_at">): Promise<ForgeOutput>;
553
+ saveAsset(asset: Omit<ForgeAsset, "id" | "created_at">): Promise<ForgeAsset>;
554
+ deleteTemplate(id: string): Promise<void>;
555
+ deleteAudience(id: string): Promise<void>;
556
+ deleteOutput(id: string): Promise<void>;
557
+ saveBrandKit(kit: Omit<BrandKit, "id" | "created_at" | "updated_at"> & {
558
+ id?: string;
559
+ }): Promise<BrandKit>;
560
+ getBrandKit(id: string): Promise<BrandKit | null>;
561
+ listBrandKits(): Promise<BrandKit[]>;
562
+ deleteBrandKit(id: string): Promise<void>;
563
+ saveWidget(widget: Omit<WidgetInstance, "id" | "created_at" | "updated_at"> & {
564
+ id?: string;
565
+ }): Promise<WidgetInstance>;
566
+ getWidget(id: string): Promise<WidgetInstance | null>;
567
+ listWidgets(templateId?: string): Promise<WidgetInstance[]>;
568
+ deleteWidget(id: string): Promise<void>;
569
+ saveStyle(style: Omit<WidgetStyle, "id" | "created_at" | "updated_at"> & {
570
+ id?: string;
571
+ }): Promise<WidgetStyle>;
572
+ getStyle(id: string): Promise<WidgetStyle | null>;
573
+ listStyles(): Promise<WidgetStyle[]>;
574
+ deleteStyle(id: string): Promise<void>;
575
+ saveDispatch(run: Omit<DispatchRun, "id" | "created_at"> & {
576
+ id?: string;
577
+ }): Promise<DispatchRun>;
578
+ getDispatch(id: string): Promise<DispatchRun | null>;
579
+ listDispatches(limit?: number): Promise<DispatchRun[]>;
580
+ deleteDispatch(id: string): Promise<void>;
581
+ saveAssetVersion(assetId: string, version: AssetVersion): Promise<AssetVersion>;
582
+ listAssetVersions(assetId: string): Promise<AssetVersion[]>;
583
+ revertAsset(assetId: string, versionId: string): Promise<AssetVersion>;
584
+ saveScheduledEntry(entry: ScheduledEntry): Promise<ScheduledEntry>;
585
+ listScheduledEntries(range?: ScheduleRange): Promise<ScheduledEntry[]>;
586
+ updateScheduledEntry(id: string, patch: Partial<Pick<ScheduledEntry, "scheduledFor" | "status" | "channelId" | "contentPreview" | "metadata">>): Promise<ScheduledEntry>;
587
+ deleteScheduledEntry(id: string): Promise<void>;
588
+ }
589
+
590
+ interface ProductTruthClaim {
591
+ id: string;
592
+ statement: string;
593
+ source_ref: string;
594
+ }
595
+ interface ProductTruth {
596
+ signal_id: string;
597
+ audience_id: string;
598
+ audience_label: string;
599
+ tonality: string;
600
+ reading_level: string;
601
+ claims: ProductTruthClaim[];
602
+ raw_source_refs: Record<string, unknown>;
603
+ }
604
+ declare function distill(input: {
605
+ signal: ForgeSignal;
606
+ audience: ForgeAudience;
607
+ }): ProductTruth;
608
+
609
+ interface ResolvedTuple {
610
+ channel: Channel;
611
+ audience_id: string;
612
+ intent: Intent;
613
+ format: Format;
614
+ modality: Modality;
615
+ }
616
+ interface ForgePrompt {
617
+ system: string;
618
+ user: string;
619
+ schema_name: string;
620
+ schema: unknown;
621
+ }
622
+ declare function assembleForgePrompt(input: {
623
+ template: ForgeTemplate;
624
+ audience: ForgeAudience;
625
+ productTruth: ProductTruth;
626
+ resolved: ResolvedTuple;
627
+ contextBlocks?: string[];
628
+ }): ForgePrompt;
629
+
630
+ interface ValidationOk<T> {
631
+ ok: true;
632
+ value: T;
633
+ }
634
+ interface ValidationErr {
635
+ ok: false;
636
+ errors: string[];
637
+ unsupported?: string[];
638
+ }
639
+ type ValidationResult<T = Record<string, unknown>> = ValidationOk<T> | ValidationErr;
640
+ declare function validateAgainstTemplateSchema(schema: unknown, candidate: unknown): ValidationResult;
641
+ declare function tryParseJsonObject(raw: string): unknown;
642
+
643
+ interface SchemaDefinitionOk {
644
+ valid: true;
645
+ }
646
+ interface SchemaDefinitionErr {
647
+ valid: false;
648
+ errors: string[];
649
+ }
650
+ type SchemaDefinitionResult = SchemaDefinitionOk | SchemaDefinitionErr;
651
+ declare function validateSchemaDefinition(input: unknown): SchemaDefinitionResult;
652
+ declare function parseAndValidateSchemaDefinition(jsonText: string): {
653
+ valid: true;
654
+ parsed: Record<string, unknown>;
655
+ } | {
656
+ valid: false;
657
+ errors: string[];
658
+ };
659
+
660
+ interface AssetSlotsValidationOk {
661
+ valid: true;
662
+ }
663
+ interface AssetSlotsValidationErr {
664
+ valid: false;
665
+ errors: string[];
666
+ }
667
+ type AssetSlotsValidationResult = AssetSlotsValidationOk | AssetSlotsValidationErr;
668
+ declare function validateAssetSlots(input: unknown): AssetSlotsValidationResult;
669
+
670
+ declare function templateAnimatedDefault(assetSlots: unknown): boolean;
671
+ declare function resolveAnimatedChoice(templateDefault: boolean, override: boolean | undefined): boolean;
672
+
673
+ declare const DEFAULT_ANIMATION_DURATION_SECONDS = 10;
674
+ declare const ANIMATION_DURATION_PRESETS: readonly [5, 10, 20, 30];
675
+ declare const MIN_ANIMATION_DURATION_SECONDS = 1;
676
+ declare const MAX_ANIMATION_DURATION_SECONDS = 120;
677
+ declare function clampAnimationDuration(seconds: number): number;
678
+ declare function resolveAnimationDuration(override: number | undefined, persisted: number | undefined, fallback?: number): number;
679
+
680
+ declare const REFINE_SESSION_SOFT_CAP = 100;
681
+ declare const REFINE_COUNTDOWN_THRESHOLD = 90;
682
+ interface RefineLimitState {
683
+ used: number;
684
+ capped: boolean;
685
+ remaining: number;
686
+ showCountdown: boolean;
687
+ }
688
+ declare function refineLimitState(usedRefines: number, softCap?: number): RefineLimitState;
689
+
690
+ interface BrandPalette {
691
+ primary: string;
692
+ accent: string;
693
+ background: string;
694
+ card: string;
695
+ text: string;
696
+ }
697
+ interface ForgeThemeEntry {
698
+ id?: string;
699
+ label?: string;
700
+ primary?: string;
701
+ accent?: string;
702
+ bg?: string;
703
+ card?: string;
704
+ text?: string;
705
+ [key: string]: unknown;
706
+ }
707
+ declare function themeEntryToPalette(entry: ForgeThemeEntry | null | undefined): BrandPalette | null;
708
+ declare function parseThemeConfigContent(content: unknown): ForgeThemeEntry[];
709
+ declare const FORGE_BRAND_THEME_ID = "__forge_brand__";
710
+ declare const BRAND_CONTENT_SLOT_KEYS: {
711
+ readonly primary: "content-primary";
712
+ readonly accent: "content-accent";
713
+ readonly bg: "content-bg";
714
+ readonly card: "content-card";
715
+ readonly text: "content-text";
716
+ };
717
+ interface BrandThemeConfig {
718
+ id?: string;
719
+ name?: string;
720
+ values?: Record<string, string>;
721
+ [key: string]: unknown;
722
+ }
723
+ declare function parseBrandThemeContent(content: unknown): BrandThemeConfig[];
724
+ declare function brandThemeConfigToEntry(config: BrandThemeConfig | null | undefined): ForgeThemeEntry | null;
725
+ interface ResolveBrandPaletteInput {
726
+ scope: ScopeKind;
727
+ themes: ForgeThemeEntry[];
728
+ selectedThemeId?: string | null;
729
+ frameworkDefault: BrandPalette | null;
730
+ appDefault: BrandPalette | null;
731
+ }
732
+ declare function resolveBrandPalette(input: ResolveBrandPaletteInput): BrandPalette | null;
733
+
734
+ interface BaseField {
735
+ name: string;
736
+ label: string;
737
+ required: boolean;
738
+ description?: string;
739
+ }
740
+ interface StringField extends BaseField {
741
+ kind: "string";
742
+ multiline: boolean;
743
+ enum?: string[];
744
+ maxLength?: number;
745
+ minLength?: number;
746
+ }
747
+ interface NumberField extends BaseField {
748
+ kind: "number";
749
+ integer: boolean;
750
+ minimum?: number;
751
+ maximum?: number;
752
+ }
753
+ interface BooleanField extends BaseField {
754
+ kind: "boolean";
755
+ }
756
+ interface ArrayField extends BaseField {
757
+ kind: "array";
758
+ itemField: FormField | null;
759
+ minItems?: number;
760
+ maxItems?: number;
761
+ }
762
+ interface ObjectField extends BaseField {
763
+ kind: "object";
764
+ fields: FormField[];
765
+ }
766
+ type FormField = StringField | NumberField | BooleanField | ArrayField | ObjectField;
767
+ interface FormSpecOk {
768
+ kind: "form";
769
+ fields: FormField[];
770
+ }
771
+ interface FormSpecRaw {
772
+ kind: "raw";
773
+ reason: string;
774
+ }
775
+ type FormSpec = FormSpecOk | FormSpecRaw;
776
+ declare function schemaToForm(schema: unknown): FormSpec;
777
+ declare function defaultValueForField(field: FormField): unknown;
778
+ declare function initialFormValues(fields: FormField[], source: Record<string, unknown>): Record<string, unknown>;
779
+ type FormErrors = Record<string, string>;
780
+ declare function validateFormValues(fields: FormField[], values: Record<string, unknown>): FormErrors;
781
+ declare const TEMPLATE_SCHEMA_EXAMPLES: Partial<Record<Format, Record<string, unknown>>>;
782
+ declare const TEMPLATE_SCHEMA_GENERIC: Record<string, unknown>;
783
+ declare function schemaExampleFor(format: Format): Record<string, unknown>;
784
+
785
+ interface ForgeGenerationInput {
786
+ /** Storage adapter the engine reads/writes through. */
787
+ storage: ForgeStorage;
788
+ /** LLM provider that handles the model call. */
789
+ provider: LlmProvider;
790
+ /** Signal id to generate from. */
791
+ signalId: string;
792
+ /** Template id that shapes the generation. */
793
+ templateId: string;
794
+ /** Per-generation tuple overrides — each replaces the template default. */
795
+ audienceOverride?: string;
796
+ intentOverride?: Intent;
797
+ formatOverride?: Format;
798
+ modalityOverride?: Modality;
799
+ /** Honest dry-run: assemble + validate inputs, never call the model, never persist. */
800
+ dryRun?: boolean;
801
+ /** Max tokens for the LLM call (default: 4096). */
802
+ maxTokens?: number;
803
+ }
804
+ interface ForgeGenerationError {
805
+ kind: "error";
806
+ status: number;
807
+ error: string;
808
+ field?: string;
809
+ }
810
+ interface ForgeGenerationDryRun {
811
+ kind: "dry_run";
812
+ payload: {
813
+ dryRun: true;
814
+ resolved: ResolvedTuple;
815
+ product_truth: unknown;
816
+ prompt: {
817
+ system: string;
818
+ user: string;
819
+ schema_name: string;
820
+ };
821
+ };
822
+ }
823
+ interface ForgeGenerationGenerated {
824
+ kind: "generated";
825
+ status: 200 | 201;
826
+ payload: {
827
+ output: unknown;
828
+ validation: ReturnType<typeof validateAgainstTemplateSchema> | null;
829
+ failure_reason: string | null;
830
+ };
831
+ }
832
+ type ForgeGenerationResult = ForgeGenerationError | ForgeGenerationDryRun | ForgeGenerationGenerated;
833
+ declare function runForgeGeneration(input: ForgeGenerationInput): Promise<ForgeGenerationResult>;
834
+
835
+ declare const WIDGET_TEMPLATE_STAT_CARD: WidgetTemplate;
836
+ declare const WIDGET_TEMPLATE_FEATURE_GRID: WidgetTemplate;
837
+ declare const WIDGET_TEMPLATE_TESTIMONIAL: WidgetTemplate;
838
+ declare const WIDGET_TEMPLATE_CTA_BANNER: WidgetTemplate;
839
+ declare const WIDGET_TEMPLATE_METRIC_BADGE: WidgetTemplate;
840
+ declare const WIDGET_TEMPLATE_PRICING_TIER: WidgetTemplate;
841
+ declare const WIDGET_TEMPLATE_CHANGELOG_ROW: WidgetTemplate;
842
+ declare const WIDGET_TEMPLATE_SOCIAL_PROOF: WidgetTemplate;
843
+ declare const BUNDLED_WIDGET_TEMPLATES: WidgetTemplate[];
844
+ declare const FREE_TIER_WIDGET_IDS: string[];
845
+ declare function getWidgetTemplate(id: string): WidgetTemplate | undefined;
846
+
847
+ interface RenderWidgetInput {
848
+ template: WidgetTemplate;
849
+ slots: Record<string, string | number>;
850
+ brandKit?: BrandKit | null;
851
+ style?: WidgetStyle | string | null;
852
+ format: WidgetExportFormat;
853
+ }
854
+ declare function renderWidget(input: RenderWidgetInput): string;
855
+
856
+ declare const FORGE_AUDIENCES: ForgeAudience[];
857
+
858
+ declare const FORGE_TEMPLATES: ForgeTemplate[];
859
+
860
+ /** Defence-in-depth: scan derived text for secret patterns before sending to LLM. */
861
+ declare function scanForSecrets(text: string): boolean;
862
+
863
+ type PrismFocus = "release" | "changelog" | "deepdive" | "summary" | `zone:${string}` | `module:${string}`;
864
+ interface PrismContextPrompt {
865
+ systemFragment: string;
866
+ contextBlock: string;
867
+ suggestedAsk: string;
868
+ }
869
+ interface PrismTemplate {
870
+ id: string;
871
+ name: string;
872
+ description: string;
873
+ defaultFocus: PrismFocus;
874
+ suggestedAsk: string;
875
+ suggestedChannels: string[];
876
+ requiresZone?: boolean;
877
+ }
878
+ declare const PRISM_TEMPLATE_RELEASE_ANNOUNCEMENT: PrismTemplate;
879
+ declare const PRISM_TEMPLATE_SHIPPING_DIGEST: PrismTemplate;
880
+ declare const PRISM_TEMPLATE_ZONE_DEEPDIVE: PrismTemplate;
881
+ declare const PRISM_TEMPLATE_ARCHITECTURE_OVERVIEW: PrismTemplate;
882
+ declare const PRISM_TEMPLATE_REFACTOR_RATIONALE: PrismTemplate;
883
+ declare const PRISM_TEMPLATES: PrismTemplate[];
884
+ declare function getPrismTemplate(id: string): PrismTemplate | undefined;
885
+
886
+ interface RefineAssetInput {
887
+ assetId: string;
888
+ assetType: string;
889
+ currentContent: string;
890
+ userMessage: string;
891
+ brandName?: string;
892
+ brandVoice?: string;
893
+ styleHint?: string;
894
+ blueprintContext?: string;
895
+ }
896
+ interface RefineAssetResult {
897
+ newContent: string;
898
+ llmReply: string;
899
+ usedTokens: number;
900
+ }
901
+ /**
902
+ * Sends the current asset content + user message to an LLM and returns
903
+ * the refined content and a brief explanation of changes.
904
+ *
905
+ * Applies scanForSecrets() to both the system prompt and the current content
906
+ * before sending — throws if secrets are detected (defence-in-depth).
907
+ */
908
+ declare function refineAsset(input: RefineAssetInput, provider: LlmProvider): Promise<RefineAssetResult>;
909
+ declare const REFINE_SUGGESTIONS: readonly ["Make it more concise", "Add more technical detail", "Make the tone more formal", "Make the tone more casual and conversational", "Add a strong opening hook", "Strengthen the call to action", "Break into shorter paragraphs", "Focus more on developer impact"];
910
+ type RefineSuggestion = (typeof REFINE_SUGGESTIONS)[number];
911
+
912
+ declare function exportToBufferCsv(entries: ScheduledEntry[]): string;
913
+ declare function exportToHypefuryCsv(entries: ScheduledEntry[]): string;
914
+ declare function exportToICalendar(entries: ScheduledEntry[]): string;
915
+ type ExportFormat = "buffer" | "hypefury" | "icalendar";
916
+ declare function previewExport(entries: ScheduledEntry[], format: ExportFormat): string;
917
+
918
+ export { ANIMATION_DURATION_PRESETS, type ArchitectureWalkthroughOpts, type ArrayField, type AskDrivenAssetFormat, type AskDrivenAssetOpts, type AssetKind, type AssetSlotsValidationErr, type AssetSlotsValidationOk, type AssetSlotsValidationResult, type AssetVersion, type AudienceId, BRAND_CONTENT_SLOT_KEYS, BUNDLED_DISPATCH_CHANNELS, BUNDLED_STYLE_PRESETS, BUNDLED_WIDGET_TEMPLATES, type BlueprintData, type BlueprintEdge, type BlueprintFile, type BooleanField, type BrandKit, type BrandKitFonts, type BrandKitLogo, type BrandKitPalette, type BrandKitSnapshot, type BrandKitVoice, type BrandPalette, type BrandThemeConfig, type ChangesSinceOpts, type Channel, type ChannelKind, type ChannelOutput, DEFAULT_ANIMATION_DURATION_SECONDS, DEFAULT_BRAND_KIT_FONTS, DEFAULT_BRAND_KIT_PALETTE, DEFAULT_BRAND_KIT_VOICE, DISPATCH_CHANNEL_BLOG, DISPATCH_CHANNEL_EMAIL, DISPATCH_CHANNEL_HN, DISPATCH_CHANNEL_INSTAGRAM, DISPATCH_CHANNEL_LINKEDIN, DISPATCH_CHANNEL_NEWSLETTER, DISPATCH_CHANNEL_REDDIT, DISPATCH_CHANNEL_SLACK, DISPATCH_CHANNEL_TWEET, type DiffEntry, type DiffResult, type DispatchAudienceContext, type DispatchBrandContext, type DispatchChannel, type DispatchRun, type ExportFormat, FORGE_AUDIENCES, FORGE_BRAND_THEME_ID, FORGE_TEMPLATES, FREE_TIER_WIDGET_IDS, type FileEntry, type ForgeAsset, type ForgeAudience, type ForgeGenerationDryRun, type ForgeGenerationError, type ForgeGenerationGenerated, type ForgeGenerationInput, type ForgeGenerationResult, type ForgeOutput, type ForgePrompt, type ForgeScope, type ForgeSignal, type ForgeStorage, type ForgeSubview, type ForgeTemplate, type ForgeThemeEntry, type FormErrors, type FormField, type FormSpec, type FormSpecOk, type FormSpecRaw, type Format, type GenerationResult, type Intent, type ListOutputsOpts, type LlmMessage, type LlmProvider, type LlmRequest, type LlmResponse, MAX_ANIMATION_DURATION_SECONDS, MIN_ANIMATION_DURATION_SECONDS, type Modality, type NumberField, type ObjectField, type OnboardingDocOpts, type OrchestrationInput, type OrchestrationResult, type OutputStatus, PRISM_TEMPLATES, PRISM_TEMPLATE_ARCHITECTURE_OVERVIEW, PRISM_TEMPLATE_REFACTOR_RATIONALE, PRISM_TEMPLATE_RELEASE_ANNOUNCEMENT, PRISM_TEMPLATE_SHIPPING_DIGEST, PRISM_TEMPLATE_ZONE_DEEPDIVE, type PrismBrandDraft, type PrismContextPrompt, type PrismData, type PrismFocus, type PrismInsight, type PrismRecommendation, type PrismSession, type PrismTemplate, type ProductTruth, type ProductTruthClaim, REFINE_COUNTDOWN_THRESHOLD, REFINE_SESSION_SOFT_CAP, REFINE_SUGGESTIONS, type ReadingLevel, type RefactoringReportOpts, type RefineAssetInput, type RefineAssetResult, type RefineLimitState, type RefineSuggestion, type ReleaseNotesOpts, type RenderWidgetInput, type ResolveBrandPaletteInput, type ResolvedTuple, STYLE_PRESET_BRUTALIST, STYLE_PRESET_DEFAULT, STYLE_PRESET_GLASSY, STYLE_PRESET_MINIMAL, type ScheduleRange, type ScheduledEntry, type ScheduledEntryMetadata, type ScheduledStatus, type SchemaDefinitionErr, type SchemaDefinitionOk, type SchemaDefinitionResult, type ScopeKind, type SignalKind, type StringField, type StyleTokens, TEMPLATE_SCHEMA_EXAMPLES, TEMPLATE_SCHEMA_GENERIC, type TokenUsage, type Tonality, type UrlBrandHints, type ValidationErr, type ValidationOk, type ValidationResult, WIDGET_TEMPLATE_CHANGELOG_ROW, WIDGET_TEMPLATE_CTA_BANNER, WIDGET_TEMPLATE_FEATURE_GRID, WIDGET_TEMPLATE_METRIC_BADGE, WIDGET_TEMPLATE_PRICING_TIER, WIDGET_TEMPLATE_SOCIAL_PROOF, WIDGET_TEMPLATE_STAT_CARD, WIDGET_TEMPLATE_TESTIMONIAL, type WidgetExportFormat, type WidgetInstance, type WidgetInstanceSnapshot, type WidgetKind, type WidgetSlotDef, type WidgetSlotType, type WidgetStyle, type WidgetStyleSnapshot, type WidgetTemplate, type Zone, applyEntryPatch, asAudienceId, assembleBrandUrlExtractionPrompt, assembleForgePrompt, brandThemeConfigToEntry, buildRevertVersion, buildScheduledEntry, buildVersion, cascadingScheduledFor, clampAnimationDuration, computeDiff, defaultBrandKit, defaultValueForField, distill, entryInRange, exportToBufferCsv, exportToHypefuryCsv, exportToICalendar, generateArchitectureWalkthrough, generateAskDrivenAsset, generateChangesSince, generateOnboardingDoc, generateRefactoringReport, generateReleaseNotes, getDispatchChannel, getPrismTemplate, getSlotValue, getStyleById, getWidgetTemplate, initialFormValues, next7DaysRange, nextVersionNumber, orchestrateDispatch, parseAndValidateSchemaDefinition, parseBrandKitFromLlmResponse, parseBrandThemeContent, parseStyleFromCss, parseStyleFromTailwindConfig, parseStyleFromTokensJson, parseThemeConfigContent, previewExport, refineAsset, refineLimitState, renderWidget, resolveAnimatedChoice, resolveAnimationDuration, resolveBrandPalette, runForgeGeneration, scanForSecrets, schemaExampleFor, schemaToForm, templateAnimatedDefault, themeEntryToPalette, tryParseJsonObject, validateAgainstTemplateSchema, validateAssetSlots, validateFormValues, validateSchemaDefinition };