@promptbook/javascript 0.106.0-0 → 0.107.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.es.js CHANGED
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/promptbook
20
20
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.106.0-0';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.107.0-0';
22
22
  /**
23
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -8,6 +8,8 @@ import { AvatarProfile } from '../book-components/AvatarProfile/AvatarProfile/Av
8
8
  import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
9
9
  import { AvatarProfileFromSource } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
10
10
  import { DEFAULT_BOOK_EDITOR_HEIGHT } from '../book-components/BookEditor/BookEditor';
11
+ import type { BookEditorUploadProgressCallback } from '../book-components/BookEditor/BookEditor';
12
+ import type { BookEditorUploadOptions } from '../book-components/BookEditor/BookEditor';
11
13
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
12
14
  import { BookEditor } from '../book-components/BookEditor/BookEditor';
13
15
  import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
@@ -76,6 +78,8 @@ export { AvatarProfile };
76
78
  export type { AvatarProfileFromSourceProps };
77
79
  export { AvatarProfileFromSource };
78
80
  export { DEFAULT_BOOK_EDITOR_HEIGHT };
81
+ export type { BookEditorUploadProgressCallback };
82
+ export type { BookEditorUploadOptions };
79
83
  export type { BookEditorProps };
80
84
  export { BookEditor };
81
85
  export { AgentChat };
@@ -7,6 +7,8 @@ import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChi
7
7
  import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
8
8
  import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
9
9
  import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
10
+ import type { BookEditorUploadProgressCallback } from '../book-components/BookEditor/BookEditor';
11
+ import type { BookEditorUploadOptions } from '../book-components/BookEditor/BookEditor';
10
12
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
11
13
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
12
14
  import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip';
@@ -30,7 +32,7 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
30
32
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
31
33
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
32
34
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
33
- import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletText';
35
+ import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletInfo';
34
36
  import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
35
37
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
36
38
  import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing';
@@ -228,6 +230,8 @@ import type { SpeechRecognitionState } from '../types/SpeechRecognition';
228
230
  import type { SpeechRecognitionEvent } from '../types/SpeechRecognition';
229
231
  import type { TaskType } from '../types/TaskType';
230
232
  import type { ToolCall } from '../types/ToolCall';
233
+ import type { ASSISTANT_PREPARATION_TOOL_CALL_NAME } from '../types/ToolCall';
234
+ import type { isAssistantPreparationToolCall } from '../types/ToolCall';
231
235
  import type { string_char_emoji } from '../types/typeAliasEmoji';
232
236
  import type { string_business_category_name } from '../types/typeAliases';
233
237
  import type { string_model_name } from '../types/typeAliases';
@@ -402,6 +406,8 @@ export type { AvatarChipProps };
402
406
  export type { AvatarChipFromSourceProps };
403
407
  export type { AvatarProfileProps };
404
408
  export type { AvatarProfileFromSourceProps };
409
+ export type { BookEditorUploadProgressCallback };
410
+ export type { BookEditorUploadOptions };
405
411
  export type { BookEditorProps };
406
412
  export type { AgentChatProps };
407
413
  export type { AgentChipData };
@@ -623,6 +629,8 @@ export type { SpeechRecognitionState };
623
629
  export type { SpeechRecognitionEvent };
624
630
  export type { TaskType };
625
631
  export type { ToolCall };
632
+ export type { ASSISTANT_PREPARATION_TOOL_CALL_NAME };
633
+ export type { isAssistantPreparationToolCall };
626
634
  export type { string_char_emoji };
627
635
  export type { string_business_category_name };
628
636
  export type { string_model_name };
@@ -27,10 +27,10 @@ import { splitIntoSentences } from '../utils/expectation-counters/countSentences
27
27
  import { countSentences } from '../utils/expectation-counters/countSentences';
28
28
  import { countWords } from '../utils/expectation-counters/countWords';
29
29
  import { CountUtils } from '../utils/expectation-counters/index';
30
+ import { linguisticHash } from '../utils/linguistic-hash/linguisticHash';
30
31
  import { $getCurrentDate } from '../utils/misc/$getCurrentDate';
31
32
  import { computeHash } from '../utils/misc/computeHash';
32
33
  import { debounce } from '../utils/misc/debounce';
33
- import { linguisticHash } from '../utils/misc/linguisticHash';
34
34
  import { parseNumber } from '../utils/misc/parseNumber';
35
35
  import { capitalize } from '../utils/normalization/capitalize';
36
36
  import { decapitalize } from '../utils/normalization/decapitalize';
@@ -118,10 +118,10 @@ export { splitIntoSentences };
118
118
  export { countSentences };
119
119
  export { countWords };
120
120
  export { CountUtils };
121
+ export { linguisticHash };
121
122
  export { $getCurrentDate };
122
123
  export { computeHash };
123
124
  export { debounce };
124
- export { linguisticHash };
125
125
  export { parseNumber };
126
126
  export { capitalize };
127
127
  export { decapitalize };
@@ -10,6 +10,30 @@ import type { number_percent, number_positive, string_css_value, string_knowledg
10
10
  * @public exported from `@promptbook/components`
11
11
  */
