@promptbook/types 0.100.4-0 → 0.101.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +130 -1
  2. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  3. package/esm/typings/src/_packages/core.index.d.ts +4 -2
  4. package/esm/typings/src/_packages/markdown-utils.index.d.ts +14 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +4 -6
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +21 -0
  7. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentModelRequirements.d.ts +1 -1
  8. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentSourceParseResult.d.ts +3 -1
  9. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirements.d.ts +2 -2
  10. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirementsWithCommitments.d.ts +3 -3
  11. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createCommitmentRegex.d.ts +2 -2
  12. package/esm/typings/src/book-2.0/agent-source/extractMetaLinks.d.ts +8 -0
  13. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +4 -19
  14. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +9 -0
  15. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +1 -1
  16. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +1 -1
  17. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  18. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +1 -1
  19. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +1 -1
  20. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +1 -1
  21. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +1 -1
  22. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +1 -1
  23. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +1 -1
  25. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +1 -1
  26. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +1 -1
  27. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +1 -1
  28. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
  29. package/esm/typings/src/book-2.0/commitments/{_misc → _base}/ParsedCommitment.d.ts +1 -1
  30. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  31. package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +17 -0
  32. package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +12 -0
  33. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +10 -0
  34. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +10 -0
  35. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
  36. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +2 -8
  37. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
  38. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  39. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  40. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  41. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  42. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +1 -1
  43. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -1
  44. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -1
  45. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -1
  46. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -1
  47. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -0
  48. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -1
  49. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  50. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +13 -0
  51. package/esm/typings/src/utils/markdown/humanizeAiText.test.d.ts +1 -0
  52. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +13 -0
  53. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +13 -0
  54. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +13 -0
  55. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +13 -0
  56. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  57. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +12 -0
  58. package/esm/typings/src/utils/markdown/promptbookifyAiText.test.d.ts +1 -0
  59. package/esm/typings/src/utils/markdown/removeMarkdownLinks.d.ts +11 -0
  60. package/esm/typings/src/utils/markdown/removeMarkdownLinks.test.d.ts +4 -0
  61. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  62. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  63. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  64. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  65. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  66. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  67. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  68. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  69. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  70. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  71. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  72. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  73. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  74. package/esm/typings/src/version.d.ts +1 -1
  75. package/package.json +2 -2
  76. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +0 -24
  77. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +0 -39
  78. /package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/removeCommentsFromSystemMessage.d.ts +0 -0
package/README.md CHANGED
@@ -47,7 +47,34 @@ npm i ptbk
47
47
  npm i -D @promptbook/types
48
48
  ```
49
49
 
50
- This package is useful when you want to explicitly define types in your code.
50
+ The types package provides comprehensive TypeScript type definitions for all Promptbook entities. It enables type-safe development when working with Promptbook APIs, ensuring compile-time validation and excellent IDE support.
51
+
52
+ ## 🎯 Purpose and Motivation
53
+
54
+ This package centralizes all TypeScript type definitions used throughout the Promptbook ecosystem. It enables developers to write type-safe code when working with promptbooks, pipelines, LLM providers, and other Promptbook components, providing excellent IntelliSense and compile-time error checking.
55
+
56
+ ## 🔧 High-Level Functionality
57
+
58
+ The package provides type definitions for:
59
+ - **Pipeline Structures**: Complete type definitions for promptbook JSON structures
60
+ - **Execution Types**: Types for pipeline execution, results, and error handling
61
+ - **LLM Provider Types**: Configuration and option types for all supported providers
62
+ - **Command Types**: Type definitions for all promptbook commands
63
+ - **Utility Types**: Helper types for common patterns and data structures
64
+ - **Component Types**: React component prop types for UI components
65
+
66
+ ## ✨ Key Features
67
+
68
+ - 📝 **Complete Type Coverage** - Types for all Promptbook entities and APIs
69
+ - 🔒 **Type Safety** - Compile-time validation and error prevention
70
+ - 💡 **Excellent IntelliSense** - Rich IDE support with autocomplete and documentation
71
+ - 🏗️ **Structural Types** - Detailed types for promptbook JSON structures
72
+ - 🔧 **Provider-Agnostic** - Generic types that work across all LLM providers
73
+ - 📊 **Execution Types** - Comprehensive types for pipeline execution and results
74
+ - 🎨 **Component Types** - React component prop types for UI development
75
+ - 🔄 **Version Compatibility** - Types that evolve with the Promptbook ecosystem
76
+
77
+ ## Usage Example
51
78
 
52
79
  ```typescript
53
80
  import type { PipelineJson } from '@promptbook/types';
