@affectively/aeon-pages-runtime 0.3.0 → 0.5.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.
- package/dist/chunk-0706gp9e.js +3285 -0
- package/dist/chunk-2bdmt2ss.js +667 -0
- package/dist/chunk-58n4edr5.js +3854 -0
- package/dist/chunk-6awcmjc3.js +3826 -0
- package/dist/chunk-abtxxkpb.js +667 -0
- package/dist/chunk-e71hvfe9.js +321 -0
- package/dist/chunk-expwf4a6.js +667 -0
- package/dist/chunk-gpw5swh8.js +667 -0
- package/dist/chunk-jvcv96q7.js +667 -0
- package/dist/chunk-m17t3vjq.js +9 -0
- package/dist/chunk-nj84xhja.js +35 -0
- package/dist/chunk-q2dqk224.js +667 -0
- package/dist/chunk-rg2gma51.js +4316 -0
- package/dist/chunk-sa09hmwb.js +35 -0
- package/dist/chunk-skgfm8t5.js +3823 -0
- package/dist/chunk-tgx0r0vn.js +37 -0
- package/dist/chunk-v227vg7f.js +667 -0
- package/dist/chunk-w7dcvmkx.js +4314 -0
- package/dist/chunk-ya7yc55k.js +4021 -0
- package/dist/chunk-z57r8rre.js +3257 -0
- package/dist/chunk-zt95154a.js +667 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +52 -8526
- package/dist/router/context-extractor.d.ts +2 -0
- package/dist/router/esi-control-react.d.ts +321 -0
- package/dist/router/esi-format-react.d.ts +283 -0
- package/dist/router/esi-react.d.ts +55 -1
- package/dist/router/index.d.ts +2 -2
- package/dist/router/index.js +86 -3910
- package/dist/router/types.d.ts +3 -1
- package/dist/server.js +8 -8498
- package/dist/types.d.ts +16 -0
- package/package.json +2 -2
|
@@ -36,6 +36,8 @@ export declare function addSpeculationHeaders(response: Response, prefetch: stri
|
|
|
36
36
|
export interface ESIState {
|
|
37
37
|
/** User subscription tier for feature gating */
|
|
38
38
|
userTier: UserTier;
|
|
39
|
+
/** Admin flag - bypasses ALL tier restrictions */
|
|
40
|
+
isAdmin?: boolean;
|
|
39
41
|
/** Current emotional state for personalization */
|
|
40
42
|
emotionState?: {
|
|
41
43
|
primary: string;
|
|
@@ -234,12 +234,333 @@ export interface ESIAutoProps<T> {
|
|
|
234
234
|
* - Quick mode → Basic (fast, single pass)
|
|
235
235
|
*/
|
|
236
236
|
export declare function ESIAuto<T>({ children, prompt, schema, render, collaborativeThreshold, optimizeSettings, fallback, loading, className, }: ESIAutoProps<T>): JSX.Element;
|
|
237
|
+
export interface ESIShowProps {
|
|
238
|
+
/** Condition to evaluate - AI will return true/false */
|
|
239
|
+
condition: string;
|
|
240
|
+
/** Content to show if condition is true */
|
|
241
|
+
children: ReactNode;
|
|
242
|
+
/** Content to show if condition is false */
|
|
243
|
+
fallback?: ReactNode;
|
|
244
|
+
/** Loading state */
|
|
245
|
+
loading?: ReactNode;
|
|
246
|
+
/** Cache TTL */
|
|
247
|
+
cacheTtl?: number;
|
|
248
|
+
/** Callback */
|
|
249
|
+
onEvaluate?: (result: boolean) => void;
|
|
250
|
+
/** Class name */
|
|
251
|
+
className?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Simple boolean show/hide based on AI evaluation
|
|
255
|
+
* @example
|
|
256
|
+
* <ESI.Show condition="User seems frustrated based on their message history">
|
|
257
|
+
* <CalmingMessage />
|
|
258
|
+
* </ESI.Show>
|
|
259
|
+
*/
|
|
260
|
+
export declare function ESIShow({ condition, children, fallback, loading, cacheTtl, onEvaluate, className, }: ESIShowProps): JSX.Element;
|
|
261
|
+
export interface ESIHideProps {
|
|
262
|
+
/** Condition to evaluate - content hidden if true */
|
|
263
|
+
condition: string;
|
|
264
|
+
/** Content to show if condition is false */
|
|
265
|
+
children: ReactNode;
|
|
266
|
+
/** Loading state */
|
|
267
|
+
loading?: ReactNode;
|
|
268
|
+
/** Cache TTL */
|
|
269
|
+
cacheTtl?: number;
|
|
270
|
+
/** Class name */
|
|
271
|
+
className?: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Hide content based on AI evaluation
|
|
275
|
+
* @example
|
|
276
|
+
* <ESI.Hide condition="User is a minor">
|
|
277
|
+
* <AdultContent />
|
|
278
|
+
* </ESI.Hide>
|
|
279
|
+
*/
|
|
280
|
+
export declare function ESIHide({ condition, children, loading, cacheTtl, className, }: ESIHideProps): JSX.Element;
|
|
281
|
+
export interface ESIWhenProps {
|
|
282
|
+
/** Condition description */
|
|
283
|
+
condition: string;
|
|
284
|
+
/** Content to render when true */
|
|
285
|
+
children: ReactNode;
|
|
286
|
+
/** Loading state */
|
|
287
|
+
loading?: ReactNode;
|
|
288
|
+
/** Cache TTL */
|
|
289
|
+
cacheTtl?: number;
|
|
290
|
+
/** Class name */
|
|
291
|
+
className?: string;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Render content only when condition is met
|
|
295
|
+
* @example
|
|
296
|
+
* <ESI.When condition="It's the user's birthday">
|
|
297
|
+
* <BirthdayBanner />
|
|
298
|
+
* </ESI.When>
|
|
299
|
+
*/
|
|
300
|
+
export declare function ESIWhen({ condition, children, loading, cacheTtl, className }: ESIWhenProps): JSX.Element;
|
|
301
|
+
export interface ESIUnlessProps {
|
|
302
|
+
/** Condition description - renders if false */
|
|
303
|
+
condition: string;
|
|
304
|
+
/** Content to render when condition is false */
|
|
305
|
+
children: ReactNode;
|
|
306
|
+
/** Loading state */
|
|
307
|
+
loading?: ReactNode;
|
|
308
|
+
/** Cache TTL */
|
|
309
|
+
cacheTtl?: number;
|
|
310
|
+
/** Class name */
|
|
311
|
+
className?: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Render content unless condition is met
|
|
315
|
+
* @example
|
|
316
|
+
* <ESI.Unless condition="User has completed onboarding">
|
|
317
|
+
* <OnboardingPrompt />
|
|
318
|
+
* </ESI.Unless>
|
|
319
|
+
*/
|
|
320
|
+
export declare function ESIUnless({ condition, children, loading, cacheTtl, className }: ESIUnlessProps): JSX.Element;
|
|
321
|
+
export interface ESITierGateProps {
|
|
322
|
+
/** Minimum tier required */
|
|
323
|
+
minTier: 'free' | 'starter' | 'pro' | 'enterprise';
|
|
324
|
+
/** Content for users who meet tier requirement */
|
|
325
|
+
children: ReactNode;
|
|
326
|
+
/** Content for users below tier (upgrade prompt) */
|
|
327
|
+
fallback?: ReactNode;
|
|
328
|
+
/** Class name */
|
|
329
|
+
className?: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Gate content by user tier
|
|
333
|
+
* Admins bypass ALL tier restrictions
|
|
334
|
+
* @example
|
|
335
|
+
* <ESI.TierGate minTier="pro" fallback={<UpgradePrompt />}>
|
|
336
|
+
* <AdvancedFeature />
|
|
337
|
+
* </ESI.TierGate>
|
|
338
|
+
*/
|
|
339
|
+
export declare function ESITierGate({ minTier, children, fallback, className }: ESITierGateProps): JSX.Element;
|
|
340
|
+
export interface ESIEmotionGateProps {
|
|
341
|
+
/** Emotion(s) that allow access */
|
|
342
|
+
allow?: string[];
|
|
343
|
+
/** Emotion(s) that block access */
|
|
344
|
+
block?: string[];
|
|
345
|
+
/** Valence range [min, max] (-1 to 1) */
|
|
346
|
+
valenceRange?: [number, number];
|
|
347
|
+
/** Arousal range [min, max] (0 to 1) */
|
|
348
|
+
arousalRange?: [number, number];
|
|
349
|
+
/** Content to show when conditions met */
|
|
350
|
+
children: ReactNode;
|
|
351
|
+
/** Content when conditions not met */
|
|
352
|
+
fallback?: ReactNode;
|
|
353
|
+
/** Class name */
|
|
354
|
+
className?: string;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Gate content by emotion state
|
|
358
|
+
* @example
|
|
359
|
+
* <ESI.EmotionGate allow={['calm', 'focused']} fallback={<TakeABreakPrompt />}>
|
|
360
|
+
* <ComplexTask />
|
|
361
|
+
* </ESI.EmotionGate>
|
|
362
|
+
*/
|
|
363
|
+
export declare function ESIEmotionGate({ allow, block, valenceRange, arousalRange, children, fallback, className, }: ESIEmotionGateProps): JSX.Element;
|
|
364
|
+
export interface ESITimeGateProps {
|
|
365
|
+
/** Start hour (0-23) */
|
|
366
|
+
after?: number;
|
|
367
|
+
/** End hour (0-23) */
|
|
368
|
+
before?: number;
|
|
369
|
+
/** Days of week (0=Sunday, 6=Saturday) */
|
|
370
|
+
days?: number[];
|
|
371
|
+
/** Content to show when in time range */
|
|
372
|
+
children: ReactNode;
|
|
373
|
+
/** Content when outside time range */
|
|
374
|
+
fallback?: ReactNode;
|
|
375
|
+
/** Class name */
|
|
376
|
+
className?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Gate content by time of day
|
|
380
|
+
* @example
|
|
381
|
+
* <ESI.TimeGate after={9} before={17} days={[1,2,3,4,5]}>
|
|
382
|
+
* <BusinessHoursContent />
|
|
383
|
+
* </ESI.TimeGate>
|
|
384
|
+
*/
|
|
385
|
+
export declare function ESITimeGate({ after, before, days, children, fallback, className, }: ESITimeGateProps): JSX.Element;
|
|
386
|
+
export interface ESIABTestProps {
|
|
387
|
+
/** Test name for tracking */
|
|
388
|
+
name: string;
|
|
389
|
+
/** Variants to test */
|
|
390
|
+
variants: {
|
|
391
|
+
[key: string]: ReactNode;
|
|
392
|
+
};
|
|
393
|
+
/** Prompt to select variant (AI decides) */
|
|
394
|
+
selectionPrompt?: string;
|
|
395
|
+
/** Use random selection instead of AI */
|
|
396
|
+
random?: boolean;
|
|
397
|
+
/** Callback when variant selected */
|
|
398
|
+
onSelect?: (variant: string) => void;
|
|
399
|
+
/** Loading state */
|
|
400
|
+
loading?: ReactNode;
|
|
401
|
+
/** Class name */
|
|
402
|
+
className?: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* A/B testing with AI-based or random selection
|
|
406
|
+
* @example
|
|
407
|
+
* <ESI.ABTest
|
|
408
|
+
* name="checkout-button"
|
|
409
|
+
* variants={{
|
|
410
|
+
* control: <Button>Buy Now</Button>,
|
|
411
|
+
* variant_a: <Button color="green">Purchase</Button>,
|
|
412
|
+
* variant_b: <Button size="large">Get It Now</Button>
|
|
413
|
+
* }}
|
|
414
|
+
* selectionPrompt="Pick the variant most likely to convert based on user emotion"
|
|
415
|
+
* />
|
|
416
|
+
*/
|
|
417
|
+
export declare function ESIABTest({ name, variants, selectionPrompt, random, onSelect, loading, className, }: ESIABTestProps): JSX.Element;
|
|
418
|
+
export interface ESIForEachProps<T> {
|
|
419
|
+
/** Prompt to generate the list */
|
|
420
|
+
prompt: string;
|
|
421
|
+
/** Zod schema for each item */
|
|
422
|
+
itemSchema: ZodType<T, ZodTypeDef, unknown>;
|
|
423
|
+
/** Render function for each item */
|
|
424
|
+
render: (item: T, index: number) => ReactNode;
|
|
425
|
+
/** Max items to generate */
|
|
426
|
+
maxItems?: number;
|
|
427
|
+
/** Empty state */
|
|
428
|
+
empty?: ReactNode;
|
|
429
|
+
/** Loading state */
|
|
430
|
+
loading?: ReactNode;
|
|
431
|
+
/** Wrapper element */
|
|
432
|
+
as?: 'div' | 'ul' | 'ol' | 'span';
|
|
433
|
+
/** Class name */
|
|
434
|
+
className?: string;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Generate and render a list of items
|
|
438
|
+
* @example
|
|
439
|
+
* <ESI.ForEach
|
|
440
|
+
* prompt="Generate 5 personalized activity suggestions"
|
|
441
|
+
* itemSchema={z.object({ title: z.string(), description: z.string() })}
|
|
442
|
+
* render={(item, i) => <ActivityCard key={i} {...item} />}
|
|
443
|
+
* />
|
|
444
|
+
*/
|
|
445
|
+
export declare function ESIForEach<T>({ prompt, itemSchema, render, maxItems, empty, loading, as: Wrapper, className, }: ESIForEachProps<T>): JSX.Element;
|
|
446
|
+
export interface ESIFirstProps {
|
|
447
|
+
/** Prompt with context for evaluation */
|
|
448
|
+
context?: string;
|
|
449
|
+
/** Children should be ESI.When components */
|
|
450
|
+
children: ReactNode;
|
|
451
|
+
/** Fallback if no condition matches */
|
|
452
|
+
fallback?: ReactNode;
|
|
453
|
+
/** Loading state */
|
|
454
|
+
loading?: ReactNode;
|
|
455
|
+
/** Class name */
|
|
456
|
+
className?: string;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Render the first child whose condition evaluates to true
|
|
460
|
+
* @example
|
|
461
|
+
* <ESI.First fallback={<DefaultContent />}>
|
|
462
|
+
* <ESI.When condition="User is angry"><CalmingContent /></ESI.When>
|
|
463
|
+
* <ESI.When condition="User is confused"><HelpContent /></ESI.When>
|
|
464
|
+
* <ESI.When condition="User is happy"><CelebrateContent /></ESI.When>
|
|
465
|
+
* </ESI.First>
|
|
466
|
+
*/
|
|
467
|
+
export declare function ESIFirst({ context, children, fallback, loading, className, }: ESIFirstProps): JSX.Element;
|
|
468
|
+
export interface ESIClampProps {
|
|
469
|
+
/** Prompt to generate a number */
|
|
470
|
+
prompt: string;
|
|
471
|
+
/** Minimum value */
|
|
472
|
+
min: number;
|
|
473
|
+
/** Maximum value */
|
|
474
|
+
max: number;
|
|
475
|
+
/** Render function */
|
|
476
|
+
render: (value: number) => ReactNode;
|
|
477
|
+
/** Default value if generation fails */
|
|
478
|
+
defaultValue?: number;
|
|
479
|
+
/** Loading state */
|
|
480
|
+
loading?: ReactNode;
|
|
481
|
+
/** Class name */
|
|
482
|
+
className?: string;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Generate a clamped numeric value
|
|
486
|
+
* @example
|
|
487
|
+
* <ESI.Clamp
|
|
488
|
+
* prompt="Rate the urgency of this message from 1-10"
|
|
489
|
+
* min={1}
|
|
490
|
+
* max={10}
|
|
491
|
+
* render={(urgency) => <UrgencyBadge level={urgency} />}
|
|
492
|
+
* />
|
|
493
|
+
*/
|
|
494
|
+
export declare function ESIClamp({ prompt, min, max, render, defaultValue, loading, className, }: ESIClampProps): JSX.Element;
|
|
495
|
+
export interface ESISelectProps<T extends string> {
|
|
496
|
+
/** Prompt for selection */
|
|
497
|
+
prompt: string;
|
|
498
|
+
/** Available options */
|
|
499
|
+
options: T[];
|
|
500
|
+
/** Render function for selected option */
|
|
501
|
+
render: (selected: T) => ReactNode;
|
|
502
|
+
/** Default if selection fails */
|
|
503
|
+
defaultOption?: T;
|
|
504
|
+
/** Loading state */
|
|
505
|
+
loading?: ReactNode;
|
|
506
|
+
/** Callback */
|
|
507
|
+
onSelect?: (selected: T) => void;
|
|
508
|
+
/** Class name */
|
|
509
|
+
className?: string;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Select from predefined options
|
|
513
|
+
* @example
|
|
514
|
+
* <ESI.Select
|
|
515
|
+
* prompt="What tone should we use for this user?"
|
|
516
|
+
* options={['formal', 'casual', 'playful', 'empathetic']}
|
|
517
|
+
* render={(tone) => <Message tone={tone} />}
|
|
518
|
+
* />
|
|
519
|
+
*/
|
|
520
|
+
export declare function ESISelect<T extends string>({ prompt, options, render, defaultOption, loading, onSelect, className, }: ESISelectProps<T>): JSX.Element;
|
|
521
|
+
export interface ESIScoreProps {
|
|
522
|
+
/** What to score */
|
|
523
|
+
prompt: string;
|
|
524
|
+
/** Render function */
|
|
525
|
+
render: (score: number, label: string) => ReactNode;
|
|
526
|
+
/** Score thresholds and labels */
|
|
527
|
+
thresholds?: {
|
|
528
|
+
value: number;
|
|
529
|
+
label: string;
|
|
530
|
+
}[];
|
|
531
|
+
/** Loading state */
|
|
532
|
+
loading?: ReactNode;
|
|
533
|
+
/** Class name */
|
|
534
|
+
className?: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Generate a normalized 0-1 score with label
|
|
538
|
+
* @example
|
|
539
|
+
* <ESI.Score
|
|
540
|
+
* prompt="Rate the user's engagement level"
|
|
541
|
+
* render={(score, label) => <EngagementMeter value={score} label={label} />}
|
|
542
|
+
* />
|
|
543
|
+
*/
|
|
544
|
+
export declare function ESIScore({ prompt, render, thresholds, loading, className, }: ESIScoreProps): JSX.Element;
|
|
237
545
|
export declare const ESIControl: {
|
|
238
546
|
Structured: typeof ESIStructured;
|
|
239
547
|
If: typeof ESIIf;
|
|
548
|
+
Show: typeof ESIShow;
|
|
549
|
+
Hide: typeof ESIHide;
|
|
550
|
+
When: typeof ESIWhen;
|
|
551
|
+
Unless: typeof ESIUnless;
|
|
240
552
|
Match: typeof ESIMatch;
|
|
241
553
|
Case: typeof ESICase;
|
|
242
554
|
Default: typeof ESIDefault;
|
|
555
|
+
First: typeof ESIFirst;
|
|
556
|
+
TierGate: typeof ESITierGate;
|
|
557
|
+
EmotionGate: typeof ESIEmotionGate;
|
|
558
|
+
TimeGate: typeof ESITimeGate;
|
|
559
|
+
ForEach: typeof ESIForEach;
|
|
560
|
+
Select: typeof ESISelect;
|
|
561
|
+
ABTest: typeof ESIABTest;
|
|
562
|
+
Clamp: typeof ESIClamp;
|
|
563
|
+
Score: typeof ESIScore;
|
|
243
564
|
Collaborative: typeof ESICollaborative;
|
|
244
565
|
Reflect: typeof ESIReflect;
|
|
245
566
|
Optimize: typeof ESIOptimize;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESI Format Components (React)
|
|
3
|
+
*
|
|
4
|
+
* Output transformation wrappers for ESI components.
|
|
5
|
+
* These components wrap other ESI components and transform their output.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // Render inference output as markdown
|
|
10
|
+
* <ESI.Markdown>
|
|
11
|
+
* <ESI.Infer>Generate documentation for this API endpoint</ESI.Infer>
|
|
12
|
+
* </ESI.Markdown>
|
|
13
|
+
*
|
|
14
|
+
* // Render LaTeX math expressions
|
|
15
|
+
* <ESI.Latex>
|
|
16
|
+
* <ESI.Infer>Write the quadratic formula</ESI.Infer>
|
|
17
|
+
* </ESI.Latex>
|
|
18
|
+
*
|
|
19
|
+
* // Pretty-print JSON output
|
|
20
|
+
* <ESI.Json>
|
|
21
|
+
* <ESI.Structured schema={mySchema}>Analyze this data</ESI.Structured>
|
|
22
|
+
* </ESI.Json>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import { type ReactNode, type FC } from 'react';
|
|
26
|
+
/** Supported wrapper element types */
|
|
27
|
+
type WrapperElement = 'div' | 'span' | 'pre' | 'code' | 'section' | 'article' | 'aside';
|
|
28
|
+
export interface ESIFormatProps {
|
|
29
|
+
/** ESI component(s) to wrap */
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/** CSS class for the output container */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Custom wrapper element */
|
|
34
|
+
as?: WrapperElement;
|
|
35
|
+
/** Fallback content if transformation fails */
|
|
36
|
+
fallback?: ReactNode;
|
|
37
|
+
/** Whether to sanitize output (default: true for HTML-producing formats) */
|
|
38
|
+
sanitize?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ESIMarkdownProps extends ESIFormatProps {
|
|
41
|
+
/** GitHub Flavored Markdown support */
|
|
42
|
+
gfm?: boolean;
|
|
43
|
+
/** Enable syntax highlighting for code blocks */
|
|
44
|
+
syntaxHighlight?: boolean;
|
|
45
|
+
/** Theme for syntax highlighting */
|
|
46
|
+
syntaxTheme?: 'light' | 'dark' | 'auto';
|
|
47
|
+
/** Allow raw HTML in markdown (default: false for security) */
|
|
48
|
+
allowHtml?: boolean;
|
|
49
|
+
/** Custom link target */
|
|
50
|
+
linkTarget?: '_blank' | '_self' | '_parent' | '_top';
|
|
51
|
+
}
|
|
52
|
+
export interface ESILatexProps extends ESIFormatProps {
|
|
53
|
+
/** Rendering mode */
|
|
54
|
+
mode?: 'inline' | 'block' | 'auto';
|
|
55
|
+
/** Display mode (larger, centered equations) */
|
|
56
|
+
displayMode?: boolean;
|
|
57
|
+
/** Error color for invalid LaTeX */
|
|
58
|
+
errorColor?: string;
|
|
59
|
+
/** Trust user input (allow dangerous commands) */
|
|
60
|
+
trust?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ESIJsonProps extends Omit<ESIFormatProps, 'as'> {
|
|
63
|
+
/** Custom wrapper element */
|
|
64
|
+
as?: WrapperElement;
|
|
65
|
+
/** Indentation spaces */
|
|
66
|
+
indent?: number;
|
|
67
|
+
/** Syntax highlighting */
|
|
68
|
+
syntaxHighlight?: boolean;
|
|
69
|
+
/** Theme for syntax highlighting */
|
|
70
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
71
|
+
/** Collapse objects/arrays by default */
|
|
72
|
+
collapsed?: boolean;
|
|
73
|
+
/** Max depth before collapsing */
|
|
74
|
+
collapseDepth?: number;
|
|
75
|
+
/** Enable copy button */
|
|
76
|
+
copyable?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface ESIPlaintextProps extends Omit<ESIFormatProps, 'as'> {
|
|
79
|
+
/** Custom wrapper element */
|
|
80
|
+
as?: WrapperElement;
|
|
81
|
+
/** Preserve whitespace */
|
|
82
|
+
preserveWhitespace?: boolean;
|
|
83
|
+
/** Word wrap */
|
|
84
|
+
wordWrap?: boolean;
|
|
85
|
+
/** Max width (characters) before wrapping */
|
|
86
|
+
maxWidth?: number;
|
|
87
|
+
}
|
|
88
|
+
/** Supported code-specialized models */
|
|
89
|
+
export type CodeModel = 'codestral' | 'deepseek' | 'starcoder' | 'codellama' | 'qwen-coder' | 'claude' | 'gpt-4' | 'llm';
|
|
90
|
+
export interface ESICodeProps extends Omit<ESIFormatProps, 'as'> {
|
|
91
|
+
/** Custom wrapper element */
|
|
92
|
+
as?: WrapperElement;
|
|
93
|
+
/** Programming language for syntax highlighting */
|
|
94
|
+
language?: string;
|
|
95
|
+
/** Auto-detect language using AI inference */
|
|
96
|
+
autoDetect?: boolean;
|
|
97
|
+
/** Generate code from natural language description (text-to-code) */
|
|
98
|
+
generateFrom?: string;
|
|
99
|
+
/** Code model to use for generation/detection */
|
|
100
|
+
model?: CodeModel;
|
|
101
|
+
/** Show line numbers */
|
|
102
|
+
lineNumbers?: boolean;
|
|
103
|
+
/** Starting line number */
|
|
104
|
+
startLine?: number;
|
|
105
|
+
/** Highlight specific lines */
|
|
106
|
+
highlightLines?: number[];
|
|
107
|
+
/** Theme */
|
|
108
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
109
|
+
/** Enable copy button */
|
|
110
|
+
copyable?: boolean;
|
|
111
|
+
/** Temperature for code generation (lower = more deterministic) */
|
|
112
|
+
temperature?: number;
|
|
113
|
+
/** Callback when language is detected */
|
|
114
|
+
onLanguageDetect?: (language: string) => void;
|
|
115
|
+
/** Callback when code is generated */
|
|
116
|
+
onGenerate?: (code: string, language: string) => void;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Render ESI output as markdown
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <ESI.Markdown gfm>
|
|
124
|
+
* <ESI.Infer>Generate API documentation for the /users endpoint</ESI.Infer>
|
|
125
|
+
* </ESI.Markdown>
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare const ESIMarkdown: FC<ESIMarkdownProps>;
|
|
129
|
+
/**
|
|
130
|
+
* Render ESI output as LaTeX math
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* <ESI.Latex displayMode>
|
|
135
|
+
* <ESI.Infer>Write the quadratic formula in LaTeX</ESI.Infer>
|
|
136
|
+
* </ESI.Latex>
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare const ESILatex: FC<ESILatexProps>;
|
|
140
|
+
/**
|
|
141
|
+
* Render ESI output as formatted JSON
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```tsx
|
|
145
|
+
* <ESI.Json indent={4} syntaxHighlight>
|
|
146
|
+
* <ESI.Structured schema={dataSchema}>Analyze this data</ESI.Structured>
|
|
147
|
+
* </ESI.Json>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export declare const ESIJson: FC<ESIJsonProps>;
|
|
151
|
+
/**
|
|
152
|
+
* Render ESI output as plain text (strips formatting)
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```tsx
|
|
156
|
+
* <ESI.Plaintext preserveWhitespace>
|
|
157
|
+
* <ESI.Infer>Generate ASCII art</ESI.Infer>
|
|
158
|
+
* </ESI.Plaintext>
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export declare const ESIPlaintext: FC<ESIPlaintextProps>;
|
|
162
|
+
/**
|
|
163
|
+
* Render ESI output as code with optional syntax highlighting and AI generation
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```tsx
|
|
167
|
+
* // Wrap inference output as code
|
|
168
|
+
* <ESI.Code language="typescript" lineNumbers>
|
|
169
|
+
* <ESI.Infer>Write a TypeScript function to sort an array</ESI.Infer>
|
|
170
|
+
* </ESI.Code>
|
|
171
|
+
*
|
|
172
|
+
* // Generate code from natural language (text-to-code)
|
|
173
|
+
* <ESI.Code
|
|
174
|
+
* generateFrom="A React hook that fetches user data"
|
|
175
|
+
* language="typescript"
|
|
176
|
+
* model="codestral"
|
|
177
|
+
* />
|
|
178
|
+
*
|
|
179
|
+
* // Auto-detect language
|
|
180
|
+
* <ESI.Code autoDetect model="deepseek">
|
|
181
|
+
* {someCodeString}
|
|
182
|
+
* </ESI.Code>
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare const ESICode: FC<ESICodeProps>;
|
|
186
|
+
/** Schema.org types for microdata */
|
|
187
|
+
export type SchemaOrgType = 'Article' | 'BlogPosting' | 'CreativeWork' | 'Event' | 'HowTo' | 'NewsArticle' | 'Organization' | 'Person' | 'Place' | 'Product' | 'Recipe' | 'Review' | 'Thing' | 'WebPage';
|
|
188
|
+
/** Extracted semantic topic */
|
|
189
|
+
export interface SemanticTopic {
|
|
190
|
+
/** Topic label */
|
|
191
|
+
label: string;
|
|
192
|
+
/** Confidence score 0-1 */
|
|
193
|
+
confidence: number;
|
|
194
|
+
/** Schema.org type */
|
|
195
|
+
schemaType?: SchemaOrgType;
|
|
196
|
+
/** Related keywords */
|
|
197
|
+
keywords?: string[];
|
|
198
|
+
/** Embedding vector (if requested) */
|
|
199
|
+
embedding?: number[];
|
|
200
|
+
}
|
|
201
|
+
/** Extracted entity */
|
|
202
|
+
export interface SemanticEntity {
|
|
203
|
+
/** Entity text */
|
|
204
|
+
text: string;
|
|
205
|
+
/** Entity type (person, place, org, etc.) */
|
|
206
|
+
type: 'person' | 'place' | 'organization' | 'date' | 'money' | 'product' | 'event' | 'other';
|
|
207
|
+
/** Schema.org type */
|
|
208
|
+
schemaType?: SchemaOrgType;
|
|
209
|
+
/** Start position in text */
|
|
210
|
+
start?: number;
|
|
211
|
+
/** End position in text */
|
|
212
|
+
end?: number;
|
|
213
|
+
}
|
|
214
|
+
/** Extracted emotion from text */
|
|
215
|
+
export interface SemanticEmotion {
|
|
216
|
+
/** Primary emotion */
|
|
217
|
+
primary: string;
|
|
218
|
+
/** Valence: negative (-1) to positive (1) */
|
|
219
|
+
valence: number;
|
|
220
|
+
/** Arousal: calm (0) to excited (1) */
|
|
221
|
+
arousal: number;
|
|
222
|
+
/** Confidence 0-1 */
|
|
223
|
+
confidence: number;
|
|
224
|
+
}
|
|
225
|
+
export interface ESISemanticProps extends Omit<ESIFormatProps, 'as'> {
|
|
226
|
+
/** Custom wrapper element */
|
|
227
|
+
as?: WrapperElement;
|
|
228
|
+
/** Text to analyze (or children) */
|
|
229
|
+
text?: string;
|
|
230
|
+
/** Output format */
|
|
231
|
+
format?: 'microdata' | 'jsonld' | 'rdfa' | 'tags';
|
|
232
|
+
/** Include embeddings in output */
|
|
233
|
+
includeEmbeddings?: boolean;
|
|
234
|
+
/** Maximum topics to extract */
|
|
235
|
+
maxTopics?: number;
|
|
236
|
+
/** Minimum confidence threshold */
|
|
237
|
+
minConfidence?: number;
|
|
238
|
+
/** Schema.org type hint */
|
|
239
|
+
schemaType?: SchemaOrgType;
|
|
240
|
+
/** Extract named entities using entity model */
|
|
241
|
+
extractEntities?: boolean;
|
|
242
|
+
/** Extract emotion using emotion model */
|
|
243
|
+
extractEmotion?: boolean;
|
|
244
|
+
/** Custom topic vocabulary (for domain-specific topics) */
|
|
245
|
+
vocabulary?: string[];
|
|
246
|
+
/** Callback with extracted data */
|
|
247
|
+
onExtract?: (data: {
|
|
248
|
+
topics: SemanticTopic[];
|
|
249
|
+
entities: SemanticEntity[];
|
|
250
|
+
emotion?: SemanticEmotion;
|
|
251
|
+
}) => void;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Extract semantic topics and generate structured HTML with microdata
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```tsx
|
|
258
|
+
* // Extract topics as microdata
|
|
259
|
+
* <ESI.Semantic format="microdata" maxTopics={5}>
|
|
260
|
+
* <ESI.Infer>Summarize this article about climate change</ESI.Infer>
|
|
261
|
+
* </ESI.Semantic>
|
|
262
|
+
*
|
|
263
|
+
* // Generate JSON-LD structured data
|
|
264
|
+
* <ESI.Semantic format="jsonld" schemaType="Article">
|
|
265
|
+
* {articleText}
|
|
266
|
+
* </ESI.Semantic>
|
|
267
|
+
*
|
|
268
|
+
* // Extract as tags for display
|
|
269
|
+
* <ESI.Semantic format="tags" extractEntities>
|
|
270
|
+
* {content}
|
|
271
|
+
* </ESI.Semantic>
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export declare const ESISemantic: FC<ESISemanticProps>;
|
|
275
|
+
export declare const ESIFormat: {
|
|
276
|
+
Markdown: FC<ESIMarkdownProps>;
|
|
277
|
+
Latex: FC<ESILatexProps>;
|
|
278
|
+
Json: FC<ESIJsonProps>;
|
|
279
|
+
Plaintext: FC<ESIPlaintextProps>;
|
|
280
|
+
Code: FC<ESICodeProps>;
|
|
281
|
+
Semantic: FC<ESISemanticProps>;
|
|
282
|
+
};
|
|
283
|
+
export default ESIFormat;
|