@promptbook/utils 0.112.0-46 → 0.112.0-48

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.
Files changed (68) hide show
  1. package/README.md +16 -16
  2. package/esm/index.es.js +1 -1
  3. package/esm/src/avatars/AvatarOrImage.d.ts +49 -0
  4. package/esm/src/avatars/avatarInteractionUtils.d.ts +81 -0
  5. package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  6. package/esm/src/avatars/avatarPointerTracking.d.ts +17 -0
  7. package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
  8. package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  9. package/esm/src/avatars/index.d.ts +2 -1
  10. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
  11. package/esm/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
  12. package/esm/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
  13. package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
  14. package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  15. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  16. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
  17. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  18. package/esm/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
  19. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  20. package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
  21. package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
  22. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
  23. package/esm/src/commitments/USE/USE.d.ts +1 -0
  24. package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  25. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  26. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  27. package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  28. package/esm/src/commitments/index.d.ts +2 -1
  29. package/esm/src/config.d.ts +2 -2
  30. package/esm/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
  31. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  32. package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
  33. package/esm/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
  34. package/esm/src/version.d.ts +1 -1
  35. package/package.json +2 -2
  36. package/umd/index.umd.js +1 -1
  37. package/umd/src/avatars/AvatarOrImage.d.ts +49 -0
  38. package/umd/src/avatars/avatarInteractionUtils.d.ts +81 -0
  39. package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  40. package/umd/src/avatars/avatarPointerTracking.d.ts +17 -0
  41. package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
  42. package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  43. package/umd/src/avatars/index.d.ts +2 -1
  44. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
  45. package/umd/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
  46. package/umd/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
  47. package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
  48. package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  49. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  50. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
  51. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  52. package/umd/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
  53. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  54. package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
  55. package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
  56. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
  57. package/umd/src/commitments/USE/USE.d.ts +1 -0
  58. package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  59. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  60. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  61. package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  62. package/umd/src/commitments/index.d.ts +2 -1
  63. package/umd/src/config.d.ts +2 -2
  64. package/umd/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
  65. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  66. package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
  67. package/umd/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
  68. package/umd/src/version.d.ts +1 -1
@@ -1,4 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
+ import type { AvatarDefinition } from '../../../avatars/types/AvatarDefinition';
3
+ import type { AvatarVisualId } from '../../../avatars/types/AvatarVisualDefinition';
2
4
  /**
3
5
  * Props for a team modal header profile badge.
4
6
  *
@@ -7,6 +9,8 @@ import { type ReactNode } from 'react';
7
9
  export type TeamHeaderProfileProps = {
8
10
  label: string;
9
11
  avatarSrc?: string | null;
12
+ avatarDefinition?: AvatarDefinition;
13
+ avatarVisualId?: AvatarVisualId;
10
14
  href?: string;
11
15
  fallbackColor?: string;
12
16
  };
@@ -15,7 +19,7 @@ export type TeamHeaderProfileProps = {
15
19
  *
16
20
  * @private component of `<Chat/>`
17
21
  */
