@promptbook/utils 0.100.0-5 → 0.100.0-61

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 (129) hide show
  1. package/README.md +2 -8
  2. package/esm/index.es.js +8 -1
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/color.index.d.ts +50 -0
  5. package/esm/typings/src/_packages/components.index.d.ts +36 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +30 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +38 -0
  8. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  9. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  10. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  11. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  12. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +45 -0
  14. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  15. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  16. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  17. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  18. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  19. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  20. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  21. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  22. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  23. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  24. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  25. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  26. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  27. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  28. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  29. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  30. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +62 -0
  31. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +36 -0
  32. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  33. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  35. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  36. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  37. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +35 -0
  38. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChipFromSource.d.ts +21 -0
  39. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/index.d.ts +2 -0
  40. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
  41. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
  42. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +35 -0
  43. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
  44. package/esm/typings/src/book-components/BookEditor/config.d.ts +10 -0
  45. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +11 -0
  46. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +20 -0
  47. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +110 -0
  48. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +14 -0
  49. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
  50. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +24 -0
  51. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +16 -0
  52. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +32 -0
  53. package/esm/typings/src/book-components/Chat/utils/ChatPersistence.d.ts +25 -0
  54. package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
  55. package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
  56. package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
  57. package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
  58. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +9 -0
  59. package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +8 -0
  60. package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
  61. package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
  62. package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +8 -0
  63. package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
  64. package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +8 -0
  65. package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +8 -0
  66. package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
  67. package/esm/typings/src/book-components/_common/react-utils/collectCssTextsForClass.d.ts +7 -0
  68. package/esm/typings/src/book-components/_common/react-utils/escapeHtml.d.ts +6 -0
  69. package/esm/typings/src/book-components/_common/react-utils/escapeRegex.d.ts +6 -0
  70. package/esm/typings/src/config.d.ts +19 -0
  71. package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
  72. package/esm/typings/src/execution/ExecutionTask.d.ts +27 -1
  73. package/esm/typings/src/execution/LlmExecutionTools.d.ts +8 -0
  74. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
  75. package/esm/typings/src/llm-providers/_common/filterModels.d.ts +0 -3
  76. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +81 -0
  77. package/esm/typings/src/llm-providers/_common/profiles/test/llmProviderProfiles.test.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -0
  79. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
  80. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  81. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  82. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  83. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
  84. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
  85. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
  86. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +5 -0
  87. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  88. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -0
  89. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  90. package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
  91. package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
  92. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  93. package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
  94. package/esm/typings/src/utils/color/Color.d.ts +180 -0
  95. package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
  96. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
  97. package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
  98. package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
  99. package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
  100. package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
  101. package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
  102. package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
  103. package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
  104. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
  105. package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
  106. package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
  107. package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
  108. package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
  109. package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
  110. package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
  111. package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
  112. package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
  113. package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
  114. package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
  115. package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
  116. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
  117. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
  118. package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
  119. package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
  120. package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
  121. package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
  122. package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
  123. package/esm/typings/src/utils/take/take.d.ts +12 -0
  124. package/esm/typings/src/utils/take/take.test.d.ts +1 -0
  125. package/esm/typings/src/version.d.ts +1 -1
  126. package/package.json +1 -1
  127. package/umd/index.umd.js +8 -1
  128. package/umd/index.umd.js.map +1 -1
  129. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
