@promptbook/javascript 0.106.0-0 → 0.108.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 +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +15 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +26 -2
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +10 -2
- package/esm/typings/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +26 -0
- package/esm/typings/src/book-components/Chat/utils/{getToolCallChipletText.d.ts → getToolCallChipletInfo.d.ts} +8 -8
- package/esm/typings/src/types/ToolCall.d.ts +76 -1
- package/esm/typings/src/utils/linguistic-hash/LinguisticHashLanguage.d.ts +41 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHash.d.ts +37 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHashTypes.d.ts +19 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHashWords.cs.d.ts +10 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHashWords.en.d.ts +10 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextSources.d.ts +13 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/esm/typings/src/utils/misc/linguisticHash.d.ts +0 -9
- /package/esm/typings/src/utils/{misc → linguistic-hash}/linguisticHash.test.d.ts +0 -0
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.
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.108.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 };
|
|
@@ -21,6 +21,7 @@ import { humanizeAiText } from '../utils/markdown/humanizeAiText';
|
|
|
21
21
|
import { humanizeAiTextEllipsis } from '../utils/markdown/humanizeAiTextEllipsis';
|
|
22
22
|
import { humanizeAiTextEmdashed } from '../utils/markdown/humanizeAiTextEmdashed';
|
|
23
23
|
import { humanizeAiTextQuotes } from '../utils/markdown/humanizeAiTextQuotes';
|
|
24
|
+
import { humanizeAiTextSources } from '../utils/markdown/humanizeAiTextSources';
|
|
24
25
|
import { humanizeAiTextWhitespace } from '../utils/markdown/humanizeAiTextWhitespace';
|
|
25
26
|
import type { MarkdownSection } from '../utils/markdown/parseMarkdownSection';
|
|
26
27
|
import { parseMarkdownSection } from '../utils/markdown/parseMarkdownSection';
|
|
@@ -54,6 +55,7 @@ export { humanizeAiText };
|
|
|
54
55
|
export { humanizeAiTextEllipsis };
|
|
55
56
|
export { humanizeAiTextEmdashed };
|
|
56
57
|
export { humanizeAiTextQuotes };
|
|
58
|
+
export { humanizeAiTextSources };
|
|
57
59
|
export { humanizeAiTextWhitespace };
|
|
58
60
|
export type { MarkdownSection };
|
|
59
61
|
export { parseMarkdownSection };
|
|
@@ -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/
|
|
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,11 @@ 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 { SelfLearningCommitmentTypeCounts } from '../types/ToolCall';
|
|
234
|
+
import type { SelfLearningTeacherSummary } from '../types/ToolCall';
|
|
235
|
+
import type { SelfLearningToolCallResult } from '../types/ToolCall';
|
|
236
|
+
import type { ASSISTANT_PREPARATION_TOOL_CALL_NAME } from '../types/ToolCall';
|
|
237
|
+
import type { isAssistantPreparationToolCall } from '../types/ToolCall';
|
|
231
238
|
import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
232
239
|
import type { string_business_category_name } from '../types/typeAliases';
|
|
233
240
|
import type { string_model_name } from '../types/typeAliases';
|
|
@@ -402,6 +409,8 @@ export type { AvatarChipProps };
|
|
|
402
409
|
export type { AvatarChipFromSourceProps };
|
|
403
410
|
export type { AvatarProfileProps };
|
|
404
411
|
export type { AvatarProfileFromSourceProps };
|
|
412
|
+
export type { BookEditorUploadProgressCallback };
|
|
413
|
+
export type { BookEditorUploadOptions };
|
|
405
414
|
export type { BookEditorProps };
|
|
406
415
|
export type { AgentChatProps };
|
|
407
416
|
export type { AgentChipData };
|
|
@@ -623,6 +632,11 @@ export type { SpeechRecognitionState };
|
|
|
623
632
|
export type { SpeechRecognitionEvent };
|
|
624
633
|
export type { TaskType };
|
|
625
634
|
export type { ToolCall };
|
|
635
|
+
export type { SelfLearningCommitmentTypeCounts };
|
|
636
|
+
export type { SelfLearningTeacherSummary };
|
|
637
|
+
export type { SelfLearningToolCallResult };
|
|
638
|
+
export type { ASSISTANT_PREPARATION_TOOL_CALL_NAME };
|
|
639
|
+
export type { isAssistantPreparationToolCall };
|
|
626
640
|
export type { string_char_emoji };
|
|
627
641
|
export type { string_business_category_name };
|
|
628
642
|
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
|
-
*
|
|
80
|
+
* Returns the URL of the uploaded file on CDN or storage.
|
|
57
81
|
*/
|
|
58
|
-
onFileUpload?(file: File,
|
|
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
|
|
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.
|
|
@@ -15,6 +15,12 @@ export type ToolCallChipletInfo = {
|
|
|
15
15
|
* Agent data for team tools (if applicable)
|
|
16
16
|
*/
|
|
17
17
|
agentData?: AgentChipData;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to wrap the chip text in brackets when rendering.
|
|
20
|
+
*
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
wrapInBrackets?: boolean;
|
|
18
24
|
};
|
|
19
25
|
/**
|
|
20
26
|
* Technical to user-friendly tool names and emojis
|
|
@@ -24,14 +30,8 @@ export type ToolCallChipletInfo = {
|
|
|
24
30
|
export declare const TOOL_TITLES: Record<string, {
|
|
25
31
|
title: string;
|
|
26
32
|
emoji: string;
|
|
33
|
+
wrapInBrackets?: boolean;
|
|
27
34
|
}>;
|
|
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
35
|
/**
|
|
36
36
|
* Gets the chiplet information including text and agent data (for team tools).
|
|
37
37
|
*
|
|
@@ -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,78 @@ export type ToolCall = {
|
|
|
35
35
|
*/
|
|
36
36
|
readonly warnings?: ReadonlyArray<TODO_any>;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Breakdown of teacher-learned commitment categories for self-learning.
|
|
40
|
+
*/
|
|
41
|
+
export type SelfLearningCommitmentTypeCounts = {
|
|
42
|
+
/**
|
|
43
|
+
* Total number of learned commitments.
|
|
44
|
+
*/
|
|
45
|
+
readonly total: number;
|
|
46
|
+
/**
|
|
47
|
+
* Count of knowledge commitments.
|
|
48
|
+
*/
|
|
49
|
+
readonly knowledge: number;
|
|
50
|
+
/**
|
|
51
|
+
* Count of rule commitments.
|
|
52
|
+
*/
|
|
53
|
+
readonly rule: number;
|
|
54
|
+
/**
|
|
55
|
+
* Count of persona commitments.
|
|
56
|
+
*/
|
|
57
|
+
readonly persona: number;
|
|
58
|
+
/**
|
|
59
|
+
* Count of other commitment types.
|
|
60
|
+
*/
|
|
61
|
+
readonly other: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Summary of the teacher review step during self-learning.
|
|
65
|
+
*/
|
|
66
|
+
export type SelfLearningTeacherSummary = {
|
|
67
|
+
/**
|
|
68
|
+
* Indicates whether the teacher step was used.
|
|
69
|
+
*/
|
|
70
|
+
readonly used: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Commitment breakdown produced by the teacher step.
|
|
73
|
+
*/
|
|
74
|
+
readonly commitmentTypes: SelfLearningCommitmentTypeCounts;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Result payload for the self-learning tool call.
|
|
78
|
+
*/
|
|
79
|
+
export type SelfLearningToolCallResult = {
|
|
80
|
+
/**
|
|
81
|
+
* Indicates whether self-learning completed successfully.
|
|
82
|
+
*/
|
|
83
|
+
readonly success: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Timestamp for when self-learning started.
|
|
86
|
+
*/
|
|
87
|
+
readonly startedAt?: string_date_iso8601;
|
|
88
|
+
/**
|
|
89
|
+
* Timestamp for when self-learning finished.
|
|
90
|
+
*/
|
|
91
|
+
readonly completedAt?: string_date_iso8601;
|
|
92
|
+
/**
|
|
93
|
+
* Number of conversation examples saved from this turn.
|
|
94
|
+
*/
|
|
95
|
+
readonly samplesAdded?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Summary of the teacher review step.
|
|
98
|
+
*/
|
|
99
|
+
readonly teacher?: SelfLearningTeacherSummary;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Tool call name emitted while preparing a GPT assistant for an agent.
|
|
103
|
+
*
|
|
104
|
+
* @public exported from `@promptbook/types`
|
|
105
|
+
*/
|
|
106
|
+
export declare const ASSISTANT_PREPARATION_TOOL_CALL_NAME = "assistant_preparation";
|
|
107
|
+
/**
|
|
108
|
+
* Checks whether a tool call is the assistant preparation marker.
|
|
109
|
+
*
|
|
110
|
+
* @public exported from `@promptbook/types`
|
|
111
|
+
*/
|
|
112
|
+
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
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Remove bracketed source citation artifacts like `\u30105:1\u2020source\u3011`.
|
|
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 humanizeAiTextSources(aiText: string_markdown): string_markdown;
|
|
11
|
+
/**
|
|
12
|
+
* Note: [??] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
13
|
+
*/
|
|
@@ -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.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.107.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.
|
|
3
|
+
"version": "0.108.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.
|
|
97
|
+
"@promptbook/core": "0.108.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.
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.108.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
|
-
*/
|
|
File without changes
|