@promptbook/node 0.92.0-24 → 0.92.0-26
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 +88 -73
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +0 -2
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/constants.d.ts +8 -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/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/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/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 +88 -73
- 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-26';
|
|
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
|
|
@@ -666,13 +666,13 @@ const ORDER_OF_PIPELINE_JSON = [
|
|
|
666
666
|
*/
|
|
667
667
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
668
668
|
/**
|
|
669
|
-
*
|
|
669
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
670
670
|
*
|
|
671
671
|
* @private within the repository
|
|
672
672
|
*/
|
|
673
673
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
674
674
|
/**
|
|
675
|
-
*
|
|
675
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
676
676
|
*
|
|
677
677
|
* @private within the repository
|
|
678
678
|
*/
|
|
@@ -1675,8 +1675,8 @@ class MissingToolsError extends Error {
|
|
|
1675
1675
|
* @public exported from `@promptbook/core`
|
|
1676
1676
|
*/
|
|
1677
1677
|
function isPipelinePrepared(pipeline) {
|
|
1678
|
-
// Note: Ignoring `pipeline.preparations`
|
|
1679
|
-
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1678
|
+
// Note: Ignoring `pipeline.preparations`
|
|
1679
|
+
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1680
1680
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1681
1681
|
// TODO: !!! Comment this out
|
|
1682
1682
|
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
@@ -2860,7 +2860,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
2860
2860
|
else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
|
|
2861
2861
|
}
|
|
2862
2862
|
if (expectedParameterNames.size === 0) {
|
|
2863
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
2863
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
2864
2864
|
Object.freeze(mappedParameters);
|
|
2865
2865
|
return mappedParameters;
|
|
2866
2866
|
}
|
|
@@ -2891,7 +2891,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
2891
2891
|
for (let i = 0; i < expectedParameterNames.size; i++) {
|
|
2892
2892
|
mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
|
|
2893
2893
|
}
|
|
2894
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
2894
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
2895
2895
|
Object.freeze(mappedParameters);
|
|
2896
2896
|
return mappedParameters;
|
|
2897
2897
|
}
|
|
@@ -3642,10 +3642,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
3642
3642
|
*/
|
|
3643
3643
|
|
|
3644
3644
|
/**
|
|
3645
|
-
*
|
|
3645
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
3646
3646
|
*
|
|
3647
|
-
* @param input
|
|
3648
|
-
* @returns
|
|
3647
|
+
* @param input The string containing diacritics to be normalized.
|
|
3648
|
+
* @returns The string with diacritics removed or normalized.
|
|
3649
3649
|
* @public exported from `@promptbook/utils`
|
|
3650
3650
|
*/
|
|
3651
3651
|
function removeDiacritics(input) {
|
|
@@ -4133,11 +4133,10 @@ async function executeFormatSubvalues(options) {
|
|
|
4133
4133
|
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
4134
4134
|
${error.message}
|
|
4135
4135
|
|
|
4136
|
-
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})
|
|
4137
4137
|
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
4138
4138
|
|
|
4139
4139
|
${block(pipelineIdentification)}
|
|
4140
|
-
Subparameter index: ${index}
|
|
4141
4140
|
`));
|
|
4142
4141
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4143
4142
|
console.error(highLevelError);
|
|
@@ -4165,12 +4164,11 @@ async function executeFormatSubvalues(options) {
|
|
|
4165
4164
|
catch (error) {
|
|
4166
4165
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4167
4166
|
console.error(spaceTrim((block) => `
|
|
4168
|
-
|
|
4167
|
+
${error.message}
|
|
4169
4168
|
|
|
4170
|
-
${
|
|
4169
|
+
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
4171
4170
|
|
|
4172
4171
|
${block(pipelineIdentification)}
|
|
4173
|
-
Subparameter index: ${index}
|
|
4174
4172
|
`));
|
|
4175
4173
|
return FAILED_VALUE_PLACEHOLDER;
|
|
4176
4174
|
}
|
|
@@ -5023,10 +5021,10 @@ function $getGlobalScope() {
|
|
|
5023
5021
|
}
|
|
5024
5022
|
|
|
5025
5023
|
/**
|
|
5026
|
-
*
|
|
5024
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
5027
5025
|
*
|
|
5028
|
-
* @param text
|
|
5029
|
-
* @returns
|
|
5026
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
5027
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
5030
5028
|
* @example 'HELLO_WORLD'
|
|
5031
5029
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
5032
5030
|
* @public exported from `@promptbook/utils`
|
|
@@ -5078,10 +5076,10 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
5078
5076
|
*/
|
|
5079
5077
|
|
|
5080
5078
|
/**
|
|
5081
|
-
*
|
|
5079
|
+
* Normalizes a text string to snake_case format.
|
|
5082
5080
|
*
|
|
5083
|
-
* @param text
|
|
5084
|
-
* @returns
|
|
5081
|
+
* @param text The text string to be converted to snake_case format.
|
|
5082
|
+
* @returns The normalized text in snake_case format.
|
|
5085
5083
|
* @example 'hello_world'
|
|
5086
5084
|
* @example 'i_love_promptbook'
|
|
5087
5085
|
* @public exported from `@promptbook/utils`
|
|
@@ -5151,10 +5149,11 @@ const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
|
5151
5149
|
*/
|
|
5152
5150
|
|
|
5153
5151
|
/**
|
|
5154
|
-
*
|
|
5152
|
+
* Registry for all available scrapers in the system.
|
|
5153
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
5155
5154
|
*
|
|
5156
5155
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
5157
|
-
* @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
|
|
5158
5157
|
* @public exported from `@promptbook/core`
|
|
5159
5158
|
*/
|
|
5160
5159
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
@@ -5250,10 +5249,10 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
5250
5249
|
*/
|
|
5251
5250
|
|
|
5252
5251
|
/**
|
|
5253
|
-
*
|
|
5252
|
+
* Converts a given text to kebab-case format.
|
|
5254
5253
|
*
|
|
5255
|
-
* @param text
|
|
5256
|
-
* @returns
|
|
5254
|
+
* @param text The text to be converted.
|
|
5255
|
+
* @returns The kebab-case formatted string.
|
|
5257
5256
|
* @example 'hello-world'
|
|
5258
5257
|
* @example 'i-love-promptbook'
|
|
5259
5258
|
* @public exported from `@promptbook/utils`
|
|
@@ -5322,7 +5321,8 @@ function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
|
5322
5321
|
*/
|
|
5323
5322
|
|
|
5324
5323
|
/**
|
|
5325
|
-
*
|
|
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.
|
|
5326
5326
|
*
|
|
5327
5327
|
* @private for `FileCacheStorage`
|
|
5328
5328
|
*/
|
|
@@ -5402,11 +5402,11 @@ function removeEmojis(text) {
|
|
|
5402
5402
|
}
|
|
5403
5403
|
|
|
5404
5404
|
/**
|
|
5405
|
-
*
|
|
5405
|
+
* Converts a title string into a normalized name.
|
|
5406
5406
|
*
|
|
5407
|
-
* @param value
|
|
5408
|
-
* @returns
|
|
5409
|
-
* @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'
|
|
5410
5410
|
* @public exported from `@promptbook/utils`
|
|
5411
5411
|
*/
|
|
5412
5412
|
function titleToName(value) {
|
|
@@ -5457,7 +5457,9 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
5457
5457
|
*/
|
|
5458
5458
|
|
|
5459
5459
|
/**
|
|
5460
|
-
*
|
|
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.
|
|
5461
5463
|
*
|
|
5462
5464
|
* @public exported from `@promptbook/core`
|
|
5463
5465
|
*/
|
|
@@ -5698,9 +5700,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
5698
5700
|
*/
|
|
5699
5701
|
|
|
5700
5702
|
/**
|
|
5701
|
-
*
|
|
5703
|
+
* Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
|
|
5702
5704
|
*
|
|
5703
|
-
* @
|
|
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`
|
|
5704
5709
|
*/
|
|
5705
5710
|
async function prepareTasks(pipeline, tools, options) {
|
|
5706
5711
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
|
|
@@ -6606,11 +6611,11 @@ const expectCommandParser = {
|
|
|
6606
6611
|
};
|
|
6607
6612
|
|
|
6608
6613
|
/**
|
|
6609
|
-
*
|
|
6614
|
+
* Normalizes a given text to camelCase format.
|
|
6610
6615
|
*
|
|
6611
|
-
* @param text
|
|
6612
|
-
* @param _isFirstLetterCapital
|
|
6613
|
-
* @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.
|
|
6614
6619
|
* @example 'helloWorld'
|
|
6615
6620
|
* @example 'iLovePromptbook'
|
|
6616
6621
|
* @public exported from `@promptbook/utils`
|
|
@@ -7098,7 +7103,7 @@ const GeneratorFormfactorDefinition = {
|
|
|
7098
7103
|
};
|
|
7099
7104
|
|
|
7100
7105
|
/**
|
|
7101
|
-
*
|
|
7106
|
+
* Pipeline interface which is equivalent to `any`
|
|
7102
7107
|
*
|
|
7103
7108
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
7104
7109
|
*
|
|
@@ -7428,8 +7433,7 @@ const jokerCommandParser = {
|
|
|
7428
7433
|
};
|
|
7429
7434
|
|
|
7430
7435
|
/**
|
|
7431
|
-
*
|
|
7432
|
-
*
|
|
7436
|
+
* @see {@link ModelVariant}
|
|
7433
7437
|
* @public exported from `@promptbook/core`
|
|
7434
7438
|
*/
|
|
7435
7439
|
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
@@ -8402,7 +8406,7 @@ function parseCommandVariant(input) {
|
|
|
8402
8406
|
}
|
|
8403
8407
|
|
|
8404
8408
|
/**
|
|
8405
|
-
*
|
|
8409
|
+
* Extracts the interface (input and output parameters) from a pipeline.
|
|
8406
8410
|
*
|
|
8407
8411
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8408
8412
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8435,7 +8439,7 @@ function getPipelineInterface(pipeline) {
|
|
|
8435
8439
|
}
|
|
8436
8440
|
|
|
8437
8441
|
/**
|
|
8438
|
-
*
|
|
8442
|
+
* Checks if two pipeline interfaces are structurally identical.
|
|
8439
8443
|
*
|
|
8440
8444
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8441
8445
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8467,10 +8471,11 @@ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
|
|
|
8467
8471
|
}
|
|
8468
8472
|
|
|
8469
8473
|
/**
|
|
8470
|
-
*
|
|
8474
|
+
* Checks if a given pipeline satisfies the requirements of a specified pipeline interface.
|
|
8471
8475
|
*
|
|
8472
8476
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8473
8477
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
8478
|
+
* @returns `true` if the pipeline implements the interface, `false` otherwise.
|
|
8474
8479
|
*
|
|
8475
8480
|
* @public exported from `@promptbook/core`
|
|
8476
8481
|
*/
|
|
@@ -8656,7 +8661,8 @@ function removeMarkdownComments(content) {
|
|
|
8656
8661
|
}
|
|
8657
8662
|
|
|
8658
8663
|
/**
|
|
8659
|
-
*
|
|
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).
|
|
8660
8666
|
*
|
|
8661
8667
|
* @public exported from `@promptbook/editable`
|
|
8662
8668
|
*/
|
|
@@ -8677,7 +8683,10 @@ function isFlatPipeline(pipelineString) {
|
|
|
8677
8683
|
}
|
|
8678
8684
|
|
|
8679
8685
|
/**
|
|
8680
|
-
*
|
|
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.
|
|
8681
8690
|
*
|
|
8682
8691
|
* @public exported from `@promptbook/editable`
|
|
8683
8692
|
*/
|
|
@@ -8734,7 +8743,7 @@ function deflatePipeline(pipelineString) {
|
|
|
8734
8743
|
* Note: It can not work with html syntax and comments
|
|
8735
8744
|
*
|
|
8736
8745
|
* @param markdown any valid markdown
|
|
8737
|
-
* @returns
|
|
8746
|
+
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
8738
8747
|
* @public exported from `@promptbook/markdown-utils`
|
|
8739
8748
|
*/
|
|
8740
8749
|
function extractAllListItemsFromMarkdown(markdown) {
|
|
@@ -9589,7 +9598,8 @@ async function locateAppOnLinux({ linuxWhich, }) {
|
|
|
9589
9598
|
*/
|
|
9590
9599
|
|
|
9591
9600
|
/**
|
|
9592
|
-
*
|
|
9601
|
+
* Provides filesystem access (for example for Node.js-based scrapers)
|
|
9602
|
+
* Creates a standardized filesystem interface that scrapers can use for file operations.
|
|
9593
9603
|
*
|
|
9594
9604
|
* @public exported from `@promptbook/node`
|
|
9595
9605
|
*/
|
|
@@ -9794,10 +9804,10 @@ async function $provideExecutablesForNode(options) {
|
|
|
9794
9804
|
*/
|
|
9795
9805
|
|
|
9796
9806
|
/**
|
|
9797
|
-
*
|
|
9807
|
+
* Register for LLM tools metadata.
|
|
9798
9808
|
*
|
|
9799
9809
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
9800
|
-
* @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.
|
|
9801
9811
|
* @public exported from `@promptbook/core`
|
|
9802
9812
|
*/
|
|
9803
9813
|
const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
@@ -9825,10 +9835,10 @@ function isRootPath(value) {
|
|
|
9825
9835
|
*/
|
|
9826
9836
|
|
|
9827
9837
|
/**
|
|
9828
|
-
*
|
|
9838
|
+
* Register for LLM tools.
|
|
9829
9839
|
*
|
|
9830
9840
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
9831
|
-
* @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.
|
|
9832
9842
|
* @public exported from `@promptbook/core`
|
|
9833
9843
|
*/
|
|
9834
9844
|
const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
@@ -10021,9 +10031,8 @@ async function $provideEnvFilename() {
|
|
|
10021
10031
|
*/
|
|
10022
10032
|
|
|
10023
10033
|
/**
|
|
10024
|
-
*
|
|
10034
|
+
* Provides LLM tools configuration by reading environment variables.
|
|
10025
10035
|
*
|
|
10026
|
-
* @@@ .env
|
|
10027
10036
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
10028
10037
|
*
|
|
10029
10038
|
* It looks for environment variables:
|
|
@@ -10031,7 +10040,8 @@ async function $provideEnvFilename() {
|
|
|
10031
10040
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
10032
10041
|
* - ...
|
|
10033
10042
|
*
|
|
10034
|
-
* @
|
|
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.
|
|
10035
10045
|
* @public exported from `@promptbook/node`
|
|
10036
10046
|
*/
|
|
10037
10047
|
async function $provideLlmToolsConfigurationFromEnv() {
|
|
@@ -10152,11 +10162,9 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
10152
10162
|
*/
|
|
10153
10163
|
|
|
10154
10164
|
/**
|
|
10155
|
-
*
|
|
10156
|
-
*
|
|
10157
|
-
*
|
|
10158
|
-
* 2) @@@
|
|
10159
|
-
*
|
|
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 *
|
|
10160
10168
|
* @public exported from `@promptbook/node`
|
|
10161
10169
|
*/
|
|
10162
10170
|
async function $provideScrapersForNode(tools, options) {
|
|
@@ -10263,11 +10271,11 @@ function parseKeywordsFromString(input) {
|
|
|
10263
10271
|
}
|
|
10264
10272
|
|
|
10265
10273
|
/**
|
|
10266
|
-
*
|
|
10274
|
+
* Converts a name string into a URI-compatible format.
|
|
10267
10275
|
*
|
|
10268
|
-
* @param name
|
|
10269
|
-
* @returns
|
|
10270
|
-
* @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'
|
|
10271
10279
|
* @public exported from `@promptbook/utils`
|
|
10272
10280
|
*/
|
|
10273
10281
|
function nameToUriPart(name) {
|
|
@@ -10281,11 +10289,11 @@ function nameToUriPart(name) {
|
|
|
10281
10289
|
}
|
|
10282
10290
|
|
|
10283
10291
|
/**
|
|
10284
|
-
*
|
|
10292
|
+
* Converts a given name into URI-compatible parts.
|
|
10285
10293
|
*
|
|
10286
|
-
* @param name
|
|
10287
|
-
* @returns
|
|
10288
|
-
* @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']
|
|
10289
10297
|
* @public exported from `@promptbook/utils`
|
|
10290
10298
|
*/
|
|
10291
10299
|
function nameToUriParts(name) {
|
|
@@ -11092,7 +11100,10 @@ function stringifyPipelineJson(pipeline) {
|
|
|
11092
11100
|
*/
|
|
11093
11101
|
|
|
11094
11102
|
/**
|
|
11095
|
-
*
|
|
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.
|
|
11096
11107
|
*
|
|
11097
11108
|
* @public exported from `@promptbook/node`
|
|
11098
11109
|
*/
|
|
@@ -11105,7 +11116,8 @@ class FileCacheStorage {
|
|
|
11105
11116
|
}
|
|
11106
11117
|
}
|
|
11107
11118
|
/**
|
|
11108
|
-
*
|
|
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.
|
|
11109
11121
|
*/
|
|
11110
11122
|
getFilenameForKey(key) {
|
|
11111
11123
|
// TODO: [👬] DRY
|
|
@@ -11117,7 +11129,8 @@ class FileCacheStorage {
|
|
|
11117
11129
|
...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${name.substring(0, MAX_FILENAME_LENGTH)}.json`);
|
|
11118
11130
|
}
|
|
11119
11131
|
/**
|
|
11120
|
-
*
|
|
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.
|
|
11121
11134
|
*/
|
|
11122
11135
|
async getItem(key) {
|
|
11123
11136
|
const filename = this.getFilenameForKey(key);
|
|
@@ -11130,7 +11143,8 @@ class FileCacheStorage {
|
|
|
11130
11143
|
return value;
|
|
11131
11144
|
}
|
|
11132
11145
|
/**
|
|
11133
|
-
*
|
|
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.
|
|
11134
11148
|
*/
|
|
11135
11149
|
async setItem(key, value) {
|
|
11136
11150
|
const filename = this.getFilenameForKey(key);
|
|
@@ -11142,7 +11156,8 @@ class FileCacheStorage {
|
|
|
11142
11156
|
await writeFile(filename, fileContent, 'utf-8');
|
|
11143
11157
|
}
|
|
11144
11158
|
/**
|
|
11145
|
-
*
|
|
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.
|
|
11146
11161
|
*/
|
|
11147
11162
|
async removeItem(key) {
|
|
11148
11163
|
const filename = this.getFilenameForKey(key);
|