@promptbook/remote-server 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.
Files changed (72) hide show
  1. package/esm/index.es.js +60 -56
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +0 -2
  4. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
  5. package/esm/typings/src/constants.d.ts +8 -2
  6. package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
  7. package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
  8. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
  9. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
  10. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
  11. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -5
  12. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
  13. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
  14. package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
  15. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
  16. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
  17. package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
  18. package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
  19. package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
  20. package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
  21. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  22. package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
  23. package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
  24. package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
  25. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
  26. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
  27. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
  28. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  29. package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
  30. package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
  31. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
  32. package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
  33. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
  34. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
  35. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
  36. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
  37. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
  38. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
  39. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
  40. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  41. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
  42. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
  43. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
  44. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
  45. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
  46. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
  47. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
  48. package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
  49. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
  50. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
  51. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
  52. package/esm/typings/src/types/ModelVariant.d.ts +5 -5
  53. package/esm/typings/src/types/typeAliases.d.ts +8 -6
  54. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
  55. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
  56. package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
  57. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
  58. package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
  59. package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
  60. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
  61. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
  62. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
  63. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
  64. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
  65. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
  66. package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
  67. package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
  68. package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
  69. package/esm/typings/src/version.d.ts +2 -1
  70. package/package.json +2 -2
  71. package/umd/index.umd.js +60 -56
  72. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
33
33
  * @generated
34
34
  * @see https://github.com/webgptorg/promptbook
35
35
  */
36
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-26';
37
37
  /**
38
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
39
39
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -892,7 +892,8 @@ async function locateAppOnLinux({ linuxWhich, }) {
892
892
  */
893
893
 
894
894
  /**
895
- * @@@
895
+ * Provides filesystem access (for example for Node.js-based scrapers)
896
+ * Creates a standardized filesystem interface that scrapers can use for file operations.
896
897
  *
897
898
  * @public exported from `@promptbook/node`
898
899
  */
