@promptbook/fake-llm 0.105.0-19 → 0.105.0-21

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/esm/index.es.js CHANGED
@@ -21,7 +21,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
21
21
  * @generated
22
22
  * @see https://github.com/webgptorg/promptbook
23
23
  */
24
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-19';
24
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-21';
25
25
  /**
26
26
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
27
27
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -13,7 +13,17 @@ import { BookEditor } from '../book-components/BookEditor/BookEditor';
13
13
  import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
14
14
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
15
15
  import { Chat } from '../book-components/Chat/Chat/Chat';
16
+ import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
16
17
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
18
+ import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
19
+ import { ChatEffectsSystem } from '../book-components/Chat/effects/ChatEffectsSystem';
20
+ import { ConfettiEffect } from '../book-components/Chat/effects/components/ConfettiEffect';
21
+ import { HeartsEffect } from '../book-components/Chat/effects/components/HeartsEffect';
22
+ import { defaultEffectConfigs } from '../book-components/Chat/effects/configs/defaultEffectConfigs';
23
+ import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffect';
24
+ import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
25
+ import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
26
+ import type { ChatEffectType } from '../book-components/Chat/effects/types/ChatEffectType';
17
27
  import { useChatAutoScroll } from '../book-components/Chat/hooks/useChatAutoScroll';
18
28
  import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
19
29
  import { useSendMessageToLlmChat } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
@@ -71,7 +81,17 @@ export { BookEditor };
71
81
  export { AgentChat };
72
82
  export type { AgentChatProps };
73
83
  export { Chat };
84
+ export type { ChatSoundSystem };
74
85
  export type { ChatProps };
86
+ export { ChatSoundToggle };
87
+ export { ChatEffectsSystem };
88
+ export { ConfettiEffect };
89
+ export { HeartsEffect };
90
+ export { defaultEffectConfigs };
91
+ export type { ChatEffect };
92
+ export type { ChatEffectConfig };
93
+ export type { ChatEffectsSystemProps };
94
+ export type { ChatEffectType };
75
95
  export { useChatAutoScroll };
76
96
  export type { SendMessageToLlmChatFunction };
77
97
  export { useSendMessageToLlmChat };
@@ -9,7 +9,13 @@ import type { AvatarProfileProps } from '../book-components/AvatarProfile/Avatar
9
9
  import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
10
10
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
11
11
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
12
+ import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
12
13
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
14
+ import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
15
+ import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffect';
16
+ import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
17
+ import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
18
+ import type { ChatEffectType } from '../book-components/Chat/effects/types/ChatEffectType';
13
19
  import type { ChatAutoScrollConfig } from '../book-components/Chat/hooks/useChatAutoScroll';
14
20
  import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
15
21
  import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
@@ -392,7 +398,13 @@ export type { AvatarProfileProps };
392
398
  export type { AvatarProfileFromSourceProps };
393
399
  export type { BookEditorProps };
394
400
  export type { AgentChatProps };
401
+ export type { ChatSoundSystem };
395
402
  export type { ChatProps };
403
+ export type { ChatSoundToggleProps };
404
+ export type { ChatEffect };
405
+ export type { ChatEffectConfig };
406
+ export type { ChatEffectsSystemProps };
407
+ export type { ChatEffectType };
396
408
  export type { ChatAutoScrollConfig };
397
409
  export type { SendMessageToLlmChatFunction };
398
410
  export type { LlmChatProps };
@@ -6,6 +6,21 @@ import { string_color } from '../../../types/typeAliases';
6
6
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
7
7
  import type { ChatMessage } from '../types/ChatMessage';
8
8
  import type { ChatParticipant } from '../types/ChatParticipant';
9
+ /**
10
+ * Interface for sound system that can be passed to Chat component
11
+ * This allows the chat to trigger sounds without tight coupling
12
+ *
13
+ * @public exported from `@promptbook/components`
14
+ */
15
+ export type ChatSoundSystem = {
16
+ /**
17
+ * @@@
18
+ */
19
+ play(event: string): Promise<void>;
20
+ isEnabled(): boolean;
21
+ setEnabled(enabled: boolean): void;
22
+ toggle(): boolean;
23
+ };
9
24
  /**
10
25
  * @public exported from `@promptbook/components`
11
26
  */
