@promptbook/website-crawler 0.104.0-9 → 0.104.0

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 (60) hide show
  1. package/README.md +0 -4
  2. package/esm/index.es.js +34 -25
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +0 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +8 -6
  6. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
  9. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +12 -2
  10. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  11. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  12. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +6 -3
  14. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
  15. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
  16. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
  17. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
  18. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
  19. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
  20. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
  21. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
  22. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
  23. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
  24. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  25. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  26. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  27. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  28. package/esm/typings/src/config.d.ts +8 -1
  29. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  31. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
  34. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
  37. package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
  38. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  40. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
  41. package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
  42. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  43. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  44. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  45. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  46. package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
  47. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  48. package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
  49. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
  50. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  51. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  52. package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
  53. package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
  54. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  55. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
  56. package/esm/typings/src/version.d.ts +1 -1
  57. package/package.json +2 -2
  58. package/umd/index.umd.js +34 -25
  59. package/umd/index.umd.js.map +1 -1
  60. package/esm/typings/servers.d.ts +0 -50
package/README.md CHANGED
@@ -27,10 +27,6 @@ Turn your company's scattered knowledge into AI ready Books
27
27
 
28
28
 
29
29
 
30
- <blockquote style="color: #ff8811">
31
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
32
- </blockquote>
33
-
34
30
  ## 📦 Package `@promptbook/website-crawler`
35
31
 
36
32
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
package/esm/index.es.js CHANGED
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-9';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1746,8 +1746,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
1746
1746
  */
1747
1747
  function removeDiacritics(input) {
1748
1748
  /*eslint no-control-regex: "off"*/
1749
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
1750
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
1749
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
1750
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
1751
1751
  });
1752
1752
  }
1753
1753
  /**
@@ -1868,9 +1868,10 @@ function isValidFilePath(filename) {
1868
1868
  *
1869
1869
  * Note: [🔂] This function is idempotent.
1870
1870
  * Note: Dataurl are considered perfectly valid.
1871
- * Note: There are two similar functions:
1872
- * - `isValidUrl` which tests any URL
1873
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
1871
+ * Note: There are few similar functions:
1872
+ * - `isValidUrl` *(this one)* which tests any URL
1873
+ * - `isValidAgentUrl` which tests just agent URL
1874
+ * - `isValidPipelineUrl` which tests just pipeline URL
1874
1875
  *
1875
1876
  * @public exported from `@promptbook/utils`
1876
1877
  */
@@ -2639,8 +2640,9 @@ function isValidPromptbookVersion(version) {
2639
2640
  /**
2640
2641
  * Tests if given string is valid pipeline URL URL.
2641
2642
  *
2642
- * Note: There are two similar functions:
2643
+ * Note: There are few similar functions:
2643
2644
  * - `isValidUrl` which tests any URL
2645
+ * - `isValidAgentUrl` which tests just agent URL
2644
2646
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
2645
2647
  *
2646
2648
  * @public exported from `@promptbook/utils`
@@ -3886,7 +3888,7 @@ async function forEachAsync(array, options, callbackfunction) {
3886
3888
  tasks.push(task);
3887
3889
  runningTasks.push(task);
3888
3890
  /* not await */ Promise.resolve(task).then(() => {
3889
- runningTasks = runningTasks.filter((t) => t !== task);
3891
+ runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
3890
3892
  });
3891
3893
  if (maxParallelCount < runningTasks.length) {
3892
3894
  await Promise.race(runningTasks);
@@ -3943,10 +3945,14 @@ function addUsage(...usageItems) {
3943
3945
  }
3944
3946
 
3945
3947
  /**
3946
- * Intercepts LLM tools and counts total usage of the tools
3948
+ * Intercepts LLM tools and counts total usage of the tools.
3949
+ *
3950
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
3951
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
3952
+ * in real-time through an observable.
3947
3953
  *
3948
- * @param llmTools LLM tools to be intercepted with usage counting
3949
- * @returns LLM tools with same functionality with added total cost counting
3954
+ * @param llmTools - The LLM tools to be intercepted and tracked
3955
+ * @returns An augmented version of the tools that includes usage tracking capabilities
3950
3956
  * @public exported from `@promptbook/core`
3951
3957
  */
3952
3958
  function countUsage(llmTools) {
@@ -4021,7 +4027,7 @@ function countUsage(llmTools) {
4021
4027
  * TODO: [🧠] Is there some meaningfull way how to test this util
4022
4028
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
4023
4029
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
4024
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4030
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
4025
4031
  */
4026
4032
 
4027
4033
  /**
@@ -4211,17 +4217,21 @@ class MultipleLlmExecutionTools {
4211
4217
  */
4212
4218
 
4213
4219
  /**
4214
- * Joins multiple LLM Execution Tools into one
4220
+ * Joins multiple LLM Execution Tools into one.
4215
4221
  *
4216
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
4222
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
4223
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
4217
4224
  *
4218
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
4219
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
4220
- * 2) If there are multiple LlmExecutionTools, first will be used first, second will be used if the first hasn`t defined model variant or fails, etc.
4221
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
4225
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
4226
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
4227
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
4228
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
4222
4229
  *
4230
+ * @param title - A descriptive title for this collection of joined tools
4231
+ * @param llmExecutionTools - An array of execution tools to be joined
4232
+ * @returns A single unified execution tool wrapper
4223
4233
  *
4224
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
4234
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
4225
4235
  *
4226
4236
  * @public exported from `@promptbook/core`
4227
4237
  */
@@ -4261,7 +4271,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4261
4271
  }
4262
4272
  /**
4263
4273
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4264
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4274
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
4265
4275
  */
4266
4276
 
4267
4277
  /**
@@ -4278,7 +4288,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
4278
4288
  }
4279
4289
  /**
4280
4290
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4281
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4291
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
4282
4292
  */
4283
4293
 
4284
4294
  /**
@@ -4564,7 +4574,6 @@ const promptbookFetch = async (urlOrRequest, init) => {
4564
4574
  * @public exported from `@promptbook/core`
4565
4575
  */
4566
4576
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4567
- // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
4568
4577
  var _a;
4569
4578
  const { fetch = promptbookFetch } = tools;
4570
4579
  const { knowledgeSourceContent } = knowledgeSource;
@@ -6636,7 +6645,7 @@ async function getKnowledgeForTask(options) {
6636
6645
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6637
6646
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6638
6647
  const { index } = knowledgePiece;
6639
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
6648
+ const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
6640
6649
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
6641
6650
  if (knowledgePieceIndex === undefined) {
6642
6651
  return {
@@ -7084,7 +7093,7 @@ async function executePipeline(options) {
7084
7093
  resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
7085
7094
  })
7086
7095
  .then(() => {
7087
- resolving = resolving.filter((w) => w !== work);
7096
+ resolving = resolving.filter((workItem) => workItem !== work);
7088
7097
  });
7089
7098
  // <- Note: Errors are catched here [3]
7090
7099
  // TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
@@ -7250,7 +7259,7 @@ function createPipelineExecutor(options) {
7250
7259
  // Calculate and update tldr based on pipeline progress
7251
7260
  const cv = newOngoingResult;
7252
7261
  // Calculate progress based on parameters resolved vs total parameters
7253
- const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
7262
+ const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
7254
7263
  let resolvedParameters = 0;
7255
7264
  let currentTaskTitle = '';
7256
7265
  // Get the resolved parameters from output parameters