@@ -1364,13 +1365,13 @@ const ORDER_OF_PIPELINE_JSON = [
1364
1365
  */
1365
1366
  const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
1366
1367
  /**
1367
- * @@@
1368
+ * Placeholder value indicating a parameter is missing its value.
1368
1369
  *
1369
1370
  * @private within the repository
1370
1371
  */
1371
1372
  const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1372
1373
  /**
1373
- * @@@
1374
+ * Placeholder value indicating a parameter is restricted and cannot be used directly.
1374
1375
  *
1375
1376
  * @private within the repository
1376
1377
  */
@@ -1801,8 +1802,8 @@ function validatePipeline_InnerFunction(pipeline) {
1801
1802
  * @public exported from `@promptbook/core`
1802
1803
  */
1803
1804
  function isPipelinePrepared(pipeline) {
1804
- // Note: Ignoring `pipeline.preparations` @@@
1805
- // Note: Ignoring `pipeline.knowledgePieces` @@@
1805
+ // Note: Ignoring `pipeline.preparations`
1806
+ // Note: Ignoring `pipeline.knowledgePieces`
1806
1807
  if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
1807
1808
  // TODO: !!! Comment this out
1808
1809
  console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
@@ -3044,10 +3045,10 @@ function $getGlobalScope() {
3044
3045
  }
3045
3046
 
3046
3047
  /**
3047
- * @@@
3048
+ * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
3048
3049
  *
3049
- * @param text @@@
3050
- * @returns @@@
3050
+ * @param text The text string to be converted to SCREAMING_CASE format.
3051
+ * @returns The normalized text in SCREAMING_CASE format.
3051
3052
  * @example 'HELLO_WORLD'
3052
3053
  * @example 'I_LOVE_PROMPTBOOK'
3053
3054
  * @public exported from `@promptbook/utils`
@@ -3099,10 +3100,10 @@ function normalizeTo_SCREAMING_CASE(text) {
3099
3100
  */
3100
3101
 
3101
3102
  /**
3102
- * @@@
3103
+ * Normalizes a text string to snake_case format.
3103
3104
  *
3104
- * @param text @@@
3105
- * @returns @@@
3105
+ * @param text The text string to be converted to snake_case format.
3106
+ * @returns The normalized text in snake_case format.
3106
3107
  * @example 'hello_world'
3107
3108
  * @example 'i_love_promptbook'
3108
3109
  * @public exported from `@promptbook/utils`
@@ -3172,10 +3173,11 @@ const $scrapersMetadataRegister = new $Register('scrapers_metadata');
3172
3173
  */
3173
3174
 
3174
3175
  /**
3175
- * @@@
3176
+ * Registry for all available scrapers in the system.
3177
+ * Central point for registering and accessing different types of content scrapers.
3176
3178
  *
3177
3179
  * Note: `$` is used to indicate that this interacts with the global scope
3178
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
3180
+ * @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
3179
3181
  * @public exported from `@promptbook/core`
3180
3182
  */
3181
3183
  const $scrapersRegister = new $Register('scraper_constructors');
@@ -3515,10 +3517,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
3515
3517
  */
3516
3518
 
3517
3519
  /**
3518
- * @@@
3520
+ * Removes diacritic marks (accents) from characters in a string.
3519
3521
  *
3520
- * @param input @@@
3521
- * @returns @@@
3522
+ * @param input The string containing diacritics to be normalized.
3523
+ * @returns The string with diacritics removed or normalized.
3522
3524
  * @public exported from `@promptbook/utils`
3523
3525
  */
3524
3526
  function removeDiacritics(input) {
@@ -3532,10 +3534,10 @@ function removeDiacritics(input) {
3532
3534
  */
3533
3535
 
3534
3536
  /**
3535
- * @@@
3537
+ * Converts a given text to kebab-case format.
3536
3538
  *
3537
- * @param text @@@
3538
- * @returns @@@
3539
+ * @param text The text to be converted.
3540
+ * @returns The kebab-case formatted string.
3539
3541
  * @example 'hello-world'
3540
3542
  * @example 'i-love-promptbook'
3541
3543
  * @public exported from `@promptbook/utils`
@@ -3604,7 +3606,8 @@ function knowledgeSourceContentToName(knowledgeSourceContent) {
3604
3606
  */
3605
3607
 
3606
3608
  /**
3607
- * @@@
3609
+ * Converts a name to a properly formatted subfolder path for cache storage.
3610
+ * Handles normalization and path formatting to create consistent cache directory structures.
3608
3611
  *
3609
3612
  * @private for `FileCacheStorage`
3610
3613
  */
@@ -3684,11 +3687,11 @@ function removeEmojis(text) {
3684
3687
  }
3685
3688
 
3686
3689
  /**
3687
- * @@@
3690
+ * Converts a title string into a normalized name.
3688
3691
  *
3689
- * @param value @@@
3690
- * @returns @@@
3691
- * @example @@@
3692
+ * @param value The title string to be converted to a name.
3693
+ * @returns A normalized name derived from the input title.
3694
+ * @example 'Hello World!' -> 'hello-world'
3692
3695
  * @public exported from `@promptbook/utils`
3693
3696
  */
3694
3697
  function titleToName(value) {
@@ -3739,7 +3742,9 @@ const promptbookFetch = async (urlOrRequest, init) => {
3739
3742
  */
3740
3743
 
3741
3744
  /**
3742
- * @@@
3745
+ * Factory function that creates a handler for processing knowledge sources.
3746
+ * Provides standardized processing of different types of knowledge sources
3747
+ * across various scraper implementations.
3743
3748
  *
3744
3749
  * @public exported from `@promptbook/core`
3745
3750
  */
@@ -3980,9 +3985,12 @@ TODO: [🧊] This is how it can look in future
3980
3985
  */
3981
3986
 
3982
3987
  /**
3983
- * @@@
3988
+ * Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
3984
3989
  *
3985
- * @public exported from `@promptbook/core`
3990
+ * @param tasks Sequence of tasks that are chained together to form a pipeline
3991
+ * @returns A promise that resolves to the prepared tasks.
3992
+ *
3993
+ * @private internal utility of `preparePipeline`
3986
3994
  */
3987
3995
  async function prepareTasks(pipeline, tools, options) {
3988
3996
  const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
@@ -4745,7 +4753,7 @@ function mapAvailableToExpectedParameters(options) {
4745
4753
  else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
4746
4754
  }
4747
4755
  if (expectedParameterNames.size === 0) {
4748
- // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent @@@
4756
+ // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
4749
4757
  Object.freeze(mappedParameters);
4750
4758
  return mappedParameters;
4751
4759
  }
@@ -4776,7 +4784,7 @@ function mapAvailableToExpectedParameters(options) {
4776
4784
  for (let i = 0; i < expectedParameterNames.size; i++) {
4777
4785
  mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
4778
4786
  }
4779
- // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent @@@
4787
+ // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
4780
4788
  Object.freeze(mappedParameters);
4781
4789
  return mappedParameters;
4782
4790
  }
@@ -5546,11 +5554,10 @@ async function executeFormatSubvalues(options) {
5546
5554
  const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
5547
5555
  ${error.message}
5548
5556
 
5549
- This is error in FOREACH command when mapping data
5557
+ This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
5550
5558
  You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
5551
5559
 
5552
5560
  ${block(pipelineIdentification)}
5553
- Subparameter index: ${index}
5554
5561
  `));
5555
5562
  if (length > BIG_DATASET_TRESHOLD) {
5556
5563
  console.error(highLevelError);
@@ -5578,12 +5585,11 @@ async function executeFormatSubvalues(options) {
5578
5585
  catch (error) {
5579
5586
  if (length > BIG_DATASET_TRESHOLD) {
5580
5587
  console.error(spaceTrim((block) => `
5581
- Error in FOREACH command:
5588
+ ${error.message}
5582
5589
 
5583
- ${block(pipelineIdentification)}
5590
+ This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
5584
5591
 
5585
5592
  ${block(pipelineIdentification)}
5586
- Subparameter index: ${index}
5587
5593
  `));
5588
5594
  return FAILED_VALUE_PLACEHOLDER;
5589
5595
  }
@@ -6256,10 +6262,10 @@ function createPipelineExecutor(options) {
6256
6262
  }
6257
6263
 
6258
6264
  /**
6259
- * @@@
6265
+ * Register for LLM tools.
6260
6266
  *
6261
6267
  * Note: `$` is used to indicate that this interacts with the global scope
6262
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
6268
+ * @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
6263
6269
  * @public exported from `@promptbook/core`
6264
6270
  */
6265
6271
  const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
@@ -6268,10 +6274,10 @@ const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
6268
6274
  */
6269
6275
 
6270
6276
  /**
6271
- * @@@
6277
+ * Register for LLM tools metadata.
6272
6278
  *
6273
6279
  * Note: `$` is used to indicate that this interacts with the global scope
6274
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
6280
+ * @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
6275
6281
  * @public exported from `@promptbook/core`
6276
6282
  */
6277
6283
  const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
@@ -6455,11 +6461,9 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
6455
6461
  */
6456
6462
 
6457
6463
  /**
6458
- * @@@
6459
- *
6460
- * 1) @@@
6461
- * 2) @@@
6462
- *
6464
+ * Provides a collection of scrapers optimized for Node.js environment.
6465
+ * 1) `provideScrapersForNode` use as default
6466
+ * 2) `provideScrapersForBrowser` use in limited browser environment *
6463
6467
  * @public exported from `@promptbook/node`
6464
6468
  */
6465
6469
  async function $provideScrapersForNode(tools, options) {
@@ -6484,11 +6488,11 @@ async function $provideScrapersForNode(tools, options) {
6484
6488
  */
6485
6489
 
6486
6490
  /**
6487
- * @@@
6491
+ * Normalizes a given text to camelCase format.
6488
6492
  *
6489
- * @param text @@@
6490
- * @param _isFirstLetterCapital @@@
6491
- * @returns @@@
6493
+ * @param text The text to be normalized.
6494
+ * @param _isFirstLetterCapital Whether the first letter should be capitalized.
6495
+ * @returns The camelCase formatted string.
6492
6496
  * @example 'helloWorld'
6493
6497
  * @example 'iLovePromptbook'
6494
6498
  * @public exported from `@promptbook/utils`
@@ -6618,11 +6622,11 @@ function parseKeywordsFromString(input) {
6618
6622
  }
6619
6623
 
6620
6624
  /**
6621
- * @@@
6625
+ * Converts a name string into a URI-compatible format.
6622
6626
  *
6623
- * @param name @@@
6624
- * @returns @@@
6625
- * @example @@@
6627
+ * @param name The string to be converted to a URI-compatible format.
6628
+ * @returns A URI-compatible string derived from the input name.
6629
+ * @example 'Hello World' -> 'hello-world'
6626
6630
  * @public exported from `@promptbook/utils`
6627
6631
  */
6628
6632
  function nameToUriPart(name) {
@@ -6636,11 +6640,11 @@ function nameToUriPart(name) {
6636
6640
  }
6637
6641
 
6638
6642
  /**
6639
- * @@@
6643
+ * Converts a given name into URI-compatible parts.
6640
6644
  *
6641
- * @param name @@@
6642
- * @returns @@@
6643
- * @example @@@
6645
+ * @param name The name to be converted into URI parts.
6646
+ * @returns An array of URI-compatible parts derived from the name.
6647
+ * @example 'Example Name' -> ['example', 'name']
6644
6648
  * @public exported from `@promptbook/utils`
6645
6649
  */
6646
6650
  function nameToUriParts(name) {