@@ -202,6 +217,49 @@ export type ChatProps = {
202
217
  * Visual style of the chat component
203
218
  */
204
219
  readonly visual: 'STANDALONE' | 'FULL_PAGE';
220
+ /**
221
+ * Optional array of effect configurations for chat animations
222
+ * When provided, enables visual effects (confetti, hearts, etc.) based on emojis in messages
223
+ *
224
+ * Example:
225
+ * ```typescript
226
+ * [
227
+ * { trigger: '🎉', effectType: 'CONFETTI' },
228
+ * { trigger: /❤️|💙|💚/, effectType: 'HEARTS' }
229
+ * ]
230
+ * ```
231
+ */
232
+ readonly effectConfigs?: ReadonlyArray<{
233
+ trigger: string | RegExp;
234
+ effectType: string;
235
+ }>;
236
+ /**
237
+ * Optional sound system for playing chat sounds
238
+ * When provided, enables sound effects for message events, button clicks, and visual effects
239
+ *
240
+ * The sound system should implement the ChatSoundSystem interface:
241
+ * - play(event: string): Plays a sound for the given event
242
+ * - isEnabled(): Returns whether sounds are enabled
243
+ * - setEnabled(enabled: boolean): Enables or disables sounds
244
+ * - toggle(): Toggles sound on/off and returns the new state
245
+ *
246
+ * Supported events:
247
+ * - 'message_send': When user sends a message
248
+ * - 'message_receive': When agent sends a message
249
+ * - 'message_typing': When agent is typing/thinking
250
+ * - 'button_click': When any button is clicked
251
+ * - 'effect_confetti': When confetti effect is triggered
252
+ * - 'effect_hearts': When hearts effect is triggered
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * import { createDefaultSoundSystem } from '@/utils/sound/createDefaultSoundSystem';
257
+ *
258
+ * const soundSystem = createDefaultSoundSystem();
259
+ * <Chat soundSystem={soundSystem} ... />
260
+ * ```
261
+ */
262
+ readonly soundSystem?: ChatSoundSystem;
205
263
  };
