@promptbook/node 0.92.0-23 → 0.92.0-25
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 +117 -82
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +0 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/config.d.ts +8 -4
- package/esm/typings/src/constants.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +10 -10
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/index.d.ts +1 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +8 -6
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/version.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +117 -82
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-25';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -102,11 +102,20 @@ const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
|
102
102
|
*/
|
|
103
103
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Threshold value that determines when a dataset is considered "big"
|
|
106
|
+
* and may require special handling or optimizations
|
|
107
|
+
*
|
|
108
|
+
* For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
|
|
106
109
|
*
|
|
107
110
|
* @public exported from `@promptbook/core`
|
|
108
111
|
*/
|
|
109
112
|
const BIG_DATASET_TRESHOLD = 50;
|
|
113
|
+
/**
|
|
114
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
115
|
+
*
|
|
116
|
+
* @public exported from `@promptbook/core`
|
|
117
|
+
*/
|
|
118
|
+
const FAILED_VALUE_PLACEHOLDER = '!?';
|
|
110
119
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
111
120
|
/**
|
|
112
121
|
* The maximum number of iterations for a loops
|
|
@@ -657,13 +666,13 @@ const ORDER_OF_PIPELINE_JSON = [
|
|
|
657
666
|
*/
|
|
658
667
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
659
668
|
/**
|
|
660
|
-
*
|
|
669
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
661
670
|
*
|
|
662
671
|
* @private within the repository
|
|
663
672
|
*/
|
|
664
673
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
665
674
|
/**
|
|
666
|
-
*
|
|
675
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
667
676
|
*
|
|
668
677
|
* @private within the repository
|
|
669
678
|
*/
|
|
@@ -1536,7 +1545,7 @@ class SimplePipelineCollection {
|
|
|
1536
1545
|
/**
|
|
1537
1546
|
* Constructs a pipeline collection from pipelines
|
|
1538
1547
|
*
|
|
1539
|
-
* @param pipelines
|
|
1548
|
+
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
1540
1549
|
*
|
|
1541
1550
|
* Note: During the construction logic of all pipelines are validated
|
|
1542
1551
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
@@ -1666,8 +1675,8 @@ class MissingToolsError extends Error {
|
|
|
1666
1675
|
* @public exported from `@promptbook/core`
|
|
1667
1676
|
*/
|
|
1668
1677
|
function isPipelinePrepared(pipeline) {
|
|
1669
|
-
// Note: Ignoring `pipeline.preparations`
|
|
1670
|
-
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1678
|
+
// Note: Ignoring `pipeline.preparations`
|
|
1679
|
+
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1671
1680
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1672
1681
|
// TODO: !!! Comment this out
|
|
1673
1682
|
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
@@ -2626,6 +2635,15 @@ const CsvFormatParser = {
|
|
|
2626
2635
|
mappedData.push(mappedRow);
|
|
2627
2636
|
if (onProgress) {
|
|
2628
2637
|
// Note: Report the CSV with all rows mapped so far
|
|
2638
|
+
/*
|
|
2639
|
+
!!!!
|
|
2640
|
+
// Report progress with updated value
|
|
2641
|
+
const progressData = mappedData.map((row, i) =>
|
|
2642
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
2643
|
+
);
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
*/
|
|
2629
2647
|
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2630
2648
|
}
|
|
2631
2649
|
}
|
|
@@ -2842,7 +2860,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
2842
2860
|
else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
|
|
2843
2861
|
}
|
|
2844
2862
|
if (expectedParameterNames.size === 0) {
|
|
2845
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
2863
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
2846
2864
|
Object.freeze(mappedParameters);
|
|
2847
2865
|
return mappedParameters;
|
|
2848
2866
|
}
|
|
@@ -2873,7 +2891,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
2873
2891
|
for (let i = 0; i < expectedParameterNames.size; i++) {
|
|
2874
2892
|
mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
|
|
2875
2893
|
}
|
|
2876
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
2894
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
2877
2895
|
Object.freeze(mappedParameters);
|
|
2878
2896
|
return mappedParameters;
|
|
2879
2897
|
}
|
|
@@ -3624,10 +3642,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
3624
3642
|
*/
|
|
3625
3643
|
|
|
3626
3644
|
/**
|
|
3627
|
-
*
|
|
3645
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
3628
3646
|
*
|
|
3629
|
-
* @param input
|
|
3630
|
-
* @returns
|
|
3647
|
+
* @param input The string containing diacritics to be normalized.
|
|
3648
|
+
* @returns The string with diacritics removed or normalized.
|
|
3631
3649
|
* @public exported from `@promptbook/utils`
|
|
3632
3650
|
*/
|
|
3633
3651
|
function removeDiacritics(input) {
|
|
@@ -4115,15 +4133,14 @@ async function executeFormatSubvalues(options) {
|
|
|
4115
4133
|
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
4116
4134
|
${error.message}
|
|
4117
4135
|
|
|
4118
|
-
This is error in FOREACH command when mapping data
|
|
4136
|
+
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
4119
4137
|
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
4120
4138
|
|
|
4121
4139
|
${block(pipelineIdentification)}
|
|
4122
|
-
Subparameter index: ${index}
|
|
4123
4140
|
`));
|
|
4124
4141
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4125
4142
|
console.error(highLevelError);
|
|
4126
|
-
return
|
|
4143
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
4127
4144
|
}
|
|
4128
4145
|
throw highLevelError;
|
|
4129
4146
|
}
|
|
@@ -4147,14 +4164,13 @@ async function executeFormatSubvalues(options) {
|
|
|
4147
4164
|
catch (error) {
|
|
4148
4165
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4149
4166
|
console.error(spaceTrim((block) => `
|
|
4150
|
-
|
|
4167
|
+
${error.message}
|
|
4151
4168
|
|
|
4152
|
-
${
|
|
4169
|
+
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
4153
4170
|
|
|
4154
4171
|
${block(pipelineIdentification)}
|
|
4155
|
-
Subparameter index: ${index}
|
|
4156
4172
|
`));
|
|
4157
|
-
return
|
|
4173
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
4158
4174
|
}
|
|
4159
4175
|
throw error;
|
|
4160
4176
|
}
|
|
@@ -4993,7 +5009,8 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
4993
5009
|
*/
|
|
4994
5010
|
|
|
4995
5011
|
/**
|
|
4996
|
-
*
|
|
5012
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
5013
|
+
* regardless of the JavaScript environment in which the code is running
|
|
4997
5014
|
*
|
|
4998
5015
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
4999
5016
|
*
|
|
@@ -5004,10 +5021,10 @@ function $getGlobalScope() {
|
|
|
5004
5021
|
}
|
|
5005
5022
|
|
|
5006
5023
|
/**
|
|
5007
|
-
*
|
|
5024
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
5008
5025
|
*
|
|
5009
|
-
* @param text
|
|
5010
|
-
* @returns
|
|
5026
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
5027
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
5011
5028
|
* @example 'HELLO_WORLD'
|
|
5012
5029
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
5013
5030
|
* @public exported from `@promptbook/utils`
|
|
@@ -5059,10 +5076,10 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
5059
5076
|
*/
|
|
5060
5077
|
|
|
5061
5078
|
/**
|
|
5062
|
-
*
|
|
5079
|
+
* Normalizes a text string to snake_case format.
|
|
5063
5080
|
*
|
|
5064
|
-
* @param text
|
|
5065
|
-
* @returns
|
|
5081
|
+
* @param text The text string to be converted to snake_case format.
|
|
5082
|
+
* @returns The normalized text in snake_case format.
|
|
5066
5083
|
* @example 'hello_world'
|
|
5067
5084
|
* @example 'i_love_promptbook'
|
|
5068
5085
|
* @public exported from `@promptbook/utils`
|
|
@@ -5132,10 +5149,11 @@ const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
|
5132
5149
|
*/
|
|
5133
5150
|
|
|
5134
5151
|
/**
|
|
5135
|
-
*
|
|
5152
|
+
* Registry for all available scrapers in the system.
|
|
5153
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
5136
5154
|
*
|
|
5137
5155
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
5138
|
-
* @singleton Only one instance of each register is created per build, but
|
|
5156
|
+
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
5139
5157
|
* @public exported from `@promptbook/core`
|
|
5140
5158
|
*/
|
|
5141
5159
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
@@ -5231,10 +5249,10 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
5231
5249
|
*/
|
|
5232
5250
|
|
|
5233
5251
|
/**
|
|
5234
|
-
*
|
|
5252
|
+
* Converts a given text to kebab-case format.
|
|
5235
5253
|
*
|
|
5236
|
-
* @param text
|
|
5237
|
-
* @returns
|
|
5254
|
+
* @param text The text to be converted.
|
|
5255
|
+
* @returns The kebab-case formatted string.
|
|
5238
5256
|
* @example 'hello-world'
|
|
5239
5257
|
* @example 'i-love-promptbook'
|
|
5240
5258
|
* @public exported from `@promptbook/utils`
|
|
@@ -5303,7 +5321,8 @@ function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
|
5303
5321
|
*/
|
|
5304
5322
|
|
|
5305
5323
|
/**
|
|
5306
|
-
*
|
|
5324
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
5325
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
5307
5326
|
*
|
|
5308
5327
|
* @private for `FileCacheStorage`
|
|
5309
5328
|
*/
|
|
@@ -5383,11 +5402,11 @@ function removeEmojis(text) {
|
|
|
5383
5402
|
}
|
|
5384
5403
|
|
|
5385
5404
|
/**
|
|
5386
|
-
*
|
|
5405
|
+
* Converts a title string into a normalized name.
|
|
5387
5406
|
*
|
|
5388
|
-
* @param value
|
|
5389
|
-
* @returns
|
|
5390
|
-
* @example
|
|
5407
|
+
* @param value The title string to be converted to a name.
|
|
5408
|
+
* @returns A normalized name derived from the input title.
|
|
5409
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
5391
5410
|
* @public exported from `@promptbook/utils`
|
|
5392
5411
|
*/
|
|
5393
5412
|
function titleToName(value) {
|
|
@@ -5438,7 +5457,9 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
5438
5457
|
*/
|
|
5439
5458
|
|
|
5440
5459
|
/**
|
|
5441
|
-
*
|
|
5460
|
+
* Factory function that creates a handler for processing knowledge sources.
|
|
5461
|
+
* Provides standardized processing of different types of knowledge sources
|
|
5462
|
+
* across various scraper implementations.
|
|
5442
5463
|
*
|
|
5443
5464
|
* @public exported from `@promptbook/core`
|
|
5444
5465
|
*/
|
|
@@ -5679,9 +5700,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
5679
5700
|
*/
|
|
5680
5701
|
|
|
5681
5702
|
/**
|
|
5682
|
-
*
|
|
5703
|
+
* Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
|
|
5683
5704
|
*
|
|
5684
|
-
* @
|
|
5705
|
+
* @param tasks Sequence of tasks that are chained together to form a pipeline
|
|
5706
|
+
* @returns A promise that resolves to the prepared tasks.
|
|
5707
|
+
*
|
|
5708
|
+
* @private internal utility of `preparePipeline`
|
|
5685
5709
|
*/
|
|
5686
5710
|
async function prepareTasks(pipeline, tools, options) {
|
|
5687
5711
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
|
|
@@ -6587,11 +6611,11 @@ const expectCommandParser = {
|
|
|
6587
6611
|
};
|
|
6588
6612
|
|
|
6589
6613
|
/**
|
|
6590
|
-
*
|
|
6614
|
+
* Normalizes a given text to camelCase format.
|
|
6591
6615
|
*
|
|
6592
|
-
* @param text
|
|
6593
|
-
* @param _isFirstLetterCapital
|
|
6594
|
-
* @returns
|
|
6616
|
+
* @param text The text to be normalized.
|
|
6617
|
+
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
6618
|
+
* @returns The camelCase formatted string.
|
|
6595
6619
|
* @example 'helloWorld'
|
|
6596
6620
|
* @example 'iLovePromptbook'
|
|
6597
6621
|
* @public exported from `@promptbook/utils`
|
|
@@ -7079,7 +7103,7 @@ const GeneratorFormfactorDefinition = {
|
|
|
7079
7103
|
};
|
|
7080
7104
|
|
|
7081
7105
|
/**
|
|
7082
|
-
*
|
|
7106
|
+
* Pipeline interface which is equivalent to `any`
|
|
7083
7107
|
*
|
|
7084
7108
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
7085
7109
|
*
|
|
@@ -7160,14 +7184,15 @@ const MatcherFormfactorDefinition = {
|
|
|
7160
7184
|
};
|
|
7161
7185
|
|
|
7162
7186
|
/**
|
|
7163
|
-
* Sheets is form of app that
|
|
7187
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
7188
|
+
* and analysis of structured data through AI-powered operations
|
|
7164
7189
|
*
|
|
7165
7190
|
* @public exported from `@promptbook/core`
|
|
7166
7191
|
*/
|
|
7167
7192
|
const SheetsFormfactorDefinition = {
|
|
7168
7193
|
name: 'SHEETS',
|
|
7169
7194
|
aliasNames: ['SHEETS', 'SHEET'],
|
|
7170
|
-
description:
|
|
7195
|
+
description: `A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data`,
|
|
7171
7196
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/176`,
|
|
7172
7197
|
pipelineInterface: {
|
|
7173
7198
|
inputParameters: [
|
|
@@ -7243,7 +7268,7 @@ const FORMFACTOR_DEFINITIONS = [
|
|
|
7243
7268
|
/**
|
|
7244
7269
|
* Parses the formfactor command
|
|
7245
7270
|
*
|
|
7246
|
-
* Note:
|
|
7271
|
+
* Note: This command is used as a formfactor for new commands and defines the app type format - it should NOT be used in any `.book` file
|
|
7247
7272
|
*
|
|
7248
7273
|
* @see `documentationUrl` for more details
|
|
7249
7274
|
* @public exported from `@promptbook/editable`
|
|
@@ -7265,7 +7290,7 @@ const formfactorCommandParser = {
|
|
|
7265
7290
|
/**
|
|
7266
7291
|
* Description of the FORMFACTOR command
|
|
7267
7292
|
*/
|
|
7268
|
-
description:
|
|
7293
|
+
description: `Specifies the application type and interface requirements that this promptbook should conform to`,
|
|
7269
7294
|
/**
|
|
7270
7295
|
* Link to documentation
|
|
7271
7296
|
*/
|
|
@@ -7408,8 +7433,7 @@ const jokerCommandParser = {
|
|
|
7408
7433
|
};
|
|
7409
7434
|
|
|
7410
7435
|
/**
|
|
7411
|
-
*
|
|
7412
|
-
*
|
|
7436
|
+
* @see {@link ModelVariant}
|
|
7413
7437
|
* @public exported from `@promptbook/core`
|
|
7414
7438
|
*/
|
|
7415
7439
|
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
@@ -8382,7 +8406,7 @@ function parseCommandVariant(input) {
|
|
|
8382
8406
|
}
|
|
8383
8407
|
|
|
8384
8408
|
/**
|
|
8385
|
-
*
|
|
8409
|
+
* Extracts the interface (input and output parameters) from a pipeline.
|
|
8386
8410
|
*
|
|
8387
8411
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8388
8412
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8415,7 +8439,7 @@ function getPipelineInterface(pipeline) {
|
|
|
8415
8439
|
}
|
|
8416
8440
|
|
|
8417
8441
|
/**
|
|
8418
|
-
*
|
|
8442
|
+
* Checks if two pipeline interfaces are structurally identical.
|
|
8419
8443
|
*
|
|
8420
8444
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8421
8445
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8447,10 +8471,11 @@ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
|
|
|
8447
8471
|
}
|
|
8448
8472
|
|
|
8449
8473
|
/**
|
|
8450
|
-
*
|
|
8474
|
+
* Checks if a given pipeline satisfies the requirements of a specified pipeline interface.
|
|
8451
8475
|
*
|
|
8452
8476
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8453
8477
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
8478
|
+
* @returns `true` if the pipeline implements the interface, `false` otherwise.
|
|
8454
8479
|
*
|
|
8455
8480
|
* @public exported from `@promptbook/core`
|
|
8456
8481
|
*/
|
|
@@ -8636,7 +8661,8 @@ function removeMarkdownComments(content) {
|
|
|
8636
8661
|
}
|
|
8637
8662
|
|
|
8638
8663
|
/**
|
|
8639
|
-
*
|
|
8664
|
+
* Utility to determine if a pipeline string is in flat format.
|
|
8665
|
+
* A flat pipeline is a simple text without proper structure (headers, blocks, etc).
|
|
8640
8666
|
*
|
|
8641
8667
|
* @public exported from `@promptbook/editable`
|
|
8642
8668
|
*/
|
|
@@ -8657,7 +8683,10 @@ function isFlatPipeline(pipelineString) {
|
|
|
8657
8683
|
}
|
|
8658
8684
|
|
|
8659
8685
|
/**
|
|
8660
|
-
*
|
|
8686
|
+
* Converts a pipeline structure to its string representation.
|
|
8687
|
+
*
|
|
8688
|
+
* Transforms a flat, simple pipeline into a properly formatted pipeline string
|
|
8689
|
+
* with sections for title, prompt, and return statement.
|
|
8661
8690
|
*
|
|
8662
8691
|
* @public exported from `@promptbook/editable`
|
|
8663
8692
|
*/
|
|
@@ -8714,7 +8743,7 @@ function deflatePipeline(pipelineString) {
|
|
|
8714
8743
|
* Note: It can not work with html syntax and comments
|
|
8715
8744
|
*
|
|
8716
8745
|
* @param markdown any valid markdown
|
|
8717
|
-
* @returns
|
|
8746
|
+
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
8718
8747
|
* @public exported from `@promptbook/markdown-utils`
|
|
8719
8748
|
*/
|
|
8720
8749
|
function extractAllListItemsFromMarkdown(markdown) {
|
|
@@ -9569,7 +9598,8 @@ async function locateAppOnLinux({ linuxWhich, }) {
|
|
|
9569
9598
|
*/
|
|
9570
9599
|
|
|
9571
9600
|
/**
|
|
9572
|
-
*
|
|
9601
|
+
* Provides filesystem access (for example for Node.js-based scrapers)
|
|
9602
|
+
* Creates a standardized filesystem interface that scrapers can use for file operations.
|
|
9573
9603
|
*
|
|
9574
9604
|
* @public exported from `@promptbook/node`
|
|
9575
9605
|
*/
|
|
@@ -9774,10 +9804,10 @@ async function $provideExecutablesForNode(options) {
|
|
|
9774
9804
|
*/
|
|
9775
9805
|
|
|
9776
9806
|
/**
|
|
9777
|
-
*
|
|
9807
|
+
* Register for LLM tools metadata.
|
|
9778
9808
|
*
|
|
9779
9809
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
9780
|
-
* @singleton Only one instance of each register is created per build, but
|
|
9810
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
9781
9811
|
* @public exported from `@promptbook/core`
|
|
9782
9812
|
*/
|
|
9783
9813
|
const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
@@ -9805,10 +9835,10 @@ function isRootPath(value) {
|
|
|
9805
9835
|
*/
|
|
9806
9836
|
|
|
9807
9837
|
/**
|
|
9808
|
-
*
|
|
9838
|
+
* Register for LLM tools.
|
|
9809
9839
|
*
|
|
9810
9840
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
9811
|
-
* @singleton Only one instance of each register is created per build, but
|
|
9841
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
9812
9842
|
* @public exported from `@promptbook/core`
|
|
9813
9843
|
*/
|
|
9814
9844
|
const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
@@ -10001,9 +10031,8 @@ async function $provideEnvFilename() {
|
|
|
10001
10031
|
*/
|
|
10002
10032
|
|
|
10003
10033
|
/**
|
|
10004
|
-
*
|
|
10034
|
+
* Provides LLM tools configuration by reading environment variables.
|
|
10005
10035
|
*
|
|
10006
|
-
* @@@ .env
|
|
10007
10036
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
10008
10037
|
*
|
|
10009
10038
|
* It looks for environment variables:
|
|
@@ -10011,7 +10040,8 @@ async function $provideEnvFilename() {
|
|
|
10011
10040
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
10012
10041
|
* - ...
|
|
10013
10042
|
*
|
|
10014
|
-
* @
|
|
10043
|
+
* @see Environment variables documentation or .env file for required variables.
|
|
10044
|
+
* @returns A promise that resolves to the LLM tools configuration, or null if configuration is incomplete or missing.
|
|
10015
10045
|
* @public exported from `@promptbook/node`
|
|
10016
10046
|
*/
|
|
10017
10047
|
async function $provideLlmToolsConfigurationFromEnv() {
|
|
@@ -10132,11 +10162,9 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
10132
10162
|
*/
|
|
10133
10163
|
|
|
10134
10164
|
/**
|
|
10135
|
-
*
|
|
10136
|
-
*
|
|
10137
|
-
*
|
|
10138
|
-
* 2) @@@
|
|
10139
|
-
*
|
|
10165
|
+
* Provides a collection of scrapers optimized for Node.js environment.
|
|
10166
|
+
* 1) `provideScrapersForNode` use as default
|
|
10167
|
+
* 2) `provideScrapersForBrowser` use in limited browser environment *
|
|
10140
10168
|
* @public exported from `@promptbook/node`
|
|
10141
10169
|
*/
|
|
10142
10170
|
async function $provideScrapersForNode(tools, options) {
|
|
@@ -10243,11 +10271,11 @@ function parseKeywordsFromString(input) {
|
|
|
10243
10271
|
}
|
|
10244
10272
|
|
|
10245
10273
|
/**
|
|
10246
|
-
*
|
|
10274
|
+
* Converts a name string into a URI-compatible format.
|
|
10247
10275
|
*
|
|
10248
|
-
* @param name
|
|
10249
|
-
* @returns
|
|
10250
|
-
* @example
|
|
10276
|
+
* @param name The string to be converted to a URI-compatible format.
|
|
10277
|
+
* @returns A URI-compatible string derived from the input name.
|
|
10278
|
+
* @example 'Hello World' -> 'hello-world'
|
|
10251
10279
|
* @public exported from `@promptbook/utils`
|
|
10252
10280
|
*/
|
|
10253
10281
|
function nameToUriPart(name) {
|
|
@@ -10261,11 +10289,11 @@ function nameToUriPart(name) {
|
|
|
10261
10289
|
}
|
|
10262
10290
|
|
|
10263
10291
|
/**
|
|
10264
|
-
*
|
|
10292
|
+
* Converts a given name into URI-compatible parts.
|
|
10265
10293
|
*
|
|
10266
|
-
* @param name
|
|
10267
|
-
* @returns
|
|
10268
|
-
* @example
|
|
10294
|
+
* @param name The name to be converted into URI parts.
|
|
10295
|
+
* @returns An array of URI-compatible parts derived from the name.
|
|
10296
|
+
* @example 'Example Name' -> ['example', 'name']
|
|
10269
10297
|
* @public exported from `@promptbook/utils`
|
|
10270
10298
|
*/
|
|
10271
10299
|
function nameToUriParts(name) {
|
|
@@ -11072,7 +11100,10 @@ function stringifyPipelineJson(pipeline) {
|
|
|
11072
11100
|
*/
|
|
11073
11101
|
|
|
11074
11102
|
/**
|
|
11075
|
-
*
|
|
11103
|
+
* A storage implementation that caches data in files organized in a directory structure.
|
|
11104
|
+
* Provides methods for retrieving, storing, and managing cached data on the filesystem.
|
|
11105
|
+
*
|
|
11106
|
+
* This class implements the PromptbookStorage interface for filesystem-based caching.
|
|
11076
11107
|
*
|
|
11077
11108
|
* @public exported from `@promptbook/node`
|
|
11078
11109
|
*/
|
|
@@ -11085,7 +11116,8 @@ class FileCacheStorage {
|
|
|
11085
11116
|
}
|
|
11086
11117
|
}
|
|
11087
11118
|
/**
|
|
11088
|
-
*
|
|
11119
|
+
* Converts a storage key to a filesystem path where the data should be stored.
|
|
11120
|
+
* Creates a consistent, deterministic file path based on the key string.
|
|
11089
11121
|
*/
|
|
11090
11122
|
getFilenameForKey(key) {
|
|
11091
11123
|
// TODO: [👬] DRY
|
|
@@ -11097,7 +11129,8 @@ class FileCacheStorage {
|
|
|
11097
11129
|
...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${name.substring(0, MAX_FILENAME_LENGTH)}.json`);
|
|
11098
11130
|
}
|
|
11099
11131
|
/**
|
|
11100
|
-
*
|
|
11132
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
11133
|
+
* Retrieves the cached data from the file system storage.
|
|
11101
11134
|
*/
|
|
11102
11135
|
async getItem(key) {
|
|
11103
11136
|
const filename = this.getFilenameForKey(key);
|
|
@@ -11110,7 +11143,8 @@ class FileCacheStorage {
|
|
|
11110
11143
|
return value;
|
|
11111
11144
|
}
|
|
11112
11145
|
/**
|
|
11113
|
-
*
|
|
11146
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
11147
|
+
* Persists data to the file system, creating necessary directory structure if it doesn't exist.
|
|
11114
11148
|
*/
|
|
11115
11149
|
async setItem(key, value) {
|
|
11116
11150
|
const filename = this.getFilenameForKey(key);
|
|
@@ -11122,7 +11156,8 @@ class FileCacheStorage {
|
|
|
11122
11156
|
await writeFile(filename, fileContent, 'utf-8');
|
|
11123
11157
|
}
|
|
11124
11158
|
/**
|
|
11125
|
-
*
|
|
11159
|
+
* Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
|
|
11160
|
+
* Deletes the corresponding file from the filesystem.
|
|
11126
11161
|
*/
|
|
11127
11162
|
async removeItem(key) {
|
|
11128
11163
|
const filename = this.getFilenameForKey(key);
|