@@ -0,0 +1,22 @@
1
+ import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from './BaseCommitmentDefinition';
3
+ /**
4
+ * Placeholder commitment definition for commitments that are not yet implemented
5
+ *
6
+ * This commitment simply adds its content 1:1 into the system message,
7
+ * preserving the original behavior until proper implementation is added.
8
+ *
9
+ * @public exported from `@promptbook/core`
10
+ */
11
+ export declare class NotYetImplementedCommitmentDefinition<TBookCommitment extends string> extends BaseCommitmentDefinition<TBookCommitment> {
12
+ constructor(type: TBookCommitment);
13
+ /**
14
+ * Short one-line description of a placeholder commitment.
15
+ */
16
+ get description(): string;
17
+ /**
18
+ * Markdown documentation available at runtime.
19
+ */
20
+ get documentation(): string;
21
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
22
+ }
@@ -0,0 +1,19 @@
1
+ import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
2
+ /**
3
+ * Creates an empty/basic agent model requirements object
4
+ * This serves as the starting point for the reduce-like pattern
5
+ * where each commitment applies its changes to build the final requirements
6
+ *
7
+ * @public exported from `@promptbook/core`
8
+ */
9
+ export declare function createEmptyAgentModelRequirements(): AgentModelRequirements;
10
+ /**
11
+ * Creates a basic agent model requirements with just the agent name
12
+ * This is used when we have an agent name but no commitments
13
+ *
14
+ * @public exported from `@promptbook/core`
15
+ */
16
+ export declare function createBasicAgentModelRequirements(agentName: string | null): AgentModelRequirements;
17
+ /**
18
+ * TODO: !!! Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
19
+ */
@@ -0,0 +1,37 @@
1
+ import type { TODO_any } from '../../../utils/organization/TODO_any';
2
+ /**
3
+ * Model requirements for an agent
4
+ *
5
+ * This is like "compiled" version of agent source
6
+ */
7
+ export interface AgentModelRequirements {
8
+ /**
9
+ * The system message that defines the agent's behavior and personality
10
+ */
11
+ readonly systemMessage: string;
12
+ /**
13
+ * The model name to use for this agent
14
+ */
15
+ readonly modelName: string;
16
+ /**
17
+ * Optional list of MCP servers that the agent can connect to
18
+ */
19
+ readonly mcpServers?: string[];
20
+ /**
21
+ * Temperature for the agent's responses, controlling randomness
22
+ */
23
+ readonly temperature?: number;
24
+ /**
25
+ * Top-p sampling value for the agent's responses
26
+ */
27
+ readonly topP?: number;
28
+ /**
29
+ * Top-k sampling value for the agent's responses
30
+ */
31
+ readonly topK?: number;
32
+ /**
33
+ * Arbitrary metadata storage for commitments
34
+ * Each commitment can store its own data here
35
+ */
36
+ readonly metadata?: Record<string, TODO_any>;
37
+ }
@@ -0,0 +1,18 @@
1
+ import type { ParsedCommitment } from './ParsedCommitment';
2
+ /**
3
+ * Result of parsing agent source for commitments
4
+ */
5
+ export interface AgentSourceParseResult {
6
+ /**
7
+ * The agent name (first line)
8
+ */
9
+ agentName: string | null;
10
+ /**
11
+ * All parsed commitments
12
+ */
13
+ commitments: ParsedCommitment[];
14
+ /**
15
+ * Lines that are not commitments (for system message)
16
+ */
17
+ nonCommitmentLines: string[];
18
+ }
@@ -0,0 +1,22 @@
1
+ import type { BookCommitment } from '../_base/BookCommitment';
2
+ /**
3
+ * Parsed commitment line from agent source
4
+ */
5
+ export interface ParsedCommitment {
6
+ /**
7
+ * The commitment type (e.g., 'PERSONA', 'KNOWLEDGE')
8
+ */
9
+ type: BookCommitment;
10
+ /**
11
+ * The content part of the commitment
12
+ */
13
+ content: string;
14
+ /**
15
+ * The original line from the agent source
16
+ */
17
+ originalLine: string;
18
+ /**
19
+ * Line number in the agent source (1-based)
20
+ */
21
+ lineNumber: number;
22
+ }
@@ -0,0 +1,62 @@
1
+ import type { string_model_name } from '../../../types/typeAliases';
2
+ import type { string_book } from '../../agent-source/string_book';
3
+ import type { AgentModelRequirements } from './AgentModelRequirements';
4
+ /**
5
+ * Creates model requirements for an agent based on its source
6
+ * Results are cached to improve performance for repeated calls with the same agentSource and modelName
7
+ *
8
+ * There are 2 similar functions:
9
+ * - `parseAgentSource` which is a lightweight parser for agent source, it parses basic information and its purpose is to be quick and synchronous. The commitments there are hardcoded.
10
+ * - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works asynchronously.
11
+ *
12
+ * @public exported from `@promptbook/core`
13
+ */
14
+ export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
15
+ /**
16
+ * Clears the cache for createAgentModelRequirements
17
+ * Useful when agent sources are updated and cached results should be invalidated
18
+ *
19
+ * @private
20
+ */
21
+ export declare function clearAgentModelRequirementsCache(): void;
22
+ /**
23
+ * Removes cache entries for a specific agent source (all model variants)
24
+ * @param agentSource The agent source to remove from cache
25
+ * @private
26
+ */
27
+ export declare function invalidateAgentModelRequirementsCache(agentSource: string_book): void;
28
+ /**
29
+ * Gets the current cache size (for debugging/monitoring)
30
+ *
31
+ * @private
32
+ */
33
+ export declare function getAgentModelRequirementsCacheSize(): number;
34
+ /**
35
+ * Extracts MCP servers from agent source
36
+ *
37
+ * @param agentSource The agent source string that may contain MCP lines
38
+ * @returns Array of MCP server identifiers
39
+ *
40
+ * @private TODO: [🧠] Maybe should be public
41
+ */
42
+ export declare function extractMcpServers(agentSource: string_book): string[];
43
+ /**
44
+ * Creates a system message for an agent based on its source
45
+ * @deprecated Use createAgentModelRequirements instead
46
+ * @private
47
+ */
48
+ export declare function createAgentSystemMessage(agentSource: string_book): Promise<string>;
49
+ /**
50
+ * Extracts the agent name from the first line of the agent source
51
+ * @deprecated Use parseAgentSource instead
52
+ * @private
53
+ */
54
+ export declare function extractAgentName(agentSource: string_book): string;
55
+ /**
56
+ * Extracts the profile image URL from agent source or returns gravatar fallback
57
+ * @param agentSource The agent source string that may contain META IMAGE line
58
+ * @returns Profile image URL (from source or gravatar fallback)
59
+ * @deprecated Use parseAgentSource instead
60
+ * @private
61
+ */
62
+ export declare function extractAgentProfileImage(agentSource: string_book): string;
@@ -0,0 +1,36 @@
1
+ import type { string_model_name } from '../../../types/typeAliases';
2
+ import type { string_book } from '../../agent-source/string_book';
3
+ import type { AgentModelRequirements } from './AgentModelRequirements';
4
+ /**
5
+ * Creates agent model requirements using the new commitment system
6
+ * This function uses a reduce-like pattern where each commitment applies its changes
7
+ * to build the final requirements starting from a basic empty model
8
+ *
9
+ * @private
10
+ */
11
+ export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
12
+ /**
13
+ * Cached version of createAgentModelRequirementsWithCommitments
14
+ * This maintains the same caching behavior as the original function
15
+ *
16
+ * @private
17
+ */
18
+ export declare function createAgentModelRequirementsWithCommitmentsCached(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
19
+ /**
20
+ * Clears the cache for createAgentModelRequirementsWithCommitments
21
+ *
22
+ * @private
23
+ */
24
+ export declare function clearAgentModelRequirementsWithCommitmentsCache(): void;
25
+ /**
26
+ * Removes cache entries for a specific agent source
27
+ *
28
+ * @private
29
+ */
30
+ export declare function invalidateAgentModelRequirementsWithCommitmentsCache(agentSource: string_book): void;
31
+ /**
32
+ * Gets the current cache size
33
+ *
34
+ * @private
35
+ */
36
+ export declare function getAgentModelRequirementsWithCommitmentsCacheSize(): number;
@@ -0,0 +1,20 @@
1
+ import type { BookCommitment } from '../_base/BookCommitment';
2
+ /**
3
+ * Generates a regex pattern to match a specific commitment
4
+ *
5
+ * Note: It always creates new Regex object
6
+ * Note: Uses word boundaries to ensure only full words are matched (e.g., "PERSONA" matches but "PERSONALITY" does not)
7
+ *
8
+ * @private
9
+ */
10
+ export declare function createCommitmentRegex(commitment: BookCommitment): RegExp;
11
+ /**
12
+ * Generates a regex pattern to match a specific commitment type
13
+ *
14
+ * Note: It just matches the type part of the commitment
15
+ * Note: It always creates new Regex object
16
+ * Note: Uses word boundaries to ensure only full words are matched (e.g., "PERSONA" matches but "PERSONALITY" does not)
17
+ *
18
+ * @private
19
+ */
20
+ export declare function createCommitmentTypeRegex(commitment: BookCommitment): RegExp;
@@ -0,0 +1,24 @@
1
+ import type { AgentBasicInformation } from '../../agent-source/parseAgentSource';
2
+ import type { string_book } from '../../agent-source/string_book';
3
+ import type { AgentSourceParseResult } from './AgentSourceParseResult';
4
+ /**
5
+ * Parses agent source using the new commitment system with multiline support
6
+ * This function replaces the hardcoded commitment parsing in the original parseAgentSource
7
+ *
8
+ * @private
9
+ */
10
+ export declare function parseAgentSourceWithCommitments(agentSource: string_book): AgentSourceParseResult;
11
+ /**
12
+ * Extracts basic information from agent source using the new commitment system
13
+ * This maintains compatibility with the original parseAgentSource interface
14
+ *
15
+ * @private
16
+ */
17
+ export declare function parseAgentSourceBasicInfo(agentSource: string_book): AgentBasicInformation;
18
+ /**
19
+ * Extracts META LINK commitments from agent source
20
+ * Returns an array of all META LINK URLs found in the agent source
21
+ *
22
+ * @private
23
+ */
24
+ export declare function extractMetaLinks(agentSource: string_book): string[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes comment lines (lines starting with #) from a system message
3
+ * This is used to clean up the final system message before sending it to the AI model
4
+ * while preserving the original content with comments in metadata
5
+ *
6
+ * @param systemMessage The system message that may contain comment lines
7
+ * @returns The system message with comment lines removed
8
+ *
9
+ * @private - TODO: [🧠] Maybe should be public?
10
+ */
11
+ export declare function removeCommentsFromSystemMessage(systemMessage: string): string;
@@ -0,0 +1,56 @@
1
+ import type { BookCommitment } from './_base/BookCommitment';
2
+ import type { CommitmentDefinition } from './_base/CommitmentDefinition';
3
+ import { ActionCommitmentDefinition } from './ACTION/ACTION';
4
+ import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
5
+ import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
6
+ import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
7
+ import { MetaLinkCommitmentDefinition } from './META_LINK/META_LINK';
8
+ import { ModelCommitmentDefinition } from './MODEL/MODEL';
9
+ import { NoteCommitmentDefinition } from './NOTE/NOTE';
10
+ import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
11
+ import { RuleCommitmentDefinition } from './RULE/RULE';
12
+ import { SampleCommitmentDefinition } from './SAMPLE/SAMPLE';
13
+ import { StyleCommitmentDefinition } from './STYLE/STYLE';
14
+ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
15
+ /**
16
+ * Registry of all available commitment definitions
17
+ * This array contains instances of all commitment definitions
18
+ * This is the single source of truth for all commitments in the system
19
+ *
20
+ * @private Use functions to access commitments instead of this array directly
21
+ */
22
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaLinkCommitmentDefinition, NoteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"SCENARIO">, NotYetImplementedCommitmentDefinition<"SCENARIOS">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"GOAL">, NotYetImplementedCommitmentDefinition<"GOALS">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
23
+ /**
24
+ * Gets a commitment definition by its type
25
+ * @param type The commitment type to look up
26
+ * @returns The commitment definition or null if not found
27
+ *
28
+ * @public exported from `@promptbook/core`
29
+ */
30
+ export declare function getCommitmentDefinition(type: BookCommitment): CommitmentDefinition | null;
31
+ /**
32
+ * Gets all available commitment definitions
33
+ * @returns Array of all commitment definitions
34
+ *
35
+ * @public exported from `@promptbook/core`
36
+ */
37
+ export declare function getAllCommitmentDefinitions(): ReadonlyArray<CommitmentDefinition>;
38
+ /**
39
+ * Gets all available commitment types
40
+ * @returns Array of all commitment types
41
+ *
42
+ * @public exported from `@promptbook/core`
43
+ */
44
+ export declare function getAllCommitmentTypes(): ReadonlyArray<BookCommitment>;
45
+ /**
46
+ * Checks if a commitment type is supported
47
+ * @param type The commitment type to check
48
+ * @returns True if the commitment type is supported
49
+ *
50
+ * @public exported from `@promptbook/core`
51
+ */
52
+ export declare function isCommitmentSupported(type: BookCommitment): boolean;
53
+ /**
54
+ * TODO: [🧠] Maybe create through standardized $register
55
+ * Note: [💞] Ignore a discrepancy between file name and entity name
56
+ */
@@ -0,0 +1,39 @@
1
+ import type { string_url_image } from '../../types/typeAliases';
2
+ /**
3
+ * Extracts profile image URL from agent definition text and returns cleaned system message
4
+ * @param systemMessage The original system message that may contain META IMAGE line
5
+ * @returns Object with profileImageUrl (if found) and cleanedSystemMessage (without META IMAGE line)
6
+ *
7
+ * @private - TODO: [🧠] Maybe should be public?
8
+ */
9
+ export declare function extractProfileImageFromSystemMessage(systemMessage: string): {
10
+ profileImageUrl?: string_url_image;
11
+ cleanedSystemMessage: string;
12
+ };
13
+ /**
14
+ * Extracts persona, examples, and profile image from agent definition text
15
+ * @param systemMessage The original system message that may contain PERSONA, EXAMPLE, and META IMAGE lines
16
+ * @returns Object with extracted information and cleaned system message
17
+ *
18
+ * @private - TODO: [🧠] Maybe should be public?
19
+ */
20
+ export declare function extractAgentMetadata(systemMessage: string): {
21
+ persona?: {
22
+ name: string;
23
+ description?: string;
24
+ };
25
+ examples: string[];
26
+ profileImageUrl?: string_url_image;
27
+ cleanedSystemMessage: string;
28
+ };
29
+ /**
30
+ * Generates a gravatar URL based on agent name for fallback avatar
31
+ * @param name The agent name to generate avatar for
32
+ * @returns Gravatar URL
33
+ *
34
+ * @private - TODO: [🧠] Maybe should be public?
35
+ */
36
+ export declare function generateGravatarUrl(name?: string | null): string;
37
+ /**
38
+ * Note: [💞] Ignore a discrepancy between file name and entity name
39
+ */
@@ -0,0 +1,35 @@
1
+ import type { AgentBasicInformation } from '../../../book-2.0/agent-source/parseAgentSource';
2
+ import type { string_css_class } from '../../../types/typeAliases';
3
+ /**
4
+ * Props of `AvatarChip`
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type AvatarChipProps = {
9
+ /**
10
+ * Avatar to be shown
11
+ */
12
+ readonly avatarBasicInformation: AgentBasicInformation;
13
+ /**
14
+ * Whether this chip is a template avatar
15
+ */
16
+ readonly isTemplate: boolean;
17
+ /**
18
+ * Optional CSS class name which will be added to root <div> element
19
+ */
20
+ readonly className?: string_css_class;
21
+ /**
22
+ * Called when chip is clicked
23
+ */
24
+ readonly onSelect?: (avatar: AgentBasicInformation) => void;
25
+ /**
26
+ * Whether this chip is selected
27
+ */
28
+ readonly isSelected?: boolean;
29
+ };
30
+ /**
31
+ * Shows a chip with avatar's avatar and name
32
+ *
33
+ * @public exported from `@promptbook/components`
34
+ */
35
+ export declare function AvatarChip(props: AvatarChipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import type { string_book } from '../../../book-2.0/agent-source/string_book';
2
+ import type { AvatarChipProps } from './AvatarChip';
3
+ /**
4
+ * Props of `AvatarChipFromSource`
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type AvatarChipFromSourceProps = Omit<AvatarChipProps, 'avatarBasicInformation'> & {
9
+ /**
10
+ * Avatar to be shown
11
+ */
12
+ readonly source: string_book;
13
+ };
14
+ /**
15
+ * Shows a chip with avatar's avatar and name based on the avatar source string
16
+ *
17
+ * This component is wrapped around the `<AvatarChip/>`, it just parses the avatar source string into `AvatarBasicInformation` and passes it to the `<AvatarChip/>` component.
18
+ *
19
+ * @public exported from `@promptbook/components`
20
+ */
21
+ export declare function AvatarChipFromSource(props: AvatarChipFromSourceProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './AvatarChip';
2
+ export * from './AvatarChipFromSource';
@@ -0,0 +1,26 @@
1
+ import type { AgentBasicInformation } from '../../../book-2.0/agent-source/parseAgentSource';
2
+ import type { string_css_class } from '../../../types/typeAliases';
3
+ /**
4
+ * Props of `AvatarProfile`
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type AvatarProfileProps = {
9
+ /**
10
+ * Agent to be shown
11
+ */
12
+ readonly agent: AgentBasicInformation & {
13
+ agentTitle?: string;
14
+ agentDescription?: string;
15
+ };
16
+ /**
17
+ * Optional CSS class name which will be added to root <div> element
18
+ */
19
+ readonly className?: string_css_class;
20
+ };
21
+ /**
22
+ * Shows a box with user avatar, name and description
23
+ *
24
+ * @public exported from `@promptbook/components`
25
+ */
26
+ export declare function AvatarProfile(props: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { string_book } from '../../../book-2.0/agent-source/string_book';
2
+ import type { AvatarProfileProps } from './AvatarProfile';
3
+ /**
4
+ * Props of `AvatarProfileFromSource`
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type AvatarProfileFromSourceProps = Omit<AvatarProfileProps, 'agent'> & {
9
+ /**
10
+ * Agent source to be shown
11
+ */
12
+ readonly agentSource: string_book;
13
+ };
14
+ /**
15
+ * Shows a box with user avatar, name and description from a string source
16
+ *
17
+ * @public exported from `@promptbook/components`
18
+ */
19
+ export declare function AvatarProfileFromSource(props: AvatarProfileFromSourceProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ /**
3
+ * Props of `BookEditor`
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export type BookEditorProps = {
8
+ /**
9
+ * Additional CSS classes to apply to the editor container.
10
+ */
11
+ readonly className?: string;
12
+ /**
13
+ * CSS className for a font (e.g. from next/font) to style the editor text.
14
+ * If omitted, defaults to system serif fonts.
15
+ */
16
+ readonly fontClassName?: string;
17
+ /**
18
+ * The book which is being edited.
19
+ */
20
+ readonly value?: string_book;
21
+ /**
22
+ * Callback function to handle changes in the book content.
23
+ */
24
+ onChange?(value: string_book): void;
25
+ /**
26
+ * If true, logs verbose debug info to the console and shows additional visual cues
27
+ */
28
+ readonly isVerbose?: boolean;
29
+ };
30
+ /**
31
+ * Renders a book editor
32
+ *
33
+ * @public exported from `@promptbook/components`
34
+ */
35
+ export declare function BookEditor(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ /**
3
+ * @private util of `<BookEditor />`
4
+ */
5
+ export type BookEditorInnerProps = {
6
+ className?: string;
7
+ fontClassName?: string;
8
+ value?: string_book;
9
+ onChange?(value: string_book): void;
10
+ isVerbose?: boolean;
11
+ };
12
+ /**
13
+ * @private util of `<BookEditor />`
14
+ */
15
+ export declare function BookEditorInner(props: BookEditorInnerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Default font class name for the BookEditor component
3
+ * In Next.js environments, you can override this by importing the font directly
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export declare const DEFAULT_BOOK_FONT_CLASS: any;
8
+ /**
9
+ * Note: [💞] Ignore a discrepancy between file name and entity name
10
+ */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Inject the CSS module rules (derived from imported `styles`) into the provided shadow root.
3
+ * This allows CSS modules (which are normally emitted into the document head) to be
4
+ * available inside the component's shadow DOM.
5
+ *
6
+ * @private within the promptbook components <- TODO: Maybe make promptbook util from this
7
+ */
8
+ export declare function injectCssModuleIntoShadowRoot(shadowRoot: ShadowRoot): void;
9
+ /**
10
+ * TODO: Make some utility functions for working with CSS modules in shadow DOM independent of `BookEditor.module.css`
11
+ */
@@ -0,0 +1,20 @@
1
+ import type { ChatProps } from './ChatProps';
2
+ /**
3
+ * @deprecated use `isComplete` instead
4
+ * @private util of `<Chat />`
5
+ */
6
+ export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
7
+ /**
8
+ * Renders a chat with messages and input for new messages
9
+ *
10
+ * Note: 🔇 This component does NOT have speak functionality, it just allows to trigger voice recognition
11
+ *
12
+ * Note: There are multiple chat components:
13
+ * - `<Chat/>` renders chat as it is without any logic
14
+ * - `<LlmChat/>` connected to LLM Execution Tools of Promptbook
15
+ *
16
+ * Use <WorkerChat/> or <SignalChat/> in most cases.
17
+ *
18
+ * @public exported from `@promptbook/components`
19
+ */
20
+ export declare function Chat(props: ChatProps): import("react/jsx-runtime").JSX.Element;