206
264
  /**
207
265
  * TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
@@ -0,0 +1,23 @@
1
+ import type { ChatSoundSystem } from './ChatProps';
2
+ /**
3
+ * Props for the ChatSoundToggle component
4
+ */
5
+ export type ChatSoundToggleProps = {
6
+ /**
7
+ * The sound system instance
8
+ */
9
+ soundSystem: ChatSoundSystem;
10
+ /**
11
+ * Optional CSS class name
12
+ */
13
+ className?: string;
14
+ };
15
+ /**
16
+ * ChatSoundToggle component
17
+ *
18
+ * Renders a toggle button/checkbox to enable/disable chat sounds.
19
+ * The state is persisted in localStorage via the SoundSystem.
20
+ *
21
+ * @public exported from `@promptbook/components`
22
+ */
23
+ export declare function ChatSoundToggle(props: ChatSoundToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { ChatEffectsSystemProps } from './types/ChatEffectsSystemProps';
2
+ /**
3
+ * ChatEffectsSystem component
4
+ * Monitors chat messages and triggers visual effects based on emoji content
5
+ *
6
+ * This component:
7
+ * - Tracks which messages have already been processed
8
+ * - Detects emojis in new agent messages
9
+ * - Triggers appropriate effects (confetti, hearts, etc.)
10
+ * - Handles effect lifecycle (creation, completion, cleanup)
11
+ *
12
+ * @public exported from `@promptbook/components`
13
+ */
14
+ export declare function ChatEffectsSystem(props: ChatEffectsSystemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ type ConfettiEffectProps = {
2
+ /**
3
+ * Unique identifier for this effect instance
4
+ */
5
+ effectId: string;
6
+ /**
7
+ * Callback when the effect completes
8
+ */
9
+ onComplete?: () => void;
10
+ };
11
+ /**
12
+ * Confetti effect component
13
+ * Renders falling confetti particles from the top of the screen
14
+ *
15
+ * @public exported from `@promptbook/components`
16
+ */
17
+ export declare function ConfettiEffect(props: ConfettiEffectProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,18 @@
1
+ type HeartsEffectProps = {
2
+ /**
3
+ * Unique identifier for this effect instance
4
+ */
5
+ effectId: string;
6
+ /**
7
+ * Callback when the effect completes
8
+ */
9
+ onComplete?: () => void;
10
+ };
11
+ /**
12
+ * Hearts effect component
13
+ * Renders floating hearts that rise from the bottom of the screen
14
+ *
15
+ * @public exported from `@promptbook/components`
16
+ */
17
+ export declare function HeartsEffect(props: HeartsEffectProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ChatEffectConfig } from '../types/ChatEffectConfig';
2
+ /**
3
+ * Default effect configurations for common chat emojis
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export declare const defaultEffectConfigs: ReadonlyArray<ChatEffectConfig>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Chat effects system exports
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { ChatEffectsSystem } from './ChatEffectsSystem';
7
+ export { ConfettiEffect } from './components/ConfettiEffect';
8
+ export { HeartsEffect } from './components/HeartsEffect';
9
+ export { defaultEffectConfigs } from './configs/defaultEffectConfigs';
10
+ export type { ChatEffect } from './types/ChatEffect';
11
+ export type { ChatEffectConfig } from './types/ChatEffectConfig';
12
+ export type { ChatEffectsSystemProps } from './types/ChatEffectsSystemProps';
13
+ export type { ChatEffectType } from './types/ChatEffectType';
14
+ export { detectEffects } from './utils/detectEffects';
15
+ /**
16
+ * TODO: !!!!! To rules: Do not create index files that re-ex-port from multiple files, import directly instead or use full register
17
+ * Note: [💞] Ignore a discrepancy between file name and entity name
18
+ */
@@ -0,0 +1,20 @@
1
+ import type { ChatEffectType } from './ChatEffectType';
2
+ /**
3
+ * Represents a chat effect instance
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export type ChatEffect = {
8
+ /**
9
+ * Unique identifier for this effect instance
10
+ */
11
+ id: string;
12
+ /**
13
+ * Type of effect
14
+ */
15
+ type: ChatEffectType;
16
+ /**
17
+ * Timestamp when the effect was triggered
18
+ */
19
+ timestamp: number;
20
+ };
@@ -0,0 +1,21 @@
1
+ import type { ChatEffectType } from './ChatEffectType';
2
+ /**
3
+ * Configuration for a chat effect trigger
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export type ChatEffectConfig = {
8
+ /**
9
+ * Emoji or pattern that triggers this effect
10
+ */
11
+ trigger: string | RegExp;
12
+ /**
13
+ * Type of effect to trigger
14
+ */
15
+ effectType: ChatEffectType;
16
+ /**
17
+ * Whether to match all heart emojis (❤️, 💙, 💚, etc.)
18
+ * Only relevant for heart effects
19
+ */
20
+ matchAllHeartEmojis?: boolean;
21
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types of chat effects that can be triggered
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export type ChatEffectType = 'CONFETTI' | 'HEARTS';
@@ -0,0 +1,32 @@
1
+ import type { ChatSoundSystem } from '../../Chat/ChatProps';
2
+ import type { ChatMessage } from '../../types/ChatMessage';
3
+ import type { ChatEffectConfig } from './ChatEffectConfig';
4
+ /**
5
+ * Props for the ChatEffectsSystem component
6
+ *
7
+ * @public exported from `@promptbook/components`
8
+ */
9
+ export type ChatEffectsSystemProps = {
10
+ /**
11
+ * Array of chat messages to monitor for effect triggers
12
+ */
13
+ messages: ReadonlyArray<ChatMessage>;
14
+ /**
15
+ * Array of effect configurations
16
+ * Defines which emojis/patterns trigger which effects
17
+ */
18
+ effectConfigs: ReadonlyArray<ChatEffectConfig>;
19
+ /**
20
+ * Optional filter function to determine if a message should trigger effects
21
+ * By default, only agent messages trigger effects
22
+ */
23
+ shouldTriggerEffect?: (message: ChatMessage) => boolean;
24
+ /**
25
+ * CSS class name for the effects container
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Optional sound system to play sounds when effects are triggered
30
+ */
31
+ soundSystem?: ChatSoundSystem;
32
+ };
@@ -0,0 +1,12 @@
1
+ import type { ChatMessage } from '../../types/ChatMessage';
2
+ import type { ChatEffectConfig } from '../types/ChatEffectConfig';
3
+ import type { ChatEffectType } from '../types/ChatEffectType';
4
+ /**
5
+ * Detects which effects should be triggered based on message content
6
+ *
7
+ * @param message - The chat message to analyze
8
+ * @param effectConfigs - Array of effect configurations
9
+ * @returns Array of unique effect types to trigger
10
+ * @private utility function of Effects system
11
+ */
12
+ export declare function detectEffects(message: ChatMessage, effectConfigs: ReadonlyArray<ChatEffectConfig>): ChatEffectType[];
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.105.0-15`).
18
+ * It follows semantic versioning (e.g., `0.105.0-20`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/fake-llm",
3
- "version": "0.105.0-19",
3
+ "version": "0.105.0-21",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.105.0-19"
99
+ "@promptbook/core": "0.105.0-21"
100
100
  },
101
101
  "dependencies": {
102
102
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-19';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-21';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name