@@ -73,6 +100,108 @@ const promptbook: PipelineJson = compilePipeline(
73
100
  );
74
101
  ```
75
102
 
103
+ ## 📦 Exported Type Categories
104
+
105
+ ### Agent and Book Types
106
+ - `AgentBasicInformation` - Basic agent information structure
107
+ - `AgentModelRequirements` - Model requirements for agents
108
+ - `string_book` - Book content string type
109
+ - `BookCommitment` - Book commitment structure
110
+ - `CommitmentDefinition` - Commitment definition interface
111
+ - `ParsedCommitment` - Parsed commitment structure
112
+
113
+ ### Component Types
114
+ - `AvatarChipProps` - Avatar chip component props
115
+ - `AvatarChipFromSourceProps` - Avatar chip from source props
116
+ - `AvatarProfileProps` - Avatar profile component props
117
+ - `AvatarProfileFromSourceProps` - Avatar profile from source props
118
+ - `BookEditorProps` - Book editor component props
119
+ - `ChatProps` - Chat component props
120
+ - `LlmChatProps` - LLM chat component props
121
+ - `ChatMessage` - Chat message structure
122
+ - `ChatParticipant` - Chat participant information
123
+
124
+ ### Collection and Pipeline Types
125
+ - `PipelineCollection` - Pipeline collection interface
126
+ - `PipelineJson` - Complete pipeline JSON structure
127
+ - `PipelineString` - Pipeline string format
128
+ - `PipelineInterface` - Pipeline interface definition
129
+ - `TaskJson` - Task JSON structure
130
+ - `PromptTaskJson` - Prompt task structure
131
+ - `ScriptTaskJson` - Script task structure
132
+ - `SimpleTaskJson` - Simple task structure
133
+ - `DialogTaskJson` - Dialog task structure
134
+ - `CommonTaskJson` - Common task properties
135
+
136
+ ### Command Types
137
+ - `Command` - Base command interface
138
+ - `CommandParser` - Command parser interface
139
+ - `CommandType` - Command type enumeration
140
+ - `CommandUsagePlace` - Command usage context
141
+ - `BookVersionCommand` - Book version command
142
+ - `ExpectCommand` - Expect command structure
143
+ - `ForeachCommand` - Foreach command structure
144
+ - `FormatCommand` - Format command structure
145
+ - `FormfactorCommand` - Formfactor command structure
146
+ - `KnowledgeCommand` - Knowledge command structure
147
+ - `ModelCommand` - Model command structure
148
+ - `ParameterCommand` - Parameter command structure
149
+ - `PersonaCommand` - Persona command structure
150
+ - `PostprocessCommand` - Postprocess command structure
151
+
152
+ ### Execution Types
153
+ - `ExecutionTools` - Execution tools interface
154
+ - `LlmExecutionTools` - LLM execution tools interface
155
+ - `PipelineExecutor` - Pipeline executor interface
156
+ - `PipelineExecutorResult` - Execution result structure
157
+ - `ExecutionTask` - Execution task structure
158
+ - `ExecutionReportJson` - Execution report structure
159
+ - `PromptResult` - Prompt execution result
160
+ - `Usage` - Usage tracking structure
161
+ - `AvailableModel` - Available model information
162
+
163
+ ### LLM Provider Configuration Types
164
+ - `AnthropicClaudeExecutionToolsOptions` - Anthropic Claude configuration
165
+ - `OpenAiExecutionToolsOptions` - OpenAI configuration
166
+ - `AzureOpenAiExecutionToolsOptions` - Azure OpenAI configuration
167
+ - `GoogleExecutionToolsOptions` - Google configuration
168
+ - `DeepseekExecutionToolsOptions` - Deepseek configuration
169
+ - `OllamaExecutionToolsOptions` - Ollama configuration
170
+ - `VercelExecutionToolsOptions` - Vercel configuration
171
+
172
+ ### Parameter and Data Types
173
+ - `ParameterJson` - Parameter definition structure
174
+ - `InputParameterJson` - Input parameter structure
175
+ - `OutputParameterJson` - Output parameter structure
176
+ - `Parameters` - Parameter collection type
177
+ - `Expectations` - Expectation validation structure
178
+ - `PersonaJson` - Persona definition structure
179
+ - `KnowledgeSourceJson` - Knowledge source structure
180
+
181
+ ### Utility and Helper Types
182
+ - `string_prompt` - Prompt string type
183
+ - `string_template` - Template string type
184
+ - `string_parameter_name` - Parameter name type
185
+ - `string_model_name` - Model name type
186
+ - `string_url` - URL string type
187
+ - `string_filename` - Filename string type
188
+ - `number_tokens` - Token count type
189
+ - `number_usd` - USD amount type
190
+ - `ModelVariant` - Model variant enumeration
191
+ - `ScriptLanguage` - Script language enumeration
192
+ - `TaskType` - Task type enumeration
193
+
194
+ ### Remote Server Types
195
+ - `RemoteServerOptions` - Remote server configuration
196
+ - `RemoteClientOptions` - Remote client configuration
197
+ - `Identification` - User identification structure
198
+
199
+ ### Storage and Scraper Types
200
+ - `PromptbookStorage` - Storage interface
201
+ - `Scraper` - Scraper interface
202
+ - `ScraperConstructor` - Scraper constructor type
203
+ - `Converter` - Content converter interface
204
+
76
205
  _Note: `@promptbook/types` does not export brand-specific types like `OpenAiExecutionToolsOptions`, `ClaudeExecutionToolsOptions`, `LangchainExecutionToolsOptions`,... etc._
77
206
 
78
207
 
@@ -16,6 +16,8 @@ import { LlmChat } from '../book-components/Chat/LlmChat/LlmChat';
16
16
  import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
17
17
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
18
18
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
19
+ import { renderMarkdown } from '../book-components/Chat/utils/renderMarkdown';
20
+ import { isMarkdownContent } from '../book-components/Chat/utils/renderMarkdown';
19
21
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
20
22
  export type { AvatarChipProps };
21
23
  export { AvatarChip };
@@ -34,3 +36,5 @@ export { LlmChat };
34
36
  export type { LlmChatProps };
35
37
  export type { ChatMessage };
36
38
  export type { ChatParticipant };
39
+ export { renderMarkdown };
40
+ export { isMarkdownContent };
@@ -1,4 +1,5 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
+ import { createAgentModelRequirements } from '../book-2.0/agent-source/createAgentModelRequirements';
2
3
  import { parseAgentSource } from '../book-2.0/agent-source/parseAgentSource';
3
4
  import { isValidBook } from '../book-2.0/agent-source/string_book';
4
5
  import { validateBook } from '../book-2.0/agent-source/string_book';
@@ -6,11 +7,11 @@ import { DEFAULT_BOOK } from '../book-2.0/agent-source/string_book';
6
7
  import { createEmptyAgentModelRequirements } from '../book-2.0/commitments/_base/createEmptyAgentModelRequirements';
7
8
  import { createBasicAgentModelRequirements } from '../book-2.0/commitments/_base/createEmptyAgentModelRequirements';
8
9
  import { NotYetImplementedCommitmentDefinition } from '../book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition';
9
- import { createAgentModelRequirements } from '../book-2.0/commitments/_misc/createAgentModelRequirements';
10
10
  import { getCommitmentDefinition } from '../book-2.0/commitments/index';
11
11
  import { getAllCommitmentDefinitions } from '../book-2.0/commitments/index';
12
12
  import { getAllCommitmentTypes } from '../book-2.0/commitments/index';
13
13
  import { isCommitmentSupported } from '../book-2.0/commitments/index';
14
+ import { generatePlaceholderAgentProfileImageUrl } from '../book-2.0/utils/generatePlaceholderAgentProfileImageUrl';
14
15
  import { collectionToJson } from '../collection/collectionToJson';
15
16
  import { createCollectionFromJson } from '../collection/constructors/createCollectionFromJson';
16
17
  import { createCollectionFromPromise } from '../collection/constructors/createCollectionFromPromise';
@@ -163,6 +164,7 @@ import { SectionTypes } from '../types/SectionType';
163
164
  import { TaskTypes } from '../types/TaskType';
164
165
  import { REMOTE_SERVER_URLS } from '../../servers';
165
166
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
167
+ export { createAgentModelRequirements };
166
168
  export { parseAgentSource };
167
169
  export { isValidBook };
168
170
  export { validateBook };
@@ -170,11 +172,11 @@ export { DEFAULT_BOOK };
170
172
  export { createEmptyAgentModelRequirements };
171
173
  export { createBasicAgentModelRequirements };
172
174
  export { NotYetImplementedCommitmentDefinition };
173
- export { createAgentModelRequirements };
174
175
  export { getCommitmentDefinition };
175
176
  export { getAllCommitmentDefinitions };
176
177
  export { getAllCommitmentTypes };
177
178
  export { isCommitmentSupported };
179
+ export { generatePlaceholderAgentProfileImageUrl };
178
180
  export { collectionToJson };
179
181
  export { createCollectionFromJson };
180
182
  export { createCollectionFromPromise };
@@ -17,10 +17,17 @@ import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocks
17
17
  import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllListItemsFromMarkdown';
18
18
  import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
19
19
  import { flattenMarkdown } from '../utils/markdown/flattenMarkdown';
20
+ import { humanizeAiText } from '../utils/markdown/humanizeAiText';
21
+ import { humanizeAiTextEllipsis } from '../utils/markdown/humanizeAiTextEllipsis';
22
+ import { humanizeAiTextEmdashed } from '../utils/markdown/humanizeAiTextEmdashed';
23
+ import { humanizeAiTextQuotes } from '../utils/markdown/humanizeAiTextQuotes';
24
+ import { humanizeAiTextWhitespace } from '../utils/markdown/humanizeAiTextWhitespace';
20
25
  import type { MarkdownSection } from '../utils/markdown/parseMarkdownSection';
21
26
  import { parseMarkdownSection } from '../utils/markdown/parseMarkdownSection';
27
+ import { promptbookifyAiText } from '../utils/markdown/promptbookifyAiText';
22
28
  import { removeMarkdownComments } from '../utils/markdown/removeMarkdownComments';
23
29
  import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
30
+ import { removeMarkdownLinks } from '../utils/markdown/removeMarkdownLinks';
24
31
  import { splitMarkdownIntoSections } from '../utils/markdown/splitMarkdownIntoSections';
25
32
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
26
33
  export { extractBlock };
@@ -41,8 +48,15 @@ export { extractAllBlocksFromMarkdown };
41
48
  export { extractAllListItemsFromMarkdown };
42
49
  export { extractOneBlockFromMarkdown };
43
50
  export { flattenMarkdown };
51
+ export { humanizeAiText };
52
+ export { humanizeAiTextEllipsis };
53
+ export { humanizeAiTextEmdashed };
54
+ export { humanizeAiTextQuotes };
55
+ export { humanizeAiTextWhitespace };
44
56
  export type { MarkdownSection };
45
57
  export { parseMarkdownSection };
58
+ export { promptbookifyAiText };
46
59
  export { removeMarkdownComments };
47
60
  export { removeMarkdownFormatting };
61
+ export { removeMarkdownLinks };
48
62
  export { splitMarkdownIntoSections };
@@ -1,10 +1,9 @@
1
- import type { AgentBasicInformation } from '../book-2.0/agent-source/parseAgentSource';
1
+ import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
2
+ import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
2
3
  import type { string_book } from '../book-2.0/agent-source/string_book';
3
4
  import type { BookCommitment } from '../book-2.0/commitments/_base/BookCommitment';
4
5
  import type { CommitmentDefinition } from '../book-2.0/commitments/_base/CommitmentDefinition';
5
- import type { AgentModelRequirements } from '../book-2.0/commitments/_misc/AgentModelRequirements';
6
- import type { AgentSourceParseResult } from '../book-2.0/commitments/_misc/AgentSourceParseResult';
7
- import type { ParsedCommitment } from '../book-2.0/commitments/_misc/ParsedCommitment';
6
+ import type { ParsedCommitment } from '../book-2.0/commitments/_base/ParsedCommitment';
8
7
  import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChip';
9
8
  import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
10
9
  import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
@@ -322,11 +321,10 @@ import type { ExportJsonOptions } from '../utils/serialization/exportJson';
322
321
  import type { ITakeChain } from '../utils/take/interfaces/ITakeChain';
323
322
  import type { string_promptbook_version } from '../version';
324
323
  export type { AgentBasicInformation };
324
+ export type { AgentModelRequirements };
325
325
  export type { string_book };
326
326
  export type { BookCommitment };
327
327
  export type { CommitmentDefinition };
328
- export type { AgentModelRequirements };
329
- export type { AgentSourceParseResult };
330
328
  export type { ParsedCommitment };
331
329
  export type { AvatarChipProps };
332
330
  export type { AvatarChipFromSourceProps };
@@ -0,0 +1,21 @@
1
+ import type { string_agent_name, string_url_image } from '../../types/typeAliases';
2
+ export type AgentBasicInformation = {
3
+ /**
4
+ * Name of the agent
5
+ * This is the first line of the agent source
6
+ */
7
+ agentName: string_agent_name | null;
8
+ /**
9
+ * Optional description of the agent
10
+ * This is the line starting with "PERSONA"
11
+ */
12
+ personaDescription: string | null;
13
+ /**
14
+ * Optional profile image URL
15
+ * This is the line starting with "META IMAGE"
16
+ */
17
+ profileImageUrl: string_url_image;
18
+ };
19
+ /**
20
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
21
+ */
@@ -1,4 +1,4 @@
1
- import type { TODO_any } from '../../../utils/organization/TODO_any';
1
+ import type { TODO_any } from '../../utils/organization/TODO_any';
2
2
  /**
3
3
  * Model requirements for an agent
4
4
  *
@@ -1,6 +1,8 @@
1
- import type { ParsedCommitment } from './ParsedCommitment';
1
+ import type { ParsedCommitment } from '../commitments/_base/ParsedCommitment';
2
2
  /**
3
3
  * Result of parsing agent source for commitments
4
+ *
5
+ * @private internal utility of `parseAgentSource` and `parseAgentSourceWithCommitments`
4
6
  */
5
7
  export type AgentSourceParseResult = {
6
8
  /**
@@ -1,6 +1,6 @@
1
- import type { string_model_name } from '../../../types/typeAliases';
2
- import type { string_book } from '../../agent-source/string_book';
1
+ import type { string_model_name } from '../../types/typeAliases';
3
2
  import type { AgentModelRequirements } from './AgentModelRequirements';
3
+ import type { string_book } from './string_book';
4
4
  /**
5
5
  * Creates model requirements for an agent based on its source
6
6
  * Results are cached to improve performance for repeated calls with the same agentSource and modelName
@@ -1,12 +1,12 @@
1
- import type { string_model_name } from '../../../types/typeAliases';
2
- import type { string_book } from '../../agent-source/string_book';
1
+ import type { string_model_name } from '../../types/typeAliases';
3
2
  import type { AgentModelRequirements } from './AgentModelRequirements';
3
+ import type { string_book } from './string_book';
4
4
  /**
5
5
  * Creates agent model requirements using the new commitment system
6
6
  * This function uses a reduce-like pattern where each commitment applies its changes
7
7
  * to build the final requirements starting from a basic empty model
8
8
  *
9
- * @private
9
+ * @private - TODO: [🧠] Maybe should be public?
10
10
  */
11
11
  export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
12
12
  /**
@@ -1,11 +1,11 @@
1
- import type { BookCommitment } from '../_base/BookCommitment';
1
+ import type { BookCommitment } from '../commitments/_base/BookCommitment';
2
2
  /**
3
3
  * Generates a regex pattern to match a specific commitment
4
4
  *
5
5
  * Note: It always creates new Regex object
6
6
  * Note: Uses word boundaries to ensure only full words are matched (e.g., "PERSONA" matches but "PERSONALITY" does not)
7
7
  *
8
- * @private
8
+ * @private - TODO: [🧠] Maybe should be public?
9
9
  */
10
10
  export declare function createCommitmentRegex(commitment: BookCommitment): RegExp;
11
11
  /**
@@ -0,0 +1,8 @@
1
+ import type { string_book } from './string_book';
2
+ /**
3
+ * Extracts META LINK commitments from agent source
4
+ * Returns an array of all META LINK URLs found in the agent source
5
+ *
6
+ * @private - TODO: [🧠] Maybe should be public?
7
+ */
8
+ export declare function extractMetaLinks(agentSource: string_book): string[];
@@ -1,23 +1,5 @@
1
- import type { string_agent_name } from '../../types/typeAliases';
2
- import type { string_url_image } from '../../types/typeAliases';
1
+ import type { AgentBasicInformation } from './AgentBasicInformation';
3
2
  import type { string_book } from './string_book';
4
- export type AgentBasicInformation = {
5
- /**
6
- * Name of the agent
7
- * This is the first line of the agent source
8
- */
9
- agentName: string_agent_name | null;
10
- /**
11
- * Optional description of the agent
12
- * This is the line starting with "PERSONA"
13
- */
14
- personaDescription: string | null;
15
- /**
16
- * Optional profile image URL
17
- * This is the line starting with "META IMAGE"
18
- */
19
- profileImageUrl: string_url_image;
20
- };
21
3
  /**
22
4
  * Parses basic information from agent source
23
5
  *
@@ -28,3 +10,6 @@ export type AgentBasicInformation = {
28
10
  * @public exported from `@promptbook/core`
29
11
  */
30
12
  export declare function parseAgentSource(agentSource: string_book): AgentBasicInformation;
13
+ /**
14
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
15
+ */
@@ -0,0 +1,9 @@
1
+ import type { AgentSourceParseResult } from './AgentSourceParseResult';
2
+ import type { string_book } from './string_book';
3
+ /**
4
+ * Parses agent source using the new commitment system with multiline support
5
+ * This function replaces the hardcoded commitment parsing in the original parseAgentSource
6
+ *
7
+ * @private internal utility of `parseAgentSource`
8
+ */
9
+ export declare function parseAgentSourceWithCommitments(agentSource: string_book): AgentSourceParseResult;
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * ACTION commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * FORMAT commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * KNOWLEDGE commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * META IMAGE commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * META LINK commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * MODEL commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * NOTE commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * PERSONA commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * RULE commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * SAMPLE commitment definition
5
5
  *
@@ -1,5 +1,5 @@
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
1
2
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
2
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
3
3
  /**
4
4
  * STYLE commitment definition
5
5
  *
@@ -1,4 +1,4 @@
1
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
2
2
  import type { CommitmentDefinition } from './CommitmentDefinition';
3
3
  /**
4
4
  * Base implementation of CommitmentDefinition that provides common functionality
@@ -1,4 +1,4 @@
1
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
2
2
  /**
3
3
  * Definition of a commitment that can be applied to agent model requirements
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
2
2
  import { BaseCommitmentDefinition } from './BaseCommitmentDefinition';
3
3
  /**
4
4
  * Placeholder commitment definition for commitments that are not yet implemented
@@ -1,4 +1,4 @@
1
- import type { BookCommitment } from '../_base/BookCommitment';
1
+ import type { BookCommitment } from './BookCommitment';
2
2
  /**
3
3
  * Parsed commitment line from agent source
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
1
+ import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
2
2
  /**
3
3
  * Creates an empty/basic agent model requirements object
4
4
  * This serves as the starting point for the reduce-like pattern
@@ -0,0 +1,17 @@
1
+ import type { string_url_image } from '../../types/typeAliases';
2
+ /**
3
+ * Extracts persona, examples, and profile image from agent definition text
4
+ * @param systemMessage The original system message that may contain PERSONA, EXAMPLE, and META IMAGE lines
5
+ * @returns Object with extracted information and cleaned system message
6
+ *
7
+ * @private - TODO: [🧠] Maybe should be public?
8
+ */
9
+ export declare function extractAgentMetadata(systemMessage: string): {
10
+ persona?: {
11
+ name: string;
12
+ description?: string;
13
+ };
14
+ examples: string[];
15
+ profileImageUrl?: string_url_image;
16
+ cleanedSystemMessage: string;
17
+ };
@@ -0,0 +1,12 @@
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
+ };
@@ -0,0 +1,10 @@
1
+ import { string_agent_name } from '../../types/typeAliases';
2
+ /**
3
+ * Generates a gravatar URL based on agent name for fallback avatar
4
+ *
5
+ * @param agentName The agent name to generate avatar for
6
+ * @returns Gravatar URL
7
+ *
8
+ * @private - [🤹] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
9
+ */
10
+ export declare function generateGravatarUrl(agentName?: string_agent_name): string;
@@ -0,0 +1,10 @@
1
+ import { string_agent_name, string_url_image } from '../../types/typeAliases';
2
+ /**
3
+ * Generates an image for the agent to use as profile image
4
+ *
5
+ * @param agentName The agent name to generate avatar for
6
+ * @returns The placeholder profile image URL for the agent
7
+ *
8
+ * @public exported from `@promptbook/core`
9
+ */
10
+ export declare function generatePlaceholderAgentProfileImageUrl(agentName?: string_agent_name): string_url_image;
@@ -1,4 +1,4 @@
1
- import type { AgentBasicInformation } from '../../../book-2.0/agent-source/parseAgentSource';
1
+ import type { AgentBasicInformation } from '../../../book-2.0/agent-source/AgentBasicInformation';
2
2
  import type { string_css_class } from '../../../types/typeAliases';
3
3
  /**
4
4
  * Props of `AvatarChip`
@@ -1,4 +1,4 @@
1
- import type { AgentBasicInformation } from '../../../book-2.0/agent-source/parseAgentSource';
1
+ import type { AgentBasicInformation } from '../../../book-2.0/agent-source/AgentBasicInformation';
2
2
  import type { string_css_class } from '../../../types/typeAliases';
3
3
  /**
4
4
  * Props of `AvatarProfile`
@@ -9,10 +9,7 @@ export type AvatarProfileProps = {
9
9
  /**
10
10
  * Agent to be shown
11
11
  */
12
- readonly agent: AgentBasicInformation & {
13
- agentTitle?: string;
14
- agentDescription?: string;
15
- };
12
+ readonly agent: AgentBasicInformation;
16
13
  /**
17
14
  * Optional CSS class name which will be added to root <div> element
18
15
  */
@@ -24,6 +21,3 @@ export type AvatarProfileProps = {
24
21
  * @public exported from `@promptbook/components`
25
22
  */
26
23
  export declare function AvatarProfile(props: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
27
- /**
28
- * TODO: [🕛] Unite `AvatarProfileProps`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
29
- */
@@ -79,6 +79,12 @@ export type ChatProps = {
79
79
  onAssistantVoiceResponse?: (content: string, isVoiceCall: boolean) => void;
80
80
  onVoiceCallStateChange?: (isVoiceCalling: boolean) => void;
81
81
  };
82
+ /**
83
+ * Indicates whether a the text is AI-generated and should be humanized
84
+ *
85
+ * @default true
86
+ */
87
+ readonly isAiTextHumanized?: boolean;
82
88
  /**
83
89
  * Indicates whether a voice call is currently active
84
90
  */
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Demo component showing Chat with markdown rendering capabilities
3
+ *
4
+ * This example demonstrates various markdown features supported by the Chat component:
5
+ * - Headers
6
+ * - Bold and italic text
7
+ * - Code blocks and inline code
8
+ * - Lists (ordered and unordered)
9
+ * - Links
10
+ * - Blockquotes
11
+ * - Tables
12
+ * - Strikethrough text
13
+ *
14
+ * @private temporary for testing purposes
15
+ */
16
+ export declare function ChatMarkdownDemo(): import("react/jsx-runtime").JSX.Element;
@@ -28,5 +28,5 @@ export type ChatParticipant = {
28
28
  color: string_color | Color;
29
29
  };
30
30
  /**
31
- * TODO: [🕛] Unite `AvatarProfileProps`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
31
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
32
32
  */
@@ -0,0 +1,21 @@
1
+ import type { string_html, string_markdown } from '../../../types/typeAliases';
2
+ /**
3
+ * Convert markdown content to HTML for display in chat messages
4
+ *
5
+ * @param markdown - The markdown content to convert
6
+ * @returns HTML string ready for rendering
7
+ *
8
+ * @public exported from `@promptbook/components`
9
+ * <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
10
+ */
11
+ export declare function renderMarkdown(markdown: string_markdown): string_html;
12
+ /**
13
+ * Check if content appears to be markdown (contains markdown syntax)
14
+ *
15
+ * @param content - Content to check
16
+ * @returns true if content appears to contain markdown syntax
17
+ *
18
+ * @public exported from `@promptbook/components`
19
+ * <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
20
+ */
21
+ export declare function isMarkdownContent(content: string): boolean;
@@ -76,6 +76,6 @@ export declare function getLlmProviderProfile(providerKey: keyof typeof LLM_PROV
76
76
  export declare function createCustomLlmProfile(baseProfile: ChatParticipant, overrides: Partial<ChatParticipant>): ChatParticipant;
77
77
  /**
78
78
  * TODO: Refactor this - each profile must be alongside the provider definition
79
- * TODO: [🕛] Unite `AvatarProfileProps`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
79
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
80
80
  * Note: [💞] Ignore a discrepancy between file name and entity name
81
81
  */
@@ -7,4 +7,5 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
7
7
  export declare function countCharacters(text: string): ExpectationAmount;
8
8
  /**
9
9
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
10
- */
10
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
11
+ */
@@ -9,4 +9,5 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
9
9
  export declare function countLines(text: string): ExpectationAmount;
10
10
  /**
11
11
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
12
- */
12
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
13
+ */
@@ -9,4 +9,5 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
9
9
  export declare function countPages(text: string): ExpectationAmount;
10
10
  /**
11
11
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
12
- */
12
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
13
+ */
@@ -7,4 +7,5 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
7
7
  export declare function countParagraphs(text: string): ExpectationAmount;
8
8
  /**
9
9
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
10
- */
10
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
11
+ */
@@ -13,4 +13,5 @@ export declare function splitIntoSentences(text: string): ReadonlyArray<string>;
13
13
  export declare function countSentences(text: string): ExpectationAmount;
14
14
  /**
15
15
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
16
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
16
17
  */
@@ -7,4 +7,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
7
7
  export declare function countWords(text: string): ExpectationAmount;
8
8
  /**
9
9
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
10
- */
10
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
11
+ * TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
12
+ */
@@ -3,6 +3,8 @@ import type { string_markdown_text } from '../../types/typeAliases';
3
3
  * Function escapeMarkdownBlock will escape markdown block if needed
4
4
  * It is useful when you want have block in block
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @public exported from `@promptbook/markdown-utils`
7
9
  */
8
10
  export declare function escapeMarkdownBlock(value: string_markdown_text): string_markdown_text;
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Function `humanizeAiText` will remove traces of AI text generation artifacts
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want more control, look for other functions for example `humanizeAiTextEmdashed` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiText(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * TODO: [🅾️] !!! Use this across the project where AI text is involved
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change ellipsis character to three dots `…` -> `...`
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextEllipsis(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change em-dashes to regular dashes `—` -> `-`
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextEmdashed(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change smart quotes to regular quotes
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextQuotes(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change unprintable hard spaces to regular spaces
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextWhitespace(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -7,3 +7,11 @@ import type { string_html } from '../../types/typeAliases';
7
7
  * @private withing the package because of HUGE size of prettier dependency
8
8
  */
9
9
  export declare function prettifyMarkdown<TContent extends string_html>(content: TContent): TContent;
10
+ /**
11
+ * Async version of prettifyMarkdown using dynamic imports
12
+ *
13
+ * @param content raw html code
14
+ * @returns formatted html code
15
+ * @private withing the package because of HUGE size of prettier dependency
16
+ */
17
+ export declare function prettifyMarkdownAsync<TContent extends string_html>(content: TContent): Promise<TContent>;
@@ -0,0 +1,12 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
4
+ *
5
+ * @public exported from `@promptbook/markdown-utils`
6
+ */
7
+ export declare function promptbookifyAiText(text: string_markdown): string_markdown;
8
+ /**
9
+ * TODO: !!!!! Make the function idempotent and add "Note: [🔂] This function is idempotent."
10
+ * TODO: [🅾️]!!! Use this across the project where AI text is involved
11
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
12
+ */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes Markdown link tags from a string.
3
+ *
4
+ * @param {string} str - The string to remove Markdown tags from.
5
+ * @returns {string} The input string with all Markdown tags removed.
6
+ * @public exported from `@promptbook/markdown-utils`
7
+ */
8
+ export declare function removeMarkdownLinks(str: string): string;
9
+ /**
10
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
11
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
4
+ */
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Makes first letter of a string uppercase
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function capitalize(word: string): string;
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Makes first letter of a string uppercase
2
+ * Makes first letter of a string lowercase
3
+ *
4
+ * Note: [🔂] This function is idempotent.
3
5
  *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
@@ -9,6 +9,8 @@ export type string_SCREAMING_CASE = string;
9
9
  /**
10
10
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
11
11
  *
12
+ * Note: [🔂] This function is idempotent.
13
+ *
12
14
  * @param text The text string to be converted to SCREAMING_CASE format.
13
15
  * @returns The normalized text in SCREAMING_CASE format.
14
16
  * @example 'HELLO_WORLD'
@@ -8,6 +8,8 @@ export type string_snake_case = string;
8
8
  /**
9
9
  * Normalizes a text string to snake_case format.
10
10
  *
11
+ * Note: [🔂] This function is idempotent.
12
+ *
11
13
  * @param text The text string to be converted to snake_case format.
12
14
  * @returns The normalized text in snake_case format.
13
15
  * @example 'hello_world'
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Take every whitespace (space, new line, tab) and replace it with a single space
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function normalizeWhitespaces(sentence: string): string;
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes diacritic marks (accents) from characters in a string.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param input The string containing diacritics to be normalized.
5
7
  * @returns The string with diacritics removed or normalized.
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function parseNumber will parse number from string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
5
6
  * Note: it also works only with decimal numbers
6
7
  *
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes emojis from a string and fix whitespaces
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param text with emojis
5
7
  * @returns text without emojis
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Removes quotes from a string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Tip: This is very useful for post-processing of the result of the LLM model
5
6
  * Note: This function removes only the same quotes from the beginning and the end of the string
6
7
  * Note: There are two similar functions:
@@ -2,6 +2,7 @@ import type { WritableDeep } from 'type-fest';
2
2
  /**
3
3
  * Creates a deep clone of the given object
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
6
7
  *
7
8
  * @param objectValue The object to clone.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Note: This is useful for post-processing of the result of the chat LLM model
5
6
  * when the model wraps the result in the (markdown) code block.
6
7
  *
@@ -3,6 +3,7 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid URL.
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
6
7
  * Note: Dataurl are considered perfectly valid.
7
8
  * Note: There are two similar functions:
8
9
  * - `isValidUrl` which tests any URL
@@ -3,6 +3,8 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Checks if value is valid uuid
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @public exported from `@promptbook/utils`
7
9
  */
8
10
  export declare function isValidUuid(value: really_unknown): value is string_uuid;
@@ -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.100.3-0`).
18
+ * It follows semantic versioning (e.g., `0.101.0-0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.100.4-0",
3
+ "version": "0.101.0-1",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -92,6 +92,6 @@
92
92
  },
93
93
  "typings": "./esm/typings/src/_packages/types.index.d.ts",
94
94
  "peerDependencies": {
95
- "@promptbook/core": "0.100.4-0"
95
+ "@promptbook/core": "0.101.0-1"
96
96
  }
97
97
  }
@@ -1,24 +0,0 @@
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[];
@@ -1,39 +0,0 @@
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
- */