@promptbook/remote-server 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.
- package/esm/index.es.js +39 -7
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -6
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +21 -0
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentSourceParseResult.d.ts +3 -1
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirements.d.ts +2 -2
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirementsWithCommitments.d.ts +3 -3
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createCommitmentRegex.d.ts +2 -2
- package/esm/typings/src/book-2.0/agent-source/extractMetaLinks.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +4 -19
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +9 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/{_misc → _base}/ParsedCommitment.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +17 -0
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +12 -0
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +10 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +10 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +2 -8
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -1
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +13 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +12 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/removeMarkdownLinks.d.ts +11 -0
- package/esm/typings/src/utils/markdown/removeMarkdownLinks.test.d.ts +4 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
- package/esm/typings/src/utils/parseNumber.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +44 -11
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +0 -24
- package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +0 -39
- /package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/removeCommentsFromSystemMessage.d.ts +0 -0
package/esm/index.es.js
CHANGED
|
@@ -11,9 +11,6 @@ import { spawn } from 'child_process';
|
|
|
11
11
|
import { stat, access, constants, readFile, writeFile, readdir, mkdir } from 'fs/promises';
|
|
12
12
|
import { join, basename, dirname, isAbsolute } from 'path';
|
|
13
13
|
import { Subject } from 'rxjs';
|
|
14
|
-
import parserHtml from 'prettier/parser-html';
|
|
15
|
-
import parserMarkdown from 'prettier/parser-markdown';
|
|
16
|
-
import { format } from 'prettier/standalone';
|
|
17
14
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
18
15
|
import sha256 from 'crypto-js/sha256';
|
|
19
16
|
import { SHA256 } from 'crypto-js';
|
|
@@ -34,7 +31,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
34
31
|
* @generated
|
|
35
32
|
* @see https://github.com/webgptorg/promptbook
|
|
36
33
|
*/
|
|
37
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
34
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
|
|
38
35
|
/**
|
|
39
36
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
40
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1299,6 +1296,7 @@ function checkSerializableAsJson(options) {
|
|
|
1299
1296
|
/**
|
|
1300
1297
|
* Creates a deep clone of the given object
|
|
1301
1298
|
*
|
|
1299
|
+
* Note: [🔂] This function is idempotent.
|
|
1302
1300
|
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
1303
1301
|
*
|
|
1304
1302
|
* @param objectValue The object to clone.
|
|
@@ -1464,6 +1462,7 @@ function isValidPromptbookVersion(version) {
|
|
|
1464
1462
|
/**
|
|
1465
1463
|
* Tests if given string is valid URL.
|
|
1466
1464
|
*
|
|
1465
|
+
* Note: [🔂] This function is idempotent.
|
|
1467
1466
|
* Note: Dataurl are considered perfectly valid.
|
|
1468
1467
|
* Note: There are two similar functions:
|
|
1469
1468
|
* - `isValidUrl` which tests any URL
|
|
@@ -2372,8 +2371,18 @@ function validatePipelineString(pipelineString) {
|
|
|
2372
2371
|
* @private withing the package because of HUGE size of prettier dependency
|
|
2373
2372
|
*/
|
|
2374
2373
|
function prettifyMarkdown(content) {
|
|
2374
|
+
// In browser/Next.js environments, just return the original content
|
|
2375
|
+
// since prettier parsers are not available and would cause bundling issues
|
|
2376
|
+
if (typeof window !== 'undefined') {
|
|
2377
|
+
return content;
|
|
2378
|
+
}
|
|
2375
2379
|
try {
|
|
2376
|
-
|
|
2380
|
+
// Use dynamic require to avoid static imports that cause bundling issues
|
|
2381
|
+
// This will only work in Node.js environments
|
|
2382
|
+
const prettierStandalone = eval('require')('prettier/standalone');
|
|
2383
|
+
const parserMarkdown = eval('require')('prettier/parser-markdown');
|
|
2384
|
+
const parserHtml = eval('require')('prettier/parser-html');
|
|
2385
|
+
return prettierStandalone.format(content, {
|
|
2377
2386
|
parser: 'markdown',
|
|
2378
2387
|
plugins: [parserMarkdown, parserHtml],
|
|
2379
2388
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
|
@@ -2401,6 +2410,8 @@ function prettifyMarkdown(content) {
|
|
|
2401
2410
|
/**
|
|
2402
2411
|
* Makes first letter of a string uppercase
|
|
2403
2412
|
*
|
|
2413
|
+
* Note: [🔂] This function is idempotent.
|
|
2414
|
+
*
|
|
2404
2415
|
* @public exported from `@promptbook/utils`
|
|
2405
2416
|
*/
|
|
2406
2417
|
function capitalize(word) {
|
|
@@ -2932,7 +2943,7 @@ const LLM_PROVIDER_PROFILES = {
|
|
|
2932
2943
|
};
|
|
2933
2944
|
/**
|
|
2934
2945
|
* TODO: Refactor this - each profile must be alongside the provider definition
|
|
2935
|
-
* TODO: [🕛] Unite `
|
|
2946
|
+
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
2936
2947
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2937
2948
|
*/
|
|
2938
2949
|
|
|
@@ -3241,6 +3252,8 @@ function $getGlobalScope() {
|
|
|
3241
3252
|
/**
|
|
3242
3253
|
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
3243
3254
|
*
|
|
3255
|
+
* Note: [🔂] This function is idempotent.
|
|
3256
|
+
*
|
|
3244
3257
|
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
3245
3258
|
* @returns The normalized text in SCREAMING_CASE format.
|
|
3246
3259
|
* @example 'HELLO_WORLD'
|
|
@@ -3296,6 +3309,8 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
3296
3309
|
/**
|
|
3297
3310
|
* Normalizes a text string to snake_case format.
|
|
3298
3311
|
*
|
|
3312
|
+
* Note: [🔂] This function is idempotent.
|
|
3313
|
+
*
|
|
3299
3314
|
* @param text The text string to be converted to snake_case format.
|
|
3300
3315
|
* @returns The normalized text in snake_case format.
|
|
3301
3316
|
* @example 'hello_world'
|
|
@@ -3713,6 +3728,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
3713
3728
|
/**
|
|
3714
3729
|
* Removes diacritic marks (accents) from characters in a string.
|
|
3715
3730
|
*
|
|
3731
|
+
* Note: [🔂] This function is idempotent.
|
|
3732
|
+
*
|
|
3716
3733
|
* @param input The string containing diacritics to be normalized.
|
|
3717
3734
|
* @returns The string with diacritics removed or normalized.
|
|
3718
3735
|
* @public exported from `@promptbook/utils`
|
|
@@ -3867,6 +3884,8 @@ function mimeTypeToExtension(value) {
|
|
|
3867
3884
|
/**
|
|
3868
3885
|
* Removes emojis from a string and fix whitespaces
|
|
3869
3886
|
*
|
|
3887
|
+
* Note: [🔂] This function is idempotent.
|
|
3888
|
+
*
|
|
3870
3889
|
* @param text with emojis
|
|
3871
3890
|
* @returns text without emojis
|
|
3872
3891
|
* @public exported from `@promptbook/utils`
|
|
@@ -5260,6 +5279,7 @@ function countCharacters(text) {
|
|
|
5260
5279
|
}
|
|
5261
5280
|
/**
|
|
5262
5281
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5282
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5263
5283
|
*/
|
|
5264
5284
|
|
|
5265
5285
|
/**
|
|
@@ -5294,6 +5314,7 @@ function countLines(text) {
|
|
|
5294
5314
|
}
|
|
5295
5315
|
/**
|
|
5296
5316
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5317
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5297
5318
|
*/
|
|
5298
5319
|
|
|
5299
5320
|
/**
|
|
@@ -5308,6 +5329,7 @@ function countPages(text) {
|
|
|
5308
5329
|
}
|
|
5309
5330
|
/**
|
|
5310
5331
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5332
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5311
5333
|
*/
|
|
5312
5334
|
|
|
5313
5335
|
/**
|
|
@@ -5320,6 +5342,7 @@ function countParagraphs(text) {
|
|
|
5320
5342
|
}
|
|
5321
5343
|
/**
|
|
5322
5344
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5345
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5323
5346
|
*/
|
|
5324
5347
|
|
|
5325
5348
|
/**
|
|
@@ -5340,6 +5363,7 @@ function countSentences(text) {
|
|
|
5340
5363
|
}
|
|
5341
5364
|
/**
|
|
5342
5365
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5366
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5343
5367
|
*/
|
|
5344
5368
|
|
|
5345
5369
|
/**
|
|
@@ -5356,6 +5380,8 @@ function countWords(text) {
|
|
|
5356
5380
|
}
|
|
5357
5381
|
/**
|
|
5358
5382
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5383
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5384
|
+
* TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
|
|
5359
5385
|
*/
|
|
5360
5386
|
|
|
5361
5387
|
/**
|
|
@@ -7018,7 +7044,9 @@ new Function(`
|
|
|
7018
7044
|
*/
|
|
7019
7045
|
|
|
7020
7046
|
/**
|
|
7021
|
-
* Makes first letter of a string
|
|
7047
|
+
* Makes first letter of a string lowercase
|
|
7048
|
+
*
|
|
7049
|
+
* Note: [🔂] This function is idempotent.
|
|
7022
7050
|
*
|
|
7023
7051
|
* @public exported from `@promptbook/utils`
|
|
7024
7052
|
*/
|
|
@@ -7088,6 +7116,8 @@ function normalizeTo_PascalCase(text) {
|
|
|
7088
7116
|
/**
|
|
7089
7117
|
* Take every whitespace (space, new line, tab) and replace it with a single space
|
|
7090
7118
|
*
|
|
7119
|
+
* Note: [🔂] This function is idempotent.
|
|
7120
|
+
*
|
|
7091
7121
|
* @public exported from `@promptbook/utils`
|
|
7092
7122
|
*/
|
|
7093
7123
|
function normalizeWhitespaces(sentence) {
|
|
@@ -7097,6 +7127,7 @@ function normalizeWhitespaces(sentence) {
|
|
|
7097
7127
|
/**
|
|
7098
7128
|
* Removes quotes from a string
|
|
7099
7129
|
*
|
|
7130
|
+
* Note: [🔂] This function is idempotent.
|
|
7100
7131
|
* Tip: This is very useful for post-processing of the result of the LLM model
|
|
7101
7132
|
* Note: This function removes only the same quotes from the beginning and the end of the string
|
|
7102
7133
|
* Note: There are two similar functions:
|
|
@@ -7120,6 +7151,7 @@ function removeQuotes(text) {
|
|
|
7120
7151
|
/**
|
|
7121
7152
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
|
7122
7153
|
*
|
|
7154
|
+
* Note: [🔂] This function is idempotent.
|
|
7123
7155
|
* Note: This is useful for post-processing of the result of the chat LLM model
|
|
7124
7156
|
* when the model wraps the result in the (markdown) code block.
|
|
7125
7157
|
*
|