12
12
  export declare const DEFAULT_BOOK_EDITOR_HEIGHT: number;
13
+ /**
14
+ * Upload progress callback for BookEditor uploads.
15
+ *
16
+ * @public exported from `@promptbook/components`
17
+ */
18
+ export type BookEditorUploadProgressCallback = (progress: number_percent, stats?: {
19
+ loadedBytes: number;
20
+ totalBytes: number;
21
+ }) => void;
22
+ /**
23
+ * Options for BookEditor uploads.
24
+ *
25
+ * @public exported from `@promptbook/components`
26
+ */
27
+ export type BookEditorUploadOptions = {
28
+ /**
29
+ * Progress callback invoked during upload.
30
+ */
31
+ readonly onProgress?: BookEditorUploadProgressCallback;
32
+ /**
33
+ * Optional abort signal for canceling an upload.
34
+ */
35
+ readonly abortSignal?: AbortSignal;
36
+ };
13
37
  /**
14
38
  * Props of `BookEditor`
15
39
  *
@@ -53,9 +77,9 @@ export type BookEditorProps = {
53
77
  */
54
78
  onChange?(value: string_book): void;
55
79
  /**
56
- * returns the URL of the uploaded file on CDN or storage
80
+ * Returns the URL of the uploaded file on CDN or storage.
57
81
  */
58
- onFileUpload?(file: File, onProgress?: (progress: number_percent) => void): Promisable<string_knowledge_source_content>;
82
+ onFileUpload?(file: File, options?: BookEditorUploadOptions | BookEditorUploadProgressCallback): Promisable<string_knowledge_source_content>;
59
83
  /**
60
84
  * If true, logs verbose debug info to the console and shows additional visual cues
61
85
  */
@@ -1,6 +1,6 @@
1
1
  import { Message } from '../../../types/Message';
2
2
  import type { ToolCall } from '../../../types/ToolCall';
3
- import type { id, string_markdown } from '../../../types/typeAliases';
3
+ import type { id, string_date_iso8601, string_markdown } from '../../../types/typeAliases';
4
4
  export type ChatToolCall = ToolCall;
5
5
  /**
6
6
  * Represents a single message within a chat interface.
@@ -10,7 +10,7 @@ export type ChatToolCall = ToolCall;
10
10
  *
11
11
  * @public exported from `@promptbook/components`
12
12
  */