18
- export declare function TeamHeaderProfile({ label, avatarSrc, href, fallbackColor }: TeamHeaderProfileProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function TeamHeaderProfile({ label, avatarSrc, avatarDefinition, avatarVisualId, href, fallbackColor, }: TeamHeaderProfileProps): import("react/jsx-runtime").JSX.Element;
19
23
  /**
20
24
  * Props for a self-learning modal avatar.
21
25
  *
@@ -24,6 +28,8 @@ export declare function TeamHeaderProfile({ label, avatarSrc, href, fallbackColo
24
28
  export type SelfLearningAvatarProps = {
25
29
  label: string;
26
30
  avatarSrc?: string | null;
31
+ avatarDefinition?: AvatarDefinition;
32
+ avatarVisualId?: AvatarVisualId;
27
33
  fallbackColor?: string;
28
34
  className?: string;
29
35
  children?: ReactNode;
@@ -33,4 +39,4 @@ export type SelfLearningAvatarProps = {
33
39
  *
34
40
  * @private component of `<Chat/>`
35
41
  */
36
- export declare function SelfLearningAvatar({ label, avatarSrc, fallbackColor, className, children, }: SelfLearningAvatarProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function SelfLearningAvatar({ label, avatarSrc, avatarDefinition, avatarVisualId, fallbackColor, className, children, }: SelfLearningAvatarProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -8,6 +8,8 @@ import type { ChatMessage } from '../types/ChatMessage';
8
8
  * - Every streaming chunk / intermediate content update
9
9
  * - `message_typing` lifecycle events before the message is finalized
10
10
  * - Re-renders of an already-notified completed message (idempotent)
11
+ * - Initial mount hydration with preloaded completed chat history
12
+ * - Switching to another chat thread that already contains completed history
11
13
  * - User-originated messages
12
14
  *
13
15
  * @param messages - Current list of chat messages
@@ -1,6 +1,8 @@
1
1
  import type { string_book } from '../../../book-2.0/agent-source/string_book';
2
2
  import type { id, string_color, string_person_fullname, string_url_image } from '../../../types/typeAliases';
3
3
  import { Color } from '../../../utils/color/Color';
4
+ import type { AvatarDefinition } from '../../../avatars/types/AvatarDefinition';
5
+ import type { AvatarVisualId } from '../../../avatars/types/AvatarVisualDefinition';
4
6
  /**
5
7
  * A participant in the chat
6
8
  *
@@ -23,6 +25,14 @@ export type ChatParticipant = {
23
25
  * Profile picture
24
26
  */
25
27
  avatarSrc?: string_url_image;
28
+ /**
29
+ * Deterministic avatar definition used when no static image should be shown.
30
+ */
31
+ avatarDefinition?: AvatarDefinition;
32
+ /**
33
+ * Built-in avatar visual id used with `avatarDefinition`.
34
+ */
35
+ avatarVisualId?: AvatarVisualId;
26
36
  /**
27
37
  * Color associated with the participant
28
38
  */
@@ -1,6 +1,6 @@
1
1
  import type { InitializationStatus } from './boilerplateTemplates';
2
2
  /**
3
- * Ensures `.gitignore` contains the standalone Promptbook coder cache entry.
3
+ * Ensures `.gitignore` contains the standalone Promptbook coder temp and cache entries.
4
4
  *
5
5
  * @private function of `initializeCoderProjectConfiguration`
6
6
  */
@@ -9,6 +9,7 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
9
9
  * Supported USE types:
10
10
  * - USE BROWSER: Enables the agent to use a web browser tool
11
11
  * - USE SEARCH ENGINE (future): Enables search engine access
12
+ * - USE DEEPSEARCH: Enables deeper research-oriented search access
12
13
  * - USE FILE SYSTEM (future): Enables file system operations
13
14
  * - USE MCP (future): Enables MCP server connections
14
15
  *
@@ -6,7 +6,7 @@ import type { ParsedCommitment } from '../_base/ParsedCommitment';
6
6
  *
7
7
  * @private internal utility of `createAgentModelRequirementsWithCommitments`
8
8
  */
9
- type AggregatedUseCommitmentType = 'USE BROWSER' | 'USE SEARCH ENGINE' | 'USE TIME';
9
+ type AggregatedUseCommitmentType = 'USE BROWSER' | 'USE DEEPSEARCH' | 'USE SEARCH ENGINE' | 'USE TIME';
10
10
  /**
11
11
  * Adds the placeholder for an aggregated `USE` system-message section only once, preserving the section position from the first occurrence.
12
12
  *
@@ -0,0 +1,47 @@
1
+ import { string_javascript_name } from '../../_packages/types.index';
2
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
3
+ import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
4
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
5
+ /**
6
+ * USE DEEPSEARCH commitment definition
7
+ *
8
+ * The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
9
+ * search workflow instead of lightweight web search when it needs fresh information from the internet.
10
+ *
11
+ * The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
12
+ * (e.g. search scope or research instructions).
13
+ *
14
+ * Example usage in agent source:
15
+ *
16
+ * ```book
17
+ * USE DEEPSEARCH
18
+ * USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
19
+ * ```
20
+ *
21
+ * @private [🪔] Maybe export the commitments through some package
22
+ */
23
+ export declare class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition<'USE DEEPSEARCH'> {
24
+ constructor();
25
+ get requiresContent(): boolean;
26
+ /**
27
+ * Short one-line description of USE DEEPSEARCH.
28
+ */
29
+ get description(): string;
30
+ /**
31
+ * Icon for this commitment.
32
+ */
33
+ get icon(): string;
34
+ /**
35
+ * Markdown documentation for USE DEEPSEARCH commitment.
36
+ */
37
+ get documentation(): string;
38
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
39
+ /**
40
+ * Gets human-readable titles for tool functions provided by this commitment.
41
+ */
42
+ getToolTitles(): Record<string_javascript_name, string>;
43
+ /**
44
+ * Gets the local fallback implementation for the `deep_search` tool.
45
+ */
46
+ getToolFunctions(): Record<string_javascript_name, ToolFunction>;
47
+ }
@@ -0,0 +1,12 @@
1
+ import { string_javascript_name } from '../../_packages/types.index';
2
+ import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
3
+ /**
4
+ * Creates one SERP-backed tool function used as a local fallback for search-like commitments.
5
+ *
6
+ * @param toolName - Technical tool name used for validation messages.
7
+ * @param resultLabel - Human-readable label used in formatted results.
8
+ * @returns Async tool function compatible with commitment tool registration.
9
+ *
10
+ * @private internal helper for search-like commitments
11
+ */
12
+ export declare function createSerpSearchToolFunction(toolName: string_javascript_name, resultLabel: string): ToolFunction;
@@ -38,6 +38,7 @@ import { TemplateCommitmentDefinition } from './TEMPLATE/TEMPLATE';
38
38
  import { UseCommitmentDefinition } from './USE/USE';
39
39
  import { UseBrowserCommitmentDefinition } from './USE_BROWSER/USE_BROWSER';
40
40
  import { UseCalendarCommitmentDefinition } from './USE_CALENDAR/USE_CALENDAR';
41
+ import { UseDeepSearchCommitmentDefinition } from './USE_DEEPSEARCH/USE_DEEPSEARCH';
41
42
  import { UseEmailCommitmentDefinition } from './USE_EMAIL/USE_EMAIL';
42
43
  import { UseImageGeneratorCommitmentDefinition } from './USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR';
43
44
  import { UseMcpCommitmentDefinition } from './USE_MCP/USE_MCP';
@@ -59,4 +60,4 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
59
60
  *
60
61
  * @private Use functions to access commitments instead of this array directly
61
62
  */
62
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
63
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
@@ -41,7 +41,7 @@ export declare const ADMIN_GITHUB_NAME: string_name;
41
41
  *
42
42
  * @public exported from `@promptbook/core`
43
43
  */
44
- export declare const CLAIM = "Turn your company's scattered knowledge into AI ready books";
44
+ export declare const CLAIM = "Create persistent AI agents that turn your company's scattered knowledge into action";
45
45
  /**
46
46
  * Color of the Promptbook
47
47
  *
@@ -89,7 +89,7 @@ export declare const USER_CHAT_COLOR: import("./utils/take/interfaces/ITakeChain
89
89
  *
90
90
  * @public exported from `@promptbook/core`
91
91
  */
92
- export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
92
+ export declare const DEFAULT_BOOK_TITLE = "\uD83D\uDC19 Untitled agent";
93
93
  /**
94
94
  * When the title of task is not provided, the default title is used
95
95
  *
@@ -2,6 +2,7 @@ import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionToo
2
2
  import type { ChatPromptResult } from '../../execution/PromptResult';
3
3
  import type { Prompt } from '../../types/Prompt';
4
4
  import type { string_agent_hash, string_agent_name } from '../../types/typeAliases';
5
+ import type { AvatarVisualId } from '../../avatars/types/AvatarVisualDefinition';
5
6
  import { Agent } from './Agent';
6
7
  import type { RemoteAgentOptions } from './RemoteAgentOptions';
7
8
  /**
@@ -28,6 +29,8 @@ export declare class RemoteAgent extends Agent {
28
29
  toolTitles: Record<string, string>;
29
30
  private _isVoiceCallingEnabled;
30
31
  private _isVoiceTtsSttEnabled;
32
+ isMetaImageExplicit: boolean;
33
+ avatarVisualId: AvatarVisualId | undefined;
31
34
  /**
32
35
  * Indicates whether the remote server allows text-to-speech and speech-to-text.
33
36
  *
@@ -1,3 +1,5 @@
1
+ import type { AvatarDefinition } from '../../avatars/types/AvatarDefinition';
2
+ import type { AvatarVisualId } from '../../avatars/types/AvatarVisualDefinition';
1
3
  import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
2
4
  import type { string_url, string_url_image } from '../../types/typeAliases';
3
5
  /**
@@ -5,25 +7,67 @@ import type { string_url, string_url_image } from '../../types/typeAliases';
5
7
  *
6
8
  * @private utility of `<Chat/>`
7
9
  */
8
- export type ResolveAgentAvatarImageUrlOptions = {
10
+ export type ResolveAgentAvatarOptions = {
9
11
  /**
10
12
  * Agent metadata used for avatar resolution.
11
13
  */
12
- readonly agent: Pick<AgentBasicInformation, 'agentName' | 'permanentId' | 'meta'>;
14
+ readonly agent: Pick<AgentBasicInformation, 'agentName' | 'agentHash' | 'permanentId' | 'meta'> & {
15
+ /**
16
+ * Optional explicit marker coming from remote profile payloads.
17
+ * When `false`, `meta.image` is treated as the generated static fallback rather than a user-defined `META IMAGE`.
18
+ */
19
+ readonly isMetaImageExplicit?: boolean;
20
+ /**
21
+ * Optional preferred avatar visual id coming from remote profile payloads.
22
+ */
23
+ readonly avatarVisualId?: AvatarVisualId;
24
+ };
13
25
  /**
14
26
  * Optional base URL used to resolve relative meta images and placeholders.
15
27
  */
16
28
  readonly baseUrl?: string_url;
17
29
  };
30
+ /**
31
+ * Backward-compatible alias kept for callers that only need image URLs.
32
+ *
33
+ * @private utility of `<Chat/>`
34
+ */
35
+ export type ResolveAgentAvatarImageUrlOptions = ResolveAgentAvatarOptions;
36
+ /**
37
+ * Default built-in avatar visual used when an agent does not define `META IMAGE`.
38
+ *
39
+ * @private shared avatar contract
40
+ */
41
+ export declare const DEFAULT_AGENT_AVATAR_VISUAL_ID: AvatarVisualId;
42
+ /**
43
+ * Resolved avatar descriptor used by interactive UIs to pick either an image or a live canvas visual.
44
+ *
45
+ * @private shared avatar contract
46
+ */
47
+ export type ResolvedAgentAvatar = {
48
+ readonly type: 'image';
49
+ readonly imageUrl: string_url_image;
50
+ } | {
51
+ readonly type: 'visual';
52
+ readonly avatarDefinition: AvatarDefinition;
53
+ readonly visualId: AvatarVisualId;
54
+ };
18
55
  /**
19
56
  * Resolve the fallback avatar URL for an agent.
20
57
  *
21
58
  * @private utility of `<Chat/>`
22
59
  */
23
- export declare function resolveAgentAvatarFallbackUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
60
+ export declare function resolveAgentAvatarFallbackUrl(options: ResolveAgentAvatarOptions): string_url_image | null;
61
+ /**
62
+ * Resolve the best avatar representation for an agent, preferring explicit `META IMAGE`
63
+ * and otherwise returning the default deterministic canvas visual.
64
+ *
65
+ * @private utility of `<Chat/>`
66
+ */
67
+ export declare function resolveAgentAvatar(options: ResolveAgentAvatarOptions): ResolvedAgentAvatar | null;
24
68
  /**
25
- * Resolve the best avatar URL for an agent, preferring META IMAGE and falling back to placeholders.
69
+ * Resolve the best avatar URL for an agent, preferring `META IMAGE` and falling back to the static placeholder route.
26
70
  *
27
71
  * @private utility of `<Chat/>`
28
72
  */
29
- export declare function resolveAgentAvatarImageUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
73
+ export declare function resolveAgentAvatarImageUrl(options: ResolveAgentAvatarOptions): string_url_image | null;
@@ -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.112.0-45`).
18
+ * It follows semantic versioning (e.g., `0.112.0-47`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@promptbook/utils",
3
- "version": "0.112.0-46",
4
- "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
3
+ "version": "0.112.0-48",
4
+ "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "repository": {
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-46';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-48';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -0,0 +1,49 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { string_css_class, string_url_image } from '../types/typeAliases';
3
+ import type { AvatarDefinition } from './types/AvatarDefinition';
4
+ import type { AvatarSurfaceStyle, AvatarVisualId } from './types/AvatarVisualDefinition';
5
+ /**
6
+ * Shared avatar-rendering props for places that may receive either an image URL or a deterministic avatar visual.
7
+ *
8
+ * @private shared component for avatar media rendering
9
+ */
10
+ export type AvatarOrImageProps = {
11
+ /**
12
+ * Explicit image URL to render.
13
+ */
14
+ readonly imageUrl?: string_url_image | null;
15
+ /**
16
+ * Deterministic avatar definition used by built-in visuals.
17
+ */
18
+ readonly avatarDefinition?: AvatarDefinition | null;
19
+ /**
20
+ * Selected built-in visual id used with `avatarDefinition`.
21
+ */
22
+ readonly visualId?: AvatarVisualId | null;
23
+ /**
24
+ * Surface used to composite a built-in visual in its parent shell.
25
+ */
26
+ readonly surface?: AvatarSurfaceStyle;
27
+ /**
28
+ * Output size in CSS pixels.
29
+ */
30
+ readonly size: number;
31
+ /**
32
+ * Accessible label used for the rendered media.
33
+ */
34
+ readonly alt: string;
35
+ /**
36
+ * Optional CSS class name applied to the rendered element.
37
+ */
38
+ readonly className?: string_css_class;
39
+ /**
40
+ * Optional inline styles forwarded to the rendered element.
41
+ */
42
+ readonly style?: CSSProperties;
43
+ };
44
+ /**
45
+ * Renders either a static image or a deterministic canvas avatar using one common prop shape.
46
+ *
47
+ * @private shared component for avatar media rendering
48
+ */
49
+ export declare function AvatarOrImage(props: AvatarOrImageProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,81 @@
1
+ import type { AvatarDefinition } from './types/AvatarDefinition';
2
+ import type { AvatarInteractionState, AvatarPointerType } from './types/AvatarVisualDefinition';
3
+ /**
4
+ * Internal interaction state kept between animation frames.
5
+ *
6
+ * @private utility of the avatar rendering system
7
+ */
8
+ export type AvatarInteractionRuntimeState = AvatarInteractionState & {
9
+ readonly lastFrameMs: number | null;
10
+ };
11
+ /**
12
+ * Raw shared pointer sample used to derive one avatar-local gaze target.
13
+ *
14
+ * @private utility of the avatar rendering system
15
+ */
16
+ export type AvatarPointerSnapshot = {
17
+ readonly clientX: number;
18
+ readonly clientY: number;
19
+ readonly isPointerActive: boolean;
20
+ readonly pointerType: Exclude<AvatarPointerType, 'idle'>;
21
+ };
22
+ /**
23
+ * Avatar-local pointer target resolved from viewport coordinates.
24
+ *
25
+ * @private utility of the avatar rendering system
26
+ */
27
+ export type AvatarPointerTarget = {
28
+ readonly gazeX: number;
29
+ readonly gazeY: number;
30
+ readonly bodyOffsetX: number;
31
+ readonly bodyOffsetY: number;
32
+ readonly intensity: number;
33
+ readonly isPointerActive: boolean;
34
+ readonly pointerType: AvatarPointerType;
35
+ };
36
+ /**
37
+ * Creates one stable cache key from the meaningful avatar-definition fields.
38
+ *
39
+ * @param avatarDefinition Normalized or raw avatar definition.
40
+ * @returns Stable cache key that ignores object identity churn.
41
+ *
42
+ * @private utility of the avatar rendering system
43
+ */
44
+ export declare function createAvatarDefinitionKey(avatarDefinition: AvatarDefinition): string;
45
+ /**
46
+ * Returns the neutral interaction state used by static/server-side renders.
47
+ *
48
+ * @returns Zeroed interaction state.
49
+ *
50
+ * @private utility of the avatar rendering system
51
+ */
52
+ export declare function createIdleAvatarInteractionState(): AvatarInteractionState;
53
+ /**
54
+ * Creates a fresh runtime state for the interactive animation loop.
55
+ *
56
+ * @returns Runtime interaction state with neutral values.
57
+ *
58
+ * @private utility of the avatar rendering system
59
+ */
60
+ export declare function createAvatarInteractionRuntimeState(): AvatarInteractionRuntimeState;
61
+ /**
62
+ * Converts the shared viewport pointer state into one avatar-local gaze target.
63
+ *
64
+ * @param avatarBounds Canvas bounds in viewport coordinates.
65
+ * @param pointerSnapshot Latest shared pointer sample.
66
+ * @returns Local target used to steer eyes and subtle body lean.
67
+ *
68
+ * @private utility of the avatar rendering system
69
+ */
70
+ export declare function resolveAvatarPointerTarget(avatarBounds: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>, pointerSnapshot: AvatarPointerSnapshot | null): AvatarPointerTarget;
71
+ /**
72
+ * Advances the smoothed interaction state toward the latest pointer target.
73
+ *
74
+ * @param runtimeState Previous animation-frame state.
75
+ * @param pointerTarget Latest local pointer target.
76
+ * @param nowMs Current animation-frame timestamp.
77
+ * @returns Next runtime state to keep in the animation loop.
78
+ *
79
+ * @private utility of the avatar rendering system
80
+ */
81
+ export declare function stepAvatarInteractionRuntimeState(runtimeState: AvatarInteractionRuntimeState, pointerTarget: AvatarPointerTarget, nowMs: number): AvatarInteractionRuntimeState;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { AvatarPointerSnapshot } from './avatarInteractionUtils';
2
+ /**
3
+ * Starts the shared pointer tracker and returns a disposer for the caller.
4
+ *
5
+ * @returns Cleanup function that releases one consumer.
6
+ *
7
+ * @private utility of the avatar rendering system
8
+ */
9
+ export declare function retainAvatarPointerTracking(): () => void;
10
+ /**
11
+ * Returns the latest shared viewport pointer sample when available.
12
+ *
13
+ * @returns Shared pointer snapshot or `null`.
14
+ *
15
+ * @private utility of the avatar rendering system
16
+ */
17
+ export declare function getAvatarPointerSnapshot(): AvatarPointerSnapshot | null;
@@ -1,7 +1,7 @@
1
1
  import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
2
2
  import type { string_color } from '../types/typeAliases';
3
3
  import type { AvatarDefinition } from './types/AvatarDefinition';
4
- import type { AvatarPalette } from './types/AvatarVisualDefinition';
4
+ import type { AvatarPalette, AvatarSurfaceStyle } from './types/AvatarVisualDefinition';
5
5
  /**
6
6
  * Default square size used by avatar renderers.
7
7
  *
@@ -48,11 +48,12 @@ export declare function createAvatarDefinitionFromAgentBasicInformation(agentBas
48
48
  * Creates the shared derived palette used by every avatar visual.
49
49
  *
50
50
  * @param avatarDefinition Stable avatar definition.
51
+ * @param surface Surface style used by the parent UI.
51
52
  * @returns Derived palette.
52
53
  *
53
54
  * @private utility of the avatar rendering system
54
55
  */
55
- export declare function createAvatarPalette(avatarDefinition: AvatarDefinition): AvatarPalette;
56
+ export declare function createAvatarPalette(avatarDefinition: AvatarDefinition, surface?: AvatarSurfaceStyle): AvatarPalette;
56
57
  /**
57
58
  * Draws the common rounded background frame used by most visuals.
58
59
  *
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  export { Avatar } from './Avatar';
2
+ export { AvatarOrImage } from './AvatarOrImage';
2
3
  export { renderAvatarVisual } from './renderAvatarVisual';
3
4
  export { createAvatarDefinitionFromAgentBasicInformation } from './avatarRenderingUtils';
4
5
  export { AVATAR_VISUALS, getAvatarVisualById } from './visuals/avatarVisualRegistry';
5
6
  export type { AvatarDefinition } from './types/AvatarDefinition';
6
- export type { AvatarPalette, AvatarProps, AvatarVisual, AvatarVisualDefinition, AvatarVisualId, AvatarVisualRenderContext, RenderAvatarVisualOptions, } from './types/AvatarVisualDefinition';
7
+ export type { AvatarInteractionState, AvatarPalette, AvatarPointerType, AvatarProps, AvatarVisual, AvatarVisualDefinition, AvatarVisualId, AvatarVisualRenderContext, RenderAvatarVisualOptions, } from './types/AvatarVisualDefinition';
@@ -1,3 +1,4 @@
1
+ import type { CSSProperties } from 'react';
1
2
  import type { string_color, string_css_class } from '../../types/typeAliases';
2
3
  import type { AvatarDefinition } from './AvatarDefinition';
3
4
  /**
@@ -5,7 +6,7 @@ import type { AvatarDefinition } from './AvatarDefinition';
5
6
  *
6
7
  * @private shared contract for the avatar rendering system
7
8
  */
8
- export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'minecraft' | 'fractal';
9
+ export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'ascii-octopus' | 'minecraft' | 'fractal';
9
10
  /**
10
11
  * Derived color palette used by avatar visuals.
11
12
  *
@@ -21,6 +22,32 @@ export type AvatarPalette = {
21
22
  readonly shadow: string_color;
22
23
  readonly ink: string_color;
23
24
  };
25
+ /**
26
+ * Surface style used when placing the avatar into different UI shells.
27
+ *
28
+ * @private shared contract for the avatar rendering system
29
+ */
30
+ export type AvatarSurfaceStyle = 'framed' | 'transparent';
31
+ /**
32
+ * Pointer source currently driving avatar interaction.
33
+ *
34
+ * @private shared contract for the avatar rendering system
35
+ */
36
+ export type AvatarPointerType = 'idle' | 'mouse' | 'touch' | 'pen';
37
+ /**
38
+ * Smoothed interaction state forwarded to animated avatar visuals.
39
+ *
40
+ * @private shared contract for the avatar rendering system
41
+ */
42
+ export type AvatarInteractionState = {
43
+ readonly gazeX: number;
44
+ readonly gazeY: number;
45
+ readonly bodyOffsetX: number;
46
+ readonly bodyOffsetY: number;
47
+ readonly intensity: number;
48
+ readonly isPointerActive: boolean;
49
+ readonly pointerType: AvatarPointerType;
50
+ };
24
51
  /**
25
52
  * Rendering context forwarded to a single avatar visual.
26
53
  *
@@ -35,6 +62,8 @@ export type AvatarVisualRenderContext = {
35
62
  readonly avatarDefinition: AvatarDefinition;
36
63
  readonly palette: AvatarPalette;
37
64
  readonly createRandom: (salt: string) => () => number;
65
+ readonly surface: AvatarSurfaceStyle;
66
+ readonly interaction: AvatarInteractionState;
38
67
  };
39
68
  /**
40
69
  * Signature of one canvas-based avatar visual renderer.
@@ -52,6 +81,7 @@ export type AvatarVisualDefinition = {
52
81
  readonly title: string;
53
82
  readonly description: string;
54
83
  readonly isAnimated: boolean;
84
+ readonly supportsPointerTracking?: boolean;
55
85
  readonly render: AvatarVisual;
56
86
  };
57
87
  /**
@@ -68,6 +98,10 @@ export type AvatarProps = {
68
98
  * Selected visual style.
69
99
  */
70
100
  readonly visualId: AvatarVisualId;
101
+ /**
102
+ * Surface used to composite the avatar in its parent UI.
103
+ */
104
+ readonly surface?: AvatarSurfaceStyle;
71
105
  /**
72
106
  * Output size in CSS pixels.
73
107
  */
@@ -80,6 +114,10 @@ export type AvatarProps = {
80
114
  * Optional CSS class name applied to the canvas.
81
115
  */
82
116
  readonly className?: string_css_class;
117
+ /**
118
+ * Optional inline style applied to the canvas.
119
+ */
120
+ readonly style?: CSSProperties;
83
121
  };
84
122
  /**
85
123
  * Low-level rendering options for a single canvas frame.
@@ -90,7 +128,9 @@ export type RenderAvatarVisualOptions = {
90
128
  readonly canvas: HTMLCanvasElement;
91
129
  readonly avatarDefinition: AvatarDefinition;
92
130
  readonly visualId: AvatarVisualId;
131
+ readonly surface?: AvatarSurfaceStyle;
93
132
  readonly size: number;
94
133
  readonly timeMs: number;
95
134
  readonly devicePixelRatio?: number;
135
+ readonly interaction?: AvatarInteractionState;
96
136
  };
@@ -0,0 +1,7 @@
1
+ import type { AvatarVisualDefinition } from '../types/AvatarVisualDefinition';
2
+ /**
3
+ * AsciiOctopus avatar visual.
4
+ *
5
+ * @private built-in avatar visual
6
+ */
7
+ export declare const asciiOctopusAvatarVisual: AvatarVisualDefinition;
@@ -0,0 +1,7 @@
1
+ import type { AvatarVisualDefinition } from '../types/AvatarVisualDefinition';
2
+ /**
3
+ * Octopus3 avatar visual.
4
+ *
5
+ * @private built-in avatar visual
6
+ */
7
+ export declare const octopus3AvatarVisual: AvatarVisualDefinition;