@promptbook/wizard 0.108.0-0 → 0.110.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.
- package/esm/index.es.js +71 -62
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +32 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatCitationModal.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatInputArea.d.ts +48 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +40 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatRatingModal.d.ts +30 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatSelfLearningSummary.d.ts +24 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +23 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +39 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatActionsOverlap.d.ts +55 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatRatings.d.ts +67 -0
- package/esm/typings/src/book-components/icons/TeacherIcon.d.ts +15 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +18 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +40 -3
- package/esm/typings/src/types/ToolCall.d.ts +4 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHash.d.ts +1 -24
- package/esm/typings/src/utils/linguistic-hash/linguisticHashWordCount.d.ts +31 -0
- package/esm/typings/src/utils/linguistic-hash/linguisticHashWordSelection.d.ts +22 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +71 -62
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MAX_LINGUISTIC_HASH_WORD_COUNT } from './linguisticHashWordSelection';
|
|
2
|
+
/**
|
|
3
|
+
* The minimum number of words for a linguistic hash.
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `linguisticHash`
|
|
6
|
+
*/
|
|
7
|
+
export declare const MIN_LINGUISTIC_HASH_WORD_COUNT = 1;
|
|
8
|
+
/**
|
|
9
|
+
* The default number of words for a linguistic hash.
|
|
10
|
+
*
|
|
11
|
+
* @private utility of `linguisticHash`
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_LINGUISTIC_HASH_WORD_COUNT = 7;
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes the word count to a supported integer range.
|
|
16
|
+
*
|
|
17
|
+
* @private utility of `linguisticHash`
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeLinguisticHashWordCount(wordCount?: number | null): number;
|
|
20
|
+
export { MAX_LINGUISTIC_HASH_WORD_COUNT };
|
|
21
|
+
/**
|
|
22
|
+
* Bundled helpers for linguistic hash word count handling.
|
|
23
|
+
*
|
|
24
|
+
* @private utility of `linguisticHash`
|
|
25
|
+
*/
|
|
26
|
+
export declare const linguisticHashWordCount: {
|
|
27
|
+
DEFAULT_LINGUISTIC_HASH_WORD_COUNT: number;
|
|
28
|
+
MAX_LINGUISTIC_HASH_WORD_COUNT: number;
|
|
29
|
+
MIN_LINGUISTIC_HASH_WORD_COUNT: number;
|
|
30
|
+
normalizeLinguisticHashWordCount: typeof normalizeLinguisticHashWordCount;
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LinguisticHashWordLists } from './linguisticHashTypes';
|
|
2
|
+
/**
|
|
3
|
+
* The maximum number of words for a linguistic hash.
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `linguisticHash`
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_LINGUISTIC_HASH_WORD_COUNT: number;
|
|
8
|
+
/**
|
|
9
|
+
* Selects the requested number of words from the hash output.
|
|
10
|
+
*
|
|
11
|
+
* @private utility of `linguisticHash`
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLinguisticHashWords(hash: string, wordCount: number, wordLists: LinguisticHashWordLists): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Bundled helpers for the linguistic hash word selection module.
|
|
16
|
+
*
|
|
17
|
+
* @private utility of `linguisticHash`
|
|
18
|
+
*/
|
|
19
|
+
export declare const linguisticHashWordSelection: {
|
|
20
|
+
createLinguisticHashWords: typeof createLinguisticHashWords;
|
|
21
|
+
MAX_LINGUISTIC_HASH_WORD_COUNT: number;
|
|
22
|
+
};
|
|
@@ -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.110.0-0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/wizard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.110.0-1",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/wizard.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.
|
|
98
|
+
"@promptbook/core": "0.110.0-1"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@ai-sdk/deepseek": "0.1.17",
|
package/umd/index.umd.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* @generated
|
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
|
51
51
|
*/
|
|
52
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
52
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.110.0-1';
|
|
53
53
|
/**
|
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -7874,60 +7874,12 @@
|
|
|
7874
7874
|
return LANGUAGE_CONFIGS[normalized];
|
|
7875
7875
|
}
|
|
7876
7876
|
|
|
7877
|
-
// <- TODO: !!!! Remove re-exports
|
|
7878
|
-
/**
|
|
7879
|
-
* Creates a human-readable hash as a short, story-like phrase.
|
|
7880
|
-
*
|
|
7881
|
-
* @param wordCount how many words to include (defaults to {@link DEFAULT_LINGUISTIC_HASH_WORD_COUNT}, clamped to
|
|
7882
|
-
* {@link MIN_LINGUISTIC_HASH_WORD_COUNT}..{@link MAX_LINGUISTIC_HASH_WORD_COUNT})
|
|
7883
|
-
* @param language optional language code (defaults to {@link DEFAULT_LINGUISTIC_HASH_LANGUAGE})
|
|
7884
|
-
*
|
|
7885
|
-
* @public exported from `@promptbook/utils`
|
|
7886
|
-
*/
|
|
7887
|
-
async function linguisticHash(input, wordCount, language) {
|
|
7888
|
-
const hash = computeHash(input);
|
|
7889
|
-
const normalizedWordCount = normalizeLinguisticHashWordCount(wordCount);
|
|
7890
|
-
const languageConfig = getLinguisticHashLanguageConfig(language);
|
|
7891
|
-
const words = createLinguisticHashWords(hash, normalizedWordCount, languageConfig.wordLists);
|
|
7892
|
-
return capitalize(words.join(' '));
|
|
7893
|
-
}
|
|
7894
7877
|
/**
|
|
7895
7878
|
* @@@
|
|
7896
7879
|
*
|
|
7897
7880
|
* @private utility of `linguisticHash`
|
|
7898
7881
|
*/
|
|
7899
7882
|
const HASH_SEGMENT_LENGTH = 8;
|
|
7900
|
-
/**
|
|
7901
|
-
* The minimum number of words for a linguistic hash.
|
|
7902
|
-
*
|
|
7903
|
-
* @private utility of `linguisticHash`
|
|
7904
|
-
*/
|
|
7905
|
-
const MIN_LINGUISTIC_HASH_WORD_COUNT = 1;
|
|
7906
|
-
/**
|
|
7907
|
-
* The default number of words for a linguistic hash.
|
|
7908
|
-
*
|
|
7909
|
-
* @private utility of `linguisticHash`
|
|
7910
|
-
*/
|
|
7911
|
-
const DEFAULT_LINGUISTIC_HASH_WORD_COUNT = 7;
|
|
7912
|
-
/**
|
|
7913
|
-
* Extracts a deterministic numeric seed from a SHA-256 hash.
|
|
7914
|
-
*
|
|
7915
|
-
* @private utility of `linguisticHash`
|
|
7916
|
-
*/
|
|
7917
|
-
function getHashSeed(hash, segmentIndex) {
|
|
7918
|
-
const expandedHash = `${hash}${hash}`;
|
|
7919
|
-
const start = (segmentIndex * HASH_SEGMENT_LENGTH + segmentIndex) % hash.length;
|
|
7920
|
-
return parseInt(expandedHash.substring(start, start + HASH_SEGMENT_LENGTH), 16);
|
|
7921
|
-
}
|
|
7922
|
-
/**
|
|
7923
|
-
* Picks a deterministic item from a list based on the hash seed.
|
|
7924
|
-
*
|
|
7925
|
-
* @private utility of `linguisticHash`
|
|
7926
|
-
*/
|
|
7927
|
-
function pickFromHash(hash, segmentIndex, list) {
|
|
7928
|
-
const seed = getHashSeed(hash, segmentIndex);
|
|
7929
|
-
return list[seed % list.length];
|
|
7930
|
-
}
|
|
7931
7883
|
/**
|
|
7932
7884
|
* Ordered word kinds used to build the linguistic hash output.
|
|
7933
7885
|
*
|
|
@@ -7968,16 +7920,23 @@
|
|
|
7968
7920
|
*/
|
|
7969
7921
|
const SINGLE_WORD_INDEX = 1;
|
|
7970
7922
|
/**
|
|
7971
|
-
*
|
|
7923
|
+
* Extracts a deterministic numeric seed from a SHA-256 hash.
|
|
7972
7924
|
*
|
|
7973
7925
|
* @private utility of `linguisticHash`
|
|
7974
7926
|
*/
|
|
7975
|
-
function
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7927
|
+
function getHashSeed(hash, segmentIndex) {
|
|
7928
|
+
const expandedHash = `${hash}${hash}`;
|
|
7929
|
+
const start = (segmentIndex * HASH_SEGMENT_LENGTH + segmentIndex) % hash.length;
|
|
7930
|
+
return parseInt(expandedHash.substring(start, start + HASH_SEGMENT_LENGTH), 16);
|
|
7931
|
+
}
|
|
7932
|
+
/**
|
|
7933
|
+
* Picks a deterministic item from a list based on the hash seed.
|
|
7934
|
+
*
|
|
7935
|
+
* @private utility of `linguisticHash`
|
|
7936
|
+
*/
|
|
7937
|
+
function pickFromHash(hash, segmentIndex, list) {
|
|
7938
|
+
const seed = getHashSeed(hash, segmentIndex);
|
|
7939
|
+
return list[seed % list.length];
|
|
7981
7940
|
}
|
|
7982
7941
|
/**
|
|
7983
7942
|
* Picks a deterministic word from the hash by kind.
|
|
@@ -8008,6 +7967,49 @@
|
|
|
8008
7967
|
return words.slice(0, wordCount);
|
|
8009
7968
|
}
|
|
8010
7969
|
|
|
7970
|
+
/**
|
|
7971
|
+
* The minimum number of words for a linguistic hash.
|
|
7972
|
+
*
|
|
7973
|
+
* @private utility of `linguisticHash`
|
|
7974
|
+
*/
|
|
7975
|
+
const MIN_LINGUISTIC_HASH_WORD_COUNT = 1;
|
|
7976
|
+
/**
|
|
7977
|
+
* The default number of words for a linguistic hash.
|
|
7978
|
+
*
|
|
7979
|
+
* @private utility of `linguisticHash`
|
|
7980
|
+
*/
|
|
7981
|
+
const DEFAULT_LINGUISTIC_HASH_WORD_COUNT = 7;
|
|
7982
|
+
/**
|
|
7983
|
+
* Normalizes the word count to a supported integer range.
|
|
7984
|
+
*
|
|
7985
|
+
* @private utility of `linguisticHash`
|
|
7986
|
+
*/
|
|
7987
|
+
function normalizeLinguisticHashWordCount(wordCount) {
|
|
7988
|
+
if (typeof wordCount !== 'number' || !Number.isFinite(wordCount)) {
|
|
7989
|
+
return DEFAULT_LINGUISTIC_HASH_WORD_COUNT;
|
|
7990
|
+
}
|
|
7991
|
+
const rounded = Math.round(wordCount);
|
|
7992
|
+
return Math.min(MAX_LINGUISTIC_HASH_WORD_COUNT, Math.max(MIN_LINGUISTIC_HASH_WORD_COUNT, rounded));
|
|
7993
|
+
}
|
|
7994
|
+
|
|
7995
|
+
// <- TODO: !!!! Remove re-exports
|
|
7996
|
+
/**
|
|
7997
|
+
* Creates a human-readable hash as a short, story-like phrase.
|
|
7998
|
+
*
|
|
7999
|
+
* @param wordCount how many words to include (defaults to {@link DEFAULT_LINGUISTIC_HASH_WORD_COUNT}, clamped to
|
|
8000
|
+
* {@link MIN_LINGUISTIC_HASH_WORD_COUNT}..{@link MAX_LINGUISTIC_HASH_WORD_COUNT})
|
|
8001
|
+
* @param language optional language code (defaults to {@link DEFAULT_LINGUISTIC_HASH_LANGUAGE})
|
|
8002
|
+
*
|
|
8003
|
+
* @public exported from `@promptbook/utils`
|
|
8004
|
+
*/
|
|
8005
|
+
async function linguisticHash(input, wordCount, language) {
|
|
8006
|
+
const hash = computeHash(input);
|
|
8007
|
+
const normalizedWordCount = normalizeLinguisticHashWordCount(wordCount);
|
|
8008
|
+
const languageConfig = getLinguisticHashLanguageConfig(language);
|
|
8009
|
+
const words = createLinguisticHashWords(hash, normalizedWordCount, languageConfig.wordLists);
|
|
8010
|
+
return capitalize(words.join(' '));
|
|
8011
|
+
}
|
|
8012
|
+
|
|
8011
8013
|
/**
|
|
8012
8014
|
* Function parseNumber will parse number from string
|
|
8013
8015
|
*
|
|
@@ -29524,15 +29526,20 @@
|
|
|
29524
29526
|
};
|
|
29525
29527
|
}
|
|
29526
29528
|
/**
|
|
29527
|
-
*
|
|
29529
|
+
* Normalizes teacher commitments into trimmed, display-ready lines.
|
|
29528
29530
|
*/
|
|
29529
|
-
function
|
|
29530
|
-
|
|
29531
|
-
const counts = createEmptySelfLearningCommitmentCounts();
|
|
29532
|
-
const lines = commitments
|
|
29531
|
+
function getTeacherCommitmentLines(commitments) {
|
|
29532
|
+
return commitments
|
|
29533
29533
|
.split(/\r?\n/)
|
|
29534
29534
|
.map((line) => line.trim())
|
|
29535
29535
|
.filter((line) => line.length > 0 && line !== '---' && !line.startsWith('```'));
|
|
29536
|
+
}
|
|
29537
|
+
/**
|
|
29538
|
+
* Summarizes teacher commitment lines into user-friendly counts for self-learning.
|
|
29539
|
+
*/
|
|
29540
|
+
function summarizeTeacherCommitmentLines(lines) {
|
|
29541
|
+
var _a, _b;
|
|
29542
|
+
const counts = createEmptySelfLearningCommitmentCounts();
|
|
29536
29543
|
for (const line of lines) {
|
|
29537
29544
|
const keyword = (_b = (_a = line.split(/\s+/)[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : '';
|
|
29538
29545
|
if (!/^[A-Z][A-Z_-]*$/.test(keyword)) {
|
|
@@ -29558,9 +29565,11 @@
|
|
|
29558
29565
|
* Builds the teacher summary payload for the self-learning tool call.
|
|
29559
29566
|
*/
|
|
29560
29567
|
function buildTeacherSummary(commitments, used) {
|
|
29568
|
+
const commitmentLines = getTeacherCommitmentLines(commitments);
|
|
29561
29569
|
return {
|
|
29562
29570
|
used,
|
|
29563
|
-
commitmentTypes:
|
|
29571
|
+
commitmentTypes: summarizeTeacherCommitmentLines(commitmentLines),
|
|
29572
|
+
commitments: commitmentLines.length > 0 ? commitmentLines : undefined,
|
|
29564
29573
|
};
|
|
29565
29574
|
}
|
|
29566
29575
|
/**
|