13
- export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'threadId' | 'metadata'> & {
13
+ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'threadId' | 'metadata' | 'createdAt'> & {
14
14
  /**
15
15
  * Force the channel to be 'PROMPTBOOK_CHAT'
16
16
  *
@@ -21,6 +21,14 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
21
21
  * The content of the message with optional markdown formatting
22
22
  */
23
23
  content: string_markdown;
24
+ /**
25
+ * ISO 8601 timestamp for when the message was sent
26
+ */
27
+ createdAt?: string_date_iso8601;
28
+ /**
29
+ * Optional duration of agent message generation in milliseconds
30
+ */
31
+ generationDurationMs?: number;
24
32
  /**
25
33
  * Whether the message is complete (for example, if it's still being generated by an AI)
26
34
  *
@@ -0,0 +1,26 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ /**
3
+ * Display-ready timestamp values for a chat message.
4
+ *
5
+ * @private utility of `<Chat/>` component
6
+ */
7
+ export type ChatMessageTimingDisplay = {
8
+ /**
9
+ * Short, UI-friendly time label (localized).
10
+ */
11
+ readonly timeLabel: string;
12
+ /**
13
+ * Full timestamp label suitable for tooltips or exports.
14
+ */
15
+ readonly fullLabel: string;
16
+ /**
17
+ * Optional duration label for agent message generation.
18
+ */
19
+ readonly durationLabel?: string;
20
+ };
21
+ /**
22
+ * Builds display-ready timestamp and duration labels for a chat message.
23
+ *
24
+ * @private utility of `<Chat/>` component
25
+ */
26
+ export declare function getChatMessageTimingDisplay(message: ChatMessage): ChatMessageTimingDisplay | null;
@@ -1,4 +1,4 @@
1
- import type { ToolCall } from '../../../types/ToolCall';
1
+ import { type ToolCall } from '../../../types/ToolCall';
2
2
  import type { AgentChipData } from '../AgentChip';
3
3
  /**
4
4
  * Utility to format tool call information for user-friendly display.
@@ -25,13 +25,6 @@ export declare const TOOL_TITLES: Record<string, {
25
25
  title: string;
26
26
  emoji: string;
27
27
  }>;
28
- /**
29
- * Gets the user-friendly text for a tool call chiplet.
30
- *
31
- * @deprecated Use getToolCallChipletInfo instead which returns both text and agent data
32
- * @private [🧠] Maybe public?
33
- */
34
- export declare function getToolCallChipletText(toolCall: ToolCall): string;
35
28
  /**
36
29
  * Gets the chiplet information including text and agent data (for team tools).
37
30
  *
@@ -1,5 +1,5 @@
1
- import type { string_date_iso8601 } from './typeAliases';
2
1
  import type { TODO_any } from '../utils/organization/TODO_any';
2
+ import type { string_date_iso8601 } from './typeAliases';
3
3
  /**
4
4
  * Represents a single tool call with its inputs, outputs, and timing.
5
5
  *
@@ -35,3 +35,15 @@ export type ToolCall = {
35
35
  */
36
36
  readonly warnings?: ReadonlyArray<TODO_any>;
37
37
  };
38
+ /**
39
+ * Tool call name emitted while preparing a GPT assistant for an agent.
40
+ *
41
+ * @public exported from `@promptbook/types`
42
+ */
43
+ export declare const ASSISTANT_PREPARATION_TOOL_CALL_NAME = "assistant_preparation";
44
+ /**
45
+ * Checks whether a tool call is the assistant preparation marker.
46
+ *
47
+ * @public exported from `@promptbook/types`
48
+ */
49
+ export declare function isAssistantPreparationToolCall(toolCall: ToolCall): boolean;
@@ -0,0 +1,41 @@
1
+ import type { LinguisticHashWordLists } from './linguisticHashTypes';
2
+ /**
3
+ * Supported language codes for linguistic hash output.
4
+ *
5
+ * @private utility of `linguisticHash`
6
+ */
7
+ export type LinguisticHashLanguage = 'en' | 'cs';
8
+ /**
9
+ * Language-specific configuration for linguistic hash generation.
10
+ *
11
+ * @private utility of `linguisticHash`
12
+ */
13
+ export type LinguisticHashLanguageConfig = {
14
+ language: LinguisticHashLanguage;
15
+ label: string;
16
+ wordLists: LinguisticHashWordLists;
17
+ };
18
+ /**
19
+ * Default language used for linguistic hashes.
20
+ *
21
+ * @private utility of `linguisticHash`
22
+ */
23
+ export declare const DEFAULT_LINGUISTIC_HASH_LANGUAGE: LinguisticHashLanguage;
24
+ /**
25
+ * Ordered list of supported linguistic hash languages.
26
+ *
27
+ * @private utility of `linguisticHash`
28
+ */
29
+ export declare const LINGUISTIC_HASH_LANGUAGES: readonly LinguisticHashLanguageConfig[];
30
+ /**
31
+ * Normalizes a requested language to a supported linguistic hash language.
32
+ *
33
+ * @private utility of `linguisticHash`
34
+ */
35
+ export declare function normalizeLinguisticHashLanguage(language?: string | null): LinguisticHashLanguage;
36
+ /**
37
+ * Returns the language configuration for linguistic hash generation.
38
+ *
39
+ * @private utility of `linguisticHash`
40
+ */
41
+ export declare function getLinguisticHashLanguageConfig(language?: string | null): LinguisticHashLanguageConfig;
@@ -0,0 +1,37 @@
1
+ import type { LinguisticHashLanguage } from './LinguisticHashLanguage';
2
+ export { DEFAULT_LINGUISTIC_HASH_LANGUAGE, LINGUISTIC_HASH_LANGUAGES, normalizeLinguisticHashLanguage, } from './LinguisticHashLanguage';
3
+ export type { LinguisticHashLanguage } from './LinguisticHashLanguage';
4
+ /**
5
+ * Creates a human-readable hash as a short, story-like phrase.
6
+ *
7
+ * @param wordCount how many words to include (defaults to {@link DEFAULT_LINGUISTIC_HASH_WORD_COUNT}, clamped to
8
+ * {@link MIN_LINGUISTIC_HASH_WORD_COUNT}..{@link MAX_LINGUISTIC_HASH_WORD_COUNT})
9
+ * @param language optional language code (defaults to {@link DEFAULT_LINGUISTIC_HASH_LANGUAGE})
10
+ *
11
+ * @public exported from `@promptbook/utils`
12
+ */
13
+ export declare function linguisticHash(input: string, wordCount?: number, language?: LinguisticHashLanguage): Promise<string>;
14
+ /**
15
+ * The minimum number of words for a linguistic hash.
16
+ *
17
+ * @private utility of `linguisticHash`
18
+ */
19
+ export declare const MIN_LINGUISTIC_HASH_WORD_COUNT = 1;
20
+ /**
21
+ * The default number of words for a linguistic hash.
22
+ *
23
+ * @private utility of `linguisticHash`
24
+ */
25
+ export declare const DEFAULT_LINGUISTIC_HASH_WORD_COUNT = 7;
26
+ /**
27
+ * The maximum number of words for a linguistic hash.
28
+ *
29
+ * @private utility of `linguisticHash`
30
+ */
31
+ export declare const MAX_LINGUISTIC_HASH_WORD_COUNT: number;
32
+ /**
33
+ * Normalizes the word count to a supported integer range.
34
+ *
35
+ * @private utility of `linguisticHash`
36
+ */
37
+ export declare function normalizeLinguisticHashWordCount(wordCount?: number | null): number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Types of words used in linguistic hash output.
3
+ *
4
+ * @private utility of `linguisticHash`
5
+ */
6
+ export type LinguisticHashWordKind = 'adjective' | 'noun' | 'verb';
7
+ /**
8
+ * Word lists used to build linguistic hashes.
9
+ *
10
+ * @private utility of `linguisticHash`
11
+ */
12
+ export type LinguisticHashWordLists = {
13
+ adjective: readonly string[];
14
+ noun: readonly string[];
15
+ verb: readonly string[];
16
+ };
17
+ /**
18
+ * Note: [💞] Ignore a discrepancy between file name and entity name
19
+ */
@@ -0,0 +1,10 @@
1
+ import type { LinguisticHashWordLists } from './linguisticHashTypes';
2
+ /**
3
+ * Czech word lists used by the linguistic hash.
4
+ *
5
+ * @private utility of `linguisticHash`
6
+ */
7
+ export declare const LINGUISTIC_HASH_WORD_LISTS_CS: LinguisticHashWordLists;
8
+ /**
9
+ * Note: [💞] Ignore a discrepancy between file name and entity name
10
+ */
@@ -0,0 +1,10 @@
1
+ import type { LinguisticHashWordLists } from './linguisticHashTypes';
2
+ /**
3
+ * English word lists used by the linguistic hash.
4
+ *
5
+ * @private utility of `linguisticHash`
6
+ */
7
+ export declare const LINGUISTIC_HASH_WORD_LISTS_EN: LinguisticHashWordLists;
8
+ /**
9
+ * Note: [💞] Ignore a discrepancy between file name and entity name
10
+ */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.105.0`).
18
+ * It follows semantic versioning (e.g., `0.106.0-0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/javascript",
3
- "version": "0.106.0-0",
3
+ "version": "0.107.0-0",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/javascript.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.106.0-0"
97
+ "@promptbook/core": "0.107.0-0"
98
98
  },
99
99
  "dependencies": {
100
100
  "crypto": "1.0.1",
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.106.0-0';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.107.0-0';
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
@@ -1,9 +0,0 @@
1
- /**
2
- * Creates a human-readable hash as a short story sentence.
3
- *
4
- * @public exported from `@promptbook/utils`
5
- */
6
- export declare function linguisticHash(input: string): Promise<string>;
7
- /**
8
- * TODO: Prompt: Extract number constants and word list to a separate file for reuse.
9
- */